diff options
author | Gary Lockyer <gary@catalyst.net.nz> | 2018-04-04 11:55:00 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-05-10 20:02:22 +0200 |
commit | 79ba530aaf76be639143530ab6e28d1e3696dfd2 (patch) | |
tree | 56cffd2b97acbeb9c2262fb95f0c4c1a0af8ce5e | |
parent | 52dc959bb21a102a14437812418bbb75b0bb231f (diff) | |
download | samba-79ba530aaf76be639143530ab6e28d1e3696dfd2.tar.gz |
dsdb: refactor password attibutes to constant
The password attributes are defined as literal in two places in the
password_hash code. They will also be needed to support password change
logging. This patch replaces the individual definitions with a shared
constant.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source4/dsdb/common/util.h | 6 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/password_hash.c | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/source4/dsdb/common/util.h b/source4/dsdb/common/util.h index ede6d8b0763..85fabde3c29 100644 --- a/source4/dsdb/common/util.h +++ b/source4/dsdb/common/util.h @@ -65,6 +65,12 @@ bool is_attr_in_list(const char * const * attrs, const char *attr); #define DSDB_SECRET_ATTRIBUTES_COMMA , #define DSDB_SECRET_ATTRIBUTES DSDB_SECRET_ATTRIBUTES_EX(DSDB_SECRET_ATTRIBUTES_COMMA) +#define DSDB_PASSWORD_ATTRIBUTES \ + "userPassword", \ + "clearTextPassword", \ + "unicodePwd", \ + "dBCSPwd" + struct GUID; char *NS_GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid); diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index 146fb6fa2c3..2641cb9c064 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -4008,10 +4008,7 @@ static int password_hash_needed(struct ldb_module *module, const struct ldb_message *msg = NULL; struct ph_context *ac = NULL; const char *passwordAttrs[] = { - "userPassword", - "clearTextPassword", - "unicodePwd", - "dBCSPwd", + DSDB_PASSWORD_ATTRIBUTES, NULL }; const char **a = NULL; @@ -4242,8 +4239,7 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r { struct ldb_context *ldb = ldb_module_get_ctx(module); struct ph_context *ac = NULL; - const char *passwordAttrs[] = { "userPassword", "clearTextPassword", - "unicodePwd", "dBCSPwd", NULL }, **l; + const char *passwordAttrs[] = {DSDB_PASSWORD_ATTRIBUTES, NULL}, **l; unsigned int del_attr_cnt, add_attr_cnt, rep_attr_cnt; struct ldb_message_element *passwordAttr; struct ldb_message *msg; |