1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-25 06:04:04 +03:00

ldb: Cope with a->name being *

The default schema when loaded from the DB will have a name of *, not NULL.

This feature is rarely used, and was incompatible with the rdn_name module
until now.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2016-11-29 16:20:07 +13:00
parent ea3c96647f
commit 4dfe84a984

View File

@ -144,7 +144,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
attribute = ldb_msg_find_element(msg, rdn_name); attribute = ldb_msg_find_element(msg, rdn_name);
if (!attribute) { if (!attribute) {
/* add entry with normalised RDN information if possible */ /* add entry with normalised RDN information if possible */
if (a->name != NULL) { if (a->name != NULL && strcmp(a->name, "*") != 0) {
ret = ldb_msg_add_value(msg, a->name, &rdn_val, NULL); ret = ldb_msg_add_value(msg, a->name, &rdn_val, NULL);
} else { } else {
ret = ldb_msg_add_value(msg, rdn_name, &rdn_val, NULL); ret = ldb_msg_add_value(msg, rdn_name, &rdn_val, NULL);
@ -154,7 +154,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
} }
} else { } else {
/* normalise attribute name if possible */ /* normalise attribute name if possible */
if (a->name != NULL) { if (a->name != NULL && strcmp(a->name, "*") != 0) {
attribute->name = a->name; attribute->name = a->name;
} }
/* normalise attribute value */ /* normalise attribute value */
@ -292,7 +292,7 @@ static int rdn_rename_callback(struct ldb_request *req, struct ldb_reply *ares)
goto error; goto error;
} }
if (a->name != NULL) { if (a->name != NULL && strcmp(a->name, "*") != 0) {
rdn_name = a->name; rdn_name = a->name;
} }
@ -440,7 +440,7 @@ static int rdn_name_modify(struct ldb_module *module, struct ldb_request *req)
return ldb_module_operr(module); return ldb_module_operr(module);
} }
if (a->name != NULL) { if (a->name != NULL && strcmp(a->name, "*") != 0) {
rdn_name = a->name; rdn_name = a->name;
} }