summaryrefslogtreecommitdiff
path: root/source4/ldap_server
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-10-21 14:51:13 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-21 14:51:13 +0200
commit5209a846a9157e649fcdcb561f7eaf19c8c0e465 (patch)
treeb0a7e52b5646c8eec182dbc391e7934b6804488c /source4/ldap_server
parent625359b2e266105022309df8985720108ecd6f67 (diff)
parent2ee8d29d22bcb1c350ab59d71b0aee548489bc9c (diff)
downloadsamba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.tar.gz
samba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.tar.bz2
samba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba into regsrv
Conflicts: source4/lib/registry/ldb.c source4/rpc_server/winreg/rpc_winreg.c
Diffstat (limited to 'source4/ldap_server')
-rw-r--r--source4/ldap_server/config.mk2
-rw-r--r--source4/ldap_server/ldap_backend.c41
-rw-r--r--source4/ldap_server/ldap_bind.c4
-rw-r--r--source4/ldap_server/ldap_extended.c2
-rw-r--r--source4/ldap_server/ldap_server.c14
5 files changed, 27 insertions, 36 deletions
diff --git a/source4/ldap_server/config.mk b/source4/ldap_server/config.mk
index 65f5b17f9a..4c35117a72 100644
--- a/source4/ldap_server/config.mk
+++ b/source4/ldap_server/config.mk
@@ -4,7 +4,7 @@
# Start SUBSYSTEM LDAP
[MODULE::LDAP]
INIT_FUNCTION = server_service_ldap_init
-SUBSYSTEM = smbd
+SUBSYSTEM = samba
PRIVATE_DEPENDENCIES = CREDENTIALS \
LIBCLI_LDAP SAMDB \
process_model \
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
index 504dcf1c0f..32fc00832e 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -19,7 +19,7 @@
#include "includes.h"
#include "ldap_server/ldap_server.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
#include "libcli/ldap/ldap.h"
#include "auth/credentials/credentials.h"
#include "auth/gensec/gensec.h"
@@ -158,6 +158,8 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
struct ldb_dn *basedn;
struct ldb_result *res = NULL;
struct ldb_request *lreq;
+ struct ldb_control *search_control;
+ struct ldb_search_options_control *search_options;
enum ldb_scope scope = LDB_SCOPE_DEFAULT;
const char **attrs = NULL;
const char *scope_str, *errstr = NULL;
@@ -216,21 +218,24 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
DEBUG(5,("ldb_request %s dn=%s filter=%s\n",
scope_str, req->basedn, ldb_filter_from_tree(call, req->tree)));
- lreq = talloc(local_ctx, struct ldb_request);
- NT_STATUS_HAVE_NO_MEMORY(lreq);
+ res = talloc_zero(local_ctx, struct ldb_result);
+ NT_STATUS_HAVE_NO_MEMORY(res);
- lreq->operation = LDB_SEARCH;
- lreq->op.search.base = basedn;
- lreq->op.search.scope = scope;
- lreq->op.search.tree = req->tree;
- lreq->op.search.attrs = attrs;
+ ldb_ret = ldb_build_search_req_ex(&lreq, samdb, local_ctx,
+ basedn, scope,
+ req->tree, attrs,
+ call->request->controls,
+ res, ldb_search_default_callback,
+ NULL);
- lreq->controls = call->request->controls;
+ if (ldb_ret != LDB_SUCCESS) {
+ goto reply;
+ }
if (call->conn->global_catalog) {
- struct ldb_control *search_control = ldb_request_get_control(lreq, LDB_CONTROL_SEARCH_OPTIONS_OID);
-
- struct ldb_search_options_control *search_options = NULL;
+ search_control = ldb_request_get_control(lreq, LDB_CONTROL_SEARCH_OPTIONS_OID);
+
+ search_options = NULL;
if (search_control) {
search_options = talloc_get_type(search_control->data, struct ldb_search_options_control);
search_options->search_options |= LDB_SEARCH_OPTION_PHANTOM_ROOT;
@@ -241,14 +246,6 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
ldb_request_add_control(lreq, LDB_CONTROL_SEARCH_OPTIONS_OID, false, search_options);
}
}
-
- res = talloc_zero(lreq, struct ldb_result);
- NT_STATUS_HAVE_NO_MEMORY(res);
-
- lreq->context = res;
- lreq->callback = ldb_search_default_callback;
-
- /* Copy the timeout from the incoming call */
ldb_set_timeout(samdb, lreq, req->timelimit);
ldb_ret = ldb_request(samdb, lreq);
@@ -688,8 +685,8 @@ reply:
NT_STATUS_HAVE_NO_MEMORY(compare_r);
if (result == LDAP_SUCCESS) {
- ldb_ret = ldb_search(samdb, dn, LDB_SCOPE_BASE, filter, attrs, &res);
- talloc_steal(local_ctx, res);
+ ldb_ret = ldb_search(samdb, local_ctx, &res,
+ dn, LDB_SCOPE_BASE, attrs, "%s", filter);
if (ldb_ret != LDB_SUCCESS) {
result = map_ldb_error(samdb, ldb_ret, &errstr);
DEBUG(10,("CompareRequest: error: %s\n", errstr));
diff --git a/source4/ldap_server/ldap_bind.c b/source4/ldap_server/ldap_bind.c
index f37ef31c0a..20777e5261 100644
--- a/source4/ldap_server/ldap_bind.c
+++ b/source4/ldap_server/ldap_bind.c
@@ -180,9 +180,6 @@ static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call)
input = *req->creds.SASL.secblob;
}
- resp->SASL.secblob = talloc(reply, DATA_BLOB);
- NT_STATUS_HAVE_NO_MEMORY(resp->SASL.secblob);
-
status = gensec_update(conn->gensec, reply,
input, &output);
@@ -211,6 +208,7 @@ static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call)
} else {
ctx->conn = conn;
status = gensec_socket_init(conn->gensec,
+ conn->connection,
conn->connection->socket,
conn->connection->event.ctx,
stream_io_handler_callback,
diff --git a/source4/ldap_server/ldap_extended.c b/source4/ldap_server/ldap_extended.c
index fe917cf7f2..334e427d79 100644
--- a/source4/ldap_server/ldap_extended.c
+++ b/source4/ldap_server/ldap_extended.c
@@ -19,7 +19,7 @@
#include "includes.h"
#include "ldap_server/ldap_server.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
#include "libcli/ldap/ldap.h"
#include "lib/tls/tls.h"
#include "smbd/service_stream.h"
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index 39a55f4420..f08f24595a 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -26,8 +26,8 @@
#include "auth/auth.h"
#include "auth/credentials/credentials.h"
#include "librpc/gen_ndr/ndr_samr.h"
-#include "lib/util/dlinklist.h"
-#include "lib/util/asn1.h"
+#include "../lib/util/dlinklist.h"
+#include "../lib/util/asn1.h"
#include "ldap_server/ldap_server.h"
#include "smbd/service_task.h"
#include "smbd/service_stream.h"
@@ -253,13 +253,11 @@ static int ldapsrv_load_limits(struct ldapsrv_connection *conn)
goto failed;
}
- ret = ldb_search(conn->ldb, basedn, LDB_SCOPE_BASE, NULL, attrs, &res);
+ ret = ldb_search(conn->ldb, tmp_ctx, &res, basedn, LDB_SCOPE_BASE, attrs, NULL);
if (ret != LDB_SUCCESS) {
goto failed;
}
- talloc_steal(tmp_ctx, res);
-
if (res->count != 1) {
goto failed;
}
@@ -275,13 +273,11 @@ static int ldapsrv_load_limits(struct ldapsrv_connection *conn)
goto failed;
}
- ret = ldb_search(conn->ldb, policy_dn, LDB_SCOPE_BASE, NULL, attrs2, &res);
+ ret = ldb_search(conn->ldb, tmp_ctx, &res, policy_dn, LDB_SCOPE_BASE, attrs2, NULL);
if (ret != LDB_SUCCESS) {
goto failed;
}
- talloc_steal(tmp_ctx, res);
-
if (res->count != 1) {
goto failed;
}
@@ -529,7 +525,7 @@ static void ldapsrv_task_init(struct task_server *task)
task_server_set_title(task, "task[ldapsrv]");
/* run the ldap server as a single process */
- model_ops = process_model_byname("single");
+ model_ops = process_model_startup(task->event_ctx, "single");
if (!model_ops) goto failed;
ldap_service = talloc_zero(task, struct ldapsrv_service);