[Da-tools-commits] ./debian/userdir-ldap-cgi r111: Do not HTML escape stuff we just got from the user before writing it to LDAP,
Peter Palfrader
peter at palfrader.org
Tue Sep 16 14:29:40 UTC 2008
------------------------------------------------------------
revno: 111
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap-cgi
timestamp: Tue 2008-09-16 16:29:40 +0200
message:
Do not HTML escape stuff we just got from the user before writing it to LDAP,
set it as passwords, etc. Instead escape stuff we did read from LDAP.
modified:
debian/changelog
search.cgi
update.cgi
-------------- next part --------------
=== modified file 'debian/changelog'
--- a/debian/changelog 2008-09-15 12:26:06 +0000
+++ b/debian/changelog 2008-09-16 14:29:40 +0000
@@ -1,3 +1,11 @@
+userdir-ldap-cgi (0.3.19) unstable; urgency=low
+
+ * Do not HTML escape stuff we just got from the user before
+ writing it to LDAP, set it as passwords, etc. Instead
+ escape stuff we did read from LDAP.
+
+ -- Peter Palfrader <weasel at debian.org> Tue, 16 Sep 2008 16:21:32 +0200
+
userdir-ldap-cgi (0.3.18) unstable; urgency=low
* Add password checking via a python wrapper.
=== modified file 'search.cgi'
--- a/search.cgi 2008-07-15 13:11:08 +0000
+++ b/search.cgi 2008-09-16 14:29:40 +0000
@@ -118,6 +118,9 @@
foreach $dn (sort {$entries->{$a}->{sn}->[0] <=> $entries->{$b}->{sn}->[0]} keys(%$entries)) {
my $ok = 0;
$data = $entries->{$dn};
+ for my $key (keys %{$data}) {
+ @{$data->{$key}} = map { CGI::escapeHTML($_); } @{$data->{$key}};
+ }
# These are local variables.. i have enough global vars as it is... <sigh>
my ($ufdn, $login, $name, $icquin, $jabberjid, $email, $fingerprint,
=== modified file 'update.cgi'
--- a/update.cgi 2008-09-15 13:26:52 +0000
+++ b/update.cgi 2008-09-16 14:29:40 +0000
@@ -82,8 +82,9 @@
# 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 @@
$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 @@
$data{mailcallout} = "";
}
- $data{email} = join(", ", @{$entry->{emailforward}});
+ $data{email} = CGI::escapeHTML(join(", ", @{$entry->{emailforward}}));
my $genderselect = '<select name="gender">'
. '<option value="9"'
@@ -126,16 +128,16 @@
next;
}
$status =~ s/:.*//; # remove verification hmac, it's just noise here.
- my $e = "<tr><td>$hosts</td>
- <td>$status</td>
+ my $e = "<tr><td>".CGI::escapeHTML($hosts)."</td>
+ <td>".CGI::escapeHTML($status)."</td>
<td><small>not shown</small></td>
- <!--<td><small><code>$uuid</code></small></td>-->
- <td><input name=\"sudopassword-delete-$uuid\" type=\"checkbox\" value=\"delete\"> (delete)</td></tr>\n";
+ <!--<td><small><code>".CGI::escapeHTML($uuid)."</code></small></td>-->
+ <td><input name=\"sudopassword-delete-".CGI::escapeHTML($uuid)."\" type=\"checkbox\" value=\"delete\"> (delete)</td></tr>\n";
$sudopassword .= $e;
if ($status eq 'unconfirmed') {
my $data = join(':', 'confirm-new-password', $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 +178,10 @@
# 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)) {
More information about the Da-tools-commits
mailing list