X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=Util.pm;h=2b230abbfba893cf619e44dbd40f637d6620afaf;hb=dcd50e6d13ea0ca9c07914f1305c4eb26f062113;hp=b48f6dcd1db92d6f2b6aa4c85a334ce39d87fdda;hpb=3bce39d94939aaf999189e4aaed805858a996153;p=mirror%2Fuserdir-ldap-cgi.git diff --git a/Util.pm b/Util.pm index b48f6dc..2b230ab 100644 --- a/Util.pm +++ b/Util.pm @@ -34,12 +34,16 @@ sub CreateKey { sub CreateCryptSalt { # this can create either a DES type salt or a MD5 salt - my $md5 = shift; # do we want a MD5 salt? + # 0 for DES, 1 for MD5 salt and 2 for apache MD5 salt + my $type = shift; my $validstr = './0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; my @valid = split(//,$validstr); my ($in, $out); - my $cryptsaltlen = ($md5 ? 8 : 2); + my $cryptsaltlen = 2; + if (($type == 1)||($type == 2)) { + $cryptsaltlen = 8; + } open (F, "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); }; };