summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES27
-rw-r--r--README2
-rw-r--r--Todo2
-rw-r--r--aclocal.m44
-rw-r--r--bin/Makefile.am6
-rw-r--r--bin/Makefile.in14
-rw-r--r--bin/alogin.in60
-rw-r--r--bin/avologin.in97
-rw-r--r--bin/avorancid.in45
-rw-r--r--bin/blogin.in55
-rw-r--r--bin/clogin.in92
-rw-r--r--bin/control_rancid.in2
-rw-r--r--bin/elogin.in42
-rw-r--r--bin/flogin.in54
-rw-r--r--bin/hlogin.in72
-rw-r--r--bin/hpuifilter.c19
-rw-r--r--bin/htlogin.in42
-rw-r--r--bin/jerancid.in13
-rw-r--r--bin/jlogin.in40
-rw-r--r--bin/mrvlogin.in51
-rw-r--r--bin/nlogin.in172
-rw-r--r--bin/nslogin.in68
-rw-r--r--bin/rancid-fe.in1
-rw-r--r--bin/rancid.in14
-rw-r--r--bin/rivlogin.in441
-rwxr-xr-xbin/srancid.in13
-rw-r--r--bin/tlogin.in101
-rw-r--r--bin/tntlogin.in113
-rw-r--r--bin/trancid.in53
-rwxr-xr-xconfigure394
-rwxr-xr-xdepcomp33
-rw-r--r--include/version.h2
-rw-r--r--include/version.h.in2
-rwxr-xr-xinstall-sh702
-rw-r--r--man/Makefile.am4
-rw-r--r--man/Makefile.in4
-rw-r--r--man/clogin.111
-rw-r--r--man/f5rancid.11
-rw-r--r--man/router.db.512
39 files changed, 1397 insertions, 1483 deletions
diff --git a/CHANGES b/CHANGES
index ae85a0c..51987a3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,31 @@
2.3.2
+ f5rancid: install the script and use the device type 'f5'
+
+ *login: accept -S for "save configuration if prompted"
+
+ *login: remove uppercase versions of lowercase options
+
+ tlogin: replace -debug with -d
+
+ nlogin: cloginrc method handling and login error path fixes
+
+ clogin: change "(enable)" and/or regex meta-char exscaping so that
+ catalyst logins work properly.
+
+ hlogin: run_commands exp_continueing when it shouldnt have
+
+ jerancid: summarize DirSlotN bytes to reduce diffs
+
+ rancid: catch aborted 'show diag' output on some 7300s.
+ Bug found by Paul Vlaar.
+
+ rancid: correct/add some filtering for ASA's more system:running-config
+
+ srancid: filter temperature sensor info for Dell 6428 stacks
+
+ hpuifilter: Filter \x07 (bell) from output, which the Cisco AGM suddenly
+ started inserting *sometimes*.
+
nxrancid: add "show version build-info". sort snmp-server user.
rancid: filter filesize and date of tracelogs dir on IOS-XE
diff --git a/README b/README
index 4aae5de..a39a8e4 100644
--- a/README
+++ b/README
@@ -113,7 +113,7 @@ expect http://expect.nist.gov/ We highly suggest that you stick to
you need to have the accompanying tcl &/ tk.
svn Code revision system, an alternative to cvs. Available from
http://subversion.tigris.org/tarballs/. Use the configure
- option --enable-svn to configure for Subversion.
+ option --with-svn to configure for Subversion.
tcl Required by expect.
Bill Fenner (now maintained by others) has a cgi script for interacting
diff --git a/Todo b/Todo
index d457091..cda5e7e 100644
--- a/Todo
+++ b/Todo
@@ -1,3 +1,5 @@
+- make *login and login.top.in cmdline options common among all scripts
+- rivlogin is a mess
- why does hlogin fail when the host key is not yet known? eg:
unix% ./hlogin procurve
procurve
diff --git a/aclocal.m4 b/aclocal.m4
index 004d2b1..b4631bd 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -13,8 +13,8 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(AC_AUTOCONF_VERSION, [2.62],,
-[m4_warning([this file was generated for autoconf 2.62.
+m4_if(AC_AUTOCONF_VERSION, [2.63],,
+[m4_warning([this file was generated for autoconf 2.63.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 3ad2a93..a2f0c5c 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -50,8 +50,8 @@ AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS = hpuifilter
bin_SCRIPTS = agmrancid alogin arancid avologin avorancid blogin brancid \
- cat5rancid clogin control_rancid cssrancid elogin erancid f10rancid \
- flogin fnrancid francid hlogin hrancid htlogin htrancid \
+ cat5rancid clogin control_rancid cssrancid elogin erancid f5rancid \
+ f10rancid flogin fnrancid francid hlogin hrancid htlogin htrancid \
jerancid jlogin jrancid mrancid mrvlogin mrvrancid nlogin nrancid \
nslogin nsrancid nxrancid par prancid rancid-fe rancid rivlogin \
rivrancid rrancid srancid tlogin tntlogin tntrancid trancid xrancid \
@@ -125,3 +125,5 @@ rancid-run: Makefile $(srcdir)/rancid-run.in
$(auto_edit) $(srcdir)/rancid-run.in >rancid-run.tmp; \
chmod +x rancid-run.tmp; \
mv rancid-run.tmp rancid-run
+
+$(bin_PROGRAMS) $(bin_SCRIPTS): ../include/version.h
diff --git a/bin/Makefile.in b/bin/Makefile.in
index 51a47bf..69784fb 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -219,12 +219,12 @@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
bin_SCRIPTS = agmrancid alogin arancid avologin avorancid blogin \
brancid cat5rancid clogin control_rancid cssrancid elogin \
- erancid f10rancid flogin fnrancid francid hlogin hrancid \
- htlogin htrancid jerancid jlogin jrancid mrancid mrvlogin \
- mrvrancid nlogin nrancid nslogin nsrancid nxrancid par prancid \
- rancid-fe rancid rivlogin rivrancid rrancid srancid tlogin \
- tntlogin tntrancid trancid xrancid zrancid lg.cgi lgform.cgi \
- rancid-cvs rancid-run
+ erancid f5rancid f10rancid flogin fnrancid francid hlogin \
+ hrancid htlogin htrancid jerancid jlogin jrancid mrancid \
+ mrvlogin mrvrancid nlogin nrancid nslogin nsrancid nxrancid \
+ par prancid rancid-fe rancid rivlogin rivrancid rrancid \
+ srancid tlogin tntlogin tntrancid trancid xrancid zrancid \
+ lg.cgi lgform.cgi rancid-cvs rancid-run
EXTRA_DIST = lg.cgi.in lgform.cgi.in rancid-cvs.in rancid-run.in
#dist_bin_SCRIPTS= $(bin_SCRIPTS:%=%.in)
CLEANFILES = lg.cgi lgform.cgi rancid-cvs rancid-run
@@ -656,6 +656,8 @@ rancid-run: Makefile $(srcdir)/rancid-run.in
$(auto_edit) $(srcdir)/rancid-run.in >rancid-run.tmp; \
chmod +x rancid-run.tmp; \
mv rancid-run.tmp rancid-run
+
+$(bin_PROGRAMS) $(bin_SCRIPTS): ../include/version.h
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/bin/alogin.in b/bin/alogin.in
index a17bd2a..0fec1a7 100644
--- a/bin/alogin.in
+++ b/bin/alogin.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,11 +49,10 @@
#
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-c command\] \
-\[-Evar=x\] \[-f cloginrc-file\] \
-\[-s script-file\] \[-t timeout\] \[-u username\] \
-\[-v vty-password\] \[-x command-file\] \
-\[-y ssh_cypher_type\] router \[router...\]\n"
+set usage "Usage: $argv0 \[-dSV\] \[-c command\] \[-Evar=x\] \
+\[-f cloginrc-file\] \[-s script-file\] \[-t timeout\] \[-u username\] \
+\[-v vty-password\] \[-x command-file\] \[-y ssh_cypher_type\] router \
+\[router...\]\n"
# env(CLOGIN) may contain:
# x == do not set xterm banner or name
@@ -71,6 +70,8 @@ set avautoenable 0
# 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) ]} {
@@ -105,8 +106,7 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
@@ -123,12 +123,10 @@ for {set i 0} {$i < $argc} {incr i} {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
# ignore -w
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
incr i
set E$varname $varvalue
@@ -137,20 +135,17 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
# ignore -e
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -160,30 +155,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [ lindex $argv $i ]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
@@ -360,7 +354,8 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
sleep 0.3
expect eof
send_user "\nError: Connection Refused\n"; wait; return 1
- } eof { send_user "\nError: 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 "\nError: Unknown host\n"; wait; return 1
@@ -375,15 +370,16 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
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\)\?" {
+ return 1
+ }
+ -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 }
-
+ return 1
+ }
-re "$u_prompt" {
send -- "$user\r"
set uprompt_seen 1
diff --git a/bin/avologin.in b/bin/avologin.in
index b51f841..1ffbddd 100644
--- a/bin/avologin.in
+++ b/bin/avologin.in
@@ -3,22 +3,42 @@
## $Id$
##
## @PACKAGE@ @VERSION@
-## Copyright (C) 1997-2008 by Terrapin Communications, Inc.
+## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed
-## without fee for non-commerical purposes provided that this license
-## remains intact and unmodified with any RANCID distribution.
+## This code is derived from software contributed to and maintained by
+## Terrapin Communications, Inc. by Henry Kilmer, John Heasley, Andrew Partan,
+## Pete Whiting, Austin Schutz, and Andrew Fort.
##
-## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
-## responsibility and liability with respect to this software's usage
-## or its effect upon hardware, computer systems, other software, or
-## anything else.
-##
-## Except where noted otherwise, rancid was written by and is maintained by
-## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+## 1. Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## 2. Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+## 3. All advertising materials mentioning features or use of this software
+## must display the following acknowledgement:
+## This product includes software developed by Terrapin Communications,
+## Inc. and its contributors for RANCID.
+## 4. Neither the name of Terrapin Communications, Inc. nor the names of its
+## contributors may be used to endorse or promote products derived from
+## this software without specific prior written permission.
+## 5. It is requested that non-binding fixes and modifications be contributed
+## back to Terrapin Communications, Inc.
##
+## THIS SOFTWARE IS PROVIDED BY Terrapin Communications, INC. AND CONTRIBUTORS
+## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
+## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+## POSSIBILITY OF SUCH DAMAGE.
#
# The login expect scripts were based on Erik Sherk's gwtn, by permission.
#
@@ -33,7 +53,7 @@
#
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-autoenable\] \[-noenable\] \[-c command\] \
+set usage "Usage: $argv0 \[-dSV\] \[-autoenable\] \[-noenable\] \[-c command\] \
\[-Evar=x\] \[-e enable-password\] \[-f cloginrc-file\] \[-p user-password\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
\[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
@@ -56,6 +76,8 @@ set avautoenable 0
# tracks if we receive them on the command line.
set do_passwd 1
set do_enapasswd 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)]} {
@@ -90,23 +112,20 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [lindex $argv $i]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [lindex $argv $i]
}
set do_passwd 0
# VTY Password
- } -v* -
- -v* {
+ } -v* {
if {! [regexp .\[vV\](.+) $arg ignore passwd]} {
incr i
set passwd [lindex $argv $i]
@@ -117,15 +136,13 @@ for {set i 0} {$i < $argc} {incr i} {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
if {! [regexp .\[wW\](.+) $arg ignore enauser]} {
incr i
set enausername [lindex $argv $i]
}
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -133,24 +150,21 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
if {! [regexp .\[e\](.+) $arg ignore enapasswd]} {
incr i
set enapasswd [lindex $argv $i]
}
set do_enapasswd 0
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [lindex $argv $i]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [lindex $argv $i]
@@ -160,30 +174,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [lindex $argv $i]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [lindex $argv $i]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [lindex $argv $i]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [lindex $argv $i]
@@ -395,14 +408,16 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
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\)\?" {
+ return 1
+ }
+ -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 }
+ return 1
+ }
-re "(denied|Sorry)" {
send_user "\nError: Check your passwd for $router\n"
catch {close}; catch {wait}; return 1
diff --git a/bin/avorancid.in b/bin/avorancid.in
index 33b77d3..fa23ed8 100644
--- a/bin/avorancid.in
+++ b/bin/avorancid.in
@@ -3,22 +3,43 @@
## $Id$
##
## @PACKAGE@ @VERSION@
-## Copyright (C) 1997-2008 by Terrapin Communications, Inc.
+## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed
-## without fee for non-commerical purposes provided that this license
-## remains intact and unmodified with any RANCID distribution.
+## This code is derived from software contributed to and maintained by
+## Terrapin Communications, Inc. by Henry Kilmer, John Heasley, Andrew Partan,
+## Pete Whiting, Austin Schutz, and Andrew Fort.
##
-## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
-## responsibility and liability with respect to this software's usage
-## or its effect upon hardware, computer systems, other software, or
-## anything else.
-##
-## Except where noted otherwise, rancid was written by and is maintained by
-## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+## 1. Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## 2. Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+## 3. All advertising materials mentioning features or use of this software
+## must display the following acknowledgement:
+## This product includes software developed by Terrapin Communications,
+## Inc. and its contributors for RANCID.
+## 4. Neither the name of Terrapin Communications, Inc. nor the names of its
+## contributors may be used to endorse or promote products derived from
+## this software without specific prior written permission.
+## 5. It is requested that non-binding fixes and modifications be contributed
+## back to Terrapin Communications, Inc.
##
+## THIS SOFTWARE IS PROVIDED BY Terrapin Communications, INC. AND CONTRIBUTORS
+## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
+## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+## POSSIBILITY OF SUCH DAMAGE.
+
#
# RANCID - Really Awesome New Cisco confIg Differ
#
diff --git a/bin/blogin.in b/bin/blogin.in
index 27b89b2..41878a8 100644
--- a/bin/blogin.in
+++ b/bin/blogin.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
@@ -52,7 +52,7 @@
#
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-autoenable\] \[-noenable\] \[-c command\] \
+set usage "Usage: $argv0 \[-dSV\] \[-autoenable\] \[-noenable\] \[-c command\] \
\[-Evar=x\] \[-e enable-password\] \[-f cloginrc-file\] \[-p user-password\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
\[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
@@ -75,6 +75,8 @@ set avautoenable 0
# tracks if we receive them on the command line.
set do_passwd 1
set do_enapasswd 0
+# 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,15 +111,13 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [ lindex $argv $i ]
@@ -135,15 +135,13 @@ for {set i 0} {$i < $argc} {incr i} {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
if {! [ regexp .\[wW\](.+) $arg ignore enauser]} {
incr i
set enausername [ lindex $argv $i ]
}
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -151,24 +149,21 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
if {! [ regexp .\[eE\](.+) $arg ignore enapasswd]} {
incr i
set enapasswd [ lindex $argv $i ]
}
set do_enapasswd 0
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -178,30 +173,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [ lindex $argv $i ]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
@@ -382,7 +376,8 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
if !$progs {
send_user "\nError: Connection Refused ($prog)\n"; return 1
}
- } eof { send_user "\nError: Couldn't login\n"; wait; return 1
+ }
+ eof { send_user "\nError: Couldn't login\n"; wait; return 1
} -nocase "unknown host\r" {
catch {close}; catch {wait};
send_user "\nError: Unknown host\n"; wait; return 1
@@ -397,14 +392,16 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
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\)\?" {
+ return 1
+ }
+ -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 }
+ return 1
+ }
-re "$u_prompt" { send -- "$user\r"
expect {
eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
diff --git a/bin/clogin.in b/bin/clogin.in
index b3e4c81..e8c7fb3 100644
--- a/bin/clogin.in
+++ b/bin/clogin.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
@@ -53,7 +53,7 @@
#
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-autoenable\] \[-noenable\] \[-c command\] \
+set usage "Usage: $argv0 \[-dSV\] \[-autoenable\] \[-noenable\] \[-c command\] \
\[-Evar=x\] \[-e enable-password\] \[-f cloginrc-file\] \[-p user-password\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
\[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
@@ -76,6 +76,8 @@ set avautoenable 0
# tracks if we receive them on the command line.
set do_passwd 1
set do_enapasswd 1
+# Save config, if prompted
+set do_saveconfig 0
#
set send_human {.4 .4 .7 .3 5}
@@ -112,15 +114,13 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [ lindex $argv $i ]
@@ -138,15 +138,13 @@ for {set i 0} {$i < $argc} {incr i} {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
if {! [regexp .\[wW\](.+) $arg ignore enauser]} {
incr i
set enausername [ lindex $argv $i ]
}
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -154,24 +152,21 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
if {! [regexp .\[e\](.+) $arg ignore enapasswd]} {
incr i
set enapasswd [ lindex $argv $i ]
}
set do_enapasswd 0
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -181,30 +176,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [ lindex $argv $i ]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
@@ -342,7 +336,6 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
if {"$port" == ""} {
set retval [ catch {spawn $sshcmd -c $cyphertype -x -l $user $router} reason ]
-
} else {
set retval [ catch {spawn $sshcmd -c $cyphertype -x -l $user -p $port $router} reason ]
}
@@ -490,14 +483,15 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
-re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
- exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ exp_continue
+ }
+ -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"
catch {close}; catch {wait};
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"
catch {close}; catch {wait};
@@ -563,8 +557,8 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
# Enable
proc do_enable { enauser enapasswd } {
- global prompt in_proc
- global u_prompt e_prompt
+ global do_saveconfig in_proc
+ global prompt u_prompt e_prompt
set in_proc 1
send "enable\r"
@@ -572,7 +566,7 @@ proc do_enable { enauser enapasswd } {
-re "$u_prompt" { send -- "$enauser\r"; exp_continue}
-re "$e_prompt" { send -- "$enapasswd\r"; exp_continue}
"#" { set prompt "#" }
- "(enable)" { set prompt "> (enable) " }
+ "(enable)" { set prompt "> \\(enable\\) " }
-re "(denied|Sorry|Incorrect)" {
# % Access denied - from local auth and poss. others
send_user "\nError: Check your Enable passwd\n";
@@ -611,17 +605,15 @@ proc run_commands { prompt command } {
} else {
send "terminal length 0\r"
}
- # escape any parens in the prompt, such as "(enable)"
- regsub -all {[)(]} $prompt {\\&} reprompt
# match cisco config mode prompts too, such as router(config-if)#,
# but catalyst does not change in this fashion.
- regsub -all {^(.{1,11}).*([#>])$} $reprompt {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt
+ regsub -all {^(.{1,11}).*([#>])$} $prompt {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt
expect {
-re $reprompt {}
-re "\[\n\r]+" { exp_continue }
}
} else {
- regsub -all "\[)(]" $prompt {\\&} reprompt
+ set reprompt $prompt
}
# this is the only way i see to get rid of more prompts in o/p..grrrrr
@@ -681,20 +673,36 @@ proc run_commands { prompt command } {
exp_continue;
}
"The system has unsaved changes" { # Force10 SFTOS
- send "n\r"
+ if {$do_saveconfig} {
+ catch {send "y\r"}
+ } else {
+ catch {send "n\r"}
+ }
exp_continue
}
"Would you like to save them now" { # Force10
- send "n\r"
+ if {$do_saveconfig} {
+ catch {send "y\r"}
+ } else {
+ catch {send "n\r"}
+ }
exp_continue
}
-re "(Profile|Configuration) changes have occurred.*" {
# Cisco CSS
- send "n\r"
+ if {$do_saveconfig} {
+ catch {send "y\r"}
+ } else {
+ catch {send "n\r"}
+ }
exp_continue
}
"Do you wish to save your configuration changes" {
- send "n\r"
+ if {$do_saveconfig} {
+ catch {send "y\r"}
+ } else {
+ catch {send "n\r"}
+ }
exp_continue
}
-re "\[\n\r]+" { exp_continue }
@@ -851,13 +859,10 @@ foreach router [lrange $argv $i end] {
set junk $expect_out(1,string)
regsub -all "^\\\* " $expect_out(1,string) {} junk
set prompt ".? ?$junk\[0-9]+ $expect_out(2,string)";
+ regsub -all "\[\]\[\(\)]" $prompt {\\&} prompt;
set platform "extreme"
}
-re "^.+$prompt" { set junk $expect_out(0,string);
- regsub -all "\[\]\[]" $junk {\\&} prompt;
- }
- -re "^.+> \\\(enable\\\)" {
- set junk $expect_out(0,string);
regsub -all "\[\]\[\(\)]" $junk {\\&} prompt;
}
}
@@ -872,6 +877,7 @@ foreach router [lrange $argv $i end] {
# command is "set length 0"; otherwise its "terminal length 0".
if [ regexp -- ".*> .*enable" "$prompt" ] {
send "set length 0\r"
+ expect -re $prompt {}
send "set logging session disable\r"
} else {
send "terminal length 0\r"
diff --git a/bin/control_rancid.in b/bin/control_rancid.in
index 2e39068..d1fe450 100644
--- a/bin/control_rancid.in
+++ b/bin/control_rancid.in
@@ -433,7 +433,7 @@ do
then
rm -f $router.new
else
- lines=`awk '{if (/^([-*!;#]|\/\*)/) { next; } lines++; \
+ lines=`awk '{if ($0 ~ /^([-*!;#]|\/\*)/) { next; } lines++; \
if (lines > 10) { print "1"; exit;}} \
END { if (lines < 10) {print "0";}}' $router.new`
diff --git a/bin/elogin.in b/bin/elogin.in
index e13f206..7e7f4fc 100644
--- a/bin/elogin.in
+++ b/bin/elogin.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
@@ -46,7 +46,7 @@
#
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-noenable\] \[-c command\] \
+set usage "Usage: $argv0 \[-dSV\] \[-noenable\] \[-c command\] \
\[-Evar=x\] \[-f cloginrc-file\] \[-p user-password\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
\[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
@@ -68,6 +68,8 @@ set avautoenable 0
# 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) ]} {
@@ -102,15 +104,13 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [ lindex $argv $i ]
@@ -128,12 +128,10 @@ for {set i 0} {$i < $argc} {incr i} {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
# ignore -w
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -141,20 +139,17 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
# ignore -e
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -164,30 +159,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [ lindex $argv $i ]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
diff --git a/bin/flogin.in b/bin/flogin.in
index 483a06e..98c2573 100644
--- a/bin/flogin.in
+++ b/bin/flogin.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
@@ -56,7 +56,7 @@
#
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-autoenable\] \[-noenable\] \
+set usage "Usage: $argv0 \[-dSV\] \[-autoenable\] \[-noenable\] \
\[-c command\] \[-Evar=x\] \[-e enable-password\] \[-p user-password\] \
\[-f cloginrc-file\] \[-s script-file\] \[-t timeout\] \[-u user\] \
\[-v vty-password\] \[-w enable-username\]\[-y ssh_cypher_type\] \
@@ -79,6 +79,8 @@ set avautoenable 0
# tracks if we receive them on the command line.
set do_passwd 1
set do_enapasswd 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) ]} {
@@ -113,15 +115,13 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [ lindex $argv $i ]
@@ -139,15 +139,13 @@ for {set i 0} {$i < $argc} {incr i} {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
if {! [ regexp .\[wW\](.+) $arg ignore enauser]} {
incr i
set enausername [ lindex $argv $i ]
}
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -155,24 +153,21 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
if {! [ regexp .\[eE\](.+) $arg ignore enapasswd]} {
incr i
set enapasswd [ lindex $argv $i ]
}
set do_enapasswd 0
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -182,26 +177,25 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
- # cypher type
- } -y* -
- -Y* {
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
+ # cypher type
+ } -y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
- } -t* -
- -T* {
+ } -t* {
incr i
set timeout [ lindex $argv $i ]
- } -x* -
- -X {
+ } -x* {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
@@ -419,14 +413,16 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
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\)\?" {
+ return 1
+ }
+ -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 }
+ return 1
+ }
-re "(denied|Sorry)" {
send_user "\nError: Check your passwd for $router\n"
catch {close}; catch {wait}; return 1
diff --git a/bin/hlogin.in b/bin/hlogin.in
index e372fe0..f1cbf51 100644
--- a/bin/hlogin.in
+++ b/bin/hlogin.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
@@ -53,7 +53,7 @@
#
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-autoenable\] \[-noenable\] \[-c command\] \
+set usage "Usage: $argv0 \[-dSV\] \[-autoenable\] \[-noenable\] \[-c command\] \
\[-Evar=x\] \[-e enable-password\] \[-f cloginrc-file\] \[-p user-password\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
\[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
@@ -78,6 +78,8 @@ set do_passwd 1
set do_enapasswd 1
# attempt at platform switching.
set platform ""
+# Save config, if prompted
+set do_saveconfig 0
#
set send_human {.2 .1 .4 .2 1}
@@ -114,15 +116,13 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [ lindex $argv $i ]
@@ -140,15 +140,13 @@ for {set i 0} {$i < $argc} {incr i} {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
if {! [ regexp .\[wW\](.+) $arg ignore enauser]} {
incr i
set enausername [ lindex $argv $i ]
}
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -156,24 +154,21 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
if {! [ regexp .\[e\](.+) $arg ignore enapasswd]} {
incr i
set enapasswd [ lindex $argv $i ]
}
set do_enapasswd 0
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -183,30 +178,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [ lindex $argv $i ]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
@@ -413,14 +407,16 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
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\)\?" {
+ return 1
+ }
+ -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 }
+ return 1
+ }
eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
-nocase "unknown host\r" {
catch {close}; catch {wait};
@@ -500,7 +496,7 @@ proc do_enable { enauser enapasswd } {
# Run commands given on the command line.
proc run_commands { prompt command } {
- global in_proc platform
+ global do_saveconfig in_proc platform
set in_proc 1
# Turn off the pager and escape regex meta characters in the $prompt
@@ -522,8 +518,7 @@ proc run_commands { prompt command } {
send -- "[subst -nocommands [lindex $commands $i]]\r"
expect {
-re "^\[^\n\r *]*$reprompt" { catch {send_user -- "$expect_out(buffer)"} }
- -re "^\[^\n\r]*$reprompt." { catch {send_user -- "$expect_out(buffer)"}
- exp_continue }
+ -re "^\[^\n\r]*$reprompt " { catch {send_user -- "$expect_out(buffer)"} }
-re "\[\n\r]+" { catch {send_user -- "$expect_out(buffer)"}
exp_continue }
-re "\[^\r\n]*Press <SPACE> to cont\[^\r\n]*" {
@@ -558,11 +553,19 @@ proc run_commands { prompt command } {
send -h "exit\r"
expect {
"Do you want to save current configuration" {
- catch {send "n\r"}
+ if {$do_saveconfig} {
+ catch {send "y\r"}
+ } else {
+ catch {send "n\r"}
+ }
exp_continue
}
- "Do you wish to save " {
- catch {send "n\r"}
+ "Do you wish to save " {
+ if {$do_saveconfig} {
+ catch {send "y\r"}
+ } else {
+ catch {send "n\r"}
+ }
exp_continue
}
"Do you want to log out" {
@@ -701,6 +704,7 @@ foreach router [lrange $argv $i end] {
if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Adjust our path to find hpuifilter
+ set hpf_path ""
regexp {(.*)/[^/]+} $argv0 junk hpf_path
if { "$hpf_path" != "" && "$hpf_path" != "." } {
append env(PATH) ":$hpf_path"
diff --git a/bin/hpuifilter.c b/bin/hpuifilter.c
index ab437f7..69569d8 100644
--- a/bin/hpuifilter.c
+++ b/bin/hpuifilter.c
@@ -141,7 +141,7 @@ main(int argc, char **argv, char **ev)
hbuf[BUFSZ], /* hlogin buffer */
ptyname[FILENAME_MAX + 1],
tbuf[BUFSZ], /* telnet/ssh buffer */
- tbufstr[4] = {ESC, '\r', '\n', '\0'};
+ tbufstr[5] = {ESC, '\x07', '\r', '\n', '\0'};
int bytes, /* bytes read/written */
devnull,
rval = EX_OK,
@@ -533,7 +533,8 @@ int
filter(char *buf, int len)
{
static regmatch_t pmatch[1];
-#define N_REG 14 /* number of regexes in reg[][] */
+#define N_REG 15 /* number of regexes in reg[][] */
+#define N_CRs 2 /* number of CR replacements */
static regex_t preg[N_REG];
static char reg[N_REG][50] = { /* vt100/220 escape codes */
"\x1B""7\x1B\\[1;24r\x1B""8", /* ds */
@@ -551,21 +552,23 @@ filter(char *buf, int len)
"\x1B\\[\\?25l", /* vi */
"\x1B\\[K", /* ce */
"\x1B\\[7m", /* mr - ansi */
+ "\x07", /* bell */
/* replace these with CR */
"\x1B\\[0m", /* me */
"\x1B""E",
};
- char ebuf[256];
+ char bufstr[3] = {ESC, '\x07', '\0'},
+ ebuf[256];
size_t nmatch = 1;
int err,
x;
static int init = 0;
- if (index(buf, ESC) == 0 || len == 0)
+ if (len == 0 || (err = strcspn(buf, bufstr)) >= len)
return(len);
- for (x = 0; x < N_REG - 2; x++) {
+ for (x = 0; x < N_REG - N_CRs; x++) {
if (! init) {
if ((err = regcomp(&preg[x], reg[x], REG_EXTENDED))) {
regerror(err, &preg[x], ebuf, 256);
@@ -587,9 +590,9 @@ filter(char *buf, int len)
}
}
- /* no the CR NL replacements */
+ /* now the CR NL replacements */
if (! init++) {
- for (x = N_REG - 2; x < N_REG; x++)
+ for (x = N_REG - N_CRs; x < N_REG; x++)
if ((err = regcomp(&preg[x], reg[x], REG_EXTENDED))) {
regerror(err, &preg[x], ebuf, 256);
fprintf(stderr, "%s: regex compile failed: %s\n", progname,
@@ -597,7 +600,7 @@ filter(char *buf, int len)
abort();
}
}
- for (x = N_REG - 2; x < N_REG; x++) {
+ for (x = N_REG - N_CRs; x < N_REG; x++) {
if ((err = regexec(&preg[x], buf, nmatch, pmatch, 0))) {
if (err != REG_NOMATCH) {
regerror(err, &preg[x], ebuf, 256);
diff --git a/bin/htlogin.in b/bin/htlogin.in
index fbe8b1f..88533c9 100644
--- a/bin/htlogin.in
+++ b/bin/htlogin.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
@@ -48,7 +48,7 @@
#
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-noenable\] \[-c command\] \
+set usage "Usage: $argv0 \[-dSV\] \[-noenable\] \[-c command\] \
\[-Evar=x\] \[-f cloginrc-file\] \[-p user-password\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
\[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
@@ -70,6 +70,8 @@ set avautoenable 0
# 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) ]} {
@@ -104,15 +106,13 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [ lindex $argv $i ]
@@ -130,12 +130,10 @@ for {set i 0} {$i < $argc} {incr i} {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
# ignore -w
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -143,20 +141,17 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
# ignore -e
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -166,30 +161,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [ lindex $argv $i ]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
diff --git a/bin/jerancid.in b/bin/jerancid.in
index 69d4697..86e08d8 100644
--- a/bin/jerancid.in
+++ b/bin/jerancid.in
@@ -293,6 +293,19 @@ sub DirSlotN {
# fail if the RP is amid the auto-sync process
return(-1) if (/active\/standby/i && /not sync/);
+ if (/(\S+:\s+)(\d+)(\s+)(\d+)(\s+)(\d+)/) {
+ my($totlen) = length($2) - 1;
+ my($tot) = $2 / (1024 * 1024);
+ my($freelen) = length($4) - 1;
+ my($free) = $4 / (1024 * 1024);
+ my($usedlen) = length($6) - 1;
+ my($used) = $6 / (1024 * 1024);
+ my($fmt) = sprintf("%%-%dsK%s%%-%dsK%s%%-%dsK", $totlen, $3,
+ $freelen, $5, $usedlen);
+
+ ProcessHistory("FLASH","","","!Flash: $1" .
+ sprintf($fmt, $tot, $free, $used));
+ }
ProcessHistory("FLASH","","","!Flash: $_");
}
ProcessHistory("","","","!\n");
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 }
diff --git a/bin/mrvlogin.in b/bin/mrvlogin.in
index 2de0c28..1eb7fa0 100644
--- a/bin/mrvlogin.in
+++ b/bin/mrvlogin.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
@@ -53,7 +53,7 @@
#
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-autoenable\] \[-noenable\] \[-c command\] \
+set usage "Usage: $argv0 \[-dSV\] \[-autoenable\] \[-noenable\] \[-c command\] \
\[-Evar=x\] \[-e enable-password\] \[-f cloginrc-file\] \[-p user-password\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
\[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
@@ -76,6 +76,8 @@ set avautoenable 0
# tracks if we receive them on the command line.
set do_passwd 1
set do_enapasswd 1
+# Save config, if prompted
+set do_saveconfig 0
#
set send_human {.4 .4 .7 .3 5}
@@ -112,15 +114,13 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [ lindex $argv $i ]
@@ -138,15 +138,13 @@ for {set i 0} {$i < $argc} {incr i} {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
if {! [regexp .\[wW\](.+) $arg ignore enauser]} {
incr i
set enausername [ lindex $argv $i ]
}
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -154,24 +152,21 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
if {! [regexp .\[e\](.+) $arg ignore enapasswd]} {
incr i
set enapasswd [ lindex $argv $i ]
}
set do_enapasswd 0
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -181,30 +176,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [ lindex $argv $i ]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
@@ -418,14 +412,15 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
-re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
- exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ exp_continue
+ }
+ -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"
catch {close}; catch {wait};
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"
catch {close}; catch {wait};
@@ -435,7 +430,7 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
send_user "\nError: Check your passwd for $router\n"
catch {close}; catch {wait}; return 1
}
- "Login failed" {
+ -re "Login (failed|incorrect)" {
send_user "\nError: Check your passwd for $router\n"
catch {close}; catch {wait}; return 1
}
diff --git a/bin/nlogin.in b/bin/nlogin.in
index d2e211d..5d302b4 100644
--- a/bin/nlogin.in
+++ b/bin/nlogin.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
@@ -53,7 +53,7 @@
# users permissions can not change.
# 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\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
\[-v vty-password\] \[-x command-file\] \
@@ -71,6 +71,8 @@ set do_script 0
# tracks if we receive them on the command line.
set do_passwd 1
set do_enapasswd 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) ]} {
@@ -105,23 +107,20 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [ lindex $argv $i ]
}
set do_passwd 0
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -129,16 +128,14 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -148,26 +145,25 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
- # cypher type
- } -y* -
- -Y* {
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
+ # cypher type
+ } -y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
- } -t* -
- -T* {
+ } -t* {
incr i
set timeout [ lindex $argv $i ]
- } -x* -
- -X {
+ } -x* {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
@@ -180,6 +176,10 @@ for {set i 0} {$i < $argc} {incr i} {
close $cmd_fd
set command [join [split $cmd_text \n] \;]
set do_command 1
+ # Version string
+ } -V* {
+ send_user "@PACKAGE@ @VERSION@\n"
+ exit 0
# Does tacacs automatically enable us?
} -autoenable {
# ignore autoenable
@@ -240,11 +240,11 @@ proc include {args} {
source_password_file $args
}
-proc find {var firewall} {
+proc find {var router} {
upvar int_$var list
if { [info exists list] } {
foreach line $list {
- if { [string match [lindex $line 0] $firewall ] } {
+ if { [string match [lindex $line 0] $router ] } {
return [lrange $line 1 end]
}
}
@@ -276,8 +276,7 @@ proc source_password_file { password_file } {
# Log into the firewall.
# returns: 0 on success, 1 on failure
-proc login { firewall user userpswd passwd enapasswd prompt cmethod
-cyphertype } {
+proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
global spawn_id in_proc do_command do_script sshcmd
set in_proc 1
set uprompt_seen 0
@@ -289,16 +288,24 @@ cyphertype } {
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
- set retval [ catch {spawn telnet $firewall} reason ]
+ set retval [ catch {spawn telnet $router} reason ]
} else {
- set retval [ catch {spawn telnet $firewall $port} reason ]
+ set retval [ catch {spawn telnet $router $port} reason ]
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
return 1
}
- } elseif ![string compare $prog "ssh"] {
- if [ catch {spawn $sshcmd -c $cyphertype -x -l $user $firewall} reason ] {
+ } elseif [string match "ssh*" $prog] {
+ regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
+ if {"$port" == ""} {
+ set cmd [join [lindex $sshcmd 0] " "]
+ set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user $router" { }]} reason ]
+ } else {
+ set cmd [join [lindex $sshcmd 0] " "]
+ set retval [ catch {eval spawn [split "$cmd -c $cyphertype -x -l $user -p $port $router" { }]} reason ]
+ }
+ if { $retval } {
send_user "\nError: $sshcmd failed: $reason\n"
return 1
}
@@ -344,39 +351,60 @@ cyphertype } {
# then it will just send the passwd.
# if telnet fails with connection refused, try ssh
expect {
- "Connection refused" {
- 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 "\nError: Unknown host\n"; wait; return 1
- } "Host is unreachable" {
- expect eof
- send_user "\nError: Host Unreachable!\n"; wait; return 1
- } "No address associated with name" {
- expect eof
- send_user "\nError: Unknown host\n"; wait; return 1
+ -re "(Connection refused|Secure connection \[^\n\r]+ refused)" {
+ catch {close}; catch {wait};
+ if !$progs {
+ send_user "\nError: Connection Refused ($prog): $router\n"
+ return 1
+ }
+ }
+ -re "(Connection closed by|Connection to \[^\n\r]+ closed)" {
+ catch {close}; catch {wait};
+ if !$progs {
+ send_user "\nError: Connection closed ($prog): $router\n"
+ return 1
+ }
+ }
+ eof { send_user "\nError: Couldn't login: $router\n"; wait; return 1 }
+ -nocase "unknown host\r" {
+ send_user "\nError: Unknown host $router\n";
+ catch {close}; catch {wait};
+ return 1
}
- -re "Are you sure you want to continue connecting .*" {
+ "Host is unreachable" {
+ send_user "\nError: Host Unreachable: $router\n";
+ catch {close}; catch {wait};
+ return 1
+ }
+ "No address associated with name" {
+ send_user "\nError: Unknown host $router\n";
+ catch {close}; catch {wait};
+ return 1
+ }
+ -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
send "yes\r"
- send_user "Host $firewall added to the list of known hosts.\n"
- exp_continue }
- -re "Host key not found .* \(yes\/no\)\?" {
- send "yes\r"
- send_user "Host $firewall added to the list of known hosts.\n"
- exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
- send "no\r"
- send_user "\nError: The host key for $firewall has changed. Update the SSH known_hosts file accordingly.\n"
- return 1 }
- -re "Offending key for .* \(yes\/no\)\?" {
+ 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 "\nError: The host key for $router has changed. Update the SSH known_hosts file accordingly.\n"
+ catch {close}; catch {wait};
+ return 1
+ }
+ -re "Offending key for .* \(yes\/no\)\?" {
send "no\r"
- send_user "\nError: host key mismatch for $firewall. Update the SSH known_hosts file accordingly.\n"
- return 1 }
- denied { send_user "\nError: Check your passwd for $firewall\n"
- catch {close}; catch {wait}; return 1
- }
- " ### Login failed" {send_user "\nError: Check your passwd for $firewall\n"; return 1 }
+ send_user "\nError: host key mismatch for $router. Update the SSH known_hosts file accordingly.\n"
+ catch {close}; catch {wait};
+ return 1
+ }
+ -re "(denied|Sorry)" {
+ send_user "\nError: Check your passwd for $router\n"
+ catch {close}; catch {wait}; return 1
+ }
+ "Login failed" {
+ send_user "\nError: Check your passwd for $router\n";
+ catch {close}; catch {wait}; return 1
+ }
-re "(login:)" {
sleep 1;
send -- "$user\r"
@@ -450,17 +478,17 @@ proc run_commands { prompt command } {
source_password_file $password_file
set in_proc 0
set exitval 0
-foreach firewall [lrange $argv $i end] {
- set firewall [string tolower $firewall]
- send_user "$firewall\n"
+foreach router [lrange $argv $i end] {
+ set router [string tolower $router]
+ send_user "$router\n"
set prompt {-> }
# Figure out passwords
if { $do_passwd || $do_enapasswd } {
- set pswd [find password $firewall]
+ set pswd [find password $router]
if { [llength $pswd] == 0 } {
- send_user "\nError: no password for $firewall in $password_file.\n"
+ send_user "\nError: no password for $router in $password_file.\n"
continue
}
set passwd [join [lindex $pswd 0] ""]
@@ -475,7 +503,7 @@ foreach firewall [lrange $argv $i end] {
# command line username
set ruser $username
} else {
- set ruser [join [find user $firewall] ""]
+ set ruser [join [find user $router] ""]
if { "$ruser" == "" } { set ruser $default_user }
}
@@ -484,7 +512,7 @@ foreach firewall [lrange $argv $i end] {
# command line username
set userpswd $userpasswd
} else {
- set userpswd [join [find userpassword $firewall] ""]
+ set userpswd [join [find userpassword $router] ""]
if { "$userpswd" == "" } { set userpswd $passwd }
}
@@ -494,20 +522,20 @@ foreach firewall [lrange $argv $i end] {
# command line cypher type
set cyphertype $cypher
} else {
- set cyphertype [find cyphertype $firewall]
+ set cyphertype [find cyphertype $router]
if { "$cyphertype" == "" } { set cyphertype "3des" }
}
# Figure out connection method
- set cmethod [find method $firewall]
+ set cmethod [find method $router]
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
# Figure out the SSH executable name
- set sshcmd [find sshcmd $firewall]
+ set sshcmd [find sshcmd $router]
if { "$sshcmd" == "" } { set sshcmd {ssh} }
- # Login to the firewall
- if {[login $firewall $ruser $userpswd $passwd $enapasswd $prompt $cmethod $cyphertype]} {
+ # Login to the router
+ if {[login $router $ruser $userpswd $passwd $enapasswd $prompt $cmethod $cyphertype]} {
incr exitval
continue
}
@@ -534,7 +562,7 @@ foreach firewall [lrange $argv $i end] {
source $sfile
catch {close};
} else {
- label $firewall
+ label $router
log_user 1
interact
}
diff --git a/bin/nslogin.in b/bin/nslogin.in
index 0dae833..b5cee90 100644
--- a/bin/nslogin.in
+++ b/bin/nslogin.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
@@ -55,7 +55,7 @@
#
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-autoenable\] \[-noenable\] \[-c command\] \
+set usage "Usage: $argv0 \[-dSV\] \[-autoenable\] \[-noenable\] \[-c command\] \
\[-Evar=x\] \[-e enable-password\] \[-f cloginrc-file\] \[-p user-password\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
\[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
@@ -78,6 +78,8 @@ set avautoenable 0
# tracks if we receive them on the command line.
set do_passwd 1
set do_enapasswd 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) ]} {
@@ -112,38 +114,33 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [ lindex $argv $i ]
}
set do_passwd 0
# VTY Password
- } -v* -
- -v* {
+ } -v* {
if {! [ regexp .\[vV\](.+) $arg ignore passwd]} {
incr i
set passwd [ lindex $argv $i ]
}
set do_passwd 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
if {! [ regexp .\[wW\](.+) $arg ignore enauser]} {
incr i
set enausername [ lindex $argv $i ]
}
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -151,24 +148,21 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
if {! [ regexp .\[e\](.+) $arg ignore enapasswd]} {
incr i
set enapasswd [ lindex $argv $i ]
}
set do_enapasswd 0
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -178,30 +172,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [ lindex $argv $i ]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
@@ -214,6 +207,10 @@ for {set i 0} {$i < $argc} {incr i} {
close $cmd_fd
set command [join [split $cmd_text \n] \;]
set do_command 1
+ # Version string
+ } -V* {
+ send_user "@PACKAGE@ @VERSION@\n"
+ exit 0
# Do we enable?
} -noenable {
set avenable 0
@@ -398,15 +395,18 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
-re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
- exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ exp_continue
+ }
+ -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\)\?" {
+ return 1
+ }
+ -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 }
+ return 1
+ }
-re "(denied|Sorry)" {
send_user "\nError: Check your passwd for $router\n"
catch {close}; catch {wait}; return 1
@@ -495,11 +495,11 @@ proc run_commands { prompt command } {
send "n\r"
exp_continue
}
- "\n" { exp_continue }
- timeout { catch {close}; catch {wait};
+ "\n" { exp_continue }
+ timeout { catch {close}; catch {wait};
return 0
}
- eof { return 0 }
+ eof { return 0 }
}
set in_proc 0
}
diff --git a/bin/rancid-fe.in b/bin/rancid-fe.in
index a76bc4d..61bf571 100644
--- a/bin/rancid-fe.in
+++ b/bin/rancid-fe.in
@@ -55,7 +55,6 @@ $vendor =~ tr/[A-Z]/[a-z]/;
'alteon' => 'arancid',
'avocent' => 'avorancid',
'baynet' => 'brancid',
- 'bigip' => 'f5rancid',
'cat5' => 'cat5rancid',
'cisco' => 'rancid',
'cisco-nx' => 'nxrancid',
diff --git a/bin/rancid.in b/bin/rancid.in
index 6926691..2b1631e 100644
--- a/bin/rancid.in
+++ b/bin/rancid.in
@@ -1246,6 +1246,14 @@ REDUX: tr/\015//d;
while (<INPUT>) {
tr/\015//d;
+ # Sometimes "show diag" just ends while we are
+ # trying to process this pcb stuff. Check for a
+ # prompt so we can get out.
+ if (/^$prompt/) {
+ $found_diag=1;
+ goto PerlSucks;
+ }
+
if (/0x..: / || /^$/) {
# no effing idea why break does not work there
goto PerlSucks;
@@ -1268,6 +1276,8 @@ PerlSucks:
#
ProcessHistory("SLOT","keysort","B","!Slot $slot$WIC: hvers $hw rev $rev\n");
ProcessHistory("SLOT","keysort","C","!Slot $slot$WIC: part $pn, serial $sn\n");
+ # If we saw the prompt, then we are done.
+ last if $found_diag;
}
/revision\s+(\S+).*revision\s+(\S+)/ &&
ProcessHistory("SLOT","keysort","C","!Slot $slot$WIC: hvers $1 rev $2\n") &&
@@ -1551,6 +1561,8 @@ sub WriteTerm {
# some versions have other crap mixed in with the bits in the
# block above
/^! (Last configuration|NVRAM config last)/ && next;
+ # and for the ASA
+ /^: (Written by \w+ at|Saved)/ && next;
# skip consecutive comment lines to avoid oscillating extra comment
# line on some access servers. grrr.
@@ -1824,7 +1836,7 @@ sub WriteTerm {
next;
}
- /^Cryptochecksum:/ && next;
+ /^ *Cryptochecksum:/ && next;
# catch anything that wasnt matched above.
ProcessHistory("","","","$_");
diff --git a/bin/rivlogin.in b/bin/rivlogin.in
index b9ca2bc..df8bc21 100644
--- a/bin/rivlogin.in
+++ b/bin/rivlogin.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
@@ -75,6 +75,8 @@ set output_file ""
set conf_prompt "*\(config\)# "
set logging 0
set config_mode 0
+# Save config, if prompted
+set do_saveconfig 0
# Password file for routers to access
set password_file $env(HOME)/.cloginrc
@@ -122,28 +124,27 @@ if {[ info exists env(CLOGINRC) ]} {
# Sets Xterm title if interactive...if its an xterm and the user cares
#
proc label { host } {
-
global env
# if CLOGIN has an 'x' in it, don't set the xterm name/banner
if [info exists env(CLOGIN)] {
- if {[string first "x" $env(CLOGIN)] != -1} { return }
+ if {[string first "x" $env(CLOGIN)] != -1} { return }
}
if [info exists env(TERM)] {
- if [regexp \^(xterm|vs) $env(TERM) ignore ] {
- send_user "\033]1;[lindex [split $host "."] 0]\a"
- send_user "\033]2;$host\a"
- }
+ if [regexp \^(xterm|vs) $env(TERM) ignore ] {
+ send_user "\033]1;[lindex [split $host "."] 0]\a"
+ send_user "\033]2;$host\a"
+ }
}
}
# This is a helper function to make the password file easier to
# maintain.
# NOTES: Using this the password file has the form:
-# add password sl* pete cow
-# add password at* steve
-# add password * hanky-pie
+# add password sl* pete cow
+# add password at* steve
+# add password * hanky-pie
proc add { var args } {
global $var
@@ -156,23 +157,22 @@ proc add { var args } {
# that a "bad guy" could just as easy put such code in the clogin
# script, so I will leave .cloginrc as just an extention of that script
proc source_password_file { } {
-
global env password_file read_password_file
if { [info exists read_password_file] } {
- return 1
+ return 1
}
if { [info exists password_file] == 0 } {
- set password_file $env(HOME)/.cloginrc
+ set password_file $env(HOME)/.cloginrc
}
set read_password_file 1
file stat $password_file fileinfo
if { [expr ($fileinfo(mode) & 007)] != 0000 } {
- puts "ERROR: $password_file must not be group or world readable and writable\n"
- return 1
+ puts "ERROR: $password_file must not be group or world readable and writable\n"
+ return 1
}
source $password_file
@@ -183,23 +183,23 @@ proc source_password_file { } {
proc find { var router } {
if {[ source_password_file ] == 0 } {
- return {}
+ return {}
}
upvar $var list
if { [info exists list] } {
- foreach line $list {
- if { [string match [lindex $line 0] $router ] } {
- return [lrange $line 1 end]
- }
- }
+ foreach line $list {
+ if { [string match [lindex $line 0] $router ] } {
+ return [lrange $line 1 end]
+ }
+ }
}
return {}
}
# pre: login completed ok
# post: terminate login session by closing tcp connection
-proc auto_exit { } {
+proc auto_exit { } {
global telnet_id
@@ -225,19 +225,19 @@ proc login { router user userpswd passwd enapasswd } {
global config verbose my_prompt
if { $verbose == 1 } {
- puts "DEBUG: login router = $router"
- puts "DEBUG: login username = $user"
- puts "DEBUG: login userpasswd = $userpswd"
+ puts "DEBUG: login router = $router"
+ puts "DEBUG: login username = $user"
+ puts "DEBUG: login userpasswd = $userpswd"
puts "DEBUG: login passwd = $passwd"
- puts "DEBUG: login enapasswd = $enapasswd"
+ puts "DEBUG: login enapasswd = $enapasswd"
}
spawn -noecho telnet $router
set telnet_id $spawn_id
if { $telnet_id == 0 } {
- puts "ERROR: login: spawn telnet session failed.\n"
- return 1
+ puts "ERROR: login: spawn telnet session failed.\n"
+ return 1
}
# wait for initial 'Press RETURN to...' response
@@ -249,70 +249,56 @@ proc login { router user userpswd passwd enapasswd } {
# If password fails 3 times then expect again
set pass_attempt 0
- expect {
-
- -re ".*> " { }
-
- "Password:" {
- incr pass_attempt
- send -- "$passwd\r"
- exp_continue
- }
-
- "Username: " {
-
- set pattempt 0
-
- send -- "$user\r"
- expect {
-
- "Password: " {
-
- incr pattempt
- if {$pattempt == 1} {
- send -- "$userpswd\r";
- } else {
- send -- "$enapasswd\r";
- }
- exp_continue
- }
-
- -re ".*> " { exp_continue;}
- }
- }
-
+ expect {
+ -re ".*> " { }
+ "Password:" {
+ incr pass_attempt
+ send -- "$passwd\r"
+ exp_continue
+ }
+ "Username: " {
+ set pattempt 0
+
+ send -- "$user\r"
+ expect {
+ "Password: " {
+ incr pattempt
+ if {$pattempt == 1} {
+ send -- "$userpswd\r";
+ } else {
+ send -- "$enapasswd\r";
+ }
+ exp_continue
+ }
+ -re ".*> " { exp_continue;}
+ }
+ }
"%TELNETD-W-BADPASSWD" {
puts "ERROR: bad userid or password to telnet."
return 1
}
"%CONS-W-AUTH_PASSWD" {
exp_continue
- }
-
+ }
"% Authentication failed." {
puts "ERROR: bad userid or password to telnet."
return 1
}
-
-
"Authentication Failed:" {
puts "ERROR: bad userid or password to radius/tacacs+"
return 1
}
-
- "Connection closed *" {
- if {$pass_attempt == 3} {
- puts "ERROR: Maximum attempts for password reached. Check password. Exiting.";
- puts $expect_out(0,string);
+ "Connection closed *" {
+ if {$pass_attempt == 3} {
+ puts "ERROR: Maximum attempts for password reached. Check password. Exiting.";
+ puts $expect_out(0,string);
return 1
- }
- }
-
- timeout {
- puts "ERROR: Timeout on login. Exiting.";
- return 1
- }
-
+ }
+ }
+ timeout {
+ puts "ERROR: Timeout on login. Exiting.";
+ return 1
+ }
eof {
puts "ERROR: device closed telnet connection during login"
return 1
@@ -324,7 +310,7 @@ proc login { router user userpswd passwd enapasswd } {
expect -re ".*> "
set abc "$expect_out(buffer)"
set my_prompt "[lindex $abc 0]"
- regexp {(.*[^>])} $my_prompt my
+ regexp {(.*[^>])} $my_prompt my
return 0;
}
@@ -338,7 +324,7 @@ proc disable_cli_paging { } {
send "cli set terminal rows 0\r"
expect {
- "$my_prompt" {return 0 }
+ "$my_prompt" {return 0 }
}
return 1
}
@@ -346,19 +332,17 @@ proc disable_cli_paging { } {
# pre: login returned 0, prompt at top level
# post: turn off command completion return 0
# on error, return 1
-proc disable_cmd_autocomplete { } {
+proc disable_cmd_autocomplete { } {
global my_prompt
send "cli set command completion off\r"
expect {
+ $my_prompt { }
- $my_prompt { }
-
- timeout {
- puts "ERROR:disable_cmd_autocomplete(TIMEOUT)";
- return 0;
- }
-
+ timeout {
+ puts "ERROR:disable_cmd_autocomplete(TIMEOUT)";
+ return 0;
+ }
}
return 0
@@ -371,18 +355,14 @@ proc logout { prompt } {
# in case of not being at root cmd...
# verify top level prompt state, move to it if necessary
-
if { $config_mode == 1 } {
-
send "exit\r"
expect {
"Do you want*" {
send "no\r"
}
-
"$enable_prompt" { }
-
timeout { puts "ERROR: logout: timeout from config mode\n" }
eof { puts "ERROR: device dropped connection\n" }
}
@@ -391,8 +371,7 @@ proc logout { prompt } {
send "logout\r"
expect {
-
- "Are you sure*" {
+ "Are you sure*" {
send "yes\r"
return 0
}
@@ -406,22 +385,21 @@ proc do_enable { enauser enapasswd userpswd } {
global my_prompt enable_prompt
set enable_prompt [ string trimright $my_prompt ">" ]
set enable_prompt $enable_prompt\#
+ set uses_username 0;
if { $verbose == 1 } {
puts "DEBUG: do_enable: my_prompt = $my_prompt ena_prompt = $enable_prompt"
}
- set uses_username 0;
-
send "enable\r"
expect {
- Username: {
+ Username: {
set uses_username 1;
send -- "$enauser\r";
exp_continue
}
- Password: {
+ Password: {
if {$uses_username == 1} {
send -- "$userpswd\r";
} else {
@@ -429,18 +407,14 @@ proc do_enable { enauser enapasswd userpswd } {
}
exp_continue
}
-
- "$my_prompt" {
+ "$my_prompt" {
puts "ERROR: do_enable failed to gain enable mode."
return 1
}
-
"CONS-W-AUTH_PASSWD" { send -- "$enapasswd\r"; }
-
- "$enable_prompt " { }
- "%SYS-W-NOPASSWD*" { }
-
- "Authentication Failed: Access Denied" {
+ "$enable_prompt " { }
+ "%SYS-W-NOPASSWD*" { }
+ "Authentication Failed: Access Denied" {
puts "ERROR: Bad user or password for enable mode."
return 1
}
@@ -464,10 +438,8 @@ proc do_configure { } {
send "configure\r"
expect {
- "$config_prompt " { }
- "$my_prompt" {
- }
-
+ "$config_prompt " { }
+ "$my_prompt" { }
eof { return 1}
timeout { return 1}
}
@@ -484,9 +456,7 @@ proc start_logfile { output_file } {
global logging
if { [ string length $output_file ] != 0 } {
- set rc [ catch {
- log_file -noappend $output_file
- } errMsg ]
+ set rc [ catch { log_file -noappend $output_file } errMsg ]
if { $rc != 0 } {
puts "ERROR: open file $output_file for write access failed. $errMsg\n"
@@ -505,12 +475,12 @@ proc run_commands { prompt cmdstring } {
set num_commands [llength $cmdstring]
for {set i 0} {$i < $num_commands} { incr i} {
- regsub -- {[ ]*([^\.]*)} [subst -nocommands [lindex $commands $i]] {\1} sendstring
+ regsub -- {[ ]*([^\.]*)} [subst -nocommands [lindex $commands $i]] {\1} sendstring
- if {[ run_single_command $prompt $sendstring ] == 1} {
- puts "ERROR: command '$sendstring' not processed by device. Check previous error messages."
- return 1
- }
+ if {[ run_single_command $prompt $sendstring ] == 1} {
+ puts "ERROR: command '$sendstring' not processed by device. Check previous error messages."
+ return 1
+ }
}
return 0
}
@@ -529,16 +499,16 @@ proc run_single_command { prompt cmdstring } {
set delay 0
if {$verbose == 1} {
- puts "DEBUG: run_commands: prompt=$prompt \"$cmdstring\" "
+ puts "DEBUG: run_commands: prompt=$prompt \"$cmdstring\" "
}
# ays == "are you sure" - must send back yes
if { [string compare $cmdstring "save startup" ] == 0 } {
set need_ays 1
- set delay 1
- if {$verbose == 1} {
- puts "DEBUG: save startup cmd seen, set need_ays = 1"
- }
+ set delay 1
+ if {$verbose == 1} {
+ puts "DEBUG: save startup cmd seen, set need_ays = 1"
+ }
}
# TODO: add case for copy command to startup, also prompts for ok
@@ -549,48 +519,39 @@ proc run_single_command { prompt cmdstring } {
send "$cmdstring\r"
if { $delay == 1} {
- sleep 1
+ sleep 1
}
expect {
-
- "%CLI-E-IVCMD*" {
- puts "ERROR: run_commands(command rejected by device)\n"
- set rc 1
- }
-
+ "%CLI-E-IVCMD*" {
+ puts "ERROR: run_commands(command rejected by device)\n"
+ set rc 1
+ }
"%CLI-E-FACUNKNWN*" {
- puts "ERROR: run_commands(command rejected by device)\n"
- set rc 1
+ puts "ERROR: run_commands(command rejected by device)\n"
+ set rc 1
}
-
"%SYS-I-ADDFAILED*" {
- puts "ERROR: run_commands(command rejected by device)\n"
- set rc 1
+ puts "ERROR: run_commands(command rejected by device)\n"
+ set rc 1
}
"%TFTP-E-REMOTE,*" {
- puts "ERROR: run_commands(command rejected by device)\n"
- set rc 1
+ puts "ERROR: run_commands(command rejected by device)\n"
+ set rc 1
}
-
"%SYS-E-PRIMARY_NO_SUCH_IMAGE*" {
- puts "ERROR: run_commands(command rejected by device)\n"
- set rc 1
+ puts "ERROR: run_commands(command rejected by device)\n"
+ set rc 1
}
-
"want to overwrite " {
send "yes\r"
if {$verbose == 1} {
- puts "DEBUG: got overwrite question, set need_ays to 0"
- }
+ puts "DEBUG: got overwrite question, set need_ays to 0"
+ }
set need_ays 0
}
-
-
- "%CONFIG-E-DUPLICATE,*" {
- }
-
- "$prompt" {
+ "%CONFIG-E-DUPLICATE,*" { }
+ "$prompt" {
if { $seen_prompt == 0 } {
set seen_prompt 1
}
@@ -603,14 +564,11 @@ proc run_single_command { prompt cmdstring } {
exp_continue
}
}
-
- -re ".* More: m,<space> --- Quit: q --- One line: <return> ---" {
- send "q"
- exp_continue
- }
-
-
- timeout {
+ -re ".* More: m,<space> --- Quit: q --- One line: <return> ---" {
+ send "q"
+ exp_continue
+ }
+ timeout {
if {$verbose == 1} {
puts "DEBUG: timeout occured for the $seen_time time\n"
}
@@ -621,16 +579,14 @@ proc run_single_command { prompt cmdstring } {
exp_continue
}
- puts "ERROR:run_commands(TIMEOUT)"
- set rc 1
- }
-
- eof {
+ puts "ERROR:run_commands(TIMEOUT)"
+ set rc 1
+ }
+ eof {
puts "ERROR:run_commands(connection closed by device)\n"
set rc 1
- }
-
- "\n" { exp_continue }
+ }
+ "\n" { exp_continue }
}
# clear input buffer of any remaining data
@@ -645,39 +601,34 @@ proc init_userid { } {
global default_user
if {[ info exists env(RSTONE_USER) ] } {
- set default_user $env(RSTONE_USER)
+ set default_user $env(RSTONE_USER)
} else {
- # This uses "id" which I think is portable. At least it has existed
- # (without options) on all machines/OSes I've been on recently -
- # unlike whoami or id -nu.
- regexp {\(([^)]*)} [exec id] junk default_user
+ # This uses "id" which I think is portable. At least it has existed
+ # (without options) on all machines/OSes I've been on recently -
+ # unlike whoami or id -nu.
+ regexp {\(([^)]*)} [exec id] junk default_user
}
}
proc source_script_file { filename } {
- global my_prompt
-
- expect -re "$my_prompt" {}
+ global my_prompt
- source $filename
+ expect -re "$my_prompt" {}
+ source $filename
}
-
# pre: login completed ok, filename contains set of cli commands one per line
# post: each command is extracted from filename and sent to device
# return 0 on success, return 1 on error
# NOTE: for scripts that begin with "configure", change the mode to configure
# before executing the following commands
proc process_script_file { filename } {
-
global my_prompt verbose
set rc 0
set ifile ""
- set rc [ catch {
- set ifile [ open $filename r]
- } errMsg ]
+ set rc [ catch { set ifile [ open $filename r] } errMsg ]
if { $rc != 0 } {
puts "ERROR: process_script_file: open script file $filename for read access failed. $errMsg\n"
@@ -724,27 +675,20 @@ proc process_script_file { filename } {
return $rc
}
-
-
# pre: filename is valid file
# post: remove extended ascii sequences and other cruft
# and prepend a header: rscmd: ip-addr : date
# TODO: should watch all file commands more closely
-proc strip_log { filename router } {
-
+proc strip_log { filename router } {
global tempfile
- set rc [ catch {
- set ifile [ open $filename r]
- } errMsg ]
+ set rc [ catch { set ifile [ open $filename r] } errMsg ]
if { $rc != 0 } {
puts "ERROR: strip_log: open script file $filename for read access failed. $errMsg\n"
return 1
}
- set rc [ catch {
- set ofile [ open $tempfile w]
- } errMsg ]
+ set rc [ catch { set ofile [ open $tempfile w] } errMsg ]
if { $rc != 0 } {
puts "ERROR: strip_log: open temp file $tempfile for write access failed. $errMsg\n"
@@ -780,8 +724,6 @@ proc strip_log { filename router } {
#
# main section
#
-
-
if { $verbose == 1 } {
puts "\n\nrscmd: Version 1.1 started on [exec date]"
puts "[exec uname -a]"
@@ -795,84 +737,83 @@ set send_human {.1 .3 1 .05 2}
init_userid
# Parse Command Line
-
for {set idx 0} {$idx < $argc} {incr idx} {
-
set arg [lindex $argv $idx]
switch -glob -- $arg {
- -c* -
- -C* {
- if {! [ regexp .\[cC\](.+) $arg ignore command]} {
- incr idx
- set command [ lindex $argv $idx ]
- }
- set do_command 1
+ -c* -
+ -C* {
+ if {! [ regexp .\[cC\](.+) $arg ignore command]} {
+ incr idx
+ set command [ lindex $argv $idx ]
+ }
+ set do_command 1
# Expect debug mode
} -d* {
exp_internal 1
- # Environment variable to pass to -s scripts
- } -E*
- {
- if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
- set E$varname $varvalue
- } else {
- send_user "Error: invalid format for -E in $arg\n"
- exit 1
- }
+ # Environment variable to pass to -s scripts
+ } -E*
+ {
+ if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
+ set E$varname $varvalue
+ } else {
+ send_user "Error: invalid format for -E in $arg\n"
+ exit 1
+ }
# Expect script to run
- } -s* -
- -S* {
- if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
- incr idx
- set sfile [ lindex $argv $idx ]
- }
-
- if { ! [ file exists $sfile ] } {
- puts "ERROR: invalid argument script file \"$sfile\" does not exist.\n"
+ } -s* {
+ if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
+ incr idx
+ set sfile [ lindex $argv $idx ]
+ }
+
+ if { ! [ file exists $sfile ] } {
+ puts "ERROR: invalid argument script file \"$sfile\" does not exist.\n"
exit 1
}
- if { ! [ file readable $sfile ] } {
- puts "ERROR: invalid argument script file \"$sfile\" permissions disallow read access.\n"
+ if { ! [ file readable $sfile ] } {
+ puts "ERROR: invalid argument script file \"$sfile\" permissions disallow read access.\n"
exit 1
- }
+ }
- set do_script 1
+ set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# Version string
} -V* {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
- # Command file
- } -x* -
- -X {
- if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
- incr idx
- set cmd_file [ lindex $argv $idx ]
- }
- if [ catch {set cmd_fd [open $cmd_file r]} reason ] {
- send_user "\nError: $reason\n"
- exit 1
- }
- set cmd_text [read $cmd_fd]
- close $cmd_fd
- set command [join [split $cmd_text \n] \;]
- set do_command 1
- } -f* -
- -F* {
- if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
- incr idx
- set password_file [ lindex $argv $idx ]
- }
-
- } -o* -
- -O* {
- if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
- incr idx
- set output_file [ lindex $argv $idx ]
+ # Command file
+ } -x* -
+ -X {
+ if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
+ incr idx
+ set cmd_file [ lindex $argv $idx ]
+ }
+ if [ catch {set cmd_fd [open $cmd_file r]} reason ] {
+ send_user "\nError: $reason\n"
+ exit 1
+ }
+ set cmd_text [read $cmd_fd]
+ close $cmd_fd
+ set command [join [split $cmd_text \n] \;]
+ set do_command 1
+ } -f* -
+ -F* {
+ if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
+ incr idx
+ set password_file [ lindex $argv $idx ]
+ }
+ } -o* -
+ -O* {
+ if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
+ incr idx
+ set output_file [ lindex $argv $idx ]
if { $verbose == 1 } {
puts "DEBUG: output file: $output_file"
}
- }
+ }
# Timeout
} -t* -
-T* {
@@ -1009,7 +950,7 @@ foreach router [lrange $argv $idx end] {
exit 1
}
-# if { [process_script_file $sfile] == 1} {
+# if { [process_script_file $sfile] == 1}{
# puts "DEBUG: logfile $output_file closed on error\n"
# logout $my_prompt
# exit 1
diff --git a/bin/srancid.in b/bin/srancid.in
index f8549c5..ad88613 100755
--- a/bin/srancid.in
+++ b/bin/srancid.in
@@ -212,6 +212,19 @@ sub ShowSys {
# Remove Uptime
/ Up time/ && next;
+ # filter temperature sensor info for Dell 6428 stacks
+ /Temperature Sensors:/ && next;
+ if (/Temperature \(Celsius\)/ &&
+ ProcessHistory("COMMENTS","keysort","C1","! Unit\tStatus\n")) {
+ while (<INPUT>) {
+ s/^\s+\015//g;
+ tr/\015//d;
+ /(\d+)\s+\d+\s+(.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","C1","! $1\t$2\n");
+ /^\s*$/ && last;
+ }
+ }
+
/system description: (.*)/i &&
ProcessHistory("COMMENTS","keysort","A1", "!Chassis type: $1\n") &&
next;
diff --git a/bin/tlogin.in b/bin/tlogin.in
index e097da1..59a166a 100644
--- a/bin/tlogin.in
+++ b/bin/tlogin.in
@@ -2,22 +2,43 @@
##
## $Id$
##
-## Copyright (C) 1997-2008 by Terrapin Communications, Inc.
+## @PACKAGE@ @VERSION@
+## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed
-## without fee for non-commerical purposes provided that this license
-## remains intact and unmodified with any RANCID distribution.
+## This code is derived from software contributed to and maintained by
+## Terrapin Communications, Inc. by Henry Kilmer, John Heasley, Andrew Partan,
+## Pete Whiting, Austin Schutz, and Andrew Fort.
##
-## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
-## responsibility and liability with respect to this software's usage
-## or its effect upon hardware, computer systems, other software, or
-## anything else.
-##
-## Except where noted otherwise, rancid was written by and is maintained by
-## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+## 1. Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## 2. Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+## 3. All advertising materials mentioning features or use of this software
+## must display the following acknowledgement:
+## This product includes software developed by Terrapin Communications,
+## Inc. and its contributors for RANCID.
+## 4. Neither the name of Terrapin Communications, Inc. nor the names of its
+## contributors may be used to endorse or promote products derived from
+## this software without specific prior written permission.
+## 5. It is requested that non-binding fixes and modifications be contributed
+## back to Terrapin Communications, Inc.
##
+## THIS SOFTWARE IS PROVIDED BY Terrapin Communications, INC. AND CONTRIBUTORS
+## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
+## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+## POSSIBILITY OF SUCH DAMAGE.
#
# The login expect scripts were based on Erik Sherk's gwtn, by permission.
#
@@ -26,11 +47,10 @@
# Modified by Ed Ravin for Netopia.
# Usage line
-set usage "Usage: $argv0 \[-autoenable\] \[-noenable\] \[-c command\] \
-\[-debug] \
+set usage "Usage: $argv0 \[-dSV\] \[-autoenable\] \[-noenable\] \[-c command\] \
\[-Evar=x\] \[-e enable-password\] \[-f cloginrc-file\] \[-p user-password\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
-\[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
+\[-V\] \[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
\[-y ssh_cypher_type\] router \[router...\]\n"
# env(CLOGIN) may contain:
@@ -79,39 +99,36 @@ for {set i 0} {$i < $argc} {incr i} {
set arg [lindex $argv $i]
switch -glob -- $arg {
+ } -d {
+ exp_internal 1
# Username
- -u* -
- -U* {
+ } -u* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
- } -p* -
- -P* {
+ } -p* {
if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} {
incr i
set userpasswd [ lindex $argv $i ]
}
set do_passwd 0
# VTY Password
- } -v* -
- -v* {
+ } -v* {
if {! [ regexp .\[vV\](.+) $arg ignore passwd]} {
incr i
set passwd [ lindex $argv $i ]
}
set do_passwd 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
if {! [ regexp .\[wW\](.+) $arg ignore enauser]} {
incr i
set enausername [ lindex $argv $i ]
}
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
@@ -119,24 +136,21 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
if {! [ regexp .\[e\](.+) $arg ignore enapasswd]} {
incr i
set enapasswd [ lindex $argv $i ]
}
set do_enapasswd 0
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -146,30 +160,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [ lindex $argv $i ]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
@@ -182,6 +195,10 @@ for {set i 0} {$i < $argc} {incr i} {
close $cmd_fd
set command [join [split $cmd_text \n] \;]
set do_command 1
+ # Version string
+ } -V* {
+ send_user "@PACKAGE@ @VERSION@\n"
+ exit 0
# Do we enable?
} -noenable {
set avenable 0
@@ -189,8 +206,6 @@ for {set i 0} {$i < $argc} {incr i} {
} -autoenable {
set avautoenable 1
set avenable 0
- } -debug {
- exp_internal 1
} -* {
send_user "\nError: Unknown argument! $arg\n"
send_user $usage
@@ -404,11 +419,11 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
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 }
diff --git a/bin/tntlogin.in b/bin/tntlogin.in
index 8a265b3..02c20a0 100644
--- a/bin/tntlogin.in
+++ b/bin/tntlogin.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
@@ -45,11 +45,10 @@
# Modified by P B Matthews.
# Usage line
-set usage "Usage: $argv0 \[-dV\] \[-c command\] \
-\[-Evar=x\] \[-f cloginrc-file\] \
-\[-s script-file\] \[-t timeout\] \[-u username\] \
-\[-v vty-password\] \[-x command-file\] \
-\[-y ssh_cypher_type\] router \[router...\]\n"
+set usage "Usage: $argv0 \[-dSV\] \[-c command\] \[-Evar=x\] \
+\[-f cloginrc-file\] \[-s script-file\] \[-t timeout\] \[-u username\] \
+\[-v vty-password\] \[-x command-file\] \[-y ssh_cypher_type\] router \
+\[router...\]\n"
# env(CLOGIN) may contain:
# x == do not set xterm banner or name
@@ -67,6 +66,8 @@ set avautoenable 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) ]} {
@@ -101,8 +102,7 @@ for {set i 0} {$i < $argc} {incr i} {
-d* {
exp_internal 1
# Username
- } -u* -
- -U* {
+ } -u* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
@@ -119,12 +119,10 @@ for {set i 0} {$i < $argc} {incr i} {
send_user "@PACKAGE@ @VERSION@\n"
exit 0
# Enable Username
- } -w* -
- -W* {
+ } -w* {
# ignore -w
# Environment variable to pass to -s scripts
- } -E*
- {
+ } -E* {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
incr i
set E$varname $varvalue
@@ -133,20 +131,17 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
# Enable Password
- } -e*
- {
+ } -e* {
# ignore -e
# Command to run.
- } -c* -
- -C* {
+ } -c* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
- } -s* -
- -S* {
+ } -s* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
@@ -156,30 +151,29 @@ for {set i 0} {$i < $argc} {incr i} {
exit 1
}
set do_script 1
+ # save config on exit
+ } -S* {
+ set do_saveconfig 1
# 'ssh -c' cypher type
- } -y* -
- -Y* {
+ } -y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
- } -f* -
- -F* {
+ } -f* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
- } -t* -
- -T* {
+ } -t* {
if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
- set timeout [ lindex $argv $i ]
+ set timeout [ lindex $argv $i ]
}
# Command file
- } -x* -
- -X {
+ } -x* {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
@@ -313,10 +307,10 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
return 1
}
} elseif ![string compare $prog "ssh"] {
- if [ catch {spawn $sshcmd -c $cyphertype -x -l $user $router} reason ] {
- send_user "\nError: $sshcmd failed: $reason\n"
- return 1
- }
+ if [ catch {spawn $sshcmd -c $cyphertype -x -l $user $router} reason ] {
+ send_user "\nError: $sshcmd failed: $reason\n"
+ return 1
+ }
} elseif ![string compare $prog "rsh"] {
send_error "\nError: unsupported method: rsh\n"
if { $progs == 0 } {
@@ -324,8 +318,8 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
}
continue;
} else {
- send_user "\nError: unknown connection method: $prog\n"
- return 1
+ send_user "\nError: unknown connection method: $prog\n"
+ return 1
}
sleep 0.3
@@ -356,7 +350,8 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
sleep 0.3
expect eof
send_user "\nError: Connection Refused\n"; wait; return 1
- } eof { send_user "\nError: 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 "\nError: Unknown host\n"; wait; return 1
@@ -370,16 +365,18 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
-re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
send "yes\r"
send_user "\nHost $router added to the list of known hosts.\n"
- exp_continue }
- -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
+ exp_continue
+ }
+ -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\)\?" {
+ return 1
+ }
+ -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 }
-
+ return 1
+ }
-re "$u_prompt" {
send -- "$user\r"
set uprompt_seen 1
@@ -466,30 +463,30 @@ foreach router [lrange $argv $i end] {
# Figure out passwords
if { $do_passwd } {
- set pswd [find password $router]
- if { [llength $pswd] == 0 } {
- send_user "\nError - no password for $router in $password_file.\n"
- continue
- }
- set passwd [join [lindex $pswd 0] ""]
+ set pswd [find password $router]
+ if { [llength $pswd] == 0 } {
+ send_user "\nError - no password for $router in $password_file.\n"
+ continue
+ }
+ set passwd [join [lindex $pswd 0] ""]
}
# Figure out username
if {[info exists username]} {
- # command line username
- set ruser $username
+ # command line username
+ set ruser $username
} else {
- set ruser [join [find user $router] ""]
- if { "$ruser" == "" } { set ruser $default_user }
+ set ruser [join [find user $router] ""]
+ if { "$ruser" == "" } { set ruser $default_user }
}
# Figure out username's password (if different from the vty password)
if {[info exists userpasswd]} {
- # command line username
- set userpswd $userpasswd
+ # command line username
+ set userpswd $userpasswd
} else {
- set userpswd [join [find userpassword $router] ""]
- if { "$userpswd" == "" } { set userpswd $passwd }
+ set userpswd [join [find userpassword $router] ""]
+ if { "$userpswd" == "" } { set userpswd $passwd }
}
# Figure out prompts
@@ -509,11 +506,11 @@ foreach router [lrange $argv $i end] {
# Figure out cypher type
if {[info exists cypher]} {
- # command line cypher type
- set cyphertype $cypher
+ # command line cypher type
+ set cyphertype $cypher
} else {
- set cyphertype [find cyphertype $router]
- if { "$cyphertype" == "" } { set cyphertype "3des" }
+ set cyphertype [find cyphertype $router]
+ if { "$cyphertype" == "" } { set cyphertype "3des" }
}
# Figure out connection method
diff --git a/bin/trancid.in b/bin/trancid.in
index 0e4f7fd..3c6e945 100644
--- a/bin/trancid.in
+++ b/bin/trancid.in
@@ -2,30 +2,55 @@
##
## $Id$
##
-## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
+## @PACKAGE@ @VERSION@
+## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed
-## without fee for non-commerical purposes provided that this license
-## remains intact and unmodified with any RANCID distribution.
+## This code is derived from software contributed to and maintained by
+## Terrapin Communications, Inc. by Henry Kilmer, John Heasley, Andrew Partan,
+## Pete Whiting, Austin Schutz, and Andrew Fort.
##
-## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
-## responsibility and liability with respect to this software's usage
-## or its effect upon hardware, computer systems, other software, or
-## anything else.
-##
-## Except where noted otherwise, rancid was written by and is maintained by
-## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+## 1. Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## 2. Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+## 3. All advertising materials mentioning features or use of this software
+## must display the following acknowledgement:
+## This product includes software developed by Terrapin Communications,
+## Inc. and its contributors for RANCID.
+## 4. Neither the name of Terrapin Communications, Inc. nor the names of its
+## contributors may be used to endorse or promote products derived from
+## this software without specific prior written permission.
+## 5. It is requested that non-binding fixes and modifications be contributed
+## back to Terrapin Communications, Inc.
##
+## THIS SOFTWARE IS PROVIDED BY Terrapin Communications, INC. AND CONTRIBUTORS
+## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
+## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+## POSSIBILITY OF SUCH DAMAGE.
#
# RANCID - Really Awesome New Cisco confIg Differ
#
-# usage: rancid [-d] [-l] [-f filename | $host]
+# usage: rancid [-dV] [-l] [-f filename | $host]
#
# Modified by Ed Ravin for Netopia.
use Getopt::Std;
-getopts('dfl');
+getopts('dflV');
+if ($opt_V) {
+ print "@PACKAGE@ @VERSION@\n";
+ exit(0);
+}
$log = $opt_l;
$debug = $opt_d;
$file = $opt_f;
diff --git a/configure b/configure
index 72fcaa3..93e5c5d 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.62.
+# Generated by GNU Autoconf 2.63.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -636,120 +636,120 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-VERSION
-PACKAGE
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-am__isrc
-CYGPATH_W
-ACLOCAL
-AUTOCONF
-AUTOMAKE
-AUTOHEADER
-MAKEINFO
-install_sh
-STRIP
-INSTALL_STRIP_PROGRAM
-MKDIR_P
-mkdir_p
-AWK
-SET_MAKE
-am__leading_dot
-AMTAR
-am__tar
-am__untar
-MAKE
-CC
-CFLAGS
-LDFLAGS
-CPPFLAGS
-ac_ct_CC
-EXEEXT
-OBJEXT
-DEPDIR
-am__include
-am__quote
-AMDEP_TRUE
-AMDEP_FALSE
-AMDEPBACKSLASH
-CCDEPMODE
-am__fastdepCC_TRUE
-am__fastdepCC_FALSE
-CPP
-GREP
-EGREP
-U
-ANSI2KNR
-MK_LCLSTATEDIR_TRUE
-MK_LCLSTATEDIR_FALSE
-CONF_INSTALL_TRUE
-CONF_INSTALL_FALSE
-RCSSYS
-SVN_FSTYPE
-MAILPLUS
-ADMINMAILPLUS
-DIRNAME
-DIFF
-DIFF_CMD
-SENDMAIL
-TAR
-PERLV_PATH
-PERLV
-EXPECT_PATH
-PING_PATH
-LG_PING_CMD
-CVS
-SVN
-COMM
-FIND
-ID
-MKDIR
-RSH
-SORT
-SSH
-TELNET
-TOUCH
-ENV_PATH
+ac_subst_vars='LTLIBOBJS
LIBOBJS
-LTLIBOBJS'
+ENV_PATH
+TOUCH
+TELNET
+SSH
+SORT
+RSH
+MKDIR
+ID
+FIND
+COMM
+SVN
+CVS
+LG_PING_CMD
+PING_PATH
+EXPECT_PATH
+PERLV
+PERLV_PATH
+TAR
+SENDMAIL
+DIFF_CMD
+DIFF
+DIRNAME
+ADMINMAILPLUS
+MAILPLUS
+SVN_FSTYPE
+RCSSYS
+CONF_INSTALL_FALSE
+CONF_INSTALL_TRUE
+MK_LCLSTATEDIR_FALSE
+MK_LCLSTATEDIR_TRUE
+ANSI2KNR
+U
+EGREP
+GREP
+CPP
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+MAKE
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+PACKAGE
+VERSION
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
@@ -1191,9 +1191,9 @@ fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
- fatal) { $as_echo "$as_me: error: Unrecognized options: $ac_unrecognized_opts" >&2
+ fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
{ (exit 1); exit 1; }; } ;;
- *) $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
@@ -1246,7 +1246,7 @@ test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- { $as_echo "$as_me: error: Working directory cannot be determined" >&2
+ { $as_echo "$as_me: error: working directory cannot be determined" >&2
{ (exit 1); exit 1; }; }
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
{ $as_echo "$as_me: error: pwd does not report name of working directory" >&2
@@ -1486,7 +1486,7 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
configure
-generated by GNU Autoconf 2.62
+generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -1500,7 +1500,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
-generated by GNU Autoconf 2.62. Invocation command line was
+generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -1623,8 +1623,8 @@ _ASBOX
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
@@ -1827,6 +1827,8 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
fi
done
if $ac_cache_corrupted; then
+ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
{ { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
@@ -2319,12 +2321,8 @@ fi
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
STRIP=$ac_ct_STRIP
@@ -2565,12 +2563,8 @@ fi
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
@@ -2769,12 +2763,8 @@ done
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
@@ -2784,11 +2774,13 @@ fi
fi
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&5
$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+ { (exit 1); exit 1; }; }; }
# Provide some information about the compiler.
$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
@@ -2918,11 +2910,13 @@ if test -z "$ac_file"; then
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
See \`config.log' for more details." >&5
$as_echo "$as_me: error: C compiler cannot create executables
See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
+ { (exit 77); exit 77; }; }; }
fi
ac_exeext=$ac_cv_exeext
@@ -2950,13 +2944,15 @@ $as_echo "$ac_try_echo") >&5
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
- { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+ { (exit 1); exit 1; }; }; }
fi
fi
fi
@@ -2999,11 +2995,13 @@ for ac_file in conftest.exe conftest conftest.*; do
esac
done
else
- { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+ { (exit 1); exit 1; }; }; }
fi
rm -f conftest$ac_cv_exeext
@@ -3057,11 +3055,13 @@ else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+ { (exit 1); exit 1; }; }; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
@@ -3821,11 +3821,13 @@ rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
:
else
- { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&5
$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+ { (exit 1); exit 1; }; }; }
fi
ac_ext=c
@@ -4208,8 +4210,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -4362,8 +4365,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'}
$as_echo "$ac_res" >&6; }
fi
-if test `eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -4594,11 +4598,13 @@ rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
:
else
- { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&5
$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+ { (exit 1); exit 1; }; }; }
fi
ac_ext=c
@@ -5149,8 +5155,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'}
$as_echo "$ac_res" >&6; }
fi
-if test `eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -5294,8 +5301,9 @@ ac_res=`eval 'as_val=${'$as_ac_Header'}
$as_echo "$ac_res" >&6; }
fi
-if test `eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -5409,8 +5417,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
@@ -5509,8 +5518,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
@@ -5591,8 +5601,9 @@ ac_res=`eval 'as_val=${'$as_ac_Lib'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_Lib'}
- $as_echo "$as_val"'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_OPENPTY 1
_ACEOF
@@ -5709,8 +5720,9 @@ ac_res=`eval 'as_val=${'$as_ac_var'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
@@ -5789,8 +5801,9 @@ ac_res=`eval 'as_val=${'$as_ac_Lib'}
$as_echo "$as_val"'`
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-if test `eval 'as_val=${'$as_ac_Lib'}
- $as_echo "$as_val"'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
LIBS="$LIBS -l$lib"; break
fi
@@ -5973,7 +5986,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
$as_echo "$ac_cv_type_size_t" >&6; }
-if test $ac_cv_type_size_t = yes; then
+if test "x$ac_cv_type_size_t" = x""yes; then
:
else
@@ -7307,8 +7320,8 @@ _ACEOF
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
@@ -7728,7 +7741,7 @@ exec 6>&1
# values after options handling.
ac_log="
This file was extended by $as_me, which was
-generated by GNU Autoconf 2.62. Invocation command line was
+generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -7741,6 +7754,15 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q`
_ACEOF
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
@@ -7754,16 +7776,17 @@ ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
-Usage: $0 [OPTIONS] [FILE]...
+Usage: $0 [OPTION]... [FILE]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
- -q, --quiet do not print progress messages
+ -q, --quiet, --silent
+ do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
+ --file=FILE[:TEMPLATE]
instantiate the configuration file FILE
- --header=FILE[:TEMPLATE]
+ --header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
@@ -7781,7 +7804,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
config.status
-configured by $0, generated by GNU Autoconf 2.62,
+configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
Copyright (C) 2008 Free Software Foundation, Inc.
@@ -8041,7 +8064,8 @@ for ac_last_try in false false false false false :; do
$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
{ (exit 1); exit 1; }; }
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` = $ac_delim_num; then
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
{ { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -8246,9 +8270,9 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
}
split(mac1, mac2, "(") #)
macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
- prefix = substr(line, 1, index(line, defundef) - 1)
print prefix "define", macro P[macro] D[macro]
next
} else {
@@ -8256,7 +8280,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
- print "/*", line, "*/"
+ print "/*", prefix defundef, macro, "*/"
next
}
}
@@ -8280,8 +8304,8 @@ do
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-$as_echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
+$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
{ (exit 1); exit 1; }; };;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
@@ -8822,7 +8846,7 @@ if test "$no_create" != yes; then
$ac_cs_success || { (exit 1); exit 1; }
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
- { $as_echo "$as_me:$LINENO: WARNING: Unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
diff --git a/depcomp b/depcomp
index ca5ea4e..e5f9736 100755
--- a/depcomp
+++ b/depcomp
@@ -1,9 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2006-10-15.18
+scriptversion=2007-03-29.01
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -215,34 +215,39 @@ aix)
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
- stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
- tmpdepfile="$stripped.u"
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
- if test -f "$tmpdepfile"; then :
- else
- stripped=`echo "$stripped" | sed 's,^.*/,,'`
- tmpdepfile="$stripped.u"
- fi
-
if test $stat -eq 0; then :
else
- rm -f "$tmpdepfile"
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
if test -f "$tmpdepfile"; then
- outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
- sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
- sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
diff --git a/include/version.h b/include/version.h
index 910c687..bdc0c4a 100644
--- a/include/version.h
+++ b/include/version.h
@@ -4,6 +4,6 @@
/* pkg version */
char package[] = "rancid";
-char version[] = "2.3.2a9";
+char version[] = "2.3.2a10";
#endif
diff --git a/include/version.h.in b/include/version.h.in
index 910c687..bdc0c4a 100644
--- a/include/version.h.in
+++ b/include/version.h.in
@@ -4,6 +4,6 @@
/* pkg version */
char package[] = "rancid";
-char version[] = "2.3.2a9";
+char version[] = "2.3.2a10";
#endif
diff --git a/install-sh b/install-sh
index 4fbbae7..676e42e 100755
--- a/install-sh
+++ b/install-sh
@@ -1,38 +1,23 @@
#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2006-10-14.15
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
+# $NetBSD: install-sh.in,v 1.4 2007/07/12 18:32:50 jlam Exp $
+# This script now also installs multiple files, but might choke on installing
+# multiple files with spaces in the file names.
#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
#
+# Copyright 1991 by the Massachusetts Institute of Technology
#
-# FSF changes to this file are in the public domain.
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
@@ -41,23 +26,15 @@ scriptversion=2006-10-14.15
# This script is compatible with the BSD install script, but was written
# from scratch.
-nl='
-'
-IFS=" "" $nl"
-
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
-if test -z "$doit"; then
- doit_exec=exec
-else
- doit_exec=$doit
-fi
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+awkprog="${AWKPROG-awk}"
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
@@ -67,441 +44,248 @@ stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
-posix_glob=
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chmodcmd=$chmodprog
-chowncmd=
-chgrpcmd=
-stripcmd=
+instcmd="$mvprog"
+pathcompchmodcmd="$chmodprog 755"
+chmodcmd="$chmodprog 755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+stripflags=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
-src=
-dst=
-dir_arg=
-dstarg=
-no_target_directory=
-
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
- or: $0 [OPTION]... SRCFILES... DIRECTORY
- or: $0 [OPTION]... -t DIRECTORY SRCFILES...
- or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
--c (ignored)
--d create directories instead of installing files.
--g GROUP $chgrpprog installed files to GROUP.
--m MODE $chmodprog installed files to MODE.
--o USER $chownprog installed files to USER.
--s $stripprog installed files.
--t DIRECTORY install into DIRECTORY.
--T report an error if DSTFILE is a directory.
---help display this help and exit.
---version display version info and exit.
-
-Environment variables override the default commands:
- CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
- case $1 in
- -c) shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- --help) echo "$usage"; exit $?;;
-
- -m) mode=$2
- shift
- shift
- case $mode in
- *' '* | *' '* | *'
-'* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t) dstarg=$2
- shift
- shift
- continue;;
+src=""
+msrc=""
+dst=""
+dir_arg=""
+suffix=""
+suffixfmt=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -b) suffix=".old"
+ shift
+ continue;;
+
+ -B) suffixfmt="$2"
+ shift
+ shift
+ continue;;
+
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -S) stripcmd="$stripprog"
+ stripflags="-S $2 $stripflags"
+ shift
+ shift
+ continue;;
+
+ *) if [ x"$msrc" = x ]
+ then
+ msrc="$dst"
+ else
+ msrc="$msrc $dst"
+ fi
+ src="$dst"
+ dst="$1"
+ shift
+ continue;;
+ esac
+done
- -T) no_target_directory=true
- shift
- continue;;
+if [ x"$dir_arg" = x ]
+then
+ dstisfile=""
+ if [ ! -d "$dst" ]
+ then
+ if [ x"$msrc" = x"$src" ]
+ then
+ dstisfile=true
+ else
+ echo "install: destination is not a directory"
+ exit 1
+ fi
+ fi
+else
+ msrc="$msrc $dst"
+fi
- --version) echo "$0 $scriptversion"; exit $?;;
+if [ x"$msrc" = x ]
+then
+ echo "install: no destination specified"
+ exit 1
+fi
- --) shift
- break;;
+for srcarg in $msrc; do
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
+if [ x"$dir_arg" != x ]; then
- *) break;;
- esac
-done
+ dstarg="$srcarg"
+else
+ dstarg="$dst"
+
+# Waiting for this to be detected by the "$instcmd $srcarg $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f "$srcarg" ]
+ then
+ doinst="$instcmd"
+ elif [ -d "$srcarg" ]
+ then
+ echo "install: $srcarg: not a regular file"
+ exit 1
+ elif [ "$srcarg" = "/dev/null" ]
+ then
+ doinst="$cpprog"
+ else
+ echo "install: $srcarg does not exist"
+ exit 1
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
-if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
- # When -d is used, all remaining arguments are directories to create.
- # When -t is used, the destination is already specified.
- # Otherwise, the last argument is the destination. Remove it from $@.
- for arg
- do
- if test -n "$dstarg"; then
- # $@ is not empty: it contains at least $arg.
- set fnord "$@" "$dstarg"
- shift # fnord
- fi
- shift # arg
- dstarg=$arg
- done
+ if [ -d "$dstarg" ]
+ then
+ dstarg="$dstarg"/`basename "$srcarg"`
+ fi
fi
-if test $# -eq 0; then
- if test -z "$dir_arg"; then
- echo "$0: no input file specified." >&2
- exit 1
- fi
- # It's OK to call `install-sh -d' without argument.
- # This can happen when creating conditional directories.
- exit 0
-fi
+## this sed command emulates the dirname command
+dstdir=`echo "$dstarg" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-if test -z "$dir_arg"; then
- trap '(exit $?); exit' 1 2 13 15
-
- # Set umask so as not to create temps with too-generous modes.
- # However, 'strip' requires both read and write access to temps.
- case $mode in
- # Optimize common cases.
- *644) cp_umask=133;;
- *755) cp_umask=22;;
-
- *[0-7])
- if test -z "$stripcmd"; then
- u_plus_rw=
- else
- u_plus_rw='% 200'
- fi
- cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
- *)
- if test -z "$stripcmd"; then
- u_plus_rw=
- else
- u_plus_rw=,u+rw
- fi
- cp_umask=$mode$u_plus_rw;;
- esac
-fi
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
-for src
-do
- # Protect names starting with `-'.
- case $src in
- -*) src=./$src ;;
- esac
-
- if test -n "$dir_arg"; then
- dst=$src
- dstdir=$dst
- test -d "$dstdir"
- dstdir_status=$?
- else
-
- # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
- # might cause directories to be created, which would be especially bad
- # if $src (and thus $dsttmp) contains '*'.
- if test ! -f "$src" && test ! -d "$src"; then
- echo "$0: $src does not exist." >&2
- exit 1
- fi
-
- if test -z "$dstarg"; then
- echo "$0: no destination specified." >&2
- exit 1
- fi
-
- dst=$dstarg
- # Protect names starting with `-'.
- case $dst in
- -*) dst=./$dst ;;
- esac
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $doit $mkdirprog "${pathcomp}"
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "${pathcomp}"; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "${pathcomp}"; else true ; fi &&
+ if [ x"$pathcompchmodcmd" != x ]; then $doit $pathcompchmodcmd "${pathcomp}"; else true ; fi
- # If destination is a directory, append the input filename; won't work
- # if double slashes aren't ignored.
- if test -d "$dst"; then
- if test -n "$no_target_directory"; then
- echo "$0: $dstarg: Is a directory" >&2
- exit 1
- fi
- dstdir=$dst
- dst=$dstdir/`basename "$src"`
- dstdir_status=0
- else
- # Prefer dirname, but fall back on a substitute if dirname fails.
- dstdir=`
- (dirname "$dst") 2>/dev/null ||
- expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$dst" : 'X\(//\)[^/]' \| \
- X"$dst" : 'X\(//\)$' \| \
- X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
- echo X"$dst" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'
- `
-
- test -d "$dstdir"
- dstdir_status=$?
- fi
- fi
-
- obsolete_mkdir_used=false
-
- if test $dstdir_status != 0; then
- case $posix_mkdir in
- '')
- # Create intermediate dirs using mode 755 as modified by the umask.
- # This is like FreeBSD 'install' as of 1997-10-28.
- umask=`umask`
- case $stripcmd.$umask in
- # Optimize common cases.
- *[2367][2367]) mkdir_umask=$umask;;
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
- *[0-7])
- mkdir_umask=`expr $umask + 22 \
- - $umask % 100 % 40 + $umask % 20 \
- - $umask % 10 % 4 + $umask % 2
- `;;
- *) mkdir_umask=$umask,go-w;;
- esac
-
- # With -d, create the new directory with the user-specified mode.
- # Otherwise, rely on $mkdir_umask.
- if test -n "$dir_arg"; then
- mkdir_mode=-m$mode
else
- mkdir_mode=
+ true
fi
- posix_mkdir=false
- case $umask in
- *[123567][0-7][0-7])
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
- ;;
- *)
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
- if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
- then
- if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writeable bit of parent directory when it shouldn't.
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
- case $ls_ld_tmpdir in
- d????-?r-*) different_mode=700;;
- d????-?--*) different_mode=755;;
- *) false;;
- esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
- }
- }
- then posix_mkdir=:
- fi
- rmdir "$tmpdir/d" "$tmpdir"
- else
- # Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
- fi
- trap '' 0;;
- esac;;
- esac
+ pathcomp="${pathcomp}/"
+done
+fi
- if
- $posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
- )
- then :
- else
-
- # The umask is ridiculous, or mkdir does not conform to POSIX,
- # or it failed possibly due to a race condition. Create the
- # directory the slow way, step by step, checking for races as we go.
-
- case $dstdir in
- /*) prefix=/ ;;
- -*) prefix=./ ;;
- *) prefix= ;;
- esac
-
- case $posix_glob in
- '')
- if (set -f) 2>/dev/null; then
- posix_glob=true
- else
- posix_glob=false
- fi ;;
- esac
-
- oIFS=$IFS
- IFS=/
- $posix_glob && set -f
- set fnord $dstdir
- shift
- $posix_glob && set +f
- IFS=$oIFS
-
- prefixes=
-
- for d
- do
- test -z "$d" && continue
-
- prefix=$prefix$d
- if test -d "$prefix"; then
- prefixes=
+ if [ x"$dir_arg" != x ]
+ then
+ if [ -d "$dstarg" ]; then
+ true
+ else
+ $doit $mkdirprog "$dstarg" &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dstarg"; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dstarg"; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dstarg"; else true ; fi
+ fi
else
- if $posix_mkdir; then
- (umask=$mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
- # Don't fail if two instances are running concurrently.
- test -d "$prefix" || exit 1
- else
- case $prefix in
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
- *) qprefix=$prefix;;
- esac
- prefixes="$prefixes '$qprefix'"
- fi
+
+ if [ x"$dstisfile" = x ]
+ then
+ file=$srcarg
+ else
+ file=$dst
+ fi
+
+ dstfile=`basename "$file"`
+ dstfinal="$dstdir/$dstfile"
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Make a backup file name in the proper directory.
+ case x$suffixfmt in
+ *%*) suffix=`echo x |
+ $awkprog -v bname="$dstfinal" -v fmt="$suffixfmt" '
+ { cnt = 0;
+ do {
+ sfx = sprintf(fmt, cnt++);
+ name = bname sfx;
+ } while (system("test -f " name) == 0);
+ print sfx; }' -`;;
+ x) ;;
+ *) suffix="$suffixfmt";;
+ esac
+ dstbackup="$dstfinal$suffix"
+
+# Move or copy the file name to the temp name
+
+ $doit $doinst $srcarg "$dsttmp" &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripflags "$dsttmp"; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ if [ x"$suffix" != x ] && [ -f "$dstfinal" ]
+ then
+ $doit $mvcmd "$dstfinal" "$dstbackup"
+ else
+ $doit $rmcmd -f "$dstfinal"
+ fi &&
+ $doit $mvcmd "$dsttmp" "$dstfinal"
fi
- prefix=$prefix/
- done
-
- if test -n "$prefixes"; then
- # Don't fail if two instances are running concurrently.
- (umask $mkdir_umask &&
- eval "\$doit_exec \$mkdirprog $prefixes") ||
- test -d "$dstdir" || exit 1
- obsolete_mkdir_used=true
- fi
- fi
- fi
-
- if test -n "$dir_arg"; then
- { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
- { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
- { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
- test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
- else
-
- # Make a couple of temp file names in the proper directory.
- dsttmp=$dstdir/_inst.$$_
- rmtmp=$dstdir/_rm.$$_
-
- # Trap to clean up those temp files at exit.
- trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
- # Copy the file name to the temp name.
- (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
- # and set any options; do chmod last to preserve setuid bits.
- #
- # If any of these fail, we abort the whole thing. If we want to
- # ignore errors from any of these, just make sure not to ignore
- # errors from the above "$doit $cpprog $src $dsttmp" command.
- #
- { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
- && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
- && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
- && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
- # Now rename the file to the real destination.
- { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
- || {
- # The rename failed, perhaps because mv can't rename something else
- # to itself, or perhaps because mv is so ancient that it does not
- # support -f.
-
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- if test -f "$dst"; then
- $doit $rmcmd -f "$dst" 2>/dev/null \
- || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
- && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
- || {
- echo "$0: cannot unlink or rename $dst" >&2
- (exit 1); exit 1
- }
- else
- :
- fi
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dst"
- }
- } || exit 1
-
- trap '' 0
- fi
-done
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+done &&
+
+
+exit 0
diff --git a/man/Makefile.am b/man/Makefile.am
index bcdd17b..b27d1cf 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -52,8 +52,8 @@ AUTOMAKE_OPTIONS=foreign no-dependencies
man_gen_MANS = lg.conf.5 rancid.conf.5 lg_intro.1
man_nogen_MANS = agmrancid.1 alogin.1 arancid.1 avologin.1 avorancid.1 \
blogin.1 brancid.1 cat5rancid.1 clogin.1 cloginrc.5 \
- control_rancid.1 cssrancid.1 elogin.1 erancid.1 f10rancid.1 \
- flogin.1 fnrancid.1 francid.1 hlogin.1 hrancid.1 \
+ control_rancid.1 cssrancid.1 elogin.1 erancid.1 f5rancid.1 \
+ f10rancid.1 flogin.1 fnrancid.1 francid.1 hlogin.1 hrancid.1 \
htlogin.1 htrancid.1 jerancid.1 jlogin.1 jrancid.1 \
mrancid.1 nlogin.1 nrancid.1 nslogin.1 nsrancid.1 nxrancid.1 \
par.1 prancid.1 rancid-cvs.1 rancid-run.1 rancid.1 \
diff --git a/man/Makefile.in b/man/Makefile.in
index 10f764c..c36f7f0 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -172,8 +172,8 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
man_gen_MANS = lg.conf.5 rancid.conf.5 lg_intro.1
man_nogen_MANS = agmrancid.1 alogin.1 arancid.1 avologin.1 avorancid.1 \
blogin.1 brancid.1 cat5rancid.1 clogin.1 cloginrc.5 \
- control_rancid.1 cssrancid.1 elogin.1 erancid.1 f10rancid.1 \
- flogin.1 fnrancid.1 francid.1 hlogin.1 hrancid.1 \
+ control_rancid.1 cssrancid.1 elogin.1 erancid.1 f5rancid.1 \
+ f10rancid.1 flogin.1 fnrancid.1 francid.1 hlogin.1 hrancid.1 \
htlogin.1 htrancid.1 jerancid.1 jlogin.1 jrancid.1 \
mrancid.1 nlogin.1 nrancid.1 nslogin.1 nsrancid.1 nxrancid.1 \
par.1 prancid.1 rancid-cvs.1 rancid-run.1 rancid.1 \
diff --git a/man/clogin.1 b/man/clogin.1
index 077403c..94d0354 100644
--- a/man/clogin.1
+++ b/man/clogin.1
@@ -1,13 +1,13 @@
.\"
.hys 50
-.TH "clogin" "1" "27 February 2008"
+.TH "clogin" "1" "16 April 2009"
.SH NAME
clogin \- Cisco/Foundry login script
.SH SYNOPSIS
.B clogin
[\fB\-autoenable\fP]
[\fB\-noenable\fP]
-[\fB\-dV\fR]
+[\fB\-dSV\fR]
[\c
.BI \-c\
command]
@@ -95,6 +95,10 @@ configuration file.
.PP
The command-line options are as follows:
.TP
+.B \-S
+Save the configuration on exit, if the device prompts at logout time.
+This only has affect when used with -s.
+.TP
.B \-V
Prints package name and version strings.
.\"
@@ -265,6 +269,9 @@ The Extreme is supported by
but it has no concept of an "enabled" privilege level. You must
set autoenable for these devices in your
.IR .cloginrc .
+.PP
+The -S option is a recent addition, it may not be supported in all of the
+login scripts or for every target device.
.\"
.SH BUGS
Do not use greater than (>) or pound sign (#) in device banners. These
diff --git a/man/f5rancid.1 b/man/f5rancid.1
new file mode 100644
index 0000000..b4633ee
--- /dev/null
+++ b/man/f5rancid.1
@@ -0,0 +1 @@
+.so man1/rancid.1
diff --git a/man/router.db.5 b/man/router.db.5
index 5d65880..273c387 100644
--- a/man/router.db.5
+++ b/man/router.db.5
@@ -67,10 +67,6 @@ An Avocent Cyclades console server.
A Bay Networks router.
.TP
.ID 15n
-.B bigip
-A F5 BigIP switch.
-.TP
-.ID 15n
.B cat5
A Cisco catalyst series 5000 and 4000 switches (i.e.: running the catalyst OS,
not IOS).
@@ -107,6 +103,10 @@ An Extreme switch.
An ADC-Kentrox EZ-T3 mux.
.TP
.ID 15n
+.B f5
+A F5 BigIP switch.
+.TP
+.ID 15n
.B force10
A Force10 router.
.TP
@@ -122,7 +122,7 @@ HP9304M.
.TP
.ID 15n
.B hitachi
-A Hitachi routers.
+A Hitachi router.
.TP
.ID 15n
.B hp
@@ -135,7 +135,7 @@ type.
A Juniper router.
.TP
.B mrtd
-A host running the (merit) MRTd daemon.
+A host running the (Merit) MRTd daemon.
.TP
.ID 15n
.B netscalar