diff options
Diffstat (limited to 'bin/francid.in')
-rwxr-xr-x | bin/francid.in | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/bin/francid.in b/bin/francid.in index 6f0c2b7..560d959 100755 --- a/bin/francid.in +++ b/bin/francid.in @@ -244,15 +244,21 @@ sub WriteTerm { # order logging statements /^logging (\d+\.\d+\.\d+\.\d+)/ && ProcessHistory("LOGGING","ipsort","$1","$_") && next; - # order name-server statements - /^ip name-server (\d+\.\d+\.\d+\.\d+)/ && - ProcessHistory("NAMESERVER","ipsort","$1","$_") && next; - # order snmp-server host statements - /^snmp-server host (\d+\.\d+\.\d+\.\d+)/ && - ProcessHistory("SNMPSERVERHOST","ipsort","$1","$_") && next; - /^snmp-server community / && - ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") && next; - + # order/prune snmp-server host/community statements + if (/^(snmp-server host )(\d+\.\d+\.\d+\.\d+)/) { + if (defined($ENV{'NOCOMMSTR'})) { + ProcessHistory("SNMPSERVERHOST","ipsort","$2","!$1 $2 <removed>\n") && next; + } else { + ProcessHistory("SNMPSERVERHOST","ipsort","$2","$_") && next; + } + } + if (/^(snmp-server community )(\S+)/) { + if (defined($ENV{'NOCOMMSTR'})) { + ProcessHistory("SNMPSERVERCOMM","keysort","$_","!$1<removed>$'") && next; + } else { + ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") && next; + } + } # order tacacs server statements /^(tacacs-server key )/ && ProcessHistory("","","","! $1<removed>\n") && next; @@ -328,6 +334,7 @@ if ($file) { } } +ProcessHistory("","","","!RANCID-CONTENT-TYPE: foundry\n!\n"); TOP: while(<INPUT>) { tr/\015//d; if (/\#exit$/) { @@ -343,7 +350,10 @@ TOP: while(<INPUT>) { } while (/#\s*($cmds_regexp)\s*$/) { $cmd = $1; - if (!defined($prompt)) {$prompt = ($_ =~ /^([^#]+#)/)[0]; } + if (!defined($prompt)) { + $prompt = ($_ =~ /^([^#]+#)/)[0]; + $prompt =~ s/([}{)(\\])/\\$1/g; + } print STDERR ("HIT COMMAND:$_") if ($debug); if (! defined($commands{$cmd})) { print STDERR "found unexpected command - \"$cmd\"\n"; |