From 9bf8303050e83100925f997fedb909c3e3d79dbf Mon Sep 17 00:00:00 2001 From: alec Date: Tue, 28 Dec 2010 12:48:56 +0000 Subject: - ldap/ldap_simple drivers: support Samba password change git-svn-id: https://svn.roundcube.net/trunk@4375 208e9e7b-5314-0410-a742-e7e81cd9613c --- plugins/password/drivers/ldap_simple.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'plugins/password/drivers/ldap_simple.php') diff --git a/plugins/password/drivers/ldap_simple.php b/plugins/password/drivers/ldap_simple.php index 38db9f129..67f53d091 100644 --- a/plugins/password/drivers/ldap_simple.php +++ b/plugins/password/drivers/ldap_simple.php @@ -66,19 +66,25 @@ function password_save($curpass, $passwd) } /* Crypting new password */ - $passwd = ldap_simple_hash_password($passwd, $rcmail->config->get('password_ldap_encodage')); - if (!$passwd) { + $crypted_pass = ldap_simple_hash_password($passwd, $rcmail->config->get('password_ldap_encodage')); + if (!$crypted_pass) { ldap_unbind($ds); return PASSWORD_CRYPT_ERROR; } - $entree[$rcmail->config->get('password_ldap_pwattr')] = $passwd; + $entree[$rcmail->config->get('password_ldap_pwattr')] = $crypted_pass; /* Updating PasswordLastChange Attribute if desired */ if ($lchattr = $rcmail->config->get('password_ldap_lchattr')) { $entree[$lchattr] = (int)(time() / 86400); } + /* Update Samba password fields */ + if ($smbattr = $rcmail->config->get('password_ldap_samba')) { + $sambaNTPassword = hash('md4', rcube_charset_convert($passwd, RCMAIL_CHARSET, 'UTF-16LE')); + $entree['sambaNTPassword'] = $sambaNTPassword; + $entree['sambaPwdLastSet'] = time(); + } if (!ldap_modify($ds, $user_dn, $entree)) { ldap_unbind($ds); -- cgit v1.2.3