summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/ldap_server/ldap_backend.c14
-rw-r--r--source4/ldap_server/ldap_hacked_ldb.c14
-rw-r--r--source4/ldap_server/ldap_simple_ldb.c12
3 files changed, 27 insertions, 13 deletions
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
index 3da7277cc1..96c9b16f5d 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -255,3 +255,17 @@ NTSTATUS ldapsrv_do_call(struct ldapsrv_call *call)
return ldapsrv_unwilling(call, 2);
}
}
+
+
+/*
+ connect to the sam database
+*/
+struct ldb_context *ldapsrv_sam_connect(struct ldapsrv_call *call)
+{
+ const char *url;
+ url = lp_parm_string(-1, "ldapsrv", "samdb");
+ if (url) {
+ return ldb_wrap_connect(call, url, 0, NULL);
+ }
+ return samdb_connect(call);
+}
diff --git a/source4/ldap_server/ldap_hacked_ldb.c b/source4/ldap_server/ldap_hacked_ldb.c
index e0056775b9..c7a5f6d1a2 100644
--- a/source4/ldap_server/ldap_hacked_ldb.c
+++ b/source4/ldap_server/ldap_hacked_ldb.c
@@ -461,7 +461,7 @@ queue_reply2:
}
static NTSTATUS hldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_call *call,
- struct ldap_SearchRequest *r)
+ struct ldap_SearchRequest *r)
{
NTSTATUS status;
void *local_ctx;
@@ -481,7 +481,7 @@ static NTSTATUS hldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
local_ctx = talloc_named(call, 0, "hldb_Search local memory context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
status = hacked_Search(partition, call, r, samdb);
@@ -618,7 +618,7 @@ static NTSTATUS hldb_Add(struct ldapsrv_partition *partition, struct ldapsrv_cal
local_ctx = talloc_named(call, 0, "hldb_Add local memory context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
dn = ldap_parse_dn(local_ctx, r->dn);
@@ -717,7 +717,7 @@ static NTSTATUS hldb_Del(struct ldapsrv_partition *partition, struct ldapsrv_cal
local_ctx = talloc_named(call, 0, "hldb_Del local memory context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
dn = ldap_parse_dn(local_ctx, r->dn);
@@ -772,7 +772,7 @@ static NTSTATUS hldb_Modify(struct ldapsrv_partition *partition, struct ldapsrv_
local_ctx = talloc_named(call, 0, "hldb_Modify local memory context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
dn = ldap_parse_dn(local_ctx, r->dn);
@@ -889,7 +889,7 @@ static NTSTATUS hldb_Compare(struct ldapsrv_partition *partition, struct ldapsrv
local_ctx = talloc_named(call, 0, "hldb_Compare local_memory_context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
dn = ldap_parse_dn(local_ctx, r->dn);
@@ -957,7 +957,7 @@ static NTSTATUS hldb_ModifyDN(struct ldapsrv_partition *partition, struct ldapsr
local_ctx = talloc_named(call, 0, "hldb_ModifyDN local memory context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
olddn = ldap_parse_dn(local_ctx, r->dn);
diff --git a/source4/ldap_server/ldap_simple_ldb.c b/source4/ldap_server/ldap_simple_ldb.c
index 4b73026d42..e8c66e80a2 100644
--- a/source4/ldap_server/ldap_simple_ldb.c
+++ b/source4/ldap_server/ldap_simple_ldb.c
@@ -54,7 +54,7 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
local_ctx = talloc_named(call, 0, "sldb_Search local memory context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
basedn = ldap_parse_dn(local_ctx, r->basedn);
@@ -179,7 +179,7 @@ static NTSTATUS sldb_Add(struct ldapsrv_partition *partition, struct ldapsrv_cal
local_ctx = talloc_named(call, 0, "sldb_Add local memory context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
dn = ldap_parse_dn(local_ctx, r->dn);
@@ -277,7 +277,7 @@ static NTSTATUS sldb_Del(struct ldapsrv_partition *partition, struct ldapsrv_cal
local_ctx = talloc_named(call, 0, "sldb_Del local memory context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
dn = ldap_parse_dn(local_ctx, r->dn);
@@ -332,7 +332,7 @@ static NTSTATUS sldb_Modify(struct ldapsrv_partition *partition, struct ldapsrv_
local_ctx = talloc_named(call, 0, "sldb_Modify local memory context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
dn = ldap_parse_dn(local_ctx, r->dn);
@@ -444,7 +444,7 @@ static NTSTATUS sldb_Compare(struct ldapsrv_partition *partition, struct ldapsrv
local_ctx = talloc_named(call, 0, "sldb_Compare local_memory_context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
dn = ldap_parse_dn(local_ctx, r->dn);
@@ -512,7 +512,7 @@ static NTSTATUS sldb_ModifyDN(struct ldapsrv_partition *partition, struct ldapsr
local_ctx = talloc_named(call, 0, "sldb_ModifyDN local memory context");
NT_STATUS_HAVE_NO_MEMORY(local_ctx);
- samdb = samdb_connect(local_ctx);
+ samdb = ldapsrv_sam_connect(call);
NT_STATUS_HAVE_NO_MEMORY(samdb);
olddn = ldap_parse_dn(local_ctx, r->dn);