summaryrefslogtreecommitdiffstats
path: root/bin/lgform.cgi.in
diff options
context:
space:
mode:
authorTar Committer <tar@ocjtech.us>2004-03-14 17:00:09 +0000
committerTar Committer <tar@ocjtech.us>2004-03-14 17:00:09 +0000
commit381d322caf5928732f3d478d80e70acfccd67f99 (patch)
treed52aa26f9698cd869eca3f09661bfc05a7008a28 /bin/lgform.cgi.in
parent989312339ea2e16579803a48700628c5469e327a (diff)
downloadrancid-381d322caf5928732f3d478d80e70acfccd67f99.tar.gz
rancid-381d322caf5928732f3d478d80e70acfccd67f99.tar.xz
rancid-381d322caf5928732f3d478d80e70acfccd67f99.zip
Imported from rancid-2.3.tar.gz.rancid-2.3
Diffstat (limited to 'bin/lgform.cgi.in')
-rw-r--r--bin/lgform.cgi.in28
1 files changed, 18 insertions, 10 deletions
diff --git a/bin/lgform.cgi.in b/bin/lgform.cgi.in
index 461ae68..f680a13 100644
--- a/bin/lgform.cgi.in
+++ b/bin/lgform.cgi.in
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: lgform.cgi.in,v 1.25 2004/01/11 03:49:13 heas Exp $
+## $Id: lgform.cgi.in,v 1.28 2004/03/10 22:41:54 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -26,11 +26,18 @@
# lgform.cgi - Looking glass front-end
# produces html form for calling lg.cgi
+BEGIN {
+ $me = $0;
+ $me =~ s/.*\/(\S+)$/$1/;
+}
+
use CGI qw/:standard/;
+use Sys::Syslog;
my(@rtrlist, %rtrlabels);
my($BASEDIR) = "@prefix@";
my($SYSCONFDIR) = "@sysconfdir@";
+my($LOCALSTATEDIR) = "@localstatedir@";
# 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.
@@ -118,23 +125,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
@@ -146,7 +154,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");
}
}
}