[Svn] r4019 - in trunk/plugins/password: . drivers

trac at roundcube.net trac at roundcube.net
Thu Sep 30 09:02:52 CEST 2010


Author: alec
Date: 2010-09-30 02:02:52 -0500 (Thu, 30 Sep 2010)
New Revision: 4019

Modified:
   trunk/plugins/password/config.inc.php.dist
   trunk/plugins/password/drivers/ldap.php
   trunk/plugins/password/drivers/ldap_simple.php
   trunk/plugins/password/package.xml
Log:
- Added password_ldap_lchattr option (#1486927) 


Modified: trunk/plugins/password/config.inc.php.dist
===================================================================
--- trunk/plugins/password/config.inc.php.dist	2010-09-30 06:50:48 UTC (rev 4018)
+++ trunk/plugins/password/config.inc.php.dist	2010-09-30 07:02:52 UTC (rev 4019)
@@ -187,7 +187,13 @@
 // Default: true
 $rcmail_config['password_ldap_force_replace'] = true;
 
+// LDAP Password Last Change Date
+// Some places use an attribute to store the date of the last password change
+// The date is meassured in "days since epoch" (an integer value)
+// Whenever the password is changed, the attribute will be updated if set (e.g. shadowLastChange)
+$rcmail_config['password_ldap_lchattr'] = '';
 
+
 // DirectAdmin Driver options
 // --------------------------
 // The host which changes the password

Modified: trunk/plugins/password/drivers/ldap.php
===================================================================
--- trunk/plugins/password/drivers/ldap.php	2010-09-30 06:50:48 UTC (rev 4018)
+++ trunk/plugins/password/drivers/ldap.php	2010-09-30 07:02:52 UTC (rev 4019)
@@ -80,12 +80,21 @@
     if (!$userEntry->replace(array($pwattr => $newCryptedPassword), $force)) {
         return PASSWORD_CONNECT_ERROR;
     }
+
+    // Updating PasswordLastChange Attribute if desired
+    if ($lchattr = $rcmail->config->get('password_ldap_lchattr')) {
+       $current_day = (int)(time() / 86400);
+       if (!$userEntry->replace(array($lchattr => $current_day), $force)) {
+           return PASSWORD_CONNECT_ERROR;
+       }
+    }
+
     if (Net_LDAP2::isError($userEntry->update())) {
         return PASSWORD_CONNECT_ERROR;
     }
     
     // All done, no error
-    return PASSWORD_SUCCESS;    
+    return PASSWORD_SUCCESS;
 }
 
 /**
@@ -269,5 +278,3 @@
 
     return $str;
 }
-
-?>

Modified: trunk/plugins/password/drivers/ldap_simple.php
===================================================================
--- trunk/plugins/password/drivers/ldap_simple.php	2010-09-30 06:50:48 UTC (rev 4018)
+++ trunk/plugins/password/drivers/ldap_simple.php	2010-09-30 07:02:52 UTC (rev 4019)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * Simple LDAP Password Driver
  *
@@ -12,7 +13,7 @@
 function password_save($curpass, $passwd)
 {
 	$rcmail = rcmail::get_instance();
-	
+
 	/* Connect */
 	if (!$ds = ldap_connect($rcmail->config->get('password_ldap_host'), $rcmail->config->get('password_ldap_port'))) {
 		ldap_unbind($ds);
@@ -24,7 +25,7 @@
 		ldap_unbind($ds);
 		return PASSWORD_CONNECT_ERROR;
 	}
-	
+
 	/* Start TLS */
 	if ($rcmail->config->get('password_ldap_starttls')) {
 		if (!ldap_start_tls($ds)) {
@@ -72,6 +73,12 @@
 	}
 	
 	$entree[$rcmail->config->get('password_ldap_pwattr')] = $passwd;
+
+	/* Updating PasswordLastChange Attribute if desired */
+	if ($lchattr = $rcmail->config->get('password_ldap_lchattr')) {
+		$entree[$lchattr] = (int)(time() / 86400)
+	}
+
 	
 	if (!ldap_modify($ds, $user_dn, $entree)) {
 		ldap_unbind($ds);

Modified: trunk/plugins/password/package.xml
===================================================================
--- trunk/plugins/password/package.xml	2010-09-30 06:50:48 UTC (rev 4018)
+++ trunk/plugins/password/package.xml	2010-09-30 07:02:52 UTC (rev 4019)
@@ -15,10 +15,10 @@
 		<email>alec at alec.pl</email>
 		<active>yes</active>
 	</lead>
-	<date>2010-09-29</date>
-	<time>19:00:00</time>
+	<date>2010-09-30</date>
+	<time>09:00:00</time>
 	<version>
-		<release>1.8</release>
+		<release>1.9</release>
 		<api>1.6</api>
 	</version>
 	<stability>
@@ -27,8 +27,7 @@
 	</stability>
 	<license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license>
 	<notes>
-- Added possibility to display extended error messages (#1486704)
-- Added extended error messages in Poppassd driver (#1486704)
+- Added password_ldap_lchattr option (#1486927)
     </notes>
 	<contents>
 		<dir baseinstalldir="/" name="/">
@@ -170,5 +169,22 @@
 - Added chpass-wrapper.py script to improve security (#1486987)
             </notes>
 	    </release>
+        <release>
+        	<date>2010-09-29</date>
+        	<time>19:00:00</time>
+	        <version>
+		        <release>1.8</release>
+		        <api>1.6</api>
+	        </version>
+	        <stability>
+		        <release>stable</release>
+		        <api>stable</api>
+	        </stability>
+	        <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license>
+	        <notes>
+- Added possibility to display extended error messages (#1486704)
+- Added extended error messages in Poppassd driver (#1486704)
+            </notes>
+        </release>
     </changelog>
 </package>

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list