summaryrefslogtreecommitdiffstats
path: root/bin/elogin.in
diff options
context:
space:
mode:
authorTar Committer <tar@ocjtech.us>2001-04-09 07:32:33 +0000
committerTar Committer <tar@ocjtech.us>2001-04-09 07:32:33 +0000
commit0e84b727786a16ade28bb081742e5c39c33ed7fa (patch)
tree12ee1a75666c0af32ecc7fbdc05c3a5833fb6fb8 /bin/elogin.in
parentb88919bea4b222a616adbdd2b82fc262a14afc8d (diff)
downloadrancid-0e84b727786a16ade28bb081742e5c39c33ed7fa.tar.gz
rancid-0e84b727786a16ade28bb081742e5c39c33ed7fa.tar.xz
rancid-0e84b727786a16ade28bb081742e5c39c33ed7fa.zip
Imported from rancid-2.2b.tar.gz.rancid-2.2b
Diffstat (limited to 'bin/elogin.in')
-rwxr-xr-xbin/elogin.in38
1 files changed, 19 insertions, 19 deletions
diff --git a/bin/elogin.in b/bin/elogin.in
index 89f7a99..46f459d 100755
--- a/bin/elogin.in
+++ b/bin/elogin.in
@@ -54,7 +54,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
@@ -115,7 +115,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
@@ -159,7 +159,7 @@ for {set i 0} {$i < $argc} {incr i} {
} -autoenable {
# ignore -autoenable
} -* {
- send_user "Error: Unknown argument! $arg\n"
+ send_user "\nError: Unknown argument! $arg\n"
send_user $usage
exit 1
} default {
@@ -169,7 +169,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
@@ -236,16 +236,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
}
}
@@ -260,7 +260,7 @@ proc login { router user userpswd passwd prompt cyphertype } {
# Telnet to the router & try to login.
if [ catch {spawn telnet $router} reason ] {
- send_user "Error: failed to telnet: $reason\n"
+ send_user "\nError: failed to telnet: $reason\n"
exit 1
}
sleep 0.3
@@ -291,23 +291,23 @@ proc login { router user userpswd passwd prompt cyphertype } {
close; wait
sleep 0.3
expect eof
- send_user "Error: Connection Refused\n"; wait; return 1
- } eof { send_user "Error: Couldn't login\n"; wait; return 1
+ send_user "\nError: Connection Refused\n"; wait; return 1
+ } eof { send_user "\nError: Couldn't login\n"; wait; return 1
} "Unknown host\r\n" {
expect eof
- send_user "Error: Unknown host\n"; wait; return 1
+ send_user "\nError: Unknown host\n"; wait; return 1
} "Host is unreachable" {
expect eof
- send_user "Error: Host Unreachable!\n"; wait; return 1
+ send_user "\nError: Host Unreachable!\n"; wait; return 1
} "No address associated with name" {
expect eof
- send_user "Error: Unknown host\n"; wait; return 1
+ send_user "\nError: Unknown host\n"; wait; return 1
}
-re "$u_prompt" { send "$user\r"
expect {
- "Login incorrect" { send_user "Error: Couldn't login\n";
+ "Login incorrect" { send_user "\nError: Couldn't login\n";
catch {close}; wait; return 1 }
- eof { send_user "Error: Couldn't login\n"; wait; return 1 }
+ eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
-re "$p_prompt" { send "$userpswd\r" }
"$prompt" { set in_proc 0; return 0 }
}
@@ -315,17 +315,17 @@ proc login { router user userpswd passwd prompt cyphertype } {
}
-re "$p_prompt" { send "$passwd\r"
expect {
- "Password incorrect" { send_user "Error: Couldn't login\n";
+ "Password incorrect" { send_user "\nError: Couldn't login\n";
catch {close}; wait; return 1 }
- eof { send_user "Error: Couldn't login\n"; wait; return 1 }
+ eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
"$prompt" { set in_proc 0; return 0 }
}
exp_continue
}
- "Password incorrect" { send_user "Error: Check your password for $router\n";
+ "Password incorrect" { send_user "\nError: Check your password for $router\n";
catch {close}; wait; return 1 }
"$prompt" { }
- 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