From 0de2cd40874c4041ce3bbff29b77ea5f80dceff7 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Tue, 26 Dec 2017 15:58:27 -0800 Subject: [PATCH] Force content type to be what's acceptable for a POST request to mailman --- admin.cgi | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/admin.cgi b/admin.cgi index 93b9e4a..d0af41f 100755 --- a/admin.cgi +++ b/admin.cgi @@ -70,16 +70,14 @@ my @realhosts = ( &get_system_hostname(), # Read posted data my $temp = &transname(); -open(my $TEMP, ">", "$temp"); +open(my $TEMP, ">", $temp); my $qs; -if (defined(&read_fully)) { - &read_fully($STDIN, \$qs, $ENV{'CONTENT_LENGTH'}); - } -else { - read(STDIN, $qs, $ENV{'CONTENT_LENGTH'}); - } +&read_fully($STDIN, \$qs, $ENV{'CONTENT_LENGTH'}); print $TEMP $qs; close($TEMP); +if ($ENV{'REQUEST_METHOD'} eq 'POST') { + $ENV{'CONTENT_TYPE'} = 'application/x-www-form-urlencoded'; + } # Run the real command, and fix up output my $cmd = &command_as_user($cgiuser, 0, "$mailman_dir/cgi-bin/$prog");