summaryrefslogtreecommitdiff
path: root/source4/ldap_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-18 10:38:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:26 -0500
commitb4eee348c4d36e67ba83651c250366e84e7125dd (patch)
treeb59a92176b422d9b23fb267e1b0f174d34e54459 /source4/ldap_server
parent97318cdb45f1022ca2beebbf24ab11af80c07dc2 (diff)
downloadsamba-b4eee348c4d36e67ba83651c250366e84e7125dd.tar.gz
samba-b4eee348c4d36e67ba83651c250366e84e7125dd.tar.bz2
samba-b4eee348c4d36e67ba83651c250366e84e7125dd.zip
r7720: - simplify the asn1 decode of ldap_search() a lot, taking advantage of
the fact that the ldap data structures now use ldb_message_element. - fixed null termination of elements in ildap (This used to be commit 09060994c1ed12073ae6e1131d7074db8fdc523c)
Diffstat (limited to 'source4/ldap_server')
-rw-r--r--source4/ldap_server/ldap_rootdse.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/source4/ldap_server/ldap_rootdse.c b/source4/ldap_server/ldap_rootdse.c
index 39e299ece1..d4e11e429a 100644
--- a/source4/ldap_server/ldap_rootdse.c
+++ b/source4/ldap_server/ldap_rootdse.c
@@ -309,28 +309,16 @@ static NTSTATUS rootdse_Search(struct ldapsrv_partition *partition, struct ldaps
goto queue_reply;
}
ent->num_attributes = res[0]->num_elements;
- ent->attributes = talloc_array(ent_r, struct ldb_message_element, ent->num_attributes);
- NT_STATUS_HAVE_NO_MEMORY(ent->attributes);
+ ent->attributes = talloc_steal(ent_r, res[0]->elements);
+
for (j=0; j < ent->num_attributes; j++) {
- ent->attributes[j].name = talloc_steal(ent->attributes, res[0]->elements[j].name);
- ent->attributes[j].num_values = 0;
- ent->attributes[j].values = NULL;
- ent->attributes[j].num_values = res[0]->elements[j].num_values;
if (ent->attributes[j].num_values == 1 &&
- strncmp(res[0]->elements[j].values[0].data, "_DYNAMIC_", 9) == 0) {
+ ent->attributes[j].values[0].length >= 9 &&
+ strncmp(ent->attributes[j].values[0].data, "_DYNAMIC_", 9) == 0) {
status = fill_dynamic_values(ent->attributes, &(ent->attributes[j]));
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- } else {
- ent->attributes[j].values = talloc_array(ent->attributes,
- DATA_BLOB, ent->attributes[j].num_values);
- NT_STATUS_HAVE_NO_MEMORY(ent->attributes[j].values);
- for (y=0; y < ent->attributes[j].num_values; y++) {
- ent->attributes[j].values[y].length = res[0]->elements[j].values[y].length;
- ent->attributes[j].values[y].data = talloc_steal(ent->attributes[j].values,
- res[0]->elements[j].values[y].data);
- }
}
}
queue_reply: