[prev in list] [next in list] [prev in thread] [next in thread] 

List:       horde-dev
Subject:    [dev] passwd: patch...
From:       Marc Jauvin <marc () register4less ! com>
Date:       2003-06-30 21:00:19
[Download RAW message or body]

This message is in MIME format.


This code fixes the following problems:

- lib/Driver/sql.php (syntax error)
- lib/Driver.php (the order in which the encryption type is added to the
encrypted string.)


--
Marc Jauvin
450-441-5458
http://register4less.com
["passwd.patch" (text/plain)]

? test.php
Index: lib/Driver.php
===================================================================
RCS file: /repository/passwd/lib/Driver.php,v
retrieving revision 1.26
diff -u -r1.26 Driver.php
--- lib/Driver.php	27 Jun 2003 12:17:32 -0000	1.26
+++ lib/Driver.php	30 Jun 2003 20:56:04 -0000
@@ -161,29 +161,29 @@
             case 'plain':
                 break;
             case 'sha':
-                $new_password = ($show_encryption ? '{SHA}' : '');
-                $new_password .= base64_encode(mHash(MHASH_SHA1, $new_password));
+                $new_password = base64_encode(mHash(MHASH_SHA1, $new_password));
+                $new_password .= ($show_encryption ? '{SHA}' : '');
                 break;
             case 'crypt':
-                $new_password = ($show_encryption ? '{crypt}' : '');
-                $new_password .= crypt($new_password, substr($new_password, 0, 2));
+                $new_password = crypt($new_password, substr($new_password, 0, 2));
+                $new_password .= ($show_encryption ? '{crypt}' : '');
                 break;
             case 'md5-hex':
                 $new_password = md5($new_password);
                 break;
             case 'md5-base64':
-                $new_password = ($show_encryption ? '{MD5}' : '');
-                $new_password .= base64_encode(mHash(MHASH_MD5, $new_password));
+                $new_password = base64_encode(mHash(MHASH_MD5, $new_password));
+                $new_password .= ($show_encryption ? '{MD5}' : '');
                 break;
             case 'ssha':
-                $new_password = ($show_encryption ? '{SSHA}' : '');
                 $salt = mhash_keygen_s2k(MHASH_SHA1, $new_password, \
                substr(pack("h*", md5(mt_rand())), 0, 8), 4);
-                $new_password .= base64_encode(mHash(MHASH_SHA1, $new_password . \
$salt) . $salt); +                $new_password = base64_encode(mHash(MHASH_SHA1, \
$new_password . $salt) . $salt); +                $new_password .= ($show_encryption \
? '{SSHA}' : '');  break;
             case 'smd5':
-                $new_password = ($show_encryption ? '{SMD5}' : '');
                 $salt = mhash_keygen_s2k(MHASH_MD5, $new_password, substr(pack("h*", \
                md5(mt_rand())), 0, 8), 4);
-                $new_password .= base64_encode(mHash(MHASH_SMD5, $new_password . \
$salt) . $salt); +                $new_password = base64_encode(mHash(MHASH_SMD5, \
$new_password . $salt) . $salt); +                $new_password .= ($show_encryption \
? '{SMD5}' : '');  break;
             default:
                 return PEAR::raiseError(_("Password module is not properly \
                configured."));
Index: lib/Driver/sql.php
===================================================================
RCS file: /repository/passwd/lib/Driver/sql.php,v
retrieving revision 1.15
diff -u -r1.15 sql.php
--- lib/Driver/sql.php	27 Jun 2003 12:17:33 -0000	1.15
+++ lib/Driver/sql.php	30 Jun 2003 20:56:04 -0000
@@ -47,7 +47,7 @@
 
         /* Defaults to match Auth::sql default. */
         $this->_params['table']      = isset($params['table'])    ? $params['table'] \
                : 'horde_users';
-        $this->_params['encryption'] = isset($params['encryption']) \
$params['encryption'] : 'md5'; +        $this->_params['encryption'] = \
                isset($params['encryption']) ? $params['encryption'] : 'md5';
         $this->_params['user_col']   = isset($params['user_col']) ? \
                $params['user_col'] : 'user_uid';
         $this->_params['pass_col']   = isset($params['pass_col']) ? \
                $params['pass_col'] : 'user_pass';
         $this->_params['show_encryption'] = isset($params['show_encryption']) ? \
$params['show_encryption'] : false;



-- 
Horde developers mailing list
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: dev-unsubscribe@lists.horde.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic