From: Martin Zobel-Helas Date: Fri, 9 Mar 2012 18:51:32 +0000 (+0100) Subject: remove code duplication X-Git-Tag: release-0.3.40~70 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap-cgi.git;a=commitdiff_plain;h=dce01ebc1c99705de3acd1638edf0b9301ddf8cb remove code duplication --- diff --git a/Util.pm b/Util.pm index f6be1ed..2b230ab 100644 --- a/Util.pm +++ b/Util.pm @@ -34,28 +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); - - open (F, "param('doupdate'))) { } # create a md5 crypted password - $newwebpassword = apache_md5_crypt($query->param('newwebpass'), &Util::CreateMD5Salt()); + $newwebpassword = apache_md5_crypt($query->param('newwebpass'), &Util::CreateCryptSalt(2)); &Util::LDAPUpdate($ldap, $editdn, 'webPassword', $newwebpassword); }