summaryrefslogtreecommitdiff
path: root/source4/cldap_server/rootdse.c
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-18 19:11:35 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-18 19:21:34 +0200
commit837a975c2be620396f3eac02a14d057a2de6c270 (patch)
tree271277e447fcdcf8c564098d7684b1e0c802eb30 /source4/cldap_server/rootdse.c
parent9969cfc36cc40d37d0cd740d60f698dad3f55bbb (diff)
downloadsamba-837a975c2be620396f3eac02a14d057a2de6c270.tar.gz
s4:cldap_server/rootdse.c - simplify the code a bit
Remove "NULL"-content variables and use "NULL"s directly as arguments. Add some linewraps where needed.
Diffstat (limited to 'source4/cldap_server/rootdse.c')
-rw-r--r--source4/cldap_server/rootdse.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/source4/cldap_server/rootdse.c b/source4/cldap_server/rootdse.c
index 3592ffae727..59f30bc3e52 100644
--- a/source4/cldap_server/rootdse.c
+++ b/source4/cldap_server/rootdse.c
@@ -36,18 +36,11 @@ static void cldapd_rootdse_fill(struct cldapd_server *cldapd,
struct ldap_Result *result)
{
struct ldap_SearchResEntry *ent = NULL;
- struct ldb_dn *basedn;
struct ldb_result *res = NULL;
struct ldb_request *lreq;
- enum ldb_scope scope = LDB_SCOPE_DEFAULT;
const char **attrs = NULL;
const char *errstr = NULL;
- int ret = 0;
- int ldb_ret = -1;
-
- basedn = ldb_dn_new(mem_ctx, cldapd->samctx, NULL);
- if (basedn == NULL) goto nomem;
- scope = LDB_SCOPE_BASE;
+ int ret = LDAP_SUCCESS, ldb_ret;
if (search->num_attributes >= 1) {
int i;
@@ -65,7 +58,7 @@ static void cldapd_rootdse_fill(struct cldapd_server *cldapd,
if (res == NULL) goto nomem;
ldb_ret = ldb_build_search_req_ex(&lreq, cldapd->samctx, mem_ctx,
- basedn, scope,
+ NULL, LDB_SCOPE_BASE,
search->tree, attrs,
NULL,
res, ldb_search_default_callback,
@@ -106,10 +99,12 @@ static void cldapd_rootdse_fill(struct cldapd_server *cldapd,
goto reply;
}
ent->num_attributes = res->msgs[0]->num_elements;
- ent->attributes = talloc_array(ent, struct ldb_message_element, ent->num_attributes);
+ ent->attributes = talloc_array(ent, struct ldb_message_element,
+ ent->num_attributes);
if (ent->attributes == NULL) goto nomem;
for (j=0; j < ent->num_attributes; j++) {
- ent->attributes[j].name = talloc_steal(ent->attributes, res->msgs[0]->elements[j].name);
+ ent->attributes[j].name = talloc_steal(ent->attributes,
+ res->msgs[0]->elements[j].name);
ent->attributes[j].num_values = 0;
ent->attributes[j].values = NULL;
if (search->attributesonly && (res->msgs[0]->elements[j].num_values == 0)) {
@@ -122,7 +117,7 @@ static void cldapd_rootdse_fill(struct cldapd_server *cldapd,
}
reply:
- if (ret) {
+ if (ret != LDAP_SUCCESS) {
/* nothing ... */
} else if (ldb_ret == LDB_SUCCESS) {
ret = LDAP_SUCCESS;
@@ -163,7 +158,8 @@ void cldapd_rootdse_request(struct cldap_socket *cldap,
reply.response = NULL;
reply.result = &result;
- cldapd_rootdse_fill(cldapd, tmp_ctx, search, &reply.response, reply.result);
+ cldapd_rootdse_fill(cldapd, tmp_ctx, search, &reply.response,
+ reply.result);
status = cldap_reply_send(cldap, &reply);
if (!NT_STATUS_IS_OK(status)) {