]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2002-10-15 23:33:37 by cjwatson]
authorcjwatson <>
Wed, 16 Oct 2002 06:33:37 +0000 (22:33 -0800)
committercjwatson <>
Wed, 16 Oct 2002 06:33:37 +0000 (22:33 -0800)
Escape control characters at the beginning of lines written to .log files,
so that they don't break the state machine used by bugreport.cgi et al.

cgi/bugreport.cgi
scripts/db2html.in
scripts/errorlib.in
scripts/process.in
scripts/service.in

index 4e909fe394e6087304de5b93ce3ead663bf05f4d..db276a3de632bac88939e2bea37b00b14b730b25 100755 (executable)
@@ -259,6 +259,7 @@ while(my $line = <L>) {
        } elsif ($normstate eq 'html') {
                $this .= $_;
        } elsif ($normstate eq 'go') {
+               s/^\030//;
                if ($mail) {
                        $mail .= $_;
                } else {
index 4c5e9efdd25a2b670ae4cc9429ce42f791f4c2a0..806f28fab12e936f4c41522edf1d24edb6bf159d 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: db2html.in,v 1.9 2002/09/25 16:16:55 doogie Exp $
+# $Id: db2html.in,v 1.10 2002/10/15 23:33:37 cjwatson Exp $
 # usage: db2html [-diff] [-stampfile=<stampfile>] [-lastrun=<days>] <wwwbase>
 
 #load the necessary libraries/configuration
@@ -305,6 +305,7 @@ for $f (@files)
         } elsif ($normstate eq 'html') {
             $this .= $_;
         } elsif ($normstate eq 'go') {
+            s/^\030//;
             $this .= &sani($_);
         } elsif ($normstate eq 'go-nox') {
             next if !s/^X//;
index 85250b995c71ddf40441c9da7f833a57d0cad463..0f82ab57517d3962279df17106ed4dfa74d50e32 100755 (executable)
@@ -1,5 +1,5 @@
 # -*- perl -*-
-# $Id: errorlib.in,v 1.7 2002/10/06 22:54:48 cjwatson Exp $
+# $Id: errorlib.in,v 1.8 2002/10/15 23:33:37 cjwatson Exp $
 
 sub F_SETLK { 6; } sub F_WRLCK{ 1; }
 $flockstruct= 'sslll'; # And there ought to be something for this too.
@@ -174,6 +174,12 @@ sub getmailbody {
        return undef;
 }
 
+sub escapelog {
+       my @log = @_;
+       map { s/^([\01-\07\030])/\030$1/gm } @log;
+       return \@log;
+}
+
 
 @severities= @gSeverityList;
 @showseverities= @severities;
index f523a563138a5b6549e0dc52ae6a7790f8afd8d1..119cd0df229f6063f040497c8602f8cb163a1255 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: process.in,v 1.50 2002/10/09 00:02:33 cjwatson Exp $
+# $Id: process.in,v 1.51 2002/10/15 23:33:37 cjwatson Exp $
 #
 # Usage: process nn
 # Temps:  incoming/Pnn
@@ -802,7 +802,7 @@ sub appendlog {
         print DEBUG "failed open log err $!<\n";
         &quit("opening db-h/$hash/$ref.log (li): $!");
     }
-    print(AP "\7\n",@log,"\n\3\n") || &quit("writing db-h/$hash/$ref.log (li): $!");
+    print(AP "\7\n",@{escapelog(@log)},"\n\3\n") || &quit("writing db-h/$hash/$ref.log (li): $!");
     close(AP) || &quit("closing db-h/$hash/$ref.log (li): $!");
 }
 
@@ -844,7 +844,7 @@ sub sendmessage {
     my $hash = get_hashname($ref);
     #save email to the log
     open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lo): $!");
-    print(AP "\2\n",join("\4",@recips),"\n\5\n$msg\n\3\n") ||
+    print(AP "\2\n",join("\4",@recips),"\n\5\n",@{escapelog($msg)},"\n\3\n") ||
         &quit("writing db-h/$hash/$ref.log (lo): $!");
     close(AP) || &quit("closing db-h/$hash/$ref.log (lo): $!");
     
index ad784ae3700705ab6c488ef5f93e92e03a9c5faf..45b88cab657d4acd4aa73d01504893c2a8daab83 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: service.in,v 1.55 2002/10/12 18:39:01 cjwatson Exp $
+# $Id: service.in,v 1.56 2002/10/15 23:33:37 cjwatson Exp $
 # ^ more or less ^
 #
 # Usage: service <code>.nn
@@ -671,7 +671,7 @@ print(AP
       &sani($header{'from'})."</code>\n".
       "to <code>".&sani($controlrequestaddr)."</code>\n".
       "\3\n".
-      "\7\n",@log,"\n\3\n") || &quit("writing db-h/-1.log: $!");
+      "\7\n",@{escapelog(@log)},"\n\3\n") || &quit("writing db-h/-1.log: $!");
 close(AP) || &quit("open db-h/-1.log: $!");
 &unfilelock;
 utime(time,time,"db-h");
@@ -887,7 +887,7 @@ sub savebug {
           "Request was from <code>".&sani($header{'from'})."</code>\n".
           "to <code>".&sani($controlrequestaddr)."</code>. \n".
           "\3\n".
-          "\7\n",@log,"\n\3\n") || &quit("writing db-h/$hash/$ref.log: $!");
+          "\7\n",@{escapelog(@log)},"\n\3\n") || &quit("writing db-h/$hash/$ref.log: $!");
     close(L) || &quit("closing db-h/$hash/$ref.log: $!");
     open(S,">db-h/$hash/$ref.status.new") || &quit("opening db-h/$hash/$ref.status.new: $!");
     print(S