fix for special character handling
Mark Cooper
mcooper at blueyonder.co.uk
Fri Nov 23 16:39:57 UTC 2001
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
More information about the Rancid-discuss
mailing list