3 ## majordomo.cgi -- Send a mail to Majordomo
8 # switch to unbuffered I/O
16 $O .= "Content-type: text/html\n" .
17 "Connection: close\n" .
19 open(FP, "</v/openssl/web/support/majordomo.head.html");
20 $O .= $_ while (<FP>);
23 open(FP, "</v/openssl/web/support/majordomo.foot.html");
24 $O .= $_ while (<FP>);
29 # let us catch runtime errors...
33 $path_info = $ENV{'PATH_INFO'};
36 $query_string = $ENV{'QUERY_STRING'};
37 if ($ENV{'REQUEST_METHOD'} eq 'POST') {
39 while (<STDIN>) { $query_string .= $_; }
42 @pairs = split(/&/, $query_string);
43 foreach $pair (@pairs) {
44 my ($name, $value) = split(/=/, $pair);
45 $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack('C', hex($1))/eg;
46 if ($qs{$name} ne '') {
47 $qs{$name} .= ",$value";
54 # check for parameter consistency
55 die "You supplied to Email address."
56 if ($qs{email} eq '');
57 die "Hmmm... <tt>your\@address.dom</tt> is certainly not correct, friend."
58 if ($qs{email} eq 'your@address.dom');
59 die "The Email address you entered doesn't look like a valid RFC822 mail address."
60 if ($qs{email} !~ m|.+@.+|);
61 die "At least one list has to be selected."
63 die "At least one action has to be selected."
64 if ($qs{action} eq '');
66 if ($qs{action} ne 'subscribe' and $qs{action} ne 'unsubscribe');
70 $mail .= "From: nobody\@openssl.org\n";
71 $mail .= "Reply-To: $qs{email}\n";
72 $mail .= "Subject: Subscription to OpenSSL mailing list(s)\n";
73 $mail .= "To: majordomo\@openssl.org\n";
75 foreach $list (split(/,/, $qs{list})) {
77 if ($list ne 'announce' and $list ne 'users' and $list ne 'dev' and $list ne 'cvs');
78 $mail .= "$qs{action} openssl-$list $qs{email}\n";
82 open(MAIL, "| /usr/sbin/sendmail -oi -oee majordomo\@openssl.org");
86 # generate result page
88 "Ok, the ingredients of the form were successfully parsed " .
89 "and forwarded to Majordomo via Email in the following format:" .
91 "<table cellpadding=5 bgcolor=\"#f0f0f0\"><tr><td>" .
92 "<pre>".HTML::Entities::encode($mail)."</pre>\n" .
93 "</td></tr></table>" .
95 "Expect a reply in your ".HTML::Entities::encode($qs{email})." Email folder the next minutes.\n"
101 # ...the runtime error handler:
107 "A fatal error occured while processing the ingredients of your" .
108 "Majordomo-request. Please check the error message below, go back to" .
109 "the form and fix the problem." .
111 "<font color=\"#cc3333\"><b>$text</b></font>\n"