summaryrefslogtreecommitdiffstats
path: root/bin/blogin.in
diff options
context:
space:
mode:
Diffstat (limited to 'bin/blogin.in')
-rw-r--r--[-rwxr-xr-x]bin/blogin.in14
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/blogin.in b/bin/blogin.in
index ceb58e6..cae1bce 100755..100644
--- a/bin/blogin.in
+++ b/bin/blogin.in
@@ -278,8 +278,14 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
- if ![string compare $prog "telnet"] {
- if [ catch {spawn telnet $router} reason ] {
+ if [string match "telnet*" $prog] {
+ regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
+ if {"$port" == ""} {
+ set retval [ catch {spawn telnet $router} reason ]
+ } else {
+ set retval [ catch {spawn telnet $router $port} reason ]
+ }
+ if { $retval } {
send_user "\nError: telnet failed: $reason\n"
exit 1
}
@@ -351,7 +357,7 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
exp_continue }
-re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
send "no\r"
- send_user "\nError: The host key for $router has changed. update the known_hosts file accordingly.\n"
+ send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
return 1 }
-re "$u_prompt" { send "$user\r"
expect {
@@ -549,7 +555,7 @@ foreach router [lrange $argv $i end] {
# Figure out connection method
set cmethod [find method $router]
- if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
+ if { "$cmethod" == "" } { set cmethod {{telnet}} }
# Login to the router
if {[login $router $ruser $userpswd $passwd $enapasswd $prompt $cmethod $cyphertype]} {