From Janos.Mohacsi at dante.org.uk Fri Nov 9 20:07:20 2001 From: Janos.Mohacsi at dante.org.uk (Janos Mohacsi) Date: Fri, 09 Nov 2001 20:07:20 +0000 Subject: real query patch for looking glass Message-ID: <5.1.0.14.0.20011109195936.02e969e0@mail.dante.org.uk> Dear All, I made a patch against the rancid 2.2b8 for looking glass for display the real command not only the Cisco command. Would you like to integrate into the next version? Regards, Janos Mohacsi Additional section for the configuration file (lg.conf) to enable real command: # # $LG_REALCMD enable displaying the real router command also # $LG_REALCMD=1; Here is the patch: *** lg.cgi.save Fri Nov 9 15:27:53 2001 --- lg.cgi Fri Nov 9 19:45:36 2001 *************** *** 169,174 **** --- 169,177 ---- # create the page and log the transaction... sub print_results { + my($mfg) = @_; + my($cmd); + my($timestr) = strftime("%a %b %e %H:%M:%S %Y %Z", gmtime); dolog(LOG_INFO, sprintf("%s %s %s %s\n", $ENV{REMOTE_HOST}, $ENV{REMOTE_ADDR}, $ENV{REMOTE_USER}, *************** *** 181,186 **** --- 184,196 ---- # add the company image, LG_IMAGE print $LG_IMAGE; + if ($mfg =~ /foundry/i) { + $cmd = $foundryCmd{$type}; + } elsif ($mfg =~ /juniper/i) { + $cmd = $juniperCmd{$type}; + } else { + $cmd = $ciscoCmd{$type}; + } print <

Looking Glass Results - $router *************** *** 190,198 ****
Date: $timestr

! Query: $cmdDisp{$type} !
HEAD if ($arg) { print "Argument(s): $arg\n"; } print "

\n"; --- 200,209 ----
Date: $timestr

! Query: $cmdDisp{$type} HEAD + if ($LG_REALCMD) { print "Real Query: $cmd"; } + print "
"; if ($arg) { print "Argument(s): $arg\n"; } print "

