diff options
author | Stefan Metzmacher <metze@samba.org> | 2004-09-27 13:20:59 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:22 -0500 |
commit | 718bb5e8ffb04ab48cb5e9c0a7df848212340a57 (patch) | |
tree | e735753dac17fb16aa25d0b2c0af38d10320ba7e /source4/ldap_server/ldap_rootdse.c | |
parent | f64b8cf9cd31d80602aba7d77e366d91127b733d (diff) | |
download | samba-718bb5e8ffb04ab48cb5e9c0a7df848212340a57.tar.gz samba-718bb5e8ffb04ab48cb5e9c0a7df848212340a57.tar.bz2 samba-718bb5e8ffb04ab48cb5e9c0a7df848212340a57.zip |
r2688: - fix case where listed attributes are asked
- use the return code of the functions
and only call ldapsrv_terminate_connection from ldapsrv_recv() or ldapsrv_send()
- the rootdse is now a normal partition
metze
(This used to be commit af1501a28d700f90cd2243fbfdce6527a0f62961)
Diffstat (limited to 'source4/ldap_server/ldap_rootdse.c')
-rw-r--r-- | source4/ldap_server/ldap_rootdse.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/source4/ldap_server/ldap_rootdse.c b/source4/ldap_server/ldap_rootdse.c index b1d889e830..46e2a7e910 100644 --- a/source4/ldap_server/ldap_rootdse.c +++ b/source4/ldap_server/ldap_rootdse.c @@ -23,11 +23,14 @@ #define ATTR_BLOB_CONST(val) data_blob_talloc(attrs, val, sizeof(val)-1) #define ATTR_SINGLE_NOVAL(attr, blob, num, nam) do { \ attr.name = talloc_strdup(attrs, nam);\ + if (!attr.name) {\ + return NT_STATUS_NO_MEMORY;\ + }\ attr.num_values = num; \ attr.values = blob;\ } while(0) -void ldapsrv_RootDSE_Search(struct ldapsrv_call *call, +static NTSTATUS rootdse_Search(struct ldapsrv_partition *partition, struct ldapsrv_call *call, struct ldap_SearchRequest *r) { struct ldap_SearchResEntry *ent; @@ -46,8 +49,7 @@ void ldapsrv_RootDSE_Search(struct ldapsrv_call *call, attrs = talloc_array_p(call, struct ldap_attribute, num_attrs); if (!attrs) { - ldapsrv_terminate_connection(call->conn, "no memory"); - return; + return NT_STATUS_NO_MEMORY; } /* @@ -59,8 +61,7 @@ void ldapsrv_RootDSE_Search(struct ldapsrv_call *call, DATA_BLOB *currentTime = talloc_array_p(attrs, DATA_BLOB, num_currentTime); char *str = ldap_timestring(call, time(NULL)); if (!str) { - ldapsrv_terminate_connection(call->conn, "no memory"); - return; + return NT_STATUS_NO_MEMORY; } currentTime[0].data = str; currentTime[0].length = strlen(str); @@ -228,8 +229,7 @@ void ldapsrv_RootDSE_Search(struct ldapsrv_call *call, ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultEntry); if (!ent_r) { - ldapsrv_terminate_connection(call->conn, "ldapsrv_init_reply() failed"); - return; + return NT_STATUS_NO_MEMORY; } ent = &ent_r->msg.r.SearchResultEntry; @@ -243,8 +243,7 @@ no_base_scope: done_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultDone); if (!done_r) { - ldapsrv_terminate_connection(call->conn, "ldapsrv_init_reply() failed"); - return; + return NT_STATUS_NO_MEMORY; } done = &done_r->msg.r.SearchResultDone; @@ -253,5 +252,14 @@ no_base_scope: done->errormessage = NULL; done->referral = NULL; - ldapsrv_queue_reply(call, done_r); + return ldapsrv_queue_reply(call, done_r); +} + +static const struct ldapsrv_partition_ops rootdse_ops = { + .Search = rootdse_Search +}; + +const struct ldapsrv_partition_ops *ldapsrv_get_rootdse_partition_ops(void) +{ + return &rootdse_ops; } |