--- fnrancid.orig       2010-06-16 14:46:06.000000000 +0000
+++ fnrancid    2010-06-25 14:24:18.000000000 +0000
@@ -59,7 +59,7 @@
 $file = $opt_f;
 $host = $ARGV[0];
 $found_end = 0;
-$timeo = 90;                           # nlogin timeout in seconds
+$timeo = 90;                           # ftlogin timeout in seconds
 
 my(@commandtable, %commands, @commands);# command lists
 my($aclsort) = ("ipsort");             # ACL sorting mode
@@ -174,6 +174,9 @@
        tr/\015//d;
        next if /^\s*$/;
        last if(/$prompt/);
+        next if (/^get system status/);
+        next if (/^System time:/);
+        next if (/^FortiClient application signature package:/);
        ProcessHistory("","","","$_");
     }
     print STDOUT "Vendor: $vendor";
@@ -196,10 +199,23 @@
        tr/\015//d;
        next if /^\s*$/;
        last if(/$prompt/);
-       if (/(^set.*)('Enc .*')(.*)/) {
-           ProcessHistory("ENC","","","!$1 'Enc **encoding removed**' $3\n");
-           next;
-       }
+        next if (/^#conf_file_ver=/);
+        if (/(^set.*)('Enc .*')(.*)/) {
+            ProcessHistory("ENC","","","!$1 'Enc **encoding removed**' $3\n");
+            next;
+        }
+        if (/(^\s*set psksecret)(\sENC .*)/ && $filter_pwds >= 1) {
+            ProcessHistory("ENC","","","$1 <removed>\n");
+            next;
+        }
+        if (/(^\s*set passwd)(\sENC .*)/ && $filter_pwds >= 1) {
+            ProcessHistory("ENC","","","$1 <removed>\n");   
+            next;
+        }
+        if (/(^\s*set password)(\sENC .*)/ && $filter_pwds >= 1) {
+            ProcessHistory("ENC","","","$1 <removed>\n");   
+            next;
+        }
        ProcessHistory("","","","$_");
     }
     $found_end = 1;
@@ -212,7 +228,7 @@
 # Main
 @commandtable = (
        {'get system status'    => 'GetSystem'},
-       {'get conf'             => 'GetConf'}
+       {'show'                 => 'GetConf'}
 );
 # Use an array to preserve the order of the commands and a hash for mapping
 # commands to the subroutine and track commands that have been completed.
@@ -241,13 +257,13 @@
     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);
+    print STDERR "executing ftlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($debug);
+    print STDOUT "executing ftlogin -t $timeo -c\"$cisco_cmds\" $host\n" if ($log);
     if (defined($ENV{NOPIPE})) {
-       system "nlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "nlogin failed for $host: $!\n";
-       open(INPUT, "< $host.raw") || die "nlogin failed for $host: $!\n";
+       system "ftlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null > $host.raw 2>&1" || die "ftlogin failed for $host: $!\n";
+       open(INPUT, "< $host.raw") || die "ftlogin failed for $host: $!\n";
     } else {
-       open(INPUT,"nlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null |") || die "nlogin failed for $host: $!\n";
+       open(INPUT,"ftlogin -t $timeo -c \"$cisco_cmds\" $host </dev/null |") || die "ftlogin failed for $host: $!\n";
     }
 }
 
@@ -263,25 +279,27 @@
     $filter_commstr = 0;
 }
 # 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;
-}
+#if ($ENV{"FILTER_PWDS"} =~ /no/i) {
+#    $filter_pwds = 0;
+#} elsif ($ENV{"FILTER_PWDS"} =~ /all/i) {
+#    $filter_pwds = 2;
+#} else {
+#    $filter_pwds = 1;
+#}
+# Force $filter_pwds to 1
+$filter_pwds = 1;
 
 ProcessHistory("","","","!RANCID-CONTENT-TYPE: fortigate\n\n");
 TOP: while(<INPUT>) {
     tr/\015//d;
     if (/^Error:/) {
-       print STDOUT ("$host nlogin error: $_");
-       print STDERR ("$host nlogin error: $_") if ($debug);
+       print STDOUT ("$host ftlogin error: $_");
+       print STDERR ("$host ftlogin error: $_") if ($debug);
        last;
     }
-    while (/>\s*($cmds_regexp)\s*$/) {
+    while (/#\s*($cmds_regexp)\s*$/) {
        $cmd = $1;
-       if (!defined($prompt)) { $prompt = " >\s*"; }
+       if (!defined($prompt)) { $prompt = " #\s*"; }
        print STDERR ("HIT COMMAND:$_") if ($debug);
        if (!defined($commands{$cmd})) {
            print STDERR "$host: found unexpected command - \"$cmd\"\n";