\n"; *************** *** 267,273 **** ($router, $mfg) = split(':', $router_param); if (!defined($type) || !defined($router)) { $results[0] = "You must at least choose a Query and a router. Try buying a clue.\n"; ! &print_results; } # conversion of command "type" passed from lgform.cgi to the vendor's syntax. --- 278,284 ---- ($router, $mfg) = split(':', $router_param); if (!defined($type) || !defined($router)) { $results[0] = "You must at least choose a Query and a router. Try buying a clue.\n"; ! &print_results($mfg); } # conversion of command "type" passed from lgform.cgi to the vendor's syntax. *************** *** 361,373 **** if ($mfg =~ /juniper/) { if (! defined($juniperCmd{$type})) { $results[0] = "$cmdDisp{$type} not implemented for junipers. sorry.\n"; ! &print_results; } $cmd = $juniperCmd{$type}; } elsif ($mfg =~ /foundry/) { if(! defined($foundryCmd{$type})) { $results[0] = "$cmdDisp{$type} not implemented for foundrys. sorry.\n"; ! &print_results; } $cmd = $foundryCmd{$type}; } else { --- 372,384 ---- if ($mfg =~ /juniper/) { if (! defined($juniperCmd{$type})) { $results[0] = "$cmdDisp{$type} not implemented for junipers. sorry.\n"; ! &print_results($mfg); } $cmd = $juniperCmd{$type}; } elsif ($mfg =~ /foundry/) { if(! defined($foundryCmd{$type})) { $results[0] = "$cmdDisp{$type} not implemented for foundrys. sorry.\n"; ! &print_results($mfg); } $cmd = $foundryCmd{$type}; } else { *************** *** 378,387 **** if ($type eq "prefix" || $type eq "mbgp" || $type eq "route" ) { if ($arg[0] !~ /^\d+\.\d+\.\d+\.\d+$/) { $results[0] = "The IP address \"$arg[0]\" is not valid and lacking an address would over-burden our router.\n"; ! &print_results; } elsif (defined($arg[1]) && $arg[1] !~ /^\d+\.\d+\.\d+\.\d+$/) { $results[0] = "The IP netmask \"$arg[1]\" is not valid.\n"; ! &print_results; } if ($mfg =~ /juniper/i && defined($arg[1])) { $arg = $arg[0] . "/" . mask2len($arg[1]); --- 389,398 ---- if ($type eq "prefix" || $type eq "mbgp" || $type eq "route" ) { if ($arg[0] !~ /^\d+\.\d+\.\d+\.\d+$/) { $results[0] = "The IP address \"$arg[0]\" is not valid and lacking an address would over-burden our router.\n"; ! &print_results($mfg); } elsif (defined($arg[1]) && $arg[1] !~ /^\d+\.\d+\.\d+\.\d+$/) { $results[0] = "The IP netmask \"$arg[1]\" is not valid.\n"; ! &print_results($mfg); } if ($mfg =~ /juniper/i && defined($arg[1])) { $arg = $arg[0] . "/" . mask2len($arg[1]); *************** *** 390,396 **** if ($mfg =~ /juniper/) { $results[0] = "Juniper does not have a show frame-relay pvc command. ". "Use show interface.\n"; ! &print_results; } if ($arg[0] > 15 && $arg[0] < 1024) { $arg = $arg[0]; --- 401,407 ---- if ($mfg =~ /juniper/) { $results[0] = "Juniper does not have a show frame-relay pvc command. ". "Use show interface.\n"; ! &print_results($mfg); } if ($arg[0] > 15 && $arg[0] < 1024) { $arg = $arg[0]; *************** *** 428,456 **** if ($arg[0] !~ /^\d+\.\d+\.\d+\.\d+$/) { if ($arg[0] !~ /([A-Za-z0-9-]*.)*[A-Za-z0-9-]*.(com|edu|net|org)/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results; } } $arg = $arg[0]; } elsif ($type eq "aspath" || $type eq "communitylist") { if ($arg[0] !~ /^\d+$/ || ($arg[0] < 1 && $arg[0] > 199)) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results; } $arg = $arg[0]; } elsif ($type eq "acl") { if ($arg[0] !~ /^\d+$/ || ($arg[0] < 100 && $arg[0] > 199) || ($arg[0] < 1300 && $arg[0] > 2699)) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results; } $arg = $arg[0]; # don't show the jewels ! &print_results if ($arg == 98 || $arg == 99); } elsif ($type eq "prefixlist" || $type eq "routemap") { if ($arg[0] !~ /^[0-9A-Za-z][^\s\"]*$/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results; } $arg = $arg[0]; } elsif ($type eq "regex") { --- 439,467 ---- if ($arg[0] !~ /^\d+\.\d+\.\d+\.\d+$/) { if ($arg[0] !~ /([A-Za-z0-9-]*.)*[A-Za-z0-9-]*.(com|edu|net|org)/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results($mfg); } } $arg = $arg[0]; } elsif ($type eq "aspath" || $type eq "communitylist") { if ($arg[0] !~ /^\d+$/ || ($arg[0] < 1 && $arg[0] > 199)) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results($mfg); } $arg = $arg[0]; } elsif ($type eq "acl") { if ($arg[0] !~ /^\d+$/ || ($arg[0] < 100 && $arg[0] > 199) || ($arg[0] < 1300 && $arg[0] > 2699)) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results($mfg); } $arg = $arg[0]; # don't show the jewels ! &print_results($mfg) if ($arg == 98 || $arg == 99); } elsif ($type eq "prefixlist" || $type eq "routemap") { if ($arg[0] !~ /^[0-9A-Za-z][^\s\"]*$/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results($mfg); } $arg = $arg[0]; } elsif ($type eq "regex") { *************** *** 462,474 **** $arg =~ s/^\s*//; $arg =~ s/\s*$//; if ($arg !~ /^[0-9_ ^.*+?[\])\(-]*\$?$/ || $arg =~ /^\s*$/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results; } # pathetic excuses for lookups if ($arg =~ /^[_.* ^]*(\*|1|701|1239|1280|1740|3561|5462|10303)+[_\$]*$/ || $arg =~ /^[_.* ^]*(1|701|1239|1280|1740|3561|5462|10303)+[_ .]*[\[*.]/) { $results[0] = "Get real. Such a query has potential to over-burden our router.\nLook that up on your own router.\n"; ! &print_results; } if ($mfg =~ /juniper/) { $arg =~ s/_/ /g; --- 473,485 ---- $arg =~ s/^\s*//; $arg =~ s/\s*$//; if ($arg !~ /^[0-9_ ^.*+?[\])\(-]*\$?$/ || $arg =~ /^\s*$/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results($mfg); } # pathetic excuses for lookups if ($arg =~ /^[_.* ^]*(\*|1|701|1239|1280|1740|3561|5462|10303)+[_\$]*$/ || $arg =~ /^[_.* ^]*(1|701|1239|1280|1740|3561|5462|10303)+[_ .]*[\[*.]/) { $results[0] = "Get real. Such a query has potential to over-burden our router.\nLook that up on your own router.\n"; ! &print_results($mfg); } if ($mfg =~ /juniper/) { $arg =~ s/_/ /g; *************** *** 486,492 **** if ($arg[0] !~ /^\d+\.\d+\.\d+\.\d+$/) { if ($arg[0] !~ /([A-Za-z0-9-]*.)*[A-Za-z0-9-]*.(com|edu|net|org)/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results; } } $arg = $arg[0]; --- 497,503 ---- if ($arg[0] !~ /^\d+\.\d+\.\d+\.\d+$/) { if ($arg[0] !~ /([A-Za-z0-9-]*.)*[A-Za-z0-9-]*.(com|edu|net|org)/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results($mfg); } } $arg = $arg[0]; *************** *** 523,529 **** if ($arg[0] !~ /^\d+\.\d+\.\d+\.\d+$/) { if ($arg[0] !~ /([A-Za-z0-9-]*.)*[A-Za-z0-9-]*.(com|edu|net|org)/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results; } } $arg = $arg[0]; --- 534,540 ---- if ($arg[0] !~ /^\d+\.\d+\.\d+\.\d+$/) { if ($arg[0] !~ /([A-Za-z0-9-]*.)*[A-Za-z0-9-]*.(com|edu|net|org)/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; ! &print_results($mfg); } } $arg = $arg[0]; *************** *** 576,582 **** while () { push(@results, $_); } close CACHE ; $seconds = $dtime; ! &print_results ; } } --- 587,593 ---- while () { push(@results, $_); } close CACHE ; $seconds = $dtime; ! &print_results($mfg) ; } } *************** *** 590,599 **** } else { @results = &DoRsh($router, $mfg, $cmd, $arg); } ! &print_results ; } # end dampened-paths/flap-statistics @results = &DoRsh($router, $mfg, $cmd, $arg); ! &print_results ; exit ; --- 601,610 ---- } else { @results = &DoRsh($router, $mfg, $cmd, $arg); } ! &print_results($mfg) ; } # end dampened-paths/flap-statistics @results = &DoRsh($router, $mfg, $cmd, $arg); ! &print_results($mfg) ; exit ; From heas at shrubbery.net Wed Nov 14 07:49:22 2001 From: heas at shrubbery.net (john heasley) Date: Wed, 14 Nov 2001 07:49:22 +0000 Subject: real query patch for looking glass In-Reply-To: <5.1.0.14.0.20011109195936.02e969e0@mail.dante.org.uk>; from Janos.Mohacsi@dante.org.uk on Fri, Nov 09, 2001 at 08:07:20PM +0000 References: <5.1.0.14.0.20011109195936.02e969e0@mail.dante.org.uk> Message-ID: <20011114074922.A18387@shrubbery.net> Fri, Nov 09, 2001 at 08:07:20PM +0000, Janos Mohacsi: > Dear All, > I made a patch against the rancid 2.2b8 for looking glass for display the > real command not only the Cisco command. > > Would you like to integrate into the next version? > Regards, > Janos Mohacsi > > > Additional section for the configuration file (lg.conf) to enable real command: > > # > # $LG_REALCMD enable displaying the real router command also > # > $LG_REALCMD=1; > merged. it seemed like a better format than the generic command, so i didnt merge the LG_REALCMD switch. thanks. From heas at shrubbery.net Wed Nov 14 18:23:34 2001 From: heas at shrubbery.net (john heasley) Date: Wed, 14 Nov 2001 10:23:34 -0800 Subject: Problems with RE matching in .cloginrc In-Reply-To: <20011018183453.K2307@shrubbery.net>; from heas@shrubbery.net on Thu, Oct 18, 2001 at 06:34:53PM -0700 References: <3BCB6A58.7DC11847@tsnz.net> <20011015203114.B23441@shrubbery.net> <3BCBC638.4B5B5BE@tsnz.net> <20011016230908.D12784@partan.com> <20011018183453.K2307@shrubbery.net> Message-ID: <20011114102334.K22256@shrubbery.net> Thu, Oct 18, 2001 at 06:34:53PM -0700, john heasley: > Tue, Oct 16, 2001 at 11:09:08PM -0400, Andrew Partan: > > On Tue, Oct 16, 2001 at 06:31:36PM +1300, Dylan Hall wrote: > > > The workaround is to remove the check for $loginname@$router from > > > jlogin. Can you suggest a more elegant fix? > > > > Hmm; I think that jlogin is the only *login that has this login at router > > stuff. I think that this bit should be removed. Is anyone using it? > > --asp at partan.com (Andrew Partan) > > i put that in there a _long_ time ago. i can't remember why and (grumble) > the cvs note is empty, but suspect it was a stepping stone. however, i > see how it might be useful for a passphrase, granted "user at host" probably > isnt the right thing. comments? > > otherwise, it should go. if i havent bunged it up... Index: jlogin.in =================================================================== RCS file: /home/rancid/.CVS/rancid/bin/jlogin.in,v retrieving revision 1.26 diff -c -r1.26 jlogin.in *** jlogin.in 2001/11/02 22:05:01 1.26 --- jlogin.in 2001/11/14 18:22:17 *************** *** 452,468 **** # command line passwd set passwd $userpasswd } else { ! set userpswd [lindex [find userpassword $loginname@$router] 0] ! if { "$userpswd" == "" } { ! set userpswd [lindex [find userpassword $router] 0] ! } ! if { "$userpswd" == "" } { ! set passwd [lindex [find password $loginname@$router] 0] if { "$passwd" == "" } { ! set passwd [lindex [find password $router] 0] } - } else { - set passwd $userpswd } } --- 452,464 ---- # command line passwd set passwd $userpasswd } else { ! set passwd [lindex [find userpassword $loginname] 0] ! if { "$passwd" == "" } { ! set passwd [lindex [find password $router] 0] if { "$passwd" == "" } { ! send_user "Error: no password for $router in $password_file.\n" ! continue } } } From heas at shrubbery.net Thu Nov 15 05:58:32 2001 From: heas at shrubbery.net ('john heasley') Date: Thu, 15 Nov 2001 05:58:32 +0000 Subject: Proposed Extreme changes. In-Reply-To: <65988049D870C042BD59CF516556134A14D2CE@sfoexh01.yipes.com>; from ABochannek@yipes.com on Fri, Oct 19, 2001 at 10:26:18AM -0700 References: <65988049D870C042BD59CF516556134A14D2CE@sfoexh01.yipes.com> Message-ID: <20011115055832.A7510@shrubbery.net> Fri, Oct 19, 2001 at 10:26:18AM -0700, Alex Bochannek: > One more diff: > > bash-2.03$ diff -c clogin clogin.new > *** clogin Fri Oct 19 10:20:07 2001 > --- clogin.new Fri Oct 19 10:21:21 2001 > *************** > *** 491,497 **** > exp_continue } > -re "\[^\r\n]*Press to cont\[^\r\n]*" { send " " > expect { > ! -re "\[\r\n]*\r\r" > {} > } > exp_continue > } > --- 491,499 ---- > exp_continue } > -re "\[^\r\n]*Press to cont\[^\r\n]*" { send " " > expect { > ! # gag, 2 more > prompts > ! -re "\[\r\n]*\r" {} > ! -re "\[^\r\n]*Press > to cont\[^\r\n]*" { send " "; exp_continue } > } > exp_continue > } other than collection not working when the config is unsaved, are folks having trouble with collection on extremes? the 3 three i have access to have not exhibited any problems (caused by rancid anyway). i havent seen this double more prompt oddness. does the following deal with it (more cleanly?)? Index: clogin.in =================================================================== RCS file: /home/rancid/.CVS/rancid/bin/clogin.in,v retrieving revision 1.41 diff -c -r1.41 clogin.in *** clogin.in 2001/11/02 23:11:39 1.41 --- clogin.in 2001/11/15 05:47:53 *************** *** 489,498 **** exp_continue } -re "\[\n\r]+" { send_user -- "$expect_out(buffer)" exp_continue } ! -re "\[^\r\n]*Press to cont\[^\r\n]*" { send " " ! expect { ! -re "\[\r\n]*\r\r" {} ! } exp_continue } -re "^<-+ More -+>\[^\n\r]*" { send " " --- 489,496 ---- exp_continue } -re "\[\n\r]+" { send_user -- "$expect_out(buffer)" exp_continue } ! -re "\[^\r\n]*Press to cont\[^\r\n]*" { ! send " " exp_continue } -re "^<-+ More -+>\[^\n\r]*" { send " " i feel for anyone burdened by these beasts. From mcooper at blueyonder.co.uk Wed Nov 21 12:44:58 2001 From: mcooper at blueyonder.co.uk (Mark Cooper) Date: Wed, 21 Nov 2001 12:44:58 -0000 Subject: Router banners References: <20011012111844.H13370@shrubbery.net> Message-ID: <016201c1728a$53f36d40$6d8e75c2@mirage> I have come across a problem with RANCID when trying to login to routers with a banner. Two real world examples are attached ( ahhhh pretty ;) ) It looks like the ?login script thinks it's already logged in due to the presence of the > in both banners. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: cisco_banner.txt Url: http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20011121/83c88e83/attachment.txt -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: nortel_banner.txt Url: http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20011121/83c88e83/attachment-0001.txt From asp at partan.com Wed Nov 21 17:15:34 2001 From: asp at partan.com (Andrew Partan) Date: Wed, 21 Nov 2001 12:15:34 -0500 Subject: Router banners In-Reply-To: <016201c1728a$53f36d40$6d8e75c2@mirage>; from mcooper@blueyonder.co.uk on Wed, Nov 21, 2001 at 12:44:58PM -0000 References: <20011012111844.H13370@shrubbery.net> <016201c1728a$53f36d40$6d8e75c2@mirage> Message-ID: <20011121121534.A29307@partan.com> On Wed, Nov 21, 2001 at 12:44:58PM -0000, Mark Cooper wrote: > It looks like the ?login script thinks it's already logged in due > to the presence of the > in both banners. Yup. We had to ban some characters in banners (and other motds) - no > or #. The trickest part about clogin (et al) is recognizing the prompt correctly. [expect turns out to be a horrible language for writting anything complicated in.] Looks like this needs to be added to the FAQ. --asp From mcooper at blueyonder.co.uk Thu Nov 22 13:26:11 2001 From: mcooper at blueyonder.co.uk (Mark Cooper) Date: Thu, 22 Nov 2001 13:26:11 -0000 Subject: bug in brancid handling of prompts Message-ID: <01df01c17359$404f31a0$6d8e75c2@mirage> I have just come across a bug in the handling of the prompt in brancid. It occurs when handling prompts with 'special' characters in them such as [UK-ISP1]> I found that rrancid already had code to handle it so the following diff against brancid should fix the problem. 172a173 > $prompt =~ s/([][])/\\$1/g; 235c236,239 < if (!defined($prompt)) {$prompt = ($_ =~ /^([^>]+>)/)[0]; } --- > if (!defined($prompt)) { > $prompt = ($_ =~ /^([^>]+>)/)[0]; > $prompt =~ s/([][])/\\$1/g; > } HTH Mark From mcooper at blueyonder.co.uk Fri Nov 23 16:39:57 2001 From: mcooper at blueyonder.co.uk (Mark Cooper) Date: Fri, 23 Nov 2001 16:39:57 -0000 Subject: fix for special character handling Message-ID: <00b701c1743d$7cfb5e00$6d8e75c2@mirage> I have run into a few problems with 'special' characters within router banners and/or prompts. The following diff against clogin should fix the banner containing expected prompt character and also any special characters in the prompt. 376c376,382 < -re "$p_prompt" { send "$userpswd\r" } --- > -re "$p_prompt" { send "$userpswd\r" > expect { > eof { send_user "\nError: Couldn't login\n"; wait; return 1 } > -re "$u_prompt" { send "$user\r" } > "$prompt" { set in_proc 0; return 0 } > } > } 394d399 < "$prompt" { break; } 449c454,455 < regsub -all "\[)(]" $prompt {\\&} reprompt --- > regsub -all {\[} $prompt {\\&} reprompt > regsub -all {\]} $reprompt {\\&} reprompt The following diff against rancid should fix handling of special characters in the prompt. 1131c1131,1134 < if (!defined($prompt)) {$prompt = ($_ =~ /^([^#]+#)/)[0]; } --- > if (!defined($prompt)) { > $prompt = ($_ =~ /^([^#]+#)/)[0]; > $prompt =~ s/([][])/\\$1/g; > } The following diff against blogin should fix problems with there being a banner on a nortel. 367c367,373 < -re "$p_prompt" { send "$userpswd\r" } --- > -re "$p_prompt" { send "$userpswd\r" > expect { > eof { send_user "\nError: Couldn't login\n"; wait; return 1 } > -re "$u_prompt" { send "$user\r" } > "$prompt" { set in_proc 0; return 0 } > } > } 385d390 < "$prompt" { break; } BTW, all these diffs are against 2.2b7 with Mordechai T. Abzug brancid patches installed. I obviously really need to provide these as full context diffs against 2.2b8....d'oh HTH Mark From mcooper at blueyonder.co.uk Wed Nov 28 11:11:11 2001 From: mcooper at blueyonder.co.uk (Mark Cooper) Date: Wed, 28 Nov 2001 11:11:11 -0000 Subject: brancid patch for Bay/Nortel GUI lock mechanism Message-ID: <012401c177fd$6347b6c0$6d8e75c2@mirage> The following patch removes the lock-address line from the Bay/Nortel configs which is used by Nortel's proprietary GUI to manage their routers. HTH Mark *** brancid Thu Nov 22 14:17:33 2001 --- brancid.patch Wed Nov 28 10:18:09 2001 *************** *** 142,147 **** --- 142,148 ---- next if (/^Reading configuration information/); next if (/^\# *uptime +\d+\s*$/); next if (/^Can\'t find object or class named \"\-all\"\s*$/); + next if (/lock-address .*$/); s{^(\# *description \{.* )Created on .*(\}\s*)$}{$1$2}; if (/community label /) { if (defined($ENV{'NOCOMMSTR'})) { From dave.packham at utah.edu Thu Nov 29 18:28:58 2001 From: dave.packham at utah.edu (Dave Packham) Date: Thu, 29 Nov 2001 11:28:58 -0700 Subject: fix for special character handling Message-ID: My router prompt is set to "TheNet>" and clogin hangs. Do I need to apply the patches in the previous postings? Dave Packham University of Utah Netcom Manager Network Engineering, Advanced Projects ISO Office member DSO ? c. 718-7777 at 801 w. 585.6043 at 801 Dave.Packham at Utah.edu ICQ#:45818442 Current ICQ status: 45818442 at pager.icq.com SMS: (Send an SMS message to my ICQ): +278314245818442 More ways to contact me: http://wwp.icq.com/45818442 ? http://www.netcom.utah.edu/network/engineering.html http://www.map.utah.edu/umaplink/0893.html ? -----Original Message----- From: Mark Cooper [mailto:mcooper at blueyonder.co.uk] Sent: Friday, November 23, 2001 9:40 AM To: rancid-discuss at shrubbery.net Cc: rancid at shrubbery.net; asp at partan.com Subject: fix for special character handling I have run into a few problems with 'special' characters within router banners and/or prompts. The following diff against clogin should fix the banner containing expected prompt character and also any special characters in the prompt. 376c376,382 < -re "$p_prompt" { send "$userpswd\r" } --- > -re "$p_prompt" { send "$userpswd\r" > expect { > eof { send_user "\nError: Couldn't login\n"; wait; return 1 } > -re "$u_prompt" { send "$user\r" } > "$prompt" { set in_proc 0; return 0 } > } > } 394d399 < "$prompt" { break; } 449c454,455 < regsub -all "\[)(]" $prompt {\\&} reprompt --- > regsub -all {\[} $prompt {\\&} reprompt > regsub -all {\]} $reprompt {\\&} reprompt The following diff against rancid should fix handling of special characters in the prompt. 1131c1131,1134 < if (!defined($prompt)) {$prompt = ($_ =~ /^([^#]+#)/)[0]; } --- > if (!defined($prompt)) { > $prompt = ($_ =~ /^([^#]+#)/)[0]; > $prompt =~ s/([][])/\\$1/g; > } The following diff against blogin should fix problems with there being a banner on a nortel. 367c367,373 < -re "$p_prompt" { send "$userpswd\r" } --- > -re "$p_prompt" { send "$userpswd\r" > expect { > eof { send_user "\nError: Couldn't login\n"; wait; return 1 } > -re "$u_prompt" { send "$user\r" } > "$prompt" { set in_proc 0; return 0 } > } > } 385d390 < "$prompt" { break; } BTW, all these diffs are against 2.2b7 with Mordechai T. Abzug brancid patches installed. I obviously really need to provide these as full context diffs against 2.2b8....d'oh HTH Mark From mcooper at blueyonder.co.uk Fri Nov 30 09:39:23 2001 From: mcooper at blueyonder.co.uk (Mark Cooper) Date: Fri, 30 Nov 2001 09:39:23 -0000 Subject: fix for special character handling References: Message-ID: <00b101c17982$e508e7c0$6d8e75c2@mirage> A login prompt such as TheNet> shouldn't cause any problems as it doesn't contain characters like square brackets ( [ or ] ) or a minus sign. If you send me a cut and paste of what happens when you run something like:- clogin -c "show ver" put_your_ciscos_ip_here and what platform you are running rancid on, I'll take a look. HTH Mark ----- Original Message ----- From: "Dave Packham" To: "Mark Cooper" ; Cc: ; Sent: Thursday, November 29, 2001 6:28 PM Subject: RE: fix for special character handling > My router prompt is set to "TheNet>" and clogin hangs. Do I need to > apply the patches in the previous postings? > > Dave Packham > University of Utah Netcom > Manager Network Engineering, > Advanced Projects > ISO Office member > DSO > > c. 718-7777 at 801 > w. 585.6043 at 801 > Dave.Packham at Utah.edu > > ICQ#:45818442 > Current ICQ status: > > 45818442 at pager.icq.com > SMS: (Send an SMS message to my ICQ): +278314245818442 > More ways to contact me: http://wwp.icq.com/45818442 > > http://www.netcom.utah.edu/network/engineering.html > http://www.map.utah.edu/umaplink/0893.html > > > > > -----Original Message----- > From: Mark Cooper [mailto:mcooper at blueyonder.co.uk] > Sent: Friday, November 23, 2001 9:40 AM > To: rancid-discuss at shrubbery.net > Cc: rancid at shrubbery.net; asp at partan.com > Subject: fix for special character handling > > I have run into a few problems with 'special' characters within router > banners and/or > prompts. > > The following diff against clogin should fix the banner containing > expected prompt > character > and also any special characters in the prompt. >