store voipPassword as an HA1
[mirror/userdir-ldap-cgi.git] / update.cgi
index 3663169..c4d121d 100755 (executable)
@@ -10,11 +10,13 @@ use strict vars;
 use CGI;
 use Data::UUID;
 use Digest::HMAC_SHA1 qw(hmac_sha1_hex);
+use Digest::MD5 qw(md5_hex);
 use Util;
 use English;
 use URI::Escape;
 use Crypt::PasswdMD5;
 use Net::LDAP qw(LDAP_SUCCESS LDAP_PROTOCOL_ERROR);
+use Net::LDAP::Util qw(ldap_explode_dn);
 
 my %config = &Util::ReadConfigFile;
 
@@ -264,7 +266,7 @@ if (!($query->param('doupdate'))) {
       &Util::HTMLError("Password check failed for voip-password: $msg.  Please go back and try again.");
     }
     # create a md5 crypted password
-    $newvoippassword = '{crypt}'.crypt($query->param('newpass'), &Util::CreateCryptSalt(1));
+    $newvoippassword = &md5_hex( ldap_explode_dn($editid)->[0]{UID} . '@debian.org:sip.debian.org:' . $query->param('newvoippass') );
 
     &Util::LDAPUpdate($ldap, $editdn, 'voipPassword', $newvoippassword);
   }