The branch, master has been updated via 93db960... s4:samldb LDB module - this codepart isn't needed due to the objectclass LDB module via df63b2c... s4:get_last_structural_class - only real structural classes can be candidates for fetching the last one via ae9faaa... s4:ldap.py - enhance the RDN name test to show that invalid "name" attributes are allowed on add operations via dd64b25... s4:rdn_name LDB module - use "ldb_msg_remove_attr" for deleting attributes via 430491b... s4:rdn_name LDB module - remove "rdn_name_find_attribute" via cadf774... s4:dsdb/common/util.c - provide a better implementation of the "samdb_msg_add_(add/del)val" calls via fa2a86e... ldb:ltdb_filter_attrs - fix a counter variable type via f3f9106... s4:ldap_server/ldap_backend.c - send back also the extended error message if it exists via 45171d6... s4:ridalloc LDB module - add more "talloc_free"s where useful via 787a42e... s4:acl LDB module - fix counter types where appropriate via fc037e0... s4:descriptor LDB module - cosmetic fixup via 2fbb8c0... s4:urgent_replication.py - specify the "dnsRoot" attribute which is requested on "crossRef" entries via 7896a35... s4:ldap.py - make sure that also the "posixuser" will be deleted on test breakages via b8ea2e0... s4:provision - fix typo in substitution variable from 62e0a74... Fix a long-standing bug with async io that would only be triggered by SMB2.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 93db960fae43913a423fe1e35a60acf5ed0cc437 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Sun Jun 6 19:12:48 2010 +0200 s4:samldb LDB module - this codepart isn't needed due to the objectclass LDB module When a "computer" entry will be added, also the inherited "user" objectclass is going to be specified. commit df63b2ca0e64897b18f8b6be8c31e16d62a96a30 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Fri Jun 4 21:10:41 2010 +0200 s4:get_last_structural_class - only real structural classes can be candidates for fetching the last one Classes with objectCategory = 1 are always structural, these with objectCategory = 0 also (as we can see in our Windows 2008 R2 schema file where class "Person" has 0 but is structural). Abstract classes and auxiliary ones cannot be considered (objectCategory = 2, 3) http://msdn.microsoft.com/en-us/library/ms677964(VS.85).aspx commit ae9faaa89449cf25c2e5e8b51e64ceaacba01832 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Thu Jun 3 18:05:52 2010 +0200 s4:ldap.py - enhance the RDN name test to show that invalid "name" attributes are allowed on add operations commit dd64b253fcd9013788093f6b98ebd14ef2308619 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Thu Jun 3 18:25:43 2010 +0200 s4:rdn_name LDB module - use "ldb_msg_remove_attr" for deleting attributes commit 430491b2df9e3512a98a88aa279f04a91c12be92 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Thu Jun 3 17:56:09 2010 +0200 s4:rdn_name LDB module - remove "rdn_name_find_attribute" It does exactly the same as "ldb_msg_find_element". commit cadf774f8b8af2aedcdd359acf51695e9f4b04db Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Mon May 31 14:52:46 2010 +0200 s4:dsdb/common/util.c - provide a better implementation of the "samdb_msg_add_(add/del)val" calls This supports now also coexisting add and delete message elements with the same attribute name. commit fa2a86ec61a80f7fe85a2bb9668885a0b287afd6 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Thu Jun 3 18:37:15 2010 +0200 ldb:ltdb_filter_attrs - fix a counter variable type commit f3f91063bd1f79c8734fa55e92392a8f30ec4144 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Sat Jun 5 14:33:52 2010 +0200 s4:ldap_server/ldap_backend.c - send back also the extended error message if it exists This message often contains suggestions how to fix issues. commit 45171d61083339a624a83a1412602475ce7978a6 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Sat Jun 5 17:45:51 2010 +0200 s4:ridalloc LDB module - add more "talloc_free"s where useful Some were missing on failure return branches. commit 787a42ef9972eca3f3889e2ad8b5e890b7c551fd Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Sat Jun 5 20:08:45 2010 +0200 s4:acl LDB module - fix counter types where appropriate commit fc037e029e23aeaa8debe1c17cf81bd3a859ae4a Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Sat Jun 5 19:58:28 2010 +0200 s4:descriptor LDB module - cosmetic fixup commit 2fbb8c08ef6042a7f479e3d9ef36ba7cc730de79 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Sun Jun 6 20:23:42 2010 +0200 s4:urgent_replication.py - specify the "dnsRoot" attribute which is requested on "crossRef" entries commit 7896a35da37c5d1cae44d864a5069df08d21013e Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Sat Jun 5 22:19:58 2010 +0200 s4:ldap.py - make sure that also the "posixuser" will be deleted on test breakages commit b8ea2e07575a6f152019a8fbe17bf65552fbd324 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Sun Jun 6 00:11:16 2010 +0200 s4:provision - fix typo in substitution variable ----------------------------------------------------------------------- Summary of changes: source4/dsdb/common/util.c | 118 +++++++++++++++----- source4/dsdb/samdb/ldb_modules/acl.c | 6 +- source4/dsdb/samdb/ldb_modules/descriptor.c | 8 +- source4/dsdb/samdb/ldb_modules/ridalloc.c | 3 + source4/dsdb/samdb/ldb_modules/samldb.c | 13 -- source4/dsdb/samdb/ldb_modules/util.c | 2 +- source4/ldap_server/ldap_backend.c | 57 +++++++--- source4/lib/ldb/ldb_tdb/ldb_search.c | 5 +- source4/lib/ldb/modules/rdn_name.c | 21 +--- source4/lib/ldb/tests/python/ldap.py | 5 +- source4/lib/ldb/tests/python/urgent_replication.py | 1 + source4/scripting/python/samba/provision.py | 2 +- source4/setup/provision_configuration.ldif | 2 +- 13 files changed, 154 insertions(+), 89 deletions(-) Changeset truncated at 500 lines: diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 408a959..811d474 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -837,52 +837,114 @@ int samdb_msg_add_delete(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struc } /* - add a add attribute value to a message + add an add attribute value to a message or enhance an existing attribute + which has the same name and the add flag set. */ -int samdb_msg_add_addval(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_message *msg, - const char *attr_name, const char *value) +int samdb_msg_add_addval(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, + struct ldb_message *msg, const char *attr_name, + const char *value) { struct ldb_message_element *el; - char *a, *v; + struct ldb_val val, *vals; + char *v; + unsigned int i; + bool found = false; int ret; - a = talloc_strdup(mem_ctx, attr_name); - if (a == NULL) - return LDB_ERR_OPERATIONS_ERROR; + v = talloc_strdup(mem_ctx, value); - if (v == NULL) + if (v == NULL) { return LDB_ERR_OPERATIONS_ERROR; - ret = ldb_msg_add_string(msg, a, v); - if (ret != 0) - return ret; - el = ldb_msg_find_element(msg, a); - if (el == NULL) + } + + val.data = (uint8_t *) v; + val.length = strlen(v); + + if (val.length == 0) { + /* allow empty strings as non-existent attributes */ + return LDB_SUCCESS; + } + + for (i = 0; i < msg->num_elements; i++) { + el = &msg->elements[i]; + if ((ldb_attr_cmp(el->name, attr_name) == 0) && + (el->flags == LDB_FLAG_MOD_ADD)) { + found = true; + break; + } + } + if (!found) { + ret = ldb_msg_add_empty(msg, attr_name, LDB_FLAG_MOD_ADD, + &el); + if (ret != LDB_SUCCESS) { + return ret; + } + } + + vals = talloc_realloc(msg, el->values, struct ldb_val, + el->num_values + 1); + if (vals == NULL) { return LDB_ERR_OPERATIONS_ERROR; - el->flags = LDB_FLAG_MOD_ADD; + } + el->values = vals; + el->values[el->num_values] = val; + ++(el->num_values); + return LDB_SUCCESS; } /* - add a delete attribute value to a message + add a delete attribute value to a message or enhance an existing attribute + which has the same name and the delete flag set. */ -int samdb_msg_add_delval(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_message *msg, - const char *attr_name, const char *value) +int samdb_msg_add_delval(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, + struct ldb_message *msg, const char *attr_name, + const char *value) { struct ldb_message_element *el; - char *a, *v; + struct ldb_val val, *vals; + char *v; + unsigned int i; + bool found = false; int ret; - a = talloc_strdup(mem_ctx, attr_name); - if (a == NULL) - return LDB_ERR_OPERATIONS_ERROR; + v = talloc_strdup(mem_ctx, value); - if (v == NULL) + if (v == NULL) { return LDB_ERR_OPERATIONS_ERROR; - ret = ldb_msg_add_string(msg, a, v); - if (ret != 0) - return ret; - el = ldb_msg_find_element(msg, a); - if (el == NULL) + } + + val.data = (uint8_t *) v; + val.length = strlen(v); + + if (val.length == 0) { + /* allow empty strings as non-existent attributes */ + return LDB_SUCCESS; + } + + for (i = 0; i < msg->num_elements; i++) { + el = &msg->elements[i]; + if ((ldb_attr_cmp(el->name, attr_name) == 0) && + (el->flags == LDB_FLAG_MOD_DELETE)) { + found = true; + break; + } + } + if (!found) { + ret = ldb_msg_add_empty(msg, attr_name, LDB_FLAG_MOD_DELETE, + &el); + if (ret != LDB_SUCCESS) { + return ret; + } + } + + vals = talloc_realloc(msg, el->values, struct ldb_val, + el->num_values + 1); + if (vals == NULL) { return LDB_ERR_OPERATIONS_ERROR; - el->flags = LDB_FLAG_MOD_DELETE; + } + el->values = vals; + el->values[el->num_values] = val; + ++(el->num_values); + return LDB_SUCCESS; } diff --git a/source4/dsdb/samdb/ldb_modules/acl.c b/source4/dsdb/samdb/ldb_modules/acl.c index d2b6a2b..1b84e8a 100644 --- a/source4/dsdb/samdb/ldb_modules/acl.c +++ b/source4/dsdb/samdb/ldb_modules/acl.c @@ -411,7 +411,8 @@ static int acl_childClasses(struct ldb_module *module, struct ldb_message_element *oc_el; struct ldb_message_element *allowedClasses; const struct dsdb_class *sclass; - int i, j, ret; + unsigned int i, j; + int ret; /* If we don't have a schema yet, we can't do anything... */ if (schema == NULL) { @@ -468,7 +469,8 @@ static int acl_childClassesEffective(struct ldb_module *module, struct ldb_control *as_system = ldb_request_get_control(ac->req, LDB_CONTROL_AS_SYSTEM_OID); struct dom_sid *sid = NULL; - int i, j, ret; + unsigned int i, j; + int ret; if (as_system != NULL) { as_system->critical = 0; diff --git a/source4/dsdb/samdb/ldb_modules/descriptor.c b/source4/dsdb/samdb/ldb_modules/descriptor.c index cfab5a0..08754ed 100644 --- a/source4/dsdb/samdb/ldb_modules/descriptor.c +++ b/source4/dsdb/samdb/ldb_modules/descriptor.c @@ -399,12 +399,12 @@ static int get_search_callback(struct ldb_request *req, struct ldb_reply *ares) switch (ares->type) { case LDB_REPLY_ENTRY: - if (ac->search_res != NULL) { + if (ac->search_res != NULL) { ldb_set_errstring(ldb, "Too many results"); talloc_free(ares); return ldb_module_done(ac->req, NULL, NULL, LDB_ERR_OPERATIONS_ERROR); - } + } ac->search_res = talloc_steal(ac, ares); break; @@ -449,12 +449,12 @@ static int get_search_oc_callback(struct ldb_request *req, struct ldb_reply *are switch (ares->type) { case LDB_REPLY_ENTRY: - if (ac->search_oc_res != NULL) { + if (ac->search_oc_res != NULL) { ldb_set_errstring(ldb, "Too many results"); talloc_free(ares); return ldb_module_done(ac->req, NULL, NULL, LDB_ERR_OPERATIONS_ERROR); - } + } ac->search_oc_res = talloc_steal(ac, ares); break; diff --git a/source4/dsdb/samdb/ldb_modules/ridalloc.c b/source4/dsdb/samdb/ldb_modules/ridalloc.c index 05aee77..e54d6b4 100644 --- a/source4/dsdb/samdb/ldb_modules/ridalloc.c +++ b/source4/dsdb/samdb/ldb_modules/ridalloc.c @@ -194,11 +194,13 @@ static int ridalloc_create_rid_set_ntds(struct ldb_module *module, TALLOC_CTX *m rid_set_dn = ldb_dn_copy(tmp_ctx, machine_dn); if (rid_set_dn == NULL) { ldb_module_oom(module); + talloc_free(tmp_ctx); return LDB_ERR_OPERATIONS_ERROR; } if (! ldb_dn_add_child_fmt(rid_set_dn, "CN=RID Set")) { ldb_module_oom(module); + talloc_free(tmp_ctx); return LDB_ERR_OPERATIONS_ERROR; } @@ -507,6 +509,7 @@ int ridalloc_allocate_rid(struct ldb_module *module, uint32_t *rid) uint64_t new_pool; ret = ridalloc_refresh_own_pool(module, &new_pool); if (ret != LDB_SUCCESS) { + talloc_free(tmp_ctx); return ret; } ret = dsdb_module_constrainted_update_integer(module, rid_set_dn, "rIDPreviousAllocationPool", diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index a068a29..8e5e0b4 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -1355,19 +1355,6 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req) } if (samdb_find_attribute(ldb, ac->msg, - "objectclass", "computer") != NULL) { - - /* make sure the computer object also has the 'user' - * objectclass so it will be handled by the next call */ - ret = samdb_find_or_add_value(ldb, ac->msg, - "objectclass", "user"); - if (ret != LDB_SUCCESS) { - talloc_free(ac); - return ret; - } - } - - if (samdb_find_attribute(ldb, ac->msg, "objectclass", "user") != NULL) { ret = samldb_check_rdn(module, ac->req->op.add.message->dn); diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c index 6512b26..bf92774 100644 --- a/source4/dsdb/samdb/ldb_modules/util.c +++ b/source4/dsdb/samdb/ldb_modules/util.c @@ -420,7 +420,7 @@ const struct dsdb_class * get_last_structural_class(const struct dsdb_schema *sc continue; } - if(tmp_class->objectClassCategory == 3) { + if(tmp_class->objectClassCategory > 1) { continue; } diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index d9f15b8..7767d05 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -34,13 +34,14 @@ return NT_STATUS_NO_MEMORY;\ } else if ( ! ldb_dn_validate(dn)) {\ result = LDAP_INVALID_DN_SYNTAX;\ - map_ldb_error(local_ctx, LDB_ERR_INVALID_DN_SYNTAX, &errstr);\ + map_ldb_error(local_ctx, LDB_ERR_INVALID_DN_SYNTAX, NULL,\ + &errstr);\ goto reply;\ }\ } while(0) static int map_ldb_error(TALLOC_CTX *mem_ctx, int ldb_err, - const char **errstring) + const char *add_err_string, const char **errstring) { WERROR err; @@ -166,6 +167,10 @@ static int map_ldb_error(TALLOC_CTX *mem_ctx, int ldb_err, *errstring = talloc_asprintf(mem_ctx, "%08x: %s", W_ERROR_V(err), ldb_strerror(ldb_err)); + if (add_err_string != NULL) { + *errstring = talloc_asprintf(mem_ctx, "%s - %s", *errstring, + add_err_string); + } /* result is 1:1 for now */ return ldb_err; @@ -488,7 +493,7 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) break; default: result = LDAP_PROTOCOL_ERROR; - map_ldb_error(local_ctx, LDB_ERR_PROTOCOL_ERROR, + map_ldb_error(local_ctx, LDB_ERR_PROTOCOL_ERROR, NULL, &errstr); errstr = talloc_asprintf(local_ctx, "%s. Invalid scope", errstr); @@ -638,7 +643,8 @@ reply: } } else { DEBUG(10,("SearchRequest: error\n")); - result = map_ldb_error(local_ctx, ldb_ret, &errstr); + result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb), + &errstr); } done->resultcode = result; @@ -697,7 +703,7 @@ static NTSTATUS ldapsrv_ModifyRequest(struct ldapsrv_call *call) default: result = LDAP_PROTOCOL_ERROR; map_ldb_error(local_ctx, - LDB_ERR_PROTOCOL_ERROR, &errstr); + LDB_ERR_PROTOCOL_ERROR, NULL, &errstr); errstr = talloc_asprintf(local_ctx, "%s. Invalid LDAP_MODIFY_* type", errstr); goto reply; @@ -734,14 +740,17 @@ reply: res = talloc_zero(local_ctx, struct ldb_result); NT_STATUS_HAVE_NO_MEMORY(res); ldb_ret = ldb_mod_req_with_controls(samdb, msg, call->request->controls, res); - result = map_ldb_error(local_ctx, ldb_ret, &errstr); + result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb), + &errstr); } modify_result = &modify_reply->msg->r.AddResponse; modify_result->dn = NULL; if (res->refs != NULL) { - modify_result->resultcode = map_ldb_error(local_ctx, LDB_ERR_REFERRAL, &errstr); + modify_result->resultcode = map_ldb_error(local_ctx, + LDB_ERR_REFERRAL, + NULL, &errstr); modify_result->errormessage = (errstr?talloc_strdup(modify_reply, errstr):NULL); modify_result->referral = talloc_strdup(call, *res->refs); } else { @@ -822,13 +831,16 @@ reply: res = talloc_zero(local_ctx, struct ldb_result); NT_STATUS_HAVE_NO_MEMORY(res); ldb_ret = ldb_add_with_context(samdb, msg, res); - result = map_ldb_error(local_ctx, ldb_ret, &errstr); + result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb), + &errstr); } add_result = &add_reply->msg->r.AddResponse; add_result->dn = NULL; if (res->refs != NULL) { - add_result->resultcode = map_ldb_error(local_ctx, LDB_ERR_REFERRAL, &errstr); + add_result->resultcode = map_ldb_error(local_ctx, + LDB_ERR_REFERRAL, NULL, + &errstr); add_result->errormessage = (errstr?talloc_strdup(add_reply,errstr):NULL); add_result->referral = talloc_strdup(call, *res->refs); } else { @@ -875,13 +887,16 @@ reply: res = talloc_zero(local_ctx, struct ldb_result); NT_STATUS_HAVE_NO_MEMORY(res); ldb_ret = ldb_delete_with_context(samdb, dn, res); - result = map_ldb_error(local_ctx, ldb_ret, &errstr); + result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb), + &errstr); } del_result = &del_reply->msg->r.DelResponse; del_result->dn = NULL; if (res->refs != NULL) { - del_result->resultcode = map_ldb_error(local_ctx, LDB_ERR_REFERRAL, &errstr); + del_result->resultcode = map_ldb_error(local_ctx, + LDB_ERR_REFERRAL, NULL, + &errstr); del_result->errormessage = (errstr?talloc_strdup(del_reply,errstr):NULL); del_result->referral = talloc_strdup(call, *res->refs); } else { @@ -928,14 +943,16 @@ static NTSTATUS ldapsrv_ModifyDNRequest(struct ldapsrv_call *call) if (ldb_dn_get_comp_num(newrdn) != 1) { result = LDAP_INVALID_DN_SYNTAX; - map_ldb_error(local_ctx, LDB_ERR_INVALID_DN_SYNTAX, &errstr); + map_ldb_error(local_ctx, LDB_ERR_INVALID_DN_SYNTAX, NULL, + &errstr); goto reply; } /* we can't handle the rename if we should not remove the old dn */ if (!req->deleteolddn) { result = LDAP_UNWILLING_TO_PERFORM; - map_ldb_error(local_ctx, LDB_ERR_UNWILLING_TO_PERFORM, &errstr); + map_ldb_error(local_ctx, LDB_ERR_UNWILLING_TO_PERFORM, NULL, + &errstr); errstr = talloc_asprintf(local_ctx, "%s. Old RDN must be deleted", errstr); goto reply; @@ -949,7 +966,7 @@ static NTSTATUS ldapsrv_ModifyDNRequest(struct ldapsrv_call *call) if (ldb_dn_get_comp_num(parentdn) < 1) { result = LDAP_AFFECTS_MULTIPLE_DSAS; map_ldb_error(local_ctx, LDB_ERR_AFFECTS_MULTIPLE_DSAS, - &errstr); + NULL, &errstr); errstr = talloc_asprintf(local_ctx, "%s. Error new Superior DN invalid", errstr); goto reply; @@ -975,13 +992,16 @@ reply: res = talloc_zero(local_ctx, struct ldb_result); NT_STATUS_HAVE_NO_MEMORY(res); ldb_ret = ldb_rename_with_context(samdb, olddn, newdn, res); - result = map_ldb_error(local_ctx, ldb_ret, &errstr); + result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb), + &errstr); } modifydn = &modifydn_r->msg->r.ModifyDNResponse; modifydn->dn = NULL; if (res->refs != NULL) { - modifydn->resultcode = map_ldb_error(local_ctx, LDB_ERR_REFERRAL, &errstr);; + modifydn->resultcode = map_ldb_error(local_ctx, + LDB_ERR_REFERRAL, NULL, + &errstr);; modifydn->errormessage = (errstr?talloc_strdup(modifydn_r,errstr):NULL); modifydn->referral = talloc_strdup(call, *res->refs); } else { @@ -1037,7 +1057,8 @@ reply: ldb_ret = ldb_search(samdb, local_ctx, &res, dn, LDB_SCOPE_BASE, attrs, "%s", filter); if (ldb_ret != LDB_SUCCESS) { - result = map_ldb_error(local_ctx, ldb_ret, &errstr); + result = map_ldb_error(local_ctx, ldb_ret, + ldb_errstring(samdb), &errstr); DEBUG(10,("CompareRequest: error: %s\n", errstr)); } else if (res->count == 0) { DEBUG(10,("CompareRequest: doesn't matched\n")); @@ -1049,7 +1070,7 @@ reply: errstr = NULL; } else if (res->count > 1) { result = LDAP_OTHER; - map_ldb_error(local_ctx, LDB_ERR_OTHER, &errstr); + map_ldb_error(local_ctx, LDB_ERR_OTHER, NULL, &errstr); errstr = talloc_asprintf(local_ctx, "%s. Too many objects match!", errstr); DEBUG(10,("CompareRequest: %d results: %s\n", res->count, errstr)); diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c index efd6968..08ccc79 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_search.c +++ b/source4/lib/ldb/ldb_tdb/ldb_search.c @@ -354,9 +354,10 @@ int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs) } for (i = 0; i < msg->num_elements; i++) { - int j, found; + unsigned int j; + int found = 0; - for (j = 0, found = 0; attrs[j]; j++) { + for (j = 0; attrs[j]; j++) { if (ldb_attr_cmp(msg->elements[i].name, attrs[j]) == 0) { found = 1; break; diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index 3a4068d..38a1b6f 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -46,19 +46,6 @@ struct rename_context { struct ldb_reply *ares; }; -static struct ldb_message_element *rdn_name_find_attribute(const struct ldb_message *msg, const char *name) -{ - unsigned int i; - - for (i = 0; i < msg->num_elements; i++) { - if (ldb_attr_cmp(name, msg->elements[i].name) == 0) { - return &msg->elements[i]; - } - } - - return NULL; -} - static int rdn_name_add_callback(struct ldb_request *req, struct ldb_reply *ares) { @@ -129,10 +116,8 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req) rdn_val = ldb_val_dup(msg, ldb_dn_get_rdn_val(msg->dn)); - /* Perhaps someone above us tried to set this? */ - if ((attribute = rdn_name_find_attribute(msg, "name")) != NULL ) { - attribute->num_values = 0; -- Samba Shared Repository