summaryrefslogtreecommitdiff
path: root/source4/ldap_server/ldap_bind.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-01-13 00:38:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:50:57 -0500
commita7a79d2b256c97bd6ffa6e9740d14366ebc7602e (patch)
tree3b7b912a8ae86a8f0a523fad0f697d6516d30f70 /source4/ldap_server/ldap_bind.c
parent0ac6b5232d1e52bab55227fc5251b363fd97b333 (diff)
downloadsamba-a7a79d2b256c97bd6ffa6e9740d14366ebc7602e.tar.gz
samba-a7a79d2b256c97bd6ffa6e9740d14366ebc7602e.tar.bz2
samba-a7a79d2b256c97bd6ffa6e9740d14366ebc7602e.zip
r12880: Remove ldap partitions useless now and probably we
will not use it anyway as we plan to support partitions in ldb directly like with rootdse Merge ldap_simple_ldb into ldap_backend, it is not simple anymore and makes no sense to have it separated now that ldap partitions are gone Initial attempt at working to some limit to avoid DOSs for the ldap server. Simo. (This used to be commit 97bff3e049eba48019f2b0f3eb5a19e32fef2e23)
Diffstat (limited to 'source4/ldap_server/ldap_bind.c')
-rw-r--r--source4/ldap_server/ldap_bind.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/source4/ldap_server/ldap_bind.c b/source4/ldap_server/ldap_bind.c
index 0f24ad9a04..cfd70d30d3 100644
--- a/source4/ldap_server/ldap_bind.c
+++ b/source4/ldap_server/ldap_bind.c
@@ -23,6 +23,8 @@
#include "auth/auth.h"
#include "libcli/ldap/ldap.h"
#include "smbd/service_stream.h"
+#include "lib/ldb/include/ldb.h"
+#include "lib/ldb/include/ldb_errors.h"
#include "dsdb/samdb/samdb.h"
static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call)
@@ -55,21 +57,20 @@ static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call)
}
if (NT_STATUS_IS_OK(status)) {
- struct ldapsrv_partition *part;
result = LDAP_SUCCESS;
errstr = NULL;
talloc_free(call->conn->session_info);
call->conn->session_info = session_info;
- for (part = call->conn->partitions; part; part = part->next) {
- if (!part->ops->Bind) {
- continue;
- }
- status = part->ops->Bind(part, call->conn);
- if (!NT_STATUS_IS_OK(status)) {
- result = LDAP_OPERATIONS_ERROR;
- errstr = talloc_asprintf(reply, "Simple Bind: Failed to advise partition %s of new credentials: %s", part->base_dn, nt_errstr(status));
- }
+
+ /* don't leak the old LDB */
+ talloc_free(call->conn->ldb);
+
+ status = ldapsrv_backend_Init(call->conn);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ result = LDAP_OPERATIONS_ERROR;
+ errstr = talloc_asprintf(reply, "Simple Bind: Failed to advise ldb new credentials: %s", nt_errstr(status));
}
} else {
status = auth_nt_status_squash(status);
@@ -145,7 +146,6 @@ static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call)
result = LDAP_SASL_BIND_IN_PROGRESS;
errstr = NULL;
} else if (NT_STATUS_IS_OK(status)) {
- struct ldapsrv_partition *part;
struct auth_session_info *old_session_info;
result = LDAP_SUCCESS;
@@ -163,15 +163,15 @@ static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call)
errstr = talloc_asprintf(reply, "SASL:[%s]: Failed to get session info: %s", req->creds.SASL.mechanism, nt_errstr(status));
} else {
talloc_free(old_session_info);
- for (part = call->conn->partitions; part; part = part->next) {
- if (!part->ops->Bind) {
- continue;
- }
- status = part->ops->Bind(part, conn);
- if (!NT_STATUS_IS_OK(status)) {
- result = LDAP_OPERATIONS_ERROR;
- errstr = talloc_asprintf(reply, "SASL:[%s]: Failed to advise partition %s of new credentials: %s", req->creds.SASL.mechanism, part->base_dn, nt_errstr(status));
- }
+
+ /* don't leak the old LDB */
+ talloc_free(call->conn->ldb);
+
+ status = ldapsrv_backend_Init(call->conn);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ result = LDAP_OPERATIONS_ERROR;
+ errstr = talloc_asprintf(reply, "SASL:[%s]: Failed to advise samdb of new credentials: %s", req->creds.SASL.mechanism, nt_errstr(status));
}
}
} else {