X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap-cgi.git;a=blobdiff_plain;f=Util.pm;h=27060d703c80000cd78b748590e095f19cdcd1a5;hp=374a592a80c0382bacc0ce86d9650c5928431aa2;hb=5cea731d1b6f9504bd695fd2f201761c35f71a2c;hpb=80ed561a914ae1af6948747933e260c4623df222 diff --git a/Util.pm b/Util.pm index 374a592..27060d7 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 @@ -33,21 +33,26 @@ sub CreateKey { } sub CreateCryptSalt { + # CreateCryptSalt(type = 0, skip_header = 0) # this can create either a DES type salt or a MD5 salt + # 0 for DES, 1 for MD5 salt + # if skip_header is 0, does not add $1$ for md5 salts. my $md5 = shift; # do we want a MD5 salt? + my $no_crypttype_header = shift; my $validstr = './0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; my @valid = split(//,$validstr); my ($in, $out); - + my $cryptsaltlen = ($md5 ? 8 : 2); - + 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); }; };