[rancid] Fortigate issue with alpha release

heasley heas at shrubbery.net
Wed Jun 21 16:00:10 UTC 2017


Wed, Jun 21, 2017 at 11:51:58AM +0000, Merijn Evertse:
> Hi,
> 
> I upgraded rancid to Alpha release and came across a problem with FortiGate systems.
> 
> Fnlogin <device>
> <device> # invalid command name "<device> # "
>     while executing
> "$junk = "(^\\$ $)""
         ^ ==

but that does not seem like the intended behavior.  This is probably
better:

Index: bin/fnlogin.in
===================================================================
--- bin/fnlogin.in      (revision 3660)
+++ bin/fnlogin.in      (working copy)
@@ -599,12 +599,11 @@
     send "\r"
     expect {
        -re "\[\r\n]+"          { exp_continue; }
-       -re "^(.+$prompt)"      { set junk $expect_out(0,string); }
-       if {[$junk = "(^\\$ $)"]} {
-         set prompt $junk;
-       } else {
-         if {[$junk = "(^# $)"]} { set prompt $junk ; }
-       };
+       -re "^(.+$prompt)"      {
+                                 regsub -all "^[#\\$]+[#\\$] " $expect_out(0,string) {} junk
+                                 regsub -all "\[\]\[\(\)]" $junk {\\&} junk;
+                                 set prompt "^$junk";
+                               }
     }
 
     if { $do_command || $do_script } {

would you verify that this works, please?

grumble.  I wish that I had one of every device to test against.

>     invoked from within
> "expect {
>         -re "\[\r\n]+"          { exp_continue; }
>         -re "^(.+$prompt)"      { set junk $expect_out(0,string);
>                                   if {[$junk = "(^\\$ $)"]} {
>                                     set prom..."
>     ("foreach" body line 79)
>     invoked from within
> "foreach router [lrange $argv $i end] {
>     set router [string tolower $router]
>     send_user "$router\n"
> 
>     # FortiOS 2.x prompts can end in either ..."
>     (file "/home/rancid/bin/fnlogin" line 569)
> 
> Will investigate further myself, but maybe someone already knows what is causing this.
> 
> Regards,
> 
> Merijn Evertse
> Trans-iX

> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss



More information about the Rancid-discuss mailing list