[rancid] Fortigate issue with alpha release

Merijn Evertse merijn at trans-ix.nl
Wed Jun 21 16:08:16 UTC 2017


Hi,

<device> # missing close-bracket
    while executing
"regsub -all "^["
    invoked from within
"expect {
        -re "\[\r\n]+"          { exp_continue; }
        -re "^(.+$prompt)"      {
                                  regsub -all "^[#\\$]+[#\\$] " $expect_out(0,s..."
    ("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)

Merijn Evertse
Trans-iX

-----Oorspronkelijk bericht-----
Van: heasley [mailto:heas at shrubbery.net] 
Verzonden: woensdag 21 juni 2017 18:00
Aan: Merijn Evertse <merijn at trans-ix.nl>
CC: rancid-discuss at shrubbery.net
Onderwerp: Re: [rancid] Fortigate issue with alpha release

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