From 8ac5db124630586605bd3972975ea47ee1cb34c0 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Wed, 17 Sep 2008 17:55:02 +0200 Subject: LDAP Server: Don't create the SASL SECBLOB output object twice Removes one "talloc" creation of the output object. Signed-off-by: Stefan Metzmacher --- source4/ldap_server/ldap_bind.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'source4/ldap_server') diff --git a/source4/ldap_server/ldap_bind.c b/source4/ldap_server/ldap_bind.c index f37ef31c0a..8357251a8f 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); -- cgit From 0e9008be35a5b334bd65e6417193d4b8f27bdc36 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 21 Sep 2008 21:26:40 +0200 Subject: Rename smbd -> samba. --- source4/ldap_server/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ldap_server') 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 \ -- cgit From 05ea5e23cf4e70de0bd658b1c5c0ead133967091 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 21 Sep 2008 21:32:40 +0200 Subject: Revert "Rename smbd -> samba." This reverts commit 0e9008be35a5b334bd65e6417193d4b8f27bdc36. --- source4/ldap_server/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ldap_server') diff --git a/source4/ldap_server/config.mk b/source4/ldap_server/config.mk index 4c35117a72..65f5b17f9a 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 = samba +SUBSYSTEM = smbd PRIVATE_DEPENDENCIES = CREDENTIALS \ LIBCLI_LDAP SAMDB \ process_model \ -- cgit From 1d92b2211cc507dd62526f564ec7f75a07110e00 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 22 Sep 2008 18:15:24 +0200 Subject: s4: allways initialize the process model before it's used metze --- source4/ldap_server/ldap_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ldap_server') diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 39a55f4420..57a63a8516 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -529,7 +529,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); -- cgit From 508527890adc7bedd47522a7dae0c96d2b2e4bae Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 23 Sep 2008 14:30:06 -0400 Subject: Merge ldb_search() and ldb_search_exp_fmt() into a simgle function. The previous ldb_search() interface made it way too easy to leak results, and being able to use a printf-like expression turns to be really useful. --- source4/ldap_server/ldap_backend.c | 4 ++-- source4/ldap_server/ldap_server.c | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'source4/ldap_server') diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 504dcf1c0f..b954038b80 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -688,8 +688,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_server.c b/source4/ldap_server/ldap_server.c index 57a63a8516..0aa9afbdd6 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -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; } -- cgit From 6a689c23e83fef71a562a9009b92983d750f63cc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 24 Sep 2008 03:16:15 +0200 Subject: Rename smbd -> samba. This reverts commit 05ea5e23cf4e70de0bd658b1c5c0ead133967091. Conflicts: source4/smbd/server.c --- source4/ldap_server/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ldap_server') 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 \ -- cgit From 83b0c5d43f568222d97f9b8de985f1e39a375fb9 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 24 Sep 2008 01:37:16 -0400 Subject: Fix nasty bug that would come up only if a client connection to a remote ldap server suddenly dies. We were creating a wrong talloc hierarchy, so the event.fde was not freed automatically as expected. This in turn made the event system call the ldap io handlers with a null packet structure, causing a segfault. Fix also the ordering in ldap_connection_dead() Thanks to Metze for the huge help in tracking down this one. --- source4/ldap_server/ldap_bind.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/ldap_server') diff --git a/source4/ldap_server/ldap_bind.c b/source4/ldap_server/ldap_bind.c index 8357251a8f..20777e5261 100644 --- a/source4/ldap_server/ldap_bind.c +++ b/source4/ldap_server/ldap_bind.c @@ -208,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, -- cgit From b2901da479f5e711986de48df4910910460fe7db Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 11 Sep 2008 18:38:40 -0400 Subject: LDB ASYNC: misc changes --- source4/ldap_server/ldap_backend.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'source4/ldap_server') diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index b954038b80..ffbef3d92f 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -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); -- cgit From 956599975573044f5f930ef23ce54c11db156ebe Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 11 Oct 2008 21:31:42 +0200 Subject: Fix include paths to new location of libutil. --- source4/ldap_server/ldap_backend.c | 2 +- source4/ldap_server/ldap_extended.c | 2 +- source4/ldap_server/ldap_server.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/ldap_server') diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index ffbef3d92f..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" 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 0aa9afbdd6..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" -- cgit