phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc class.common.inc.php,1.133,1.134


From: Miles Lott <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.common.inc.php,1.133,1.134
Date: Mon, 13 May 2002 21:02:22 -0400

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv27596/phpgwapi/inc

Modified Files:
        class.common.inc.php 
Log Message:
Add in sha passwd crypt for ldap (requires mhash to configure and use) ...
Concept by Matt Pavlovich <address@hidden>



Index: class.common.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.common.inc.php,v
retrieving revision 1.133
retrieving revision 1.134
diff -C2 -r1.133 -r1.134
*** class.common.inc.php        30 Apr 2002 03:35:52 -0000      1.133
--- class.common.inc.php        14 May 2002 01:02:19 -0000      1.134
***************
*** 1157,1160 ****
--- 1157,1169 ----
                        return $ldappassword;
                }
+ 
+               function sha_cryptpasswd($userpass)
+               {
+                       $hash = base64_encode(mhash(MHASH_SHA1, $userpass));
+                       $ldappassword = sprintf('%s%s', '{SHA}', $hash);
+ 
+                       return $ldappassword;
+               }
+ 
                /*!
                @function encrypt_password
***************
*** 1165,1177 ****
                function encrypt_password($password)
                {
!                       if 
($GLOBALS['phpgw_info']['server']['ldap_encryption_type'] == 'DES')
                        {
                                $salt       = $this->randomstring(2);
                                $e_password = $this->des_cryptpasswd($password, 
$salt);
                        }
!                       if 
($GLOBALS['phpgw_info']['server']['ldap_encryption_type'] == 'MD5')
                        {
                                $salt       = $this->randomstring(8);
                                $e_password = $this->md5_cryptpasswd($password, 
$salt);
                        }
                        return $e_password;
--- 1174,1199 ----
                function encrypt_password($password)
                {
!                       
if($GLOBALS['phpgw_info']['server']['ldap_encryption_type'] == 'DES')
                        {
                                $salt       = $this->randomstring(2);
                                $e_password = $this->des_cryptpasswd($password, 
$salt);
                        }
!                       
if($GLOBALS['phpgw_info']['server']['ldap_encryption_type'] == 'MD5')
                        {
                                $salt       = $this->randomstring(8);
                                $e_password = $this->md5_cryptpasswd($password, 
$salt);
+                       }
+                       
if($GLOBALS['phpgw_info']['server']['ldap_encryption_type'] == 'SHA')
+                       {
+                               if(@function_exists('mhash'))
+                               {
+                                       $e_password = 
$this->sha_cryptpasswd($password);
+                               }
+                               else
+                               {
+                                       /* this should error instead... */
+                                       $salt       = $this->randomstring(8);
+                                       $e_password = 
$this->md5_cryptpasswd($password, $salt);
+                               }
                        }
                        return $e_password;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]