summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTar Committer <tar@ocjtech.us>2005-07-07 01:14:43 +0000
committerTar Committer <tar@ocjtech.us>2005-07-07 01:14:43 +0000
commit96dc4026054df77affedfe50380a661dcdba732a (patch)
tree0c8de7e68e7f316bf312cecce0b76e1f76b63020
parent4d684aecaacc9a59e7e9c0661934aeba0b16efec (diff)
downloadrancid-96dc4026054df77affedfe50380a661dcdba732a.zip
rancid-96dc4026054df77affedfe50380a661dcdba732a.tar.gz
rancid-96dc4026054df77affedfe50380a661dcdba732a.tar.xz
Imported from rancid-2.3.2a2.tar.gz.rancid-2.3.2a2
-rw-r--r--CHANGES18
-rw-r--r--Makefile.in82
-rw-r--r--Todo3
-rw-r--r--aclocal.m4540
-rw-r--r--bin/Makefile.in32
-rw-r--r--bin/alogin.in269
-rw-r--r--bin/arancid.in94
-rw-r--r--bin/blogin.in46
-rw-r--r--bin/brancid.in62
-rw-r--r--bin/cat5rancid.in112
-rw-r--r--bin/clogin.in29
-rw-r--r--bin/control_rancid.in63
-rw-r--r--bin/cssrancid.in57
-rw-r--r--bin/elogin.in33
-rw-r--r--bin/erancid.in63
-rw-r--r--bin/f10rancid.in125
-rw-r--r--bin/flogin.in64
-rw-r--r--bin/fnrancid.in66
-rw-r--r--bin/francid.in69
-rw-r--r--bin/hlogin.in20
-rw-r--r--bin/hpuifilter.c12
-rw-r--r--bin/hrancid.in66
-rw-r--r--bin/htlogin.in33
-rw-r--r--bin/htrancid.in56
-rw-r--r--bin/jerancid.in65
-rw-r--r--bin/jlogin.in28
-rw-r--r--bin/jrancid.in101
-rw-r--r--bin/mrancid.in52
-rw-r--r--bin/nlogin.in265
-rw-r--r--bin/nrancid.in109
-rw-r--r--bin/nslogin.in29
-rw-r--r--bin/nsrancid.in60
-rw-r--r--bin/par.in6
-rwxr-xr-xbin/prancid.in61
-rw-r--r--bin/rancid-fe.in4
-rw-r--r--bin/rancid-run.in4
-rw-r--r--bin/rancid.in215
-rw-r--r--bin/rivlogin.in151
-rw-r--r--bin/rivrancid.in79
-rw-r--r--bin/rrancid.in75
-rw-r--r--bin/tntlogin.in50
-rw-r--r--bin/tntrancid.in78
-rw-r--r--bin/xrancid.in67
-rwxr-xr-xbin/zrancid.in50
-rwxr-xr-xconfigure66
-rwxr-xr-xdepcomp65
-rw-r--r--etc/Makefile.in18
-rw-r--r--etc/lg.conf.sample.in6
-rw-r--r--etc/rancid.conf.sample.in10
-rw-r--r--include/Makefile.in10
-rw-r--r--include/version.h2
-rw-r--r--include/version.h.in2
-rwxr-xr-xinstall-sh102
-rw-r--r--man/Makefile.in8
-rw-r--r--man/rancid.conf.5.in21
-rwxr-xr-xmissing85
-rwxr-xr-xmkinstalldirs6
-rw-r--r--share/Makefile.in21
-rw-r--r--share/cisco-load.exp68
-rw-r--r--share/cisco-reload.exp22
-rw-r--r--share/downreport.in25
-rw-r--r--share/lgnotes.html2
-rw-r--r--share/rtrfilter.in4
63 files changed, 2253 insertions, 1853 deletions
diff --git a/CHANGES b/CHANGES
index 91dc4ed..25ad1e9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,20 @@
-2.3.2a
+2.3.2
+ Add a MAILHEADERS configuration variable for user-defined mail headers
+
+ rancid: match HSRP group numbers greater than 1 char wide - Ed Ravin
+
+ nrancid: filter radius secrest - Jee Kay
+
+ *rancid: collapse the two command list definitions to an array of
+ hashrefs and build the lists from it - Ed Ravin
+
+ *login: ignore rsh on platforms that do not support it and on those
+ that do (eg: cisco), skip rsh for interactive and script (-s) logins.
+
+ add MAX_ROUNDS rancid.conf knob - Mardechai Abzug
+
+ control_rancid: fix adminmailrcpt default - Danny Thomas
+
rancid: correct handling of SNMPv3 host configs - Patrick Adlam
rancid: filter nv_hdr file seen on sup720 - Bill Ouchark
diff --git a/Makefile.in b/Makefile.in
index d8d8a91..0f42ead 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.4 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -59,6 +59,12 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(pkgdatadir)"
pkgdataDATA_INSTALL = $(INSTALL_DATA)
DATA = $(pkgdata_DATA)
@@ -155,6 +161,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
@@ -233,7 +241,7 @@ install-pkgdataDATA: $(pkgdata_DATA)
test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
@list='$(pkgdata_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
+ f=$(am__strip_dir) \
echo " $(pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
$(pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
done
@@ -241,7 +249,7 @@ install-pkgdataDATA: $(pkgdata_DATA)
uninstall-pkgdataDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgdata_DATA)'; for p in $$list; do \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
+ f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
done
@@ -253,7 +261,13 @@ uninstall-pkgdataDATA:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @set fnord $$MAKEFLAGS; amf=$$2; \
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -265,7 +279,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ || eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -273,7 +287,13 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @set fnord $$MAKEFLAGS; amf=$$2; \
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -294,7 +314,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ || eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -328,7 +348,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test -f $$subdir/TAGS && \
+ test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
@@ -339,7 +359,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -z "$$unique" && unique=$$empty_fix; \
+ test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
@@ -396,15 +416,17 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
- list='$(SUBDIRS)'; for subdir in $$list; do \
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
- || mkdir "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="../$(top_distdir)" \
- distdir="../$(distdir)/$$subdir" \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
@@ -415,15 +437,15 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
- $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
- $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
- $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
@@ -436,7 +458,7 @@ dist-zip: distdir
$(am__remove_distdir)
dist dist-all: distdir
- $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
@@ -445,11 +467,11 @@ dist dist-all: distdir
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
- GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
- bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
- uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
@@ -533,7 +555,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
- -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -597,14 +619,14 @@ uninstall-info: uninstall-info-recursive
dist-tarZ dist-zip distcheck distclean distclean-generic \
distclean-recursive distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-exec \
- install-exec-am install-info install-info-am install-man \
- install-pkgdataDATA install-strip installcheck installcheck-am \
- installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic maintainer-clean-recursive \
- mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
- pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
- uninstall-info-am uninstall-pkgdataDATA
+ install install-am install-data install-data-am \
+ install-data-hook install-exec install-exec-am install-info \
+ install-info-am install-man install-pkgdataDATA install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am uninstall-pkgdataDATA
@SET_MAKE@
diff --git a/Todo b/Todo
index dbf5e17..c955c52 100644
--- a/Todo
+++ b/Todo
@@ -1,3 +1,4 @@
+- jrancid doesnt use $timeo
- lg.conf(5) needs the query stuff documented.
- subversion support in addition to CVS
- configure OLDTIME per-group
@@ -53,7 +54,7 @@
this is clouded by the UI mess.
- rancid needs to treat the 3600s like the 7Ks and 12Ks...
Also, need to allow 12012s, and force 700s to not be treated like 7Ks.
-- clogin/jlogin rsh is munged
+- clogin rsh is munged
- LG should sort routers
- LG {requested} command additions
- show controllers T3 (data)
diff --git a/aclocal.m4 b/aclocal.m4
index ac67328..3ebc46f 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.8.4 -*- Autoconf -*-
+# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -11,55 +11,32 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-# -*- Autoconf -*-
-# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-# Generated from amversion.in; do not edit by hand.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
-AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"])
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
- [AM_AUTOMAKE_VERSION([1.8.4])])
-
-# AM_AUX_DIR_EXPAND
-
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ [AM_AUTOMAKE_VERSION([1.9.5])])
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
@@ -106,26 +83,16 @@ AC_PREREQ([2.50])dnl
am_aux_dir=`cd $ac_aux_dir && pwd`
])
-# AM_CONDITIONAL -*- Autoconf -*-
+# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 6
+# serial 7
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
@@ -145,30 +112,19 @@ else
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
- AC_MSG_ERROR([conditional "$1" was never defined.
-Usually this means the macro was only invoked conditionally.])
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
fi])])
-# serial 7 -*- Autoconf -*-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
+# serial 8
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
@@ -177,7 +133,6 @@ fi])])
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
-
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
@@ -317,26 +272,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
-# Generate code to set up dependency tracking. -*- Autoconf -*-
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# Generate code to set up dependency tracking. -*- Autoconf -*-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-#serial 2
+#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
@@ -355,27 +300,21 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
else
continue
fi
- grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
- # Extract the definition of DEP_FILES from the Makefile without
- # running `make'.
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
- test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
- # We invoke sed twice because it is the simplest approach to
- # changing $(DEPDIR) to its actual value in the expansion.
- for file in `sed -n '
- /^DEP_FILES = .*\\\\$/ {
- s/^DEP_FILES = //
- :loop
- s/\\\\$//
- p
- n
- /\\\\$/ b loop
- p
- }
- /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
@@ -401,30 +340,19 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
-# Do all the work for Automake. -*- Autoconf -*-
-
-# This macro actually does too much some checks are only needed if
-# your package does certain things. But this isn't really a big deal.
+# Do all the work for Automake. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# serial 12
-# serial 11
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
@@ -482,7 +410,6 @@ AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
-AM_MISSING_PROG(AMTAR, tar)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
@@ -491,7 +418,9 @@ AC_REQUIRE([AM_PROG_MKDIR_P])dnl
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
@@ -525,51 +454,27 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
-
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
-# -*- Autoconf -*-
-# Copyright (C) 2003 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 1
+# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
@@ -584,26 +489,15 @@ fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
-# Check to see how 'make' treats includes. -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+# Check to see how 'make' treats includes. -*- Autoconf -*-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 2
+# serial 3
# AM_MAKE_INCLUDE()
# -----------------
@@ -647,27 +541,16 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
-# -*- Autoconf -*-
-
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 3
+# serial 4
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
@@ -693,27 +576,16 @@ else
fi
])
+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
-
-# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
+#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
@@ -734,13 +606,21 @@ fi
# this.)
AC_DEFUN([AM_PROG_MKDIR_P],
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
- # Keeping the `.' argument allows $(mkdir_p) to be used without
- # argument. Indeed, we sometimes output rules like
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
- # where $(somedir) is conditionally defined.
- # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more
- # expensive solution, as it forces Make to start a sub-shell.)
- mkdir_p='mkdir -p -- .'
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
@@ -759,26 +639,15 @@ else
fi
AC_SUBST([mkdir_p])])
-# Helper functions for option handling. -*- Autoconf -*-
+# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 2
+# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@@ -803,26 +672,14 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-
-# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003
+# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005
# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 3
+# serial 4
AC_DEFUN([AM_C_PROTOTYPES],
[AC_REQUIRE([AC_C_PROTOTYPES])
@@ -840,28 +697,16 @@ AC_SUBST(ANSI2KNR)dnl
AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
-#
-# Check to make sure that the build environment is sane.
-#
-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 3
+# serial 4
# AM_SANITY_CHECK
# ---------------
@@ -904,25 +749,14 @@ Check your system clock])
fi
AC_MSG_RESULT(yes)])
-# AM_PROG_INSTALL_STRIP
-
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+# AM_PROG_INSTALL_STRIP
+# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
@@ -943,4 +777,100 @@ fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
m4_include([acinclude.m4])
diff --git a/bin/Makefile.in b/bin/Makefile.in
index 99a55ca..2bcfa3e 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.4 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -80,7 +80,6 @@ SCRIPTS = $(bin_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/hpuifilter.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
@@ -175,6 +174,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
@@ -198,15 +199,12 @@ target_alias = @target_alias@
#AUTOMAKE_OPTIONS=foreign no-dependencies
AUTOMAKE_OPTIONS = foreign
-bin_SCRIPTS = cat5rancid control_rancid \
- alogin arancid clogin blogin brancid cssrancid \
- elogin erancid f10rancid flogin francid fnrancid \
- jlogin jrancid jerancid \
- hlogin hrancid htlogin htrancid \
- mrancid nlogin nrancid nslogin nsrancid par prancid \
- rancid rancid-fe rivlogin rivrancid rrancid \
- tntlogin tntrancid xrancid zrancid\
-lg.cgi lgform.cgi rancid-cvs rancid-run
+bin_SCRIPTS = cat5rancid control_rancid alogin arancid clogin blogin \
+ brancid cssrancid elogin erancid f10rancid flogin francid \
+ fnrancid jlogin jrancid jerancid hlogin hrancid htlogin \
+ htrancid mrancid nlogin nrancid nslogin nsrancid par prancid \
+ rancid rancid-fe rivlogin rivrancid rrancid tntlogin tntrancid \
+ 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
@@ -403,16 +401,14 @@ distclean-compile:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
@@ -437,7 +433,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -z "$$unique" && unique=$$empty_fix; \
+ test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
@@ -518,7 +514,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
diff --git a/bin/alogin.in b/bin/alogin.in
index c0e5c40..537c506 100644
--- a/bin/alogin.in
+++ b/bin/alogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
-#
-## $Id: alogin.in,v 1.24 2004/12/24 21:00:31 tex Exp $
+##
+## $Id: alogin.in,v 1.30 2005/06/14 20:20:43 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -24,13 +24,247 @@
# alogin - Alteon WebOS switch login
#
# afort@choqolat.org is responsible for this particular mess
-# (andrew fort)
+# (andrew fort)
+#
+
+# Usage line
+set usage "Usage: $argv0 \[-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
+
+# Password file
+set password_file $env(HOME)/.cloginrc
+# Default is to login to the router
+set do_command 0
+set do_script 0
+# The default is to automatically enable
+set avenable 1
+# The default is that you login non-enabled (tacacs can have you login already
+# enabled)
+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
+
+# Find the user in the ENV, or use the unix userid.
+if {[ info exists env(CISCO_USER) ]} {
+ set default_user $env(CISCO_USER)
+} elseif {[ info exists env(USER) ]} {
+ set default_user $env(USER)
+} elseif {[ info exists env(LOGNAME) ]} {
+ set default_user $env(LOGNAME)
+} 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.
+ if [ catch {exec id} reason ] {
+ send_error "\nError: could not exec id: $reason\n"
+ exit 1
+ }
+ regexp {\(([^)]*)} "$reason" junk default_user
+}
+
+# Sometimes routers take awhile to answer (the default is 10 sec)
+set timeout 45
+
+# Process the command line
+for {set i 0} {$i < $argc} {incr i} {
+ set arg [lindex $argv $i]
+
+ switch -glob -- $arg {
+ # Username
+ -u* -
+ -U* {
+ if {! [ regexp .\[uU\](.+) $arg ignore user]} {
+ incr i
+ set username [ lindex $argv $i ]
+ }
+ # VTY Password
+ } -v* -
+ -v* {
+ if {! [ regexp .\[vV\](.+) $arg ignore passwd]} {
+ incr i
+ set passwd [ lindex $argv $i ]
+ }
+ set do_passwd 0
+ # Enable Username
+ } -w* -
+ -W* {
+ # ignore -w
+ # Environment variable to pass to -s scripts
+ } -E*
+ {
+ if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
+ incr i
+ set E$varname $varvalue
+ } else {
+ send_user "\nError: invalid format for -E in $arg\n"
+ exit 1
+ }
+ # Enable Password
+ } -e*
+ {
+ # ignore -e
+ # Command to run.
+ } -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* {
+ if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
+ incr i
+ set sfile [ lindex $argv $i ]
+ }
+ if { ! [ file readable $sfile ] } {
+ send_user "\nError: Can't read $sfile\n"
+ exit 1
+ }
+ set do_script 1
+ # 'ssh -c' cypher type
+ } -y* -
+ -Y* {
+ if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
+ incr i
+ set cypher [ lindex $argv $i ]
+ }
+ # alternate cloginrc file
+ } -f* -
+ -F* {
+ if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
+ incr i
+ set password_file [ lindex $argv $i ]
+ }
+ # Timeout
+ } -t* -
+ -T* {
+ if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
+ incr i
+ set timeout [ lindex $argv $i ]
+ }
+ # Command file
+ } -x* -
+ -X {
+ if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
+ incr i
+ set cmd_file [ lindex $argv $i ]
+ }
+ 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
+ # Do we enable?
+ } -noenable {
+ # ignore -noenable
+ # Does tacacs automatically enable us?
+ } -autoenable {
+ # ignore -autoenable
+ } -* {
+ send_user "\nError: Unknown argument! $arg\n"
+ send_user $usage
+ exit 1
+ } default {
+ break
+ }
+ }
+}
+# Process routers...no routers listed is an error.
+if { $i == $argc } {
+ send_user "\nError: $usage"
+}
+
+# Only be quiet if we are running a script (it can log its output
+# on its own)
+if { $do_script } {
+ log_user 0
+} else {
+ log_user 1
+}
+
+#
+# Done configuration/variable setting. Now run with it...
#
-# alogin: doesn't understand enable. It will just ignore the enable options.
-@INCLUDE login.top@
+# 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 }
+ }
+ # take host from ENV(TERM)
+ 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"
+ }
+ }
+}
+
+# This is a helper function to make the password file easier to
+# maintain. Using this the password file has the form:
+# add password sl* pete cow
+# add password at* steve
+# add password * hanky-pie
+proc add {var args} { global int_$var ; lappend int_$var $args}
+proc include {args} {
+ global env
+ regsub -all "(^{|}$)" $args {} args
+ if { [ regexp "^/" $args ignore ] == 0 } {
+ set args $env(HOME)/$args
+ }
+ source_password_file $args
+}
+
+proc find {var router} {
+ upvar int_$var list
+ if { [info exists list] } {
+ foreach line $list {
+ if { [string match [lindex $line 0] $router ] } {
+ return [lrange $line 1 end]
+ }
+ }
+ }
+ return {}
+}
+
+# Loads the password file. Note that as this file is tcl, and that
+# it is sourced, the user better know what to put in there, as it
+# could install more than just password info... I will assume however,
+# 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 { password_file } {
+ global env
+ if { ! [file exists $password_file] } {
+ send_user "\nError: password file ($password_file) does not exist\n"
+ exit 1
+ }
+ file stat $password_file fileinfo
+ if { [expr ($fileinfo(mode) & 007)] != 0000 } {
+ send_user "\nError: $password_file must not be world readable/writable\n"
+ exit 1
+ }
+ if [ catch {source $password_file} reason ] {
+ send_user "\nError: $reason\n"
+ exit 1
+ }
+}
# Log into the router.
+# returns: 0 on success, 1 on failure
proc login { router user userpswd passwd prompt cmethod cyphertype } {
global spawn_id in_proc do_command do_script
global u_prompt p_prompt sshcmd
@@ -40,6 +274,7 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
@@ -49,23 +284,23 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
- exit 1
+ return 1
}
- } elseif ![string compare $prog "ssh"] {
+ } elseif ![string compare $prog "ssh"] {
if [ catch {spawn $sshcmd -c $cyphertype -x -l $user $router} reason ] {
send_user "\nError: $sshcmd failed: $reason\n"
- exit 1
- }
- } elseif ![string compare $prog "rsh"] {
- if [ catch {spawn rsh -l $user $router} reason ] {
- send_user "\nError: rsh failed: $reason\n"
- exit 1
+ return 1
}
- } else {
- puts "\nError: unknown connection method: $prog"
+ } elseif ![string compare $prog "rsh"] {
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
+ }
+ continue;
+ } else {
+ send_user "\nError: unknown connection method: $prog\n"
return 1
- }
- incr progs -1
+ }
sleep 0.3
# This helps cleanup each expect clause.
diff --git a/bin/arancid.in b/bin/arancid.in
index a2bf1ef..4c843b2 100644
--- a/bin/arancid.in
+++ b/bin/arancid.in
@@ -1,8 +1,8 @@
#! @PERLV_PATH@
##
-## $Id: arancid.in,v 1.14 2004/01/11 03:49:13 heas Exp $
+## $Id: arancid.in,v 1.19 2005/06/15 20:55:12 heas Exp $
##
-## Hacked version of rancid for Alteon WebOS switches
+## Hacked version of rancid for Alteon WebOS switches
## tested with: ad3 v8.1.18
## afort@choqolat.org (andrew fort)
##
@@ -24,7 +24,7 @@
##
#
# RANCID - Really Awesome New Cisco confIg Differ
-#
+#
# arancid - Alteon WebOS plugin for rancid
#
# usage: arancid [-d] [-l] [-f filename | $host]
@@ -38,13 +38,16 @@ $host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
$prompt = "#";
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # alogin timeout in seconds
+
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -66,10 +69,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -79,10 +82,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -92,10 +95,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -105,9 +108,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -121,7 +124,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -134,7 +137,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -142,23 +145,23 @@ sub sortbyipaddr {
# This routine parses "/info/sys" (cf. show version)
sub ShowVersion {
- print STDERR " In ShowVersion: $_" if ($debug);
+ print STDERR " In ShowVersion: $_" if ($debug);
+
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/^>>.*$prompt/);
+ next if(/^(\s*|\s*$cmd\s*)$/);
- while (<INPUT>) {
- tr/\015//d;
- last if (/^>>.*$prompt/);
- next if(/^(\s*|\s*$cmd\s*)$/);
-
- /^(ACEdirector.*|ACEswitch.*|Alteon.*)/i &&
+ /^(ACEdirector.*|ACEswitch.*|Alteon.*)/i &&
ProcessHistory("COMMENTS","keysort","A1", "\/\*Model: $1\n") && next;
/^Software Version\s+(.*?)\s\((.*)\)/i &&
ProcessHistory("COMMENTS","keysort","B1", "\/\*Image: Software: $1 ($2)\n") && next;
/^Hardware Part No:\s+(.*?)\s+/i &&
ProcessHistory("COMMENTS","keysort","A2", "\/\*Hardware part no: $1\n") && next;
/^MAC address:\s+([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})/i &&
- ProcessHistory("COMMENTS","keysort","C1", "\/\*Base MAC address: $1\n") && next;
- }
- return(0);
+ ProcessHistory("COMMENTS","keysort","C1", "\/\*Base MAC address: $1\n") && next;
+ }
+ return(0);
}
# This routine processes a "/cfg/dump"
@@ -170,10 +173,10 @@ sub WriteTerm {
# now just copy it verbatim to the history file
while (<INPUT>) {
- tr/\015//d;
- last if(/^>>.*$prompt/);
+ tr/\015//d;
+ last if(/^>>.*$prompt/);
chop;
- if (/(rcomm|wcomm|t1com|t2com)(\s+)(.*)/ &&
+ if (/(rcomm|wcomm|t1com|t2com)(\s+)(.*)/ &&
defined($ENV{'NOCOMMSTR'})) {
ProcessHistory("","","","\/\*\t$1$2\"<removed>\"\n") && next;
}
@@ -183,8 +186,8 @@ sub WriteTerm {
next if (/^\/\* Configuration dump taken/i);
next if (/^\/\* Version.*Base MAC.*/i);
- if (/^\/?script end/) {
- $found_end = 1;
+ if (/^\/?script end/) {
+ $found_end = 1;
ProcessHistory("","","","$_\n");
return(1);
}
@@ -198,16 +201,15 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- '/info/sys' => "ShowVersion",
- '/cfg/dump' => "WriteTerm",
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "/info/sys",
- "/cfg/dump",
+@commandtable = (
+ {'/info/sys' => 'ShowVersion'},
+ {'/cfg/dump' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -237,13 +239,13 @@ ProcessHistory("COMMENTS","keysort","F0","\/\*\n");
TOP: while(<INPUT>) {
tr/\015//d;
if (/^>>.*$prompt exit/) {
- $clean_run=1;
- last;
+ $clean_run=1;
+ last;
}
while (/>>.*$prompt\s*($cmds_regexp)\s*$/) {
- $cmd = $1;
- if (!defined($prompt)) {
+ $cmd = $1;
+ if (!defined($prompt)) {
$prompt = ($_ =~ /^([^#]+#)/)[0];
$prompt =~ s/([][}{)(\\])/\\$1/g;
print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
@@ -252,7 +254,7 @@ TOP: while(<INPUT>) {
if (!defined($commands{$cmd})) {
print STDERR "$host: found unexpected command - \"$cmd\"\n";
$clean_run = 0;
- last TOP;
+ last TOP;
}
$rval = &{$commands{$cmd}};
delete($commands{$cmd});
diff --git a/bin/blogin.in b/bin/blogin.in
index 90843ed..63dae4c 100644
--- a/bin/blogin.in
+++ b/bin/blogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: blogin.in,v 1.23 2004/02/02 17:38:36 heas Exp $
+## $Id: blogin.in,v 1.28 2005/06/14 20:20:43 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -56,7 +56,7 @@ set do_passwd 1
set do_enapasswd 0
# Find the user in the ENV, or use the unix userid.
-if {[ info exists env(CISCO_USER) ] } {
+if {[ info exists env(CISCO_USER) ]} {
set default_user $env(CISCO_USER)
} elseif {[ info exists env(USER) ]} {
set default_user $env(USER)
@@ -112,14 +112,14 @@ for {set i 0} {$i < $argc} {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 {
send_user "\nError: invalid format for -E in $arg\n"
exit 1
- }
+ }
# Enable Password
} -e*
{
@@ -237,25 +237,25 @@ proc label { host } {
# add password * hanky-pie
proc add {var args} { global int_$var ; lappend int_$var $args}
proc include {args} {
- global env
- regsub -all "(^{|}$)" $args {} args
+ global env
+ regsub -all "(^{|}$)" $args {} args
if { [ regexp "^/" $args ignore ] == 0 } {
set args $env(HOME)/$args
- }
+ }
source_password_file $args
-}
-
+}
+
proc find {var router} {
- upvar int_$var list
+ upvar int_$var list
if { [info exists list] } {
foreach line $list {
if { [string match [lindex $line 0] $router ] } {
return [lrange $line 1 end]
- }
- }
- }
- return {}
-}
+ }
+ }
+ }
+ return {}
+}
# Loads the password file. Note that as this file is tcl, and that
# it is sourced, the user better know what to put in there, as it
@@ -280,6 +280,7 @@ proc source_password_file { password_file } {
}
# Log into the router.
+# returns: 0 on success, 1 on failure
proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
global spawn_id in_proc do_command do_script
global u_prompt p_prompt e_prompt sshcmd
@@ -288,6 +289,7 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
@@ -297,23 +299,23 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
- exit 1
+ 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"
- exit 1
+ return 1
}
} elseif ![string compare $prog "rsh"] {
- if [ catch {spawn rsh -l $user $router} reason ] {
- send_user "\nError: rsh failed: $reason\n"
- exit 1
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
}
+ continue;
} else {
- puts "\nError: unknown connection method: $prog"
+ send_user "\nError: unknown connection method: $prog\n"
return 1
}
- incr progs -1
sleep 0.3
# This helps cleanup each expect clause.
diff --git a/bin/brancid.in b/bin/brancid.in
index c2e602e..8cb3e69 100644
--- a/bin/brancid.in
+++ b/bin/brancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: brancid.in,v 1.16 2004/01/11 03:49:13 heas Exp $
+## $Id: brancid.in,v 1.21 2005/06/15 20:55:13 heas Exp $
## hacked version of Hank's rancid - this one tries to deal with Bay's.
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
@@ -32,15 +32,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # blogin timeout in seconds
+$timeo = 90; # blogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -62,10 +63,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -75,10 +76,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -88,10 +89,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -101,9 +102,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -117,7 +118,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -130,7 +131,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -158,8 +159,8 @@ sub ShowConfig {
}
# ProcessHistory("","","","!$_");
if (/exit$/) {
- $found_end = 1;
- return(1);
+ $found_end = 1;
+ return(1);
}
return(0);
}
@@ -186,20 +187,17 @@ sub RunCommand {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'bcc' => "RunCommand",
- 'show config' => "ShowConfig",
- 'show config -all' => "ShowConfig",
- 'exit' => "RunCommand"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "bcc",
- "show config",
- "show config -all",
- "exit"
+@commandtable = (
+ {'bcc' => 'RunCommand'},
+ {'show config' => 'ShowConfig'},
+ {'show config -all' => 'ShowConfig'},
+ {'exit' => 'RunCommand'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -225,7 +223,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/cat5rancid.in b/bin/cat5rancid.in
index 174aead..bea31bb 100644
--- a/bin/cat5rancid.in
+++ b/bin/cat5rancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: cat5rancid.in,v 1.37 2005/03/20 22:15:35 heas Exp $
+## $Id: cat5rancid.in,v 1.43 2005/06/20 21:24:30 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -31,16 +31,17 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # clogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
my(%modules); # module info (part from sh ver, part from sh module)
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -62,10 +63,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -75,10 +76,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -88,10 +89,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -101,9 +102,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -117,7 +118,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -130,7 +131,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -671,8 +672,8 @@ sub ShowModule {
print STDERR " In ShowModule: $_" if ($debug);
OUTER:while (<INPUT>) {
- tr/\015//d;
- last if(/^$prompt/);
+ tr/\015//d;
+ last if(/^$prompt/);
# stuff module type into %module
if (/^Mod\s+Slot\s+Ports/) {
<INPUT>;
@@ -696,7 +697,7 @@ OUTER:while (<INPUT>) {
}
next;
}
- # one does it one way... pita
+ # one does it one way... pita
if (/^Mod\s+Module-Name\s+Ports/) {
<INPUT>;
#my($slot);
@@ -713,7 +714,7 @@ OUTER:while (<INPUT>) {
}
next;
}
- # daughter boards
+ # daughter boards
if (/^Mod\s+Sub-Type/) {
<INPUT>;
my($slot, $board);
@@ -767,7 +768,7 @@ OUTER:while (<INPUT>) {
ProcessHistory("MODS","","",$model);
if ($dboards) {ProcessHistory("MODS","","",$dboards);}
}
-}
+}
# This routine processes a "show port ifindex"
sub ShowPortIfindex {
@@ -790,7 +791,10 @@ sub ShowPortIfindex {
sub WriteTerm {
print STDERR " In WriteTerm: $_" if ($debug);
- ProcessHistory("","","","!\n");
+ if (! $found_end) {
+ ProcessHistory("","","","!\n");
+ }
+
while (<INPUT>) {
tr/\015//d;
last if (/^$prompt/);
@@ -822,9 +826,9 @@ sub WriteTerm {
/^#Time: / && next;
# Dog gone Cool matches to process the rest of the config
- /^#time: / && next; # kill time:
- /^tftp-server flash / && next; # kill any tftp remains
- /^ntp clock-period / && next; # kill ntp clock-period
+ /^#time: / && next; # kill time:
+ /^tftp-server flash / && next; # kill any tftp remains
+ /^ntp clock-period / && next; # kill ntp clock-period
/^ length / && next; # kill length on serial lines
/^ width / && next; # kill width on serial lines
if (/^enable password / && $filter_pwds >= 1) {
@@ -925,15 +929,15 @@ sub WriteTerm {
# order logging statements
/^set logging server (\d+\.\d+\.\d+\.\d+)/ &&
ProcessHistory("LOGGING","ipsort","$1","$_") && next;
- # order/prune snmp-server host statements
- # we only prune lines of the form
- # snmp-server host a.b.c.d <community>
+ # order/prune snmp-server host statements
+ # we only prune lines of the form
+ # snmp-server host a.b.c.d <community>
if (/^set snmp trap (\d+\.\d+\.\d+\.\d+) /) {
if (defined($ENV{'NOCOMMSTR'})) {
ProcessHistory("SNMPSERVERHOST","ipsort","$1","!set snmp trap $1 <removed>\n");
} else {
ProcessHistory("SNMPSERVERHOST","ipsort","$1","$_");
- }
+ }
next;
}
if (/^(set snmp community) (\S+) (\S+)/) {
@@ -991,38 +995,26 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'show version' => "ShowVersion",
- 'show boot' => "ShowBoot",
- 'show flash' => "ShowFlash",
- 'dir bootflash:' => "DirSlotN",
- 'dir slot0:' => "DirSlotN",
- 'dir slot1:' => "DirSlotN",
- 'dir sup-bootflash:' => "DirSlotN",
- 'dir sup-microcode:' => "DirSlotN",
- 'show module' => "ShowModule",
- 'show port ifindex' => "ShowPortIfindex",
- 'write term all' => "WriteTerm",
- 'write term' => "WriteTerm",
- 'show running-config' => "WriteTerm"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "show version",
- "show boot",
- "show flash",
- "dir bootflash:",
- "dir slot0:",
- "dir slot1:",
- "dir sup-bootflash:",
- "dir sup-microcode:",
- "show module",
- "show port ifindex",
- "write term all",
- "write term",
- "show running-config"
+@commandtable = (
+ {'show version' => 'ShowVersion'},
+ {'show boot' => 'ShowBoot'},
+ {'show flash' => 'ShowFlash'},
+ {'dir bootflash:' => 'DirSlotN'},
+ {'dir slot0:' => 'DirSlotN'},
+ {'dir slot1:' => 'DirSlotN'},
+ {'dir sup-bootflash:' => 'DirSlotN'},
+ {'dir sup-microcode:' => 'DirSlotN'},
+ {'show module' => 'ShowModule'},
+ {'show port ifindex' => 'ShowPortIfindex'},
+ {'write term all' => 'WriteTerm'},
+ {'write term' => 'WriteTerm'},
+ {'show running-config' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
diff --git a/bin/clogin.in b/bin/clogin.in
index 92bb2f8..d4f27db 100644
--- a/bin/clogin.in
+++ b/bin/clogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: clogin.in,v 1.79 2004/05/27 21:57:52 heas Exp $
+## $Id: clogin.in,v 1.85 2005/06/14 20:20:43 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -59,7 +59,7 @@ set do_enapasswd 1
set platform ""
# Find the user in the ENV, or use the unix userid.
-if {[ info exists env(CISCO_USER) ] } {
+if {[ info exists env(CISCO_USER) ]} {
set default_user $env(CISCO_USER)
} elseif {[ info exists env(USER) ]} {
set default_user $env(USER)
@@ -286,6 +286,7 @@ proc source_password_file { password_file } {
}
# Log into the router.
+# returns: 0 on success, 1 on failure
proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
global spawn_id in_proc do_command do_script platform
global prompt u_prompt p_prompt e_prompt sshcmd
@@ -295,6 +296,7 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
@@ -304,7 +306,7 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
- exit 1
+ return 1
}
} elseif [string match "ssh*" $prog] {
regexp {ssh(:([^[:space:]]+))*} $prog command suffix port
@@ -316,18 +318,23 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
}
if { $retval } {
send_user "\nError: $sshcmd failed: $reason\n"
- exit 1
+ return 1
}
} elseif ![string compare $prog "rsh"] {
+ if { ! $do_command } {
+ if { $progs == 0 } {
+ return 1
+ }
+ continue;
+ }
if [ catch {spawn rsh -l $user $router} reason ] {
send_user "\nError: rsh failed: $reason\n"
- exit 1
+ return 1
}
} else {
- puts "\nError: unknown connection method: $prog"
+ send_user "\nError: unknown connection method: $prog\n"
return 1
}
- incr progs -1
sleep 0.3
# This helps cleanup each expect clause.
@@ -617,10 +624,10 @@ foreach router [lrange $argv $i end] {
set router [string tolower $router]
send_user "$router\n"
- # Figure out prompt.
- # Since autoenable is off by default, if we have it defined, it
- # was done on the command line. If it is not specifically set on the
- # command line, check the password file.
+ # Figure out the prompt.
+ # autoenable is off by default. If we have it defined, it was done
+ # on the command line. If it is not specifically set on the command
+ # line, check the password file.
if $avautoenable {
set autoenable 1
set enable 0
diff --git a/bin/control_rancid.in b/bin/control_rancid.in
index bcfd316..c33411e 100644
--- a/bin/control_rancid.in
+++ b/bin/control_rancid.in
@@ -1,6 +1,6 @@
#! /bin/sh
##
-## $Id: control_rancid.in,v 1.64 2004/03/12 23:13:09 heas Exp $
+## $Id: control_rancid.in,v 1.69 2005/07/07 01:09:08 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -81,13 +81,23 @@ DIR=$BASEDIR/$GROUP
TMP=${TMPDIR:=/tmp}/rancid.$GROUP.$$
trap 'rm -fr $TMP;' 1 2 15
-# the receipient(s) of diffs
+# the receipient(s) of diffs & mail options
mailrcpt=${mailrcpt:-"@MAILPLUS@${GROUP}${MAILDOMAIN}"}; export mailrcpt
-adminmailrcpt=${mailrcpt:-"@ADMINMAILPLUS@${GROUP}${MAILDOMAIN}"};
+adminmailrcpt=${adminmailrcpt:-"@ADMINMAILPLUS@${GROUP}${MAILDOMAIN}"};
export adminmailrcpt
+set | grep MAILHEADERS= > /dev/null 2>&1
+if [ $? -ne 0 ] ; then
+ MAILHEADERS="Precedence: bulk\n"; export MAILHEADERS
+fi
# Number of things par should run in parallel.
PAR_COUNT=${PAR_COUNT:-5}
+# Number of times failed collections should be retried. Minimum 1.
+MAX_ROUNDS=${MAX_ROUNDS:-4}
+if [ $MAX_ROUNDS -lt 1 ] ; then
+ echo "Error: MAX_ROUNDS must be at least 1."
+ MAX_ROUNDS=1
+fi
# Bail if we do not have the necessary info to run
if [ ! -d $DIR ]
@@ -97,7 +107,7 @@ then
(
echo "To: $adminmailrcpt"
echo "Subject: no $GROUP directory"
- echo "Precedence: bulk"
+ echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
echo ""
echo "$DIR does not exist."
echo "Run bin/rancid-cvs $GROUP to make all of the needed directories."
@@ -123,7 +133,7 @@ then
(
echo "To: $adminmailrcpt"
echo "Subject: no $GROUP/router.db file"
- echo "Precedence: bulk"
+ echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
echo ""
echo "$DIR/router.db does not exist."
) | sendmail -t
@@ -134,7 +144,7 @@ fi
cd $DIR
trap 'rm -fr routers.db routers.all.new routers.down.new routers.up.new \
routers.mail routers.added routers.deleted $TMP;' 1 2 15
-sed -e '/^#/d' -e 's/^ *//' -e 's/ *$//' -e 's/ *: */:/g' router.db |
+sed -e '/^#/d' -e 's/^ *//' -e 's/ *$//' -e 's/ *: */:/g' router.db |
sort -u > routers.db
cut -d: -f1,2 routers.db > routers.all.new
if [ ! -f routers.all ] ; then touch routers.all; fi
@@ -175,10 +185,10 @@ then
WCDOWN=`comm -13 routers.down routers.down.new | wc -l | \
sed -e 's/^ *\([^ ]*\)/\1/'`
if [ $WCDOWN -eq 1 ] ; then
- echo Routers changed to down:
- comm -13 routers.down routers.down.new | \
+ echo Routers changed to down:
+ comm -13 routers.down routers.down.new | \
sed -e 's/^/ /'
- echo
+ echo
fi
fi
fi
@@ -193,14 +203,14 @@ then
if [ $WCADDED -gt 0 ]
then
- echo Added routers:
- cat routers.added
+ echo Added routers:
+ cat routers.added
echo
fi
if [ $WCDELETED -gt 0 ]
then
- echo Deleted routers:
- cat routers.deleted
+ echo Deleted routers:
+ cat routers.deleted
echo
fi
@@ -212,7 +222,7 @@ then
(
echo "To: $adminmailrcpt"
echo "Subject: changes in $GROUP routers"
- echo "Precedence: bulk"
+ echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
echo ""
cat routers.mail
) | sendmail -t
@@ -309,7 +319,7 @@ par -q -n $PAR_COUNT -c "rancid-fe \{}" $devlistfile
# This section will generate a list of missed routers
# and try to grab them again. It will run through
# $pass times.
-pass=4
+pass=$MAX_ROUNDS
round=1
if [ -f $DIR/routers.up.missed ]; then
rm -f $DIR/routers.up.missed
@@ -347,10 +357,10 @@ echo
# Make sure that no empty configs are accepted. Those that are non-empty
# are renamed from device_name.new -> device_name.
for router in `cat $devlistfile`
-do
+do
OFS=$IFS
IFS=':'
- set $router
+ set $router
IFS=$OFS
router=$1;
@@ -386,14 +396,15 @@ else
fi
# Mail out the diffs (if there are any).
-if [ -s $TMP.diff ]; then
- sendmail -t <<EMAIL
-To: $mailrcpt
-Subject: $subject
-Precedence: bulk
-
-`cat $TMP.diff`
-EMAIL
+if [ -s $TMP.diff ]
+then
+ (
+ echo "To: $mailrcpt"
+ echo "Subject: $subject"
+ echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
+ echo ""
+ cat $TMP.diff
+ ) | sendmail -t
fi
# If any machines have not been reached within the last $OLDTIME
@@ -410,7 +421,7 @@ then
(
echo "To: $adminmailrcpt"
echo "Subject: config fetcher problems - $GROUP"
- echo "Precedence: bulk"
+ echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
echo ""
echo "The following routers have not been successfully contacted for"
echo "more than $OLDTIME hours."
diff --git a/bin/cssrancid.in b/bin/cssrancid.in
index b737a4d..4b6afae 100644
--- a/bin/cssrancid.in
+++ b/bin/cssrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: cssrancid.in,v 1.5 2004/08/02 15:56:27 heas Exp $
+## $Id: cssrancid.in,v 1.10 2005/06/15 20:55:13 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -31,15 +31,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # clogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -64,7 +65,7 @@ sub numerically { $a <=> $b; }
# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -77,7 +78,7 @@ sub keynsort {
# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -90,7 +91,7 @@ sub keysort {
# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -102,7 +103,7 @@ sub valsort{
# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -116,7 +117,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -129,7 +130,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -293,9 +294,9 @@ sub ShowBoot {
}
if ($type !~ /^(12[04]|7)/) {
if ($type !~ /^(29|35)00/) {
- ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_");
+ ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_");
} else {
- ProcessHistory("COMMENTS","keysort","H1","!Variable: $_");
+ ProcessHistory("COMMENTS","keysort","H1","!Variable: $_");
}
} elsif (/variable/) {
ProcessHistory("COMMENTS","keysort","H1","!Variable: $_");
@@ -548,22 +549,18 @@ sub ShowRun {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'term length 65535' => "TermLength",
- 'copy profile user-profile' => "CopyProfile",
- 'show version' => "ShowVersion",
- 'show boot' => "ShowBoot",
- 'show run' => "ShowRun"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and show run last). pita
-@commands=(
- "term length 65535",
- "copy profile user-profile",
- "show version",
- "show boot",
- "show run"
+@commandtable = (
+ {'term length 65535' => 'TermLength'},
+ {'copy profile user-profile' => 'CopyProfile'},
+ {'show version' => 'ShowVersion'},
+ {'show boot' => 'ShowBoot'},
+ {'show run' => 'ShowRun'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -588,7 +585,7 @@ if ($file) {
}
# determine password filtering mode
-if ($ENV{"FILTER_PWDS"} =~ /no/i) {
+if ($ENV{"FILTER_PWDS"} =~ /no/i) {
$filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
diff --git a/bin/elogin.in b/bin/elogin.in
index 0a41285..e58f149 100644
--- a/bin/elogin.in
+++ b/bin/elogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: elogin.in,v 1.28 2004/02/02 17:38:36 heas Exp $
+## $Id: elogin.in,v 1.33 2005/06/14 20:20:43 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -49,7 +49,7 @@ set avautoenable 0
set do_passwd 1
# Find the user in the ENV, or use the unix userid.
-if {[ info exists env(CISCO_USER) ] } {
+if {[ info exists env(CISCO_USER) ]} {
set default_user $env(CISCO_USER)
} elseif {[ info exists env(USER) ]} {
set default_user $env(USER)
@@ -62,9 +62,9 @@ if {[ info exists env(CISCO_USER) ] } {
if [ catch {exec id} reason ] {
send_error "\nError: could not exec id: $reason\n"
exit 1
- }
+ }
regexp {\(([^)]*)} "$reason" junk default_user
-}
+}
# Sometimes routers take awhile to answer (the default is 10 sec)
set timeout 45
@@ -268,31 +268,44 @@ proc source_password_file { password_file } {
}
# Log into the router.
+# returns: 0 on success, 1 on failure
proc login { router user userpswd passwd prompt cmethod cyphertype } {
global spawn_id in_proc do_command do_script
global u_prompt p_prompt
set in_proc 1
- set uprompt_seen 0
+ set uprompt_seen 0
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
- set retval [ catch {spawn telnet $router} reason ]
- } else {
+ set retval [ catch {spawn telnet $router} reason ]
+ } else {
set retval [ catch {spawn telnet $router $port} reason ]
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
- exit 1
+ return 1
+ }
+ } elseif ![string compare $prog "ssh"] {
+ send_error "\nError: unsupported method: ssh\n"
+ if { $progs == 0 } {
+ return 1
+ }
+ continue
+ } elseif ![string compare $prog "rsh"] {
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
}
+ continue
} else {
- puts "\nError: unknown connection method: $prog"
+ send_user "\nError: unknown connection method: $prog\n"
return 1
}
- incr progs -1
sleep 0.3
# This helps cleanup each expect clause.
diff --git a/bin/erancid.in b/bin/erancid.in
index 20da43d..8f08721 100644
--- a/bin/erancid.in
+++ b/bin/erancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: erancid.in,v 1.18 2004/01/11 03:49:13 heas Exp $
+## $Id: erancid.in,v 1.23 2005/06/15 20:54:40 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -31,15 +31,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # elogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -61,10 +62,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -74,10 +75,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -87,10 +88,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -100,9 +101,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -116,7 +117,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -129,7 +130,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -168,8 +169,8 @@ sub ShowModule {
# now just copy it verbatim to the history file
while (<INPUT>) {
- tr/\015//d;
- last if(/Active\) >/);
+ tr/\015//d;
+ last if(/Active\) >/);
last if(/^$/);
chop;
ProcessHistory("SLOT","","","-$_\n");
@@ -186,8 +187,8 @@ sub WriteTerm {
# now just copy it verbatim to the history file
while (<INPUT>) {
- tr/\015//d;
- last if(/Active\) >/);
+ tr/\015//d;
+ last if(/Active\) >/);
chop;
if (/^\s*snmp/ && defined($ENV{'NOCOMMSTR'})) {
/snmp (getcomm|setcomm|trapcomm)(\s+)(\S*)/ &&
@@ -204,18 +205,16 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'version' => "ShowVersion",
- 'equipment' => "ShowModule",
- 'config' => "WriteTerm",
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "version",
- "equipment",
- "config",
+@commandtable = (
+ {'version' => 'ShowVersion'},
+ {'equipment' => 'ShowModule'},
+ {'config' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -241,7 +240,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/f10rancid.in b/bin/f10rancid.in
index 2c4e485..56ef691 100644
--- a/bin/f10rancid.in
+++ b/bin/f10rancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: f10rancid.in,v 1.11 2004/01/11 03:49:13 heas Exp $
+## $Id: f10rancid.in,v 1.16 2005/06/15 20:54:40 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -33,15 +33,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # clogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -63,10 +64,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -76,10 +77,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -89,10 +90,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -102,9 +103,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -118,7 +119,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -131,7 +132,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -416,9 +417,9 @@ sub ShowBoot {
}
if ($type !~ /^(12[04]|7)/) {
if ($type !~ /^(29|35)00/) {
- ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_");
+ ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_");
} else {
- ProcessHistory("COMMENTS","keysort","H1","!Variable: $_");
+ ProcessHistory("COMMENTS","keysort","H1","!Variable: $_");
}
} elsif (/variable/) {
ProcessHistory("COMMENTS","keysort","H1","!Variable: $_");
@@ -1109,62 +1110,38 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'show version' => "ShowVersion",
- 'show install active' => "ShowInstallActive",
- 'show env all' => "ShowEnv",
- 'show gsr chassis' => "ShowGSR",
- 'show boot' => "ShowBoot",
- 'show bootvar' => "ShowBoot",
- 'show variables boot' => "ShowBoot",
- 'show flash' => "ShowFlash",
- 'dir /all nvram:' => "DirSlotN",
- 'dir /all bootflash:' => "DirSlotN",
- 'dir /all slot0:' => "DirSlotN",
- 'dir /all disk0:' => "DirSlotN",
- 'dir /all slot1:' => "DirSlotN",
- 'dir /all disk1:' => "DirSlotN",
- "dir /all sup-bootflash:"=> "DirSlotN", # cat 6500-ios
- "dir /all sup-microcode:"=> "DirSlotN", # cat 6500-ios
- 'show controllers' => "ShowContAll",
- 'show controllers cbus' => "ShowContCbus",
- 'show diagbus' => "ShowDiagbus",
- 'show diag' => "ShowDiag",
- 'show module' => "ShowModule", # cat 6500-ios
- 'show c7200' => "ShowC7200",
- 'show vtp status' => "ShowVTP",
- 'show vlan' => "ShowVLAN",
- 'show running' => "WriteTerm"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "show version",
- "show install active",
- "show env all",
- "show gsr chassis",
- "show boot",
- "show bootvar",
- "show variables boot",
- "show flash",
- "dir /all nvram:",
- "dir /all bootflash:",
- "dir /all slot0:",
- "dir /all disk0:",
- "dir /all slot1:",
- "dir /all disk1:",
- "dir /all sup-bootflash:",
- "dir /all sup-microcode:",
- "show controllers",
- "show controllers cbus",
- "show diagbus",
- "show diag",
- "show module",
- "show c7200",
- "show vtp status",
- "show vlan",
- "show running"
+@commandtable = (
+ {'show version' => 'ShowVersion'},
+ {'show install active' => 'ShowInstallActive'},
+ {'show env all' => 'ShowEnv'},
+ {'show gsr chassis' => 'ShowGSR'},
+ {'show boot' => 'ShowBoot'},
+ {'show bootvar' => 'ShowBoot'},
+ {'show variables boot' => 'ShowBoot'},
+ {'show flash' => 'ShowFlash'},
+ {'dir /all nvram:' => 'DirSlotN'},
+ {'dir /all bootflash:' => 'DirSlotN'},
+ {'dir /all slot0:' => 'DirSlotN'},
+ {'dir /all disk0:' => 'DirSlotN'},
+ {'dir /all slot1:' => 'DirSlotN'},
+ {'dir /all disk1:' => 'DirSlotN'},
+ {'dir /all sup-bootflash:' => 'DirSlotN'},
+ {'dir /all sup-microcode:' => 'DirSlotN'},
+ {'show controllers' => 'ShowContAll'},
+ {'show controllers cbus' => 'ShowContCbus'},
+ {'show diagbus' => 'ShowDiagbus'},
+ {'show diag' => 'ShowDiag'},
+ {'show module' => 'ShowModule'},
+ {'show c7200' => 'ShowC7200'},
+ {'show vtp status' => 'ShowVTP'},
+ {'show vlan' => 'ShowVLAN'},
+ {'show running' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -1189,7 +1166,7 @@ if ($file) {
}
# determine password filtering mode
-if ($ENV{"FILTER_PWDS"} =~ /no/i) {
+if ($ENV{"FILTER_PWDS"} =~ /no/i) {
$filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
diff --git a/bin/flogin.in b/bin/flogin.in
index fd4cf93..49f057e 100644
--- a/bin/flogin.in
+++ b/bin/flogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: flogin.in,v 1.34 2004/10/27 21:33:08 heas Exp $
+## $Id: flogin.in,v 1.39 2005/06/14 20:20:43 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -60,7 +60,7 @@ set do_passwd 1
set do_enapasswd 1
# Find the user in the ENV, or use the unix userid.
-if {[ info exists env(CISCO_USER) ] } {
+if {[ info exists env(CISCO_USER) ]} {
set default_user $env(CISCO_USER)
} elseif {[ info exists env(USER) ]} {
set default_user $env(USER)
@@ -73,9 +73,9 @@ if {[ info exists env(CISCO_USER) ] } {
if [ catch {exec id} reason ] {
send_error "\nError: could not exec id: $reason\n"
exit 1
- }
+ }
regexp {\(([^)]*)} "$reason" junk default_user
-}
+}
# Sometimes routers take awhile to answer (the default is 10 sec)
set timeout 45
@@ -244,9 +244,9 @@ proc include {args} {
regsub -all "(^{|}$)" $args {} args
if { [ regexp "^/" $args ignore ] == 0 } {
set args $env(HOME)/$args
- }
+ }
source_password_file $args
-}
+}
proc find {var router} {
upvar int_$var list
@@ -264,7 +264,7 @@ proc find {var router} {
# it is sourced, the user better know what to put in there, as it
# could install more than just password info... I will assume however,
# 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
+# script, so I will leave .cloginrc as just an extention of that script
proc source_password_file { password_file } {
global env
if { ! [file exists $password_file] } {
@@ -283,6 +283,7 @@ proc source_password_file { password_file } {
}
# Log into the router.
+# returns: 0 on success, 1 on failure
proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
global spawn_id in_proc do_command do_script platform
global prompt u_prompt p_prompt e_prompt sshcmd
@@ -292,6 +293,7 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
@@ -301,23 +303,23 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
- exit 1
+ 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"
- exit 1
+ return 1
}
} elseif ![string compare $prog "rsh"] {
- if [ catch {spawn rsh -l $user $router} reason ] {
- send_user "\nError: rsh failed: $reason\n"
- exit 1
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
}
+ continue;
} else {
- puts "\nError: unknown connection method: $prog"
+ send_user "\nError: unknown connection method: $prog\n"
return 1
}
- incr progs -1
sleep 0.3
# This helps cleanup each expect clause.
@@ -354,15 +356,15 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
if !$progs {
send_user "\nError: Connection Refused ($prog): $router\n"
return 1
- }
+ }
}
-re "(Connection closed by|Connection to \[^\n\r]+ closed)" {
catch {close}; wait
if !$progs {
send_user "\nError: Connection closed ($prog): $router\n"
return 1
- }
- }
+ }
+ }
-re "Telnet server disabled" {
catch {close}; wait
if !$progs {
@@ -546,7 +548,7 @@ foreach router [lrange $argv $i end] {
if { [llength $pswd] == 0 } {
send_user "\nError: no password for $router in $password_file.\n"
continue
- }
+ }
if { $enable && $do_enapasswd && $autoenable == 0 && [llength $pswd] < 2 } {
send_user "\nError: no enable password for $router in $password_file.\n"
continue
@@ -556,13 +558,13 @@ foreach router [lrange $argv $i end] {
}
# Figure out username
- if {[info exists username]} {
+ if {[info exists username]} {
# command line username
set ruser $username
} else {
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]} {
@@ -570,17 +572,17 @@ foreach router [lrange $argv $i end] {
set userpswd $userpasswd
} else {
set userpswd [join [find userpassword $router] ""]
- if { "$userpswd" == "" } { set userpswd $passwd }
- }
-
+ if { "$userpswd" == "" } { set userpswd $passwd }
+ }
+
# Figure out enable username
- if {[info exists enausername]} {
+ if {[info exists enausername]} {
# command line enausername
set enauser $enausername
} else {
set enauser [join [find enauser $router] ""]
- if { "$enauser" == "" } { set enauser $ruser }
- }
+ if { "$enauser" == "" } { set enauser $ruser }
+ }
# Figure out prompts
set u_prompt [find userprompt $router]
@@ -615,15 +617,15 @@ foreach router [lrange $argv $i end] {
set cmethod [find method $router]
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
- # Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
- if { "$sshcmd" == "" } { set sshcmd {ssh} }
+ # Figure out the SSH executable name
+ set sshcmd [find sshcmd $router]
+ if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
if {[login $router $ruser $userpswd $passwd $enapasswd $cmethod $cyphertype]} {
continue
}
- if { $enable } {
+ if { $enable } {
if {[do_enable $enauser $enapasswd]} {
if { $do_command || $do_script } {
close; wait
@@ -643,7 +645,7 @@ foreach router [lrange $argv $i end] {
source $sfile
close
} else {
- label $router
+ label $router
log_user 1
interact
}
diff --git a/bin/fnrancid.in b/bin/fnrancid.in
index 815227b..6965f7b 100644
--- a/bin/fnrancid.in
+++ b/bin/fnrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: fnrancid.in,v 1.3 2004/01/11 03:49:13 heas Exp $
+## $Id: fnrancid.in,v 1.8 2005/06/15 20:54:40 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -20,7 +20,7 @@
##
#
# A library built on Stephen Gill's Netscreen stuff to accomodate
-# the Fortinet product line. [d_pfleger@juniper.net]
+# the Fortinet product line. [d_pfleger@juniper.net]
#
# RANCID - Really Awesome New Cisco confIg Differ
#
@@ -34,15 +34,16 @@ $debug = $opt_d;
$file = $opt_f;
$host = $ARGV[0];
$found_end = 0;
-$timeo = 90; # nlogin timeout in seconds
+$timeo = 90; # nlogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -64,10 +65,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -77,10 +78,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -90,22 +91,22 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
- $sorted_lines[$i] = $key;
- $i++;
+ $sorted_lines[$i] = $key;
+ $i++;
}
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -119,7 +120,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -132,7 +133,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -146,7 +147,7 @@ sub GetSystem {
tr/\015//d;
next if /^\s*$/;
last if(/$prompt/);
- ProcessHistory("","","","$_");
+ ProcessHistory("","","","$_");
#print STDOUT "$_";
}
print STDOUT "Vendor: $vendor";
@@ -170,9 +171,9 @@ sub GetConf {
next if /^\s*$/;
last if(/$prompt/);
if (/(^set.*)('Enc .*')(.*)/) {
- ProcessHistory("ENC","","","!$1 'Enc **encoding removed**' $3\n");
- next;
- }
+ ProcessHistory("ENC","","","!$1 'Enc **encoding removed**' $3\n");
+ next;
+ }
ProcessHistory("","","","$_");
#print STDOUT "$_";
}
@@ -184,16 +185,15 @@ sub GetConf {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'get system status' => "GetSystem",
- 'get conf' => "GetConf"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important. pita
-@commands=(
- "get system status",
- "get conf"
+@commandtable = (
+ {'get system status' => 'GetSystem'},
+ {'get conf' => 'GetConf'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -218,7 +218,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/francid.in b/bin/francid.in
index 31977b9..78bdc62 100644
--- a/bin/francid.in
+++ b/bin/francid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: francid.in,v 1.29 2004/04/14 21:38:12 heas Exp $
+## $Id: francid.in,v 1.34 2005/06/15 20:54:40 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -34,15 +34,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # flogin timeout in seconds
+$timeo = 90; # flogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -64,10 +65,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -77,10 +78,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -90,22 +91,22 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
- $sorted_lines[$i] = $key;
- $i++;
+ $sorted_lines[$i] = $key;
+ $i++;
}
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -119,7 +120,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -132,7 +133,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -241,8 +242,8 @@ sub WriteTerm {
/^module \d+ / && next;
/^ntp clock-period / && next; # kill ntp clock-period
- /^ length / && next; # kill length on serial lines
- /^ width / && next; # kill width on serial lines
+ /^ length / && next; # kill length on serial lines
+ /^ width / && next; # kill width on serial lines
# filter out any RCS/CVS tags to avoid confusing local CVS storage
s/\$(Revision|Id):/ $1:/;
# order access-lists
@@ -346,22 +347,18 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'show version' => "ShowVersion",
- 'show chassis' => "ShowChassis",
- 'show module' => "ShowModule",
- 'show flash' => "ShowFlash",
- 'write term' => "WriteTerm"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important. pita
-@commands=(
- "show version",
- "show chassis",
- "show module",
- "show flash",
- "write term"
+@commandtable = (
+ {'show version' => 'ShowVersion'},
+ {'show chassis' => 'ShowChassis'},
+ {'show module' => 'ShowModule'},
+ {'show flash' => 'ShowFlash'},
+ {'write term' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -387,7 +384,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/hlogin.in b/bin/hlogin.in
index 2e3636d..ab02f4f 100644
--- a/bin/hlogin.in
+++ b/bin/hlogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: hlogin.in,v 1.24 2004/10/14 17:53:57 heas Exp $
+## $Id: hlogin.in,v 1.28 2005/06/13 03:11:45 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -59,7 +59,7 @@ set do_enapasswd 1
set platform ""
# Find the user in the ENV, or use the unix userid.
-if {[ info exists env(CISCO_USER) ] } {
+if {[ info exists env(CISCO_USER) ]} {
set default_user $env(CISCO_USER)
} elseif {[ info exists env(USER) ]} {
set default_user $env(USER)
@@ -287,6 +287,7 @@ proc source_password_file { password_file } {
}
# Log into the router.
+# returns: 0 on success, 1 on failure
proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
global spawn_id in_proc do_command do_script platform
global prompt u_prompt p_prompt e_prompt sshcmd
@@ -295,6 +296,7 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
regexp {(telnet|ssh)(:([^[:space:]]+))*} $prog command suffix junk port
if [string match "telnet*" $prog] {
if {"$port" == ""} {
@@ -304,7 +306,7 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
- exit 1
+ return 1
}
} elseif [string match "ssh*" $prog] {
if {"$port" == ""} {
@@ -314,18 +316,18 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
}
if { $retval } {
send_user "\nError: $sshcmd failed: $reason\n"
- exit 1
+ return 1
}
} elseif ![string compare $prog "rsh"] {
- if [ catch {spawn hpuifilter rsh -l $user $router} reason ] {
- send_user "\nError: rsh failed: $reason\n"
- exit 1
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
}
+ continue;
} else {
- puts "\nError: unknown connection method: $prog"
+ send_user "\nError: unknown connection method: $prog\n"
return 1
}
- incr progs -1
sleep 0.3
# This helps cleanup each expect clause.
diff --git a/bin/hpuifilter.c b/bin/hpuifilter.c
index cc94fec..4747299 100644
--- a/bin/hpuifilter.c
+++ b/bin/hpuifilter.c
@@ -1,5 +1,5 @@
/*
- * $Id: hpuifilter.c,v 1.20 2005/03/30 07:27:15 heas Exp $
+ * $Id: hpuifilter.c,v 1.21 2005/06/14 20:20:43 heas Exp $
*
* Copyright (C) 1997-2004 by Terrapin Communications, Inc.
* All rights reserved.
@@ -296,7 +296,7 @@ filter(buf, len)
static char reg[N_REG][50] = { /* vt100/220 escape codes */
"\e7\e\\[1;24r\e8", /* ds */
"\e8", /* fs */
-
+
"\e\\[2J",
"\e\\[2K", /* kE */
@@ -366,22 +366,22 @@ filter(buf, len)
return(strlen(buf));
}
-RETSIGTYPE
+RETSIGTYPE
reapchild(void)
{
int status;
pid_t pid;
-
+
/* XXX this needs to deal with/without wait3 via HAVE_WAIT3 */
while ((pid = wait3(&status, WNOHANG, 0)) > 0)
if (debug)
fprintf(stderr, "reap child %d\n", pid);
-
+
/*exit(1);*/
return;
/* not reached */
-}
+}
void
usage(void)
diff --git a/bin/hrancid.in b/bin/hrancid.in
index d53cad0..4eb77e1 100644
--- a/bin/hrancid.in
+++ b/bin/hrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: hrancid.in,v 1.18 2005/01/27 00:01:10 heas Exp $
+## $Id: hrancid.in,v 1.22 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -33,16 +33,17 @@ $debug = $opt_d;
$file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
-$found_end = 0; # unused - hp lacks an end-of-config tag.
-$timeo = 90; # clogin timeout in seconds
+$found_end = 0; # unused - hp lacks an end-of-config tag
+$timeo = 90; # hlogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -64,10 +65,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -77,10 +78,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -90,10 +91,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -103,9 +104,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -119,7 +120,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -132,7 +133,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -426,24 +427,19 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'show version' => "ShowVersion",
- 'show flash' => "ShowFlash",
- 'show system-information' => "ShowSystem",
- 'show module' => "ShowModule",
- 'show stack' => "ShowStack",
- 'write term' => "WriteTerm"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "show version",
- "show flash",
- "show system-information",
- "show module",
- "show stack",
- "write term"
+@commandtable = (
+ {'show version' => 'ShowVersion'},
+ {'show flash' => 'ShowFlash'},
+ {'show system-information' => 'ShowSystem'},
+ {'show module' => 'ShowModule'},
+ {'show stack' => 'ShowStack'},
+ {'write term' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -469,7 +465,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/htlogin.in b/bin/htlogin.in
index 01de69c..c95733b 100644
--- a/bin/htlogin.in
+++ b/bin/htlogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: htlogin.in,v 1.8 2004/02/02 17:38:36 heas Exp $
+## $Id: htlogin.in,v 1.13 2005/06/14 20:20:43 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -51,7 +51,7 @@ set avautoenable 0
set do_passwd 1
# Find the user in the ENV, or use the unix userid.
-if {[ info exists env(CISCO_USER) ] } {
+if {[ info exists env(CISCO_USER) ]} {
set default_user $env(CISCO_USER)
} elseif {[ info exists env(USER) ]} {
set default_user $env(USER)
@@ -64,9 +64,9 @@ if {[ info exists env(CISCO_USER) ] } {
if [ catch {exec id} reason ] {
send_error "\nError: could not exec id: $reason\n"
exit 1
- }
+ }
regexp {\(([^)]*)} "$reason" junk default_user
-}
+}
# Sometimes routers take awhile to answer (the default is 10 sec)
set timeout 45
@@ -270,31 +270,44 @@ proc source_password_file { password_file } {
}
# Log into the router.
+# returns: 0 on success, 1 on failure
proc login { router user userpswd passwd prompt cmethod cyphertype } {
global spawn_id in_proc do_command do_script
global u_prompt p_prompt
set in_proc 1
- set uprompt_seen 0
+ set uprompt_seen 0
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
- set retval [ catch {spawn telnet $router} reason ]
- } else {
+ set retval [ catch {spawn telnet $router} reason ]
+ } else {
set retval [ catch {spawn telnet $router $port} reason ]
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
- exit 1
+ return 1
+ }
+ } elseif ![string compare $prog "ssh"] {
+ send_error "\nError: unsupported method: ssh\n"
+ if { $progs == 0 } {
+ return 1
+ }
+ continue
+ } elseif ![string compare $prog "rsh"] {
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
}
+ continue
} else {
- puts "\nError: unknown connection method: $prog"
+ send_user "\nError: unknown connection method: $prog\n"
return 1
}
- incr progs -1
sleep 0.3
# This helps cleanup each expect clause.
diff --git a/bin/htrancid.in b/bin/htrancid.in
index 2b2eaaa..5f05a00 100644
--- a/bin/htrancid.in
+++ b/bin/htrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: htrancid.in,v 1.5 2004/01/11 03:49:13 heas Exp $
+## $Id: htrancid.in,v 1.10 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -33,15 +33,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # blogin timeout in seconds
+$timeo = 90; # htlogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -63,10 +64,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -76,10 +77,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -89,10 +90,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -102,9 +103,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -118,7 +119,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -131,7 +132,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -166,16 +167,15 @@ sub ShowVersion {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'version -a' => "ShowVersion",
- 'cat /config/router.cnf' => "ShowConfig"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "version -a",
- "cat /config/router.cnf"
+@commandtable = (
+ {'version -a' => 'ShowVersion'},
+ {'cat /config/router.cnf' => 'ShowConfig'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -201,7 +201,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
@@ -224,8 +224,8 @@ TOP: while(<INPUT>) {
while (/command:\s*($cmds_regexp)\s*$/) {
$cmd = $1;
if (!defined($prompt)) {
- $prompt = ($_ =~ /^([^:]+:)/)[0];
- }
+ $prompt = ($_ =~ /^([^:]+:)/)[0];
+ }
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
print STDERR "$host: found unexpected command - \"$cmd\"\n";
diff --git a/bin/jerancid.in b/bin/jerancid.in
index 4d51964..7455b1d 100644
--- a/bin/jerancid.in
+++ b/bin/jerancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: jerancid.in,v 1.30 2004/10/15 21:20:49 heas Exp $
+## $Id: jerancid.in,v 1.33 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -33,15 +33,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # clogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -63,10 +64,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -76,10 +77,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -89,10 +90,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -102,9 +103,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -118,7 +119,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -131,7 +132,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -536,26 +537,20 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'show version' => "ShowVersion",
- 'show redundancy' => "ShowRedundancy",
- 'show boot' => "ShowBoot",
- 'show environment all' => "ShowEnv",
- 'dir' => "DirSlotN",
- 'show hardware' => "ShowHardware",
- 'show configuration' => "WriteTerm"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "show version",
- "show redundancy",
- "show boot",
- "show environment all",
- "dir",
- "show hardware",
- "show configuration"
+@commandtable = (
+ {'show version' => 'ShowVersion'},
+ {'show redundancy' => 'ShowRedundancy'},
+ {'show boot' => 'ShowBoot'},
+ {'show environment all' => 'ShowEnv'},
+ {'dir' => 'DirSlotN'},
+ {'show hardware' => 'ShowHardware'},
+ {'show configuration' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$jnxe_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
diff --git a/bin/jlogin.in b/bin/jlogin.in
index afa860e..e6c4a01 100644
--- a/bin/jlogin.in
+++ b/bin/jlogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: jlogin.in,v 1.46 2004/03/11 19:36:25 heas Exp $
+## $Id: jlogin.in,v 1.51 2005/06/14 20:20:43 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -48,7 +48,7 @@ set avenable 1
set do_passwd 1
# Find the user in the ENV, or use the unix userid.
-if {[ info exists env(CISCO_USER) ] } {
+if {[ info exists env(CISCO_USER) ]} {
set default_user $env(CISCO_USER)
} elseif {[ info exists env(USER) ]} {
set default_user $env(USER)
@@ -252,6 +252,7 @@ proc source_password_file { password_file } {
}
# Log into the router.
+# returns: 0 on success, 1 on failure
proc login { router user passwd cmethod cyphertype identfile} {
global spawn_id in_proc do_command do_script passphrase prompt
global sshcmd
@@ -260,6 +261,7 @@ proc login { router user passwd cmethod cyphertype identfile} {
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
@@ -269,7 +271,7 @@ proc login { router user passwd cmethod cyphertype identfile} {
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
- exit 1
+ return 1
}
} elseif ![string compare $prog "ssh"] {
# ssh to the router & try to login with or without an identfile.
@@ -278,24 +280,24 @@ proc login { router user passwd cmethod cyphertype identfile} {
if {$identfile != ""} {
if [ catch {spawn $sshcmd -c $cyphertype -x -l $user -i $identfile $router} reason ] {
send_user "\nError: failed to $sshcmd: $reason\n"
- exit 1
+ return 1
}
} else {
if [ catch {spawn $sshcmd -c $cyphertype -x -l $user $router} reason ] {
send_user "\nError: failed to $sshcmd: $reason\n"
- exit 1
+ return 1
}
}
} elseif ![string compare $prog "rsh"] {
- if [ catch {spawn rsh -l $user $router} reason ] {
- send_user "\nError: rsh failed: $reason\n"
- exit 1
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
}
+ continue
} else {
- puts "\nError: unknown connection method: $prog"
+ send_user "\nError: unknown connection method: $prog\n"
return 1
}
- incr progs -1
sleep 0.3
# This helps cleanup each expect clause.
@@ -493,9 +495,9 @@ foreach router [lrange $argv $i end] {
set cmethod [find method $router]
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
- # Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
- if { "$sshcmd" == "" } { set sshcmd {ssh} }
+ # Figure out the SSH executable name
+ set sshcmd [find sshcmd $router]
+ if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
if {[login $router $loginname $passwd $cmethod $cyphertype $identfile]} {
diff --git a/bin/jrancid.in b/bin/jrancid.in
index 8432671..8b7f2bf 100644
--- a/bin/jrancid.in
+++ b/bin/jrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: jrancid.in,v 1.63 2004/12/08 00:31:46 asp Exp $
+## $Id: jrancid.in,v 1.68 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -36,13 +36,14 @@ $host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -64,10 +65,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -77,10 +78,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -90,22 +91,22 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
- $sorted_lines[$i] = $key;
- $i++;
+ $sorted_lines[$i] = $key;
+ $i++;
}
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -119,7 +120,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -132,7 +133,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -488,7 +489,7 @@ sub ShowConfiguration {
while (<INPUT>) {
tr/\015//d;
next if (/^\s*$/);
- # end of config - hopefully. juniper does not have a reliable
+ # end of config - hopefully. juniper does not have a reliable
# end-of-config tag. appears to end with "\nPROMPT>", but not sure.
if(/^$prompt/) {
$found_end++;
@@ -559,46 +560,30 @@ sub ShowConfiguration {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- "show chassis clocks" => "ShowChassisClocks",
- "show chassis environment" => "ShowChassisEnvironment",
- "show chassis firmware" => "ShowChassisFirmware",
- "show chassis fpc detail" => "ShowChassisFpcDetail",
- "show chassis hardware detail" => "ShowChassisHardware",
- "show chassis routing-engine" => "ShowChassisRoutingEngine",
- "show chassis scb" => "ShowChassisSCB",
- "show chassis sfm detail" => "ShowChassisSCB",
- "show chassis ssb" => "ShowChassisSCB",
- "show chassis feb" => "ShowChassisSCB",
- "show chassis cfeb" => "ShowChassisSCB",
- "show chassis alarms" => "ShowChassisAlarms",
-# "show system autoinstallation status" => "ShowSystemAutoinstall",
- "show system license" => "ShowSystemLicense",
-# "show system license keys" => "ShowSystemLicenseKeys",
- "show system boot-messages" => "ShowSystemBootMessages",
- "show version detail" => "ShowVersion",
- "show configuration" => "ShowConfiguration"
-);
-@commands=(
- "show chassis clocks",
- "show chassis environment",
- "show chassis firmware",
- "show chassis fpc detail",
- "show chassis hardware detail",
- "show chassis routing-engine",
- "show chassis scb",
- "show chassis sfm detail",
- "show chassis ssb",
- "show chassis feb",
- "show chassis cfeb",
- "show chassis alarms",
-# "show system autoinstallation status",
- "show system license",
-# "show system license keys",
- "show system boot-messages",
- "show version detail",
- "show configuration"
+@commandtable = (
+ {'show chassis clocks' => 'ShowChassisClocks'},
+ {'show chassis environment' => 'ShowChassisEnvironment'},
+ {'show chassis firmware' => 'ShowChassisFirmware'},
+ {'show chassis fpc detail' => 'ShowChassisFpcDetail'},
+ {'show chassis hardware detail' => 'ShowChassisHardware'},
+ {'show chassis routing-engine' => 'ShowChassisRoutingEngine'},
+ {'show chassis scb' => 'ShowChassisSCB'},
+ {'show chassis sfm detail' => 'ShowChassisSCB'},
+ {'show chassis ssb' => 'ShowChassisSCB'},
+ {'show chassis feb' => 'ShowChassisSCB'},
+ {'show chassis cfeb' => 'ShowChassisSCB'},
+ {'show chassis alarms' => 'ShowChassisAlarms'},
+# {'show system autoinstallation status' => 'ShowSystemAutoinstall'},
+ {'show system license' => 'ShowSystemLicense'},
+# {'show system license keys' => 'ShowSystemLicenseKeys'},
+ {'show system boot-messages' => 'ShowSystemBootMessages'},
+ {'show version detail' => 'ShowVersion'},
+ {'show configuration' => 'ShowConfiguration'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
$jnx_commands=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -627,7 +612,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/mrancid.in b/bin/mrancid.in
index 8d52c27..80bc206 100644
--- a/bin/mrancid.in
+++ b/bin/mrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: mrancid.in,v 1.11 2004/01/11 03:49:13 heas Exp $
+## $Id: mrancid.in,v 1.15 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -34,15 +34,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # clogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -64,10 +65,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -77,10 +78,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -90,10 +91,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -103,9 +104,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -119,7 +120,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -132,7 +133,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -305,16 +306,15 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'show version' => "ShowVersion",
- 'show config' => "WriteTerm"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "show version",
- "show config"
+@commandtable = (
+ {'show version' => 'ShowVersion'},
+ {'show config' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -340,7 +340,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/nlogin.in b/bin/nlogin.in
index 9754367..e10db1e 100644
--- a/bin/nlogin.in
+++ b/bin/nlogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: nlogin.in,v 1.20 2004/12/24 21:00:32 tex Exp $
+## $Id: nlogin.in,v 1.26 2005/06/14 20:20:44 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -30,14 +30,224 @@
# netscreen does not have the concept of "enable", once logged in, a
# users permissions can not change.
+# Usage line
+set usage "Usage: $argv0 \[-c command\] \[-Evar=x\] \[-f cloginrc-file\] \
+\[-p user-password\] \
+\[-s script-file\] \[-t timeout\] \[-u username\] \
+\[-v vty-password\] \[-x command-file\] \
+\[-y ssh_cypher_type\] router \[router...\]\n"
-@INCLUDE login.top@
-# Enable password isn't understood but is used in script.
-# enable settings mostly ignored, but set this:
-set do_enapasswd 0
-# just in case
+# env(CLOGIN) may contain:
+# x == do not set xterm banner or name
+
+# Password file
+set password_file $env(HOME)/.cloginrc
+# Default is to login to the firewall
+set do_command 0
+set do_script 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
+set do_enapasswd 1
+
+# Find the user in the ENV, or use the unix userid.
+if {[ info exists env(CISCO_USER) ]} {
+ set default_user $env(CISCO_USER)
+} elseif {[ info exists env(USER) ]} {
+ set default_user $env(USER)
+} elseif {[ info exists env(LOGNAME) ]} {
+ set default_user $env(LOGNAME)
+} 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.
+ if [ catch {exec id} reason ] {
+ send_error "\nError: could not exec id: $reason\n"
+ exit 1
+ }
+ regexp {\(([^)]*)} "$reason" junk default_user
+}
+
+# Sometimes firewall take awhile to answer (the default is 10 sec)
+set timeout 45
+
+# Process the command line
+for {set i 0} {$i < $argc} {incr i} {
+ set arg [lindex $argv $i]
+
+ switch -glob -- $arg {
+ # Username
+ -u* -
+ -U* {
+ if {! [ regexp .\[uU\](.+) $arg ignore user]} {
+ incr i
+ set username [ lindex $argv $i ]
+ }
+ # VTY Password
+ } -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*
+ {
+ if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
+ set E$varname $varvalue
+ } else {
+ send_user "\nError: invalid format for -E in $arg\n"
+ exit 1
+ }
+ # Command to run.
+ } -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* {
+ if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
+ incr i
+ set sfile [ lindex $argv $i ]
+ }
+ if { ! [ file readable $sfile ] } {
+ send_user "\nError: Can't read $sfile\n"
+ exit 1
+ }
+ set do_script 1
+ # cypher type
+ } -y* -
+ -Y* {
+ if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
+ incr i
+ set cypher [ lindex $argv $i ]
+ }
+ # alternate cloginrc file
+ } -f* -
+ -F* {
+ if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
+ incr i
+ set password_file [ lindex $argv $i ]
+ }
+ } -t* -
+ -T* {
+ incr i
+ set timeout [ lindex $argv $i ]
+ } -x* -
+ -X {
+ if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
+ incr i
+ set cmd_file [ lindex $argv $i ]
+ }
+ 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
+ # Does tacacs automatically enable us?
+ } -autoenable {
+ # ignore autoenable
+ } -* {
+ send_user "\nError: Unknown argument! $arg\n"
+ send_user $usage
+ exit 1
+ } default {
+ break
+ }
+ }
+}
+# Process firewalls...no firewalls listed is an error.
+if { $i == $argc } {
+ send_user "\nError: $usage"
+}
+
+# Only be quiet if we are running a script (it can log its output
+# on its own)
+if { $do_script } {
+ log_user 0
+} else {
+ log_user 1
+}
+
+#
+# Done configuration/variable setting. Now run with it...
+#
+
+# 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 }
+ }
+ # take host from ENV(TERM)
+ 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"
+ }
+ }
+}
+
+# This is a helper function to make the password file easier to
+# maintain. Using this the password file has the form:
+# add password sl* pete cow
+# add password at* steve
+# add password * hanky-pie
+proc add {var args} { global int_$var ; lappend int_$var $args}
+proc include {args} {
+ global env
+ regsub -all "(^{|}$)" $args {} args
+ if { [ regexp "^/" $args ignore ] == 0 } {
+ set args $env(HOME)/$args
+ }
+ source_password_file $args
+}
+
+proc find {var firewall} {
+ upvar int_$var list
+ if { [info exists list] } {
+ foreach line $list {
+ if { [string match [lindex $line 0] $firewall ] } {
+ return [lrange $line 1 end]
+ }
+ }
+ }
+ return {}
+}
+
+# Loads the password file. Note that as this file is tcl, and that
+# it is sourced, the user better know what to put in there, as it
+# could install more than just password info... I will assume however,
+# 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 { password_file } {
+ global env
+ if { ! [file exists $password_file] } {
+ send_user "\nError: password file ($password_file) does not exist\n"
+ exit 1
+ }
+ file stat $password_file fileinfo
+ if { [expr ($fileinfo(mode) & 007)] != 0000 } {
+ send_user "\nError: $password_file must not be world readable/writable\n"
+ exit 1
+ }
+ if [ catch {source $password_file} reason ] {
+ send_user "\nError: $reason\n"
+ exit 1
+ }
+}
# Log into the firewall.
+# returns: 0 on success, 1 on failure
proc login { firewall user userpswd passwd enapasswd prompt cmethod
cyphertype } {
global spawn_id in_proc do_command do_script sshcmd
@@ -47,6 +257,7 @@ cyphertype } {
# Telnet to the firewall & try to login.
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
@@ -56,23 +267,23 @@ cyphertype } {
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
- exit 1
+ return 1
}
} elseif ![string compare $prog "ssh"] {
if [ catch {spawn $sshcmd -c $cyphertype -x -l $user $firewall} reason ] {
send_user "\nError: $sshcmd failed: $reason\n"
- exit 1
- }
+ return 1
+ }
} elseif ![string compare $prog "rsh"] {
- if [ catch {spawn rsh -l $user $firewall} reason ] {
- send_user "\nError: rsh failed: $reason\n"
- exit 1
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
}
+ continue;
} else {
- puts "\nError: unknown connection method: $prog"
+ send_user "\nError: unknown connection method: $prog\n"
return 1
}
- incr progs -1
sleep 0.3
@@ -105,10 +316,10 @@ cyphertype } {
# then it will just send the passwd.
# if telnet fails with connection refused, try ssh
expect {
- "Connection refused" {
+ "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" {
+ } "Unknown host\r\n" {
expect eof
send_user "\nError: Unknown host\n"; wait; return 1
} "Host is unreachable" {
@@ -134,7 +345,7 @@ cyphertype } {
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"
+ denied { send_user "\nError: Check your passwd for $firewall\n"
catch {close}; wait; return 1
}
" ### Login failed" {send_user "\nError: Check your passwd for $firewall\n"; return 1 }
@@ -235,19 +446,19 @@ foreach firewall [lrange $argv $i end] {
if { [llength $pswd] == 0 } {
send_user "\nError: no password for $firewall in $password_file.\n"
continue
- }
+ }
set passwd [join [lindex $pswd 0] ""]
set enapasswd [join [lindex $pswd 1] ""]
}
# Figure out username
- if {[info exists username]} {
+ if {[info exists username]} {
# command line username
set ruser $username
} else {
set ruser [join [find user $firewall] ""]
if { "$ruser" == "" } { set ruser $default_user }
- }
+ }
# Figure out username's password (if different from the vty password)
if {[info exists userpasswd]} {
@@ -255,9 +466,9 @@ foreach firewall [lrange $argv $i end] {
set userpswd $userpasswd
} else {
set userpswd [join [find userpassword $firewall] ""]
- if { "$userpswd" == "" } { set userpswd $passwd }
- }
-
+ if { "$userpswd" == "" } { set userpswd $passwd }
+ }
+
# Figure out cypher type
if {[info exists cypher]} {
@@ -272,9 +483,9 @@ foreach firewall [lrange $argv $i end] {
set cmethod [find method $firewall]
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
- # Figure out the SSH executable name
- set sshcmd [find sshcmd $firewall]
- if { "$sshcmd" == "" } { set sshcmd {ssh} }
+ # Figure out the SSH executable name
+ set sshcmd [find sshcmd $firewall]
+ if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the firewall
if {[login $firewall $ruser $userpswd $passwd $enapasswd $prompt $cmethod $cyphertype]} {
@@ -302,7 +513,7 @@ foreach firewall [lrange $argv $i end] {
source $sfile
close
} else {
- label $firewall
+ label $firewall
log_user 1
interact
}
diff --git a/bin/nrancid.in b/bin/nrancid.in
index 3f2b224..b7305e5 100644
--- a/bin/nrancid.in
+++ b/bin/nrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: nrancid.in,v 1.17 2004/10/15 08:56:01 afort Exp $
+## $Id: nrancid.in,v 1.23 2005/06/24 16:01:19 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -21,7 +21,7 @@
#
# Amazingly hacked version of Hank's rancid - this one tries to
# deal with Netscreen firewalls
-#
+#
# Original Netscreen hacks implemented by Stephen Gill [gillsr@yahoo.com]
#
# RANCID - Really Awesome New Cisco confIg Differ
@@ -35,15 +35,16 @@ $debug = $opt_d;
$file = $opt_f;
$host = $ARGV[0];
$found_end = 0;
-$timeo = 90; # nlogin timeout in seconds
+$timeo = 90; # nlogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
-# This routine is used to print out the firewall configuration
+# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -65,10 +66,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -78,10 +79,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -91,22 +92,22 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
- $sorted_lines[$i] = $key;
- $i++;
+ $sorted_lines[$i] = $key;
+ $i++;
}
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -120,7 +121,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -133,7 +134,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -150,20 +151,20 @@ sub GetSystem {
# throw away the pager lines
next if /^--- more ---/;
- /^Serial Number: (\d+), Control Number: \d+$/ &&
- ProcessHistory("SYSTEM","","", "!SN: $1\n") && next;
- /^Product Name: (\S+)$/ &&
- ProcessHistory("SYSTEM","","", "!Product: $1\n") && next;
- /^Hardware Version: (\S+), / &&
- ProcessHistory("SYSTEM","","", "!HW: $1\n") && next;
- /^Software Version: (\S+), Type: (\S+)$/ &&
- ProcessHistory("SYSTEM","","", "!Netscreen Type: $2\n!Software Version: $1\n") && next;
- /^Image: (\S+), / &&
- ProcessHistory("SYSTEM","","", "!Image: $1\n") && next;
- /^Feature: (\S+)$/ &&
- ProcessHistory("SYSTEM","","", "!Feature: $1\n") && next;
- /^File Name: (\S+), Checksum: (\S+)$/ &&
- ProcessHistory("SYSTEM","","", "!File Name: $1, Checksum: $2\n") && next;
+ /^Serial Number: (\d+), Control Number: \d+$/ &&
+ ProcessHistory("SYSTEM","","", "!SN: $1\n") && next;
+ /^Product Name: (\S+)$/ &&
+ ProcessHistory("SYSTEM","","", "!Product: $1\n") && next;
+ /^Hardware Version: (\S+), / &&
+ ProcessHistory("SYSTEM","","", "!HW: $1\n") && next;
+ /^Software Version: (\S+), Type: (\S+)$/ &&
+ ProcessHistory("SYSTEM","","", "!Netscreen Type: $2\n!Software Version: $1\n") && next;
+ /^Image: (\S+), / &&
+ ProcessHistory("SYSTEM","","", "!Image: $1\n") && next;
+ /^Feature: (\S+)$/ &&
+ ProcessHistory("SYSTEM","","", "!Feature: $1\n") && next;
+ /^File Name: (\S+), Checksum: (\S+)$/ &&
+ ProcessHistory("SYSTEM","","", "!File Name: $1, Checksum: $2\n") && next;
}
ProcessHistory("SYSTEM","","","!\n");
@@ -190,18 +191,23 @@ sub GetConf {
next if /^--- more ---/;
if (/^set admin name "(\S+)"$/ && $filter_pwds >= 1) {
- ProcessHistory("ADMIN","","","!set admin name <removed>\n");
- next;
- }
+ ProcessHistory("ADMIN","","","!set admin name <removed>\n");
+ next;
+ }
if (/^set admin password (\S+)$/ && $filter_pwds >= 1) {
- ProcessHistory("ADMIN","","","!set admin password <removed>\n");
- next;
- }
+ ProcessHistory("ADMIN","","","!set admin password <removed>\n");
+ next;
+ }
if (/^set admin user (\S+) password (\S+) privilege (\S+)$/ &&
$filter_pwds >= 1) {
- ProcessHistory("ADMIN","","",
+ ProcessHistory("ADMIN","","",
"!set admin user $1 password <removed> privilege $3\n");
- next;
+ next;
+ }
+ if (/^set auth-server (\S+) radius secret / && $filter_pwds >= 1 ) {
+ ProcessHistory("ADMIN","","",
+ "!set auth-server $1 radius secret <removed>\n");
+ next;
}
ProcessHistory("","","","$_");
}
@@ -213,16 +219,15 @@ sub GetConf {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'get system' => "GetSystem",
- 'get conf' => "GetConf"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important. pita
-@commands=(
- "get system",
- "get conf"
+@commandtable = (
+ {'get system' => 'GetSystem'},
+ {'get conf' => 'GetConf'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -248,7 +253,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/nslogin.in b/bin/nslogin.in
index c4b8e8a..b48004d 100644
--- a/bin/nslogin.in
+++ b/bin/nslogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: nslogin.in,v 1.11 2004/02/02 17:38:36 heas Exp $
+## $Id: nslogin.in,v 1.17 2005/06/14 22:23:44 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -61,7 +61,7 @@ set do_enapasswd 1
set platform ""
# Find the user in the ENV, or use the unix userid.
-if {[ info exists env(CISCO_USER) ] } {
+if {[ info exists env(CISCO_USER) ]} {
set default_user $env(CISCO_USER)
} elseif {[ info exists env(USER) ]} {
set default_user $env(USER)
@@ -288,6 +288,7 @@ proc source_password_file { password_file } {
}
# Log into the router.
+# returns: 0 on success, 1 on failure
proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
global spawn_id in_proc do_command do_script platform
global prompt u_prompt p_prompt e_prompt sshcmd
@@ -297,16 +298,28 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
if ![string compare $prog "ssh"] {
if [ catch {spawn $sshcmd -c $cyphertype -x -l $user $router} reason ] {
send_user "\nError: $sshcmd failed: $reason\n"
- exit 1
+ return 1
}
+ } elseif ![string compare $prog "telnet"] {
+ send_error "\nError: unsupported method: telnet\n"
+ if { $progs == 0 } {
+ return 1
+ }
+ continue
+ } elseif ![string compare $prog "rsh"] {
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
+ }
+ continue
} else {
- puts "\nError: unknown connection method: $prog"
+ send_user "\nError: unknown connection method: $prog\n"
return 1
}
- incr progs -1
sleep 0.3
# This helps cleanup each expect clause.
@@ -589,9 +602,9 @@ foreach router [lrange $argv $i end] {
set cmethod [find method $router]
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
- # Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
- if { "$sshcmd" == "" } { set sshcmd {ssh} }
+ # Figure out the SSH executable name
+ set sshcmd [find sshcmd $router]
+ if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
if {[login $router $ruser $userpswd $passwd $enapasswd $cmethod $cyphertype]} {
diff --git a/bin/nsrancid.in b/bin/nsrancid.in
index 40a286f..c0a9a73 100644
--- a/bin/nsrancid.in
+++ b/bin/nsrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: nsrancid.in,v 1.7 2004/01/11 03:49:13 heas Exp $
+## $Id: nsrancid.in,v 1.11 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -34,20 +34,20 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # nslogin timeout in seconds
+$timeo = 90; # nslogin timeout in seconds
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
@temp1 = split (/\./,$host);
$prompt = "$temp1[0]#";
$prompt = "netscaler#";
-my(%filter_pwds); # password filtering mode
-
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -69,10 +69,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -82,10 +82,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -95,10 +95,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -108,9 +108,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -124,7 +124,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -137,7 +137,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -165,9 +165,9 @@ sub ShowConfig {
}
if (/exit$/) {
- $found_end = 1;
- $clean_run = 1;
- return(1);
+ $found_end = 1;
+ $clean_run = 1;
+ return(1);
}
return(0);
}
@@ -205,17 +205,15 @@ sub RunCommand {
sub DoNothing {print STDOUT;}
# Main
-#--------------------------------------------------
-%commands=(
- 'cat /etc/ns.conf' => "ShowConfig",
- 'get log setting' => "GetLogSet"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "cat /etc/ns.conf",
- "get log setting"
+@commandtable = (
+ {'cat /etc/ns.conf' => 'ShowConfig'},
+ {'get log setting' => 'GetLogSet'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -261,7 +259,7 @@ TOP: while(<INPUT>) {
# if ( (/netscaler#/) || $found_end ) {
#print STDOUT "\n\nhere1\n";
-# $clean_run=1;
+# $clean_run=1;
# last;
# }
diff --git a/bin/par.in b/bin/par.in
index b50bd05..ae94eae 100644
--- a/bin/par.in
+++ b/bin/par.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: par.in,v 1.10 2004/01/11 03:49:13 heas Exp $
+## $Id: par.in,v 1.11 2005/06/14 20:20:44 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -59,7 +59,7 @@ if ($opt_q && ($opt_x || $opt_l)) {
$signalled=0;
-sub handler {
+sub handler {
$signalled++;
print STDERR "Received signal - ending run ($signalled).\n";
if($signalled>1) {
@@ -145,4 +145,4 @@ $procs=$i if ($i<$procs);
while($procs) {
$procs-- if(finish);
}
-print STDERR "Complete\n" if ($debug);
+print STDERR "Complete\n" if ($debug);
diff --git a/bin/prancid.in b/bin/prancid.in
index 7ded178..d3e71a4 100755
--- a/bin/prancid.in
+++ b/bin/prancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: prancid.in,v 1.29 2004/01/11 03:49:13 heas Exp $
+## $Id: prancid.in,v 1.32 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -33,16 +33,17 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # clogin timeout in seconds
-my($platform); # platform/cpu type
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
+my($platform); # platform/cpu type
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -64,10 +65,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -77,10 +78,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -90,10 +91,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -103,9 +104,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -119,7 +120,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -132,7 +133,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -460,22 +461,18 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'show version all' => "ShowVersion",
- 'show package' => "ShowPackage",
- 'show hardware' => "ShowHardware",
- 'show inventory' => "ShowInventory",
- 'write term' => "WriteTerm"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "show version all",
- "show package",
- "show hardware",
- "show inventory",
- "write term"
+@commandtable = (
+ {'show version all' => 'ShowVersion'},
+ {'show package' => 'ShowPackage'},
+ {'show hardware' => 'ShowHardware'},
+ {'show inventory' => 'ShowInventory'},
+ {'write term' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
diff --git a/bin/rancid-fe.in b/bin/rancid-fe.in
index b80a194..3976253 100644
--- a/bin/rancid-fe.in
+++ b/bin/rancid-fe.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: rancid-fe.in,v 1.36 2004/01/11 03:49:13 heas Exp $
+## $Id: rancid-fe.in,v 1.37 2005/06/14 20:20:44 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -19,7 +19,7 @@
## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
-# rancid-FE - front-end to rancid/jrancid/etc. for use with par.
+# rancid-FE - front-end to rancid/jrancid/etc. for use with par.
#
# usage: rancid-fe <router>:<vendor>
#
diff --git a/bin/rancid-run.in b/bin/rancid-run.in
index 02093bc..9197117 100644
--- a/bin/rancid-run.in
+++ b/bin/rancid-run.in
@@ -1,6 +1,6 @@
#! /bin/sh
##
-## $Id: rancid-run.in,v 1.31 2004/12/24 00:55:26 tex Exp $
+## $Id: rancid-run.in,v 1.32 2005/06/14 20:20:44 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -143,5 +143,5 @@ END
echo
echo ending: `date`
- ) >$LOGDIR/$GROUP.`date +%Y%m%d.%H%M%S` 2>&1
+ ) >$LOGDIR/$GROUP.`date +%Y%m%d.%H%M%S` 2>&1
done
diff --git a/bin/rancid.in b/bin/rancid.in
index 0841594..915be60 100644
--- a/bin/rancid.in
+++ b/bin/rancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: rancid.in,v 1.185 2005/03/29 23:38:41 heas Exp $
+## $Id: rancid.in,v 1.190 2005/06/24 16:07:00 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -34,15 +34,16 @@ $found_end = 0;
$found_version = 0;
$found_env = 0;
$found_diag = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # clogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -64,10 +65,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -77,10 +78,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -90,10 +91,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -103,9 +104,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -119,7 +120,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -132,7 +133,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -1235,8 +1236,8 @@ sub WriteTerm {
$lineauto = 1 if /^ modem auto/;
/^ speed / && $lineauto && next; # kill speed on serial lines
/^ clockrate / && next; # kill clockrate on serial interfaces
- if (/^(enable )?(password|passwd) / && $filter_pwds >= 1) {
- ProcessHistory("ENABLE","","","!$1$2 <removed>\n");
+ if (/^(enable )?(password|passwd)( level \d+)? / && $filter_pwds >= 1) {
+ ProcessHistory("ENABLE","","","!$1$2$3 <removed>\n");
next;
}
if (/^(enable secret) / && $filter_pwds >= 2) {
@@ -1315,7 +1316,7 @@ sub WriteTerm {
ProcessHistory("","","","!$1 <removed> $'"); next;
}
# filter HSRP passwords
- if (/^(\s+standby \d authentication) / && $filter_pwds >= 1) {
+ if (/^(\s+standby \d+ authentication) / && $filter_pwds >= 1) {
ProcessHistory("","","","!$1 <removed>\n"); next;
}
# this appears in "measurement/sla" images
@@ -1499,122 +1500,68 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'admin show version' => "ShowVersion",
- 'show version' => "ShowVersion",
- 'show redundancy secondary' => "ShowRedundancy",
- 'show idprom backplane', => "ShowIDprom",
- 'show install active' => "ShowInstallActive",
- 'admin show env all' => "ShowEnv",
- 'show env all' => "ShowEnv",
- 'show rsp chassis-info',=> "ShowRSP",
- 'show gsr chassis' => "ShowGSR",
- 'show boot' => "ShowBoot",
- 'show bootvar' => "ShowBoot",
- 'show variables boot' => "ShowBoot",
- 'show flash' => "ShowFlash",
- 'dir /all nvram:' => "DirSlotN",
- 'dir /all bootflash:' => "DirSlotN",
- 'dir /all slot0:' => "DirSlotN",
- 'dir /all disk0:' => "DirSlotN",
- 'dir /all slot1:' => "DirSlotN",
- 'dir /all disk1:' => "DirSlotN",
- 'dir /all slot2:' => "DirSlotN",
- 'dir /all disk2:' => "DirSlotN",
- 'dir /all harddisk:' => "DirSlotN",
- 'dir /all harddiska:' => "DirSlotN",
- 'dir /all harddiskb:' => "DirSlotN",
- "dir /all sup-bootflash:"=> "DirSlotN", # cat 6500-ios
- "dir /all sup-microcode:"=> "DirSlotN", # cat 6500-ios
- 'dir /all slavenvram:' => "DirSlotN",
- 'dir /all slavebootflash:' => "DirSlotN",
- 'dir /all slaveslot0:' => "DirSlotN",
- 'dir /all slavedisk0:' => "DirSlotN",
- 'dir /all slaveslot1:' => "DirSlotN",
- 'dir /all slavedisk1:' => "DirSlotN",
- 'dir /all slaveslot2:' => "DirSlotN",
- 'dir /all slavedisk2:' => "DirSlotN",
- "dir /all slavesup-bootflash:"=> "DirSlotN", # cat 7609
- 'dir /all sec-nvram:' => "DirSlotN",
- 'dir /all sec-bootflash:' => "DirSlotN",
- 'dir /all sec-slot0:' => "DirSlotN",
- 'dir /all sec-disk0:' => "DirSlotN",
- 'dir /all sec-slot1:' => "DirSlotN",
- 'dir /all sec-disk1:' => "DirSlotN",
- 'dir /all sec-slot2:' => "DirSlotN",
- 'dir /all sec-disk2:' => "DirSlotN",
- 'show controllers' => "ShowContAll",
- 'show controllers cbus' => "ShowContCbus",
- 'show diagbus' => "ShowDiagbus",
- 'admin show diag' => "ShowDiag",
- 'show diag' => "ShowDiag",
- 'show module' => "ShowModule", # cat 6500-ios
- 'show spe version' => "ShowSpeVersion",
- 'show c7200' => "ShowC7200",
- 'show vtp status' => "ShowVTP",
- 'show vlan' => "ShowVLAN",
- 'show running-config' => "WriteTerm",
- 'write term' => "WriteTerm"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "admin show version",
- "show version",
- "show redundancy secondary",
- "show idprom backplane",
- "show install active",
- "admin show env all",
- "show env all",
- "show rsp chassis-info",
- "show gsr chassis",
- "show boot",
- "show bootvar",
- "show variables boot",
- "show flash",
- "dir /all nvram:",
- "dir /all bootflash:",
- "dir /all slot0:",
- "dir /all disk0:",
- "dir /all slot1:",
- "dir /all disk1:",
- "dir /all slot2:",
- "dir /all disk2:",
- "dir /all harddisk:",
- "dir /all harddiska:",
- "dir /all harddiskb:",
- "dir /all sup-bootflash:",
- "dir /all sup-microcode:",
- "dir /all slavenvram:",
- "dir /all slavebootflash:",
- "dir /all slaveslot0:",
- "dir /all slavedisk0:",
- "dir /all slaveslot1:",
- "dir /all slavedisk1:",
- "dir /all slaveslot2:",
- "dir /all slavedisk2:",
- "dir /all slavesup-bootflash:",
- "dir /all sec-nvram:",
- "dir /all sec-bootflash:",
- "dir /all sec-slot0:",
- "dir /all sec-disk0:",
- "dir /all sec-slot1:",
- "dir /all sec-disk1:",
- "dir /all sec-slot2:",
- "dir /all sec-disk2:",
- "show controllers",
- "show controllers cbus",
- "show diagbus",
- "admin show diag",
- "show diag",
- "show module",
- "show spe version",
- "show c7200",
- "show vtp status",
- "show vlan",
- "show running-config",
- "write term"
+@commandtable = (
+ {'admin show version' => 'ShowVersion'},
+ {'show version' => 'ShowVersion'},
+ {'show redundancy secondary' => 'ShowRedundancy'},
+ {'show idprom backplane', => 'ShowIDprom'},
+ {'show install active' => 'ShowInstallActive'},
+ {'admin show env all' => 'ShowEnv'},
+ {'show env all' => 'ShowEnv'},
+ {'show rsp chassis-info', => 'ShowRSP'},
+ {'show gsr chassis' => 'ShowGSR'},
+ {'show boot' => 'ShowBoot'},
+ {'show bootvar' => 'ShowBoot'},
+ {'show variables boot' => 'ShowBoot'},
+ {'show flash' => 'ShowFlash'},
+ {'dir /all nvram:' => 'DirSlotN'},
+ {'dir /all bootflash:' => 'DirSlotN'},
+ {'dir /all slot0:' => 'DirSlotN'},
+ {'dir /all disk0:' => 'DirSlotN'},
+ {'dir /all slot1:' => 'DirSlotN'},
+ {'dir /all disk1:' => 'DirSlotN'},
+ {'dir /all slot2:' => 'DirSlotN'},
+ {'dir /all disk2:' => 'DirSlotN'},
+ {'dir /all harddisk:' => 'DirSlotN'},
+ {'dir /all harddiska:' => 'DirSlotN'},
+ {'dir /all harddiskb:' => 'DirSlotN'},
+ {'dir /all sup-bootflash:' => 'DirSlotN'}, # cat 6500-ios
+ {'dir /all sup-microcode:' => 'DirSlotN'}, # cat 6500-ios
+ {'dir /all slavenvram:' => 'DirSlotN'},
+ {'dir /all slavebootflash:' => 'DirSlotN'},
+ {'dir /all slaveslot0:' => 'DirSlotN'},
+ {'dir /all slavedisk0:' => 'DirSlotN'},
+ {'dir /all slaveslot1:' => 'DirSlotN'},
+ {'dir /all slavedisk1:' => 'DirSlotN'},
+ {'dir /all slaveslot2:' => 'DirSlotN'},
+ {'dir /all slavedisk2:' => 'DirSlotN'},
+ {'dir /all slavesup-bootflash:' => 'DirSlotN'}, # cat 7609
+ {'dir /all sec-nvram:' => 'DirSlotN'},
+ {'dir /all sec-bootflash:' => 'DirSlotN'},
+ {'dir /all sec-slot0:' => 'DirSlotN'},
+ {'dir /all sec-disk0:' => 'DirSlotN'},
+ {'dir /all sec-slot1:' => 'DirSlotN'},
+ {'dir /all sec-disk1:' => 'DirSlotN'},
+ {'dir /all sec-slot2:' => 'DirSlotN'},
+ {'dir /all sec-disk2:' => 'DirSlotN'},
+ {'show controllers' => 'ShowContAll'},
+ {'show controllers cbus' => 'ShowContCbus'},
+ {'show diagbus' => 'ShowDiagbus'},
+ {'admin show diag' => 'ShowDiag'},
+ {'show diag' => 'ShowDiag'},
+ {'show module' => 'ShowModule'}, # cat 6500-ios
+ {'show spe version' => 'ShowSpeVersion'},
+ {'show c7200' => 'ShowC7200'},
+ {'show vtp status' => 'ShowVTP'},
+ {'show vlan' => 'ShowVLAN'},
+ {'show running-config' => 'WriteTerm'},
+ {'write term' => 'WriteTerm'},
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
diff --git a/bin/rivlogin.in b/bin/rivlogin.in
index bbfa9b5..e0de6b2 100644
--- a/bin/rivlogin.in
+++ b/bin/rivlogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: rivlogin.in,v 1.18 2004/07/19 00:06:08 afort Exp $
+## $Id: rivlogin.in,v 1.19 2005/06/14 20:20:44 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -24,8 +24,8 @@
# rivlogin - Riverstone (and Enterasys SSR) login
#
# Based upon rscmd (see nmops.org)
-# rscmd - Riverstone Networks Automated login
-# by Mike MacFaden, Kiran Addepalli
+# rscmd - Riverstone Networks Automated login
+# by Mike MacFaden, Kiran Addepalli
# Riverstone Networks, 2000
#
# Returned to the RANCID crowd by andrew fort
@@ -36,12 +36,12 @@
set verbose 0
set success 1
set config 0
-
+
# in seconds to wait for data back from device
set timeout 10
set tempfile "/tmp/rivlogin.[exec date]"
-# cli command prompt
+# cli command prompt
set my_prompt ">"
set enable_prompt "\#"
@@ -105,27 +105,27 @@ proc label { host } {
# add password at* steve
# add password * hanky-pie
-proc add { var args } {
+proc add { var args } {
global $var
lappend $var $args
-}
+}
# Loads the password file. Note that as this file is tcl, and that
# it is sourced, the user better know what to put in there, as it
# could install more than just password info... I will assume however,
# 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
+# 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] } {
+ if { [info exists read_password_file] } {
return 1
}
- if { [info exists password_file] == 0 } {
+ if { [info exists password_file] == 0 } {
set password_file $env(HOME)/.cloginrc
}
@@ -149,8 +149,8 @@ proc find { var router } {
return {}
}
- upvar $var list
- if { [info exists list] } {
+ upvar $var list
+ if { [info exists list] } {
foreach line $list {
if { [string match [lindex $line 0] $router ] } {
return [lrange $line 1 end]
@@ -166,7 +166,7 @@ proc find { var router } {
proc auto_exit { } {
- global telnet_id
+ global telnet_id
if { $verbose == 1 } {
puts "DEBUG: auto_exit closing connection to pid $telnet_id\n"
@@ -179,7 +179,7 @@ proc auto_exit { } {
# post: return 0 on successful login, else 1
#
# NOTE: a number of globals are setup: my_prompt, telnet_id are key
-# and paging of cli output is disabled
+# and paging of cli output is disabled
proc login { router user userpswd passwd enapasswd } {
@@ -212,7 +212,7 @@ proc login { router user userpswd passwd enapasswd } {
expect "*"
send "\r"
- # If password fails 3 times then expect again
+ # If password fails 3 times then expect again
set pass_attempt 0
expect {
@@ -220,7 +220,7 @@ proc login { router user userpswd passwd enapasswd } {
-re ".*> " { }
"Password:" {
- incr pass_attempt
+ incr pass_attempt
send "$passwd\r"
exp_continue
}
@@ -232,13 +232,13 @@ proc login { router user userpswd passwd enapasswd } {
send "$user\r"
expect {
- "Password: " {
+ "Password: " {
incr pattempt
if {$pattempt == 1} {
- send "$userpswd\r";
- } else {
- send "$enapasswd\r";
+ send "$userpswd\r";
+ } else {
+ send "$enapasswd\r";
}
exp_continue
}
@@ -246,8 +246,8 @@ proc login { router user userpswd passwd enapasswd } {
-re ".*> " { exp_continue;}
}
}
-
- "%TELNETD-W-BADPASSWD" {
+
+ "%TELNETD-W-BADPASSWD" {
puts "ERROR: bad userid or password to telnet."
return 1
}
@@ -266,7 +266,7 @@ proc login { router user userpswd passwd enapasswd } {
return 1
}
- "Connection closed *" {
+ "Connection closed *" {
if {$pass_attempt == 3} {
puts "ERROR: Maximum attempts for password reached. Check password. Exiting.";
puts $expect_out(0,string);
@@ -279,7 +279,7 @@ proc login { router user userpswd passwd enapasswd } {
return 1
}
- eof {
+ eof {
puts "ERROR: device closed telnet connection during login"
return 1
}
@@ -322,9 +322,9 @@ proc disable_cmd_autocomplete { } {
$my_prompt { }
- timeout {
+ timeout {
puts "ERROR:disable_cmd_autocomplete(TIMEOUT)";
- return 0;
+ return 0;
}
}
@@ -333,7 +333,7 @@ proc disable_cmd_autocomplete { } {
}
# pre: login returned 0, do_enable returned 0, cli is in enable or config mode
-# post: issues logout cli to device, returns 0
+# post: issues logout cli to device, returns 0
proc logout { prompt } {
global config_mode enable_prompt
@@ -342,7 +342,7 @@ proc logout { prompt } {
# verify top level prompt state, move to it if necessary
if { $config_mode == 1 } {
-
+
send "exit\r"
expect {
@@ -382,22 +382,22 @@ proc do_enable { enauser enapasswd userpswd } {
}
set uses_username 0;
-
+
send "enable\r"
expect {
- Username: {
+ Username: {
set uses_username 1;
- send "$enauser\r";
- exp_continue
+ send "$enauser\r";
+ exp_continue
}
- Password: {
+ Password: {
if {$uses_username == 1} {
send "$userpswd\r";
} else {
send "$enapasswd\r";
}
- exp_continue
+ exp_continue
}
"$my_prompt" {
@@ -405,7 +405,7 @@ proc do_enable { enauser enapasswd userpswd } {
return 1
}
- "CONS-W-AUTH_PASSWD" { send "$enapasswd\r"; }
+ "CONS-W-AUTH_PASSWD" { send "$enapasswd\r"; }
"$enable_prompt " { }
"%SYS-W-NOPASSWD*" { }
@@ -415,7 +415,7 @@ proc do_enable { enauser enapasswd userpswd } {
return 1
}
}
-
+
set my_prompt $enable_prompt
return 0
}
@@ -432,7 +432,7 @@ proc do_configure { } {
if { $verbose == 1 } {
puts "DEBUG: do_config: my_prompt = $my_prompt cfg_prompt = $config_prompt"
}
-
+
send "configure\r"
expect {
"$config_prompt " { }
@@ -453,13 +453,13 @@ proc do_configure { } {
# post: logfile open, global var logging == 1, return 0 , else 1
proc start_logfile { output_file } {
- global logging
+ global logging
if { [ string length $output_file ] != 0 } {
- set rc [ catch {
+ set rc [ catch {
log_file -noappend $output_file
} errMsg ]
-
+
if { $rc != 0 } {
puts "ERROR: open file $output_file for write access failed. $errMsg\n"
return 1
@@ -471,7 +471,7 @@ proc start_logfile { output_file } {
}
proc run_commands { prompt cmdstring } {
- global sendstring
+ global sendstring
set commands [split $cmdstring \;]
set num_commands [llength $cmdstring]
@@ -511,7 +511,7 @@ proc run_single_command { prompt cmdstring } {
set need_ays 1
set delay 1
if {$verbose == 1} {
- puts "DEBUG: save startup cmd seen, set need_ays = 1"
+ puts "DEBUG: save startup cmd seen, set need_ays = 1"
}
}
@@ -524,7 +524,7 @@ proc run_single_command { prompt cmdstring } {
if { $delay == 1} {
sleep 1
- }
+ }
expect {
@@ -555,7 +555,7 @@ proc run_single_command { prompt cmdstring } {
"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
}
@@ -564,7 +564,7 @@ proc run_single_command { prompt cmdstring } {
"%CONFIG-E-DUPLICATE,*" {
}
- "$prompt" {
+ "$prompt" {
if { $seen_prompt == 0 } {
set seen_prompt 1
}
@@ -584,7 +584,7 @@ proc run_single_command { prompt cmdstring } {
}
- timeout {
+ timeout {
if {$verbose == 1} {
puts "DEBUG: timeout occured for the $seen_time time\n"
}
@@ -599,8 +599,8 @@ proc run_single_command { prompt cmdstring } {
set rc 1
}
- eof {
- puts "ERROR:run_commands(connection closed by device)\n"
+ eof {
+ puts "ERROR:run_commands(connection closed by device)\n"
set rc 1
}
@@ -622,8 +622,8 @@ proc init_userid { } {
if {[ info exists 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 -
+ # 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
}
@@ -651,7 +651,7 @@ proc process_script_file { filename } {
set rc 0
set ifile ""
- set rc [ catch {
+ set rc [ catch {
set ifile [ open $filename r]
} errMsg ]
@@ -663,16 +663,16 @@ proc process_script_file { filename } {
set line_cnt 0
while { [eof $ifile] != 1 } {
-
+
set bytes [ gets $ifile cmd ]
incr line_cnt
- if { $bytes < 0 } {
- break
+ if { $bytes < 0 } {
+ break
} elseif { $bytes == 0 } {
continue
}
-
+
if { $verbose == 1 } {
puts "DEBUG: line:$line_cnt cmd = $cmd\n"
}
@@ -711,7 +711,7 @@ proc strip_log { filename router } {
global tempfile
- set rc [ catch {
+ set rc [ catch {
set ifile [ open $filename r]
} errMsg ]
@@ -719,7 +719,7 @@ proc strip_log { filename router } {
puts "ERROR: strip_log: open script file $filename for read access failed. $errMsg\n"
return 1
}
- set rc [ catch {
+ set rc [ catch {
set ofile [ open $tempfile w]
} errMsg ]
@@ -731,12 +731,11 @@ proc strip_log { filename router } {
set nl 0
puts $ofile "rscmd: $router : [exec date]"
-
+
while { [eof $ifile] != 1 } {
-
set bytes [ gets $ifile cmd ]
- if { $bytes <= 0 } {
- break
+ if { $bytes <= 0 } {
+ break
}
incr nl
if { $nl <= 2 } {
@@ -894,24 +893,24 @@ set router [string tolower $router]
if { [llength $pswd] == 0 } {
puts "ERROR: - no password for $router in $password_file.\n"
exit 1
- }
+ }
if { $do_enapasswd && [llength $pswd] < 2 } {
puts "ERROR: no enable password found for $router in $password_file."
exit 1
}
-
+
set passwd [join [lindex $pswd 0] ""]
set enapasswd [join [lindex $pswd 1] ""]
}
# Figure out user to login with if necessary
- if {[info exists username]} {
+ if {[info exists username]} {
# command line username
set user $username
} else {
set user [join [find user $router] ""]
if { "$user" == "" } { set user $default_user }
- }
+ }
# Figure out username's password
if {[info exists userpasswd]} {
@@ -919,17 +918,17 @@ set router [string tolower $router]
set userpswd $userpasswd
} else {
set userpswd [join [find userpassword $router] ""]
- if { "$userpswd" == "" } { set userpswd $passwd }
- }
+ if { "$userpswd" == "" } { set userpswd $passwd }
+ }
# Figure out enable username
- if {[info exists enausername]} {
+ if {[info exists enausername]} {
# command line enausername
set enauser $enausername
} else {
set enauser [join [find enauser $router] ""]
- if { "$enauser" == "" } { set enauser $user }
- }
+ if { "$enauser" == "" } { set enauser $user }
+ }
# Login to the router, set my_prompt to router's cmd prompt
if {[login $router $user $userpswd $passwd $enapasswd ]} {
@@ -956,13 +955,13 @@ set router [string tolower $router]
if { $do_command } {
disable_cmd_autocomplete
disable_cli_paging
-
+
if { [start_logfile $output_file] != 0 } {
exit 1
}
if {[ run_commands $my_prompt $command ]} {
- log_file
+ log_file
exit 1
} else {
logout $my_prompt
@@ -970,7 +969,7 @@ set router [string tolower $router]
} elseif { $do_script } {
disable_cmd_autocomplete
disable_cli_paging
-
+
if {[ start_logfile $output_file] != 0 } {
exit 1
}
@@ -985,14 +984,14 @@ set router [string tolower $router]
logout $my_prompt
} else {
- label $router
+ label $router
log_user 1
if {[ start_logfile $output_file] != 0 } {
exit 1
}
interact
- log_file
+ log_file
}
if { $verbose == 1 } {
@@ -1000,7 +999,7 @@ set router [string tolower $router]
}
if { $logging == 1} {
- log_file
+ log_file
strip_log $output_file $router
}
}
diff --git a/bin/rivrancid.in b/bin/rivrancid.in
index 8b9ae03..6d5f869 100644
--- a/bin/rivrancid.in
+++ b/bin/rivrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: rivrancid.in,v 1.9 2004/01/11 03:49:13 heas Exp $
+## $Id: rivrancid.in,v 1.14 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -21,9 +21,9 @@
#
# Amazingly hacked version of Hank's rancid - this one tries to
# deal with Cabletron, Riverstone and Enterasys routers/switches
-#
+#
# 10/23/2002 -- Initial changes for Riverstone/Cabletron support
-# Jim Meehan -- jmeehan@vpizza.org
+# Jim Meehan -- jmeehan@vpizza.org
#
# RANCID - Really Awesome New Cisco confIg Differ
#
@@ -37,15 +37,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # flogin timeout in seconds
+$timeo = 90; # rivlogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -67,10 +68,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -80,10 +81,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -93,22 +94,22 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
- $sorted_lines[$i] = $key;
- $i++;
+ $sorted_lines[$i] = $key;
+ $i++;
}
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -122,7 +123,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -135,7 +136,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -179,7 +180,7 @@ sub ShowUptime {
tr/\015//d;
last if(/^$prompt/);
next if /^\s*$/;
- next if /System up/;
+ next if /System up/;
ProcessHistory("UPTIME","","","!UPTIME: $_");
}
ProcessHistory("","","","!\n");
@@ -197,13 +198,13 @@ sub ShowActive {
s/^\s*(\d+\D: )*//;
# Riverstone/Cabletron doesn't have an "end" line, so
- # we need to set $clean_run here
+ # we need to set $clean_run here
if (/^$prompt/) {
- $clean_run = 1;
- last;
- }
+ $clean_run = 1;
+ last;
+ }
- next if (/Running system configuration/);
+ next if (/Running system configuration/);
# filter out any RCS/CVS tags to avoid confusing local CVS storage
s/\$(Revision|Id):/ $1:/;
@@ -227,22 +228,16 @@ sub ShowActive {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'system show uptime' => "ShowUptime",
- 'system show version' => "ShowVersion",
- 'system show hardware' => "ShowHardware",
- 'system show active-config' => "ShowActive"
-);
-
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important. pita
-
-@commands=(
- "system show uptime",
- "system show version",
- "system show hardware",
- "system show active-config"
+@commandtable = (
+ {'system show uptime' => 'ShowUptime'},
+ {'system show version' => 'ShowVersion'},
+ {'system show hardware' => 'ShowHardware'},
+ {'system show active-config' => 'ShowActive'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -269,7 +264,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/rrancid.in b/bin/rrancid.in
index 7674452..fdfb39c 100644
--- a/bin/rrancid.in
+++ b/bin/rrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: rrancid.in,v 1.18 2004/01/11 03:49:13 heas Exp $
+## $Id: rrancid.in,v 1.23 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -33,15 +33,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # clogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -63,10 +64,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -76,10 +77,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -89,22 +90,22 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
- $sorted_lines[$i] = $key;
- $i++;
+ $sorted_lines[$i] = $key;
+ $i++;
}
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -118,7 +119,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -131,7 +132,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -245,7 +246,7 @@ sub WriteTerm {
s/\$(Revision|Id):/ $1:/;
# order access-lists
/^access-list\s+(\d\d?)\s+(\S+)\s+(\S+)/ &&
- ProcessHistory("ACL $1 $2","ipsort","$3","$_") && next;
+ ProcessHistory("ACL $1 $2","ipsort","$3","$_") && next;
# prune snmp community statements
if (/^snmp (group|community) (\S+)/) {
if (defined($ENV{'NOCOMMSTR'})) {
@@ -255,7 +256,7 @@ sub WriteTerm {
}
}
ProcessHistory("","","","$_");
- # end of config
+ # end of config
if (/^end$/) {
$found_end = 1;
last;
@@ -283,26 +284,20 @@ sub FlailHelplessly {
}
# Main
-%commands=(
- 'show version' => "ShowVersion",
- "dir /flash" => "DirFlash",
- "dir /pcmcia0" => "DirFlash",
- "dir /pcmcia1" => "DirFlash",
- 'show hardware' => "ShowHardware",
- 'show chassis' => "ShowChassis",
- 'show slot table' => "ShowSlotTable",
- 'show config' => "WriteTerm"
-);
-@commands=(
- "show version",
- "dir /flash",
- "dir /pcmcia0",
- "dir /pcmcia1",
- "show hardware",
- "show chassis",
- "show slot table",
- "show config"
+@commandtable = (
+ {'show version' => 'ShowVersion'},
+ {'dir /flash' => 'DirFlash'},
+ {'dir /pcmcia0' => 'DirFlash'},
+ {'dir /pcmcia1' => 'DirFlash'},
+ {'show hardware' => 'ShowHardware'},
+ {'show chassis' => 'ShowChassis'},
+ {'show slot table' => 'ShowSlotTable'},
+ {'show config' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
$redback_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -330,7 +325,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/tntlogin.in b/bin/tntlogin.in
index 2eae6e3..027be07 100644
--- a/bin/tntlogin.in
+++ b/bin/tntlogin.in
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
-## $Id: tntlogin.in,v 1.12 2004/02/02 17:38:36 heas Exp $
+## $Id: tntlogin.in,v 1.17 2005/06/14 20:20:44 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -39,16 +39,16 @@ set password_file $env(HOME)/.cloginrc
set do_command 0
set do_script 0
# The default is to automatically enable
-set avenable 0
+set avenable 0
# The default is that you login non-enabled (tacacs can have you login already
# enabled)
-set avautoenable 1
+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
# Find the user in the ENV, or use the unix userid.
-if {[ info exists env(CISCO_USER) ] } {
+if {[ info exists env(CISCO_USER) ]} {
set default_user $env(CISCO_USER)
} elseif {[ info exists env(USER) ]} {
set default_user $env(USER)
@@ -61,9 +61,9 @@ if {[ info exists env(CISCO_USER) ] } {
if [ catch {exec id} reason ] {
send_error "\nError: could not exec id: $reason\n"
exit 1
- }
+ }
regexp {\(([^)]*)} "$reason" junk default_user
-}
+}
# Sometimes routers take awhile to answer (the default is 10 sec)
set timeout 45
@@ -260,6 +260,7 @@ proc source_password_file { password_file } {
}
# Log into the router.
+# returns: 0 on success, 1 on failure
proc login { router user userpswd passwd prompt cmethod cyphertype } {
global spawn_id in_proc do_command do_script
global u_prompt p_prompt sshcmd
@@ -269,6 +270,7 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ incr progs -1
if [string match "telnet*" $prog] {
regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
@@ -278,24 +280,24 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
- exit 1
+ return 1
}
- } elseif ![string compare $prog "ssh"] {
+ } elseif ![string compare $prog "ssh"] {
if [ catch {spawn $sshcmd -c $cyphertype -x -l $user $router} reason ] {
send_user "\nError: $sshcmd failed: $reason\n"
- exit 1
- }
- } elseif ![string compare $prog "rsh"] {
- if [ catch {spawn rsh -l $user $router} reason ] {
- send_user "\nError: rsh failed: $reason\n"
- exit 1
+ return 1
}
- } else {
- puts "\nError: unknown connection method: $prog"
+ } elseif ![string compare $prog "rsh"] {
+ send_error "\nError: unsupported method: rsh\n"
+ if { $progs == 0 } {
+ return 1
+ }
+ continue;
+ } else {
+ send_user "\nError: unknown connection method: $prog\n"
return 1
- }
- incr progs -1
- sleep 0.3
+ }
+ sleep 0.3
# This helps cleanup each expect clause.
expect_after {
@@ -387,7 +389,7 @@ proc run_commands { prompt command } {
send "lines 0\r"
expect -re $prompt {}
regsub -all "\[)(]" $prompt {\\&} reprompt
-
+
# Is this a multi-command?
if [ string match "*\;*" "$command" ] {
set commands [split $command \;]
@@ -409,7 +411,7 @@ proc run_commands { prompt command } {
-re "\[\n\r]+" { exp_continue }
}
}
-
+
send "quit\r"
# expect {
# -re "^WARNING: the current user has insufficient rights to view password fields. A configuration saved under this circumstance should not be used to restore profiles containing passwords. Save anyway? [y/n]"
@@ -496,9 +498,9 @@ foreach router [lrange $argv $i end] {
set cmethod [find method $router]
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
- # Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
- if { "$sshcmd" == "" } { set sshcmd {ssh} }
+ # Figure out the SSH executable name
+ set sshcmd [find sshcmd $router]
+ if { "$sshcmd" == "" } { set sshcmd {ssh} }
# Login to the router
if {[login $router $ruser $userpswd $passwd $prompt $cmethod $cyphertype]} {
diff --git a/bin/tntrancid.in b/bin/tntrancid.in
index 88520fd..ac3bbee 100644
--- a/bin/tntrancid.in
+++ b/bin/tntrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: tntrancid.in,v 1.8 2004/01/11 03:49:13 heas Exp $
+## $Id: tntrancid.in,v 1.14 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -34,19 +34,19 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # tntlogin timeout in seconds
+$timeo = 90; # tntlogin timeout in seconds
$prompt = "admin> ";
-$always_y = "y"; # cause its a pain.
+$always_y = "y"; # cause its a pain.
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
- print eval "$always_y \%history";
undef %history;
}
if (($new_hist_tag) && ($new_command) && ($command_string)) {
@@ -67,10 +67,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -80,10 +80,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -93,10 +93,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -106,9 +106,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -122,7 +122,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -135,45 +135,40 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
}
-
# This routine processes a "save con"
sub SaveConf {
print STDERR " In SaveConf: $_" if ($debug);
- my($comment) = 1; # strip extra comments, esp to preserve chassis type
while (<INPUT>) {
tr/\015//d;
last if(/^$prompt/);
-# next if(/^\s*$/);
-
-### s/^\s*$/;/;
-
-# Leave software revision, but strip out saved date,
-# which causes rancid to think it changes each poll
+ # Leave software revision, but strip out saved date,
+ # which causes rancid to think it changes each poll
if (/^; saved from /) {
- ProcessHistory("","","","$_");
- next;
+ ProcessHistory("","","","$_");
+ next;
}
/^; saved / && next;
# catch anything that wasnt match above.
ProcessHistory("","","","$_");
+
# end of config
-# if (/^# End of configuration file/i) {
if (/; profiles saved$/) {
printf STDERR " End SaveConf: $_" if ($debug);
$found_end = 1;
print STDOUT "$found_end = found_end within test\n";
- return(1);
+ return(1);
}
- $found_end = 1;
+ # XXX what is the purpose of this?
+ $found_end = 1;
#### print STDOUT "$found_end = found_end at test\n";
}
$found_end = 1;
@@ -189,17 +184,16 @@ print STDOUT "$found_end = found_end at end test\n";
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'save con' => "SaveConf"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "save con"
+@commandtable = (
+ {'save con' => 'SaveConf'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$tnt_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
-$tnt_cmds="save con";
open(OUTPUT,">$host.new") || die "Can't open $host.new for writing: $!\n";
select(OUTPUT);
@@ -223,7 +217,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
@@ -234,8 +228,8 @@ ProcessHistory("","","","#RANCID-CONTENT-TYPE: tnt\n#\n");
ProcessHistory("COMMENTS","keysort","X0",";\n");
TOP: while(<INPUT>) {
tr/\015//d;
-
- if (/^Error:/) {
+
+ if (/^Error:/) {
print STDOUT ("$host tntlogin error: $_");
print STDERR ("$host tntlogin error: $_") if ($debug);
$clean_run=0;
diff --git a/bin/xrancid.in b/bin/xrancid.in
index b415c86..718c699 100644
--- a/bin/xrancid.in
+++ b/bin/xrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: xrancid.in,v 1.33 2004/01/13 01:56:50 asp Exp $
+## $Id: xrancid.in,v 1.37 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -31,15 +31,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # clogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -61,10 +62,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -74,10 +75,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -87,10 +88,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -100,9 +101,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -116,7 +117,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -129,7 +130,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -373,26 +374,20 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'show version' => "ShowVersion",
- 'show memory' => "ShowMemory",
- 'show diag' => "ShowDiag",
- 'show switch' => "ShowSwitch",
- 'show slot' => "ShowSlot",
- 'show configuration detail' => "WriteTerm",
- 'show configuration' => "WriteTerm"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "show version",
- "show memory",
- "show diag",
- "show switch",
- "show slot",
- "show configuration detail",
- "show configuration"
+@commandtable = (
+ {'show version' => 'ShowVersion'},
+ {'show memory' => 'ShowMemory'},
+ {'show diag' => 'ShowDiag'},
+ {'show switch' => 'ShowSwitch'},
+ {'show slot' => 'ShowSlot'},
+ {'show configuration detail' => 'WriteTerm'},
+ {'show configuration' => 'WriteTerm'},
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
@@ -418,7 +413,7 @@ if ($file) {
# determine password filtering mode
if ($ENV{"FILTER_PWDS"} =~ /no/i) {
- $filter_pwds = 0;
+ $filter_pwds = 0;
} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
$filter_pwds = 2;
} else {
diff --git a/bin/zrancid.in b/bin/zrancid.in
index a969553..0eae9ef 100755
--- a/bin/zrancid.in
+++ b/bin/zrancid.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: zrancid.in,v 1.8 2004/01/11 03:49:13 heas Exp $
+## $Id: zrancid.in,v 1.11 2005/06/15 20:54:41 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -33,15 +33,16 @@ $file = $opt_f;
$host = $ARGV[0];
$clean_run = 0;
$found_end = 0;
-$timeo = 90; # clogin timeout in seconds
+$timeo = 90; # clogin timeout in seconds
-my(%filter_pwds); # password filtering mode
+my(@commandtable, %commands, @commands);# command lists
+my(%filter_pwds); # password filtering mode
# This routine is used to print out the router configuration
sub ProcessHistory {
- my($new_hist_tag,$new_command,$command_string,@string)=(@_);
- if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
- && defined %history) {
+ my($new_hist_tag,$new_command,$command_string,@string) = (@_);
+ if ((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
+ && defined %history) {
print eval "$command \%history";
undef %history;
}
@@ -63,10 +64,10 @@ sub ProcessHistory {
sub numerically { $a <=> $b; }
-# This is a sort routing that will sort numerically on the
+# This is a sort routine that will sort numerically on the
# keys of a hash as if it were a normal array.
sub keynsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort numerically keys(%lines)) {
@@ -76,10 +77,10 @@ sub keynsort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# keys of a hash as if it were a normal array.
sub keysort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort keys(%lines)) {
@@ -89,10 +90,10 @@ sub keysort {
@sorted_lines;
}
-# This is a sort routing that will sort on the
+# This is a sort routine that will sort on the
# values of a hash as if it were a normal array.
sub valsort{
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $key (sort values %lines) {
@@ -102,9 +103,9 @@ sub valsort{
@sorted_lines;
}
-# This is a numerical sort routing (ascending).
+# This is a numerical sort routine (ascending).
sub numsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $num (sort {$a <=> $b} keys %lines) {
@@ -118,7 +119,7 @@ sub numsort {
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
- local(%lines)=@_;
+ local(%lines) = @_;
local($i) = 0;
local(@sorted_lines);
foreach $addr (sort sortbyipaddr keys %lines) {
@@ -131,7 +132,7 @@ sub ipsort {
# These two routines will sort based upon IP addresses
sub ipaddrval {
my(@a) = ($_[0] =~ m#^(\d+)\.(\d+)\.(\d+)\.(\d+)$#);
- $a[3]+256*($a[2]+256*($a[1]+256*$a[0]));
+ $a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
@@ -306,16 +307,15 @@ sub WriteTerm {
sub DoNothing {print STDOUT;}
# Main
-%commands=(
- 'show version' => "ShowVersion",
- 'write term' => "WriteTerm"
-);
-# keys() doesnt return things in the order entered and the order of the
-# cmds is important (show version first and write term last). pita
-@commands=(
- "show version",
- "write term"
+@commandtable = (
+ {'show version' => 'ShowVersion'},
+ {'write term' => 'WriteTerm'}
);
+# Use an array to preserve the order of the commands and a hash for mapping
+# commands to the subroutine and track commands that have been completed.
+@commands = map(keys(%$_), @commandtable);
+%commands = map(%$_, @commandtable);
+
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
diff --git a/configure b/configure
index 2889b6f..ec1428a 100755
--- a/configure
+++ b/configure
@@ -310,7 +310,7 @@ 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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot 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 EGREP U ANSI2KNR MK_LCLSTATEDIR_TRUE MK_LCLSTATEDIR_FALSE CONF_INSTALL_TRUE CONF_INSTALL_FALSE MAILPLUS ADMINMAILPLUS DIRNAME DIFF DIFF_CMD SENDMAIL TAR PERLV_PATH PERLV EXPECT_PATH PING_PATH LG_PING_CMD CVS COMM FIND GREP ID MKDIR RSH SORT SSH TELNET TOUCH ENV_PATH LIBOBJS LTLIBOBJS'
+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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM 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 EGREP U ANSI2KNR MK_LCLSTATEDIR_TRUE MK_LCLSTATEDIR_FALSE CONF_INSTALL_TRUE CONF_INSTALL_FALSE MAILPLUS ADMINMAILPLUS DIRNAME DIFF DIFF_CMD SENDMAIL TAR PERLV_PATH PERLV EXPECT_PATH PING_PATH LG_PING_CMD CVS COMM FIND GREP ID MKDIR RSH SORT SSH TELNET TOUCH ENV_PATH LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -1310,7 +1310,7 @@ PACKAGE=`sed -n 's/.*package.*"\(.*\)".*/\1/p' $srcdir/include/version.h.in|tr -
-am__api_version="1.8"
+am__api_version="1.9"
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
@@ -1487,13 +1487,21 @@ echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
fi
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
- # Keeping the `.' argument allows $(mkdir_p) to be used without
- # argument. Indeed, we sometimes output rules like
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
- # where $(somedir) is conditionally defined.
- # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more
- # expensive solution, as it forces Make to start a sub-shell.)
- mkdir_p='mkdir -p -- .'
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
@@ -1628,9 +1636,6 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
-
-AMTAR=${AMTAR-"${am_missing_run}tar"}
-
install_sh=${install_sh-"$am_aux_dir/install-sh"}
# Installed binaries are usually stripped using `strip' when the user
@@ -1723,6 +1728,13 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
@@ -6810,7 +6822,6 @@ s,@AUTOCONF@,$AUTOCONF,;t t
s,@AUTOMAKE@,$AUTOMAKE,;t t
s,@AUTOHEADER@,$AUTOHEADER,;t t
s,@MAKEINFO@,$MAKEINFO,;t t
-s,@AMTAR@,$AMTAR,;t t
s,@install_sh@,$install_sh,;t t
s,@STRIP@,$STRIP,;t t
s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
@@ -6819,6 +6830,9 @@ s,@mkdir_p@,$mkdir_p,;t t
s,@AWK@,$AWK,;t t
s,@SET_MAKE@,$SET_MAKE,;t t
s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
s,@MAKE@,$MAKE,;t t
s,@CC@,$CC,;t t
s,@CFLAGS@,$CFLAGS,;t t
@@ -7533,27 +7547,21 @@ echo X"$mf" |
else
continue
fi
- grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
- # Extract the definition of DEP_FILES from the Makefile without
- # running `make'.
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
- test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
- # We invoke sed twice because it is the simplest approach to
- # changing $(DEPDIR) to its actual value in the expansion.
- for file in `sed -n '
- /^DEP_FILES = .*\\\\$/ {
- s/^DEP_FILES = //
- :loop
- s/\\\\$//
- p
- n
- /\\\\$/ b loop
- p
- }
- /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
diff --git a/depcomp b/depcomp
index 25bdb18..ffcd540 100755
--- a/depcomp
+++ b/depcomp
@@ -1,9 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2004-04-25.13
+scriptversion=2005-02-09.22
-# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,17 +43,18 @@ Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
- exit 0
+ exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
- exit 0
+ exit $?
;;
esac
@@ -61,18 +62,10 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
-# `libtool' can also be set to `yes' or `no'.
-
-if test -z "$depfile"; then
- base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
- dir=`echo "$object" | sed 's,/.*$,/,'`
- if test "$dir" = "$object"; then
- dir=
- fi
- # FIXME: should be _deps on DOS.
- depfile="$dir.deps/$base"
-fi
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
@@ -294,33 +287,43 @@ tru64)
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
- # Dependencies are output in .lo.d with libtool 1.4.
- # They are output in .o.d with libtool 1.5.
- tmpdepfile1="$dir.libs/$base.lo.d"
- tmpdepfile2="$dir.libs/$base.o.d"
- tmpdepfile3="$dir.libs/$base.d"
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mecanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
- tmpdepfile1="$dir$base.o.d"
- tmpdepfile2="$dir$base.d"
- tmpdepfile3="$dir$base.d"
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
- rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
- if test -f "$tmpdepfile1"; then
- tmpdepfile="$tmpdepfile1"
- elif test -f "$tmpdepfile2"; then
- tmpdepfile="$tmpdepfile2"
- else
- tmpdepfile="$tmpdepfile3"
- fi
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
diff --git a/etc/Makefile.in b/etc/Makefile.in
index 1a37d6e..de060b1 100644
--- a/etc/Makefile.in
+++ b/etc/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.4 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -46,6 +46,12 @@ CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(pkgdatadir)"
pkgdataDATA_INSTALL = $(INSTALL_DATA)
DATA = $(pkgdata_DATA)
@@ -129,6 +135,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
@@ -213,7 +221,7 @@ install-pkgdataDATA: $(pkgdata_DATA)
test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
@list='$(pkgdata_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
+ f=$(am__strip_dir) \
echo " $(pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
$(pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
done
@@ -221,7 +229,7 @@ install-pkgdataDATA: $(pkgdata_DATA)
uninstall-pkgdataDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgdata_DATA)'; for p in $$list; do \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
+ f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
done
@@ -286,7 +294,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
diff --git a/etc/lg.conf.sample.in b/etc/lg.conf.sample.in
index 54e538a..73ff892 100644
--- a/etc/lg.conf.sample.in
+++ b/etc/lg.conf.sample.in
@@ -1,7 +1,7 @@
# configuration file for the looking glass
#
# note: these are perl statements! Mind the syntax. "perl -c lg.conf"
-# should succeed.
+# should succeed.
#
# adjust the path to find [cfj]login, telnet, ssh, rsh, etc.
#
@@ -126,8 +126,8 @@ $queries = {};
#
# Interface queries
$queries->{"interface"} = {
- framerelay => "show frame-relay PVC [DLCI]",
- interface => "show interface [interface]"
+ framerelay => "show frame-relay PVC [DLCI]",
+ interface => "show interface [interface]"
};
#
# Routing queries
diff --git a/etc/rancid.conf.sample.in b/etc/rancid.conf.sample.in
index 8cc1b09..2a51249 100644
--- a/etc/rancid.conf.sample.in
+++ b/etc/rancid.conf.sample.in
@@ -37,6 +37,10 @@ LOGDIR=$BASEDIR/logs; export LOGDIR
# if NOCOMMSTR is set, snmp community strings will be stripped from the configs
#NOCOMMSTR=YES; export NOCOMMSTR
#
+# How many times failed collections are retried (for each run) before
+# giving up. Minimum: 1
+#MAX_ROUNDS=4; export MAX_ROUNDS
+#
# How many hours should pass before complaining about routers that
# can not be reached. The value should be greater than the number
# of hours between your rancid-run cron job.
@@ -65,3 +69,9 @@ OLDTIME=4; export OLDTIME
# included, as this is simply appended to the usual recipients. It is NOT
# appended to recipients specified in rancid-run's -m option.
#MAILDOMAIN="@example.com"; export MAILDOMAIN
+#
+# By default, rancid mail is marked with precedence "bulk". This may be
+# changed by setting the MAILHEADERS variable; for example no header by setting
+# it to "" or adding X- style headers. Individual headers must be separated
+# by a \n.
+#MAILHEADERS="Precedence: bulk"; export MAILHEADERS
diff --git a/include/Makefile.in b/include/Makefile.in
index 1c98cf4..1fca9b6 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.4 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -131,6 +131,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
@@ -233,7 +235,7 @@ TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -z "$$unique" && unique=$$empty_fix; \
+ test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
@@ -311,7 +313,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
diff --git a/include/version.h b/include/version.h
index 91a8cf7..976d99d 100644
--- a/include/version.h
+++ b/include/version.h
@@ -4,6 +4,6 @@
/* pkg version */
char package[] = "rancid";
-char version[] = "2.3.2a";
+char version[] = "2.3.2a2";
#endif
diff --git a/include/version.h.in b/include/version.h.in
index 91a8cf7..976d99d 100644
--- a/include/version.h.in
+++ b/include/version.h.in
@@ -4,6 +4,6 @@
/* pkg version */
char package[] = "rancid";
-char version[] = "2.3.2a";
+char version[] = "2.3.2a2";
#endif
diff --git a/install-sh b/install-sh
index e4160c9..1a83534 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2004-04-01.17
+scriptversion=2005-02-02.21
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -58,9 +58,6 @@ stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
-transformbasename=
-transform_arg=
-instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
@@ -70,23 +67,27 @@ mvcmd="$mvprog"
src=
dst=
dir_arg=
+dstarg=
+no_target_directory=
-usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
- or: $0 -d DIRECTORIES...
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
-In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
-In the second, create the directory path DIR.
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
Options:
--b=TRANSFORMBASENAME
--c copy source (using $cpprog) instead of moving (using $mvprog).
+-c (ignored)
-d create directories instead of installing files.
--g GROUP $chgrp installed files to GROUP.
--m MODE $chmod installed files to MODE.
--o USER $chown installed files to USER.
--s strip installed files (using $stripprog).
--t=TRANSFORM
+-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.
@@ -96,12 +97,7 @@ Environment variables override the default commands:
while test -n "$1"; do
case $1 in
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- -c) instcmd=$cpprog
- shift
+ -c) shift
continue;;
-d) dir_arg=true
@@ -113,7 +109,7 @@ while test -n "$1"; do
shift
continue;;
- --help) echo "$usage"; exit 0;;
+ --help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
shift
@@ -129,14 +125,20 @@ while test -n "$1"; do
shift
continue;;
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
+ -t) dstarg=$2
+ shift
+ shift
+ continue;;
- --version) echo "$0 $scriptversion"; exit 0;;
+ -T) no_target_directory=true
+ shift
+ continue;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
- test -n "$dir_arg" && break
+ # When -t is used, the destination is already specified.
+ test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
@@ -174,13 +176,13 @@ do
src=
if test -d "$dst"; then
- instcmd=:
+ mkdircmd=:
chmodcmd=
else
- instcmd=$mkdirprog
+ mkdircmd=$mkdirprog
fi
else
- # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+ # 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
@@ -202,12 +204,16 @@ do
# 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
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
- dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+ dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
# Make sure that the destination directory exists.
@@ -220,7 +226,8 @@ do
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
- set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ shift
IFS=$oIFS
pathcomp=
@@ -229,51 +236,42 @@ do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
- $mkdirprog "$pathcomp" || lasterr=$?
+ $mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
- test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
+ test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
- $doit $instcmd "$dst" \
+ $doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
- # If we're going to rename the final executable, determine the name now.
- if test -z "$transformarg"; then
- dstfile=`basename "$dst"`
- else
- dstfile=`basename "$dst" $transformbasename \
- | sed $transformarg`$transformbasename
- fi
-
- # don't allow the sed command to completely eliminate the filename.
- test -z "$dstfile" && dstfile=`basename "$dst"`
+ dstfile=`basename "$dst"`
# 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 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
- # Move or copy the file name to the temp name
- $doit $instcmd "$src" "$dsttmp" &&
+ # Copy the file name to the temp name.
+ $doit $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 $instcmd $src $dsttmp" command.
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
@@ -298,7 +296,7 @@ do
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
+ (exit 1); exit 1
}
else
:
@@ -309,12 +307,12 @@ do
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
- fi || { (exit 1); exit; }
+ fi || { (exit 1); exit 1; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
- (exit 0); exit
+ (exit 0); exit 0
}
# Local variables:
diff --git a/man/Makefile.in b/man/Makefile.in
index 82dd0e2..c7415a2 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.4 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -132,6 +132,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
@@ -368,7 +370,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
diff --git a/man/rancid.conf.5.in b/man/rancid.conf.5.in
index b8c01e3..4a86364 100644
--- a/man/rancid.conf.5.in
+++ b/man/rancid.conf.5.in
@@ -1,8 +1,8 @@
.\"
-.\" $Id: rancid.conf.5.in,v 1.11 2004/03/12 23:13:09 heas Exp $
+.\" $Id: rancid.conf.5.in,v 1.14 2005/07/07 01:09:13 heas Exp $
.\"
.hys 50
-.TH "rancid.conf" "5" "12 Mar 2004"
+.TH "rancid.conf" "5" "5 July 2005"
.SH NAME
rancid.conf \- rancid environment configuration file
.SH DESCRIPTION
@@ -123,6 +123,23 @@ For example @MAILPLUS@usfs@example.com, if
had been set to "@example.com".
.\"
.TP
+.B MAILHEADERS
+Define additional mail headers to be added to rancid mail, such as Precedence
+or X- style headers.
+Individual headers must be separated by a \\n (new line).
+.sp
+Default: Precedence: bulk
+.sp
+Example: Precedence: bulk\\nX-clamation: beef cake
+.\"
+.TP
+.B MAX_ROUNDS
+Defines how many times rancid should retry collection of devices that fail.
+The minimum is 1.
+.sp
+Default: 4.
+.\"
+.TP
.B NOCOMMSTR
If set,
.IR rancid (1)
diff --git a/missing b/missing
index e7ef83a..09edd88 100755
--- a/missing
+++ b/missing
@@ -1,9 +1,9 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2003-09-02.23
+scriptversion=2005-02-08.22
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
@@ -60,11 +60,6 @@ case "$1" in
msg="probably too old"
fi
;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
-h|--h|--he|--hel|--help)
echo "\
@@ -92,10 +87,12 @@ Supported PROGRAM values:
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
+ exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
+ exit $?
;;
-*)
@@ -104,12 +101,42 @@ Send bug reports to <bug-automake@gnu.org>."
exit 1
;;
- aclocal*)
+esac
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
fi
+ ;;
+esac
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+ aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
@@ -119,11 +146,6 @@ WARNING: \`$1' is $msg. You should only need it if
;;
autoconf)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
@@ -133,11 +155,6 @@ WARNING: \`$1' is $msg. You should only need it if
;;
autoheader)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
@@ -157,11 +174,6 @@ WARNING: \`$1' is $msg. You should only need it if
;;
automake*)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
@@ -173,11 +185,6 @@ WARNING: \`$1' is $msg. You should only need it if
;;
autom4te)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
@@ -254,11 +261,6 @@ WARNING: \`$1' is $msg. You should only need it if
;;
help2man)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
@@ -279,11 +281,6 @@ WARNING: \`$1' is $msg. You should only need it if
;;
makeinfo)
- if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
- # We have makeinfo, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -291,20 +288,20 @@ WARNING: \`$1' is $msg. You should only need it if
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
- file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
touch $file
;;
tar)
shift
- if test -n "$run"; then
- echo 1>&2 "ERROR: \`tar' requires --run"
- exit 1
- fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
diff --git a/mkinstalldirs b/mkinstalldirs
index 6fbe5e1..5d26a48 100755
--- a/mkinstalldirs
+++ b/mkinstalldirs
@@ -1,7 +1,7 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
-scriptversion=2004-02-15.20
+scriptversion=2005-02-02.21
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
@@ -27,7 +27,7 @@ while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
- exit 0
+ exit $?
;;
-m) # -m PERM arg
shift
@@ -37,7 +37,7 @@ while test $# -gt 0 ; do
;;
--version)
echo "$0 $scriptversion"
- exit 0
+ exit $?
;;
--) # stop option processing
shift
diff --git a/share/Makefile.in b/share/Makefile.in
index 3f10f76..13e51db 100644
--- a/share/Makefile.in
+++ b/share/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.8.4 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -47,12 +47,19 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = rtrfilter
-am__installdirs = "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)"
+am__installdirs = "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)" \
+ "$(DESTDIR)$(pkgdatadir)"
dist_pkgdataSCRIPT_INSTALL = $(INSTALL_SCRIPT)
pkgdataSCRIPT_INSTALL = $(INSTALL_SCRIPT)
SCRIPTS = $(dist_pkgdata_SCRIPTS) $(pkgdata_SCRIPTS)
SOURCES =
DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
dist_pkgdataDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_pkgdata_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -135,6 +142,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
datadir = @datadir@
@@ -256,7 +265,7 @@ install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
@list='$(dist_pkgdata_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
+ f=$(am__strip_dir) \
echo " $(dist_pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
$(dist_pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
done
@@ -264,7 +273,7 @@ install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
uninstall-dist_pkgdataDATA:
@$(NORMAL_UNINSTALL)
@list='$(dist_pkgdata_DATA)'; for p in $$list; do \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
+ f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
done
@@ -329,7 +338,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
diff --git a/share/cisco-load.exp b/share/cisco-load.exp
index 0c28549..995659f 100644
--- a/share/cisco-load.exp
+++ b/share/cisco-load.exp
@@ -1,5 +1,5 @@
##
-## $Id: cisco-load.exp,v 1.10 2004/01/11 03:43:50 heas Exp $
+## $Id: cisco-load.exp,v 1.11 2005/06/14 23:06:26 heas Exp $
##
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
@@ -46,8 +46,8 @@
# prompt cmd-line prompt as determined by clogin
#
# note: the tcl/expect parser is extremely stoopid. comment lines are NOT
-# completely ignored!! so, a '{' or '}' in a comment might produce
-# unexpected results.
+# completely ignored!! so, a '{' or '}' in a comment might produce
+# unexpected results.
##
# log_user 1
# exp_internal 1
@@ -72,11 +72,12 @@ proc logout { ecode } {
send "quit\r"
expect {
- "$prompt" { logout $ecode }
+ "$prompt" { logout $ecode }
timeout { send_error "Error: timeout waiting for EOF after quit\n"}
- eof {
- send_user "\n"
- exit $ecode }
+ eof {
+ send_user "\n"
+ exit $ecode
+ }
}
}
@@ -91,13 +92,15 @@ proc erase { } {
send "write erase\r"
expect {
-re " Continue\[^\n\]\*confirm\]" {
- send "\r"
- exp_continue }
- "$prompt" { }
- timeout {
- send_error "Error: timeout waiting for write erase.\n"
- logout 1 }
- eof { logout 1 }
+ send "\r"
+ exp_continue
+ }
+ "$prompt" { }
+ timeout {
+ send_error "Error: timeout waiting for write erase.\n"
+ logout 1
+ }
+ eof { logout 1 }
}
}
@@ -165,10 +168,10 @@ proc doload { confghost routername config retry } {
send_error "Error: timeout exceeded while loading config\n"
logout 1 }
-re "\[^\n\]*Connection refused" {
- send_error "Error: $expect_out(0,string)\n"
+ send_error "Error: $expect_out(0,string)\n"
logout 1 }
-re "\[^\n\]*Destination unreachable" {
- send_error "Error: $expect_out(0,string)\n"
+ send_error "Error: $expect_out(0,string)\n"
logout 1 }
-re "\[^\n\]*Permission denied" {
send_error "Error: $expect_out(0,string)\n"
@@ -203,9 +206,10 @@ proc doload { confghost routername config retry } {
-re "\[^\n]*Error (opening|copying).*\r" {
send_error "Error: $expect_out(0,string)\n"
logout 1 }
- -nocase -re "\[^\n]* error\[^a-z\n]+\[^\n]*" {
- send_error "$expect_out(0,string)\n"
- logout 1 }
+ -nocase -re "\[^\n]* error\[^a-z\n]+\[^\n]*" {
+ send_error "$expect_out(0,string)\n"
+ logout 1
+ }
"\n" { exp_continue }
-re "^\[^ ]*\#" {
send_user "load successful.\n"
@@ -245,25 +249,25 @@ logout 0
# these were my original transcripts of performing loads. it is a useful
# example of info you may collect to get an idea of what needs to be handled
# in the expect{}s
-#
+#
# pdx-oob#
# pdx-oob#copy rcp start
# Address of remote host [255.255.255.255]? 205.238.52.35
# Name of configuration file [a]? pdx-oob-confg
# Configure using pdx-oob-confg from 205.238.52.35? [confirm]
-#
+#
# Connected to 205.238.52.35
# Loading 8131 byte file pdx-oob-confg: !!!! [OK]
# Compressing configuration from 8131 bytes to 3886 bytes
# [OK]
# pdx-oob#
-#
+#
# 12.0S-isms
# pao2#cop rcp sta
# Address or name of remote host []? eng0
# Translating "eng0"...domain server (205.238.52.46) [OK]
-#
+#
# Source username [pao2]?
# Source filename []? pao2-confg
# Destination filename [startup-config]?
@@ -274,7 +278,7 @@ logout 0
# Accessing rcp://pao2@eng0/pao2-confg...
# Connected to 205.238.52.35
# Loading 30138 byte file pao2-confg: !!!!!! [OK]
-#
+#
# 30138 bytes copied in 2.576 secs (15069 bytes/sec)
# pao2#
# OR IS IT
@@ -292,7 +296,7 @@ logout 0
# Address of remote host [255.255.255.255]? 205.238.52.35
# Name of configuration file [a]? pdx-oob-confg
# Configure using pdx-oob-confg from 205.238.52.35? [confirm]
-#
+#
# Connected to 205.238.52.35
# Loading 8131 byte file pdx-oob-confg: !!!! [OK]
# Compressing configuration from 8131 bytes to 3886 bytes
@@ -301,17 +305,17 @@ logout 0
# Address of remote host [205.238.52.35]? 205.238.52.35
# Name of configuration file [pdx-oob-confg]? pdx-oob-confg
# Configure using pdx-oob-confg from 205.238.52.35? [confirm]
-#
+#
# Connected to 205.238.52.35
# %rcp: /tftpboot/pdx-oob-confg: No such file or directory
# pdx-oob#
-#
+#
# pdx-oob#copy rcp start
# Address of remote host [205.238.52.35]? 205.238.52.35
# Name of configuration file [pdx-oob-confg]? pdx-oob-confg
# Configure using pdx-oob-confg from 205.238.52.35? [confirm]
-#
+#
# Connected to 205.238.52.35
# %rcp: /tftpboot/pdx-oob-confg: Permission denied
# pdx-oob#
@@ -323,9 +327,9 @@ logout 0
# Name of configuration file [pdx-oob-confg]?
# Configure using pdx-oob-confg from 205.238.1.94? [confirm]
# % Destination unreachable; gateway or host down
-#
+#
# pdx-oob#
-#
+#
# *** response from host w/o rcp daemon
# pdx-oob#cop rcp sta
@@ -333,6 +337,6 @@ logout 0
# Name of configuration file [pdx-oob-confg]?
# Configure using pdx-oob-confg from 205.238.1.66? [confirm]
# % Connection refused by remote host
-#
+#
# pdx-oob#
-#
+#
diff --git a/share/cisco-reload.exp b/share/cisco-reload.exp
index 25880c1..22c08a9 100644
--- a/share/cisco-reload.exp
+++ b/share/cisco-reload.exp
@@ -1,5 +1,5 @@
##
-## $Id: cisco-reload.exp,v 1.9 2004/01/11 03:43:50 heas Exp $
+## $Id: cisco-reload.exp,v 1.10 2005/06/14 23:06:27 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -29,14 +29,14 @@
# e.g. usage:
# % clogin -s cisco-reload.exp -Ereload_arg='at 01:00' router
# router
-# Reload scheduled for 01:00:00 UTC Sat Jun 23 2001 (in 7 hours and 16 minutes)
+# Reload scheduled for 01:00:00 UTC Sat Jun 23 2001 (in 7 hours and 16 minutes)
# % clogin -s cisco-reload.exp -Ereload_arg='at cancel' router
# router
-# % Ambiguous command: "reload at cancel"
+# % Ambiguous command: "reload at cancel"
#
# % clogin -s cisco-reload.exp -Ereload_arg='cancel' router
# router
-# SHUTDOWN ABORTED
+# SHUTDOWN ABORTED
#
#
# keep in mind that it is important to NOT polute the global variable space.
@@ -49,8 +49,8 @@
# prompt cmd-line prompt as determined by clogin
#
# note: the tcl/expect parser is extremely stoopid. comment lines are NOT
-# completely ignored!! so, a '{' or '}' in a comment might produce
-# unexpected results.
+# completely ignored!! so, a '{' or '}' in a comment might produce
+# unexpected results.
##
# exp_internal 1
# log_user 1
@@ -68,7 +68,7 @@ if ([info exists Ereload_arg]) {
send "\r"
expect {
- timeout { send_error "Error: did not receive prompt\n"
+ timeout { send_error "Error: did not receive prompt\n"
exit }
-re "^.*$prompt" { send "$reloadcmd\r"
expect * {} }
@@ -133,15 +133,15 @@ expect {
## Proceed with reload? [confirm]
## ultra#reload can
## ultra#
-##
-##
+##
+##
## ***
## *** --- SHUTDOWN ABORTED ---
## ***
## ultra# reload at 8:10 10 dec
-##
+##
## System configuration has been modified. Save? [yes/no]: no
## Reload scheduled for 08:10:00 PST Thu Dec 10 1998 (in 296 hours and 17 minutes)
## Proceed with reload? [confirm]
## ultra#
-##
+##
diff --git a/share/downreport.in b/share/downreport.in
index a05a524..f2fd4c3 100644
--- a/share/downreport.in
+++ b/share/downreport.in
@@ -1,6 +1,6 @@
#! /bin/sh
##
-## $Id: downreport.in,v 1.9 2004/01/11 03:43:50 heas Exp $
+## $Id: downreport.in,v 1.11 2005/07/07 01:09:14 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -40,19 +40,23 @@ elif [ "$LIST_OF_GROUPS" = "" ] ; then
exit 1
fi
+# mail variables
+set | grep MAILHEADERS= > /dev/null 2>&1
+if [ $? -ne 0 ] ; then
+ MAILHEADERS="Precedence: bulk\n"; export MAILHEADERS
+fi
for GROUP in $LIST_OF_GROUPS; do
(
echo "To: @MAILPLUS@admin-$GROUP"
echo "Subject: Down router report - $GROUP"
- echo "Precedence: bulk"
+ echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
echo ""
DIR=$BASEDIR/$GROUP
if [ -s $DIR/routers.down ]; then
(
-
- cat << EOM
-
+ cat << EOM
+
The following $GROUP routers are listed as other than up.
Routers listed as "up" in rancid's router.db are polled several
@@ -61,20 +65,17 @@ not polled.
EOM
- cat $DIR/routers.down;
-
+ cat $DIR/routers.down;
)
-
else
(
+ cat << EOM
- cat << EOM
-
- No routers are down/ticketed for router group $GROUP (yay).
+ No routers are down/ticketed for router group $GROUP (yay).
EOM
- )
+ )
fi
) | sendmail -t
diff --git a/share/lgnotes.html b/share/lgnotes.html
index 3f12357..502a51d 100644
--- a/share/lgnotes.html
+++ b/share/lgnotes.html
@@ -30,7 +30,7 @@ Ed Kern's looking glass (which was http://nitrous.digex.net).
<li>The looking glass will ping a router prior to querying it to avoid
trying to query routers which are down or otherwise inaccessible.</li>
<li>Login failures can be intermittent or permanent, either due to the
- router being inaccessible from the looking glass machine,
+ router being inaccessible from the looking glass machine,
or authorization failure(s). Contact your local network engineering
folks to resolve login failures.</li>
<li>Queries followed by &lt;something&gt; require an argument(s) in the text
diff --git a/share/rtrfilter.in b/share/rtrfilter.in
index 9807e1f..f2caaca 100644
--- a/share/rtrfilter.in
+++ b/share/rtrfilter.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: rtrfilter.in,v 1.13 2004/01/11 03:43:50 heas Exp $
+## $Id: rtrfilter.in,v 1.14 2005/06/14 23:06:27 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -43,7 +43,7 @@
#
# exclusion takes precedence and defaults to nothing. inclusion defaults to
# everything.
-#
+#
# this program requires the Mail::Mailer module which can be found on CPAN.
##
BEGIN {