X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=update.cgi;h=ae0b6ce2289e93fc42c99464191b0ba8b687444c;hb=39f1dbe07f85a3c83b181c88ddf639a256757779;hp=716faa936390815e225316722ca1220c5277f7e8;hpb=7e3253a8e182b7f49f222a760af741dbd27f8367;p=mirror%2Fuserdir-ldap-cgi.git diff --git a/update.cgi b/update.cgi index 716faa9..ae0b6ce 100755 --- a/update.cgi +++ b/update.cgi @@ -82,8 +82,9 @@ if (!($query->param('doupdate'))) { # First do the easy stuff - this catches most of the cases foreach (keys(%$entry)) { $data{$_} = $entry->{$_}->[0]; + $data{$_} = CGI::escapeHTML($data{$_}) if defined $data{$_}; } - + $data{gender} = 9 if not $data{gender}; # Now we have to fill in the rest that needs some processing... @@ -92,6 +93,7 @@ if (!($query->param('doupdate'))) { $data{editdn} = $editdn; $data{staddress} = $entry->{postaladdress}->[0]; $data{staddress} =~ s/\$/\n/; + $data{staddress} = CGI::escapeHTML($data{staddress}); $data{countryname} = &Util::LookupCountry($data{c}); if ($data{mailgreylisting} eq "TRUE") { @@ -106,7 +108,7 @@ if (!($query->param('doupdate'))) { $data{mailcallout} = ""; } - $data{email} = join(", ", @{$entry->{emailforward}}); + $data{email} = CGI::escapeHTML(join(", ", @{$entry->{emailforward}})); my $genderselect = ' (delete)\n"; + + (delete)\n"; $sudopassword .= $e; if ($status eq 'unconfirmed') { - my $data = join(':', 'confirm-new-password', $uuid, $hosts, $crypted); + my $data = join(':', 'confirm-new-password', 'sudo', $data{'uid'}, $uuid, $hosts, $crypted); my $hmac = hmac_sha1_hex( $data, $hmac_key); - $confirmstring .= "confirm sudopassword $uuid $hosts $hmac\n"; + $confirmstring .= CGI::escapeHTML("confirm sudopassword $uuid $hosts $hmac\n"); } }; if ($confirmstring ne '') { @@ -176,7 +186,10 @@ if (!($query->param('doupdate'))) { # Actually update stuff... my ($newpassword, $newstaddress); - &Util::FixParams($query); + # Good god, why would we want to do that here? it breaks password setting + # etc, and it doesn't prevent people from setting eveil stuff in ldap + # directly. + # &Util::FixParams($query); if (($query->param('labeleduri')) && ($query->param('labeleduri') !~ /^https?:\/\//i)) {