store voipPassword as an HA1
authorLuca Filipozzi <lfilipoz@emyr.net>
Tue, 14 Jan 2014 01:27:04 +0000 (01:27 +0000)
committerLuca Filipozzi <lfilipoz@emyr.net>
Tue, 14 Jan 2014 01:27:04 +0000 (01:27 +0000)
debian/control
update.cgi

index d6dd18a..e2d06d1 100644 (file)
@@ -14,6 +14,7 @@ Depends: userdir-ldap,
        libcrypt-passwdmd5-perl,
        libdate-manip-perl,
        libdigest-hmac-perl,
+       libdigest-md5-perl,
        libio-socket-ssl-perl,
        libnet-ldap-perl,
        libossp-uuid-perl,
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);
   }