X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap-cgi.git;a=blobdiff_plain;f=search.cgi;h=5a328c093297b1021f398de4f1c2686ca2f71303;hp=ff99da35e99c8fea32a45f736debfd4b19c743ac;hb=03a2094f69b5b8d37b6d8d3734c46788a76292f2;hpb=532616d83a8d807b9315d88d9afb47f842577382 diff --git a/search.cgi b/search.cgi index ff99da3..5a328c0 100755 --- a/search.cgi +++ b/search.cgi @@ -11,7 +11,7 @@ use strict vars; use CGI; use Util; use URI::Escape; -use Net::LDAP qw(:all); +use Net::LDAP qw(LDAP_SUCCESS LDAP_PROTOCOL_ERROR); # Global settings... my %config = &Util::ReadConfigFile; @@ -117,11 +117,18 @@ if (!$dosearch) { # Format the output.... foreach $dn (sort {$entries->{$a}->{sn}->[0] <=> $entries->{$b}->{sn}->[0]} keys(%$entries)) { my $ok = 0; - $data = $entries->{$dn}; - # These are local variables.. i have enough global vars as it is... my ($ufdn, $login, $name, $icquin, $jabberjid, $email, $fingerprint, $address, $latlong, $vacation, $created, $modified, $lastseen, $gender) = undef; + + # Last seen information (Echelon) + $lastseen = &Util::FormatLastSeen($entries->{$dn}->{"activity-pgp"}->[0], + $entries->{$dn}->{"activity-from"}->[0]); + + $data = $entries->{$dn}; + for my $key (keys %{$data}) { + @{$data->{$key}} = map { CGI::escapeHTML($_); } @{$data->{$key}}; + } $ufdn = $dn; # Net::LDAP does not have a dn2ufn function, but this is close enough :) @@ -176,10 +183,6 @@ if (!$dosearch) { $modified = &Util::FormatTimestamp($data->{modifytimestamp}->[0]); $created = &Util::FormatTimestamp($data->{createtimestamp}->[0]); - # Last seen information (Echelon) - $lastseen = &Util::FormatLastSeen($data->{"activity-pgp"}->[0], - $data->{"activity-from"}->[0]); - # Link in the debian login id $login = $data->{uid}->[0]; $login = "$login"; @@ -188,7 +191,7 @@ if (!$dosearch) { $vacation = $data->{onvacation}->[0] if ($authtoken && $id); # OK, now generate output... (i.e. put the output into the buffer ) - $outsub{searchresults} .= ''; + $outsub{searchresults} .= '
'; $outsub{searchresults} .= '\n";
'."$name "; $outsub{searchresults} .= "($ufdn)