Bug 27654

Summary: Update to PR 27653
Product: Documentation Reporter: arun <arun>
Component: Books & ArticlesAssignee: freebsd-doc (Nobody) <doc>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description arun 2001-05-26 08:30:04 UTC
The patch attached in PR 27653 was corrupted due to a bug in
the patch itself.

Fix: ------------=_990861646-1068-0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: text/plain

--- dosendpr.cgi	2001/05/24 04:21:13	1.1
+++ dosendpr.cgi	2001/05/26 07:17:12
@@ -9,9 +9,16 @@
 #     (http://www.gnu.ai.mit.edu/copyleft/gpl.html)
 #
 # $FreeBSD: www/en/cgi/dosendpr.cgi,v 1.5 2001/05/07 19:28:09 wosch Exp $
+#
+# MIME support: Arun Sharma <arun@sharmas.dhs.org>
 
 require "html.pl";
 
+# Requires p5-MIME-Tools port
+use CGI qw(:standard);
+use MIME::Entity;
+use IO::String;
+
 sub prerror {
     &html_title ("Problem Report Error");
     &html_body();
@@ -23,9 +30,11 @@
 }
 
 &www_content ("text","html");
-&cgi_form_in();
+#&cgi_form_in();
+
+$query = CGI::new;
 
-$gndb = $cgi_data{'gndb'};
+$gndb = $query->param('gndb');
 if ($gndb =~ /^[a-z]+$/ && -e "$gndb.def")
   { require "$gndb.def"; }
 else
@@ -52,8 +61,8 @@
 &html_body ($gnsprepbody);
 
 # Verify the data ...
