X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap-cgi.git;a=blobdiff_plain;f=Util.pm;h=f6be1ed9ffdcc428fd363fddc1da06e1a63c1603;hp=e97a9e9ea133379222c7709a034dfad2ea5c6daa;hb=9b394648f35965c5b6e18a8ff12af25d73866f7a;hpb=7e3253a8e182b7f49f222a760af741dbd27f8367
diff --git a/Util.pm b/Util.pm
index e97a9e9..f6be1ed 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
@@ -50,6 +50,22 @@ sub CreateCryptSalt {
return ($md5 ? "\$1\$$out\$" : $out);
}
+sub CreateMD5Salt {
+ my $validstr = './0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ my @valid = split(//,$validstr);
+ my ($in, $out);
+
+ my $cryptsaltlen = 8;
+
+ open (F, "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";
}
@@ -349,12 +370,12 @@ sub UpgradeConnection($) {
my ($ldap) = @_;
my $mesg = $ldap->start_tls(
verify => 'require',
- capath => '/etc/ssl/certs/'
+ cafile => '/etc/ssl/certs/spi-cacert-2008.pem'
);
$mesg->sync;
if ($mesg->code != LDAP_SUCCESS) {
print "Content-type: text/html; charset=utf-8\n\n";
- print "