From dce01ebc1c99705de3acd1638edf0b9301ddf8cb Mon Sep 17 00:00:00 2001 From: Martin Zobel-Helas Date: Fri, 9 Mar 2012 19:51:32 +0100 Subject: [PATCH] remove code duplication --- Util.pm | 26 ++++++++------------------ update.cgi | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-) 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); } -- 2.20.1