[rancid] rancid 2.3.6: clogin with multiple devices fails... ($autologin not defined)
Jon Peatfield
J.S.Peatfield at damtp.cam.ac.uk
Thu Jul 14 00:57:21 UTC 2011
On Wed, 13 Jul 2011, Lee wrote:
>> I can see a number of possible fixes to the current clogin code but would
>> prefer an expert to take a look at it...
>
> ... crickets ...
>
> OK, how 'bout a proposed fix? Starting at my line 756 in clogin it's:
> set enable 0
> foreach router [lrange $argv $i end] {
> set router [string tolower $router]
> # attempt at platform switching.
>
> Fix is to move the "set enable 0" line after the "foreach router [..." line.
Which does seem to fix it, or at least hide the underlying problems...
My worry is that the code is testing $enable in the loop before it can be
set other than to 0, so either the testing of $enable code is wrong, or it
really is intended to be the value of $enable from the *previous* time
round the loop, in which case the fix may break something subtle...
Then there is the use of $autoenable itself, which I assume was left when
the variable was renamed, but it isn't obvious (to me) if that should be
$avautoenable or $ae since I don't understand what the test is meant to be
doing...
So we have (in the unfixed 2.3.6):
...
set enable 0
foreach router [lrange $argv $i end] {
...
# look for noenable option in .cloginrc
if { [find noenable $router] == "1" } {
set enable 0
}
...
if { $enable && $do_enapasswd && $autoenable == 0 && [llength $pswd] < 2 } {
send_user -- "\nError: no enable password for $router in $password_file.\n"
continue
}
...
<things which set enable and tests of it>
...
}
so maybe that test of $enable just needs to be moved after the places
where enable is set...
I clearly don't understand the code.
-- Jon
More information about the Rancid-discuss
mailing list