summaryrefslogtreecommitdiff
path: root/source4/torture/ldap
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-10 04:33:16 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:49:01 +0100
commitb65dba2245bf382c47d65c95ac9b1efa43918fc0 (patch)
treee2a474ba5bd99368423ad11d3632c55a51ed865c /source4/torture/ldap
parent4a36b71675a5ea2a22d7cf2a79d61a3cd511e99f (diff)
downloadsamba-b65dba2245bf382c47d65c95ac9b1efa43918fc0.tar.gz
samba-b65dba2245bf382c47d65c95ac9b1efa43918fc0.tar.bz2
samba-b65dba2245bf382c47d65c95ac9b1efa43918fc0.zip
r26355: Eliminate global_loadparm in more places.
(This used to be commit 5d589a0d94bd76a9b4c9fc748854e8098ea43c4d)
Diffstat (limited to 'source4/torture/ldap')
-rw-r--r--source4/torture/ldap/basic.c9
-rw-r--r--source4/torture/ldap/common.c13
2 files changed, 12 insertions, 10 deletions
diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c
index 76d412a7cd..358bf53590 100644
--- a/source4/torture/ldap/basic.c
+++ b/source4/torture/ldap/basic.c
@@ -42,14 +42,15 @@ static bool test_bind_simple(struct ldap_connection *conn, const char *userdn, c
return ret;
}
-static bool test_bind_sasl(struct ldap_connection *conn, struct cli_credentials *creds)
+static bool test_bind_sasl(struct torture_context *tctx,
+ struct ldap_connection *conn, struct cli_credentials *creds)
{
NTSTATUS status;
bool ret = true;
printf("Testing sasl bind as user\n");
- status = torture_ldap_bind_sasl(conn, creds, global_loadparm);
+ status = torture_ldap_bind_sasl(conn, creds, tctx->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
ret = false;
}
@@ -205,7 +206,7 @@ bool torture_ldap_basic(struct torture_context *torture)
url = talloc_asprintf(mem_ctx, "ldap://%s/", host);
- status = torture_ldap_connection(mem_ctx, &conn, url);
+ status = torture_ldap_connection(torture, &conn, url);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
@@ -220,7 +221,7 @@ bool torture_ldap_basic(struct torture_context *torture)
ret = false;
}
- if (!test_bind_sasl(conn, cmdline_credentials)) {
+ if (!test_bind_sasl(torture, conn, cmdline_credentials)) {
ret = false;
}
diff --git a/source4/torture/ldap/common.c b/source4/torture/ldap/common.c
index b03a6d8113..11b11dcc00 100644
--- a/source4/torture/ldap/common.c
+++ b/source4/torture/ldap/common.c
@@ -54,8 +54,9 @@ _PUBLIC_ NTSTATUS torture_ldap_bind_sasl(struct ldap_connection *conn,
}
/* open a ldap connection to a server */
-_PUBLIC_ NTSTATUS torture_ldap_connection(TALLOC_CTX *mem_ctx, struct ldap_connection **conn,
- const char *url)
+_PUBLIC_ NTSTATUS torture_ldap_connection(struct torture_context *tctx,
+ struct ldap_connection **conn,
+ const char *url)
{
NTSTATUS status;
@@ -64,7 +65,7 @@ _PUBLIC_ NTSTATUS torture_ldap_connection(TALLOC_CTX *mem_ctx, struct ldap_conne
return NT_STATUS_INVALID_PARAMETER;
}
- *conn = ldap4_new_connection(mem_ctx, NULL);
+ *conn = ldap4_new_connection(tctx, tctx->lp_ctx, NULL);
status = ldap_connect(*conn, url);
if (!NT_STATUS_IS_OK(status)) {
@@ -76,17 +77,17 @@ _PUBLIC_ NTSTATUS torture_ldap_connection(TALLOC_CTX *mem_ctx, struct ldap_conne
}
/* open a ldap connection to a server */
-NTSTATUS torture_ldap_connection2(TALLOC_CTX *mem_ctx, struct ldap_connection **conn,
+NTSTATUS torture_ldap_connection2(struct torture_context *tctx, struct ldap_connection **conn,
const char *url, const char *userdn, const char *password)
{
NTSTATUS status;
- status = torture_ldap_connection(mem_ctx, conn, url);
+ status = torture_ldap_connection(tctx, conn, url);
NT_STATUS_NOT_OK_RETURN(status);
status = ldap_bind_simple(*conn, userdn, password);
if (!NT_STATUS_IS_OK(status)) {
- printf("Failed a simple ldap bind - %s\n", ldap_errstr(*conn, mem_ctx, status));
+ printf("Failed a simple ldap bind - %s\n", ldap_errstr(*conn, tctx, status));
}
return status;