Index: ldapauth.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ldap_integration/ldapauth.module,v
retrieving revision 1.28
diff -u -F^f -r1.28 ldapauth.module
--- ldapauth.module	22 Aug 2007 23:55:21 -0000	1.28
+++ ldapauth.module	16 Nov 2007 16:55:03 -0000
@@ -918,7 +997,10 @@ function _ldapauth_save_user($login_stri
     //if (variable_get('ldap_login_process', LDAP_FIRST_LDAP) == LDAP_FIRST_LDAP) {
     if (variable_get('ldap_forget_passwords', true)) {
       // generate a random generic password using drupal api
-      $pass = user_password(20);
+      $save_pass = user_password(20);
+    }
+    else {
+      $save_pass = $pass;
     }
     //   2. 'mail' => we cannot access the LDAP info from here, so
     //                we just write anything as e-mail address. If
@@ -937,7 +1019,7 @@ function _ldapauth_save_user($login_stri
       
     // Here ldap_dn should not be set (as it was in the 4.7- versions). 
     // The DN should be determined by the specific LDAP repo that is being used at login time
-    $userinfo = array('name' => $login_string, 'pass' => $pass, 'mail' => $mail, 'init' => $init, 'status' => 1, 'authname_ldapauth' => $login_string, 'ldap_authentified' => TRUE, 'ldap_dn' => $dn);        
+    $userinfo = array('name' => $login_string, 'pass' => $save_pass, 'mail' => $mail, 'init' => $init, 'status' => 1, 'authname_ldapauth' => $login_string, 'ldap_authentified' => TRUE, 'ldap_dn' => $dn);        
     $user = user_save('', $userinfo);
     watchdog('user', t('New external user - ldapauth: %user using module %module.', array('%user' => theme('placeholder', $login_string), '%module' => theme('placeholder', 'ldapauth'))), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $user->uid .'/edit'));
   }
