X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=Util.pm;h=001de372e5e232fc5637a0995cd30a107d35af0d;hb=86db90437e60869cae6c0a7689e63d277991c52f;hp=7f19694faa6e72f1d5c595123fa0238d31fe61fe;hpb=39f1dbe07f85a3c83b181c88ddf639a256757779;p=mirror%2Fuserdir-ldap-cgi.git diff --git a/Util.pm b/Util.pm index 7f19694..001de37 100644 --- a/Util.pm +++ b/Util.pm @@ -7,7 +7,7 @@ package Util; use strict; use Date::Manip qw(ParseDate); -use Net::LDAP qw(:all); +use Net::LDAP qw(LDAP_SUCCESS LDAP_PROTOCOL_ERROR); use English; my $blocksize = 8; # A blowfish block is 8 bytes @@ -228,16 +228,21 @@ sub FormatLastSeen { my ($d1, $d2, $lastseen); return "No activity detected" if (!$lastseenpgp && !$lastseenfrom); + $lastseen = $lastseenpgp; $lastseen = $lastseenfrom if (!$lastseenpgp); if ($lastseenfrom && $lastseenpgp) { - ($d1) = ($lastseenpgp =~ /^\[(.+?)\]/); $d1 = ParseDate($d1); + ($d1) = ($lastseenpgp =~ /^\[(.+?)\]/); $d1 = ParseDate($d1); ($d2) = ($lastseenfrom =~ /^\[(.+?)\]/); $d2 = ParseDate($d2); $lastseen = (($d1 gt $d2) ? $lastseenpgp : $lastseenfrom); } - my ($date,$user,$list,$msgid) = ($lastseen =~ /^\[(.+?)\]\s+"(.+?)"\s+"(?:<(.+?)>.*?|\-)"\s+"<(.+?)>"/); + my ($date,$user,$list,$msgid) = ($lastseen =~ /^\[(.+?)\]\s+"(.+?)"\s+"(?:<(.+?)>.*?|\-)"\s+"(<.+?>)"/); $list = "on $list" if ($list); + $date = CGI::escapeHTML($date); + $user = CGI::escapeHTML($user); + $list = CGI::escapeHTML($list); + $msgid = CGI::escapeHTML($msgid); return "$date $list
 Message ID: $msgid"; } @@ -354,7 +359,7 @@ sub UpgradeConnection($) { $mesg->sync; if ($mesg->code != LDAP_SUCCESS) { print "Content-type: text/html; charset=utf-8\n\n"; - print "

STARTTLS failed: "..$mesg->error."

\n"; + print "

STARTTLS failed: ".$mesg->error."

\n"; exit(1); }; };