-if (!$cgi_data{'email'} || !$cgi_data{'originator'} ||
-    !$cgi_data{'synopsis'}) {
+if (!$query->param('email') || !$query->param('originator') ||
+    !$query->param('synopsis')) {
     if ($gnsprepbad && -e $gnsprepbad )
       { print `cat $gnsprepbad`; }
     else {
@@ -68,27 +77,67 @@
 }
 
 # Build the PR.
-$pr = "To: $gnemail\n" .
-      "From: $cgi_data{'email'}\n" . 
-      "Subject: $cgi_data{'synopsis'}\n" .
-      "X-Send-Pr-Version: www-1.0\n\n" .
-      ">Submitter-Id:\t$cgi_data{'submitterid'}\n" .
-      ">Originator:\t$cgi_data{'originator'}\n" .
-      ">Organization:\t$cgi_data{'organization'}\n" .
-      ">Confidential:\t$cgi_data{'confidential'}\n" .
-      ">Synopsis:\t$cgi_data{'synopsis'}\n" .
-      ">Severity:\t$cgi_data{'severity'}\n" .
-      ">Priority:\t$cgi_data{'priority'}\n" .
-      ">Category:\t$cgi_data{'category'}\n" .
-      ">Class:\t\t$cgi_data{'class'}\n" .
-      ">Release:\t$cgi_data{'release'}\n" .
-      ">Environment:\t$cgi_data{'environment'}\n" .
-      ">Description:\n$cgi_data{'description'}\n" .
-      ">How-To-Repeat:\n$cgi_data{'howtorepeat'}\n" .
-      ">Fix:\n$cgi_data{'fix'}\n";
+$head = "To: " . $gnemail . "\n" .
+      "From: " . $query->param('email') . "\n" . 
+      "Subject: " . $query->param('synopsis') . "\n" .
+      "X-Send-Pr-Version: www-1.0\n\n";
+
+$body = ">Submitter-Id:\t" . $query->param('submitterid') . "\n" .
+      ">Originator:\t" . $query->param('originator'). "\n" .
+      ">Organization:\t" . $query->param('organization') . "\n" .
+      ">Confidential:\t" . $query->param('confidential') . "\n" .
+      ">Synopsis:\t" . $query->param('synopsis'). "\n" .
+      ">Severity:\t" . $query->param('severity'). "\n" .
+      ">Priority:\t" . $query->param('priority'). "\n" .
+      ">Category:\t" . $query->param('category'). "\n" .
+      ">Class:\t\t" . $query->param('class'). "\n" .
+      ">Release:\t" . $query->param('release'). "\n" .
+      ">Environment:\t" . $query->param('environment') . "\n" .
+      ">Description:\n" . $query->param('description') . "\n" .
+      ">How-To-Repeat:\n" . $query->param('howtorepeat') . "\n" .
+      ">Fix:\n" . $query->param('fix') . "\n";
+
+$pr = $head . $body;
 
 # remove any carrage returns that appear in the report.
 $pr =~ s/\r//g;
+
+if ($query->param('attachment1 [details]') || $query->param('attachment2 [details]')) {
+# we need to construct a MIME message
+    $top = MIME::Entity->build( Type     => "multipart/mixed",
+				-From    => $query->param('email'),
+				-To      => $gnemail,
+				-Subject => $query->param('synopsis'));
+
+    $top->attach(Data=>$body);
+
+    { 
+	undef $/;
+	$fh = $query->param('attachment1 [details]');
+    	$data1 = <$fh>;
+    }
+
+    # attachment #1 [details]
+    if (length $data1 > 0) {
+       $top->attach(Data =>$data1,
+		    Encoding => 'text/plain');
+    };
+
+    { 
+	undef $/;
+	$fh = $query->param('attachment2 [details]');
+    	$data2 = <$fh>;
+    }
+
+    # attachment #2 [details]
+    if (length $data2 > 0) {
+       $top->attach(Data => $data2,
+		    Encoding => 'text/plain');
+    };
+
+    $io = IO::String->new($pr);
+    $top->print($io);
+}
 
 #print "<PRE>$submitprog\n\n$pr\n</PRE>";
 if (open (SUBMIT, "|$submitprog")){

------------=_990861646-1068-0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: text/plain



------------=_990861646-1068-0----0riUxEmmAAA4RMNpzUWroOExQ0fkLrs0mhVlu14RSKQb0pe6
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- send-pr.html.orig	Fri May 25 23:25:50 2001
+++ send-pr.html	Thu May 24 09:41:27 2001
@@ -28,7 +28,8 @@
       you fill in the "Environment" field as requested with the output from
       the machine on which problem occurred.</P>
 
-    <FORM ACTION="http://www.FreeBSD.org/cgi/dosendpr.cgi" METHOD="POST">      <INPUT TYPE="HIDDEN" NAME="gndb" VALUE="freebsd">
+      <FORM ACTION="http://sharmas.dhs.org:81/cgi-bin/dosendpr.cgi" METHOD="POST" ENCTYPE="multipart/form-data">      
+      <INPUT TYPE="HIDDEN" NAME="gndb" VALUE="freebsd">
       <INPUT TYPE="HIDDEN" NAME="submitterid" VALUE="net">
       <INPUT TYPE="HIDDEN" NAME="confidential" VALUE="no">
       
@@ -93,12 +94,16 @@
       <B>Fix to the problem if known</B>: <BR>
       <TEXTAREA NAME="fix" ROWS="6" COLS="72"></TEXTAREA><BR>
 
+      <B>Attachments</B>: <P>
+      <INPUT TYPE="FILE" NAME="attachment1 [details]"> <BR>
+      <INPUT TYPE="FILE" NAME="attachment2 [details]"> <BR>
+      <P>
+
       <INPUT TYPE="SUBMIT" VALUE="Submit Problem Report">
       <INPUT TYPE="RESET" VALUE="Reset">
+
     </FORM>
     
-    <P><B>Note</B>: copy/paste will destroy TABs and spacing, and this web
-      form should not be used to submit code as plain text.</P>
       
       <HR NOSHADE>
 <ADDRESS><A HREF="./mailto.html">freebsd-questions@FreeBSD.ORG</A><BR>
How-To-Repeat: 
Use the attached patch. If it applies cleanly, it proves that
the patch works.
Comment 1 Ceri Davies freebsd_committer freebsd_triage 2003-02-24 19:07:46 UTC
State Changed
From-To: open->closed

This was a nice idea, but send-pr.html is now disabled, and I don't 
see it coming back anytime soon.  Thanks for your efforts anyway.
Comment 2 Ceri Davies freebsd_committer freebsd_triage 2003-02-24 19:07:46 UTC
State Changed
From-To: open->closed

The send-pr.html page is now disabled, and will probably remain so. 
Thanks for your efforts in improving FreeBSD!