From 0e84b727786a16ade28bb081742e5c39c33ed7fa Mon Sep 17 00:00:00 2001 From: Tar Committer Date: Mon, 9 Apr 2001 07:32:33 +0000 Subject: Imported from rancid-2.2b.tar.gz. --- bin/flogin.in | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'bin/flogin.in') diff --git a/bin/flogin.in b/bin/flogin.in index 6c82594..ac60bf3 100755 --- a/bin/flogin.in +++ b/bin/flogin.in @@ -62,7 +62,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 @@ -130,7 +130,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 @@ -171,7 +171,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 { @@ -181,7 +181,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 @@ -247,16 +247,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 } } @@ -269,7 +269,7 @@ proc login { router user userpswd passwd enapasswd 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 @@ -307,7 +307,7 @@ proc login { router user userpswd passwd enapasswd prompt cyphertype } { close; wait if { $tryssh } { if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] { - send_user "Error: failed to ssh: $reason\n" + send_user "\nError: failed to ssh: $reason\n" exit 1 } set tryssh 0 @@ -315,18 +315,18 @@ proc login { router user userpswd passwd enapasswd prompt cyphertype } { exp_continue } else { expect eof - send_user "Error: Connection Refused\n"; wait; return 1 + send_user "\nError: Connection Refused\n"; 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 } "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 "Host key not found .* \(yes\/no\)\?" { send "yes\r" @@ -334,13 +334,13 @@ proc login { router user userpswd passwd enapasswd prompt cyphertype } { 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 "(Username:|login:|Name :)" { sleep 1; send "$user\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 "\[Pp]assword:" { send "$userpswd\r" } "$prompt" { set in_proc 0; return 0 } } @@ -348,14 +348,14 @@ proc login { router user userpswd passwd enapasswd prompt cyphertype } { } "\[Pp]assword:" { 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 } "Password:" { send "$enapasswd\r" } "$prompt" { set in_proc 0; return 0 } } exp_continue } "$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 "quit" wait @@ -364,7 +364,7 @@ proc login { router user userpswd passwd enapasswd prompt 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 return 0 @@ -381,8 +381,8 @@ proc do_enable { enauser enapasswd } { -re "(Username|User Name):" { send "$enauser\r"; exp_continue} "Password:" { send "$enapasswd\r"; exp_continue} "#" { } - 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 } } -- cgit