diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2012-04-21 17:20:24 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-06-05 01:36:23 +0200 |
commit | 62ee2a5caf8b8e7750a650c7ebc9729beda48a89 (patch) | |
tree | 0563e68a778559bbf0ac4fd67824fe8b5c34d577 /source4/dsdb/samdb/ldb_modules | |
parent | ad383ac8887eb5d44c2f2396e25a167c66b02ae6 (diff) | |
download | samba-62ee2a5caf8b8e7750a650c7ebc9729beda48a89.tar.gz samba-62ee2a5caf8b8e7750a650c7ebc9729beda48a89.tar.bz2 samba-62ee2a5caf8b8e7750a650c7ebc9729beda48a89.zip |
s4:samldb LDB module - "userAccountControl" = 0 means UF_NORMAL_ACCOUNT on add
Windows Server 2008 has changed semantics in comparison to Server 2003.
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samldb.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index da9c966ddd..cd13900bf5 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -990,7 +990,7 @@ static int samldb_objectclass_trigger(struct samldb_ctx *ac) switch(ac->type) { case SAMLDB_TYPE_USER: { - bool uac_generated = false; + bool uac_generated = false, uac_add_flags = false; /* Step 1.2: Default values */ ret = samdb_find_or_add_attribute(ldb, ac->msg, @@ -1032,6 +1032,7 @@ static int samldb_objectclass_trigger(struct samldb_ctx *ac) return ret; } uac_generated = true; + uac_add_flags = true; } el = ldb_msg_find_element(ac->msg, "userAccountControl"); @@ -1042,6 +1043,11 @@ static int samldb_objectclass_trigger(struct samldb_ctx *ac) user_account_control = ldb_msg_find_attr_as_uint(ac->msg, "userAccountControl", 0); + /* "userAccountControl" = 0 means "UF_NORMAL_ACCOUNT" */ + if (user_account_control == 0) { + user_account_control = UF_NORMAL_ACCOUNT; + uac_generated = true; + } /* Temporary duplicate accounts aren't allowed */ if ((user_account_control & UF_TEMP_DUPLICATE_ACCOUNT) != 0) { @@ -1124,8 +1130,10 @@ static int samldb_objectclass_trigger(struct samldb_ctx *ac) * has been generated here (tested against Windows * Server) */ if (uac_generated) { - user_account_control |= UF_ACCOUNTDISABLE; - user_account_control |= UF_PASSWD_NOTREQD; + if (uac_add_flags) { + user_account_control |= UF_ACCOUNTDISABLE; + user_account_control |= UF_PASSWD_NOTREQD; + } ret = samdb_msg_set_uint(ldb, ac->msg, ac->msg, "userAccountControl", |