summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-20 04:59:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:35 -0500
commitdb6933323c0997cc6334d447e9a938cb42731ae9 (patch)
tree7aee8be52e77bc7238f23f8aa13e619ea0c8465a
parentbd7a474b1967423711ff93c0080ce0f89270e3f9 (diff)
downloadsamba-db6933323c0997cc6334d447e9a938cb42731ae9.tar.gz
samba-db6933323c0997cc6334d447e9a938cb42731ae9.tar.bz2
samba-db6933323c0997cc6334d447e9a938cb42731ae9.zip
r7777: allow for overriding the location of the sam databasein the ldap server, using
ldapsrv:samdb option. This allows the following: sam database=ldap://localhost ldapsrv:samdb=tdb:///home/tridge/samba/samba4/prefix/private/sam.ldb which allows us to test putting the sam on an ldap server using our own ldap server. This is a great stress test for the ldap code. (This used to be commit 40948ba3848e2cfd69ee5ef77031170a652e389b)
-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);