From 989312339ea2e16579803a48700628c5469e327a Mon Sep 17 00:00:00 2001
From: Tar Committer
Date: Mon, 12 Jan 2004 03:17:26 +0000
Subject: Imported from rancid-2.3.rc1.tar.gz.
---
CHANGES | 161 +-
COPYING | 22 +-
FAQ | 143 +-
Makefile.am | 51 +-
Makefile.in | 637 ++--
README | 132 +-
README.lg | 79 +
Todo | 74 +-
UPGRADING | 85 +
acconfig.h | 78 +
aclocal.m4 | 1080 ++++--
bin/Makefile.am | 103 +-
bin/Makefile.in | 746 ++--
bin/alogin.in | 84 +-
bin/arancid.in | 25 +-
bin/blogin.in | 85 +-
bin/brancid.in | 20 +-
bin/cat5rancid.in | 31 +-
bin/clogin.in | 156 +-
bin/control_rancid.in | 79 +-
bin/create_cvs.in | 89 -
bin/cssrancid.in | 660 ++++
bin/do-diffs.in | 128 -
bin/elogin.in | 44 +-
bin/env.in | 48 -
bin/erancid.in | 23 +-
bin/f10rancid.in | 31 +-
bin/flogin.in | 95 +-
bin/fnrancid.in | 275 ++
bin/francid.in | 25 +-
bin/hlogin.in | 92 +-
bin/hpfilter.c | 397 ---
bin/hpuifilter.c | 400 +++
bin/hrancid.in | 32 +-
bin/htlogin.in | 492 +++
bin/htrancid.in | 266 ++
bin/jerancid.in | 645 ++++
bin/jlogin.in | 50 +-
bin/jrancid.in | 102 +-
bin/lg.cgi.in | 867 +++++
bin/lgform.cgi.in | 259 ++
bin/mrancid.in | 30 +-
bin/nlogin.in | 524 +++
bin/nrancid.in | 302 ++
bin/nslogin.in | 642 ++++
bin/nsrancid.in | 313 ++
bin/par.in | 17 +-
bin/prancid.in | 569 +++
bin/rancid-cvs.in | 94 +
bin/rancid-fe.in | 51 +-
bin/rancid-run.in | 136 +
bin/rancid.in | 445 ++-
bin/rename.in | 113 -
bin/rivlogin.in | 1005 ++++++
bin/rivrancid.in | 344 ++
bin/rrancid.in | 23 +-
bin/tntlogin.in | 528 +++
bin/tntrancid.in | 292 ++
bin/xrancid.in | 64 +-
bin/zrancid.in | 411 +++
cloginrc.sample | 16 +-
configure | 8565 +++++++++++++++++++++++++++++++++------------
configure.in | 122 +-
depcomp | 520 +++
etc/Makefile.am | 77 +
etc/Makefile.in | 375 ++
etc/lg.conf.sample.in | 188 +
etc/rancid.conf.sample.in | 59 +
include/Makefile.am | 24 +-
include/Makefile.in | 411 ++-
include/config.h | 165 +-
include/config.h.in | 143 +-
include/stamp-h.in | 1 -
include/version.h | 2 +-
include/version.h.in | 2 +-
install-sh | 443 ++-
man/Makefile.am | 71 +-
man/Makefile.in | 444 ++-
man/clogin.1 | 59 +-
man/cloginrc.5 | 57 +-
man/control_rancid.1 | 12 +-
man/create_cvs.1 | 54 -
man/cssrancid.1 | 1 +
man/do-diffs.1 | 124 -
man/env.5.in | 189 -
man/fnrancid.1 | 1 +
man/htlogin.1 | 1 +
man/htrancid.1 | 1 +
man/jerancid.1 | 1 +
man/lg.conf.5.in | 45 +-
man/lg_intro.1.in | 2 +-
man/nlogin.1 | 1 +
man/nrancid.1 | 1 +
man/nslogin.1 | 1 +
man/nsrancid.1 | 1 +
man/par.1 | 10 +-
man/prancid.1 | 1 +
man/rancid-cvs.1 | 54 +
man/rancid-run.1 | 124 +
man/rancid.1 | 48 +-
man/rancid.conf.5.in | 224 ++
man/rancid_intro.1 | 52 +-
man/rivlogin.1 | 1 +
man/rivrancid.1 | 1 +
man/router.db.5 | 51 +-
man/tntlogin.1 | 1 +
man/tntrancid.1 | 1 +
man/zrancid.1 | 1 +
missing | 212 +-
mkinstalldirs | 149 +-
share/Makefile.am | 53 +
share/Makefile.in | 401 +++
share/README.misc | 24 +
share/cisco-load.exp | 338 ++
share/cisco-reload.exp | 147 +
share/downreport.in | 81 +
share/getipacctg | 121 +
share/index.html | 12 +
share/lgnotes.html | 61 +
share/rtrfilter.in | 164 +
util/Makefile.in | 37 -
util/README | 9 -
util/cisco-load.exp | 331 --
util/cisco-reload.exp | 141 -
util/configure | 990 ------
util/configure.in | 26 -
util/downreport.in | 62 -
util/getipacctg.in | 103 -
util/lg/Makefile.in | 43 -
util/lg/README | 76 -
util/lg/configure | 991 ------
util/lg/configure.in | 27 -
util/lg/index.html | 9 -
util/lg/lg.cgi.in | 783 -----
util/lg/lg.conf.in | 105 -
util/lg/lgform.cgi.in | 245 --
util/lg/lgnotes.html | 61 -
util/rtrfilter.README | 14 -
util/rtrfilter.in | 158 -
139 files changed, 23753 insertions(+), 9763 deletions(-)
create mode 100644 README.lg
create mode 100644 UPGRADING
create mode 100644 acconfig.h
mode change 100755 => 100644 bin/cat5rancid.in
mode change 100755 => 100644 bin/clogin.in
mode change 100755 => 100644 bin/control_rancid.in
delete mode 100755 bin/create_cvs.in
create mode 100644 bin/cssrancid.in
delete mode 100755 bin/do-diffs.in
mode change 100755 => 100644 bin/elogin.in
delete mode 100644 bin/env.in
mode change 100755 => 100644 bin/erancid.in
mode change 100755 => 100644 bin/f10rancid.in
mode change 100755 => 100644 bin/flogin.in
create mode 100644 bin/fnrancid.in
mode change 100755 => 100644 bin/francid.in
mode change 100755 => 100644 bin/hlogin.in
delete mode 100644 bin/hpfilter.c
create mode 100644 bin/hpuifilter.c
mode change 100755 => 100644 bin/hrancid.in
create mode 100644 bin/htlogin.in
create mode 100644 bin/htrancid.in
create mode 100644 bin/jerancid.in
mode change 100755 => 100644 bin/jlogin.in
mode change 100755 => 100644 bin/jrancid.in
create mode 100644 bin/lg.cgi.in
create mode 100644 bin/lgform.cgi.in
mode change 100755 => 100644 bin/mrancid.in
create mode 100644 bin/nlogin.in
create mode 100644 bin/nrancid.in
create mode 100644 bin/nslogin.in
create mode 100644 bin/nsrancid.in
mode change 100755 => 100644 bin/par.in
create mode 100755 bin/prancid.in
create mode 100644 bin/rancid-cvs.in
mode change 100755 => 100644 bin/rancid-fe.in
create mode 100644 bin/rancid-run.in
mode change 100755 => 100644 bin/rancid.in
delete mode 100755 bin/rename.in
create mode 100644 bin/rivlogin.in
create mode 100644 bin/rivrancid.in
mode change 100755 => 100644 bin/rrancid.in
create mode 100644 bin/tntlogin.in
create mode 100644 bin/tntrancid.in
mode change 100755 => 100644 bin/xrancid.in
create mode 100755 bin/zrancid.in
create mode 100755 depcomp
create mode 100644 etc/Makefile.am
create mode 100644 etc/Makefile.in
create mode 100644 etc/lg.conf.sample.in
create mode 100644 etc/rancid.conf.sample.in
delete mode 100644 include/stamp-h.in
delete mode 100644 man/create_cvs.1
create mode 100644 man/cssrancid.1
delete mode 100644 man/do-diffs.1
delete mode 100644 man/env.5.in
create mode 100644 man/fnrancid.1
create mode 100644 man/htlogin.1
create mode 100644 man/htrancid.1
create mode 100644 man/jerancid.1
create mode 100644 man/nlogin.1
create mode 100644 man/nrancid.1
create mode 100644 man/nslogin.1
create mode 100644 man/nsrancid.1
create mode 100644 man/prancid.1
create mode 100644 man/rancid-cvs.1
create mode 100644 man/rancid-run.1
create mode 100644 man/rancid.conf.5.in
create mode 100644 man/rivlogin.1
create mode 100644 man/rivrancid.1
create mode 100644 man/tntlogin.1
create mode 100644 man/tntrancid.1
create mode 100644 man/zrancid.1
create mode 100644 share/Makefile.am
create mode 100644 share/Makefile.in
create mode 100644 share/README.misc
create mode 100644 share/cisco-load.exp
create mode 100644 share/cisco-reload.exp
create mode 100644 share/downreport.in
create mode 100644 share/getipacctg
create mode 100644 share/index.html
create mode 100644 share/lgnotes.html
create mode 100644 share/rtrfilter.in
delete mode 100644 util/Makefile.in
delete mode 100644 util/README
delete mode 100644 util/cisco-load.exp
delete mode 100644 util/cisco-reload.exp
delete mode 100755 util/configure
delete mode 100644 util/configure.in
delete mode 100755 util/downreport.in
delete mode 100755 util/getipacctg.in
delete mode 100644 util/lg/Makefile.in
delete mode 100644 util/lg/README
delete mode 100755 util/lg/configure
delete mode 100644 util/lg/configure.in
delete mode 100644 util/lg/index.html
delete mode 100755 util/lg/lg.cgi.in
delete mode 100644 util/lg/lg.conf.in
delete mode 100755 util/lg/lgform.cgi.in
delete mode 100644 util/lg/lgnotes.html
delete mode 100644 util/rtrfilter.README
delete mode 100755 util/rtrfilter.in
diff --git a/CHANGES b/CHANGES
index 2795e3f..fb139cf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,156 @@
+2.3.rc1
+ The following files have been moved to make rancid more
+ install/pkg/port/rpm friendly.
+ *** bin/env has been moved to etc/rancid.conf ***
+ *** bin/hpfilter has been renamed hpuifilter ***
+ *** util/lg/lg.conf has been moved to etc/lg.conf ***
+ *** util/lg/lg*.cgi have been moved to bin/lg*cgi ***
+ Note: existing configuration files are *NOT* copied/moved for you
+
+ bin/rename is no longer shipped with rancid
+
+ rancid.conf: add LOGDIR variable - see rancid.conf(5)
+
+ rancid: add show spe version and parse FRU show diag output
+ - from Yuval Ben-Ari.
+
+ add option --enable-adminmail-plus to configure
+
+ jrancid: collect show chassis alarms
+
+ rancid: skip show vlan for (3550|4500|7600) - from Andrew Fort
+
+ rancid: collect 6500 slave sup bootflash - from Andrew Fort
+
+ rancid: show diag updates for 1700, 3700, etc - help from Michael Haba
+
+ The Extreme does not have an 'enable' level, so make sure
+ you have 'set autoenable' for it in your .cloginrc so clogin
+ will work.
+
+ add Cisco CSS support - from Wedge Martin
+
+ *login: add cloginrc sshcmd directive - idea from steve neighorn
+
+ rancid: IOS show version changes w/ 12.3 - from Yuval Ben-Ari
+
+ support for hitachi routers - from Mohacsi Janos
+
+ strip WS around router.db fields - from Alastair Galloway
+
+ add goveling of 2600 mainboard port adapter info
+
+ *login: also check LOGNAME for default username - from Fredrik Thulin
+
+ jerancid: add matches for "Please wait" to all functions -
+ reported by Dave Mack
+
+ fnrancid: Fortigate support - from D. Pfleger
+
+ nlogin: Fix prompt groveling when running a cluster - from D. Pfleger
+
+ nrancid: filter "set admin user" - from D. Pfleger
+
+ rancid: do both 'write term' and 'show running-config' and
+ keep the output from the first one that works. As cisco
+ phases out 'write term', this will keep things working.
+
+ jerancid: filter host ... ftp, encrypted passwords oscillate - reported
+ by Dave Mack.
+
+ rivlogin: add "User:" as a possible username prompt (u_prompt) for
+ some platforms - from Adam Rothschild
+
+ cat 3500 s/n and pix failover license - from Rob Evans
+
+ recognize cisco ContentEngine - from Rob Evans
+
+ Juniper ERX (jerancid) support, based on 5.0 - thanks to Dan Pfleger,
+ Richard Russman, Zaid, Mike Baker, and Mark Nguyen
+
+ rancid: drop the "suggested action" portion of GSR LC/RP ROM upgrade
+ warnings. Cisco keeps changing the format; it just is not worth the
+ aggrevation.
+
+ study causes missed command somehow in redhat9 - from David King
+
+ filter port security mac entries, from Arnold Nipper
+
+ add Procket Networks support, "prancid"
+
+ filter ipsec keys in rancid & jrancid.
+
+ rancid: collect show idprom backplane (6500 cmd); this could collect
+ more - request from jared mauch
+
+ rancid: order all 'ip host' commands.
+
+ rancid: collect show rsp chassis-info
+
+ rancid: filter HSRP auth and SSA key-string reversable passwords
+
+ lg: set query/command list in lg.conf, thus allowing individual cmds
+ to {dis,en}abled, and add some multicast and ipv6 queries all of which
+ are disabled by default (for lack of testing) - from Janos Mohacsi
+
+ cat5rancid: collect 'write term all' for cats that support it - tested
+ by terry kennedy and joe rizzo
+
+ cat5rancid: regularize escaping of regex operators in switch prompt
+
+ nsrancid: include "get log setting", as suggested by gael canal.
+
+ add manpage note about log_user with -s, from mail list discussion
+
+ xrancid: Handle end of ssh connection a bit better.
+
+ jrancid: skip master/backup re msgs
+
+ *rancid: escape regex chars found in prompt
+
+ xrancid: also collect 'show configuration detail'
+
+ hlogin: allow the port to be specified for method ssh and
+ add path to hlogin to env(PATH) for locating hpfilter
+
+ hpfilter: allow >2 arguments so that telnet port number can be passed.
+
+ rancid: gsr RP slot warning is only 1 line - Russell Heilling
+
+ add zrancid to handle zebra routing s/w
+
+ add riverstone support - from Jim Meehan. thanks to Hong Luo for
+ access to a riverstone to test. Kevin Chan reports that this works
+ for Cabletron routers with more recent s/w (~v9.0.3).
+
+ jrancid: fix handling of reversible keys such that trailing text is
+ not removed
+
+ rancid: slave/redundancy stuff - from stephen griffin
+
+ rancid: show version bootstrap format changed in 12.0(23)S
+
+ rancid: make sure we filter PIX pager prompts
+
+ xrancid: make xrancid work when the extreme has pending changes.
+
+ netscaler support - from Anshuman Kanwar.
+
+ netscreen firewall support - from Stephen Gill
+
+ rancid: include additional cpu info from show version in !CPU: line.
+
+ lucent tnt support - from Richard Vander Reyden
+
+ rancid: skip consecutive comment lines. on some access servers the
+ number of comment lines oscillate.
+
+ lg.conf: add LG_STYLE variable for style sheet - from Janos Mohacsi
+
+ also install the FAQ - good idea from Janos Mohacsi's freshport
+
+ rancid: filter 'cable shared-secret'
+
2.2.2
*login: fix handling of userprompt et al so that {}'s are used in
.cloginrc as they are with every other .cloginrc directive.
@@ -77,7 +230,7 @@
alogin: misplaced brace caused improper return from proc login
relax the check ping and traceroute check of hostname arguments such
- that non-fqdn hosts are allowed. ie: just check that arg chars are
+ that non-fqdn hosts are allowed. i.e.: just check that arg chars are
valid dns chars and leave the resolve errors to the router.
Add initial support for Force10.
@@ -217,9 +370,9 @@
can be used within configuration mode. note: this turns $prompt into
a regexp, WRT -s scripts and -re option for expect's.
- add -Evar=x option to pass variables to scripts. eg:
+ add -Evar=x option to pass variables to scripts. e.g.:
clogin -Evariable=something router...
- clogin -Evariable=a,b,c [ie: an array/list which user splits]
+ clogin -Evariable=a,b,c [i.e.: an array/list which user splits]
2.2b2
fix jlogin's password/userpassword functionality which broke when
@@ -277,7 +430,7 @@
add man pages
- collect 'sh vlan' on cat 6000 - afort@staff.webcentral.com.au
+ collect 'sh vlan' on cat 6000 - afort@choqolat.org
Add 'show vtp status' for the 3500XLs as well.
diff --git a/COPYING b/COPYING
index 639e792..888b207 100644
--- a/COPYING
+++ b/COPYING
@@ -1,18 +1,22 @@
##
-## Copyright (C) 1997-2001 by Henry Kilmer, Erik Sherk and Pete Whiting.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
-
-# bin/rename - is from CPAN by lwall.
-# util/lg - the original looking glass is by Ed Kern, provided by
-# permission and modified beyond recognition of the original
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+##
+#
+# The login expect scripts were based on Erik Sherk's gwtn, by permission.
+#
+# bin/lg - the original looking glass software was written by Ed Kern,
+# provided by permission and modified beyond recognition.
diff --git a/FAQ b/FAQ
index 7cda952..210700e 100644
--- a/FAQ
+++ b/FAQ
@@ -1,20 +1,65 @@
-Frequently Asked Questions about rancid - last updated 20011121.
+Frequently Asked Questions about rancid - last updated 20040107.
+
+This FAQ contains information that may not apply directly to versions of
+rancid prior to 2.3. It also contains paths containing tags such as
+, which refer to paths that are site-specific and are determined
+by how rancid is or was configured at installation time. These are explained
+briefly in the configure --help output. Below are the defaults used in
+rancid.
+
+ PREFIX configure --prefix= option. default: /usr/local/rancid
+ EPREFIX configure --exec-prefix= option. default:
+ BINDIR configure --bindir= option. default: /bin
+ The location of clogin, etc.
+ SYSCONFDIR configure --sysconfdir option. default: /etc
+ The location of rancid.conf, etc.
+ LOCALSTATEDIR configure --localstatedir option. default: /var
+ The location of the CVS repository, log files, etc.
1) Platform specific
Q. I have a Cisco Catalyst 6500 series switch running the IOS (NOT catOS)
software, is the router.db device type cisco or cat5?
-A. A catalyst running IOS is type "cisco". See the router.db(5) manual page.
+A. A catalyst running IOS is type "cisco". The 'show version' output will
+ have banner including a phrase similar to "Cisco Internetwork Operating
+ System Software". See the router.db(5) manual page.
+
+Q. I have Hybrid Cisco switch, like a cat5k with an RSM. How do I collect
+ both the routing engine and switch configurations?
+A. Recommended way is to use two entries in the router.db, one for each.
+ For example:
+ cat5k_rsm.domain.com:cisco:up
+ cat5k_sw.domain.com:cat5:up
Q. I have a Cisco ??? on which collection stopped working, but clogin works
as expected.
A. Check if 'write term' produces output. Some IOS combined with large
configs and low free memory produce zero 'write term' output, esp. combined
- with a memory leak. The device will have to be rebooted or upgraded.
+ with a memory leak. The device will have to be rebooted and/or upgraded.
+
+Q. I have a Cisco Catalyst switch. clogin connects, but after receiving the
+ prompt, it stalls until it times out. Why?
+A. This may be due to your prompt. CatOS does not include an implicit '>' in
+ it's prompt, like IOS does. clogin looks for '>' during login, so specify
+ your prompt with a trailing '>'. Also see cat5rancid(1). For example:
+ cat5k>
+ cat5k> enable
+ Password:
+ cat5k> (enable)
+
+Q. Polling a ZebOS box fails from cron, but is successful from the command-
+ line.
+A. This is the tty/pty handling of either your O/S or ZebOS. Supposedly,
+ changing the TERM in /rancid.conf to the following seems to
+ fix it.
+ TERM=vt100;export TERM
+ COLUMNS=160; LINES=48; export COLUMNS LINES
2) CVS and filesystem permissions
+ WARNING: Be careful when mucking around with the repository!
+
Q. I am new to CVS, where can I find additional information?
A. The manual page for CVS is quite complete, but can be be overwhelming even
for someone familiar with RCS. There are some excellent resources on the
@@ -23,31 +68,31 @@ A. The manual page for CVS is quite complete, but can be be overwhelming even
Q. Errors are showing up in the logs like:
cvs [diff aborted]: there is no version here; run 'cvs checkout' first
A. The directory was not imported into CVS properly or was not properly checked
- out afterward, so CVS control files or directories do not exist. create_cvs
+ out afterward, so CVS control files or directories do not exist. rancid-cvs
should always be used to create the directories and perform the CVS work.
If it is just the directories that have been created manually, save a copy of
- the router.db file, then remove the group's directory, use create_cvs, and
+ the router.db file, then remove the group's directory, use rancid-cvs, and
replace the router.db file. If the CVS import was also performed manually,
- cd to and use 'cvs co ' to create all the CVS
+ cd to and use 'cvs co ' to create all the CVS
control bits.
Q. I keep receiving the same diff for a (or set of) devices, but I know the
data is not changing repeatedly. Why?
-A. This is most likely either a CVS or filesystem permissions problem. Check
- the log file from the last run for that group first; it may provide the
+A. This is probably a CVS or filesystem permissions problem. Check the log
+ file from the last run for that group for clues first; it may provide the
exact cause.
Note: It is very important the following be done as the user who normally
runs the rancid collection from cron.
- Check the cvs status of the device's file. eg:
+ Check the cvs status of the device's file. example:
guelah [2704] cvs status rtr.shrubbery.net
===================================================================
File: yogi.shrubbery.net Status: Up-to-date
Working revision: 1.197 Tue Jul 10 15:41:16 2001
- Repository revision: 1.197 /user/local/rancid/CVS/shrubbery/configs/rtr.shrubbery.net,v
+ Repository revision: 1.197 /usr/local/rancid/var/CVS/shrubbery/configs/rtr.shrubbery.net,v
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)
@@ -55,19 +100,20 @@ A. This is most likely either a CVS or filesystem permissions problem. Check
The Status: should be Up-to-date. If the status is "Unknown", then somehow
the file has been created without being cvs add'ed. This should be
corrected by removing that device's entry from the group's router.db file,
- run do-diffs, replace the entry in router.db, and run do-diffs again.
+ run rancid-run, replace the entry in router.db, and run rancid-run again.
If the Status is anything else, someone has most likely been touching the
files manually. Sane state can be achieved by removing the file and running
cvs update to get a fresh copy from the repository.
Check the ownership and permissions of the file and directory and the
- directory and file in the cvs repository (/usr/local/rancid/CVS/). They
- should be owned by the user who runs do-diffs from cron. At the very least,
- the directory and files should be writable by the rancid user. Group and
- world permissions will determined by the umask (default 027), which is set
- in /usr/local/rancid/bin/env. Likely the easiest way to fix the ownership
- on the cvs repository is chown -R /usr/local/rancid/CVS
+ directory and file in the cvs repository (/CVS/). They
+ should be owned by the user who runs rancid-run from cron. At the very
+ least, the directory and files should be writable by the rancid user. Group
+ and world permissions will determined by the umask (default 027), which is
+ set in /rancid.conf. Likely the easiest way to fix the
+ ownership on the cvs repository is
+ chown -R /CVS /
Q. I am renaming a device but would like the retain the history in CVS. How
is this done?
@@ -75,11 +121,11 @@ A. CVS does not provide a way (AFAIK) to rename files or to rename or delete
directories. The best way is to copy the CVS repository file manually
like this (disclaimer: BE VERY CAREFUL mucking around with the repository):
% su - rancid_user
- % cd /usr/local/rancid
+ % cd
% echo "new_device_name:device_type:up" >> GROUP/router.db
% cp -p CVS/GROUP/configs/old_device_name,v \
CVS/GROUP/configs/new_device_name,v
- where GROUP is the name of the rancid group the device is a member of.
+ where GROUP is the name of the rancid group that the device is a member of.
Rancid will pick-up the new file with a CVS update the next time it runs.
Once the renaming is complete, remove the old name from the router.db file
and leave the CVS clean-up of the old filename to rancid.
@@ -88,13 +134,23 @@ A. CVS does not provide a way (AFAIK) to rename files or to rename or delete
history, the same procedure would work. Substituting the new group name
appropriately.
+Q. I am removing a group and would like to remove all traces of it from the
+ rancid directory and the CVS repository. How is this done?
+A. As far as I know, CVS does not provide a way to remove directories. First,
+ remove the group from /rancid.conf. If rancid is running,
+ wait for it to complete. Then just recursively remove the
+ directory. For example, a group named "fubar":
+ % su - rancid_user
+ % cd
+ % rm -rf fubar CVS/fubar
+
3) General
Q. I have a (set of) device(s) on which collection fails. How can I debug
this?
A. Our usual diagnostic procedure for this is:
- - Make sure that the appropriate *login (eg: clogin for cisco) works.
+ - Make sure that the appropriate *login (example: clogin for cisco) works.
This tests to make sure you don't have routing or firewall issues, DNS
or hostname errors, that your .cloginrc is correct, your banner does
not have some character that *login does not like, and that the *login
@@ -103,7 +159,7 @@ A. Our usual diagnostic procedure for this is:
clogin cisco_router
Should login to cisco_router and produce a router prompt that you can
- use normally, as if clogin were not used (ie: telnet cisco_router).
+ use normally, as if clogin were not used (i.e.: telnet cisco_router).
- See if commands can be executed on the router via clogin. This will
exercise the *login functionality needed for rancid. For example:
@@ -129,8 +185,8 @@ A. Our usual diagnostic procedure for this is:
router.db file is correct and check the group's last log file for errors.
Q. Are there any characters in the banner that rancid has problems with OR
- I changed the device's command prompt?
-A. The trickest part about clogin (et al) is recognizing the prompt
+ I changed the device's command prompt and now collection is failing?
+A. The trickiest part about clogin (et al) is recognizing the prompt
correctly. clogin looks for '>' and '#' to figure out if it is logged
in or in enable mode. So if you have a '>' or '#' in your login banner
(other other motd), then clogin gets all confused and will not be
@@ -138,8 +194,49 @@ A. The trickest part about clogin (et al) is recognizing the prompt
Don't use '>' or '#' in your prompt or in your banner or other motd.
+Q. I use /*login -c to run commands on multiple boxes. Sometimes
+ these are commands that take secondary input, like a filename. How can
+ enter the data for that secondary prompt?
+A. Two methods will work. Write an expect script to be used with clogin's
+ -s option, for which a few examples come with rancid like cisco-load.exp.
+ OR provide all the input in one command with the -c option like so:
+ Router#clear counters
+ Clear "show interface" counters on all interfaces [confirm]
+ Router#
+
+ clogin -c 'clear counters\n'
+ The specific return (\n) will be entered after 'clear counters' followed
+ by the normal return after the command.
+
+Q. I would like to collect device configurations every hour, but only receive
+ diffs every Nth collection or every N hours. Is this possible?
+A. Certainly, but rancid does not provide such a mechanism natively. Two
+ approaches are recommended:
+
+ 1) Using your preferred mail-list software, add a list with a digest
+ and configure your MTA (example: sendmail) to send diffs to the
+ list. Configure the mail-list software to force the digest at the
+ interval desired. This allows folks to choose which type they
+ prefer, after each collection or every N hours.
+
+ This method also provides easy methods to archive the diff mail and
+ retrieve previous diffs.
+
+ 2) Write a script to send diffs, which saves the time it last ran
+ and passes this to the -D option of CVS.
+
+ Obviously, the first option is the cleanest and most featureful, which is
+ why the script mention in the second option is not provided.
+
Q. I'm still stuck on this problem. Where can I get more help?
A. A discussion list is available, rancid-discuss@shrubbery.net. You must
be a subscriber to post. Subscribe like this:
shell% echo "subscribe" | mail rancid-discuss-request@shrubbery.net
+
+Q. What else can I do with rancid?
+A. The possibilities are endless...rancid is non-toxic when applied properly.
+ see Joe Abley and Stephen Stuart's NANOG presentation:
+ http://www.nanog.org/mtg-0210/abley.html
+ or our NANOG presentation:
+ http://www.shrubbery.net/rancid/NANOG29/
diff --git a/Makefile.am b/Makefile.am
index 6ad5316..df32f4f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,28 +1,41 @@
## Process this file with automake to produce Makefile.in
+## A Makefile.in is supplied, in case you do not have automake.
+
+## $Id: Makefile.am,v 1.19 2004/01/10 22:47:29 heas Exp $
+##
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
+## All rights reserved.
+##
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
+##
+## There is no warranty or other guarantee of fitness of this software.
+## It is provided solely "as is". The author(s) disclaim(s) all
+## responsibility and liability with respect to this software's usage
+## or its effect upon hardware, computer systems, other software, or
+## anything else.
+##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, and Pete Whiting.
+##
AUTOMAKE_OPTIONS=foreign no-dependencies
@SET_MAKE@
-EXTRA_DIST = BUGS CHANGES COPYING FAQ README Todo cloginrc.sample configure \
- install-sh \
- mkinstalldirs Makefile.in Todo
+pkgdata_DATA = COPYING CHANGES FAQ README README.lg UPGRADING cloginrc.sample
+EXTRA_DIST = BUGS Todo configure install-sh \
+ mkinstalldirs Makefile.in Todo $(pkgdata_DATA)
#DIST_COMMON =
# '.' is here (and at the beginnging of the macro) so that distclean-recursive
-# will run make distclean in . after the other dirs (preserving Makefile)
-SUBDIRS = . include bin man util
-
-all:
-
-# install-exec-local:
-# $(mkinstalldirs) $(prefix) $(prefix)/bin $(prefix)/man $(prefix)/util $(prefix)/util/lg
-
-install-exec-local:
- $(mkinstalldirs) $(prefix)/util $(prefix)/util/lg
-
-install:
- for file in CHANGES README cloginrc.sample ; do \
- $(INSTALL_DATA) $$file $(prefix); \
- done
-
+# will run make distclean in . after the other dirs (preserving Makefile) and
+# mkinstalldirs will create the install destination before descending into
+# the subdirs.
+SUBDIRS = . include etc bin man share
+
+# sysconfdir is here because etc/Makefile uses a script to be careful about
+# installing rancid.conf, not over-writing an existing one.
+install-data-hook:
+ $(mkinstalldirs) $(prefix) $(localstatedir) $(sysconfdir);
diff --git a/Makefile.in b/Makefile.in
index 52e2caa..2c7c59e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,8 @@
-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+# Makefile.in generated by automake 1.8 from Makefile.am.
+# @configure_input@
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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.
@@ -10,127 +12,231 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-
-SHELL = @SHELL@
+@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
-
top_builddir = .
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/configure COPYING \
+ acconfig.h configure configure.in depcomp install-sh missing \
+ mkinstalldirs
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+depcomp =
+am__depfiles_maybe =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+am__installdirs = $(DESTDIR)$(pkgdatadir)
+pkgdataDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(pkgdata_DATA)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+ADMINMAILPLUS = @ADMINMAILPLUS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
COMM = @COMM@
CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
CVS = @CVS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
DIFF = @DIFF@
DIFF_CMD = @DIFF_CMD@
DIRNAME = @DIRNAME@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
ENV_PATH = @ENV_PATH@
+EXEEXT = @EXEEXT@
EXPECT_PATH = @EXPECT_PATH@
FIND = @FIND@
GREP = @GREP@
ID = @ID@
-INST_PROGS = @INST_PROGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
LG_PING_CMD = @LG_PING_CMD@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
MAILPLUS = @MAILPLUS@
-MAINT = @MAINT@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
PERLV = @PERLV@
PERLV_PATH = @PERLV_PATH@
PING_PATH = @PING_PATH@
-RD_BIN_DATAS = @RD_BIN_DATAS@
-RD_BIN_PROGS = @RD_BIN_PROGS@
-RD_UTIL_LG_PROGS = @RD_UTIL_LG_PROGS@
-RD_UTIL_PROGS = @RD_UTIL_PROGS@
RSH = @RSH@
SENDMAIL = @SENDMAIL@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
SORT = @SORT@
SSH = @SSH@
+STRIP = @STRIP@
TAR = @TAR@
TELNET = @TELNET@
TOUCH = @TOUCH@
U = @U@
VERSION = @VERSION@
-
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
AUTOMAKE_OPTIONS = foreign no-dependencies
-
-EXTRA_DIST = BUGS CHANGES COPYING FAQ README Todo cloginrc.sample configure install-sh mkinstalldirs Makefile.in Todo
+pkgdata_DATA = COPYING CHANGES FAQ README README.lg UPGRADING cloginrc.sample
+EXTRA_DIST = BUGS Todo configure install-sh \
+ mkinstalldirs Makefile.in Todo $(pkgdata_DATA)
#DIST_COMMON =
# '.' is here (and at the beginnging of the macro) so that distclean-recursive
-# will run make distclean in . after the other dirs (preserving Makefile)
-SUBDIRS = . include bin man util
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = ./include/config.h
-CONFIG_CLEAN_FILES =
-DIST_COMMON = README COPYING Makefile.am Makefile.in acinclude.m4 \
-aclocal.m4 configure configure.in install-sh missing mkinstalldirs
-
+# will run make distclean in . after the other dirs (preserving Makefile) and
+# mkinstalldirs will create the install destination before descending into
+# the subdirs.
+SUBDIRS = . include etc bin man share
+all: all-recursive
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-GZIP_ENV = --best
-all: all-redirect
.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
- cd $(srcdir) && $(ACLOCAL)
-
-config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+ cd $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
-$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+
+$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+uninstall-info-am:
+install-pkgdataDATA: $(pkgdata_DATA)
+ @$(NORMAL_INSTALL)
+ $(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|^.*/||'`"; \
+ echo " $(pkgdataDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f"; \
+ $(pkgdataDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f; \
+ done
+
+uninstall-pkgdataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgdata_DATA)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \
+ rm -f $(DESTDIR)$(pkgdatadir)/$$f; \
+ done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -138,13 +244,8 @@ $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4)
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
-
-@SET_MAKE@
-
-all-recursive install-data-recursive install-exec-recursive \
-installdirs-recursive install-recursive uninstall-recursive \
-check-recursive installcheck-recursive info-recursive dvi-recursive:
- @set fnord $(MAKEFLAGS); amf=$$2; \
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -164,13 +265,18 @@ check-recursive installcheck-recursive info-recursive dvi-recursive:
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @set fnord $(MAKEFLAGS); amf=$$2; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
- rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
- rev="$$subdir $$rev"; \
- test "$$subdir" != "." || dot_seen=yes; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
done; \
- test "$$dot_seen" = "no" && rev=". $$rev"; \
+ rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
@@ -186,178 +292,313 @@ tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
tags: TAGS
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
+ if (etags --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ else \
+ include_option=--include; \
+ fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
- fi; \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
done; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
-clean-tags:
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-distdir = $(PACKAGE)-$(VERSION)
-top_distdir = $(distdir)
-
-# This target untars the dist file and tries a VPATH configuration. Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
- -rm -rf $(distdir)
- GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
- mkdir $(distdir)/=build
- mkdir $(distdir)/=inst
- dc_install_base=`cd $(distdir)/=inst && pwd`; \
- cd $(distdir)/=build \
- && ../configure --srcdir=.. --prefix=$$dc_install_base \
- && $(MAKE) $(AM_MAKEFLAGS) \
- && $(MAKE) $(AM_MAKEFLAGS) dvi \
- && $(MAKE) $(AM_MAKEFLAGS) check \
- && $(MAKE) $(AM_MAKEFLAGS) install \
- && $(MAKE) $(AM_MAKEFLAGS) installcheck \
- && $(MAKE) $(AM_MAKEFLAGS) dist
- -rm -rf $(distdir)
- @banner="$(distdir).tar.gz is ready for distribution"; \
- dashes=`echo "$$banner" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- echo "$$dashes"
-dist: distdir
- -chmod -R a+r $(distdir)
- GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
- -rm -rf $(distdir)
-dist-all: distdir
- -chmod -R a+r $(distdir)
- GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
- -rm -rf $(distdir)
distdir: $(DISTFILES)
- -rm -rf $(distdir)
+ $(am__remove_distdir)
mkdir $(distdir)
- -chmod 777 $(distdir)
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
+ $(mkdir_p) $(distdir)/bin $(distdir)/include $(distdir)/share
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
fi; \
done
- for subdir in $(SUBDIRS); do \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test -d $(distdir)/$$subdir \
- || mkdir $(distdir)/$$subdir \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
|| exit 1; \
- chmod 777 $(distdir)/$$subdir; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
+ distdir) \
|| exit 1; \
fi; \
done
-info-am:
-info: info-recursive
-dvi-am:
-dvi: dvi-recursive
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -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
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && $(mkdir_p) "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
check-am: all-am
check: check-recursive
-installcheck-am:
-installcheck: installcheck-recursive
-install-exec-am: install-exec-local
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ $(mkdir_p) $(DESTDIR)$(pkgdatadir)
+install: install-recursive
install-exec: install-exec-recursive
-
-install-data-am:
install-data: install-data-recursive
+uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-recursive
-uninstall-am:
-uninstall: uninstall-recursive
-all-am: Makefile
-all-redirect: all-recursive
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs: installdirs-recursive
-installdirs-am:
-
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
-mostlyclean-am: mostlyclean-tags mostlyclean-generic
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
-mostlyclean: mostlyclean-recursive
+clean-am: clean-generic mostlyclean-am
-clean-am: clean-tags clean-generic mostlyclean-am
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
-clean: clean-recursive
+dvi: dvi-recursive
-distclean-am: distclean-tags distclean-generic clean-am
+dvi-am:
-distclean: distclean-recursive
- -rm -f config.status
+html: html-recursive
-maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
- distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
+info: info-recursive
+
+info-am:
+
+install-data-am: install-pkgdataDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
maintainer-clean: maintainer-clean-recursive
- -rm -f config.status
-
-.PHONY: install-data-recursive uninstall-data-recursive \
-install-exec-recursive uninstall-exec-recursive installdirs-recursive \
-uninstalldirs-recursive all-recursive check-recursive \
-installcheck-recursive info-recursive dvi-recursive \
-mostlyclean-recursive distclean-recursive clean-recursive \
-maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
-dvi-am dvi check check-am installcheck-am installcheck \
-install-exec-local install-exec-am install-exec install-data-am \
-install-data install-am install uninstall-am uninstall all-redirect \
-all-am all installdirs-am installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+mostlyclean: mostlyclean-recursive
-@SET_MAKE@
+mostlyclean-am: mostlyclean-generic
-all:
+pdf: pdf-recursive
-# install-exec-local:
-# $(mkinstalldirs) $(prefix) $(prefix)/bin $(prefix)/man $(prefix)/util $(prefix)/util/lg
+pdf-am:
-install-exec-local:
- $(mkinstalldirs) $(prefix)/util $(prefix)/util/lg
+ps: ps-recursive
-install:
- for file in CHANGES README cloginrc.sample ; do \
- $(INSTALL_DATA) $$file $(prefix); \
- done
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-pkgdataDATA
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-generic clean-recursive ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
+ 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
+
+
+@SET_MAKE@
+# sysconfdir is here because etc/Makefile uses a script to be careful about
+# installing rancid.conf, not over-writing an existing one.
+install-data-hook:
+ $(mkinstalldirs) $(prefix) $(localstatedir) $(sysconfdir);
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/README b/README
index cce631c..3fd7fe7 100644
--- a/README
+++ b/README
@@ -1,14 +1,26 @@
Rancid is a "Really Awesome New Cisco confIg Differ" developed to
maintain CVS controlled copies of router configs.
+*** The Following Information is Very Important ****
+Rancid 2.3 introduces a new directory layout. It has been changed to more
+closely follow the standard path hierarchy, which is defined by the FHS
+standard and autoconf, and/or make these locations more easily configurable
+within rancid.
+
+The obvious advantage of this is making rancid more easily packagable; i.e.:
+NetBSD pkgsrc, FreeBSD port, Linux RPM, etc.
+
+Please please please please read the UPGRADING file for more information.
+**********
+
The following is the packing list for Rancid. .in is stripped from
the files below by configure with substitutions completed:
README This file.
CHANGES List of changes to Rancid.
-Todo partial list of what needs to be done.
-env.in Environment settings needed.
-do-diffs.in Script designed to be run from cron calling control_rancid.
+Todo Partial list of what needs to be done.
+rancid.conf.in Environment settings needed.
+rancid-run.in Script designed to be run from cron calling control_rancid.
control_rancid.in
Builds router list, calls rancid on each router and
handles cvs routines.
@@ -21,6 +33,7 @@ francid.in Runs commands on foundry switches and processes the output.
hrancid.in Runs commands on hp procurve switches and processes the output.
jrancid.in Runs commands on juniper routers and processes the output.
mrancid.in Runs commands on MRT daemons and processes the output.
+nrancid.in Runs commands on netscreen routers and processes the output.
rrancid.in Runs commands on redback routers and processes the output.
xrancid.in Runs commands on extreme switches and processes the output.
cat5rancid.in Runs commands on cisco Cat switches and processes the output.
@@ -43,12 +56,13 @@ jlogin.in Expect script that logs into juniper routers similarly to
.cloginrc TCL commands to set passwords, usernames etc. used by clogin
and jlogin.
par.in Parallel processing of commands - any commands.
-rename.in Perl script to rename files.
-create_cvs.in Creates all of the CVS and config directories.
-hpfilter.c HP procurve login filter - see end of hlogin(1).
+rancid-cvs.in Creates all of the CVS and config directories.
+hpuifilter.c HP procurve login filter - see end of hlogin(1).
+etc/ Configuration file samples
+etc/lg.conf.sample
+etc/rancid.conf.sample
man/ man pages
-util/ utilities / contribs
-util/lg looking glass
+share/ Readmes, samples, utilities, contribs, etc
The following are included as part of the installation tools:
@@ -58,41 +72,53 @@ install-sh GNU autoconf shell script to simulate BSD style install
mkinstalldirs GNU autoconf shell script to make installation directories
rancid will also need to have the following packages:
-cvs code revision system available from prep.ai.mit.edu:/pub/gnu
-gnudiff gnudiff provides the uni-diff (-u) option. if you do not have
- gnudiff, configure will set-up rancid to use 'diff -c' or
- 'diff -C'.
+cvs Code revision system available from prep.ai.mit.edu:/pub/gnu
+gnudiff gnudiff provides the uni-diff (-u) option. If you do not have
+ a diff that supports -u, configure will set-up rancid to use
+ 'diff -c' or 'diff -C'.
perl5 perl version 5 or greater available from www.cpan.org
-expect http://expect.nist.gov/ we highly suggest that you stick to
- expect 5.24.1 (or so). this seems to work best. note that
- you have to have the accompanying tcl &/ tk.
-tcl required by expect.
+expect http://expect.nist.gov/ We highly suggest that you stick to
+ expect 5.24.1 (or so). This seems to work best. Note that
+ you need to have the accompanying tcl &/ tk.
+tcl Required by expect.
-Bill Fenner has a cgi script for interacting with CVS repositories via
-a web interface. This provides a great way to view rancid diffs and
-full configs, especially for those unfamiliar with cvs. The package is
-not included, but can be found here:
+Bill Fenner (now maintained by others) has a cgi script for interacting
+with CVS repositories via a web interface. This provides a great way to
+view rancid diffs and full configs, especially for those unfamiliar with
+cvs. The package is not included, but can be found here:
- http://www.freebsd.org/~fenner/cvsweb/cvsweb-1.0.tar.gz
+ http://www.freebsd.org/projects/cvsweb.html
Quick Installation Guide (an example):
1) ./configure [--prefix=]
- By default, All rancid crud will be installed under /usr/local/rancid.
- This can be overridden with the --prefix option. E.g.:
+ By default, rancid will be installed under /usr/local/rancid (the default
+ "prefix"). This can be overridden with the --prefix option. E.g.:
./configure --prefix=/home/rancid
- see ./configure --help for other configure options.
+ Rancid uses autoconf's "localstatedir" as the location of it's logs,
+ CVS respository, and directories where it's groups are placed. The user
+ who will run rancid (from cron, etc) will need write access to these
+ directories. By default, this is /var, or /home/rancid/var
+ following the example above.
+
+ We realize that this is not optimal, but it follows the standards. We
+ suggest that this be altered to include the package name, like so:
- The user who will run rancid must have write permission in this
- directory.
+ ./configure --prefix=/home/rancid \
+ --localstatedir=/home/rancid/var/rancid
+
+ The user who will run rancid must have write permission in "localstatedir".
+
+ See ./configure --help for other configure options.
2) make install
-3) Modify /bin/env. The variable LIST_OF_GROUPS is a
- space delimited list of router "groups". E.g.:
+3) Modify /rancid.conf (e.g.: /etc/rancid.conf). The
+ variable LIST_OF_GROUPS is a space delimited list of router "groups".
+ E.g.:
LIST_OF_GROUPS="backbone aggregation switches"
4) Put .cloginrc in the home directory of the user who will run rancid.
@@ -106,9 +132,9 @@ Quick Installation Guide (an example):
Note: the juniper user you use *must* log into a cli shell (which
is the default on a juniper).
- See the file cloginrc.sample, located in , for examples and
- good starting point. Also take a look at the cloginrc manual page,
- 'man -M /man cloginrc'.
+ See the file cloginrc.sample, located in (/share/rancid),
+ for examples and good starting point. Also take a look at the cloginrc
+ manual page, 'man -M /man cloginrc'.
6) Modify /etc/aliases
Rancid sends the diffs and other administrative emails to rancid-
@@ -127,24 +153,28 @@ Quick Installation Guide (an example):
addresses mentioned above to "rancid+". See sendmail's operation manual
for more information on handling of '+'.
-7) Run create_cvs.
+ The --enable-adminmail-plus configure option will set each of the
+ "rancid-admin-" addresses mentioned above to "rancid-admin+". If this
+ option is not used, the value of --enable-mail-plus is assumed. That is,
+ the addresses will be "rancid+", if it is specified.
+
+7) Run rancid-cvs.
This creates all of the necessary directories and config files for
each of the groups in LIST_OF_GROUPS and imports them into CVS. This
will also be run each time a new group is added. Do not create the
- directories or CVS repository manually, allow create_cvs do it. Also see
- 'man -M /man create_cvs'.
+ directories or CVS repository manually, allow rancid-cvs do it. Also see
+ 'man -M /man rancid-cvs'.
8) For each "group", modify the router.db file in the group directory.
The file is of the form "router:mfg:state" where "router" is
the name (we use FQDN) of the router, mfg is the manufacturer
- from the set of
- (alteon|baynet|cat5|cisco|extreme|ezt3|force10|foundry|hp|juniper|redback),
- and "state" is either up or down. Each router listed as "up"
- will have the configuration grabbed. Note: manufacturer cat5
- is intended only for cisco catalyst switches running catalyst (not
+ from the set of (cat5|cisco|juniper) (see router.db.5 for a complete
+ list and description), and "state" is either up or down. Each router
+ listed as "up" will have the configuration grabbed. Note: manufacturer
+ cat5 is intended only for cisco catalyst switches running catalyst (not
IOS) code.
- eg //router.db:
+ e.g.: //router.db:
cisco-router.domain.com:cisco:up
adc-mux.domain.com:ezt3:up
foundry-switch-router.domain.com:foundry:up
@@ -152,28 +182,28 @@ Quick Installation Guide (an example):
redback-dsl-router.domain.com:redback:down
extreme-switch.domain.com:extreme:down
-9) For first-time users or new installations, run bin/do-diffs (with no
+9) For first-time users or new installations, run bin/rancid-run (with no
arguments) and check the resulting log file(s) (in logs/*) for errors.
Repeat until there are no errors.
-10) Put do-diffs in cron to be called however often you want it to
- run for each group (do-diffs []). If you run it less
- often than once/hour, check the setting of OLDTIME in bin/env.
+10) Put rancid-run in cron to be called however often you want it to
+ run for each group (rancid-run []). If you run it less
+ often than once/hour, check the setting of OLDTIME in etc/rancid.conf.
E.g.:
# run config differ hourly
- 1 * * * * /bin/do-diffs
+ 1 * * * * /bin/rancid-run
# clean out config differ logs
- 50 23 * * * /usr/bin/find /logs -type f -mtime +2 -exec rm {} \;
+ 50 23 * * * /usr/bin/find /logs -type f -mtime +2 -exec rm {} \;
11) Note: If you are using any of these programs (other than
- do-diffs) out of cron, make sure that you set your $PATH
+ rancid-run) out of cron, make sure that you set your $PATH
correctly so that they work. E.g.: if you are using clogin,
it can call id, telnet, ssh, and/or rsh.
configure already makes sure that $PATH is set correctly in
- bin/env for do-diffs, so you could use the $PATH from there. eg:
+ etc/rancid.conf for rancid-run, so you could use the $PATH from there. e.g.:
- 50 23 * * * . /usr/local/rancid/bin/env; clogin -c 'sh vers' router
+ 50 23 * * * . /rancid.conf; clogin -c 'sh vers' router
12) Send any bugs, suggestions or updates to rancid@shrubbery.net.
See the web page at http://www.shrubbery.net/rancid. We have
@@ -198,10 +228,10 @@ Patch-ID# 105786-11
Keywords: security ip tcp_priv_stream routing ip_enable_group_ifs ndd
Synopsis: SunOS 5.6: /kernel/drv/ip patch
-another possibile contributor is expect/tcl. we've noticed that expect
+Another possibile contributor is expect/tcl. We've noticed that expect
5.24.1 (possibly 5.28.*) and whatever tcl happens to compile with it,
seems to not exhibit this problem, while 5.32.* appears to on linux and
-solaris but not on netbsd 1.5. see www.shrubbery.net/rancid for additional
+solaris but not on netbsd 1.5. See www.shrubbery.net/rancid for additional
notes on this.
-Hank
diff --git a/README.lg b/README.lg
new file mode 100644
index 0000000..d66d1f1
--- /dev/null
+++ b/README.lg
@@ -0,0 +1,79 @@
+This is a looking glass based on Ed Kern's which used to be available on
+http://nitrous.digex.net/. This version supports cisco, juniper, and
+foundry, using rancid's [cfj]login to login (so rcmd is not necessary,
+it can use telnet, ssh, or rsh), and has some additional commands
+implemented. There are a few cisco commands where either no juniper or
+foundry equivalent exists or we have not had time to implement yet.
+
+packing list:
+README This file.
+index.html often the default document the server will load, contains
+ an html redirect to load lgform.cgi
+lg.conf looking glass configuration file
+lg.cgi work horse of the looking glass
+lgform.cgi front-end form for the looking glass engine
+lgnotes.html user info for the looking glass
+
+The looking glass requires the CGI and LockFile-Simple perl modules.
+these can be retrieved from CPAN, http://www.cpan.org/. CGI's home is
+ftp://ftp-genome.wi.mit.edu/pub/software/WWW/. It also requires
+the POSIX module (for strftime) and Sys::Syslog, which I believe comes
+with perl5 and/or are converted with h2ph(1).
+
+basic installation instructions:
+
+The configure and make install process will make variable substitutions
+and install the looking glass bits. Assuming configure was run without
+directory options, such as --prefix, the default install prefix is
+/usr/local/rancid. So, the bits will be installed in
+/usr/local/rancid/etc/lg.conf, /usr/local/rancid/bin, and
+/usr/local/rancid/share/rancid (i.e.: /etc/lg.conf, etc.).
+
+1) Make the scripts and html files available to your server (httpd) by
+ creating a directory in your server's document root directory
+ (apache's httpd.conf "DocumentRoot" variable). For example:
+
+ mkdir /usr/local/htdocs/lg
+
+ Then either:
+ - copy the files /share/rancid/{index.html,lgnotes.html} and
+ /bin/{lg.cgi,lgform.cgi} to /usr/local/htdocs/lg
+ OR
+ - create symlinks from /usr/local/htdocs/lg to each of these files.
+
+ Note on links: if you use symlinks, you have to configure apache to
+ allow following symlinks. e.g.:
+ % cat /usr/local/htdocs/lg/.htaccess
+ Options FollowSymLinks ExecCGI
+
+ Note on index.html: index.html is typically the default file loaded
+ when a url ends with a '/'. index.html can be used to redirect this
+ to lgform.cgi using a netscape meta refresh. Though this is supported
+ by many browsers, it is supposedly netscape specific and non-standard.
+ In apache, the same thing can be acheived by altering the default
+ directory index like this:
+
+ % cat /usr/local/htdocs/lg/.htaccess
+ DirectoryIndex lgform.cgi
+
+2) The looking glass scripts need to be able to find and read lg.conf. By
+ default it is installed as /lg.conf (/etc/lg.conf)
+ and the scripts will first look in their CWD (Current Working Directory)
+ and then /lg.conf, if it does not exist in the CWD. However,
+ the LG_CONF environment variable can be used to move it elsewhere.
+
+ To get LG_CONF into the CGI enviroment, you can use SetEnvIf in apache's
+ httpd.conf. For example:
+ SetEnvIf Request_URI "\/lg/.*.cgi" LG_CONF=/usr/local/htdocs/lg/lg.conf
+
+3) Edit /lg.conf (usually /etc/lg.conf). See lg.conf(5)
+ for additional information.
+
+4) Set-up cron jobs to rotate the log file and clean out old cache files.
+ See LG_CACHE_DIR & LG_LOG in lg.conf. Something like (YMMV):
+
+ # rotate lookingglass log
+ #0 0 * * * cd /usr/local/htdocs/lg/tmp; /usr/local/etc/savelog -m 666 -c14 lg.log
+ 0 0 * * * cd /usr/local/htdocs/lg/tmp; /bin/mv lg.log lg.log.0
+ # clean out the lookingglass cache
+ 0 0 * * * cd /usr/local/htdocs/lg/tmp; /usr/local/bin/find . -type f -maxdepth 1 \( \! -name lg.log\* \) -mtime +1 -exec rm -f {} \;
diff --git a/Todo b/Todo
index 87b2520..97ded87 100644
--- a/Todo
+++ b/Todo
@@ -1,19 +1,34 @@
+- could the cloginrc match function do a longest-match search instead of
+ first match?
+- look at Andreas Dahl's Brocade switch collection scripts
+- noenable should handle a value properly. i.e.: 1 == noenable, 0 == enable or
+ perhaps don't clear the -noenable cmd-line option. the manpage needs to be
+ fixed as well. see msg from fred jordan.
+- recent hp procurve s/w does not seem have show flash or show module
+- would like to have a "pre-login-sequence" cloginrc directive, see
+ rancid-disuss message from mike ethridge 16/may
+- would like to have a "timeout" cloginrc directive
+- would like to have a ssh "passphrase" cloginrc directive
+- would like to have a "login_option" cloginrc directive to specify arbitrary
+ command-line options
+- possibly a "debug" (exp_internal 1 ?) cloginrc directive? *login -d flag
+ for same? warning about filling logs?
+- on 6500, show boot and show bootvar produce the same output and both appear
+ in the crunched config. should one be filtered?
- fix varargs for knf in util.c
- isis filtering for foundry?
-- extreme v6.2.x need 'show configuration detail' to get full config but
- does not work on older vers
-- hlogin (hp procurve) needs to adjust it's PATH to find hpfilter
-- hlogin hangs when the procurve is does not ask for passwords
-- util/ tool to prune cvs versions, excluding those with tags, by (all but
+- hlogin hangs when the procurve does not ask for passwords
+- hlogin does not work with ssh, needs to alloc a pty?
+- share/ tool to prune cvs versions, excluding those with tags, by (all but
latest | keep N versions | keep N days/months/years)
-- extreme collections lose when the config on the switch is in an unsaved
- state, probably due to the prompt changing or rather how clogin formulates
- the prompt used by expect{ -re }'s.
- extreme collection fails for tacacs-enabled boxen due to diffs in UI - blech!
+- xrancid should collect both of these:
+ show configuration
+ show configuration detail
- FILTER_PWDS knob is not implemented in alteon, bay, ezt3 or redback due to
lack of h/w to test against. need help from the community.
- should par's -c override an input files' : cmd?
-- *login should emmit "clogin error:" or "*login error:" to make matches for
+- should *login emmit "clogin error:" or "*login error:" to make matches for
login failures definitive?
- would like hpfilter to be more friendly to interactive logins
- rancid with zebra? via vtysh?
@@ -34,6 +49,45 @@
- 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
-- LG {requested} additions
+- LG should sort routers
+- LG {requested} command additions
- show controllers T3 (data)
- handle redback in the looking glass
+ - show ip as-path-access-list
+ - show access-list
+ - show ip community-list
+ - show ip route-map
+- prancid - lots of GC'ing to be done
+- prancid - sort logging file by filename. e.g.:
+ logging file messages facility kernel level debugging
+ logging file log facility any level debugging
+ logging file log archive files 10 size 10m
+ logging file messages archive files 10 size 10m
+ then, sort by facility, e.g.:
+ logging file messages facility kernel level debugging
+ logging file messages facility authorization level debugging
+- should we add CVS ID header to saved configs? configurable option? - idea
+ from andrew fort
+- cat 2900 extra info
+ uptime is 3 weeks, 3 days, 14 hours, 17 minutes
+ System returned to ROM by power-on
+ System restarted at 15:21:54 UTC Mon Sep 30 2002
+ System image file is "flash:c2950-i6q4l2-mz.121-9.EA1d.bin"
+
+ cisco WS-C2950-24 (RC32300) processor (revision B0) with 20821K bytes of memory.
+ Processor board ID FHK0619X2RN
+ Last reset from system-reset
+ Running Standard Image
+ 24 FastEthernet/IEEE 802.3 interface(s)
+
+ 32K bytes of flash-simulated non-volatile configuration memory.
+ Base ethernet MAC Address: 00:09:B7:50:DE:C0
+ Motherboard assembly number: 73-5781-10
+ Power supply part number: 34-0965-01
+ Motherboard serial number: FOC061903JF
+ Power supply serial number: DAB061735H4
+ Model revision number: B0
+ Motherboard revision number: A0
+ Model number: WS-C2950-24
+ System serial number: FHK0619X2RN
+ Configuration register is 0xF
diff --git a/UPGRADING b/UPGRADING
new file mode 100644
index 0000000..3724331
--- /dev/null
+++ b/UPGRADING
@@ -0,0 +1,85 @@
+Rancid 2.3 introduces a new directory layout. It has been changed to more
+closely follow the standard path hierarchy, which is defined by the FHS
+standard and autoconf, and/or make these locations more easily configurable
+within rancid.
+
+The obvious advantage of this is making rancid more easily packagable; i.e.:
+NetBSD pkgsrc, FreeBSD port, Linux RPM, etc.
+
+Make sure your rancid repository is quiet before upgrading; disable rancid
+cron jobs, wait for running jobs to complete, etc.
+
+Autoconf defines the following (see configure --help):
+ Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [/usr/local/rancid]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+ Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --mandir=DIR man documentation [PREFIX/man]
+
+ Also defined, though not mentioned above, is:
+ pkgdatadir same as datadir, but datadir/rancid
+
+File and directory movement:
+ bin/env the rancid configuration file has moved to
+ sysconfdir/rancid.conf
+ util/lg/lg.conf the looking glass configuration has moved to
+ sysconfdir/lg.conf
+ util/lg/lg.cgi
+ util/lg/lgform.cgi the looking glass CGI scripts have moved to bindir
+ util/lg/* the remainder of looking glass html, README, etc
+ files have moved to pkgdatadir
+ util/* misc examples, scripts, etc have moved to pkgdatadir
+ cloginrc.sample moved to pkgdatadir
+
+For those upgrading, there is one basic choice to make; to move your CVS
+repository and logs or not. Prior to rancid 2.3, these were placed in
+. They are now in "localstatedir". The user who runs rancid will
+need write access to this directory.
+
+To maintain the same location as was used prior to rancid 2.3, provide
+the --localstatedir option to configure. e.g.:
+
+ ./configure --localstatedir=/usr/local/rancid
+
+/usr/local/rancid is, and has been, the default .
+
+To move them elsewhere, accept the default (e.g.: /usr/local/rancid/var) or
+specify your own and move the existing directories. e.g.:
+
+ ./configure --localstatedir=/var/rancid
+ make install
+ edit /rancid.conf # merge with your old bin/env
+ # configuration file
+ mv /usr/local/rancid/logs /var/rancid
+ mv /usr/local/rancid/CVS /var/rancid
+ cd /var/rancid
+ su - rancid_user
+ /bin/sh
+ . /rancid.conf
+ for grp in $LIST_OF_GROUPS; do
+ cvs -d /var/rancid/CVS co $grp
+ done
+
+Note that the first rancid-run will send messages about routers being added,
+marked up or down, etc., because the routers.{all,down,up} will have been
+lost. Afterward, it will be back to normal.
+
+Note also that any non-rancid files that may have been placed in these CVS
+trees will be lost. You have been warned.
+
+*** We strongly suggest that if a DIR used as the install prefix, as in
+ --prefix=DIR, is not dedicated to rancid that "/rancid" should be
+ appended to the --localstatedir, as in the example above.
+
+Note that not all operating systems have a mv command that will move
+directories across file systems. It may be necessary to use 'cp -r' or
+'tar cf - | (cd ; tar xpf -)'.
diff --git a/acconfig.h b/acconfig.h
new file mode 100644
index 0000000..87d5f53
--- /dev/null
+++ b/acconfig.h
@@ -0,0 +1,78 @@
+#ifndef CONFIG_H
+#define CONFIG_H 1
+
+@TOP@
+
+@BOTTOM@
+
+#ifndef __P
+# if STDC_HEADERS
+# define __P(a) a
+# else
+# define __P(a) ()
+# endif
+#endif
+
+#define BUF_SZ LINE_MAX /* (increments of) size of bufs */
+
+#if HAVE_STDLIB_H
+# include
+#endif
+
+#if HAVE_UNISTD_H
+# include
+# include
+#elif HAVE_SYS_TYPES_H
+# include
+#endif
+
+#if HAVE_ERRNO_H
+# include
+#endif
+extern int errno;
+
+#if HAVE_STRING_H
+# include
+#endif
+#if HAVE_STRINGS_H
+# include
+#endif
+
+#if ! HAVE_STRERROR
+# define strerror(n) sys_errlist[n];
+#endif
+
+#if HAVE_SYS_WAIT_H
+# include
+#endif
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+#if HAVE_MEMSET
+# define bzero(p,s) memset(p, 0, s)
+# define bcopy(s,d,l) memcpy(d, s, l)
+#endif
+
+#if HAVE_INDEX && ! HAVE_STRCHR
+# define index(s,c) strchr(s,c)
+#endif
+
+#if HAVE_SYSEXITS_H
+# include
+#else
+ /* missing sysexits.h */
+# define EX_OK 0
+# define EX_USAGE 64 /* command line usage error */
+# define EX_NOINPUT 66 /* cannot open input */
+# define EX_TEMPFAIL 75 /* temp failure */
+# define EX_OSERR 71 /* system error */
+# define EX_CANTCREAT 73 /* can't create (user) output file */
+# define EX_IOERR 74 /* input/output error */
+# define EX_CONFIG 78 /* configuration error */
+#endif
+
+#endif /* CONFIG_H */
diff --git a/aclocal.m4 b/aclocal.m4
index c6f5608..42590ae 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,72 +1,857 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4-p5
+# generated automatically by aclocal 1.8 -*- Autoconf -*-
-dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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.
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-dnl PARTICULAR PURPOSE.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
-AUTOMAKE_OPTIONS=no-dependencies foreign
+# -*- Autoconf -*-
+# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# Generated from amversion.in; do not edit by hand.
-# Do all the work for Automake. 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.
+# 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.
-# serial 1
+# 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
+
+# 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"])
+
+# 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])])
+
+# AM_AUX_DIR_EXPAND
+
+# 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.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# 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.
+
+# serial 6
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+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.])
+fi])])
+
+# serial 5 -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 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.
+
+
+# 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,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ : > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored.
+ if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+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 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.
+
+#serial 2
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
+ # Extract the definition of DEP_FILES from the Makefile without
+ # running `make'.
+ DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n -e '/^U = / s///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 -e '
+ /^DEP_FILES = .*\\\\$/ {
+ s/^DEP_FILES = //
+ :loop
+ s/\\\\$//
+ p
+ n
+ /\\\\$/ b loop
+ p
+ }
+ /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _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.
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 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.
-dnl Usage:
-dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+# serial 11
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_REQUIRE([AC_PROG_INSTALL])
-PACKAGE=[$1]
-AC_SUBST(PACKAGE)
-VERSION=[$2]
-AC_SUBST(VERSION)
-dnl test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
-ifelse([$3],,
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
-AC_REQUIRE([AM_SANITY_CHECK])
-AC_REQUIRE([AC_ARG_PROGRAM])
-dnl FIXME This is truly gross.
-missing_dir=`cd $ac_aux_dir && pwd`
-AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
-AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
-AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
-AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
-AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
-AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+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
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# 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.
+
+# serial 1
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+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.
+
+# 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 2
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# -*- 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.
+
+# serial 3
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+
+# 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.
+
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -m 0755 -p -- . 2>/dev/null; then
+ mkdir_p='mkdir -m 0755 -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-m ./0755 ./-p ./--;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs) -m 0755'
+ else
+ mkdir_p='$(install_sh) -m 0755 -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# 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.
+
+# serial 2
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+
+# Copyright (C) 1996, 1997, 1998, 2000, 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.
+
+# serial 3
+
+AC_DEFUN([AM_C_PROTOTYPES],
+[AC_REQUIRE([AC_C_PROTOTYPES])
+if test "$ac_cv_prog_cc_stdc" != no; then
+ U= ANSI2KNR=
+else
+ U=_ ANSI2KNR=./ansi2knr
+fi
+# Ensure some checks needed by ansi2knr itself.
+AC_REQUIRE([AC_HEADER_STDC])
+AC_CHECK_HEADERS(string.h)
+AC_SUBST(U)dnl
+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.
+
+# 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
+
+# AM_SANITY_CHECK
+# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
-echo timestamp > conftestfile
+echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "[$]*" = "X"; then
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
# -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
+ set X `ls -t $srcdir/configure conftest.file`
fi
- if test "[$]*" != "X $srcdir/configure conftestfile" \
- && test "[$]*" != "X conftestfile $srcdir/configure"; then
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
@@ -76,7 +861,7 @@ if (
alias in your environment])
fi
- test "[$]2" = conftestfile
+ test "$[2]" = conftest.file
)
then
# Ok.
@@ -85,188 +870,45 @@ else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
-rm -f conftest*
AC_MSG_RESULT(yes)])
-dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
-dnl The program must properly implement --version.
-AC_DEFUN([AM_MISSING_PROG],
-[AC_MSG_CHECKING(for working $2)
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if ($2 --version) < /dev/null > /dev/null 2>&1; then
- $1=$2
- AC_MSG_RESULT(found)
-else
- $1="$3/missing $2"
- AC_MSG_RESULT(missing)
-fi
-AC_SUBST($1)])
+# AM_PROG_INSTALL_STRIP
-# Like AC_CONFIG_HEADER, but automatically create stamp file.
-
-AC_DEFUN([AM_CONFIG_HEADER],
-[AC_PREREQ([2.12])
-AC_CONFIG_HEADER([$1])
-dnl When config.status generates a header, we must update the stamp-h file.
-dnl This file resides in the same directory as the config header
-dnl that is generated. We must strip everything past the first ":",
-dnl and everything past the last "/".
-AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
-ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
-<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
-<>; do
- case " <<$>>CONFIG_HEADERS " in
- *" <<$>>am_file "*<<)>>
- echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
- ;;
- esac
- am_indx=`expr "<<$>>am_indx" + 1`
-done<<>>dnl>>)
-changequote([,]))])
+# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
-# Add --enable-maintainer-mode option to configure.
-# From Jim Meyering
+# 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.
-# serial 1
-
-AC_DEFUN([AM_MAINTAINER_MODE],
-[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
- dnl maintainer-mode is disabled by default
- AC_ARG_ENABLE(maintainer-mode,
-[ --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer],
- USE_MAINTAINER_MODE=$enableval,
- USE_MAINTAINER_MODE=no)
- AC_MSG_RESULT($USE_MAINTAINER_MODE)
- AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
- MAINT=$MAINTAINER_MODE_TRUE
- AC_SUBST(MAINT)dnl
-]
-)
+# 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.
-# Define a conditional.
+# 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_CONDITIONAL],
-[AC_SUBST($1_TRUE)
-AC_SUBST($1_FALSE)
-if $2; then
- $1_TRUE=
- $1_FALSE='#'
-else
- $1_TRUE='#'
- $1_FALSE=
-fi])
-
-
-# serial 1
-
-AC_DEFUN([AM_C_PROTOTYPES],
-[AC_REQUIRE([AM_PROG_CC_STDC])
-AC_REQUIRE([AC_PROG_CPP])
-AC_MSG_CHECKING([for function prototypes])
-if test "$am_cv_prog_cc_stdc" != no; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
- U= ANSI2KNR=
-else
- AC_MSG_RESULT(no)
- U=_ ANSI2KNR=./ansi2knr
- # Ensure some checks needed by ansi2knr itself.
- AC_HEADER_STDC
- AC_CHECK_HEADERS(string.h)
+# 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
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
fi
-AC_SUBST(U)dnl
-AC_SUBST(ANSI2KNR)dnl
-])
-
-
-# serial 1
-
-# @defmac AC_PROG_CC_STDC
-# @maindex PROG_CC_STDC
-# @ovindex CC
-# If the C compiler in not in ANSI C mode by default, try to add an option
-# to output variable @code{CC} to make it so. This macro tries various
-# options that select ANSI C on some system or another. It considers the
-# compiler to be in ANSI C mode if it handles function prototypes correctly.
-#
-# If you use this macro, you should check after calling it whether the C
-# compiler has been set to accept ANSI C; if not, the shell variable
-# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
-# code in ANSI C, you can make an un-ANSIfied copy of it by using the
-# program @code{ansi2knr}, which comes with Ghostscript.
-# @end defmac
-
-AC_DEFUN([AM_PROG_CC_STDC],
-[AC_REQUIRE([AC_PROG_CC])
-AC_BEFORE([$0], [AC_C_INLINE])
-AC_BEFORE([$0], [AC_C_CONST])
-dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
-dnl a magic option to avoid problems with ANSI preprocessor commands
-dnl like #elif.
-dnl FIXME: can't do this because then AC_AIX won't work due to a
-dnl circular dependency.
-dnl AC_BEFORE([$0], [AC_PROG_CPP])
-AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
-AC_CACHE_VAL(am_cv_prog_cc_stdc,
-[am_cv_prog_cc_stdc=no
-ac_save_CC="$CC"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- AC_TRY_COMPILE(
-[#include
-#include
-#include
-#include
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-], [
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
-],
-[am_cv_prog_cc_stdc="$ac_arg"; break])
-done
-CC="$ac_save_CC"
-])
-if test -z "$am_cv_prog_cc_stdc"; then
- AC_MSG_RESULT([none needed])
-else
- AC_MSG_RESULT($am_cv_prog_cc_stdc)
-fi
-case "x$am_cv_prog_cc_stdc" in
- x|xno) ;;
- *) CC="$CC $am_cv_prog_cc_stdc" ;;
-esac
-])
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+m4_include([acinclude.m4])
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 67c8966..21fac52 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -1,26 +1,46 @@
## Process this file with automake to produce Makefile.in
## A Makefile.in is supplied, in case you do not have automake.
-## Copyright (C) 1997-2001 by Henry Kilmer, Erik Sherk and Pete Whiting.
+## $Id: Makefile.am,v 1.28 2004/01/11 07:15:23 hank Exp $
+##
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
+##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+##
#AUTOMAKE_OPTIONS=foreign no-dependencies
AUTOMAKE_OPTIONS=foreign
-PREFIX = @prefix@
+bin_PROGRAMS = hpuifilter
+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
+
+bin_SCRIPTS += 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
+#CLEANFILES= $(bin_SCRIPTS)
-bin_PROGRAMS = hpfilter
-hpfilter_SOURCES = hpfilter.c
+hpuifilter_SOURCES = hpuifilter.c
#CPPFLAGS += @PG_CPPFLAGS@
#INCLUDES += -I$(top_srcdir)/include @PG_CPPFLAGS@
@@ -35,35 +55,46 @@ YFLAGS = -d
# no idea why automake doesnt clean these targets
#CLEANFILES= y.tab.c y.tab.h lex.yy.c conf.h conf.c conflex.c
-BIN_PROGS=@RD_BIN_PROGS@
-BIN_DATAS=@RD_BIN_DATAS@
-
-install: all
- for prog in $(BIN_PROGS) ; do \
- $(INSTALL) $$prog $(bindir); \
- done; \
- if test -f $(bindir)/env ; then \
- echo "WARNING: *** $(bindir)/env exists: installing as env.new."; \
- echo " *** review env.new for new/deprecated switches"; \
- $(INSTALL_DATA) env $(bindir)/env.new; \
- else \
- $(INSTALL_DATA) env $(bindir); \
- fi
-# BIN_DATAS are empty at the moment.
-# for prog in $(BIN_DATAS) ; do \
-# $(INSTALL_DATA) $$prog $(PREFIX)/bin; \
-# done; \
-
#clean:
# rm -f Makefile env $(BIN_DATAS) $(BIN_PROGS)
-#distclean: clean
-# rm -f config.log config.status
+# auto_edit does the autoconf variable substitution. This allows the
+# substitution to have the full expansion of the variables, e.g.: $sysconfdir
+# will be /prefix/etc instead of ${prefix}/etc.
+#
+# This is a bit of a PITA, but is the method recommended by the autoconf
+# documentation.
+auto_edit = sed \
+ -e 's,@prefix\@,$(prefix),g' \
+ -e 's,@localstatedir\@,$(localstatedir),g' \
+ -e 's,@sysconfdir\@,$(sysconfdir),g' \
+ -e 's,@EXPECT_PATH\@,$(EXPECT_PATH),g' \
+ -e 's,@PERLV\@,$(PERLV),g' \
+ -e 's,@PERLV_PATH\@,$(PERLV_PATH),g' \
+ -e 's,@LG_PING_CMD\@,$(LG_PING_CMD),g' \
+ -e 's,@ADMINMAILPLUS\@,$(ADMINMAILPLUS),g' \
+ -e 's,@MAILPLUS\@,$(MAILPLUS),g'
+
+lg.cgi: Makefile $(srcdir)/lg.cgi.in
+ rm -f lg.cgi lg.cgi.tmp; \
+ $(auto_edit) $(srcdir)/lg.cgi.in >lg.cgi.tmp; \
+ chmod +x lg.cgi.tmp; \
+ mv lg.cgi.tmp lg.cgi
+
+lgform.cgi: Makefile $(srcdir)/lgform.cgi.in
+ rm -f lgform.cgi lgform.cgi.tmp; \
+ $(auto_edit) $(srcdir)/lgform.cgi.in >lgform.cgi.tmp; \
+ chmod +x lgform.cgi.tmp; \
+ mv lgform.cgi.tmp lgform.cgi
+
+rancid-cvs: Makefile $(srcdir)/rancid-cvs.in
+ rm -f rancid-cvs rancid-cvs.tmp; \
+ $(auto_edit) $(srcdir)/rancid-cvs.in >rancid-cvs.tmp; \
+ chmod +x rancid-cvs.tmp; \
+ mv rancid-cvs.tmp rancid-cvs
-#distdir:
-# for file in Makefile.in configure.in env.in $(BIN_DATAS:=.in) ; do \
-# $(INSTALL_DATA) $$file $(distdir); \
-# done
-# for file in configure $(BIN_PROGS:=.in) ; do \
-# $(INSTALL) $$file $(distdir); \
-# done
+rancid-run: Makefile $(srcdir)/rancid-run.in
+ rm -f rancid-run rancid-run.tmp; \
+ $(auto_edit) $(srcdir)/rancid-run.in >rancid-run.tmp; \
+ chmod +x rancid-run.tmp; \
+ mv rancid-run.tmp rancid-run
diff --git a/bin/Makefile.in b/bin/Makefile.in
index ad98aa8..eedc795 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -1,6 +1,8 @@
-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+# Makefile.in generated by automake 1.8 from Makefile.am.
+# @configure_input@
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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.
@@ -10,397 +12,595 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-#AUTOMAKE_OPTIONS=foreign no-dependencies
+@SET_MAKE@
-SHELL = @SHELL@
+SOURCES = $(hpuifilter_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
-
top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+bin_PROGRAMS = hpuifilter$(EXEEXT)
+subdir = bin
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/alogin.in $(srcdir)/arancid.in $(srcdir)/blogin.in \
+ $(srcdir)/brancid.in $(srcdir)/cat5rancid.in \
+ $(srcdir)/clogin.in $(srcdir)/control_rancid.in \
+ $(srcdir)/cssrancid.in $(srcdir)/elogin.in \
+ $(srcdir)/erancid.in $(srcdir)/f10rancid.in \
+ $(srcdir)/flogin.in $(srcdir)/fnrancid.in $(srcdir)/francid.in \
+ $(srcdir)/hlogin.in $(srcdir)/hrancid.in $(srcdir)/htlogin.in \
+ $(srcdir)/htrancid.in $(srcdir)/jerancid.in \
+ $(srcdir)/jlogin.in $(srcdir)/jrancid.in $(srcdir)/mrancid.in \
+ $(srcdir)/nlogin.in $(srcdir)/nrancid.in $(srcdir)/nslogin.in \
+ $(srcdir)/nsrancid.in $(srcdir)/par.in $(srcdir)/prancid.in \
+ $(srcdir)/rancid-fe.in $(srcdir)/rancid.in \
+ $(srcdir)/rivlogin.in $(srcdir)/rivrancid.in \
+ $(srcdir)/rrancid.in $(srcdir)/tntlogin.in \
+ $(srcdir)/tntrancid.in $(srcdir)/xrancid.in \
+ $(srcdir)/zrancid.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES = control_rancid par rancid-fe alogin arancid \
+ blogin brancid cat5rancid clogin rancid cssrancid elogin \
+ erancid f10rancid flogin francid fnrancid jlogin jrancid \
+ jerancid hlogin hrancid htlogin htrancid mrancid nlogin \
+ nrancid nslogin nsrancid prancid rivlogin rivrancid rrancid \
+ tntlogin tntrancid xrancid zrancid
+am__installdirs = $(DESTDIR)$(bindir) $(DESTDIR)$(bindir)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_hpuifilter_OBJECTS = hpuifilter.$(OBJEXT)
+hpuifilter_OBJECTS = $(am_hpuifilter_OBJECTS)
+hpuifilter_LDADD = $(LDADD)
+binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+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)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(hpuifilter_SOURCES)
+DIST_SOURCES = $(hpuifilter_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMINMAILPLUS = @ADMINMAILPLUS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+
+#CPPFLAGS += @PG_CPPFLAGS@
+#INCLUDES += -I$(top_srcdir)/include @PG_CPPFLAGS@
+#INCLUDES += -I$(top_srcdir)/include
+
+#CFLAGS += -g
+CFLAGS = -g -O0
COMM = @COMM@
CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
CVS = @CVS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
DIFF = @DIFF@
DIFF_CMD = @DIFF_CMD@
DIRNAME = @DIRNAME@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
ENV_PATH = @ENV_PATH@
+EXEEXT = @EXEEXT@
EXPECT_PATH = @EXPECT_PATH@
FIND = @FIND@
GREP = @GREP@
ID = @ID@
-INST_PROGS = @INST_PROGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
LG_PING_CMD = @LG_PING_CMD@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
MAILPLUS = @MAILPLUS@
-MAINT = @MAINT@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
MKDIR = @MKDIR@
+OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
PERLV = @PERLV@
PERLV_PATH = @PERLV_PATH@
PING_PATH = @PING_PATH@
-RD_BIN_DATAS = @RD_BIN_DATAS@
-RD_BIN_PROGS = @RD_BIN_PROGS@
-RD_UTIL_LG_PROGS = @RD_UTIL_LG_PROGS@
-RD_UTIL_PROGS = @RD_UTIL_PROGS@
RSH = @RSH@
SENDMAIL = @SENDMAIL@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
SORT = @SORT@
SSH = @SSH@
+STRIP = @STRIP@
TAR = @TAR@
TELNET = @TELNET@
TOUCH = @TOUCH@
U = @U@
VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+#AUTOMAKE_OPTIONS=foreign no-dependencies
AUTOMAKE_OPTIONS = foreign
-
-PREFIX = @prefix@
-
-bin_PROGRAMS = hpfilter
-hpfilter_SOURCES = hpfilter.c
-
-#CPPFLAGS += @PG_CPPFLAGS@
-#INCLUDES += -I$(top_srcdir)/include @PG_CPPFLAGS@
-#INCLUDES += -I$(top_srcdir)/include
-
-#CFLAGS += -g
-CFLAGS = -g -O0
-
+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
+#CLEANFILES= $(bin_SCRIPTS)
+hpuifilter_SOURCES = hpuifilter.c
YFLAGS = -d
#LFLAGS = -i
# no idea why automake doesnt clean these targets
#CLEANFILES= y.tab.c y.tab.h lex.yy.c conf.h conf.c conflex.c
-BIN_PROGS = @RD_BIN_PROGS@
-BIN_DATAS = @RD_BIN_DATAS@
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = ../include/config.h
-CONFIG_CLEAN_FILES = alogin arancid blogin brancid cat5rancid clogin \
-control_rancid create_cvs do-diffs elogin env erancid f10rancid flogin \
-francid jlogin jrancid hlogin hrancid mrancid par rancid-fe rancid \
-rename rrancid xrancid
-PROGRAMS = $(bin_PROGRAMS)
-
-
-DEFS = @DEFS@ -I. -I$(srcdir) -I../include
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-hpfilter_OBJECTS = hpfilter.o
-hpfilter_LDADD = $(LDADD)
-hpfilter_DEPENDENCIES =
-hpfilter_LDFLAGS =
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-DIST_COMMON = Makefile.am Makefile.in alogin.in arancid.in blogin.in \
-brancid.in cat5rancid.in clogin.in control_rancid.in create_cvs.in \
-do-diffs.in elogin.in env.in erancid.in f10rancid.in flogin.in \
-francid.in hlogin.in hrancid.in jlogin.in jrancid.in mrancid.in par.in \
-rancid-fe.in rancid.in rename.in rrancid.in xrancid.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+#clean:
+# rm -f Makefile env $(BIN_DATAS) $(BIN_PROGS)
-GZIP_ENV = --best
-SOURCES = $(hpfilter_SOURCES)
-OBJECTS = $(hpfilter_OBJECTS)
+# auto_edit does the autoconf variable substitution. This allows the
+# substitution to have the full expansion of the variables, e.g.: $sysconfdir
+# will be /prefix/etc instead of ${prefix}/etc.
+#
+# This is a bit of a PITA, but is the method recommended by the autoconf
+# documentation.
+auto_edit = sed \
+ -e 's,@prefix\@,$(prefix),g' \
+ -e 's,@localstatedir\@,$(localstatedir),g' \
+ -e 's,@sysconfdir\@,$(sysconfdir),g' \
+ -e 's,@EXPECT_PATH\@,$(EXPECT_PATH),g' \
+ -e 's,@PERLV\@,$(PERLV),g' \
+ -e 's,@PERLV_PATH\@,$(PERLV_PATH),g' \
+ -e 's,@LG_PING_CMD\@,$(LG_PING_CMD),g' \
+ -e 's,@ADMINMAILPLUS\@,$(ADMINMAILPLUS),g' \
+ -e 's,@MAILPLUS\@,$(MAILPLUS),g'
+
+all: all-am
-all: all-redirect
.SUFFIXES:
-.SUFFIXES: .S .c .o .s
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps bin/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-alogin: $(top_builddir)/config.status alogin.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-arancid: $(top_builddir)/config.status arancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-blogin: $(top_builddir)/config.status blogin.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-brancid: $(top_builddir)/config.status brancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-cat5rancid: $(top_builddir)/config.status cat5rancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-clogin: $(top_builddir)/config.status clogin.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-control_rancid: $(top_builddir)/config.status control_rancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-create_cvs: $(top_builddir)/config.status create_cvs.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-do-diffs: $(top_builddir)/config.status do-diffs.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-elogin: $(top_builddir)/config.status elogin.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-env: $(top_builddir)/config.status env.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-erancid: $(top_builddir)/config.status erancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-f10rancid: $(top_builddir)/config.status f10rancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-flogin: $(top_builddir)/config.status flogin.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-francid: $(top_builddir)/config.status francid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-jlogin: $(top_builddir)/config.status jlogin.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-jrancid: $(top_builddir)/config.status jrancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-hlogin: $(top_builddir)/config.status hlogin.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-hrancid: $(top_builddir)/config.status hrancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-mrancid: $(top_builddir)/config.status mrancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-par: $(top_builddir)/config.status par.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-rancid-fe: $(top_builddir)/config.status rancid-fe.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-rancid: $(top_builddir)/config.status rancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-rename: $(top_builddir)/config.status rename.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-rrancid: $(top_builddir)/config.status rrancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-xrancid: $(top_builddir)/config.status xrancid.in
- cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-mostlyclean-binPROGRAMS:
-
-clean-binPROGRAMS:
- -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
-
-distclean-binPROGRAMS:
-
-maintainer-clean-binPROGRAMS:
-
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign bin/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+control_rancid: $(top_builddir)/config.status $(srcdir)/control_rancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+par: $(top_builddir)/config.status $(srcdir)/par.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+rancid-fe: $(top_builddir)/config.status $(srcdir)/rancid-fe.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+alogin: $(top_builddir)/config.status $(srcdir)/alogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+arancid: $(top_builddir)/config.status $(srcdir)/arancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+blogin: $(top_builddir)/config.status $(srcdir)/blogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+brancid: $(top_builddir)/config.status $(srcdir)/brancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+cat5rancid: $(top_builddir)/config.status $(srcdir)/cat5rancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+clogin: $(top_builddir)/config.status $(srcdir)/clogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+rancid: $(top_builddir)/config.status $(srcdir)/rancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+cssrancid: $(top_builddir)/config.status $(srcdir)/cssrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+elogin: $(top_builddir)/config.status $(srcdir)/elogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+erancid: $(top_builddir)/config.status $(srcdir)/erancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+f10rancid: $(top_builddir)/config.status $(srcdir)/f10rancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+flogin: $(top_builddir)/config.status $(srcdir)/flogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+francid: $(top_builddir)/config.status $(srcdir)/francid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+fnrancid: $(top_builddir)/config.status $(srcdir)/fnrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+jlogin: $(top_builddir)/config.status $(srcdir)/jlogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+jrancid: $(top_builddir)/config.status $(srcdir)/jrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+jerancid: $(top_builddir)/config.status $(srcdir)/jerancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+hlogin: $(top_builddir)/config.status $(srcdir)/hlogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+hrancid: $(top_builddir)/config.status $(srcdir)/hrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+htlogin: $(top_builddir)/config.status $(srcdir)/htlogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+htrancid: $(top_builddir)/config.status $(srcdir)/htrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+mrancid: $(top_builddir)/config.status $(srcdir)/mrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+nlogin: $(top_builddir)/config.status $(srcdir)/nlogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+nrancid: $(top_builddir)/config.status $(srcdir)/nrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+nslogin: $(top_builddir)/config.status $(srcdir)/nslogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+nsrancid: $(top_builddir)/config.status $(srcdir)/nsrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+prancid: $(top_builddir)/config.status $(srcdir)/prancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+rivlogin: $(top_builddir)/config.status $(srcdir)/rivlogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+rivrancid: $(top_builddir)/config.status $(srcdir)/rivrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+rrancid: $(top_builddir)/config.status $(srcdir)/rrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+tntlogin: $(top_builddir)/config.status $(srcdir)/tntlogin.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+tntrancid: $(top_builddir)/config.status $(srcdir)/tntrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+xrancid: $(top_builddir)/config.status $(srcdir)/xrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+zrancid: $(top_builddir)/config.status $(srcdir)/zrancid.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(bindir)
+ $(mkdir_p) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
- if test -f $$p; then \
- echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
- $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
- list='$(bin_PROGRAMS)'; for p in $$list; do \
- rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+ rm -f $(DESTDIR)$(bindir)/$$f; \
done
-.c.o:
- $(COMPILE) -c $<
-
-.s.o:
- $(COMPILE) -c $<
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+hpuifilter$(EXEEXT): $(hpuifilter_OBJECTS) $(hpuifilter_DEPENDENCIES)
+ @rm -f hpuifilter$(EXEEXT)
+ $(LINK) $(hpuifilter_LDFLAGS) $(hpuifilter_OBJECTS) $(hpuifilter_LDADD) $(LIBS)
+install-binSCRIPTS: $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ $(mkdir_p) $(DESTDIR)$(bindir)
+ @list='$(bin_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f"; \
+ $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f; \
+ else :; fi; \
+ done
-.S.o:
- $(COMPILE) -c $<
+uninstall-binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+ rm -f $(DESTDIR)$(bindir)/$$f; \
+ done
mostlyclean-compile:
- -rm -f *.o core *.core
-
-clean-compile:
+ -rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
-maintainer-clean-compile:
-
-hpfilter: $(hpfilter_OBJECTS) $(hpfilter_DEPENDENCIES)
- @rm -f hpfilter
- $(LINK) $(hpfilter_LDFLAGS) $(hpfilter_OBJECTS) $(hpfilter_LDADD) $(LIBS)
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hpuifilter.Po@am__quote@
+.c.o:
+@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@
+@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@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
tags: TAGS
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
-clean-tags:
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = bin
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
fi; \
done
-
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
check-am: all-am
check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-exec-am: install-binPROGRAMS
+all-am: Makefile $(PROGRAMS) $(SCRIPTS)
+installdirs:
+ $(mkdir_p) $(DESTDIR)$(bindir) $(DESTDIR)$(bindir)
+install: install-am
install-exec: install-exec-am
-
-install-data-am:
install-data: install-data-am
+uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am: uninstall-binPROGRAMS
-uninstall: uninstall-am
-all-am: Makefile $(PROGRAMS)
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
- $(mkinstalldirs) $(DESTDIR)$(bindir)
-
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
-mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
- mostlyclean-tags mostlyclean-generic
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
-mostlyclean: mostlyclean-am
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
-clean-am: clean-binPROGRAMS clean-compile clean-tags clean-generic \
- mostlyclean-am
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
-clean: clean-am
+dvi: dvi-am
-distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
- distclean-generic clean-am
+dvi-am:
-distclean: distclean-am
+html: html-am
-maintainer-clean-am: maintainer-clean-binPROGRAMS \
- maintainer-clean-compile maintainer-clean-tags \
- maintainer-clean-generic distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS install-binSCRIPTS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
-.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
-maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
-mostlyclean-compile distclean-compile clean-compile \
-maintainer-clean-compile tags mostlyclean-tags distclean-tags \
-clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
-check-am installcheck-am installcheck install-exec-am install-exec \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
-
-
-install: all
- for prog in $(BIN_PROGS) ; do \
- $(INSTALL) $$prog $(bindir); \
- done; \
- if test -f $(bindir)/env ; then \
- echo "WARNING: *** $(bindir)/env exists: installing as env.new."; \
- echo " *** review env.new for new/deprecated switches"; \
- $(INSTALL_DATA) env $(bindir)/env.new; \
- else \
- $(INSTALL_DATA) env $(bindir); \
- fi
-# BIN_DATAS are empty at the moment.
-# for prog in $(BIN_DATAS) ; do \
-# $(INSTALL_DATA) $$prog $(PREFIX)/bin; \
-# done; \
+mostlyclean: mostlyclean-am
-#clean:
-# rm -f Makefile env $(BIN_DATAS) $(BIN_PROGS)
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
+ uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-binSCRIPTS install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-binSCRIPTS uninstall-info-am
+
+
+lg.cgi: Makefile $(srcdir)/lg.cgi.in
+ rm -f lg.cgi lg.cgi.tmp; \
+ $(auto_edit) $(srcdir)/lg.cgi.in >lg.cgi.tmp; \
+ chmod +x lg.cgi.tmp; \
+ mv lg.cgi.tmp lg.cgi
-#distclean: clean
-# rm -f config.log config.status
+lgform.cgi: Makefile $(srcdir)/lgform.cgi.in
+ rm -f lgform.cgi lgform.cgi.tmp; \
+ $(auto_edit) $(srcdir)/lgform.cgi.in >lgform.cgi.tmp; \
+ chmod +x lgform.cgi.tmp; \
+ mv lgform.cgi.tmp lgform.cgi
-#distdir:
-# for file in Makefile.in configure.in env.in $(BIN_DATAS:=.in) ; do \
-# $(INSTALL_DATA) $$file $(distdir); \
-# done
-# for file in configure $(BIN_PROGS:=.in) ; do \
-# $(INSTALL) $$file $(distdir); \
-# done
+rancid-cvs: Makefile $(srcdir)/rancid-cvs.in
+ rm -f rancid-cvs rancid-cvs.tmp; \
+ $(auto_edit) $(srcdir)/rancid-cvs.in >rancid-cvs.tmp; \
+ chmod +x rancid-cvs.tmp; \
+ mv rancid-cvs.tmp rancid-cvs
+rancid-run: Makefile $(srcdir)/rancid-run.in
+ rm -f rancid-run rancid-run.tmp; \
+ $(auto_edit) $(srcdir)/rancid-run.in >rancid-run.tmp; \
+ chmod +x rancid-run.tmp; \
+ mv rancid-run.tmp rancid-run
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/bin/alogin.in b/bin/alogin.in
index 03f12ca..91623fb 100644
--- a/bin/alogin.in
+++ b/bin/alogin.in
@@ -1,21 +1,26 @@
-#!@EXPECT_PATH@ --
+#! @EXPECT_PATH@ --
##
+## $Id: alogin.in,v 1.22 2004/01/11 05:39:15 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer, Erik Sherk and Pete Whiting.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
+# The login expect scripts were based on Erik Sherk's gwtn, by permission.
+#
# alogin - Alteon WebOS switch login
#
# afort@choqolat.org is responsible for this particular mess
@@ -39,8 +44,9 @@ set do_command 0
set do_script 0
# The default is to automatically enable
set enable 1
-# The default is that you login non-enabled (tacacs can have you login already enabled)
-set autoenable 0
+# 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
@@ -50,12 +56,14 @@ 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 "Error: could not exec id: $reason\n"
+ send_error "\nError: could not exec id: $reason\n"
exit 1
}
regexp {\(([^)]*)} "$reason" junk default_user
@@ -95,7 +103,7 @@ for {set i 0} {$i < $argc} {incr i} {
incr i
set E$varname $varvalue
} else {
- send_user "Error: invalid format for -E in $arg\n"
+ send_user "\nError: invalid format for -E in $arg\n"
exit 1
}
# Enable Password
@@ -118,7 +126,7 @@ for {set i 0} {$i < $argc} {incr i} {
set sfile [ lindex $argv $i ]
}
if { ! [ file readable $sfile ] } {
- send_user "Error: Can't read $sfile\n"
+ send_user "\nError: Can't read $sfile\n"
exit 1
}
set do_script 1
@@ -160,12 +168,12 @@ for {set i 0} {$i < $argc} {incr i} {
set do_command 1
# Do we enable?
} -noenable {
- # ignore -noenable
+ # ignore -noenable
# Does tacacs automatically enable us?
} -autoenable {
- # ignore -autoenable
+ # ignore -autoenable
} -* {
- send_user "Error: Unknown argument! $arg\n"
+ send_user "\nError: Unknown argument! $arg\n"
send_user $usage
exit 1
} default {
@@ -175,7 +183,7 @@ for {set i 0} {$i < $argc} {incr i} {
}
# Process routers...no routers listed is an error.
if { $i == $argc } {
- send_user "Error: $usage"
+ send_user "\nError: $usage"
}
# Only be quiet if we are running a script (it can log its output
@@ -241,16 +249,16 @@ proc find {var router} {
proc source_password_file { password_file } {
global env
if { ! [file exists $password_file] } {
- send_user "Error: password file ($password_file) does not exist\n"
+ send_user "\nError: password file ($password_file) does not exist\n"
exit 1
}
file stat $password_file fileinfo
if { [expr ($fileinfo(mode) & 007)] != 0000 } {
- send_user "Error: $password_file must not be world readable/writable\n"
+ send_user "\nError: $password_file must not be world readable/writable\n"
exit 1
}
if [ catch {source $password_file} reason ] {
- send_user "Error: $reason\n"
+ send_user "\nError: $reason\n"
exit 1
}
}
@@ -258,7 +266,7 @@ proc source_password_file { password_file } {
# Log into the router.
proc login { router user userpswd passwd prompt cmethod cyphertype } {
global spawn_id in_proc do_command do_script
- global u_prompt p_prompt
+ global u_prompt p_prompt sshcmd
set in_proc 1
set uprompt_seen 0
@@ -277,17 +285,17 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
exit 1
}
} elseif ![string compare $prog "ssh"] {
- if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] {
- send_user "Error: ssh failed: $reason\n"
+ 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 "Error: rsh failed: $reason\n"
+ send_user "\nError: rsh failed: $reason\n"
exit 1
}
} else {
- puts "ERROR: unknown connection method: $prog"
+ puts "\nError: unknown connection method: $prog"
return 1
}
incr progs -1
@@ -319,17 +327,17 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
close; wait
sleep 0.3
expect eof
- send_user "Error: Connection Refused\n"; wait; return 1
- } eof { send_user "Error: Couldn't login\n"; wait; return 1
+ send_user "\nError: Connection Refused\n"; wait; return 1
+ } eof { send_user "\nError: Couldn't login\n"; wait; return 1
} "Unknown host\r\n" {
expect eof
- send_user "Error: Unknown host\n"; wait; return 1
+ send_user "\nError: Unknown host\n"; wait; return 1
} "Host is unreachable" {
expect eof
- send_user "Error: Host Unreachable!\n"; wait; return 1
+ send_user "\nError: Host Unreachable!\n"; wait; return 1
} "No address associated with name" {
expect eof
- send_user "Error: Unknown host\n"; wait; return 1
+ send_user "\nError: Unknown host\n"; wait; return 1
}
-re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
send "yes\r"
@@ -362,10 +370,10 @@ proc login { router user userpswd passwd prompt cmethod cyphertype } {
send "y\r"
exp_continue
}
- "Password incorrect" { send_user "Error: Check your password for $router\n";
+ "Password incorrect" { send_user "\nError: Check your password for $router\n";
catch {close}; wait; return 1 }
-re "$prompt" { break; }
- denied { send_user "Error: Check your passwd for $router\n"
+ denied { send_user "\nError: Check your passwd for $router\n"
catch {close}; wait; return 1
}
"\r\n" { exp_continue; }
@@ -439,10 +447,10 @@ foreach router [lrange $argv $i end] {
if { $do_passwd } {
set pswd [find password $router]
if { [llength $pswd] == 0 } {
- send_user "Error - no password for $router in $password_file.\n"
+ send_user "\nError - no password for $router in $password_file.\n"
continue
}
- set passwd [lindex $pswd 0]
+ set passwd [join [lindex $pswd 0] ""]
}
# Figure out username
@@ -450,7 +458,7 @@ foreach router [lrange $argv $i end] {
# command line username
set ruser $username
} else {
- set ruser [find user $router]
+ set ruser [join [find user $router] ""]
if { "$ruser" == "" } { set ruser $default_user }
}
@@ -459,7 +467,7 @@ foreach router [lrange $argv $i end] {
# command line username
set userpswd $userpasswd
} else {
- set userpswd [find userpassword $router]
+ set userpswd [join [find userpassword $router] ""]
if { "$userpswd" == "" } { set userpswd $passwd }
}
@@ -468,13 +476,13 @@ foreach router [lrange $argv $i end] {
if { "$u_prompt" == "" } {
set u_prompt "(Username|login| Login):"
} else {
- set u_prompt [lindex $u_prompt 0]
+ set u_prompt [join [lindex $u_prompt 0] ""]
}
set p_prompt [find passprompt $router]
if { "$p_prompt" == "" } {
set p_prompt "\[Pp]assword:"
} else {
- set p_prompt [lindex $p_prompt 0]
+ set p_prompt [join [lindex $p_prompt 0] ""]
}
# Figure out cypher type
@@ -490,6 +498,10 @@ 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} }
+
# Login to the router
if {[login $router $ruser $userpswd $passwd $prompt $cmethod $cyphertype]} {
continue
diff --git a/bin/arancid.in b/bin/arancid.in
index f51a6c3..a2bf1ef 100644
--- a/bin/arancid.in
+++ b/bin/arancid.in
@@ -1,23 +1,26 @@
-#!@PERLV_PATH@
+#! @PERLV_PATH@
+##
+## $Id: arancid.in,v 1.14 2004/01/11 03:49:13 heas Exp $
##
## Hacked version of rancid for Alteon WebOS switches
## tested with: ad3 v8.1.18
## afort@choqolat.org (andrew fort)
##
-##
-## Copyright (C) 1997-2001 by Henry Kilmer.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
# RANCID - Really Awesome New Cisco confIg Differ
@@ -27,7 +30,7 @@
# usage: arancid [-d] [-l] [-f filename | $host]
#
use Getopt::Std;
-getopts('dflm');
+getopts('dfl');
$log = $opt_l;
$debug = $opt_d;
$file = $opt_f;
@@ -240,7 +243,11 @@ TOP: while() {
while (/>>.*$prompt\s*($cmds_regexp)\s*$/) {
$cmd = $1;
- if (!defined($prompt)) {$prompt = ($_ =~ /^([^#]+#)/)[0]; }
+ if (!defined($prompt)) {
+ $prompt = ($_ =~ /^([^#]+#)/)[0];
+ $prompt =~ s/([][}{)(\\])/\\$1/g;
+ print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
+ }
print STDERR ("HIT COMMAND:$_") if ($debug);
if (!defined($commands{$cmd})) {
print STDERR "$host: found unexpected command - \"$cmd\"\n";
diff --git a/bin/blogin.in b/bin/blogin.in
index 23bf97c..92d2e8c 100644
--- a/bin/blogin.in
+++ b/bin/blogin.in
@@ -1,26 +1,33 @@
-#!@EXPECT_PATH@ --
+#! @EXPECT_PATH@ --
##
+## $Id: blogin.in,v 1.22 2004/01/11 05:39:15 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer, Erik Sherk and Pete Whiting.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
+# The login expect scripts were based on Erik Sherk's gwtn, by permission.
+#
# blogin - Bay Networks(Nortel) login
#
-# Unlike the Cisco's, there is no enable function on the Bay's.
-# Instead there are seperate User and Manager accounts. A 'system' command
-# exists, which i am told does nothing.
+# Unlike the Cisco's, there is no enable function on the Bay's. Instead
+# there are seperate User and Manager accounts. A 'system' command exists,
+# which I am told does nothing.
+#
+# The "bcc>" prompt changes to "box#", not "bcc#" after the config command.
#
# Usage line
@@ -40,8 +47,9 @@ set do_command 0
set do_script 0
# The default is to automatically enable
set enable 0
-# The default is that you login non-enabled (tacacs can have you login already enabled)
-set autoenable 0
+# 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
@@ -52,6 +60,8 @@ 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 -
@@ -107,7 +117,7 @@ for {set i 0} {$i < $argc} {incr i} {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
- send_user "Error: invalid format for -E in $arg\n"
+ send_user "\nError: invalid format for -E in $arg\n"
exit 1
}
# Enable Password
@@ -176,7 +186,7 @@ for {set i 0} {$i < $argc} {incr i} {
set enable 0
# Does tacacs automatically enable us?
} -autoenable {
- set autoenable 1
+ set avautoenable 1
set enable 0
} -* {
send_user "\nError: Unknown argument! $arg\n"
@@ -272,7 +282,7 @@ proc source_password_file { password_file } {
# Log into the router.
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
+ global u_prompt p_prompt e_prompt sshcmd
set in_proc 1
# try each of the connection methods in $cmethod until one is successful
@@ -290,8 +300,8 @@ proc login { router user userpswd passwd enapasswd prompt cmethod cyphertype } {
exit 1
}
} elseif ![string compare $prog "ssh"] {
- if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] {
- send_user "\nError: ssh failed: $reason\n"
+ 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"] {
@@ -408,10 +418,13 @@ proc do_enable { enauser enapasswd } {
-re "$e_prompt" { send "$enapasswd\r"; exp_continue}
"#" { set prompt "#" }
"(enable)" { set prompt "> (enable) " }
- denied { send_user "\nError: Check your Enable passwd\n"; return 1}
- "% Bad passwords" { send_user "\nError: Check your Enable passwd\n"
- return 1
- }
+ denied { send_user "\nError: Check your Enable passwd\n"
+ return 1
+ }
+ "% Bad passwords" {
+ send_user "\nError: Check your Enable passwd\n"
+ return 1
+ }
}
# We set the prompt variable (above) so script files don't need
# to know what it is.
@@ -440,7 +453,7 @@ proc run_commands { prompt command } {
expect {
-re "^\[^\n\r *]*$reprompt" {}
-re "^\[^\n\r]*$reprompt." { exp_continue }
- -re "\[\n\r]" { exp_continue }
+ -re "\[\n\r]+" { exp_continue }
}
}
} else {
@@ -448,7 +461,7 @@ proc run_commands { prompt command } {
expect {
-re "^\[^\n\r *]*$reprompt" {}
-re "^\[^\n\r]*$reprompt." { exp_continue }
- -re "\[\n\r]" { exp_continue }
+ -re "\[\n\r]+" { exp_continue }
}
}
send "logout\r"
@@ -473,7 +486,9 @@ foreach router [lrange $argv $i end] {
# 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.
- if $autoenable {
+ if $avautoenable {
+ set autoenable 1
+ set enable 0
set prompt "#"
} else {
set ae [find autoenable $router]
@@ -496,15 +511,15 @@ foreach router [lrange $argv $i end] {
if { $do_passwd || $do_enapasswd } {
set pswd [find password $router]
if { [llength $pswd] == 0 } {
- send_user "Error - no password for $router in $password_file.\n"
+ send_user "\nError - no password for $router in $password_file.\n"
continue
}
if { $do_enapasswd && $autoenable == 0 && [llength $pswd] < 2 } {
- send_user "Error - no enable password for $router in $password_file.\n"
+ send_user "\nError - no enable password for $router in $password_file.\n"
continue
}
- set passwd [lindex $pswd 0]
- set enapasswd [lindex $pswd 1]
+ set passwd [join [lindex $pswd 0] ""]
+ set enapasswd [join [lindex $pswd 1] ""]
}
# Figure out username
@@ -512,7 +527,7 @@ foreach router [lrange $argv $i end] {
# command line username
set ruser $username
} else {
- set ruser [find user $router]
+ set ruser [join [find user $router] ""]
if { "$ruser" == "" } { set ruser $default_user }
}
@@ -521,7 +536,7 @@ foreach router [lrange $argv $i end] {
# command line username
set userpswd $userpasswd
} else {
- set userpswd [find userpassword $router]
+ set userpswd [join [find userpassword $router] ""]
if { "$userpswd" == "" } { set userpswd $passwd }
}
@@ -530,7 +545,7 @@ foreach router [lrange $argv $i end] {
# command line enausername
set enauser $enausername
} else {
- set enauser [find enauser $router]
+ set enauser [join [find enauser $router] ""]
if { "$enauser" == "" } { set enauser $ruser }
}
@@ -539,19 +554,19 @@ foreach router [lrange $argv $i end] {
if { "$u_prompt" == "" } {
set u_prompt "(Username|login|user name):"
} else {
- set u_prompt [lindex $u_prompt 0]
+ set u_prompt [join [lindex $u_prompt 0] ""]
}
set p_prompt [find passprompt $router]
if { "$p_prompt" == "" } {
set p_prompt "(\[Pp]assword|passwd):"
} else {
- set p_prompt [lindex $p_prompt 0]
+ set p_prompt [join [lindex $p_prompt 0] ""]
}
set e_prompt [find enableprompt $router]
if { "$e_prompt" == "" } {
set e_prompt "\[Pp]assword:"
} else {
- set e_prompt [lindex $e_prompt 0]
+ set e_prompt [join [lindex $e_prompt 0] ""]
}
# Figure out cypher type
@@ -567,6 +582,10 @@ foreach router [lrange $argv $i end] {
set cmethod [find method $router]
if { "$cmethod" == "" } { set cmethod {{telnet}} }
+ # 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 $prompt $cmethod $cyphertype]} {
continue
diff --git a/bin/brancid.in b/bin/brancid.in
index 2ea7e3b..c2e602e 100644
--- a/bin/brancid.in
+++ b/bin/brancid.in
@@ -1,20 +1,23 @@
-#!@PERLV_PATH@
+#! @PERLV_PATH@
##
+## $Id: brancid.in,v 1.16 2004/01/11 03:49:13 heas Exp $
## hacked version of Hank's rancid - this one tries to deal with Bay's.
##
-## Copyright (C) 1997-2001 by Henry Kilmer.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
# RANCID - Really Awesome New Cisco confIg Differ
@@ -22,7 +25,7 @@
# usage: rancid [-d] [-l] [-f filename | $host]
#
use Getopt::Std;
-getopts('dflm');
+getopts('dfl');
$log = $opt_l;
$debug = $opt_d;
$file = $opt_f;
@@ -246,7 +249,8 @@ TOP: while() {
$cmd = $1;
if (!defined($prompt)) {
$prompt = ($_ =~ /^([^>]+>)/)[0];
- $prompt =~ s/([][])/\\$1/g;
+ $prompt =~ s/([][}{)(\\])/\\$1/g;
+ print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
}
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
diff --git a/bin/cat5rancid.in b/bin/cat5rancid.in
old mode 100755
new mode 100644
index c8219d8..f1214a1
--- a/bin/cat5rancid.in
+++ b/bin/cat5rancid.in
@@ -1,19 +1,22 @@
-#!@PERLV_PATH@
+#! @PERLV_PATH@
##
+## $Id: cat5rancid.in,v 1.36 2004/01/11 03:49:13 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
# RANCID - Really Awesome New Cisco confIg Differ
@@ -21,7 +24,7 @@
# usage: rancid [-d] [-l] [-f filename | $host]
#
use Getopt::Std;
-getopts('dflm');
+getopts('dfl');
$log = $opt_l;
$debug = $opt_d;
$file = $opt_f;
@@ -783,7 +786,7 @@ sub ShowPortIfindex {
}
}
-# This routine processes a "write term"
+# This routine processes a "write term {all}"
sub WriteTerm {
print STDERR " In WriteTerm: $_" if ($debug);
@@ -791,7 +794,10 @@ sub WriteTerm {
while () {
tr/\015//d;
last if (/^$prompt/);
+ last if (/^Unknown host /); # error when write term all
+ # is not supported
next if (/^\.+$/ | /^$/);
+ return(0) if ($found_end);
/Non-Volatile memory is in use/ && return(-1); # NvRAM is locked
# skip the crap
next if (/^This command shows non-default configurations only./i);
@@ -862,6 +868,7 @@ sub WriteTerm {
next;
}
/fair-queue individual-limit/ && next;
+ /^set port security \d+\/\d+ \S+-\S+\-/ && next;
# sort ip explicit-paths.
if (/^ip explicit-path name (\S+)/) {
my($key) = $1;
@@ -995,6 +1002,7 @@ sub DoNothing {print STDOUT;}
'dir sup-microcode:' => "DirSlotN",
'show module' => "ShowModule",
'show port ifindex' => "ShowPortIfindex",
+ 'write term all' => "WriteTerm",
'write term' => "WriteTerm"
);
# keys() doesnt return things in the order entered and the order of the
@@ -1010,6 +1018,7 @@ sub DoNothing {print STDOUT;}
"dir sup-microcode:",
"show module",
"show port ifindex",
+ "write term all",
"write term"
);
$cisco_cmds=join(";",@commands);
@@ -1062,7 +1071,11 @@ TOP: while() {
}
while (/> \(enable\)\s*($cmds_regexp)\s*$/) {
$cmd = $1;
- if (!defined($prompt)) {$prompt = ($_ =~ /^([^>]+>)/)[0]; }
+ if (!defined($prompt)) {
+ $prompt = ($_ =~ /^([^>]+>)/)[0];
+ $prompt =~ s/([][}{)(\\])/\\$1/g;
+ print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
+ }
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
print STDERR "$host: found unexpected command - \"$cmd\"\n";
diff --git a/bin/clogin.in b/bin/clogin.in
old mode 100755
new mode 100644
index c026699..281d634
--- a/bin/clogin.in
+++ b/bin/clogin.in
@@ -1,21 +1,26 @@
-#!@EXPECT_PATH@ --
+#! @EXPECT_PATH@ --
##
+## $Id: clogin.in,v 1.72 2004/01/11 05:39:15 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer, Erik Sherk and Pete Whiting.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
+# The login expect scripts were based on Erik Sherk's gwtn, by permission.
+#
# clogin - Cisco login
#
# Most options are intuitive for logging into a Cisco router.
@@ -43,8 +48,9 @@ set do_command 0
set do_script 0
# The default is to automatically enable
set enable 1
-# The default is that you login non-enabled (tacacs can have you login already enabled)
-set autoenable 0
+# 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
@@ -57,6 +63,8 @@ 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 -
@@ -112,7 +120,7 @@ for {set i 0} {$i < $argc} {incr i} {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
- send_user "Error: invalid format for -E in $arg\n"
+ send_user "\nError: invalid format for -E in $arg\n"
exit 1
}
# Enable Password
@@ -184,7 +192,7 @@ for {set i 0} {$i < $argc} {incr i} {
set enable 0
# Does tacacs automatically enable us?
} -autoenable {
- set autoenable 1
+ set avautoenable 1
set enable 0
} -* {
send_user "\nError: Unknown argument! $arg\n"
@@ -280,7 +288,7 @@ proc source_password_file { password_file } {
# Log into the router.
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
+ global prompt u_prompt p_prompt e_prompt sshcmd
set in_proc 1
set uprompt_seen 0
@@ -299,8 +307,8 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
exit 1
}
} elseif ![string compare $prog "ssh"] {
- if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] {
- send_user "\nError: ssh failed: $reason\n"
+ 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"] {
@@ -344,24 +352,32 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
# then it will just send the passwd.
# if telnet fails with connection refused, try ssh
expect {
- -re "(Connection refused|Secure connection \[^\n\r]+ refused|Connection closed by)" {
+ -re "(Connection refused|Secure connection \[^\n\r]+ refused)" {
+ catch {close}; wait
+ 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 Refused ($prog)\n"; return 1
+ send_user "\nError: Connection closed ($prog): $router\n"
+ return 1
}
}
- eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
+ eof { send_user "\nError: Couldn't login: $router\n"; wait; return 1 }
-nocase "unknown host\r" {
catch {close};
- send_user "\nError: Unknown host\n"; wait; return 1
+ send_user "\nError: Unknown host $router\n"; wait; return 1
}
"Host is unreachable" {
catch {close};
- send_user "\nError: Host Unreachable!\n"; wait; return 1
+ send_user "\nError: Host Unreachable: $router\n"; wait; return 1
}
"No address associated with name" {
catch {close};
- send_user "\nError: Unknown host\n"; wait; return 1
+ send_user "\nError: Unknown host $router\n"; wait; return 1
}
-re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
send "yes\r"
@@ -387,6 +403,12 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
send_user "\nError: Check your passwd for $router\n"
return 1
}
+ -re "^Enter Selection: " {
+ # Catalyst 1900s have some lame menu. Enter
+ # K to reach a command-line.
+ send "K\r"
+ exp_continue;
+ }
-re "@\[^\r\n]+ $p_prompt" {
# ssh pwd prompt
sleep 1
@@ -407,9 +429,9 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
}
exp_continue
}
- "$prompt" { break; }
+ -re "$prompt" { break; }
"Login invalid" {
- send_user "\nError: Invalid login\n";
+ send_user "\nError: Invalid login: $router\n";
catch {close}; wait; return 1
}
}
@@ -431,10 +453,19 @@ proc do_enable { enauser enapasswd } {
-re "$e_prompt" { send "$enapasswd\r"; exp_continue}
"#" { set prompt "#" }
"(enable)" { set prompt "> (enable) " }
- denied { send_user "\nError: Check your Enable passwd\n"; return 1}
- "% Bad passwords" { send_user "\nError: Check your Enable passwd\n"
- return 1
- }
+ "denied" {
+ # % Access denied - from local auth
+ send_user "\nError: Check your Enable passwd\n";
+ return 1
+ }
+ "% Error in authentication" {
+ send_user "\nError: Check your Enable passwd\n"
+ return 1
+ }
+ "% Bad passwords" {
+ send_user "\nError: Check your Enable passwd\n"
+ return 1
+ }
}
# We set the prompt variable (above) so script files don't need
# to know what it is.
@@ -449,16 +480,19 @@ proc run_commands { prompt command } {
# If the prompt is (enable), then we are on a switch and the
# command is "set length 0"; otherwise its "term length 0".
- # skip if its an extreme.
+ # skip if its an extreme (since the pager can not be disabled on a
+ # per-vty basis).
if { [ string compare "extreme" "$platform" ] } {
if [ regexp -- ".*> .*enable" "$prompt" ] {
send "set length 0\r"
} else {
send "term length 0\r"
}
- regsub -all "\[)(]" $prompt {\\&} reprompt
- # match cisco config mode prompts too, but not for catalyst ie: (enable)
- regsub -all "\[#>]$" $reprompt {(\\([^\\r\\n]+\\))?&} reprompt
+ # escape any parens in the prompt, such as "(enable)"
+ regsub -all {[)(]} $prompt {\\&} reprompt
+ # match cisco config mode prompts too, such as router(config-if)#,
+ # but catalyst does not change in this fashion.
+ regsub -all {^(.{1,14}).*([#>])$} $reprompt {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt
expect {
-re $reprompt {}
-re "\[\n\r]+" { exp_continue }
@@ -466,6 +500,7 @@ proc run_commands { prompt command } {
} else {
regsub -all "\[)(]" $prompt {\\&} reprompt
}
+
# this is the only way i see to get rid of more prompts in o/p..grrrrr
log_user 0
# Is this a multi-command?
@@ -540,11 +575,18 @@ proc run_commands { prompt command } {
send "quit\r"
}
expect {
+ -re "^\[^\n\r *]*$reprompt" {
+ # the Cisco CE and Jnx ERX
+ # return to non-enabled mode
+ # on exit in enabled mode.
+ send "exit\r"
+ exp_continue;
+ }
"Do you wish to save your configuration changes" {
send "n\r"
exp_continue
}
- "\n" { exp_continue }
+ -re "\[\n\r]+" { exp_continue }
timeout { return 0 }
eof { return 0 }
}
@@ -564,14 +606,16 @@ foreach router [lrange $argv $i end] {
# 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.
- if $autoenable {
- set prompt "#"
+ if $avautoenable {
+ set autoenable 1
+ set enable 0
+ set prompt "(#| \\(enable\\))"
} else {
set ae [find autoenable $router]
if { "$ae" == "1" } {
set autoenable 1
set enable 0
- set prompt "#"
+ set prompt "(#| \\(enable\\))"
} else {
set autoenable 0
set prompt ">"
@@ -587,15 +631,15 @@ foreach router [lrange $argv $i end] {
if { $do_passwd || $do_enapasswd } {
set pswd [find password $router]
if { [llength $pswd] == 0 } {
- send_user "Error: no password for $router in $password_file.\n"
+ send_user "\nError: no password for $router in $password_file.\n"
continue
}
if { $enable && $do_enapasswd && $autoenable == 0 && [llength $pswd] < 2 } {
- send_user "Error: no enable password for $router in $password_file.\n"
+ send_user "\nError: no enable password for $router in $password_file.\n"
continue
}
- set passwd [lindex $pswd 0]
- set enapasswd [lindex $pswd 1]
+ set passwd [join [lindex $pswd 0] ""]
+ set enapasswd [join [lindex $pswd 1] ""]
}
# Figure out username
@@ -603,7 +647,7 @@ foreach router [lrange $argv $i end] {
# command line username
set ruser $username
} else {
- set ruser [find user $router]
+ set ruser [join [find user $router] ""]
if { "$ruser" == "" } { set ruser $default_user }
}
@@ -612,7 +656,7 @@ foreach router [lrange $argv $i end] {
# command line username
set userpswd $userpasswd
} else {
- set userpswd [find userpassword $router]
+ set userpswd [join [find userpassword $router] ""]
if { "$userpswd" == "" } { set userpswd $passwd }
}
@@ -621,7 +665,7 @@ foreach router [lrange $argv $i end] {
# command line enausername
set enauser $enausername
} else {
- set enauser [find enauser $router]
+ set enauser [join [find enauser $router] ""]
if { "$enauser" == "" } { set enauser $ruser }
}
@@ -630,34 +674,38 @@ foreach router [lrange $argv $i end] {
if { "$u_prompt" == "" } {
set u_prompt "(Username|Login|login|user name):"
} else {
- set u_prompt [lindex $u_prompt 0]
+ set u_prompt [join [lindex $u_prompt 0] ""]
}
set p_prompt [find passprompt $router]
if { "$p_prompt" == "" } {
set p_prompt "(\[Pp]assword|passwd):"
} else {
- set p_prompt [lindex $p_prompt 0]
+ set p_prompt [join [lindex $p_prompt 0] ""]
}
set e_prompt [find enableprompt $router]
if { "$e_prompt" == "" } {
set e_prompt "\[Pp]assword:"
} else {
- set e_prompt [lindex $e_prompt 0]
+ set e_prompt [join [lindex $e_prompt 0] ""]
}
# Figure out cypher type
if {[info exists cypher]} {
- # command line cypher type
- set cyphertype $cypher
+ # command line cypher type
+ set cyphertype $cypher
} else {
- set cyphertype [find cyphertype $router]
- if { "$cyphertype" == "" } { set cyphertype "3des" }
+ set cyphertype [find cyphertype $router]
+ if { "$cyphertype" == "" } { set cyphertype "3des" }
}
# Figure out connection method
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} }
+
# Login to the router
if {[login $router $ruser $userpswd $passwd $enapasswd $cmethod $cyphertype]} {
continue
@@ -675,16 +723,20 @@ foreach router [lrange $argv $i end] {
expect {
-re "\[\r\n]+" { exp_continue; }
-re "^(.+:)1 $prompt" { # stoopid extreme cmd-line numbers and
- # prompt based on state of config changes
+ # prompt based on state of config changes,
+ # which may have an * at the beginning.
set junk $expect_out(1,string)
regsub -all "^\\\* " $expect_out(1,string) {} junk
- set prompt ".? ?$junk\[0-9]+ $prompt";
+ set prompt ".? ?$junk\[0-9]+ $expect_out(2,string)";
set platform "extreme"
}
-re "^.+$prompt" { set junk $expect_out(0,string);
- regsub -all "\[\]\[]" $junk {\\&} prompt; }
- -re "^.+> \\\(enable\\\)" { set junk $expect_out(0,string);
- regsub -all "\[\]\[]" $junk {\\&} prompt; }
+ regsub -all "\[\]\[]" $junk {\\&} prompt;
+ }
+ -re "^.+> \\\(enable\\\)" {
+ set junk $expect_out(0,string);
+ regsub -all "\[\]\[]" $junk {\\&} prompt;
+ }
}
if { $do_command } {
diff --git a/bin/control_rancid.in b/bin/control_rancid.in
old mode 100755
new mode 100644
index 42f14ae..f51a21b
--- a/bin/control_rancid.in
+++ b/bin/control_rancid.in
@@ -1,19 +1,22 @@
-#!/bin/sh
+#! /bin/sh
##
+## $Id: control_rancid.in,v 1.61 2004/01/11 05:25:13 hank Exp $
##
-## Copyright (C) 1996-2001 by Henry Kilmer.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
# control_rancid $GROUP
@@ -80,6 +83,7 @@ trap 'rm -fr $TMP;' 1 2 15
# the receipient(s) of diffs
mailrcpt=${mailrcpt:-"@MAILPLUS@$GROUP"}; export mailrcpt
+adminmailrcpt=${mailrcpt:-"@ADMINMAILPLUS@$GROUP"}; export adminmailrcpt
# Number of things par should run in parallel.
PAR_COUNT=${PAR_COUNT:-5}
@@ -88,14 +92,14 @@ PAR_COUNT=${PAR_COUNT:-5}
if [ ! -d $DIR ]
then
echo "$DIR does not exist."
- echo "Run bin/create_cvs $GROUP to make all of the needed directories."
+ echo "Run bin/rancid-cvs $GROUP to make all of the needed directories."
(
- echo "To: @MAILPLUS@admin-$GROUP"
+ echo "To: $adminmailrcpt"
echo "Subject: no $GROUP directory"
echo "Precedence: bulk"
echo ""
echo "$DIR does not exist."
- echo "Run bin/create_cvs $GROUP to make all of the needed directories."
+ echo "Run bin/rancid-cvs $GROUP to make all of the needed directories."
) | sendmail -t
exit 1
fi
@@ -116,7 +120,7 @@ rm -f $TMP
if [ ! -f $DIR/router.db ]
then
(
- echo "To: @MAILPLUS@admin-$GROUP"
+ echo "To: $adminmailrcpt"
echo "Subject: no $GROUP/router.db file"
echo "Precedence: bulk"
echo ""
@@ -132,16 +136,17 @@ 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
-grep -v '^#' router.db > routers.db
-cut -d: -f1,2 routers.db | sort -u > routers.all.new
+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
diff routers.all routers.all.new > /dev/null 2>&1; RALL=$?
@PERLV@ -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print $_)
- if ($F[2] !~ /^up$/i);}' routers.db | sort -u > routers.down.new
+ if ($F[2] !~ /^up$/i);}' routers.db > routers.down.new
if [ ! -f routers.down ] ; then touch routers.down; fi
diff routers.down routers.down.new > /dev/null 2>&1; RDOWN=$?
@PERLV@ -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print "$F[0]:$F[1]\n")
- if ($F[2] =~ /^up$/i);}' routers.db | sort -u > routers.up.new
+ if ($F[2] =~ /^up$/i);}' routers.db > routers.up.new
if [ ! -f routers.up ] ; then touch routers.up; fi
diff routers.up routers.up.new > /dev/null 2>&1; RUP=$?
@@ -207,7 +212,7 @@ then
if [ -s routers.mail ] ; then
(
- echo "To: @MAILPLUS@admin-$GROUP"
+ echo "To: $adminmailrcpt"
echo "Subject: changes in $GROUP routers"
echo "Precedence: bulk"
echo ""
@@ -236,9 +241,18 @@ then
cd $DIR
fi
-mv routers.all.new routers.all
-mv routers.down.new routers.down
-mv routers.up.new routers.up
+mv -f routers.all.new routers.all
+if [ $? -ne 0 ]; then
+ echo "Error: could not rename routers.all.new"
+fi
+mv -f routers.down.new routers.down
+if [ $? -ne 0 ]; then
+ echo "Error: could not rename routers.down.new"
+fi
+mv -f routers.up.new routers.up
+if [ $? -ne 0 ]; then
+ echo "Error: could not rename routers.up.new"
+fi
rm -f routers.db
trap 'rm -fr $TMP;' 1 2 15
@@ -290,6 +304,7 @@ cd $DIR/configs
# The number of processes running at any given time can be
# tailored to the specific installation.
+echo ""
echo "Trying to get all of the configs."
par -q -n $PAR_COUNT -c "rancid-fe \{}" $devlistfile
@@ -331,19 +346,27 @@ do
done
echo
-# Make sure that all of the new configs are not empty.
-for config in *.new
-do
- if [ ! -s $config ]
+# 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
+ OFS=$IFS
+ IFS=':'
+ set $router
+ IFS=$OFS
+ router=$1;
+
+ if [ ! -s $router.new ]
then
- rm -f $config
+ rm -f $router.new
+ else
+ mv $router.new $router
+ if [ $? -ne 0 ]; then
+ echo "Error: could not rename $router.new to $router"
+ fi
fi
done
-# Now that we have the new configs, rename them to their proper
-# name.
-rename 's/.new$//' *.new
-
# This has been different for different machines...
# Diff the directory and then checkin.
trap 'rm -fr $TMP $TMP.diff $DIR/routers.single;' 1 2 15
@@ -387,7 +410,7 @@ fi
if [ -s $DIR/routers.failed ]
then
(
- echo "To: @MAILPLUS@admin-$GROUP"
+ echo "To: $adminmailrcpt"
echo "Subject: config fetcher problems - $GROUP"
echo "Precedence: bulk"
echo ""
diff --git a/bin/create_cvs.in b/bin/create_cvs.in
deleted file mode 100755
index 06d414b..0000000
--- a/bin/create_cvs.in
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/sh
-##
-##
-## Copyright (C) 1996-2001 by Henry Kilmer.
-## All rights reserved.
-##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
-##
-## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
-## responsibility and liability with respect to this software's usage
-## or its effect upon hardware, computer systems, other software, or
-## anything else.
-##
-##
-#
-# Create all of the misc files & dirs needed.
-#
-# create_cvs
-#
-
-# Read in the environment
-ENVFILE="`dirname $0`/env"
-
-. $ENVFILE
-
-# Base dir
-if [ ! -d $BASEDIR ]; then
- mkdir -p $BASEDIR
-fi
-
-cd $BASEDIR
-
-# Top level CVS stuff
-if [ ! -d $CVSROOT ]; then
- cvs init
-fi
-
-# Log dir
-if [ ! -d logs ]; then
- mkdir logs
-fi
-
-# Which groups to do
-if [ $# -ge 1 ] ; then
- LIST_OF_GROUPS="$*"; export LIST_OF_GROUPS
-elif [ "$LIST_OF_GROUPS" = "" ] ; then
- echo "LIST_OF_GROUPS is empty in $ENVFILE"
- exit 1
-fi
-
-for GROUP in `echo $LIST_OF_GROUPS` ;
-do
-
- DIR=$BASEDIR/$GROUP
-
- # Directory for the group and the configs
- if [ ! -d $DIR ]; then
- mkdir -p $DIR
- cd $DIR
- cvs import -m "$GROUP" $GROUP new rancid
- cd $BASEDIR
- cvs co $GROUP
- fi
- cd $DIR
- if [ ! -d configs ]; then
- mkdir configs
- cvs add configs
- cvs commit -m 'new' configs
- fi
-
- # main files
- if [ ! -f routers.all ]; then
- touch routers.all
- fi
- if [ ! -f routers.down ]; then
- touch routers.down
- fi
- if [ ! -f routers.up ]; then
- touch routers.up
- fi
- if [ ! -f router.db ]; then
- touch router.db
- cvs add router.db
- cvs commit -m 'new' router.db
- fi
-done
diff --git a/bin/cssrancid.in b/bin/cssrancid.in
new file mode 100644
index 0000000..27049df
--- /dev/null
+++ b/bin/cssrancid.in
@@ -0,0 +1,660 @@
+#! @PERLV_PATH@
+##
+## $Id: cssrancid.in,v 1.4 2004/01/11 03:49:13 heas Exp $
+##
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
+## All rights reserved.
+##
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
+##
+## There is no warranty or other guarantee of fitness of this software.
+## It is provided solely "as is". The author(s) disclaim(s) all
+## responsibility and liability with respect to this software's usage
+## or its effect upon hardware, computer systems, other software, or
+## anything else.
+##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+##
+#
+# RANCID - Really Awesome New Cisco confIg Differ
+#
+# usage: rancid [-d] [-l] [-f filename | $host]
+#
+use Getopt::Std;
+getopts('dfl');
+$log = $opt_l;
+$debug = $opt_d;
+$file = $opt_f;
+$host = $ARGV[0];
+$clean_run = 0;
+$found_end = 0;
+$timeo = 90; # clogin timeout in seconds
+
+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) {
+ print eval "$command \%history";
+ undef %history;
+ }
+ if (($new_hist_tag) && ($new_command) && ($command_string)) {
+ if ($history{$command_string}) {
+ $history{$command_string} = "$history{$command_string}@string";
+ } else {
+ $history{$command_string} = "@string";
+ }
+ } elsif (($new_hist_tag) && ($new_command)) {
+ $history{++$#history} = "@string";
+ } else {
+ print "@string";
+ }
+ $hist_tag = $new_hist_tag;
+ $command = $new_command;
+ 1;
+}
+
+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($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort numerically keys(%lines)) {
+ $sorted_lines[$i] = $lines{$key};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# 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($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort keys(%lines)) {
+ $sorted_lines[$i] = $lines{$key};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# 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($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort values %lines) {
+ $sorted_lines[$i] = $key;
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a numerical sort routine (ascending).
+sub numsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $num (sort {$a <=> $b} keys %lines) {
+ $sorted_lines[$i] = $lines{$num};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a sort routine that will sort on the
+# ip address when the ip address is anywhere in
+# the strings.
+sub ipsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $addr (sort sortbyipaddr keys %lines) {
+ $sorted_lines[$i] = $lines{$addr};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# 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]));
+}
+sub sortbyipaddr {
+ &ipaddrval($a) <=> &ipaddrval($b);
+}
+
+# This routine parses "show version"
+sub ShowVersion {
+ print STDERR " In ShowVersion: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ study;
+ last if(/^$prompt/);
+ next if(/^(\s*|\s*$cmd\s*)$/);
+ return(-1) if (/command authorization failed/i);
+ if (/^Slave in slot (\d+) is running/) {
+ $slave = " Slave:";
+ next;
+ }
+ /^Cisco Secure PIX /i &&
+ ProcessHistory("COMMENTS","keysort","F1", "!Image: $_") && next;
+ /^IOS .* Software \(([A-Za-z-0-9]*)\), .*Version\s+(.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","F1",
+ "!Image:$slave Software: $1, $2\n") && next;
+ /^([A-Za-z-0-9_]*) Synced to mainline version: (.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","F2",
+ "!Image:$slave $1 Synced to mainline version: $2\n") && next;
+ /^Compiled (.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","F3",
+ "!Image:$slave Compiled: $1\n") && next;
+ /^ROM: (System )?Bootstrap.*(Version.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","G1",
+ "!ROM Bootstrap: $2\n") && next;
+ if (/^Hardware:\s+(.*), (.* RAM), CPU (.*)$/) {
+ ProcessHistory("COMMENTS","keysort","A1",
+ "!Chassis type: $1 - a PIX\n");
+ ProcessHistory("COMMENTS","keysort","A2",
+ "!CPU: $3\n");
+ ProcessHistory("COMMENTS","keysort","B1", "!Memory: $2\n");
+ }
+ /^Serial Number:\s+(.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","C1", "!$_") && next;
+ /^Activation Key:\s+(.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","C2", "!$_") && next;
+ /^ROM: \d+ Bootstrap .*(Version.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","G2",
+ "!ROM Image: Bootstrap $1\n!\n") && next;
+ /^ROM: .*(Version.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","G3","!ROM Image: $1\n") && next;
+ /^BOOTFLASH: .*(Version.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","G4","!BOOTFLASH: $1\n") && next;
+ /^BOOTLDR: .*(Version.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","G4","!BOOTLDR: $1\n") && next;
+ /^System image file is "([^\"]*)", booted via (\S*)/ &&
+ ProcessHistory("COMMENTS","keysort","F4","!Image: booted $1\n") &&
+ next;
+ /^System image file is "([^\"]*)"$/ &&
+ ProcessHistory("COMMENTS","keysort","F5","!Image: $1\n") && next;
+ if (/(\S+)\s+\((\S+)\)\s+processor.*with (\S+[kK]) bytes/) {
+ my($proc) = $1;
+ my($cpu) = $2;
+ my($mem) = $3;
+ my($device) = "router";
+ $type = "CSS";
+ print STDERR "TYPE = $type\n" if ($debug);
+ ProcessHistory("COMMENTS","keysort","A1",
+ "!Chassis type:$slave $proc - a $type $device\n");
+ ProcessHistory("COMMENTS","keysort","B1",
+ "!Memory:$slave main $mem\n");
+ ProcessHistory("COMMENTS","keysort","A3","!CPU:$slave $cpu\n");
+ next;
+ }
+ if (/(\S+) Silicon\s*Switch Processor/) {
+ if (!defined($C0)) {
+ $C0=1; ProcessHistory("COMMENTS","keysort","C0","!\n");
+ }
+ ProcessHistory("COMMENTS","keysort","C2","!SSP: $1\n");
+ $ssp = 1;
+ $sspmem = $1;
+ next;
+ }
+ /^(\d+[kK]) bytes of multibus/ &&
+ ProcessHistory("COMMENTS","keysort","B2",
+ "!Memory: multibus $1\n") && next;
+ /^(\d+[kK]) bytes of non-volatile/ &&
+ ProcessHistory("COMMENTS","keysort","B3",
+ "!Memory: nvram $1\n") && next;
+ /^(\d+[kK]) bytes of flash memory/ &&
+ ProcessHistory("COMMENTS","keysort","B5","!Memory: flash $1\n") &&
+ next;
+ /^(\d+[kK]) bytes of .*flash partition/ &&
+ ProcessHistory("COMMENTS","keysort","B6",
+ "!Memory: flash partition $1\n") && next;
+ /^(\d+[kK]) bytes of Flash internal/ &&
+ ProcessHistory("COMMENTS","keysort","B4",
+ "!Memory: bootflash $1\n") && next;
+ if(/^(\d+[kK]) bytes of (Flash|ATA)?.*PCMCIA .*(slot|disk) ?(\d)/i) {
+ ProcessHistory("COMMENTS","keysort","B7",
+ "!Memory: pcmcia $2 $3$4 $1\n");
+ next;
+ }
+ if(/^WARNING/) {
+ if (!defined($I0)) {
+ $I0=1;
+ ProcessHistory("COMMENTS","keysort","I0","!\n");
+ }
+ ProcessHistory("COMMENTS","keysort","I1","! $_");
+ # The line after the WARNING is what to do about it.
+ $_ = ; tr/\015//d;
+ ProcessHistory("COMMENTS","keysort","I1","! $_");
+ }
+ if (/^Configuration register is (.*)$/) {
+ $config_register=$1;
+ next;
+ }
+ }
+ return(0);
+}
+
+
+# Dummy routine to set term length....
+sub TermLength {
+ # Dummy subroutine.. need to set term length differently for CSS
+ # boxes as term length 0 doesnt work correctly. POS.
+ return(0);
+}
+
+# Dummy routine to copy profile...
+sub CopyProfile {
+ ## Because the term length gets changed twice, the stupid
+ ## box will ask you to save or discard changes. This prompt
+ ## of couse breaks the interaction... strangely enough tho
+ ## in a failover environment, only the secondary behaves this
+ ## way.. the primary lets you log out and does not complain.
+ return(0);
+}
+
+
+# This routine parses "show boot"
+sub ShowBoot {
+ # Pick up boot variables if 7000/7200/7500/12000/2900/3500;
+ # otherwise pick up bootflash.
+ print STDERR " In ShowBoot: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ return(1) if /^\s*\^\s*$/;
+ return(-1) if (/command authorization failed/i);
+ return(1) if /Ambiguous command/i;
+ # return(1) if /(Invalid input detected|Type help or )/;
+ return(1) if /(Open device \S+ failed|Error opening \S+:)/;
+ next if /CONFGEN variable/;
+ if (!defined($H0)) {
+ $H0=1; ProcessHistory("COMMENTS","keysort","H0","!\n");
+ }
+ if ($type !~ /^(12[04]|7)/) {
+ if ($type !~ /^(29|35)00/) {
+ ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_");
+ } else {
+ ProcessHistory("COMMENTS","keysort","H1","!Variable: $_");
+ }
+ } elsif (/variable/) {
+ ProcessHistory("COMMENTS","keysort","H1","!Variable: $_");
+ }
+ }
+ ProcessHistory("COMMENTS","","","!\n");
+ return(0);
+}
+
+
+# This routine processes a "show run"
+sub ShowRun {
+ print STDERR " In ShowRun: $_" if ($debug);
+ my($lineauto) = 0;
+
+ while () {
+ tr/\015//d;
+ study;
+ last if(/^$prompt/);
+ return(-1) if (/command authorization failed/i);
+ # the pager can not be disabled per-session on the PIX
+ s/^<-+ More -+>\s*//;
+ /Non-Volatile memory is in use/ && return(-1); # NvRAM is locked
+ $lineauto = 0 if (/^[^ ]/);
+ # skip the crap
+ if (/^(##+$|(Building|Current) configuration)/i) {
+ while () {
+ next if (/^Current configuration\s*:/i);
+ next if (/^:/);
+ next if (/^([%!].*|\s*)$/);
+ next if (/^ip add.*ipv4:/); # band-aid for 3620 12.0S
+ last;
+ }
+ if (defined($config_register)) {
+ ProcessHistory("","","","!\nconfig-register $config_register\n");
+ }
+ tr/\015//d;
+ }
+ # some versions have other crap mixed in with the bits in the
+ # block above
+ /^! (Last configuration|NVRAM config last)/ && next;
+ ## CSS specific....
+ /Generated on/ && next;
+
+ # Dog gone Cool matches to process the rest of the config
+ /^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
+ $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 \n");
+ next;
+ }
+ if (/^(enable secret) / && $filter_pwds >= 2) {
+ ProcessHistory("ENABLE","","","!$1 \n");
+ next;
+ }
+ if (/^username (\S+)(\s.*)? secret /) {
+ if ($filter_pwds >= 2) {
+ ProcessHistory("USER","keysort","$1","!username $1$2 secret \n");
+ } else {
+ ProcessHistory("USER","keysort","$1","$_");
+ }
+ next;
+ }
+ if (/^username (\S+)(\s.*)? password ((\d) \S+|\S+)/) {
+ if ($filter_pwds == 2) {
+ ProcessHistory("USER","keysort","$1","!username $1$2 password \n");
+ } elsif ($filter_pwds == 1 && $4 ne "5"){
+ ProcessHistory("USER","keysort","$1","!username $1$2 password \n");
+ } else {
+ ProcessHistory("USER","keysort","$1","$_");
+ }
+ next;
+ }
+ if (/^(\s*)password / && $filter_pwds >= 1) {
+ ProcessHistory("LINE-PASS","","","!$1password \n");
+ next;
+ }
+ if (/^\s*neighbor (\S*) password / && $filter_pwds >= 1) {
+ ProcessHistory("","","","! neighbor $1 password \n");
+ next;
+ }
+ if (/^(ppp .* password) 7 .*/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+ if (/^(ip ftp password) / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+ if (/^( ip ospf authentication-key) / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+ # isis passwords appear to be completely plain-text
+ if (/^\s+isis password (\S+)( .*)?/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","!isis password $2\n"); next;
+ }
+ if (/^\s+(domain-password|area-password) (\S+)( .*)?/
+ && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 $2\n"); next;
+ }
+ # this is reversable, despite 'md5' in the cmd
+ if (/^( ip ospf message-digest-key \d+ md5) / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+ if (/^((crypto )?isakmp key) \S+ / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 $'"); next;
+ }
+ # i am told these are plain-text on the PIX
+ if (/^(vpdn username \S+ password)/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+ /fair-queue individual-limit/ && next;
+ # sort ip explicit-paths.
+ if (/^ip explicit-path name (\S+)/) {
+ my($key) = $1;
+ my($expath) = $_;
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ last if (/^$prompt/ || ! /^(ip explicit-path name |[ !])/);
+ if (/^ip explicit-path name (\S+)/) {
+ ProcessHistory("EXPATH","keysort","$key","$expath");
+ $key = $1;
+ $expath = $_;
+ } else {
+ $expath .= $_;
+ }
+ }
+ ProcessHistory("EXPATH","keysort","$key","$expath");
+ }
+ # sort route-maps
+ if (/^route-map (\S+)/) {
+ my($key) = $1;
+ my($routemap) = $_;
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/ || ! /^(route-map |[ !])/);
+ if (/^route-map (\S+)/) {
+ ProcessHistory("ROUTEMAP","keysort","$key","$routemap");
+ $key = $1;
+ $routemap = $_;
+ } else {
+ $routemap .= $_;
+ }
+ }
+ ProcessHistory("ROUTEMAP","keysort","$key","$routemap");
+ }
+ # filter out any RCS/CVS tags to avoid confusing local CVS storage
+ s/\$(Revision|Id):/ $1:/;
+ # order access-lists
+ /^access-list\s+(\d\d?)\s+(\S+)\s+(\S+)/ &&
+ ProcessHistory("ACL $1 $2","ipsort","$3","$_") && next;
+ # order extended access-lists
+ /^access-list\s+(\d\d\d)\s+(\S+)\s+ip\s+host\s+(\S+)/ &&
+ ProcessHistory("EACL $1 $2","ipsort","$3","$_") && next;
+ /^access-list\s+(\d\d\d)\s+(\S+)\s+ip\s+(\d\S+)/ &&
+ ProcessHistory("EACL $1 $2","ipsort","$3","$_") && next;
+ /^access-list\s+(\d\d\d)\s+(\S+)\s+ip\s+any/ &&
+ ProcessHistory("EACL $1 $2","ipsort","0.0.0.0","$_") && next;
+ # order arp lists
+ /^arp\s+(\d+\.\d+\.\d+\.\d+)\s+/ &&
+ ProcessHistory("ARP","ipsort","$1","$_") && next;
+ /^ip prefix-list\s+(\S+)\s+seq\s+(\d+)\s+(permit|deny)\s+(\d\S+)(\/.*)$/ &&
+ ProcessHistory("PACL $1 $3","ipsort","$4","ip prefix-list $1 $3 $4$5\n")
+ && next;
+ # order logging statements
+ /^logging (\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
+ if (/^snmp-server host (\d+\.\d+\.\d+\.\d+) /) {
+ if (defined($ENV{'NOCOMMSTR'})) {
+ my($ip) = $1;
+ my($line) = "snmp-server host $ip";
+ my(@tokens) = split(' ', $');
+ my($token);
+ while ($token = shift(@tokens)) {
+ if ($token eq 'version') {
+ $line .= " " . join(' ', ($token, shift(@tokens)));
+ } elsif ($token =~ /^(informs?|traps?|(no)?auth)$/) {
+ $line .= " " . $token;
+ } else {
+ $line = "!$line " . join(' ', ("", join(' ',@tokens)));
+ last;
+ }
+ }
+ ProcessHistory("SNMPSERVERHOST","ipsort","$ip","$line\n");
+ } else {
+ ProcessHistory("SNMPSERVERHOST","ipsort","$1","$_");
+ }
+ next;
+ }
+ if (/^(snmp-server community) (\S+)/) {
+ if (defined($ENV{'NOCOMMSTR'})) {
+ ProcessHistory("SNMPSERVERCOMM","keysort","$_","!$1 $'") && next;
+ } else {
+ ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") && next;
+ }
+ }
+ # order/prune tacacs/radius server statements
+ if (/^(tacacs-server|radius-server) key / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 key \n"); next;
+ }
+ # order clns host statements
+ /^clns host \S+ (\S+)/ &&
+ ProcessHistory("CLNS","keysort","$1","$_") && next;
+ # order alias statements
+ /^alias / && ProcessHistory("ALIAS","keysort","$_","$_") && next;
+ # delete ntp auth password - this md5 is a reversable too
+ if (/^(ntp authentication-key \d+ md5) / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+ # order ntp peers/servers
+ if (/^ntp (server|peer) (\d+)\.(\d+)\.(\d+)\.(\d+)/) {
+ $sortkey = sprintf("$1 %03d%03d%03d%03d",$2,$3,$4,$5);
+ ProcessHistory("NTP","keysort",$sortkey,"$_");
+ next;
+ }
+ # order ip host line statements
+ /^ip host line(\d+)/ &&
+ ProcessHistory("IPHOST","numsort","$1","$_") && next;
+ # order ip nat source static statements
+ /^ip nat (\S+) source static (\S+)/ &&
+ ProcessHistory("IP NAT $1","ipsort","$2","$_") && next;
+ # order atm map-list statements
+ /^\s+ip\s+(\d+\.\d+\.\d+\.\d+)\s+atm-vc/ &&
+ ProcessHistory("ATM map-list","ipsort","$1","$_") && next;
+ # order ip rcmd lines
+ /^ip rcmd/ && ProcessHistory("RCMD","keysort","$_","$_") && next;
+
+ # system controller
+ /^syscon address (\S*) (\S*)/ &&
+ ProcessHistory("","","","!syscon address $1 \n") &&
+ next;
+ if (/^syscon password (\S*)/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","!syscon password \n");
+ next;
+ }
+
+ # catch anything that wasnt matched above.
+ ProcessHistory("","","","$_");
+ # end of config. the ": " game is for the PIX
+ if (/^(: +)?end$/ || /CSS.*#/ || /$prompt/ ) {
+ $found_end = 1;
+ return(1);
+ }
+ }
+ return(0);
+}
+
+# dummy function
+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"
+);
+$cisco_cmds=join(";",@commands);
+$cmds_regexp=join("|",@commands);
+
+open(OUTPUT,">$host.new") || die "Can't open $host.new for writing: $!\n";
+select(OUTPUT);
+# make OUTPUT unbuffered if debugging
+if ($debug) { $| = 1; }
+
+if ($file) {
+ print STDERR "opening file $host\n" if ($debug);
+ print STDOUT "opening file $host\n" if ($log);
+ open(INPUT,"<$host") || die "open failed for $host: $!\n";
+} else {
+ print STDERR "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
+ print STDOUT "executing clogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
+ if (defined($ENV{NOPIPE})) {
+ system "clogin -t $timeo -c \"$cisco_cmds\" $host $host.raw 2>&1" || die "clogin failed for $host: $!\n";
+ open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
+ } else {
+ open(INPUT,"clogin -t $timeo -c \"$cisco_cmds\" $host ) {
+ tr/\015//d;
+ if (/\#\s?exit/) {
+ $clean_run=1;
+ last;
+ }
+ if (/^Error:/) {
+ print STDOUT ("$host clogin error: $_");
+ print STDERR ("$host clogin error: $_") if ($debug);
+ $clean_run=0;
+ last;
+ }
+ while (/#\s*($cmds_regexp)\s*$/) {
+ $cmd = $1;
+ if (!defined($prompt)) {$prompt = ($_ =~ /^([^#]+#)/)[0]; }
+ print STDERR ("HIT COMMAND:$_") if ($debug);
+ if (! defined($commands{$cmd})) {
+ print STDERR "$host: found unexpected command - \"$cmd\"\n";
+ # $clean_run = 0;
+ # last TOP;
+ next TOP;
+ } else {
+ $rval = &{$commands{$cmd}};
+ delete($commands{$cmd});
+ if ($rval == -1) {
+ $clean_run = 0;
+ last TOP;
+ }
+ }
+ }
+}
+print STDOUT "Done $logincmd: $_\n" if ($log);
+# Flush History
+ProcessHistory("","","","");
+# Cleanup
+close(INPUT);
+close(OUTPUT);
+
+if (defined($ENV{NOPIPE})) {
+ unlink("$host.raw") if (! $debug);
+}
+
+# check for completeness
+if (scalar(%commands) || !$clean_run || !$found_end) {
+ if (scalar(%commands)) {
+ printf(STDOUT "$host: missed cmd(s): %s\n", join(',', keys(%commands)));
+ printf(STDERR "$host: missed cmd(s): %s\n", join(',', keys(%commands))) if ($debug);
+ }
+ if (!$clean_run || !$found_end) {
+ print STDOUT "$host: End of run not found\n";
+ print STDERR "$host: End of run not found\n" if ($debug);
+ system("/usr/bin/tail -1 $host.new");
+ }
+ unlink "$host.new" if (! $debug);
+}
diff --git a/bin/do-diffs.in b/bin/do-diffs.in
deleted file mode 100755
index 874007c..0000000
--- a/bin/do-diffs.in
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/bin/sh
-## Copyright (C) 1997-2001 by Henry Kilmer.
-## All rights reserved.
-##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
-##
-## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
-## responsibility and liability with respect to this software's usage
-## or its effect upon hardware, computer systems, other software, or
-## anything else.
-##
-# do diffs for each of the diff groups ($LIST_OF_GROUPS) from /bin/env
-##
-
-ENVFILE="`dirname $0`/env"
-
-. $ENVFILE
-
-TMPDIR=${TMPDIR:=/tmp}; export TMPDIR
-
-# control_rancid argv
-CR_ARGV=""; export CR_ARGV
-
-# print a usage message to stderr
-pr_usage() {
- echo "usage: $0 [-r device_name] [-m mail rcpt] [group [group ...]]" >&2;
-}
-
-# command-line options
-# -r
-if [ $# -ge 1 ] ; then
-
- while [ 1 ] ; do
- case $1 in
- -r)
- shift
- # next arg is the device name
- CR_ARGV="$CR_ARGV -r $1"; export CR_ARGV
- shift
- ;;
- -m)
- shift
- # next arg is the mailto name
- CR_ARGV="$CR_ARGV -m $1"; export CR_ARGV
- shift
- ;;
- --)
- shift; break;
- ;;
- -h)
- pr_usage
- exit
- ;;
- -*)
- echo "unknown option: $1" >&2
- pr_usage
- exit 1
- ;;
- *)
- break;
- ;;
- esac
- done
-fi
-
-if [ $# -ge 1 ] ; then
- LIST_OF_GROUPS="$*"; export LIST_OF_GROUPS
-elif [ "$LIST_OF_GROUPS" = "" ] ; then
- echo "LIST_OF_GROUPS is empty in $ENVFILE"
- exit 1
-fi
-
-if [ ! -d $BASEDIR/logs ] ; then
- mkdir $BASEDIR/logs
-fi
-
-for GROUP in $LIST_OF_GROUPS
-do
-
- LOCKFILE=$TMPDIR/.$GROUP.run.lock
-
- (
- echo starting: `date`
- echo
-
- if [ -f $LOCKFILE ]
- then
- echo hourly config diffs failed: $LOCKFILE exists
- ls -l $LOCKFILE
-
- # Send email if the lock file is old.
- if [ "X$LOCKTIME" = "X" ] ; then
- LOCKTIME=4
- fi
- @PERLV@ -e "\$t = (stat(\"$LOCKFILE\"))[9]; print \"OLD\\n\" if (time() - \$t >= $LOCKTIME*60*60);" > $TMPDIR/.$GROUP.old
- if [ -s $TMPDIR/.$GROUP.old ]
- then
- (
- echo "To: @MAILPLUS@admin-$GROUP"
- echo "Subject: rancid hung - $GROUP"
- echo "Precedence: bulk"
- echo ""
-
- cat <$BASEDIR/logs/$GROUP.`date +%Y%m%d.%H%M%S` 2>&1
-done
diff --git a/bin/elogin.in b/bin/elogin.in
old mode 100755
new mode 100644
index 1b647fa..651d7fb
--- a/bin/elogin.in
+++ b/bin/elogin.in
@@ -1,19 +1,22 @@
-#!@EXPECT_PATH@ --
+#! @EXPECT_PATH@ --
##
+## $Id: elogin.in,v 1.27 2004/01/11 05:39:15 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer, Erik Sherk and Pete Whiting.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
# elogin - ADC EZT3 login
@@ -38,8 +41,9 @@ set do_command 0
set do_script 0
# The default is to automatically enable
set enable 1
-# The default is that you login non-enabled (tacacs can have you login already enabled)
-set autoenable 0
+# 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
@@ -49,6 +53,8 @@ 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 -
@@ -101,7 +107,7 @@ for {set i 0} {$i < $argc} {incr i} {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
- send_user "Error: invalid format for -E in $arg\n"
+ send_user "\nError: invalid format for -E in $arg\n"
exit 1
}
# Enable Password
@@ -166,10 +172,10 @@ for {set i 0} {$i < $argc} {incr i} {
set do_command 1
# Do we enable?
} -noenable {
- # ignore -noenable
+ # ignore -noenable
# Does tacacs automatically enable us?
} -autoenable {
- # ignore -autoenable
+ # ignore -autoenable
} -* {
send_user "\nError: Unknown argument! $arg\n"
send_user $usage
@@ -406,17 +412,17 @@ foreach router [lrange $argv $i end] {
# Figure out prompt.
set prompt "Active) > "
- set autoenable 1
- set enable 0
+ set autoenable 1
+ set enable 0
# Figure out passwords
if { $do_passwd } {
set pswd [find password $router]
if { [llength $pswd] == 0 } {
- send_user "Error: no password for $router in $password_file.\n"
+ send_user "\nError: no password for $router in $password_file.\n"
continue
}
- set passwd [lindex $pswd 0]
+ set passwd [join [lindex $pswd 0] ""]
}
# Figure out username
@@ -424,7 +430,7 @@ foreach router [lrange $argv $i end] {
# command line username
set ruser $username
} else {
- set ruser [find user $router]
+ set ruser [join [find user $router] ""]
if { "$ruser" == "" } { set ruser $default_user }
}
@@ -433,7 +439,7 @@ foreach router [lrange $argv $i end] {
# command line username
set userpswd $userpasswd
} else {
- set userpswd [find userpassword $router]
+ set userpswd [join [find userpassword $router] ""]
if { "$userpswd" == "" } { set userpswd $passwd }
}
@@ -442,13 +448,13 @@ foreach router [lrange $argv $i end] {
if { "$u_prompt" == "" } {
set u_prompt "(Username|login| Login):"
} else {
- set u_prompt [lindex $u_prompt 0]
+ set u_prompt [join [lindex $u_prompt 0] ""]
}
set p_prompt [find passprompt $router]
if { "$p_prompt" == "" } {
set p_prompt "\[Pp]assword:"
} else {
- set p_prompt [lindex $p_prompt 0]
+ set p_prompt [join [lindex $p_prompt 0] ""]
}
# Figure out cypher type
diff --git a/bin/env.in b/bin/env.in
deleted file mode 100644
index e3c2ba4..0000000
--- a/bin/env.in
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# This file setups up the environment used for rancid. see env(5)
-#
-# This will be site specific
-#
-TERM=network;export TERM
-#
-# Under $BASEDIR, there will be a bin directory for the rancid programs,
-# a log directory for the logs from rancid and a directory for each group
-# of routers (LIST_OF_GROUPS). In addition to these directories, there
-# will be the CVS repositories as well.
-# use a full path (no sym-links) for BASEDIR. some versions of CVS seemingly
-# don't take kindly to sym-links.
-#
-TMPDIR=/tmp; export TMPDIR
-BASEDIR=@prefix@; export BASEDIR
-PATH=$BASEDIR/bin:@ENV_PATH@; export PATH
-CVSROOT=$BASEDIR/CVS; export CVSROOT
-#
-# if NOPIPE is set, temp files will be used instead of a cmd pipe during
-# collection from the router(s).
-#NOPIPE=YES; export NOPIPE
-#
-# FILTER_PWDS determines which passwords are filtered from configs by the
-# value set (NO | YES | ALL). see env(5).
-#FILTER_PWDS=YES; export FILTER_PWDS
-#
-# if NOCOMMSTR is set, snmp community strings will be stripped from the configs
-#NOCOMMSTR=YES; export NOCOMMSTR
-#
-# How many hours to go by before complaining about routers that
-# can not be reached. The value should be greater than the number
-# of hours between your do-diffs cron job.
-OLDTIME=4; export OLDTIME
-#
-# The number of devices to collect simultaneously.
-#PAR_COUNT=5; export PAR_COUNT
-#
-# list of rancid groups
-LIST_OF_GROUPS="sl joebobisp"
-#
-# For each group, define a list of people to receive the diffs.
-# in sendmail's /etc/aliases.
-# rancid-group: joe,moe@foo
-# rancid-group-admin: hostmaster
-# be sure to read ../README regarding aliases.
-#
-umask 027
diff --git a/bin/erancid.in b/bin/erancid.in
old mode 100755
new mode 100644
index 01a6268..20da43d
--- a/bin/erancid.in
+++ b/bin/erancid.in
@@ -1,22 +1,22 @@
-#!@PERLV_PATH@
+#! @PERLV_PATH@
##
-## Hacked version of rancid for ADC EZT3 series muxes. Only tested
-## with switch software 1.50 so far - terry@tmk.com
+## $Id: erancid.in,v 1.18 2004/01/11 03:49:13 heas Exp $
##
-##
-## Copyright (C) 1997-2001 by Henry Kilmer.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
# RANCID - Really Awesome New Cisco confIg Differ
@@ -24,7 +24,7 @@
# usage: rancid [-d] [-l] [-f filename | $host]
#
use Getopt::Std;
-getopts('dflm');
+getopts('dfl');
$log = $opt_l;
$debug = $opt_d;
$file = $opt_f;
@@ -268,7 +268,8 @@ while() {
$cmd = $1;
if (!defined($prompt)) {
$prompt = ($_ =~ /^([^#]+#)/)[0];
- $prompt =~ s/([}{)(\\])/\\$1/g;
+ $prompt =~ s/([][}{)(\\])/\\$1/g;
+ print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
}
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
diff --git a/bin/f10rancid.in b/bin/f10rancid.in
old mode 100755
new mode 100644
index 06528c5..2c4e485
--- a/bin/f10rancid.in
+++ b/bin/f10rancid.in
@@ -1,28 +1,32 @@
-#!@PERLV_PATH@
+#! @PERLV_PATH@
##
-## This version of rancid tries to deal with Force10s.
+## $Id: f10rancid.in,v 1.11 2004/01/11 03:49:13 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
+# This version of rancid tries to deal with Force10s.
+#
# RANCID - Really Awesome New Cisco confIg Differ
#
# usage: rancid [-d] [-l] [-f filename | $host]
#
use Getopt::Std;
-getopts('dflm');
+getopts('dfl');
$log = $opt_l;
$debug = $opt_d;
$file = $opt_f;
@@ -139,7 +143,6 @@ sub ShowVersion {
while () {
tr/\015//d;
- study;
last if(/^$prompt/);
next if(/^(\s*|\s*$cmd\s*)$/);
return(-1) if (/command authorization failed/i);
@@ -479,7 +482,6 @@ sub ShowContAll {
while () {
tr/\015//d;
- study;
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
# return(1) if ($type =~ /^(12[40]|7[05])/);
@@ -583,7 +585,6 @@ sub ShowDiagbus {
while () {
tr/\015//d;
- study;
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
#return(1) if ($type !~ /^7[05]/);
@@ -670,7 +671,6 @@ sub ShowDiag {
while () {
tr/\015//d;
- study;
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
# return(1) if ($type !~ /^(12[40]|720|36|26)/);
@@ -882,7 +882,6 @@ sub WriteTerm {
while () {
tr/\015//d;
- study;
last if(/^$prompt/);
return(-1) if (/command authorization failed/i);
# the pager can not be disabled per-session on the PIX
@@ -1216,7 +1215,11 @@ TOP: while() {
}
while (/#\s*($cmds_regexp)\s*$/) {
$cmd = $1;
- if (!defined($prompt)) {$prompt = ($_ =~ /^([^#]+#)/)[0]; }
+ if (!defined($prompt)) {
+ $prompt = ($_ =~ /^([^#]+#)/)[0];
+ $prompt =~ s/([][}{)(\\])/\\$1/g;
+ print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
+ }
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
print STDERR "$host: found unexpected command - \"$cmd\"\n";
diff --git a/bin/flogin.in b/bin/flogin.in
old mode 100755
new mode 100644
index 1a34068..169e522
--- a/bin/flogin.in
+++ b/bin/flogin.in
@@ -1,21 +1,26 @@
-#!@EXPECT_PATH@ --
+#! @EXPECT_PATH@ --
##
+## $Id: flogin.in,v 1.32 2004/01/11 05:39:15 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer, Erik Sherk and Pete Whiting.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
-##
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
+##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
+# The login expect scripts were based on Erik Sherk's gwtn, by permission.
+#
# flogin - foundry login
#
# Most options are intuitive for logging into a foundry switch.
@@ -46,8 +51,9 @@ set do_command 0
set do_script 0
# The default is to automatically enable
set enable 1
-# The default is that you login non-enabled (tacacs can have you login already enabled)
-set autoenable 0
+# 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
@@ -58,6 +64,8 @@ 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 -
@@ -113,7 +121,7 @@ for {set i 0} {$i < $argc} {incr i} {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
- send_user "Error: invalid format for -E in $arg\n"
+ send_user "\nError: invalid format for -E in $arg\n"
exit 1
}
# Enable Password
@@ -181,7 +189,7 @@ for {set i 0} {$i < $argc} {incr i} {
set enable 0
# Does tacacs automatically enable us?
} -autoenable {
- set autoenable 1
+ set avautoenable 1
set enable 0
} -* {
send_user "\nError: Unknown argument! $arg\n"
@@ -277,7 +285,7 @@ proc source_password_file { password_file } {
# Log into the router.
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
+ global prompt u_prompt p_prompt e_prompt sshcmd
set in_proc 1
set uprompt_seen 0
@@ -296,8 +304,8 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
exit 1
}
} elseif ![string compare $prog "ssh"] {
- if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] {
- send_user "\nError: ssh failed: $reason\n"
+ 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"] {
@@ -341,24 +349,39 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
# then it will just send the passwd.
# if telnet fails with connection refused, try ssh
expect {
- -re "(Connection refused|Secure connection \[^\n\r]+ refused|Connection closed by|Telnet server disabled)" {
+ -re "(Connection refused|Secure connection \[^\n\r]+ refused)" {
+ catch {close}; wait
+ 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 Refused ($prog)\n"; return 1
+ send_user "\nError: Connection closed ($prog): $router\n"
+ return 1
+ }
+ }
+ -re "Telnet server disabled" {
+ catch {close}; wait
+ if !$progs {
+ send_user "\nError: Connection Refused ($prog): $router\n"
+ return 1
}
}
eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
-nocase "unknown host\r" {
catch {close};
- send_user "\nError: Unknown host\n"; wait; return 1
+ send_user "\nError: Unknown host $router\n"; wait; return 1
}
"Host is unreachable" {
catch {close};
- send_user "\nError: Host Unreachable!\n"; wait; return 1
+ send_user "\nError: Host Unreachable: $router\n"; wait; return 1
}
"No address associated with name" {
catch {close};
- send_user "\nError: Unknown host\n"; wait; return 1
+ send_user "\nError: Unknown host $router\n"; wait; return 1
}
-re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
send "yes\r"
@@ -406,7 +429,7 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
}
"$prompt" { break; }
"Login invalid" {
- send_user "\nError: Invalid login\n";
+ send_user "\nError: Invalid login: $router\n";
catch {close}; wait; return 1
}
}
@@ -432,6 +455,10 @@ proc do_enable { enauser enapasswd } {
denied { send_user "\nError: Check your Enable passwd\n";
return 1
}
+ "Incorrect username or password" {
+ send_user "\nError: Check your Enable passwd\n";
+ return 1
+ }
"% Bad passwords" { send_user "\nError: Check your Enable passwd\n";
return 1
}
@@ -496,7 +523,9 @@ foreach router [lrange $argv $i end] {
# 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.
- if $autoenable {
+ if $avautoenable {
+ set autoenable 1
+ set enable 0
set prompt "#"
} else {
set ae [find autoenable $router]
@@ -514,15 +543,15 @@ foreach router [lrange $argv $i end] {
if { $do_passwd || $do_enapasswd } {
set pswd [find password $router]
if { [llength $pswd] == 0 } {
- send_user "Error: no password for $router in $password_file.\n"
+ send_user "\nError: no password for $router in $password_file.\n"
continue
}
if { $enable && $do_enapasswd && $autoenable == 0 && [llength $pswd] < 2 } {
- send_user "Error: no enable password for $router in $password_file.\n"
+ send_user "\nError: no enable password for $router in $password_file.\n"
continue
}
- set passwd [lindex $pswd 0]
- set enapasswd [lindex $pswd 1]
+ set passwd [join [lindex $pswd 0] ""]
+ set enapasswd [join [lindex $pswd 1] ""]
}
# Figure out username
@@ -530,7 +559,7 @@ foreach router [lrange $argv $i end] {
# command line username
set ruser $username
} else {
- set ruser [find user $router]
+ set ruser [join [find user $router] ""]
if { "$ruser" == "" } { set ruser $default_user }
}
@@ -539,7 +568,7 @@ foreach router [lrange $argv $i end] {
# command line username
set userpswd $userpasswd
} else {
- set userpswd [find userpassword $router]
+ set userpswd [join [find userpassword $router] ""]
if { "$userpswd" == "" } { set userpswd $passwd }
}
@@ -548,7 +577,7 @@ foreach router [lrange $argv $i end] {
# command line enausername
set enauser $enausername
} else {
- set enauser [find enauser $router]
+ set enauser [join [find enauser $router] ""]
if { "$enauser" == "" } { set enauser $ruser }
}
@@ -557,19 +586,19 @@ foreach router [lrange $argv $i end] {
if { "$u_prompt" == "" } {
set u_prompt "(Username|login|Name|User Name):"
} else {
- set u_prompt [lindex $u_prompt 0]
+ set u_prompt [join [lindex $u_prompt 0] ""]
}
set p_prompt [find passprompt $router]
if { "$p_prompt" == "" } {
set p_prompt "(\[Pp]assword):"
} else {
- set p_prompt [lindex $p_prompt 0]
+ set p_prompt [join [lindex $p_prompt 0] ""]
}
set e_prompt [find enableprompt $router]
if { "$e_prompt" == "" } {
set e_prompt "\[Pp]assword:"
} else {
- set e_prompt [lindex $e_prompt 0]
+ set e_prompt [join [lindex $e_prompt 0] ""]
}
# Figure out cypher tpye
@@ -585,6 +614,10 @@ 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} }
+
# Login to the router
if {[login $router $ruser $userpswd $passwd $enapasswd $cmethod $cyphertype]} {
continue
diff --git a/bin/fnrancid.in b/bin/fnrancid.in
new file mode 100644
index 0000000..815227b
--- /dev/null
+++ b/bin/fnrancid.in
@@ -0,0 +1,275 @@
+#! @PERLV_PATH@
+##
+## $Id: fnrancid.in,v 1.3 2004/01/11 03:49:13 heas Exp $
+##
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
+## All rights reserved.
+##
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
+##
+## There is no warranty or other guarantee of fitness of this software.
+## It is provided solely "as is". The author(s) disclaim(s) all
+## responsibility and liability with respect to this software's usage
+## or its effect upon hardware, computer systems, other software, or
+## anything else.
+##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+##
+#
+# A library built on Stephen Gill's Netscreen stuff to accomodate
+# the Fortinet product line. [d_pfleger@juniper.net]
+#
+# RANCID - Really Awesome New Cisco confIg Differ
+#
+# usage: rancid [-d] [-l] [-f filename | $host]
+#
+use Getopt::Std;
+getopts('dfl');
+$log = $opt_l;
+$debug = $opt_d;
+#$debug = 1;
+$file = $opt_f;
+$host = $ARGV[0];
+$found_end = 0;
+$timeo = 90; # nlogin timeout in seconds
+
+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) {
+ print eval "$command \%history";
+ undef %history;
+ }
+ if (($new_hist_tag) && ($new_command) && ($command_string)) {
+ if ($history{$command_string}) {
+ $history{$command_string} = "$history{$command_string}@string";
+ } else {
+ $history{$command_string} = "@string";
+ }
+ } elsif (($new_hist_tag) && ($new_command)) {
+ $history{++$#history} = "@string";
+ } else {
+ print "@string";
+ }
+ $hist_tag = $new_hist_tag;
+ $command = $new_command;
+ 1;
+}
+
+sub numerically { $a <=> $b; }
+
+# This is a sort routing that will sort numerically on the
+# keys of a hash as if it were a normal array.
+sub keynsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort numerically keys(%lines)) {
+ $sorted_lines[$i] = $lines{$key};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a sort routing that will sort on the
+# keys of a hash as if it were a normal array.
+sub keysort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort keys(%lines)) {
+ $sorted_lines[$i] = $lines{$key};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a sort routing that will sort on the
+# values of a hash as if it were a normal array.
+sub valsort{
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort values %lines) {
+ $sorted_lines[$i] = $key;
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a numerical sort routing (ascending).
+sub numsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $num (sort {$a <=> $b} keys %lines) {
+ $sorted_lines[$i] = $lines{$num};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a sort routine that will sort on the
+# ip address when the ip address is anywhere in
+# the strings.
+sub ipsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $addr (sort sortbyipaddr keys %lines) {
+ $sorted_lines[$i] = $lines{$addr};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# 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]));
+}
+sub sortbyipaddr {
+ &ipaddrval($a) <=> &ipaddrval($b);
+}
+
+# This routine parses "get system"
+sub GetSystem {
+ print STDERR " In GetSystem: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ next if /^\s*$/;
+ last if(/$prompt/);
+ ProcessHistory("","","","$_");
+ #print STDOUT "$_";
+ }
+ print STDOUT "Vendor: $vendor";
+ ProcessHistory("SYSTEM","","","\n");
+ return(0);
+}
+
+sub GetFile {
+ print STDERR " In GetFile: $_" if ($debug);
+ while () {
+ last if(/$prompt/);
+ }
+ ProcessHistory("FILE","","","\n");
+ return(0);
+}
+
+sub GetConf {
+ print STDERR " In GetConf: $_" if ($debug);
+ while () {
+ tr/\015//d;
+ next if /^\s*$/;
+ last if(/$prompt/);
+ if (/(^set.*)('Enc .*')(.*)/) {
+ ProcessHistory("ENC","","","!$1 'Enc **encoding removed**' $3\n");
+ next;
+ }
+ ProcessHistory("","","","$_");
+ #print STDOUT "$_";
+ }
+ $found_end=1;
+ return(1);
+}
+
+# dummy function
+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"
+);
+$cisco_cmds=join(";",@commands);
+$cmds_regexp=join("|",@commands);
+
+open(OUTPUT,">$host.new") || die "Can't open $host.new for writing: $!\n";
+select(OUTPUT);
+# make OUTPUT unbuffered if debugging
+if ($debug) { $| = 1; }
+
+if ($file) {
+ print STDERR "opening file $host\n" if ($debug);
+ print STDOUT "opening file $host\n" if ($log);
+ open(INPUT,"<$host") || die "open failed for $host: $!\n"; } else {
+ print STDERR "executing nlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
+ print STDOUT "executing nlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
+ if (defined($ENV{NOPIPE})) {
+ system "nlogin -t $timeo -c \"$cisco_cmds\" $host $host.raw 2>&1" || die "nlogin failed for $host: $!\n";
+ open(INPUT, "< $host.raw") || die "nlogin failed for $host: $!\n";
+ } else {
+ open(INPUT,"nlogin -t $timeo -c \"$cisco_cmds\" $host ) {
+ tr/\015//d;
+ if (/^Error:/) {
+ print STDOUT ("$host nlogin error: $_");
+ print STDERR ("$host nlogin error: $_") if ($debug);
+ last;
+ }
+ while (/>\s*($cmds_regexp)\s*$/) {
+ $cmd = $1;
+ if (!defined($prompt)) { $prompt = " >\s*"; }
+ print STDERR ("HIT COMMAND:$_") if ($debug);
+ if (!defined($commands{$cmd})) {
+ print STDERR "$host: found unexpected command - \"$cmd\"\n";
+ last TOP;
+ }
+ $rval = &{$commands{$cmd}};
+ delete($commands{$cmd});
+ if ($rval == -1) {
+ last TOP;
+ }
+ }
+}
+print STDOUT "Done $logincmd: $_\n" if ($log);
+# Flush History
+ProcessHistory("","","","");
+# Cleanup
+close(INPUT);
+close(OUTPUT);
+
+if (defined($ENV{NOPIPE})) {
+ unlink("$host.raw") if (! $debug);
+}
+
+# check for completeness
+if (scalar(%commands) || !$found_end) {
+ if (scalar(%commands)) {
+ printf(STDOUT "$host: missed cmd(s): %s\n", join(',', keys(%commands)));
+ printf(STDERR "$host: missed cmd(s): %s\n", join(',', keys(%commands))) if ($debug);
+ }
+ if (!$found_end) {
+ print STDOUT "$found_end: found end\n";
+ print STDOUT "$host: End of run not found\n";
+ print STDERR "$host: End of run not found\n" if ($debug);
+ system("/usr/bin/tail -1 $host.new");
+ }
+ unlink "$host.new" if (! $debug);
+}
diff --git a/bin/francid.in b/bin/francid.in
old mode 100755
new mode 100644
index b03052e..e1fd284
--- a/bin/francid.in
+++ b/bin/francid.in
@@ -1,29 +1,33 @@
-#!@PERLV_PATH@
+#! @PERLV_PATH@
##
-## Amazingly hacked version of Hank's rancid - this one tries to
-## deal with foundrys and foundrys OEM'd by HP as Procurves.
+## $Id: francid.in,v 1.26 2004/01/11 03:49:13 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
+# Amazingly hacked version of Hank's rancid - this one tries to
+# deal with foundrys and foundrys OEM'd by HP as Procurves.
+#
# RANCID - Really Awesome New Cisco confIg Differ
#
# usage: rancid [-d] [-l] [-f filename | $host]
#
use Getopt::Std;
-getopts('dflm');
+getopts('dfl');
$log = $opt_l;
$debug = $opt_d;
$file = $opt_f;
@@ -376,7 +380,8 @@ TOP: while() {
$cmd = $1;
if (!defined($prompt)) {
$prompt = ($_ =~ /^([^#]+#)/)[0];
- $prompt =~ s/([}{)(\\])/\\$1/g;
+ $prompt =~ s/([][}{)(\\])/\\$1/g;
+ print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
}
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
diff --git a/bin/hlogin.in b/bin/hlogin.in
old mode 100755
new mode 100644
index 917ea83..6af11b4
--- a/bin/hlogin.in
+++ b/bin/hlogin.in
@@ -1,21 +1,26 @@
-#!@EXPECT_PATH@ --
+#! @EXPECT_PATH@ --
##
+## $Id: hlogin.in,v 1.21 2004/01/11 05:39:15 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer, Erik Sherk and Pete Whiting.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
+# The login expect scripts were based on Erik Sherk's gwtn, by permission.
+#
# hlogin - hp login
#
# Most options are intuitive for logging into a Cisco router.
@@ -43,8 +48,9 @@ set do_command 0
set do_script 0
# The default is to automatically enable
set enable 1
-# The default is that you login non-enabled (tacacs can have you login already enabled)
-set autoenable 0
+# 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
@@ -57,6 +63,8 @@ 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 -
@@ -112,7 +120,7 @@ for {set i 0} {$i < $argc} {incr i} {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
- send_user "Error: invalid format for -E in $arg\n"
+ send_user "\nError: invalid format for -E in $arg\n"
exit 1
}
# Enable Password
@@ -281,30 +289,35 @@ proc source_password_file { password_file } {
# Log into the router.
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
+ global prompt u_prompt p_prompt e_prompt sshcmd
set in_proc 1
# try each of the connection methods in $cmethod until one is successful
set progs [llength $cmethod]
foreach prog [lrange $cmethod 0 end] {
+ regexp {(telnet|ssh)(:([^[:space:]]+))*} $prog command suffix junk port
if [string match "telnet*" $prog] {
- regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
if {"$port" == ""} {
- set retval [ catch {spawn hpfilter telnet $router} reason ]
+ set retval [ catch {spawn hpuifilter telnet $router} reason ]
} else {
- set retval [ catch {spawn hpfilter telnet $router $port} reason ]
+ set retval [ catch {spawn hpuifilter telnet $router $port} reason ]
}
if { $retval } {
send_user "\nError: telnet failed: $reason\n"
exit 1
}
- } elseif ![string compare $prog "ssh"] {
- if [ catch {spawn hpfilter ssh -c $cyphertype -x -l $user $router} reason ] {
- send_user "\nError: ssh failed: $reason\n"
+ } elseif [string match "ssh*" $prog] {
+ if {"$port" == ""} {
+ set retval [ catch {spawn hpuifilter $sshcmd -c $cyphertype -x -l $user $router} reason ]
+ } else {
+ set retval [ catch {spawn hpuifilter $sshcmd -c $cyphertype -p $port -x -l $user $router} reason ]
+ }
+ if { $retval } {
+ send_user "\nError: $sshcmd failed: $reason\n"
exit 1
}
} elseif ![string compare $prog "rsh"] {
- if [ catch {spawn hpfilter rsh -l $user $router} reason ] {
+ if [ catch {spawn hpuifilter rsh -l $user $router} reason ] {
send_user "\nError: rsh failed: $reason\n"
exit 1
}
@@ -353,14 +366,17 @@ proc login { router user userpswd passwd enapasswd cmethod cyphertype } {
if !$progs {
send_user "\nError: Connection Refused ($prog)\n"; return 1
}
- } eof { send_user "\nError: Couldn't login\n"; wait; return 1
- } -nocase "unknown host\r" {
+ }
+ eof { send_user "\nError: Couldn't login\n"; wait; return 1 }
+ -nocase "unknown host\r" {
catch {close};
send_user "\nError: Unknown host\n"; wait; return 1
- } "Host is unreachable" {
+ }
+ "Host is unreachable" {
catch {close};
send_user "\nError: Host Unreachable!\n"; wait; return 1
- } "No address associated with name" {
+ }
+ "No address associated with name" {
catch {close};
send_user "\nError: Unknown host\n"; wait; return 1
}
@@ -542,7 +558,9 @@ foreach router [lrange $argv $i end] {
# 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.
- if $autoenable {
+ if $avautoenable {
+ set autoenable 1
+ set enable 0
set prompt "#"
} else {
set ae [find autoenable $router]
@@ -565,15 +583,15 @@ foreach router [lrange $argv $i end] {
if { $do_passwd || $do_enapasswd } {
set pswd [find password $router]
if { [llength $pswd] == 0 } {
- send_user "Error: no password for $router in $password_file.\n"
+ send_user "\nError: no password for $router in $password_file.\n"
continue
}
if { $enable && $do_enapasswd && $autoenable == 0 && [llength $pswd] < 2 } {
- send_user "Error: no enable password for $router in $password_file.\n"
+ send_user "\nError: no enable password for $router in $password_file.\n"
continue
}
- set passwd [lindex $pswd 0]
- set enapasswd [lindex $pswd 1]
+ set passwd [join [lindex $pswd 0] ""]
+ set enapasswd [join [lindex $pswd 1] ""]
}
# Figure out username
@@ -581,7 +599,7 @@ foreach router [lrange $argv $i end] {
# command line username
set ruser $username
} else {
- set ruser [find user $router]
+ set ruser [join [find user $router] ""]
if { "$ruser" == "" } { set ruser $default_user }
}
@@ -590,7 +608,7 @@ foreach router [lrange $argv $i end] {
# command line username
set userpswd $userpasswd
} else {
- set userpswd [find userpassword $router]
+ set userpswd [join [find userpassword $router] ""]
if { "$userpswd" == "" } { set userpswd $passwd }
}
@@ -599,7 +617,7 @@ foreach router [lrange $argv $i end] {
# command line enausername
set enauser $enausername
} else {
- set enauser [find enauser $router]
+ set enauser [join [find enauser $router] ""]
if { "$enauser" == "" } { set enauser $ruser }
}
@@ -608,19 +626,19 @@ foreach router [lrange $argv $i end] {
if { "$u_prompt" == "" } {
set u_prompt "(Username|login|user name):"
} else {
- set u_prompt [lindex $u_prompt 0]
+ set u_prompt [join [lindex $u_prompt 0] ""]
}
set p_prompt [find passprompt $router]
if { "$p_prompt" == "" } {
set p_prompt "(\[Pp]assword|passwd):"
} else {
- set p_prompt [lindex $p_prompt 0]
+ set p_prompt [join [lindex $p_prompt 0] ""]
}
set e_prompt [find enableprompt $router]
if { "$e_prompt" == "" } {
set e_prompt "\[Pp]assword:"
} else {
- set e_prompt [lindex $e_prompt 0]
+ set e_prompt [join [lindex $e_prompt 0] ""]
}
# Figure out cypher type
@@ -636,6 +654,16 @@ 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} }
+
+ # Adjust our path to find hpuifilter
+ regexp {(.*)/[^/]+} $argv0 junk hpf_path
+ if { "$hpf_path" != "" && "$hpf_path" != "." } {
+ append env(PATH) ":$hpf_path"
+ }
+
# Login to the router
if {[login $router $ruser $userpswd $passwd $enapasswd $cmethod $cyphertype]} {
continue
diff --git a/bin/hpfilter.c b/bin/hpfilter.c
deleted file mode 100644
index 83d799e..0000000
--- a/bin/hpfilter.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Copyright (C) 1997-2002 by Henry Kilmer, Erik Sherk and Pete Whiting.
- * All rights reserved.
- *
- * This software may be freely copied, modified and redistributed without
- * fee for non-commerical purposes provided that this copyright notice is
- * preserved intact on all copies and modified copies.
- *
- * There is no warranty or other guarantee of fitness of this software.
- * It is provided solely "as is". The author(s) disclaim(s) all
- * responsibility and liability with respect to this software's usage
- * or its effect upon hardware, computer systems, other software, or
- * anything else.
- *
- *
- * run telnet or ssh to connect to device specified on the command line. the
- * point of hpfilter is to filter all the bloody vt100 (curses) escape codes
- * that the HP procurve switches belch and make hlogin a real bitch.
- */
-
-#define DFLT_TO 60 /* default timeout */
-
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-char *progname;
-int debug = 0;
-
-int filter __P((char *, int));
-void usage __P((void));
-void vers __P((void));
-RETSIGTYPE reapchild __P((void));
-
-int
-main(int argc, char **argv)
-{
- extern char *optarg;
- extern int optind;
- char ch,
- hbuf[LINE_MAX * 2], /* hlogin buffer */
- *hbufp,
- tbuf[LINE_MAX * 2], /* telnet buffer */
- *tbufp;
- int bytes, /* bytes read/written */
- child,
- r[2], /* recv pipe */
- s[2]; /* send pipe */
- ssize_t hlen = 0, /* len of hbuf */
- tlen = 0; /* len of tbuf */
- struct timeval to = { DFLT_TO, 0 };
- fd_set rfds, /* select() */
- wfds;
- struct termios tios;
-
- /* get just the basename() of our exec() name and strip a .* off the end */
- if ((progname = strrchr(argv[0], '/')) != NULL)
- progname += 1;
- else
- progname = argv[0];
- if (strrchr(progname, '.') != NULL)
- *(strrchr(progname, '.')) = '\0';
-
- while ((ch = getopt(argc, argv, "dhv")) != -1 )
- switch (ch) {
- case 'd':
- debug++;
- break;
- case 'v':
- vers();
- return(EX_OK);
- case 'h':
- default:
- usage();
- return(EX_USAGE);
- }
-
- if (argc - optind != 2) {
- usage();
- return(EX_USAGE);
- }
-
- /* reap our children */
- signal(SIGCHLD, (void *) reapchild);
- signal(SIGHUP, (void *) reapchild);
- signal(SIGINT, (void *) reapchild);
- signal(SIGTERM, (void *) reapchild);
-
- /* create 2 pipes for send/recv and then fork and exec telnet */
- for (child = 3; child < 10; child++)
- close(child);
- if (pipe(s) || pipe(r)) {
- fprintf(stderr, "%s: pipe() failed: %s\n", progname,
- strerror(errno));
- return(EX_TEMPFAIL);
- }
-
- /* if a tty, make it raw as the hp echos _everything_, including
- * passwords.
- */
- if (isatty(0)) {
- if (tcgetattr(0, &tios)) {
- fprintf(stderr, "%s: tcgetattr() failed: %s\n", progname,
- strerror(errno));
- return(EX_OSERR);
- }
- tios.c_lflag &= ~ECHO;
- tios.c_lflag &= ~ICANON;
-#ifdef VMIN
- tios.c_cc[VMIN] = 1;
- tios.c_cc[VTIME] = 0;
-#endif
- if (tcsetattr(0, TCSANOW, &tios)) {
- fprintf(stderr, "%s: tcsetattr() failed: %s\n", progname,
- strerror(errno));
- return(EX_OSERR);
- }
- }
-
- if ((child = fork()) == -1) {
- fprintf(stderr, "%s: fork() failed: %s\n", progname,
- strerror(errno));
- return(EX_TEMPFAIL);
- }
-
- /* zero the buffers */
- bzero(hbuf, LINE_MAX * 2);
- bzero(tbuf, LINE_MAX * 2);
-
- if (child == 0) {
- /* close the parent's side of the pipes; we write r[1], read s[0] */
- close(s[1]);
- close(r[0]);
- /* close stdin/out/err and attach them to the pipes */
- if (dup2(s[0], 0) == -1 || dup2(r[1], 1) == -1 || dup2(r[1], 2) == -1) {
- fprintf(stderr, "%s: dup2() failed: %s\n", progname,
- strerror(errno));
- return(EX_OSERR);
- }
- close(s[0]);
- close(r[1]);
- /* exec telnet */
- if (execvp(argv[optind], argv + optind)) {
- fprintf(stderr, "%s: execlp() failed: %s\n", progname,
- strerror(errno));
- return(EX_TEMPFAIL);
- }
- /* not reached */
- } else {
- /* parent */
- if (debug)
- fprintf(stderr, "child %d\n", child);
-
- /* close the child's side of the pipes; we write s[1], read r[0] */
- close(s[0]);
- close(r[1]);
-
- /* make FDs non-blocking */
- if (fcntl(s[1], F_SETFL, O_NONBLOCK) ||
- fcntl(r[0], F_SETFL, O_NONBLOCK) ||
- fcntl(0, F_SETFL, O_NONBLOCK) ||
- fcntl(1, F_SETFL, O_NONBLOCK)) {
- fprintf(stderr, "%s: fcntl(NONBLOCK) failed: %s\n", progname,
- strerror(errno));
- exit(EX_OSERR);
- }
-
- /* loop to read on stdin and r[0] */
- FD_ZERO(&rfds); FD_ZERO(&wfds);
- hbufp = hbuf; tbufp = tbuf;
-
- while (1) {
- FD_SET(0, &rfds); FD_SET(r[0], &rfds);
- /* if we have stuff in our buffer(s), we select on writes too */
- FD_ZERO(&wfds);
- if (hlen) {
- FD_SET(s[1], &wfds);
- }
- if (tlen) {
- FD_SET(1, &wfds);
- }
-
- switch (select(r[1], &rfds, &wfds, NULL, &to)) {
- case 0:
- /* timeout */
- /* HEAS: what do i do here? */
- break;
- case -1:
- switch (errno) {
- case EINTR: /* interrupted syscall */
- break;
- default:
- exit(EX_IOERR);
- }
- break;
- default:
- /* check exceptions first */
-
- /* which FD is ready? write our buffers asap. */
- /* write hbuf (stdin) -> s[1] */
- if (FD_ISSET(s[1], &wfds) && hlen) {
- if ((hlen = write(s[1], hbuf, hlen)) < 0) {
- fprintf(stderr, "%s: write() failed: %s\n", progname,
- strerror(errno));
- close(s[1]);
- } else
- strcpy(hbuf, hbuf + hlen);
-
- hlen = strlen(hbuf);
- }
- /* write tbuf -> stdout */
- if (FD_ISSET(1, &wfds) && tlen) {
- /* if there is an escape char that didnt get filter()'d,
- * we need to only write up to that point and wait for
- * the bits that complete the escape sequence
- */
- if ((tbufp = index(tbuf, 0x1b)) != NULL)
- tlen = tbufp - tbuf;
-
- if ((tlen = write(1, tbuf, tlen)) < 0) {
- fprintf(stderr, "%s: write() failed: %s\n", progname,
- strerror(errno));
- close(1);
- } else
- strcpy(tbuf, tbuf + tlen);
-
- tlen = strlen(tbuf);
- }
- if (FD_ISSET(0, &rfds)) {
- /* read stdin into hbuf */
- if (LINE_MAX * 2 - hlen > 1) {
- hlen += read(0, hbuf + hlen,
- (LINE_MAX * 2 - 1) - hlen);
- if (hlen > 0) {
- hbuf[hlen] = '\0';
- } else if (hlen == 0 || errno != EAGAIN)
- /* EOF or read error */
- close(0);
-
- hlen = strlen(hbuf);
- }
- } else if (FD_ISSET(r[0], &rfds)) {
- /* read telnet into tbuf, then filter */
- if (LINE_MAX * 2 - tlen > 1) {
- tlen += read(r[0], tbuf + tlen,
- (LINE_MAX * 2 - 1) - tlen);
- if (tlen > 0) {
- tbuf[tlen] = '\0';
- tlen = filter(tbuf, tlen);
- } else if (tlen == 0 || errno != EAGAIN)
- /* EOF or read error */
- close(r[0]);
-
- tlen = strlen(tbuf);
- }
- }
-
- break;
- }
- }
- /* close */
- close(0);
- close(1);
- close(s[1]);
- close(r[0]);
-
- }
-
- if (! kill(child, SIGQUIT))
- reapchild();
-
- return(EX_OK);
-}
-
-int
-filter(buf, len)
- char *buf;
- int len;
-{
- static regmatch_t pmatch[1];
-#define N_REG 11 /* number of regexes in reg[][] */
- static regex_t preg[N_REG];
- static char reg[N_REG][50] = { /* vt100/220 escape codes */
- "\e7\e\\[1;24r\e8", /* ds */
- "\e8", /* fs */
-
- "\e\\[2J",
- "\e\\[2K", /* kE */
-
- "\e\\[[0-9]+;[0-9]+r", /* cs */
- "\e\\[[0-9]+;[0-9]+H", /* cm */
-
- "\e\\[\\?6l",
- "\e\\[\\?7l", /* RA */
- "\e\\[\\?25h", /* ve */
- "\e\\[\\?25l", /* vi */
-
- "\eE", /* replace w/ CR */
- };
- char ebuf[256];
- size_t nmatch = 1;
- int err,
- x;
- static int init = 0;
-
- if (index(buf, 0x1b) == 0 || len == 0)
- return(len);
-
- for (x = 0; x < N_REG - 1; x++) {
- if (! init) {
- if ((err = regcomp(&preg[x], reg[x], REG_EXTENDED))) {
- regerror(err, &preg[x], ebuf, 256);
- fprintf(stderr, "%s: regex compile failed: %s\n", progname,
- ebuf);
- abort();
- }
- }
- if ((err = regexec(&preg[x], buf, nmatch, pmatch, 0))) {
- if (err != REG_NOMATCH) {
- regerror(err, &preg[x], ebuf, 256);
- fprintf(stderr, "%s: regexec failed: %s\n", progname, ebuf);
- abort();
- }
- } else {
- strcpy(buf + pmatch[0].rm_so, buf + pmatch[0].rm_eo);
- x = 0;
- }
- }
-
- /* replace \eE w/ CR NL */
- if (! init++) {
- if ((err = regcomp(&preg[N_REG - 1], reg[N_REG - 1], REG_EXTENDED))) {
- regerror(err, &preg[N_REG - 1], ebuf, 256);
- fprintf(stderr, "%s: regex compile failed: %s\n", progname,
- ebuf);
- abort();
- }
- }
- while (1)
- if ((err = regexec(&preg[N_REG - 1], buf, nmatch, pmatch, 0))) {
- if (err != REG_NOMATCH) {
- regerror(err, &preg[N_REG - 1], ebuf, 256);
- fprintf(stderr, "%s: regexec failed: %s\n", progname, ebuf);
- abort();
- } else
- break;
- } else {
- *(buf + pmatch[0].rm_so) = '\n';
- strcpy(buf + pmatch[0].rm_so + 1, buf + pmatch[0].rm_eo);
- x = 0;
- }
-
- return(strlen(buf));
-}
-
-RETSIGTYPE
-reapchild(void)
-{
- int status;
- pid_t pid;
-
- /* HEAS: 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)
-{
- fprintf(stderr,
-"usage: %s [-hv]
-", progname);
- return;
-}
-
-void
-vers(void)
-{
- fprintf(stderr,
-"%s: %s version %s
-", progname, package, version);
- return;
-}
diff --git a/bin/hpuifilter.c b/bin/hpuifilter.c
new file mode 100644
index 0000000..8f7005a
--- /dev/null
+++ b/bin/hpuifilter.c
@@ -0,0 +1,400 @@
+/*
+ * $Id: hpuifilter.c,v 1.17 2004/01/11 03:49:13 heas Exp $
+ *
+ * Copyright (C) 1997-2004 by Terrapin Communications, Inc.
+ * All rights reserved.
+ *
+ * This software may be freely copied, modified and redistributed
+ * without fee for non-commerical purposes provided that this license
+ * remains intact and unmodified with any RANCID distribution.
+ *
+ * There is no warranty or other guarantee of fitness of this software.
+ * It is provided solely "as is". The author(s) disclaim(s) all
+ * responsibility and liability with respect to this software's usage
+ * or its effect upon hardware, computer systems, other software, or
+ * anything else.
+ *
+ * Except where noted otherwise, rancid was written by and is maintained by
+ * Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+ *
+ * Run telnet or ssh to connect to device specified on the command line. The
+ * point of hpfilter is to filter all the bloody vt100 (curses) escape codes
+ * that the HP procurve switches belch out, which are a real bitch to handle
+ * in hlogin.
+ */
+
+#define DFLT_TO 60 /* default timeout */
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+char *progname;
+int debug = 0;
+
+int filter __P((char *, int));
+void usage __P((void));
+void vers __P((void));
+RETSIGTYPE reapchild __P((void));
+
+int
+main(int argc, char **argv)
+{
+ extern char *optarg;
+ extern int optind;
+ char ch,
+ hbuf[LINE_MAX * 2], /* hlogin buffer */
+ *hbufp,
+ tbuf[LINE_MAX * 2], /* telnet buffer */
+ *tbufp;
+ int bytes, /* bytes read/written */
+ child,
+ r[2], /* recv pipe */
+ s[2]; /* send pipe */
+ ssize_t hlen = 0, /* len of hbuf */
+ tlen = 0; /* len of tbuf */
+ struct timeval to = { DFLT_TO, 0 };
+ fd_set rfds, /* select() */
+ wfds;
+ struct termios tios;
+
+ /* get just the basename() of our exec() name and strip a .* off the end */
+ if ((progname = strrchr(argv[0], '/')) != NULL)
+ progname += 1;
+ else
+ progname = argv[0];
+ if (strrchr(progname, '.') != NULL)
+ *(strrchr(progname, '.')) = '\0';
+
+ while ((ch = getopt(argc, argv, "dhv")) != -1 )
+ switch (ch) {
+ case 'd':
+ debug++;
+ break;
+ case 'v':
+ vers();
+ return(EX_OK);
+ case 'h':
+ default:
+ usage();
+ return(EX_USAGE);
+ }
+
+ if (argc - optind < 2) {
+ usage();
+ return(EX_USAGE);
+ }
+
+ /* reap our children */
+ signal(SIGCHLD, (void *) reapchild);
+ signal(SIGHUP, (void *) reapchild);
+ signal(SIGINT, (void *) reapchild);
+ signal(SIGTERM, (void *) reapchild);
+
+ /* create 2 pipes for send/recv and then fork and exec telnet */
+ for (child = 3; child < 10; child++)
+ close(child);
+ if (pipe(s) || pipe(r)) {
+ fprintf(stderr, "%s: pipe() failed: %s\n", progname,
+ strerror(errno));
+ return(EX_TEMPFAIL);
+ }
+
+ /* if a tty, make it raw as the hp echos _everything_, including
+ * passwords.
+ */
+ if (isatty(0)) {
+ if (tcgetattr(0, &tios)) {
+ fprintf(stderr, "%s: tcgetattr() failed: %s\n", progname,
+ strerror(errno));
+ return(EX_OSERR);
+ }
+ tios.c_lflag &= ~ECHO;
+ tios.c_lflag &= ~ICANON;
+#ifdef VMIN
+ tios.c_cc[VMIN] = 1;
+ tios.c_cc[VTIME] = 0;
+#endif
+ if (tcsetattr(0, TCSANOW, &tios)) {
+ fprintf(stderr, "%s: tcsetattr() failed: %s\n", progname,
+ strerror(errno));
+ return(EX_OSERR);
+ }
+ }
+
+ if ((child = fork()) == -1) {
+ fprintf(stderr, "%s: fork() failed: %s\n", progname,
+ strerror(errno));
+ return(EX_TEMPFAIL);
+ }
+
+ /* zero the buffers */
+ bzero(hbuf, LINE_MAX * 2);
+ bzero(tbuf, LINE_MAX * 2);
+
+ if (child == 0) {
+ /* close the parent's side of the pipes; we write r[1], read s[0] */
+ close(s[1]);
+ close(r[0]);
+ /* close stdin/out/err and attach them to the pipes */
+ if (dup2(s[0], 0) == -1 || dup2(r[1], 1) == -1 || dup2(r[1], 2) == -1) {
+ fprintf(stderr, "%s: dup2() failed: %s\n", progname,
+ strerror(errno));
+ return(EX_OSERR);
+ }
+ close(s[0]);
+ close(r[1]);
+ /* exec telnet */
+ if (execvp(argv[optind], argv + optind)) {
+ fprintf(stderr, "%s: execlp() failed: %s\n", progname,
+ strerror(errno));
+ return(EX_TEMPFAIL);
+ }
+ /* not reached */
+ } else {
+ /* parent */
+ if (debug)
+ fprintf(stderr, "child %d\n", child);
+
+ /* close the child's side of the pipes; we write s[1], read r[0] */
+ close(s[0]);
+ close(r[1]);
+
+ /* make FDs non-blocking */
+ if (fcntl(s[1], F_SETFL, O_NONBLOCK) ||
+ fcntl(r[0], F_SETFL, O_NONBLOCK) ||
+ fcntl(0, F_SETFL, O_NONBLOCK) ||
+ fcntl(1, F_SETFL, O_NONBLOCK)) {
+ fprintf(stderr, "%s: fcntl(NONBLOCK) failed: %s\n", progname,
+ strerror(errno));
+ exit(EX_OSERR);
+ }
+
+ /* loop to read on stdin and r[0] */
+ FD_ZERO(&rfds); FD_ZERO(&wfds);
+ hbufp = hbuf; tbufp = tbuf;
+
+ while (1) {
+ FD_SET(0, &rfds); FD_SET(r[0], &rfds);
+ /* if we have stuff in our buffer(s), we select on writes too */
+ FD_ZERO(&wfds);
+ if (hlen) {
+ FD_SET(s[1], &wfds);
+ }
+ if (tlen) {
+ FD_SET(1, &wfds);
+ }
+
+ switch (select(r[1], &rfds, &wfds, NULL, &to)) {
+ case 0:
+ /* timeout */
+ /* HEAS: what do i do here? */
+ break;
+ case -1:
+ switch (errno) {
+ case EINTR: /* interrupted syscall */
+ break;
+ default:
+ exit(EX_IOERR);
+ }
+ break;
+ default:
+ /* check exceptions first */
+
+ /* which FD is ready? write our buffers asap. */
+ /* write hbuf (stdin) -> s[1] */
+ if (FD_ISSET(s[1], &wfds) && hlen) {
+ if ((hlen = write(s[1], hbuf, hlen)) < 0) {
+ fprintf(stderr, "%s: write() failed: %s\n", progname,
+ strerror(errno));
+ close(s[1]);
+ } else
+ strcpy(hbuf, hbuf + hlen);
+
+ hlen = strlen(hbuf);
+ }
+ /* write tbuf -> stdout */
+ if (FD_ISSET(1, &wfds) && tlen) {
+ /* if there is an escape char that didnt get filter()'d,
+ * we need to only write up to that point and wait for
+ * the bits that complete the escape sequence
+ */
+ if ((tbufp = index(tbuf, 0x1b)) != NULL)
+ tlen = tbufp - tbuf;
+
+ if ((tlen = write(1, tbuf, tlen)) < 0) {
+ fprintf(stderr, "%s: write() failed: %s\n", progname,
+ strerror(errno));
+ close(1);
+ } else
+ strcpy(tbuf, tbuf + tlen);
+
+ tlen = strlen(tbuf);
+ }
+ if (FD_ISSET(0, &rfds)) {
+ /* read stdin into hbuf */
+ if (LINE_MAX * 2 - hlen > 1) {
+ hlen += read(0, hbuf + hlen,
+ (LINE_MAX * 2 - 1) - hlen);
+ if (hlen > 0) {
+ hbuf[hlen] = '\0';
+ } else if (hlen == 0 || errno != EAGAIN)
+ /* EOF or read error */
+ close(0);
+
+ hlen = strlen(hbuf);
+ }
+ } else if (FD_ISSET(r[0], &rfds)) {
+ /* read telnet into tbuf, then filter */
+ if (LINE_MAX * 2 - tlen > 1) {
+ tlen += read(r[0], tbuf + tlen,
+ (LINE_MAX * 2 - 1) - tlen);
+ if (tlen > 0) {
+ tbuf[tlen] = '\0';
+ tlen = filter(tbuf, tlen);
+ } else if (tlen == 0 || errno != EAGAIN)
+ /* EOF or read error */
+ close(r[0]);
+
+ tlen = strlen(tbuf);
+ }
+ }
+
+ break;
+ }
+ }
+ /* close */
+ close(0);
+ close(1);
+ close(s[1]);
+ close(r[0]);
+
+ }
+
+ if (! kill(child, SIGQUIT))
+ reapchild();
+
+ return(EX_OK);
+}
+
+int
+filter(buf, len)
+ char *buf;
+ int len;
+{
+ static regmatch_t pmatch[1];
+#define N_REG 11 /* number of regexes in reg[][] */
+ static regex_t preg[N_REG];
+ static char reg[N_REG][50] = { /* vt100/220 escape codes */
+ "\e7\e\\[1;24r\e8", /* ds */
+ "\e8", /* fs */
+
+ "\e\\[2J",
+ "\e\\[2K", /* kE */
+
+ "\e\\[[0-9]+;[0-9]+r", /* cs */
+ "\e\\[[0-9]+;[0-9]+H", /* cm */
+
+ "\e\\[\\?6l",
+ "\e\\[\\?7l", /* RA */
+ "\e\\[\\?25h", /* ve */
+ "\e\\[\\?25l", /* vi */
+
+ "\eE", /* replace w/ CR */
+ };
+ char ebuf[256];
+ size_t nmatch = 1;
+ int err,
+ x;
+ static int init = 0;
+
+ if (index(buf, 0x1b) == 0 || len == 0)
+ return(len);
+
+ for (x = 0; x < N_REG - 1; x++) {
+ if (! init) {
+ if ((err = regcomp(&preg[x], reg[x], REG_EXTENDED))) {
+ regerror(err, &preg[x], ebuf, 256);
+ fprintf(stderr, "%s: regex compile failed: %s\n", progname,
+ ebuf);
+ abort();
+ }
+ }
+ if ((err = regexec(&preg[x], buf, nmatch, pmatch, 0))) {
+ if (err != REG_NOMATCH) {
+ regerror(err, &preg[x], ebuf, 256);
+ fprintf(stderr, "%s: regexec failed: %s\n", progname, ebuf);
+ abort();
+ }
+ } else {
+ strcpy(buf + pmatch[0].rm_so, buf + pmatch[0].rm_eo);
+ x = 0;
+ }
+ }
+
+ /* replace \eE w/ CR NL */
+ if (! init++) {
+ if ((err = regcomp(&preg[N_REG - 1], reg[N_REG - 1], REG_EXTENDED))) {
+ regerror(err, &preg[N_REG - 1], ebuf, 256);
+ fprintf(stderr, "%s: regex compile failed: %s\n", progname,
+ ebuf);
+ abort();
+ }
+ }
+ while (1)
+ if ((err = regexec(&preg[N_REG - 1], buf, nmatch, pmatch, 0))) {
+ if (err != REG_NOMATCH) {
+ regerror(err, &preg[N_REG - 1], ebuf, 256);
+ fprintf(stderr, "%s: regexec failed: %s\n", progname, ebuf);
+ abort();
+ } else
+ break;
+ } else {
+ *(buf + pmatch[0].rm_so) = '\n';
+ strcpy(buf + pmatch[0].rm_so + 1, buf + pmatch[0].rm_eo);
+ x = 0;
+ }
+
+ return(strlen(buf));
+}
+
+RETSIGTYPE
+reapchild(void)
+{
+ int status;
+ pid_t pid;
+
+ /* HEAS: 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)
+{
+ fprintf(stderr,
+"usage: %s [-hv] [] []\n",
+ progname);
+ return;
+}
+
+void
+vers(void)
+{
+ fprintf(stderr, "%s: %s version %s\n", progname, package, version);
+ return;
+}
diff --git a/bin/hrancid.in b/bin/hrancid.in
old mode 100755
new mode 100644
index d0bcc55..fa048ce
--- a/bin/hrancid.in
+++ b/bin/hrancid.in
@@ -1,29 +1,33 @@
-#!@PERLV_PATH@
+#! @PERLV_PATH@
##
-## Amazingly hacked version of Hank's rancid - this one tries to
-## deal with HP procurves.
+## $Id: hrancid.in,v 1.17 2004/01/11 03:49:13 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
+# Amazingly hacked version of Hank's rancid - this one tries to
+# deal with HP procurves.
+#
# RANCID - Really Awesome New Cisco confIg Differ
#
# usage: rancid [-d] [-l] [-f filename | $host]
#
use Getopt::Std;
-getopts('dflm');
+getopts('dfl');
$log = $opt_l;
$debug = $opt_d;
$file = $opt_f;
@@ -334,7 +338,7 @@ sub WriteTerm {
ProcessHistory("","","",";$_") && next;
- # the rest are from rancid (ie: cisco), but suspect they will someday
+ # the rest are from rancid (i.e.: cisco), but suspect they will someday
# be applicable or close to it.
/^tftp-server flash / && next; # kill any tftp remains
@@ -493,8 +497,12 @@ TOP: while() {
}
while (/#\s*($cmds_regexp)\s*$/) {
$cmd = $1;
- if (!defined($prompt)) {$prompt = ($_ =~ /^([^#]+)/)[0];
- $prompt .= "[#>]"; }
+ if (!defined($prompt)) {
+ $prompt = ($_ =~ /^([^#]+)/)[0];
+ $prompt =~ s/([][}{)(\\])/\\$1/g;
+ $prompt .= "[#>]";
+ print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
+ }
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
print STDERR "$host: found unexpected command - \"$cmd\"\n";
diff --git a/bin/htlogin.in b/bin/htlogin.in
new file mode 100644
index 0000000..8e9c5f5
--- /dev/null
+++ b/bin/htlogin.in
@@ -0,0 +1,492 @@
+#! @EXPECT_PATH@ --
+##
+## $Id: htlogin.in,v 1.7 2004/01/11 05:39:15 heas Exp $
+##
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
+## All rights reserved.
+##
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
+##
+## There is no warranty or other guarantee of fitness of this software.
+## It is provided solely "as is". The author(s) disclaim(s) all
+## responsibility and liability with respect to this software's usage
+## or its effect upon hardware, computer systems, other software, or
+## anything else.
+##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+##
+#
+# The login expect scripts were based on Erik Sherk's gwtn, by permission.
+#
+# htlogin - Hitachi router login
+#
+# Most options are intuitive for logging into an Hitachi router login.
+#
+
+# Usage line
+set usage "Usage: $argv0 \[-noenable\] \[-c command\] \
+\[-Evar=x\] \[-f cloginrc-file\] \[-p user-password\] \
+\[-s script-file\] \[-t timeout\] \[-u username\] \
+\[-v vty-password\] \[-w enable-username\] \[-x command-file\] \
+\[-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 enable 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
+ } -p* -
+ -P* {
+ if {! [ regexp .\[pP\](.+) $arg ignore userpasswd]} {
+ incr i
+ set userpasswd [ lindex $argv $i ]
+ }
+ set do_passwd 0
+ # 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]} {
+ set E$varname $varvalue
+ } else {
+ send_user "Error: 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...
+#
+
+# 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.
+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
+
+ # try each of the connection methods in $cmethod until one is successful
+ set progs [llength $cmethod]
+ foreach prog [lrange $cmethod 0 end] {
+ 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 $port} reason ]
+ }
+ if { $retval } {
+ send_user "\nError: telnet failed: $reason\n"
+ exit 1
+ }
+ } else {
+ puts "\nError: unknown connection method: $prog"
+ return 1
+ }
+ incr progs -1
+ sleep 0.3
+
+ # This helps cleanup each expect clause.
+ expect_after {
+ timeout {
+ send_user "\nError: TIMEOUT reached\n"
+ catch {close}; wait
+ if { $in_proc} {
+ return 1
+ } else {
+ continue
+ }
+ } eof {
+ send_user "\nError: EOF received\n"
+ catch {close}; wait
+ if { $in_proc} {
+ return 1
+ } else {
+ continue
+ }
+ }
+ }
+
+ expect {
+ "Connection refused" {
+ close; wait
+ sleep 0.3
+ expect eof
+ send_user "\nError: Connection Refused\n"; wait; return 1
+ } eof { send_user "\nError: Couldn't login\n"; wait; return 1
+ } "Unknown host\r\n" {
+ expect eof
+ send_user "\nError: Unknown host\n"; wait; return 1
+ } "Host is unreachable" {
+ expect eof
+ send_user "\nError: Host Unreachable!\n"; wait; return 1
+ } "No address associated with name" {
+ expect eof
+ send_user "\nError: Unknown host\n"; wait; return 1
+ }
+ -re "$u_prompt" {
+ send "$user\r"
+ set uprompt_seen 1
+ exp_continue
+ }
+ -re "$p_prompt" {
+ sleep 1
+ if {$uprompt_seen == 1} {
+ send "$userpswd\r"
+ } else {
+ send "$passwd\r"
+ }
+ exp_continue
+ }
+ "Password incorrect" { send_user "\nError: Check your password for $router\n";
+ catch {close}; wait; return 1
+ }
+ "$prompt" { break; }
+ denied { send_user "\nError: Check your passwd for $router\n"
+ catch {close}; wait; return 1
+ }
+ "\r\n" { exp_continue; }
+ }
+ }
+ set in_proc 0
+ return 0
+}
+
+# Run commands given on the command line.
+proc run_commands { prompt command } {
+ global in_proc
+ set in_proc 1
+
+ # Is this a multi-command?
+ if [ string match "*\;*" "$command" ] {
+ set commands [split $command \;]
+ set num_commands [llength $commands]
+
+ for {set i 0} {$i < $num_commands} { incr i} {
+ send "[lindex $commands $i]\r"
+ expect {
+ -re "^\[^\n\r]*$prompt" {}
+ -re "^\[^\n\r *]*$prompt" {}
+ -re "\[\n\r]" { exp_continue }
+ }
+ }
+ } else {
+ send "$command\r"
+ expect {
+ -re "^\[^\n\r]*$prompt" {}
+ -re "^\[^\n\r *]*$prompt" {}
+ -re "\[\n\r]" { exp_continue }
+ }
+ }
+ send "exit\r"
+ expect {
+ "\n" { exp_continue }
+ timeout { return 0 }
+ eof { return 0 }
+ }
+ set in_proc 0
+}
+
+#
+# For each router... (this is main loop)
+#
+source_password_file $password_file
+set in_proc 0
+foreach router [lrange $argv $i end] {
+ set router [string tolower $router]
+ send_user "$router\n"
+
+ # Figure out prompt.
+ set prompt "command: "
+ set autoenable 1
+ set enable 0
+
+ # Figure out passwords
+ if { $do_passwd } {
+ set pswd [find password $router]
+ if { [llength $pswd] == 0 } {
+ send_user "Error: no password for $router in $password_file.\n"
+ continue
+ }
+ set passwd [join [lindex $pswd 0] ""]
+ }
+
+ # Figure out username
+ if {[info exists username]} {
+ # command line username
+ set ruser $username
+ } 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]} {
+ # command line username
+ set userpswd $userpasswd
+ } else {
+ set userpswd [join [find userpassword $router] ""]
+ if { "$userpswd" == "" } { set userpswd $passwd }
+ }
+
+ # Figure out prompts
+ set u_prompt [find userprompt $router]
+ if { "$u_prompt" == "" } {
+ set u_prompt "(Username|login| Login):"
+ } else {
+ set u_prompt [join [lindex $u_prompt 0] ""]
+ }
+ set p_prompt [find passprompt $router]
+ if { "$p_prompt" == "" } {
+ set p_prompt "\[Pp]assword:"
+ } else {
+ set p_prompt [join [lindex $p_prompt 0] ""]
+ }
+
+ # Figure out cypher type
+ if {[info exists cypher]} {
+ # command line cypher type
+ set cyphertype $cypher
+ } else {
+ set cyphertype [find cyphertype $router]
+ if { "$cyphertype" == "" } { set cyphertype "3des" }
+ }
+
+ # Figure out connection method
+ set cmethod [find method $router]
+ if { "$cmethod" == "" } { set cmethod {{telnet}} }
+
+ # Login to the router
+ if {[login $router $ruser $userpswd $passwd $prompt $cmethod $cyphertype]} {
+ continue
+ }
+
+ if { $do_command } {
+ if {[run_commands $prompt $command]} {
+ continue
+ }
+ } elseif { $do_script } {
+ source $sfile
+ close
+ } else {
+ label $router
+ log_user 1
+ interact
+ }
+
+ # End of for each router
+ wait
+ sleep 0.3
+}
+exit 0
diff --git a/bin/htrancid.in b/bin/htrancid.in
new file mode 100644
index 0000000..2b2eaaa
--- /dev/null
+++ b/bin/htrancid.in
@@ -0,0 +1,266 @@
+#! @PERLV_PATH@
+##
+## $Id: htrancid.in,v 1.5 2004/01/11 03:49:13 heas Exp $
+##
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
+## All rights reserved.
+##
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
+##
+## There is no warranty or other guarantee of fitness of this software.
+## It is provided solely "as is". The author(s) disclaim(s) all
+## responsibility and liability with respect to this software's usage
+## or its effect upon hardware, computer systems, other software, or
+## anything else.
+##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+##
+#
+# hacked version of Hank's rancid - this one tries to deal with Hitachi's.
+#
+# RANCID - Really Awesome New Cisco confIg Differ
+#
+# usage: htrancid [-d] [-l] [-f filename | $host]
+#
+use Getopt::Std;
+getopts('dfl');
+$log = $opt_l;
+$debug = $opt_d;
+$file = $opt_f;
+$host = $ARGV[0];
+$clean_run = 0;
+$found_end = 0;
+$timeo = 90; # blogin timeout in seconds
+
+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) {
+ print eval "$command \%history";
+ undef %history;
+ }
+ if (($new_hist_tag) && ($new_command) && ($command_string)) {
+ if ($history{$command_string}) {
+ $history{$command_string} = "$history{$command_string}@string";
+ } else {
+ $history{$command_string} = "@string";
+ }
+ } elsif (($new_hist_tag) && ($new_command)) {
+ $history{++$#history} = "@string";
+ } else {
+ print "@string";
+ }
+ $hist_tag = $new_hist_tag;
+ $command = $new_command;
+ 1;
+}
+
+sub numerically { $a <=> $b; }
+
+# This is a sort routing that will sort numerically on the
+# keys of a hash as if it were a normal array.
+sub keynsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort numerically keys(%lines)) {
+ $sorted_lines[$i] = $lines{$key};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a sort routing that will sort on the
+# keys of a hash as if it were a normal array.
+sub keysort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort keys(%lines)) {
+ $sorted_lines[$i] = $lines{$key};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a sort routing that will sort on the
+# values of a hash as if it were a normal array.
+sub valsort{
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort values %lines) {
+ $sorted_lines[$i] = $key;
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a numerical sort routing (ascending).
+sub numsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $num (sort {$a <=> $b} keys %lines) {
+ $sorted_lines[$i] = $lines{$num};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a sort routine that will sort on the
+# ip address when the ip address is anywhere in
+# the strings.
+sub ipsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $addr (sort sortbyipaddr keys %lines) {
+ $sorted_lines[$i] = $lines{$addr};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# 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]));
+}
+sub sortbyipaddr {
+ &ipaddrval($a) <=> &ipaddrval($b);
+}
+
+# This routine parses "show config"
+sub ShowConfig {
+ print STDERR " In ShowConfig: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ ProcessHistory("","","","$_");
+ }
+ return(0);
+}
+
+# This routine parses single command's that return no required info
+sub ShowVersion {
+ print STDERR " In ShowVersion: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ }
+ return(0)
+}
+
+# dummy function
+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"
+);
+$cisco_cmds=join(";",@commands);
+$cmds_regexp=join("|",@commands);
+
+open(OUTPUT,">$host.new") || die "Can't open $host.new for writing: $!\n";
+select(OUTPUT);
+# make OUTPUT unbuffered if debugging
+if ($debug) { $| = 1; }
+
+if ($file) {
+ print STDERR "opening file $host\n" if ($debug);
+ print STDOUT "opening file $host\n" if ($log);
+ open(INPUT,"<$host") || die "open failed for $host: $!\n";
+} else {
+ print STDERR "executing htlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
+ print STDOUT "executing htlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
+ if (defined($ENV{NOPIPE})) {
+ system "htlogin -t $timeo -c \"$cisco_cmds\" $host $host.raw 2>&1" || die "htlogin failed for $host: $!\n";
+ open(INPUT, "< $host.raw") || die "htlogin failed for $host: $!\n";
+ } else {
+ open(INPUT,"htlogin -t $timeo -c \"$cisco_cmds\" $host ) {
+ tr/\015//d;
+ if (/^.*logout$/) {
+ $clean_run=1;
+ last;
+ }
+ if (/^Error:/) {
+ print STDOUT ("$host htlogin error: $_");
+ print STDERR ("$host htlogin error: $_") if ($debug);
+ $clean_run=0;
+ last;
+ }
+ while (/command:\s*($cmds_regexp)\s*$/) {
+ $cmd = $1;
+ if (!defined($prompt)) {
+ $prompt = ($_ =~ /^([^:]+:)/)[0];
+ }
+ print STDERR ("HIT COMMAND:$_") if ($debug);
+ if (! defined($commands{$cmd})) {
+ print STDERR "$host: found unexpected command - \"$cmd\"\n";
+ $clean_run = 0;
+ last TOP;
+ }
+ $rval = &{$commands{$cmd}};
+ delete($commands{$cmd});
+ if ($rval == -1) {
+ $clean_run = 0;
+ last TOP;
+ }
+ }
+}
+print STDOUT "Done $logincmd: $_\n" if ($log);
+# Flush History
+ProcessHistory("","","","");
+# Cleanup
+close(INPUT);
+close(OUTPUT);
+
+if (defined($ENV{NOPIPE})) {
+ unlink("$host.raw") if (! $debug);
+}
+
+# check for completeness
+if (scalar(%commands) || !$clean_run ) {
+ if (scalar(%commands)) {
+ printf(STDOUT "$host: missed cmd(s): %s\n", join(',', keys(%commands)));
+ printf(STDERR "$host: missed cmd(s): %s\n", join(',', keys(%commands))) if ($debug);
+ }
+ if (!$clean_run ) {
+ print STDOUT "$host: End of run not found\n";
+ print STDERR "$host: End of run not found\n" if ($debug);
+ system("/usr/bin/tail -1 $host.new");
+ }
+ unlink "$host.new" if (! $debug);
+}
diff --git a/bin/jerancid.in b/bin/jerancid.in
new file mode 100644
index 0000000..1b72737
--- /dev/null
+++ b/bin/jerancid.in
@@ -0,0 +1,645 @@
+#! @PERLV_PATH@
+##
+## $Id: jerancid.in,v 1.25 2004/01/11 03:49:13 heas Exp $
+##
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
+## All rights reserved.
+##
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
+##
+## There is no warranty or other guarantee of fitness of this software.
+## It is provided solely "as is". The author(s) disclaim(s) all
+## responsibility and liability with respect to this software's usage
+## or its effect upon hardware, computer systems, other software, or
+## anything else.
+##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+##
+#
+# jerancid - tries to deal with Juniper ERXs.
+#
+# RANCID - Really Awesome New Cisco confIg Differ
+#
+# usage: rancid [-d] [-l] [-f filename | $host]
+#
+use Getopt::Std;
+getopts('dfl');
+$log = $opt_l;
+$debug = $opt_d;
+$file = $opt_f;
+$host = $ARGV[0];
+$clean_run = 0;
+$found_end = 0;
+$timeo = 90; # clogin timeout in seconds
+
+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) {
+ print eval "$command \%history";
+ undef %history;
+ }
+ if (($new_hist_tag) && ($new_command) && ($command_string)) {
+ if ($history{$command_string}) {
+ $history{$command_string} = "$history{$command_string}@string";
+ } else {
+ $history{$command_string} = "@string";
+ }
+ } elsif (($new_hist_tag) && ($new_command)) {
+ $history{++$#history} = "@string";
+ } else {
+ print "@string";
+ }
+ $hist_tag = $new_hist_tag;
+ $command = $new_command;
+ 1;
+}
+
+sub numerically { $a <=> $b; }
+
+# This is a sort routing that will sort numerically on the
+# keys of a hash as if it were a normal array.
+sub keynsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort numerically keys(%lines)) {
+ $sorted_lines[$i] = $lines{$key};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a sort routing that will sort on the
+# keys of a hash as if it were a normal array.
+sub keysort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort keys(%lines)) {
+ $sorted_lines[$i] = $lines{$key};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a sort routing that will sort on the
+# values of a hash as if it were a normal array.
+sub valsort{
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $key (sort values %lines) {
+ $sorted_lines[$i] = $key;
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a numerical sort routing (ascending).
+sub numsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $num (sort {$a <=> $b} keys %lines) {
+ $sorted_lines[$i] = $lines{$num};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# This is a sort routine that will sort on the
+# ip address when the ip address is anywhere in
+# the strings.
+sub ipsort {
+ local(%lines)=@_;
+ local($i) = 0;
+ local(@sorted_lines);
+ foreach $addr (sort sortbyipaddr keys %lines) {
+ $sorted_lines[$i] = $lines{$addr};
+ $i++;
+ }
+ @sorted_lines;
+}
+
+# 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]));
+}
+sub sortbyipaddr {
+ &ipaddrval($a) <=> &ipaddrval($b);
+}
+
+# This routine parses "show version"
+sub ShowVersion {
+ print STDERR " In ShowVersion: $_" if ($debug);
+ my($slots);
+
+ while () {
+ tr/\015//d;
+ last if(/^$prompt/);
+ next if(/^(\s*|\s*$cmd\s*)$/);
+ next if (/^Please wait/i);
+ return(-1) if (/command authorization failed/i);
+
+ /^Juniper Edge .* (\S+)$/ &&
+ ProcessHistory("COMMENTS","keysort","A1",
+ "!Chassis type: $1 - a $_") && next;
+ /^System Release: / &&
+ ProcessHistory("COMMENTS","keysort","B1", "!$_") && next;
+ /^\s+(Version: .*)$/ &&
+ ProcessHistory("COMMENTS","keysort","B1", "!System $1\n") &&
+ next;
+
+ if (/^(slot .*)\s+slot uptime/i) {
+ ($slots++);
+ ProcessHistory("COMMENTS","keysort","B2", "!\n! $1\n");
+ next;
+ }
+ /^(--.*) --+$/ && $slots &&
+ ProcessHistory("COMMENTS","keysort","B2", "! $1\n") && next;
+ if (/^(\d+ +\S+ +(\S+).*) \S+$/ && $slots) {
+ my($line) = $1;
+ if ($2 != /--+/) {
+ ProcessHistory("COMMENTS","keysort","B3", "! $line\n");
+ }
+ next;
+ }
+ }
+ ProcessHistory("COMMENTS","keysort","B4","!\n");
+ return(0);
+}
+
+# This routine parses "show redundancy"
+sub ShowRedundancy {
+ print STDERR " In ShowRedundancy: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ last if(/^$prompt/);
+ next if(/^(\s*|\s*$cmd\s*)$/);
+ next if (/^Please wait/i);
+
+ ProcessHistory("","","","! $_");
+ }
+ ProcessHistory("","","","!\n");
+ return(0);
+}
+
+# This routine parses "show environment all"
+sub ShowEnv {
+ print STDERR " In ShowEnv: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ next if (/^Please wait/i);
+ return(-1) if (/command authorization failed/i);
+
+ # skip the temperature goop
+ if (/processor\s+processor/) {
+ ; ; ;
+ next;
+ }
+ /^\d+\s+\d+\s+\S+/ && next;
+
+ # strip nvs usage
+ s/, \d+% \S+\)/\)/;
+
+ s/^ //;
+ ProcessHistory("COMMENTS","keysort","D1","! $_");
+ }
+ ProcessHistory("COMMENTS","keysort","D1","!\n");
+ return(0);
+}
+
+# This routine parses "show boot"
+sub ShowBoot {
+ print STDERR " In ShowBoot: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ next if (/^Please wait/i);
+ next if (/^\s*$/);
+ return(1) if /^\s*\^\s*$/;
+ return(-1) if (/command authorization failed/i);
+ return(1) if /Ambiguous command/i;
+
+ /System Release:\s+(.*)/ &&
+ ProcessHistory("COMMENTS","keysort","C1","!Boot Release: $1\n")
+ && next;
+ /System Configuration:\s+(.*)/ &&
+ ProcessHistory("COMMENTS","keysort","C1",
+ "!Boot Configuration: $1\n") && next;
+
+ ProcessHistory("COMMENTS","keysort","C1","!$_");
+ }
+ ProcessHistory("COMMENTS","keysort","C1","!\n");
+ return(0);
+}
+
+# This routine parses "dir"
+sub DirSlotN {
+ print STDERR " In DirSlotN: $_" if ($debug);
+
+ my($dev) = (/\s([^\s]+):/);
+
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ next if (/^Please wait/i);
+ next if (/^system\.log/);
+
+ ProcessHistory("FLASH","","","!Flash: $_");
+ }
+ ProcessHistory("","","","!\n");
+ return(0);
+}
+
+# This routine parses "show hardware"
+sub ShowHardware {
+ print STDERR " In ShowHardware: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ next if (/^Please wait/i);
+ # return(1) if ($type =~ /^(12[40]|7[05])/);
+ return(-1) if (/command authorization failed/i);
+ next if (/^Please wait/i);
+
+ # wow...a clean table
+ ProcessHistory("","","","!$_");
+ }
+ ProcessHistory("","","","!\n");
+ return(0);
+}
+
+# This routine processes a "show configuration"
+sub WriteTerm {
+ print STDERR " In WriteTerm: $_" if ($debug);
+ my($lineauto) = 0;
+
+ while () {
+ tr/\015//d;
+ last if(/^$prompt/);
+ next if (/^Please wait/i);
+ return(-1) if (/command authorization failed/i);
+ /Non-Volatile memory is in use/ && return(-1); # NvRAM is locked
+ $lineauto = 0 if (/^[^ ]/);
+
+ # skip the crap
+ /^! Configuration script /i && next;
+ /^! Copyright /i && next;
+
+ # Dog gone Cool matches to process the rest of the config
+ /^ntp clock-period / && next; # kill ntp clock-period
+ /^ length / && next; # kill length on serial lines
+ /^ width / && next; # kill width on serial lines
+ $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 \n");
+ next;
+ }
+ if (/^(enable secret) / && $filter_pwds >= 2) {
+ ProcessHistory("ENABLE","","","!$1 \n");
+ next;
+ }
+
+ # XXX: ERX appears to not have local usernames, but leaving these in
+ # case I am wrong.
+ if (/^username (\S+)(\s.*)? secret /) {
+ if ($filter_pwds >= 2) {
+ ProcessHistory("USER","keysort","$1",
+ "!username $1$2 secret \n");
+ } else {
+ ProcessHistory("USER","keysort","$1","$_");
+ }
+ next;
+ }
+ if (/^username (\S+)(\s.*)? password ((\d) \S+|\S+)/) {
+ if ($filter_pwds == 2) {
+ ProcessHistory("USER","keysort","$1",
+ "!username $1$2 password \n");
+ } elsif ($filter_pwds == 1 && $4 ne "5"){
+ ProcessHistory("USER","keysort","$1",
+ "!username $1$2 password \n");
+ } else {
+ ProcessHistory("USER","keysort","$1","$_");
+ }
+ next;
+ }
+
+ if (/^(\s*)password / && $filter_pwds >= 1) {
+ ProcessHistory("LINE-PASS","","","!$1password \n");
+ next;
+ }
+ if (/^\s*neighbor (\S*) password / && $filter_pwds >= 1) {
+ ProcessHistory("","","","! neighbor $1 password \n");
+ next;
+ }
+ if (/^(ppp .* password) 7 .*/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+ if (/^( ip ospf authentication-key) / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+ # isis interface passwords
+ if (/^(\s+isis authentication-key \S+)( \d)? \S+/ &&
+ $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 $'\n"); next;
+ }
+ if (/^(\s+isis message-digest-key \d+ hmac-md5)( \d)?( \S+)/ &&
+ $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 $'"); next;
+ }
+
+ # this is reversable, despite 'md5' in the cmd
+ if (/^(\s+ip ospf authentication-key \S+)( \d)? \S+/ &&
+ $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 $'\n"); next;
+ }
+ if (/^(\s+ip ospf message-digest-key \d+ hmac-md5)( \d)?( \S+)/ &&
+ $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 $'"); next;
+ }
+ if (/^( ip ospf message-digest-key \d+ md5) / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+
+ # filter VRRP passwords
+ if (/^(\s+ip vrrp authentication-key \d+)( \d)? \s+ / &&
+ $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+
+ # ftp host encrypted password oscillates
+ if (/^(host \S+ \S+ ftp) /) {
+ if ($filter_pwds >= 1 || /^host \S+ \S+ ftp \d /) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+ }
+
+ # sort ip explicit-paths.
+ if (/^ip explicit-path name (\S+)/) {
+ my($key) = $1;
+ my($expath) = $_;
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ last if (/^$prompt/ || ! /^(ip explicit-path name |[ !])/);
+ if (/^ip explicit-path name (\S+)/) {
+ ProcessHistory("EXPATH","keysort","$key","$expath");
+ $key = $1;
+ $expath = $_;
+ } else {
+ $expath .= $_;
+ }
+ }
+ ProcessHistory("EXPATH","keysort","$key","$expath");
+ }
+ # sort route-maps
+ if (/^route-map (\S+)/) {
+ my($key) = $1;
+ my($routemap) = $_;
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/ || ! /^(route-map |[ !])/);
+ if (/^route-map (\S+)/) {
+ ProcessHistory("ROUTEMAP","keysort","$key","$routemap");
+ $key = $1;
+ $routemap = $_;
+ } else {
+ $routemap .= $_;
+ }
+ }
+ ProcessHistory("ROUTEMAP","keysort","$key","$routemap");
+ }
+ # filter out any RCS/CVS tags to avoid confusing local CVS storage
+ s/\$(Revision|Id):/ $1:/;
+
+ # order arp lists
+ /^arp\s+(\d+\.\d+\.\d+\.\d+)\s+/ &&
+ ProcessHistory("ARP","ipsort","$1","$_") && next;
+
+ /^ip prefix-list\s+(\S+)\s+seq\s+(\d+)\s+(permit|deny)\s+(\d\S+)(\/.*)$/ &&
+ ProcessHistory("PACL $1 $3","ipsort","$4","ip prefix-list $1 $3 $4$5\n")
+ && next;
+
+
+ # order/prune snmp-server host statements
+ # we only prune lines of the form
+ # snmp-server host a.b.c.d
+ if (/^snmp-server host (\d+\.\d+\.\d+\.\d+) /) {
+ if (defined($ENV{'NOCOMMSTR'})) {
+ my($ip) = $1;
+ my($line) = "snmp-server host $ip";
+ my(@tokens) = split(' ', $');
+ my($token);
+ while ($token = shift(@tokens)) {
+ if ($token eq 'version' || $tokens[0] == 1) {
+ $line .= " " . join(' ', ($token, shift(@tokens)));
+ } elsif ($token =~ /^(informs?|traps?|(no)?auth)$/) {
+ $line .= " " . $token;
+ } else {
+ $line = "!$line " .
+ join(' ', ("", join(' ',@tokens)));
+ last;
+ }
+ }
+ ProcessHistory("SNMPSERVERHOST","ipsort","$ip","$line\n");
+ } else {
+ ProcessHistory("SNMPSERVERHOST","ipsort","$1","$_");
+ }
+ next;
+ }
+ if (/^(snmp-server community) (\S+)/) {
+ if (defined($ENV{'NOCOMMSTR'})) {
+ ProcessHistory("SNMPSERVERCOMM","keysort","$_","!$1 $'");
+ next;
+ } else {
+ ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") && next;
+ }
+ }
+
+ # prune tacacs/radius server keys
+ if (/^(tacacs-server|radius-server) key / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 key \n"); next;
+ }
+ if (/^((tacacs-server|radius-server) host \S+ key)( \d)? \S+/ &&
+ $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 $'"); next;
+ }
+ if (/^( key )(\d )?\S+/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 $'"); next;
+ }
+
+ # order clns host statements
+ /^clns host \S+ (\S+)/ &&
+ ProcessHistory("CLNS","keysort","$1","$_") && next;
+ # order alias statements
+ /^alias / && ProcessHistory("ALIAS","keysort","$_","$_") && next;
+ # filter isis keys
+ if (/^( (area|domain)-message-digest-key \d+ hmac-md5)( \d)? \S+/ &&
+ $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 $'\n"); next;
+ }
+ if (/^( (area|domain)-authentication-key)( \d)? \S+( \d)?/ &&
+ $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 $'\n"); next;
+ }
+
+ # delete ntp auth password - this md5 is a reversable too
+ if (/^(ntp authentication-key \d+ md5) / && $filter_pwds >= 1) {
+ ProcessHistory("","","","!$1 \n"); next;
+ }
+
+ # order ntp peers/servers
+ if (/^ntp (server|peer) (\d+)\.(\d+)\.(\d+)\.(\d+)/) {
+ $sortkey = sprintf("$1 %03d%03d%03d%03d",$2,$3,$4,$5);
+ ProcessHistory("NTP","keysort",$sortkey,"$_");
+ next;
+ }
+
+ # catch anything that wasnt matched above.
+ ProcessHistory("","","","$_");
+ # end of config...is a comment.
+ if (/^! end of /i) {
+ $found_end = 1;
+ return(1);
+ }
+ }
+ return(0);
+}
+
+# dummy function
+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"
+);
+$jnxe_cmds=join(";",@commands);
+$cmds_regexp=join("|",@commands);
+
+open(OUTPUT,">$host.new") || die "Can't open $host.new for writing: $!\n";
+select(OUTPUT);
+# make OUTPUT unbuffered if debugging
+if ($debug) { $| = 1; }
+
+if ($file) {
+ print STDERR "opening file $host\n" if ($debug);
+ print STDOUT "opening file $host\n" if ($log);
+ open(INPUT,"<$host") || die "open failed for $host: $!\n";
+} else {
+ print STDERR "executing clogin -t $timeo -c\"$jnxe_cmds\" $host\n" if ($debug);
+ print STDOUT "executing clogin -t $timeo -c\"$jnxe_cmds\" $host\n" if ($log);
+ if (defined($ENV{NOPIPE})) {
+ system "clogin -t $timeo -c \"$jnxe_cmds\" $host $host.raw 2>&1" || die "clogin failed for $host: $!\n";
+ open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
+ } else {
+ open(INPUT,"clogin -t $timeo -c \"$jnxe_cmds\" $host ) {
+ tr/\015//d;
+ if (/\#\s?exit$/) {
+ $clean_run=1;
+ last;
+ }
+ if (/^Error:/) {
+ print STDOUT ("$host clogin error: $_");
+ print STDERR ("$host clogin error: $_") if ($debug);
+ $clean_run=0;
+ last;
+ }
+ while (/#\s*($cmds_regexp)\s*$/) {
+ $cmd = $1;
+ if (!defined($prompt)) {
+ $prompt = ($_ =~ /^([^#]+#)/)[0];
+ $prompt =~ s/([][}{)(\\])/\\$1/g;
+ print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
+ }
+ print STDERR ("HIT COMMAND:$_") if ($debug);
+ if (! defined($commands{$cmd})) {
+ print STDERR "$host: found unexpected command - \"$cmd\"\n";
+ $clean_run = 0;
+ last TOP;
+ }
+ $rval = &{$commands{$cmd}};
+ delete($commands{$cmd});
+ if ($rval == -1) {
+ $clean_run = 0;
+ last TOP;
+ }
+ }
+}
+print STDOUT "Done $logincmd: $_\n" if ($log);
+# Flush History
+ProcessHistory("","","","");
+# Cleanup
+close(INPUT);
+close(OUTPUT);
+
+if (defined($ENV{NOPIPE})) {
+ unlink("$host.raw") if (! $debug);
+}
+
+# check for completeness
+if (scalar(%commands) || !$clean_run || !$found_end) {
+ if (scalar(%commands)) {
+ printf(STDOUT "$host: missed cmd(s): %s\n", join(',', keys(%commands)));
+ printf(STDERR "$host: missed cmd(s): %s\n", join(',', keys(%commands))) if ($debug);
+ }
+ if (!$clean_run || !$found_end) {
+ print STDOUT "$host: End of run not found\n";
+ print STDERR "$host: End of run not found\n" if ($debug);
+ system("/usr/bin/tail -1 $host.new");
+ }
+ unlink "$host.new" if (! $debug);
+}
diff --git a/bin/jlogin.in b/bin/jlogin.in
old mode 100755
new mode 100644
index 0f005d7..31be4f6
--- a/bin/jlogin.in
+++ b/bin/jlogin.in
@@ -1,25 +1,30 @@
-#!@EXPECT_PATH@ --
+#! @EXPECT_PATH@ --
##
+## $Id: jlogin.in,v 1.41 2004/01/11 05:39:15 heas Exp $
##
-## Copyright (C) 1997-2001 by Henry Kilmer, Erik Sherk and Pete Whiting.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
-# jlogin - juniper ssh login
+# The login expect scripts were based on Erik Sherk's gwtn, by permission.
#
-## Most options are intuitive for logging into a Cisco router.
-## The default username password is the same as the vty password.
+# jlogin - juniper login
+#
+# Most options are intuitive for logging into a Cisco router.
+# The default username password is the same as the vty password.
#
# Usage line
@@ -49,6 +54,8 @@ 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 -
@@ -82,7 +89,7 @@ for {set i 0} {$i < $argc} {incr i} {
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
set E$varname $varvalue
} else {
- send_user "Error: invalid format for -E in $arg\n"
+ send_user "\nError: invalid format for -E in $arg\n"
exit 1
}
# alternate cloginrc file
@@ -249,6 +256,7 @@ proc source_password_file { password_file } {
# Log into the router.
proc login { router user passwd cmethod cyphertype identfile} {
global spawn_id in_proc do_command do_script passphrase prompt
+ global sshcmd
set in_proc 1
# try each of the connection methods in $cmethod until one is successful
@@ -270,13 +278,13 @@ proc login { router user passwd cmethod cyphertype identfile} {
# We use two calls to spawn since spawn does not seem to parse
# spaces correctly.
if {$identfile != ""} {
- if [ catch {spawn ssh -c $cyphertype -x -l $user -i $identfile $router} reason ] {
- send_user "\nError: failed to ssh: $reason\n"
+ if [ catch {spawn $sshcmd -c $cyphertype -x -l $user -i $identfile $router} reason ] {
+ send_user "\nError: failed to $sshcmd: $reason\n"
exit 1
}
} else {
- if [ catch {spawn ssh -c $cyphertype -x -l $user $router} reason ] {
- send_user "\nError: failed to ssh: $reason\n"
+ if [ catch {spawn $sshcmd -c $cyphertype -x -l $user $router} reason ] {
+ send_user "\nError: failed to $sshcmd: $reason\n"
exit 1
}
}
@@ -438,7 +446,7 @@ foreach router [lrange $argv $i end] {
# command line username
set loginname $username
} else {
- set loginname [find user $router]
+ set loginname [join [find user $router] ""]
if { "$loginname" == "" } { set loginname $default_user }
}
@@ -447,11 +455,11 @@ foreach router [lrange $argv $i end] {
# command line passwd
set passwd $userpasswd
} else {
- set passwd [lindex [find userpassword $router] 0]
+ set passwd [join [lindex [find userpassword $router] 0] ""]
if { "$passwd" == "" } {
- set passwd [lindex [find password $router] 0]
+ set passwd [join [lindex [find password $router] 0] ""]
if { "$passwd" == "" } {
- send_user "Error: no password for $router in $password_file.\n"
+ send_user "\nError: no password for $router in $password_file.\n"
continue
}
}
@@ -460,7 +468,7 @@ foreach router [lrange $argv $i end] {
# figure out identity file to use
set identfile ""
if {[info exists identity]} {
- set identfile [lindex [find identity $router] 0]
+ set identfile [join [lindex [find identity $router] 0] ""]
}
# Figure out ssh cypher type
@@ -476,6 +484,10 @@ 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} }
+
# Login to the router
if {[login $router $loginname $passwd $cmethod $cyphertype $identfile]} {
continue
diff --git a/bin/jrancid.in b/bin/jrancid.in
old mode 100755
new mode 100644
index 238e704..2793446
--- a/bin/jrancid.in
+++ b/bin/jrancid.in
@@ -1,23 +1,27 @@
-#!@PERLV_PATH@
+#! @PERLV_PATH@
##
-## Amazingly hacked version of Hank's rancid - this one tries to
-## deal with Junipers.
+## $Id: jrancid.in,v 1.58 2004/01/11 03:49:13 heas Exp $
##
-## Original Rancid: Copyright (C) 1997-2001 by Henry Kilmer.
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
##
-## This software may be freely copied, modified and redistributed without
-## fee for non-commerical purposes provided that this copyright notice is
-## preserved intact on all copies and modified copies.
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
##
## There is no warranty or other guarantee of fitness of this software.
-## It is provided solely "as is". The author(s) disclaim(s) all
+## It is provided solely "as is". The author(s) disclaim(s) all
## responsibility and liability with respect to this software's usage
## or its effect upon hardware, computer systems, other software, or
## anything else.
##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
##
#
+# Amazingly hacked version of Hank's rancid - this one tries to
+# deal with Junipers.
+#
# RANCID - Really Awesome New Cisco confIg Differ
#
# usage: jrancid [-d] [-l] [-f filename | $host]
@@ -147,6 +151,8 @@ sub ShowChassisClocks {
while () {
tr/\015//d;
last if(/^$prompt/);
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
/error: the chassis subsystem is not running/ && return;
/Couldn\'t initiate connection/ && return;
@@ -171,6 +177,8 @@ sub ShowChassisEnvironment {
while () {
tr/\015//d;
last if(/^$prompt/);
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
/error: the chassis subsystem is not running/ && return;
/Couldn\'t initiate connection/ && return;
@@ -199,6 +207,8 @@ sub ShowChassisFirmware {
while () {
tr/\015//d;
last if(/^$prompt/);
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
/error: the chassis subsystem is not running/ && return;
/Couldn\'t initiate connection/ && return;
@@ -220,6 +230,8 @@ sub ShowChassisFpcDetail {
while () {
tr/\015//d;
last if(/^$prompt/);
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
/error: the chassis subsystem is not running/ && return;
/Couldn\'t initiate connection/ && return;
@@ -244,6 +256,8 @@ sub ShowChassisHardware {
while () {
tr/\015//d;
last if(/^$prompt/);
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
/error: the chassis subsystem is not running/ && return;
/Couldn\'t initiate connection/ && return;
@@ -266,6 +280,8 @@ sub ShowChassisRoutingEngine {
while () {
tr/\015//d;
last if(/^$prompt/);
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
/error: the chassis subsystem is not running/ && return;
/Couldn\'t initiate connection/ && return;
@@ -284,8 +300,8 @@ sub ShowChassisRoutingEngine {
return;
}
-# This routine parses "show chassis feb" "show chassis scb", "show
-# chassis sfm detail", and "show chassis ssb".
+# This routine parses "show chassis cfeb", "show chassis feb", "show
+# chassis scb", "show chassis sfm detail", and "show chassis ssb".
# Only do this routine once.
sub ShowChassisSCB {
print STDERR " In ShowChassisSCB: $_" if ($debug);
@@ -295,6 +311,8 @@ sub ShowChassisSCB {
while () {
tr/\015//d;
last if(/^$prompt/);
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
return if ($ShowChassisSCB);
/error: the chassis subsystem is not running/ && return;
@@ -315,6 +333,25 @@ sub ShowChassisSCB {
return;
}
+# This routine parses "show system boot-messages"
+sub ShowChassisAlarms {
+ print STDERR " In ShowChassisAlarms: $_" if ($debug);
+
+ ProcessHistory("","","","# $_");
+ while () {
+ tr/\015//d;
+ last if(/^$prompt/);
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
+
+ /Unrecognized command/ && return;
+ /^\s+\^/ && return;
+ /syntax error/ && return;
+ ProcessHistory("","","","# $_");
+ }
+ return;
+}
+
# This routine parses "show system boot-messages"
sub ShowSystemBootMessages {
print STDERR " In ShowSystemBootMessages: $_" if ($debug);
@@ -324,6 +361,8 @@ sub ShowSystemBootMessages {
while () {
tr/\015//d;
last if(/^$prompt/);
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
/Unrecognized command/ && return;
/^\s+\^/ && return;
@@ -347,10 +386,15 @@ sub ShowVersion {
while () {
tr/\015//d;
last if(/^$prompt/);
+ next if(/^\s*$/);
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
/^Juniper Networks is:/ && ProcessHistory("","","","# \n# $_") && next;
ProcessHistory("","","","# $_");
}
+ ProcessHistory("","","","#\n");
+
return;
}
@@ -371,11 +415,14 @@ sub ShowConfiguration {
$found_end++;
last;
}
+ next if(/^system (shutdown message from|going down )/i);
+ next if(/^\{(master|backup)}/);
$lines++;
/^database header mismatch: / && return(-1);
/^version .*;\d+$/ && return(-1);
+ s/ # SECRET-DATA$//;
# filter snmp community, when in snmp { stanza }
/^snmp/ && $snmp++;
/^}/ && ($snmp = 0);
@@ -384,24 +431,30 @@ sub ShowConfiguration {
$_ = "$1$2 \"\"$3\n";
}
}
- if (/(\s*authentication-key ).*$/ && $filter_pwds >= 1) {
- s/(\s*authentication-key ).*$/#$1;/;
+ if (/(\s*authentication-key )[^ ;]+/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","#$1$'");
+ next;
}
- if (/(\s*hello-authentication-key ).*$/ && $filter_pwds >= 1) {
- s/(\s*hello-authentication-key ).*$/#$1;/;
+ if (/(\s*hello-authentication-key )[^ ;]+/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","#$1$'");
+ next;
}
- if (/^(.*\ssecret \")\$9\$.*(\".*)$/ && $filter_pwds >= 1) {
- s/^(.*\ssecret \")\$9\$.*(\".*)$/#$1$2/;
+ if (/^(.*\ssecret )[^ ;]+/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","#$1$'");
+ next;
}
- if (/(\s+encrypted-password ).*$/ && $filter_pwds >= 2) {
- ProcessHistory("","","","#$1;\n");
+ if (/(\s+encrypted-password )[^ ;]+/ && $filter_pwds >= 2) {
+ ProcessHistory("","","","#$1$'");
next;
}
if (/(\s+ssh-(rsa|dsa) )\"/ && $filter_pwds >= 2) {
ProcessHistory("","","","#$1;\n");
next;
}
- s/ # SECRET-DATA$//;
+ if (/^(\s+(pre-shared-|)key (ascii-text|hexadecimal) )[^ ;]+/ && $filter_pwds >= 1) {
+ ProcessHistory("","","","#$1$'");
+ next;
+ }
ProcessHistory("","","","$_");
}
@@ -433,8 +486,10 @@ sub DoNothing {print STDOUT;}
"show chassis sfm detail" => "ShowChassisSCB",
"show chassis ssb" => "ShowChassisSCB",
"show chassis feb" => "ShowChassisSCB",
+ "show chassis cfeb" => "ShowChassisSCB",
+ "show chassis alarms" => "ShowChassisAlarms",
"show system boot-messages" => "ShowSystemBootMessages",
- "show version" => "ShowVersion",
+ "show version detail" => "ShowVersion",
"show configuration" => "ShowConfiguration"
);
@commands=(
@@ -448,8 +503,10 @@ sub DoNothing {print STDOUT;}
"show chassis sfm detail",
"show chassis ssb",
"show chassis feb",
+ "show chassis cfeb",
+ "show chassis alarms",
"show system boot-messages",
- "show version",
+ "show version detail",
"show configuration"
);
@@ -512,7 +569,8 @@ TOP: while() {
$cmd = $1;
if (!defined($prompt)) {
$prompt = ($_ =~ /^([^>]+>)/)[0];
- $prompt =~ s/([}{)(\\])/\\$1/g;
+ $prompt =~ s/([][}{)(\\])/\\$1/g;
+ print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
}
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
diff --git a/bin/lg.cgi.in b/bin/lg.cgi.in
new file mode 100644
index 0000000..ad08c68
--- /dev/null
+++ b/bin/lg.cgi.in
@@ -0,0 +1,867 @@
+#! @PERLV_PATH@
+##
+## $Id: lg.cgi.in,v 1.47 2004/01/11 03:49:13 heas Exp $
+##
+## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
+## All rights reserved.
+##
+## This software may be freely copied, modified and redistributed
+## without fee for non-commerical purposes provided that this license
+## remains intact and unmodified with any RANCID distribution.
+##
+## There is no warranty or other guarantee of fitness of this software.
+## It is provided solely "as is". The author(s) disclaim(s) all
+## responsibility and liability with respect to this software's usage
+## or its effect upon hardware, computer systems, other software, or
+## anything else.
+##
+## Except where noted otherwise, rancid was written by and is maintained by
+## Henry Kilmer, John Heasley, Andrew Partan, Pete Whiting, and Austin Schutz.
+##
+#
+# The original original lookingglass s/w was written by Ed Kern. It was
+# a single script that used to be available at http://nitrous.digex.net/.
+# Provided by permission and modified beyond recognition.
+#
+# Looking glass
+# vars: query, router, args
+
+BEGIN {
+$me = $0;
+$me =~ s/.*\/(\S+)$/$1/;
+}
+
+use CGI qw/:standard escapeHTML/;
+use POSIX qw(strftime);
+use Sys::Syslog;
+use LockFile::Simple qw(lock trylock unlock);
+
+my($BASEDIR) = "@prefix@";
+my($SYSCONFDIR) = "@sysconfdir@";
+my($pingcmd) = "@LG_PING_CMD@";
+
+my($query, $max_time_diff, $cache_dir, $cloginrc, @results);
+my($type, $router_param, $remote_user, $arg, $router, $mfg);
+
+my($LG_CACHE_DIR, $LG_CLOGINRC, $LG_IMAGE, $LG_LOG, $LG_ROUTERDB, $LG_AS_REG);
+my($LG_BGP_RT, $LG_CACHE_TIME, $LG_SINGLE, $LG_STRIP);
+
+if (!defined($ENV{HOME})) { $ENV{HOME} = "."; }
+
+# note: the following functions are duplicated between lgform.cgi and lg.cgi
+# to avoid the need for module inclusion headaches from within a httpd context.
+# it is just easier to be self-contained.
+# SO, ANY CHANGES HERE SHOULD BE REFLECTED IN THE OTHER .cgi.
+
+# logging
+sub dolog
+{
+ my($level, $msg) = @_;
+
+ if (defined($LG_LOG) && $LG_LOG !~ /\//) {
+ openlog($me, "pid", $LG_LOG);
+ syslog($level, "%s", $msg);
+ closelog;
+ } else {
+ local(*LOG);
+ my($file);
+ if (defined($LG_LOG)) {
+ $file = $LG_LOG;
+ } else {
+ $file = "$cache_dir/lg.log";
+ }
+ # log date, hostname, query, addr
+ if (open(LOG, ">>$file") == 0) {
+ # stderr, if all else fails
+ printf(STDERR "[" . strftime("%a %b %e %H:%M:%S %Y", gmtime) .
+ "] could not open log file $file: $!\n");
+ printf(STDERR $msg);
+ } else {
+ printf(LOG $msg);
+ close(LOG);
+ }
+ }
+ return;
+}
+
+# read LG configuration file
+sub readconf
+{
+ my($conffile, $cmds);
+ local(*CONF);
+ if (defined($ENV{LG_CONF})) {
+ $conffile = $ENV{LG_CONF};
+ } elsif (-e "lg.conf") {
+ $conffile = "lg.conf";
+ } else {
+ $conffile = "$SYSCONFDIR/lg.conf";
+ }
+
+ if (! -f $conffile) {
+ return;
+ }
+
+ if (open(CONF, "< $conffile")) {
+ while () {
+ next if (/^\s*(#|$)/);
+ $cmds .= $_;
+ }
+ close(CONF);
+ eval $cmds;
+ } else {
+ printf(STDERR "ERROR: couldn\'t open the configuration file: " .
+ "$conffile: $!\n");
+ exit(1);
+ }
+
+ return;
+}
+
+# read router.db file
+sub readrouters
+{
+ my($rtrdb);
+ local(*RTR);
+
+ if (defined($LG_ROUTERDB)) {
+ $rtrdb = $LG_ROUTERDB;
+ } else {
+ $rtrdb = "$SYSCONFDIR/router.db";
+ }
+
+ if (! -f $rtrdb) {
+ my(@dirs, $dir);
+ # if the router.db file does not exist, try to compile the list from
+ # the rancid group router.db files.
+ local(*DIR);
+ if (! opendir(DIR, $BASEDIR)) {
+ dolog(LOG_ERR, "ERROR: couldn\'t read $BASEDIR: $!\n");
+ } else {
+ while ($dir = readdir(DIR)) {
+ next if ($dir =~ /^(\.|\.\.|CVS|bin|etc|logs|util)$/);
+ push(@dirs, $dir) if (-d "$BASEDIR/$dir");
+ }
+ closedir(DIR);
+
+ foreach $dir (@dirs) {
+ if (! opendir(DIR, "$BASEDIR/$dir")) {
+ dolog(LOG_ERR, "ERROR: couldn\'t read $BASEDIR/$dir: $!\n");
+ next;
+ }
+ closedir(DIR);
+ next if (! -f "$BASEDIR/$dir/router.db");
+ if (open(RTR, "< $BASEDIR/$dir/router.db")) {
+ while () {
+ next if (/^\s*(#|$)/);
+ # fqdn:mfg:state
+ @record = split('\:', $_);
+ next if ($record[2] !~ /up/i || $record[1] !~ /(cisco|foundry|juniper)/);
+ push(@rtrlist, join(':', ($record[0], $record[1])));
+ $rtrlabels{join(':', ($record[0], $record[1]))} = $record[0];
+ }
+ close(RTR);
+ } else {
+ dolog(LOG_ERR, "ERROR: couldn\'t open the router.db " .
+ "file: $BASEDIR/$dir/router.db: $!\n");
+ }
+ }
+ }
+ } else {
+ if (open(RTR, "< $rtrdb")) {
+ while () {
+ next if (/^\s*(#|$)/);
+ # fqdn:mfg:state
+ @record = split('\:', $_);
+ next if ($record[2] !~ /up/i || $record[1] !~ /(cisco|foundry|juniper)/);
+ push(@rtrlist, join(':', ($record[0], $record[1])));
+ $rtrlabels{join(':', ($record[0], $record[1]))} = $record[0];
+ }
+ close(RTR);
+ } else {
+ dolog(LOG_ERR, "ERROR: couldn\'t open the router.db file: " .
+ "$rtrdb: $!\n");
+ exit(1);
+ }
+ }
+
+ return;
+}
+
+# the remaining functions are particular to lg.cgi.
+
+# return true if $router is a member of @rtrlist
+sub arraymember {
+ my($rtrlist) = shift;
+ my($router) = shift;
+ my($r);
+
+ foreach $r (@$rtrlist) {
+ $r = (split(':', $r))[0];
+ return(1) if ($r eq $router);
+ }
+
+ return(0);
+}
+
+# check reachability and lock file before attempting to connect to device
+# return non-zero on error.
+sub DoRsh
+{
+ my ($router, $mfg, $cmd, $arg) = @_;
+ my($ctime) = time();
+ my($val);
+
+ my($lckobj) = LockFile::Simple->make(-delay => $lock_int,
+ -max => $max_lock_wait, -hold => $max_lock_hold);
+
+ if ($pingcmd =~ /\d$/) {
+ `$pingcmd $router`;
+ } else {
+ `$pingcmd $router 56 1`;
+ }
+ if ($?) {
+ print "$router is unreachable. Try again later.\n";
+ return(-1);
+ }
+ if (! $lckobj->lock("$cache_dir/$router")) {
+ print "$router is busy. Try again later.\n";
+ return(-1);
+ }
+ $val = &DoCmd($router, $mfg, $cmd, $arg);
+ $lckobj->unlock("$cache_dir/$router");
+ return($val);
+}
+
+# run commands on the router. return non-zero on error.
+sub DoCmd
+{
+ my($rtr, $mfg, $cmd, $arg) = @_;
+ local(*CMD);
+
+ if ($mfg =~ /foundry/i) {
+ open(CMD, "sh -c \"flogin -f $cloginrc -c \'$cmd $arg\' $rtr\" 2>&1 |");
+ } elsif ($mfg =~ /juniper/i) {
+ open(CMD, "sh -c \"jlogin -f $cloginrc -c \'$cmd $arg\' $rtr\" 2>&1 |");
+ } else {
+ open(CMD, "sh -c \"clogin -noenable -f $cloginrc -c \'$cmd $arg\' $rtr\" 2>&1 |");
+ }
+ while () {
+ tr/\015//d;
+ if (/^error:/i) {
+ dolog(LOG_ERR, $_);
+ if ($LG_STRIP) { undef(@results); }
+ push(@results, $_);
+ print @results;
+ return(-1);
+ }
+ push(@results, $_);
+ if (/$cmd/) {
+ ($prompt) = /^(\S*)[\#>]/;
+ if ($LG_STRIP) {
+ undef(@results);
+ } else {
+ print @results;
+ }
+ last;
+ }
+ }
+
+ while () {
+ last if /^$prompt[\#>]/;
+ tr/\015//d;
+ print $_;
+ push(@results, $_);
+ }
+ while () {}
+ close(CMD);
+
+ return(0);
+}
+
+##
+# Subroutine: Error
+# Usage: &Error("msg"));
+# Description: displays an error and exits.
+##
+sub Error {
+ my($msg) = @_;
+
+ my($q) = new CGI();
+ print $q->header;
+ if ($LG_STYLE) {
+ print $query->start_html(-title => "LookingGlass Results - $router",
+ -style => {'src' => $LG_STYLE});
+ } else {
+ print $query->start_html(-title => "LookingGlass Results - $router");
+ }
+
+ # add the company image, LG_IMAGE
+ print $LG_IMAGE;
+
+
+ print <
+ Looking Glass Error:
+