summaryrefslogtreecommitdiffstats
path: root/bin/clogin.in
diff options
context:
space:
mode:
Diffstat (limited to 'bin/clogin.in')
-rwxr-xr-xbin/clogin.in50
1 files changed, 25 insertions, 25 deletions
diff --git a/bin/clogin.in b/bin/clogin.in
index 40d0d57..d1894b6 100755
--- a/bin/clogin.in
+++ b/bin/clogin.in
@@ -60,7 +60,7 @@ if {[ info exists env(CISCO_USER) ] } {
# (without options) on all machines/OSes I've been on recently -
# unlike whoami or id -nu.
if [ catch {exec id} reason ] {
- send_error "Error: could not exec id: $reason\n"
+ send_error "\nError: could not exec id: $reason\n"
exit 1
}
regexp {\(([^)]*)} "$reason" junk default_user
@@ -128,7 +128,7 @@ for {set i 0} {$i < $argc} {incr i} {
set sfile [ lindex $argv $i ]
}
if { ! [ file readable $sfile ] } {
- send_user "Error: Can't read $sfile\n"
+ send_user "\nError: Can't read $sfile\n"
exit 1
}
set do_script 1
@@ -173,7 +173,7 @@ for {set i 0} {$i < $argc} {incr i} {
set autoenable 1
set enable 0
} -* {
- send_user "Error: Unknown argument! $arg\n"
+ send_user "\nError: Unknown argument! $arg\n"
send_user $usage
exit 1
} default {
@@ -183,7 +183,7 @@ for {set i 0} {$i < $argc} {incr i} {
}
# Process routers...no routers listed is an error.
if { $i == $argc } {
- send_user "Error: $usage"
+ send_user "\nError: $usage"
}
# Only be quiet if we are running a script (it can log its output
@@ -249,16 +249,16 @@ proc find {var router} {
proc source_password_file { password_file } {
global env
if { ! [file exists $password_file] } {
- send_user "Error: password file ($password_file) does not exist\n"
+ send_user "\nError: password file ($password_file) does not exist\n"
exit 1
}
file stat $password_file fileinfo
if { [expr ($fileinfo(mode) & 007)] != 0000 } {
- send_user "Error: $password_file must not be world readable/writable\n"
+ send_user "\nError: $password_file must not be world readable/writable\n"
exit 1
}
if [ catch {source $password_file} reason ] {
- send_user "Error: $reason\n"
+ send_user "\nError: $reason\n"
exit 1
}
}
@@ -274,21 +274,21 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
foreach prog [lrange $cmethod 0 end] {
if ![string compare $prog "telnet"] {
if [ catch {spawn telnet $router} reason ] {
- send_user "Error: telnet failed: $reason\n"
+ send_user "\nError: telnet failed: $reason\n"
exit 1
}
} elseif ![string compare $prog "ssh"] {
if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] {
- send_user "Error: ssh failed: $reason\n"
+ send_user "\nError: ssh failed: $reason\n"
exit 1
}
} elseif ![string compare $prog "rsh"] {
if [ catch {spawn rsh -l $user $router} reason ] {
- send_user "Error: rsh failed: $reason\n"
+ send_user "\nError: rsh failed: $reason\n"
exit 1
}
} else {
- puts "ERROR: unknown connection method: $prog"
+ puts "\nError: unknown connection method: $prog"
return 1
}
incr progs -1
@@ -328,29 +328,29 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
if !$progs {
send_user "\nError: Connection Refused ($prog)\n"; return 1
}
- } eof { send_user "Error: Couldn't login\n"; wait; return 1
+ } eof { send_user "\nError: Couldn't login\n"; wait; return 1
} -nocase "unknown host\r" {
catch {close};
- send_user "Error: Unknown host\n"; wait; return 1
+ send_user "\nError: Unknown host\n"; wait; return 1
} "Host is unreachable" {
catch {close};
- send_user "Error: Host Unreachable!\n"; wait; return 1
+ send_user "\nError: Host Unreachable!\n"; wait; return 1
} "No address associated with name" {
catch {close};
- send_user "Error: Unknown host\n"; wait; return 1
+ send_user "\nError: Unknown host\n"; wait; return 1
}
- -re "Host key not found .* \(yes\/no\)\?" {
+ -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
send "yes\r"
- send_user "Host $router added to the list of known hosts.\n"
+ send_user "\nHost $router added to the list of known hosts.\n"
exp_continue }
-re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
send "no\r"
- send_user "Error: 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 known_hosts file accordingly.\n"
return 1 }
-re "$u_prompt" { send "$user\r"
expect {
- eof { send_user "Error: Couldn't login\n"; wait; return 1 }
- "Login invalid" { send_user "Error: Invalid login\n"; vatch {close}; wait; return 1 }
+ eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
+ "Login invalid" { send_user "\nError: Invalid login\n"; vatch {close}; wait; return 1 }
-re "$p_prompt" { send "$userpswd\r" }
"$prompt" { set in_proc 0; return 0 }
}
@@ -363,14 +363,14 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
send "$passwd\r"
}
expect {
- eof { send_user "Error: Couldn't login\n"; wait; return 1 }
+ eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
-re "$e_prompt" { send "$enapasswd\r" }
"$prompt" { set in_proc 0; return 0 }
}
exp_continue
}
"$prompt" { break; }
- denied { send_user "Error: Check your passwd for $router\n"
+ denied { send_user "\nError: Check your passwd for $router\n"
if { $do_command || $do_script } {
send "exit\r"
wait
@@ -379,7 +379,7 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
return 1
}
}
- "% Bad passwords" {send_user "Error: Check your passwd for $router\n"; return 1 }
+ "% Bad passwords" {send_user "\nError: Check your passwd for $router\n"; return 1 }
}
}
set in_proc 0
@@ -398,8 +398,8 @@ proc do_enable { enauser enapasswd } {
-re "$e_prompt" { send "$enapasswd\r"; exp_continue}
"#" { set prompt "#" }
"(enable)" { set prompt "> (enable) " }
- denied { send_user "Error: Check your Enable passwd\n"; return 1}
- "% Bad passwords" { send_user "Error: Check your Enable passwd\n"
+ denied { send_user "\nError: Check your Enable passwd\n"; return 1}
+ "% Bad passwords" { send_user "\nError: Check your Enable passwd\n"
return 1
}
}