summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-01-30 23:53:47 +0000
committerAndrew Bartlett <abartlet@samba.org>2004-01-30 23:53:47 +0000
commitc21764b9214dce72f3c07a578d9c6a5c120bd95f (patch)
treecc2a2df72b76718ccf3828d98257ce617162de3b /source3
parent14fb4b8e06368a2492f277492311fefdfffadaee (diff)
downloadsamba-c21764b9214dce72f3c07a578d9c6a5c120bd95f.tar.gz
samba-c21764b9214dce72f3c07a578d9c6a5c120bd95f.tar.bz2
samba-c21764b9214dce72f3c07a578d9c6a5c120bd95f.zip
(merge from 3.0)
If we are setting the NT or LM password to NULL, remove the attribute rather than writing XXXXX Andrew Bartlett (This used to be commit 2ae9672f811c91c95ee2ddfd4b0dcc6b0f4fa192)
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_ldap.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index ff2b5cf762..dcb2040530 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -910,27 +910,41 @@ static BOOL init_ldap_from_sam (struct ldapsam_privates *ldap_state,
if ((pdb_get_acct_ctrl(sampass)&(ACB_WSTRUST|ACB_SVRTRUST|ACB_DOMTRUST))
|| (lp_ldap_passwd_sync()!=LDAP_PASSWD_SYNC_ONLY)) {
- pdb_sethexpwd(temp, pdb_get_lanman_passwd(sampass),
- pdb_get_acct_ctrl(sampass));
-
- if (need_update(sampass, PDB_LMPASSWD))
- smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
- get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_LMPW),
- temp);
-
- pdb_sethexpwd (temp, pdb_get_nt_passwd(sampass),
- pdb_get_acct_ctrl(sampass));
-
- if (need_update(sampass, PDB_NTPASSWD))
- smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
- get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_NTPW),
- temp);
+ if (need_update(sampass, PDB_LMPASSWD)) {
+ uchar *lm_pw = pdb_get_lanman_passwd(sampass);
+ if (lm_pw) {
+ pdb_sethexpwd(temp, lm_pw,
+ pdb_get_acct_ctrl(sampass));
+ smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
+ get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_LMPW),
+ temp);
+ } else {
+ smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
+ get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_LMPW),
+ NULL);
+ }
+ }
+ if (need_update(sampass, PDB_NTPASSWD)) {
+ uchar *nt_pw = pdb_get_nt_passwd(sampass);
+ if (nt_pw) {
+ pdb_sethexpwd(temp, nt_pw,
+ pdb_get_acct_ctrl(sampass));
+ smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
+ get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_NTPW),
+ temp);
+ } else {
+ smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
+ get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_NTPW),
+ NULL);
+ }
+ }
- slprintf (temp, sizeof (temp) - 1, "%li", pdb_get_pass_last_set_time(sampass));
- if (need_update(sampass, PDB_PASSLASTSET))
+ if (need_update(sampass, PDB_PASSLASTSET)) {
+ slprintf (temp, sizeof (temp) - 1, "%li", pdb_get_pass_last_set_time(sampass));
smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods,
get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_PWD_LAST_SET),
temp);
+ }
}
/* FIXME: Hours stuff goes in LDAP */