113 |
return ($user_id,$user_pwd); |
return ($user_id,$user_pwd); |
114 |
} |
} |
115 |
|
|
116 |
my $ant_password_protected; |
my $ant_unknown_password; |
117 |
|
my $ant_ok_password; |
118 |
|
|
119 |
sub ant_another_passwd { |
sub ant_another_passwd { |
120 |
my $ant = shift || die "no ant?"; |
my $ant = shift || die "no ant?"; |
121 |
return if ( $ant_password_protected->{$ant} ); |
return 0 if ( $ant_unknown_password->{$ant} ); |
122 |
|
|
123 |
$ant_passwd->{$ant}++; |
$ant_passwd->{$ant}++; |
124 |
|
|
125 |
if ( $ant_passwd->{$ant} > $#try_accounts ) { |
if ( $ant_passwd->{$ant} > $#try_accounts ) { |
126 |
print "$ant ant with unknown password\n"; |
print "$ant ant with unknown password\n"; |
127 |
$ant_password_protected->{$ant}++; |
$ant_unknown_password->{$ant}++; |
128 |
|
$ant_passwd->{$ant} = 0; |
129 |
return 0; |
return 0; |
130 |
} |
} |
131 |
return 1; |
return 1; |
170 |
next if ( $type =~ m#^(INFO|ANT-SEARCH|EXEC-CLI)# ); |
next if ( $type =~ m#^(INFO|ANT-SEARCH|EXEC-CLI)# ); |
171 |
|
|
172 |
my $ant = $h->{'ANT-ID'} || die "no ANT-ID in ", dump( $h ); |
my $ant = $h->{'ANT-ID'} || die "no ANT-ID in ", dump( $h ); |
173 |
|
my $seq_nr = $h->{'SEQ-NR'}; |
174 |
|
#warn "SEQ-NR: $seq_nr ok: ",$ant_ok_password->{$ant},"\n" if ($seq_nr); |
175 |
|
|
176 |
my ($user_id,$user_pwd) = ant_credentials( $ant ); |
my ($user_id,$user_pwd) = ant_credentials( $ant ); |
177 |
|
|
178 |
if ($type eq 'REPLY-ANT-SEARCH') { |
if ($type eq 'REPLY-ANT-SEARCH') { |
179 |
mdap_send("INFO MDAP/$mdap_ver\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n") unless ( $ant_password_protected->{$ant} ); |
mdap_send("INFO MDAP/$mdap_ver\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n") unless ( $ant_unknown_password->{$ant} ); |
180 |
} elsif ($type eq 'REPLY-INFO') { |
} elsif ($type eq 'REPLY-INFO') { |
181 |
|
|
182 |
if ($h->{'SEQ-NR'} < 0) { |
if ( $seq_nr < 0 ) { |
183 |
if ( ant_another_passwd( $ant ) ) { |
if ( $ant_ok_password ) { |
184 |
my ($user_id,$user_pwd) = ant_credentials( $ant ); |
$ant_ok_password->{$ant} = 0; |
185 |
|
} elsif ( ant_another_passwd( $ant ) ) { |
186 |
|
($user_id,$user_pwd) = ant_credentials( $ant ); |
187 |
mdap_send("INFO MDAP/$mdap_ver\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); |
mdap_send("INFO MDAP/$mdap_ver\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); |
188 |
} |
} |
189 |
next; |
next; |
190 |
|
} else { |
191 |
|
$ant_ok_password->{$ant}++; |
192 |
} |
} |
193 |
|
|
194 |
my $board = $h->{'_BOARD_NAME'} || die "no _BOARD_NAME?"; |
my $board = $h->{'_BOARD_NAME'} || die "no _BOARD_NAME?"; |
200 |
mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:software upgrade\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); |
mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:software upgrade\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); |
201 |
} else { |
} else { |
202 |
once "$ant OK version $build", |
once "$ant OK version $build", |
203 |
$ant_password_protected->{$ant} ? '' : ' with password', |
$ant_unknown_password->{$ant} ? ' with unknown password' : |
204 |
|
$ant_ok_password->{$ant} ? ' password protected' : |
205 |
|
'', |
206 |
"\n"; |
"\n"; |
207 |
} |
} |
208 |
} else { |
} else { |
211 |
} elsif ( $type eq 'REPLY-EXEC-CLI' && $h->{'SEQ-NR'} == 1 ) { |
} elsif ( $type eq 'REPLY-EXEC-CLI' && $h->{'SEQ-NR'} == 1 ) { |
212 |
print "+ $ant bootp mode re-flash started\n"; |
print "+ $ant bootp mode re-flash started\n"; |
213 |
mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nSEQ-NR:2\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); |
mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nSEQ-NR:2\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); |
214 |
$ant_password_protected->{$ant} = 0; |
$ant_unknown_password->{$ant} = 0; |
215 |
|
$ant_passwd->{$ant} = 0; |
216 |
|
$ant_ok_password->{$ant} = 0; |
217 |
} else { |
} else { |
218 |
print "!! reply ignored ", dump( $h ), $/; |
print "!! reply ignored ", dump( $h ), $/; |
219 |
} |
} |