summaryrefslogtreecommitdiffstats
path: root/bin/lg.cgi.in
diff options
context:
space:
mode:
authorJeffrey C. Ollie <jeff@ocjtech.us>2007-03-25 23:16:40 -0500
committerJeffrey C. Ollie <jeff@ocjtech.us>2007-03-25 23:16:40 -0500
commited56ea51bb811dcdabb00d036786b412fdbf4d36 (patch)
treee880bcf06d9e757c39ee0cae83713b3de885c6df /bin/lg.cgi.in
parentad03c748e10fe5b8dbd95c3bcdbcc2c02e777e7b (diff)
parentac54243f382e817c08c1f895ccfdc05dcacdb044 (diff)
downloadrancid-ed56ea51bb811dcdabb00d036786b412fdbf4d36.tar.gz
rancid-ed56ea51bb811dcdabb00d036786b412fdbf4d36.tar.xz
rancid-ed56ea51bb811dcdabb00d036786b412fdbf4d36.zip
Update usercmd branch with latest vendor changes.rancid-2.3.2a7-usercmd.patch
Diffstat (limited to 'bin/lg.cgi.in')
-rw-r--r--bin/lg.cgi.in37
1 files changed, 20 insertions, 17 deletions
diff --git a/bin/lg.cgi.in b/bin/lg.cgi.in
index ad08c68..4ad6fdd 100644
--- a/bin/lg.cgi.in
+++ b/bin/lg.cgi.in
@@ -1,8 +1,9 @@
#! @PERLV_PATH@
##
-## $Id: lg.cgi.in,v 1.47 2004/01/11 03:49:13 heas Exp $
+## $Id: lg.cgi.in,v 1.54 2006/10/05 04:27:43 heas Exp $
##
-## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
+## @PACKAGE@ @VERSION@
+## Copyright (C) 1997-2006 by Terrapin Communications, Inc.
## All rights reserved.
##
## This software may be freely copied, modified and redistributed
@@ -27,8 +28,8 @@
# vars: query, router, args
BEGIN {
-$me = $0;
-$me =~ s/.*\/(\S+)$/$1/;
+ $me = $0;
+ $me =~ s/.*\/(\S+)$/$1/;
}
use CGI qw/:standard escapeHTML/;
@@ -38,6 +39,7 @@ use LockFile::Simple qw(lock trylock unlock);
my($BASEDIR) = "@prefix@";
my($SYSCONFDIR) = "@sysconfdir@";
+my($LOCALSTATEDIR) = "@localstatedir@";
my($pingcmd) = "@LG_PING_CMD@";
my($query, $max_time_diff, $cache_dir, $cloginrc, @results);
@@ -134,23 +136,24 @@ sub readrouters
# 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");
+ if (! opendir(DIR, $LOCALSTATEDIR)) {
+ dolog(LOG_ERR, "ERROR: couldn\'t read $LOCALSTATEDIR: $!\n");
} else {
while ($dir = readdir(DIR)) {
- next if ($dir =~ /^(\.|\.\.|CVS|bin|etc|logs|util)$/);
- push(@dirs, $dir) if (-d "$BASEDIR/$dir");
+ next if ($dir =~ /^(\.|\.\.|\.ssh|CVS|bin|etc|logs|util)$/);
+ push(@dirs, $dir) if (-d "$LOCALSTATEDIR/$dir");
}
closedir(DIR);
foreach $dir (@dirs) {
- if (! opendir(DIR, "$BASEDIR/$dir")) {
- dolog(LOG_ERR, "ERROR: couldn\'t read $BASEDIR/$dir: $!\n");
+ if (! opendir(DIR, "$LOCALSTATEDIR/$dir")) {
+ dolog(LOG_ERR,
+ "ERROR: couldn\'t read $LOCALSTATEDIR/$dir: $!\n");
next;
}
closedir(DIR);
- next if (! -f "$BASEDIR/$dir/router.db");
- if (open(RTR, "< $BASEDIR/$dir/router.db")) {
+ next if (! -f "$LOCALSTATEDIR/$dir/router.db");
+ if (open(RTR, "< $LOCALSTATEDIR/$dir/router.db")) {
while (<RTR>) {
next if (/^\s*(#|$)/);
# fqdn:mfg:state
@@ -162,7 +165,7 @@ sub readrouters
close(RTR);
} else {
dolog(LOG_ERR, "ERROR: couldn\'t open the router.db " .
- "file: $BASEDIR/$dir/router.db: $!\n");
+ "file: $LOCALSTATEDIR/$dir/router.db: $!\n");
}
}
}
@@ -430,7 +433,7 @@ $max_lock_hold = 300;
if (defined($LG_CLOGINRC)) {
$cloginrc = $LG_CLOGINRC;
} else {
- $cloginrc = "$ENV(HOME)/.cloginrc";
+ $cloginrc = $ENV{HOME} . "/.cloginrc";
}
$query = new CGI;
@@ -451,7 +454,7 @@ if (!defined($type) || !defined($router) || $router eq "") {
"a clue.\n");
}
-if ($arg !~ /^[-A-Za-z0-9|_\/ \.^\$]*$/) {
+if ($arg !~ /^[-A-Za-z0-9|_\/: \.^\$]*$/) {
&Error("Funny characters in argument; ignoring.\n");
}
if (length($arg) >= 50) {
@@ -678,7 +681,7 @@ if ($type eq "prefix" || $type eq "mbgp" || $type eq "route" ) {
if ($mfg =~ /cisco/i) {
$arg = " | include " . join(' ', @arg);
} elsif ($mfg =~ /juniper/i) {
- $arg = " | match \"" . join(' ', @arg) . "\"";
+ $arg = " | match \\\"" . join(' ', @arg) . "\\\"";
} else {
undef($arg);
}
@@ -736,7 +739,7 @@ if ($type eq "prefix" || $type eq "mbgp" || $type eq "route" ) {
} else {
$arg =~ s/[\$^]/ /g;
}
- $arg = "\"$arg\"";
+ $arg = "\\\"$arg\\\"";
}
# escape any ()s
$arg =~ s/([\(\)])/\\$1/g;