diff options
author | unknown <unknown@unknown> | 2009-09-01 13:24:17 +0000 |
---|---|---|
committer | unknown <unknown@unknown> | 2009-09-01 13:24:17 +0000 |
commit | 1e2a739ede68f904c84ea693362fdd4445c4fc16 (patch) | |
tree | c812acb3606017e6a4334a0b6ce24f769c73c5eb /bin/jlogin.in | |
parent | 09f0f026fd4931b90016d0090778983da01c294a (diff) | |
download | rancid-1e2a739ede68f904c84ea693362fdd4445c4fc16.tar.gz rancid-1e2a739ede68f904c84ea693362fdd4445c4fc16.tar.xz rancid-1e2a739ede68f904c84ea693362fdd4445c4fc16.zip |
Imported from rancid-2.3.2a10.tar.gz.rancid-2.3.2a10
Diffstat (limited to 'bin/jlogin.in')
-rw-r--r-- | bin/jlogin.in | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/bin/jlogin.in b/bin/jlogin.in index 03c75a7..de14fdf 100644 --- a/bin/jlogin.in +++ b/bin/jlogin.in @@ -3,7 +3,7 @@ ## $Id$ ## ## @PACKAGE@ @VERSION@ -## Copyright (c) 1997-2008 by Terrapin Communications, Inc. +## Copyright (c) 1997-2009 by Terrapin Communications, Inc. ## All rights reserved. ## ## This code is derived from software contributed to and maintained by @@ -49,7 +49,7 @@ # # Usage line -set usage "Usage: $argv0 \[-dV\] \[-c command\] \[-Evar=x\] \ +set usage "Usage: $argv0 \[-dSV\] \[-c command\] \[-Evar=x\] \ \[-f cloginrc-file\] \[-p user-password\] \[-r passphrase\] \[-s script-file\] \ \[-u username\] \[-t timeout\] \[-x command-file\] \[-y ssh_cypher_type\] \ router \[router...\]\n" @@ -67,6 +67,8 @@ set avenable 1 # The default is to look in the password file to find the passwords. This # tracks if we receive them on the command line. set do_passwd 1 +# Save config, if prompted +set do_saveconfig 0 # Find the user in the ENV, or use the unix userid. if {[ info exists env(CISCO_USER) ]} { @@ -109,8 +111,7 @@ for {set i 0} {$i < $argc} {incr i} { } -d* { exp_internal 1 # Environment variable to pass to -s scripts - } -E* - { + } -E* { if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} { set E$varname $varvalue } else { @@ -118,15 +119,13 @@ for {set i 0} {$i < $argc} {incr i} { exit 1 } # alternate cloginrc file - } -f* - - -F* { + } -f* { if {! [ regexp .\[fF\](.+) $arg ignore password_file]} { incr i set password_file [ lindex $argv $i ] } # user Password - } -p* - - -P* { + } -p* { if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} { incr i set userpasswd [ lindex $argv $i ] @@ -137,15 +136,13 @@ for {set i 0} {$i < $argc} {incr i} { send_user "@PACKAGE@ @VERSION@\n" exit 0 # passphrase - } -r* - - -R* { + } -r* { if {! [ regexp .\[rR\](.+) $arg ignore passphrase]} { incr i set avpassphrase [ lindex $argv $i ] } # Expect script to run. - } -s* - - -S* { + } -s* { if {! [ regexp .\[sS\](.+) $arg ignore sfile]} { incr i set sfile [ lindex $argv $i ] @@ -155,23 +152,23 @@ for {set i 0} {$i < $argc} {incr i} { exit 1 } set do_script 1 + # save config on exit + } -S* { + set do_saveconfig 1 # Timeout - } -t* - - -T* { + } -t* { if {! [ regexp .\[tT\](.+) $arg ignore timeout]} { incr i set timeout [ lindex $argv $i ] } # Username - } -u* - - -U* { + } -u* { if {! [ regexp .\[uU\](.+) $arg ignore user]} { incr i set username [ lindex $argv $i ] } # command file - } -x* - - -X* { + } -x* { if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} { incr i set cmd_file [ lindex $argv $i ] @@ -185,8 +182,7 @@ for {set i 0} {$i < $argc} {incr i} { set command [join [split $cmd_text \n] \;] set do_command 1 # 'ssh -c' cypher type - } -y* - - -Y* { + } -y* { if {! [ regexp .\[yY\](.+) $arg ignore cypher]} { incr i set cypher [ lindex $argv $i ] @@ -389,11 +385,11 @@ proc login { router user passwd cmethod cyphertype identfile} { send "yes\r" send_user "\nHost $router added to the list of known hosts.\n" exp_continue } - -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" { + -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" { send "no\r" send_user "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n" return 1 } - -re "Offending key for .* \(yes\/no\)\?" { + -re "Offending key for .* \(yes\/no\)\?" { send "no\r" send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n" return 1 } |