summaryrefslogtreecommitdiffstats
path: root/bin/blogin.in
diff options
context:
space:
mode:
Diffstat (limited to 'bin/blogin.in')
-rw-r--r--bin/blogin.in41
1 files changed, 15 insertions, 26 deletions
diff --git a/bin/blogin.in b/bin/blogin.in
index 9851493..27b89b2 100644
--- a/bin/blogin.in
+++ b/bin/blogin.in
@@ -3,7 +3,7 @@
## $Id$
##
## @PACKAGE@ @VERSION@
-## Copyright (c) 1997-2007 by Terrapin Communications, Inc.
+## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
@@ -405,26 +405,26 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
send "no\r"
send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
return 1 }
- -re "$u_prompt" { send "$user\r"
+ -re "$u_prompt" { send -- "$user\r"
expect {
eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
"Login invalid" { send_user "\nError: Invalid login\n";
catch {close}; catch {wait};
return 1 }
- -re "$p_prompt" { send "$userpswd\r" }
+ -re "$p_prompt" { send -- "$userpswd\r" }
"$prompt" { set in_proc 0; return 0 }
}
exp_continue
}
-re "$p_prompt" {
if ![string compare $prog "ssh"] {
- send "$userpswd\r"
+ send -- "$userpswd\r"
} else {
- send "$passwd\r"
+ send -- "$passwd\r"
}
expect {
eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
- -re "$e_prompt" { send "$enapasswd\r" }
+ -re "$e_prompt" { send -- "$enapasswd\r" }
"$prompt" { set in_proc 0; return 0 }
}
exp_continue
@@ -448,8 +448,8 @@ proc do_enable { enauser enapasswd } {
send "enable\r"
expect {
- -re "$u_prompt" { send "$enauser\r"; exp_continue}
- -re "$e_prompt" { send "$enapasswd\r"; exp_continue}
+ -re "$u_prompt" { send -- "$enauser\r"; exp_continue}
+ -re "$e_prompt" { send -- "$enapasswd\r"; exp_continue}
"#" { set prompt "#" }
"(enable)" { set prompt "> (enable) " }
denied { send_user "\nError: Check your Enable passwd\n"
@@ -477,25 +477,14 @@ proc run_commands { prompt command } {
regsub -all "\[)(]" $prompt {\\&} reprompt
- # Is this a multi-command?
- if [ string match "*\;*" "$command" ] {
- set commands [split $command \;]
- set num_commands [llength $commands]
-
- for {set i 0} {$i < $num_commands} { incr i} {
- send "[subst -nocommands [lindex $commands $i]]\r"
- expect {
- -re "^\[^\n\r *]*$reprompt" {}
- -re "^\[^\n\r]*$reprompt." { exp_continue }
- -re "\[\n\r]+" { exp_continue }
- }
- }
- } else {
- send "[subst -nocommands $command]\r"
+ set commands [split $command \;]
+ set num_commands [llength $commands]
+ for {set i 0} {$i < $num_commands} { incr i} {
+ send -- "[subst -nocommands [lindex $commands $i]]\r"
expect {
- -re "^\[^\n\r *]*$reprompt" {}
- -re "^\[^\n\r]*$reprompt." { exp_continue }
- -re "\[\n\r]+" { exp_continue }
+ -re "^\[^\n\r *]*$reprompt" {}
+ -re "^\[^\n\r]*$reprompt." { exp_continue }
+ -re "\[\n\r]+" { exp_continue }
}
}
send "logout\r"