summaryrefslogtreecommitdiffstats
path: root/bin/erancid.in
diff options
context:
space:
mode:
Diffstat (limited to 'bin/erancid.in')
-rwxr-xr-xbin/erancid.in23
1 files changed, 17 insertions, 6 deletions
diff --git a/bin/erancid.in b/bin/erancid.in
index aac7ea0..01a6268 100755
--- a/bin/erancid.in
+++ b/bin/erancid.in
@@ -33,6 +33,8 @@ $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)=(@_);
@@ -237,7 +239,16 @@ if ($file) {
}
}
-ProcessHistory("","","","- RANCID-CONTENT-TYPE: ezt3\n-\n");
+# determine password filtering mode
+if ($ENV{"FILTER_PWDS"} =~ /no/i) {
+ $filter_pwds = 0;
+} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
+ $filter_pwds = 2;
+} else {
+ $filter_pwds = 1;
+}
+
+ProcessHistory("","","","- RANCID-CONTENT-TYPE: adc-ezt3\n-\n");
ProcessHistory("COMMENTS","keysort","B0","-\n");
ProcessHistory("COMMENTS","keysort","F0","-\n");
ProcessHistory("COMMENTS","keysort","G0","-\n");
@@ -261,7 +272,7 @@ while(<INPUT>) {
}
print STDERR ("HIT COMMAND:$_") if ($debug);
if (! defined($commands{$cmd})) {
- print STDERR "found unexpected command - \"$cmd\"\n";
+ print STDERR "$host: found unexpected command - \"$cmd\"\n";
$clean_run = 0;
last;
}
@@ -287,12 +298,12 @@ if (defined($ENV{NOPIPE})) {
# check for completeness
if (scalar(%commands) || !$clean_run || !$found_end) {
if (scalar(%commands)) {
- printf(STDOUT "missed cmd(s): %s\n", join(',', keys(%commands)));
- printf(STDERR "missed cmd(s): %s\n", join(',', keys(%commands))) if ($debug);
+ 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 "End of run not found\n";
- print STDERR "End of run not found\n" if ($debug);
+ 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);