Mailing List Archive

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
fix for special character handling [ In reply to ]
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@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
fix for special character handling [ In reply to ]
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" <dave.packham@utah.edu>
To: "Mark Cooper" <mcooper at blueyonder.co.uk>; <rancid-discuss at shrubbery.net>
Cc: <rancid at shrubbery.net>; <asp at partan.com>
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.
>
<SNIP>