From 2e28edd233964f54b46fde10217f93f571ed1d6d Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 12 Aug 2004 08:00:45 +0000 Subject: r1771: OK Let's add tests for ldap. Thanks to Metze and Volker for their unvaluable support :) (This used to be commit e6a6c0737ab94d58930c0d4e1ef0bb4d99510833) --- source4/torture/ldap/basic.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 source4/torture/ldap/basic.c (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c new file mode 100644 index 0000000000..2227d70421 --- /dev/null +++ b/source4/torture/ldap/basic.c @@ -0,0 +1,34 @@ + +#include "includes.h" + +BOOL torture_ldap_basic(int dummy) +{ + NTSTATUS status; + struct ldap_connection *conn; + TALLOC_CTX *mem_ctx; + BOOL ret = True; + const char *host = lp_parm_string(-1, "torture", "host"); + char *url; + + mem_ctx = talloc_init("torture_ldap_basic"); + + url = talloc_asprintf(mem_ctx, "ldap://%s/", host); + + status = torture_ldap_connection(&conn, url); + if (!NT_STATUS_IS_OK(status)) { + return False; + } + + /* other basic tests here */ + + /* --- nothing yet :-) --- */ + + /* no more test we are closing */ + + talloc_destroy(mem_ctx); + + torture_ldap_close(conn); + + return ret; +} + -- cgit From 9dc1e17c353d61a82a5500d1fad787dda8c766c3 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 12 Aug 2004 22:25:01 +0000 Subject: r1793: try to bind multiple times as anonimous and user added -D parameter to torture to be able to specify: - user dn - base dn - user secret (This used to be commit 0eaec28f5c511a28764a1d350c2eaaf37272eb62) --- source4/torture/ldap/basic.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 2227d70421..a9ab023d9d 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -1,6 +1,28 @@ #include "includes.h" +BOOL test_multibind(struct ldap_connection *conn, TALLOC_CTX *mem_ctx, const char *userdn, const char *password) +{ + NTSTATUS status; + BOOL ret = True; + + printf("\nTesting multiple binds on a single connnection as anonymous and user\n"); + + status = torture_ldap_bind(conn, userdn, password); + if (!NT_STATUS_IS_OK(status)) { + printf("1st bind as user over an anonymous bind failed\n"); + return False; + } + + status = torture_ldap_bind(conn, NULL, NULL); + if (!NT_STATUS_IS_OK(status)) { + printf("2nd bind as anonymous over an authenticated bind failed\n"); + return False; + } + + return ret; +} + BOOL torture_ldap_basic(int dummy) { NTSTATUS status; @@ -8,20 +30,25 @@ BOOL torture_ldap_basic(int dummy) TALLOC_CTX *mem_ctx; BOOL ret = True; const char *host = lp_parm_string(-1, "torture", "host"); + const char *userdn = lp_parm_string(-1, "torture", "ldap_userdn"); + const char *basedn = lp_parm_string(-1, "torture", "ldap_basedn"); + const char *secret = lp_parm_string(-1, "torture", "ldap_secret"); char *url; mem_ctx = talloc_init("torture_ldap_basic"); url = talloc_asprintf(mem_ctx, "ldap://%s/", host); - status = torture_ldap_connection(&conn, url); + status = torture_ldap_connection(&conn, url, NULL, NULL); if (!NT_STATUS_IS_OK(status)) { return False; } /* other basic tests here */ - /* --- nothing yet :-) --- */ + if (!test_multibind(conn, mem_ctx, userdn, secret)) { + ret = False; + } /* no more test we are closing */ -- cgit From 01b58ebf83eca8b3909f3ba5becd6615bb89039f Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 13 Aug 2004 05:26:38 +0000 Subject: r1802: start to support SASL in our ldap libraries does not work yet but we are close currently we send the right data on wire and fail to decode the answer (This used to be commit 10baf585821bf1f10a3786045a0965000cdffd12) --- source4/torture/ldap/basic.c | 51 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 10 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index a9ab023d9d..ac11a3342a 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -1,23 +1,47 @@ #include "includes.h" -BOOL test_multibind(struct ldap_connection *conn, TALLOC_CTX *mem_ctx, const char *userdn, const char *password) +BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) { NTSTATUS status; BOOL ret = True; - printf("\nTesting multiple binds on a single connnection as anonymous and user\n"); - status = torture_ldap_bind(conn, userdn, password); if (!NT_STATUS_IS_OK(status)) { - printf("1st bind as user over an anonymous bind failed\n"); - return False; + ret = False; } - status = torture_ldap_bind(conn, NULL, NULL); + return ret; +} + +BOOL test_bind_sasl(struct ldap_connection *conn, const char *username, const char *domain, const char *password) +{ + NTSTATUS status; + BOOL ret = True; + + status = torture_ldap_bind_sasl(conn, username, domain, password); if (!NT_STATUS_IS_OK(status)) { - printf("2nd bind as anonymous over an authenticated bind failed\n"); - return False; + ret = False; + } + + return ret; +} + +BOOL test_multibind(struct ldap_connection *conn, const char *userdn, const char *password) +{ + BOOL ret = True; + + printf("\nTesting multiple binds on a single connnection as anonymous and user\n"); + + ret = test_bind_simple(conn, NULL, NULL); + if (!ret) { + printf("1st bind as anonymous failed\n"); + return ret; + } + + ret = test_bind_simple(conn, userdn, password); + if (!ret) { + printf("2nd bind as authenticated user failed\n"); } return ret; @@ -30,6 +54,9 @@ BOOL torture_ldap_basic(int dummy) TALLOC_CTX *mem_ctx; BOOL ret = True; const char *host = lp_parm_string(-1, "torture", "host"); + const char *username = lp_parm_string(-1, "torture", "username"); + const char *domain = lp_workgroup(); + const char *password = lp_parm_string(-1, "torture", "password"); const char *userdn = lp_parm_string(-1, "torture", "ldap_userdn"); const char *basedn = lp_parm_string(-1, "torture", "ldap_basedn"); const char *secret = lp_parm_string(-1, "torture", "ldap_secret"); @@ -39,14 +66,18 @@ BOOL torture_ldap_basic(int dummy) url = talloc_asprintf(mem_ctx, "ldap://%s/", host); - status = torture_ldap_connection(&conn, url, NULL, NULL); + status = torture_ldap_connection(&conn, url, userdn, secret); if (!NT_STATUS_IS_OK(status)) { return False; } /* other basic tests here */ - if (!test_multibind(conn, mem_ctx, userdn, secret)) { + if (!test_multibind(conn, userdn, secret)) { + ret = False; + } + + if (!test_bind_sasl(conn, username, domain, password)) { ret = False; } -- cgit From 16757c52d626d324566f504774525641a4785cd9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 13 Aug 2004 07:10:46 +0000 Subject: r1805: ...I just forgot to say that the sasl bind actually works now:-) metze (This used to be commit a2cd725681fa7b10a5cca337554be17f628465c0) --- source4/torture/ldap/basic.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index ac11a3342a..0e6eb64d4c 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -1,3 +1,25 @@ +/* + Unix SMB/CIFS mplementation. + LDAP protocol helper functions for SAMBA + + Copyright (C) Stefan Metzmacher 2004 + Copyright (C) Simo Sorce 2004 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ #include "includes.h" -- cgit From a4b2f077e05469f76b8fe4a7f1e097c9e3495871 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 17 Aug 2004 11:04:12 +0000 Subject: r1855: fix compiler warning and output fromatting metze (This used to be commit 59f3d417449f55d247604966b6e9fa2fa97c5124) --- source4/torture/ldap/basic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 0e6eb64d4c..468cacc032 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -41,6 +41,8 @@ BOOL test_bind_sasl(struct ldap_connection *conn, const char *username, const ch NTSTATUS status; BOOL ret = True; + printf("Testing sasl bind as user\n"); + status = torture_ldap_bind_sasl(conn, username, domain, password); if (!NT_STATUS_IS_OK(status)) { ret = False; @@ -53,7 +55,7 @@ BOOL test_multibind(struct ldap_connection *conn, const char *userdn, const char { BOOL ret = True; - printf("\nTesting multiple binds on a single connnection as anonymous and user\n"); + printf("Testing multiple binds on a single connnection as anonymous and user\n"); ret = test_bind_simple(conn, NULL, NULL); if (!ret) { @@ -80,7 +82,7 @@ BOOL torture_ldap_basic(int dummy) const char *domain = lp_workgroup(); const char *password = lp_parm_string(-1, "torture", "password"); const char *userdn = lp_parm_string(-1, "torture", "ldap_userdn"); - const char *basedn = lp_parm_string(-1, "torture", "ldap_basedn"); + /*const char *basedn = lp_parm_string(-1, "torture", "ldap_basedn");*/ const char *secret = lp_parm_string(-1, "torture", "ldap_secret"); char *url; -- cgit From 8aa051c7b2fa651d284321715f16d94215128abf Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 25 Aug 2004 14:31:59 +0000 Subject: r2071: - change smbtorture to use the popt_common stuff this means -U DOM\\user is know allowed - torture:userdomain is a new smb.conf parameter because lp_workgroup is not the domain of the user - we use torture:userdomain now in the tests instad of lp_workgroup - for backward compat the userdomain is lp_workgroup() by default and not lp_netbios_name(), which my change later to match 'net' and 'smbclient'.. - we now have dublicate options e.g. -N -s ... tridge: can we change this? metze (This used to be commit 4733dcbf5f17422a8a4c9f99664270b3aa66c586) --- source4/torture/ldap/basic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 468cacc032..06b703b4ba 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -79,7 +79,7 @@ BOOL torture_ldap_basic(int dummy) BOOL ret = True; const char *host = lp_parm_string(-1, "torture", "host"); const char *username = lp_parm_string(-1, "torture", "username"); - const char *domain = lp_workgroup(); + const char *domain = lp_parm_string(-1, "torture", "userdomain"); const char *password = lp_parm_string(-1, "torture", "password"); const char *userdn = lp_parm_string(-1, "torture", "ldap_userdn"); /*const char *basedn = lp_parm_string(-1, "torture", "ldap_basedn");*/ -- cgit From 6aa4a9bd1648237cac01724932efdd991786441e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 7 Oct 2004 15:13:20 +0000 Subject: r2853: add torture test to find the defaultNamingContext on the RootDSE try a sasl sealed CompareRequest abartlet: we need to check how SINGING only can work, it failed for me:-( metze (This used to be commit 1dabd04e265bbc1e8335f816708c2639746d9afd) --- source4/torture/ldap/basic.c | 118 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 06b703b4ba..574b01b226 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -71,6 +71,115 @@ BOOL test_multibind(struct ldap_connection *conn, const char *userdn, const char return ret; } +static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) +{ + BOOL ret = True; + struct ldap_message *msg, *result; + + printf("Testing RootDSE Search\n"); + + *basedn = NULL; + conn->searchid = 0; + conn->next_msgid = 30; + + msg = new_ldap_message(); + if (!msg) { + return False; + } + + msg->type = LDAP_TAG_SearchRequest; + msg->r.SearchRequest.basedn = ""; + msg->r.SearchRequest.scope = LDAP_SEARCH_SCOPE_BASE; + msg->r.SearchRequest.deref = LDAP_DEREFERENCE_NEVER; + msg->r.SearchRequest.timelimit = 0; + msg->r.SearchRequest.sizelimit = 0; + msg->r.SearchRequest.attributesonly = False; + msg->r.SearchRequest.filter = talloc_strdup(msg->mem_ctx, "(objectclass=*)"); + msg->r.SearchRequest.num_attributes = 0; + msg->r.SearchRequest.attributes = NULL; + + if (!ldap_setsearchent(conn, msg, NULL)) { + printf("Could not setsearchent\n"); + return False; + } + + result = ldap_getsearchent(conn, NULL); + if (result) { + int i; + struct ldap_SearchResEntry *r = &result->r.SearchResultEntry; + + DEBUG(1,("\tdn: %s\n", r->dn)); + for (i=0; inum_attributes; i++) { + int j; + for (j=0; jattributes[i].num_values; j++) { + DEBUG(1,("\t%s: %d %.*s\n", r->attributes[i].name, + r->attributes[i].values[j].length, + r->attributes[i].values[j].length, + (char *)r->attributes[i].values[j].data)); + if (!(*basedn) && + strcasecmp("defaultNamingContext",r->attributes[i].name)==0) { + *basedn = talloc_asprintf(conn->mem_ctx, "%.*s", + r->attributes[i].values[j].length, + (char *)r->attributes[i].values[j].data); + } + } + } + } else { + ret = False; + } + + ldap_endsearchent(conn, NULL); + + return ret; +} + +static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) +{ + BOOL ret = True; + struct ldap_message *msg, *result; + const char *val; + + printf("Testing SASL Compare: %s\n", basedn); + + if (!basedn) { + return False; + } + + conn->next_msgid = 55; + + msg = new_ldap_message(); + if (!msg) { + return False; + } + + msg->type = LDAP_TAG_CompareRequest; + msg->r.CompareRequest.dn = basedn; + msg->r.CompareRequest.attribute = talloc_strdup(msg->mem_ctx, "objectClass"); + val = "domain"; + msg->r.CompareRequest.value = data_blob_talloc(msg->mem_ctx, val, strlen(val)); + + if (!ldap_sasl_send_msg(conn, msg, NULL)) { + return False; + } + + DEBUG(5,("Code: %d DN: [%s] ERROR:[%s] REFERRAL:[%s]\n", + msg->r.CompareResponse.resultcode, + msg->r.CompareResponse.dn, + msg->r.CompareResponse.errormessage, + msg->r.CompareResponse.referral)); + + return True; + if (!result) { + return False; + } + + if (result->type != LDAP_TAG_CompareResponse) { + return False; + } + + return ret; +} + BOOL torture_ldap_basic(int dummy) { NTSTATUS status; @@ -85,6 +194,7 @@ BOOL torture_ldap_basic(int dummy) /*const char *basedn = lp_parm_string(-1, "torture", "ldap_basedn");*/ const char *secret = lp_parm_string(-1, "torture", "ldap_secret"); char *url; + char *basedn; mem_ctx = talloc_init("torture_ldap_basic"); @@ -101,10 +211,18 @@ BOOL torture_ldap_basic(int dummy) ret = False; } + if (!test_search_rootDSE(conn, &basedn)) { + ret = False; + } + if (!test_bind_sasl(conn, username, domain, password)) { ret = False; } + if (!test_compare_sasl(conn, basedn)) { + ret = False; + } + /* no more test we are closing */ talloc_destroy(mem_ctx); -- cgit From ba6d5fcb97b9831dddf7dfe09fb02fbb23d864b4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 28 Oct 2004 13:40:50 +0000 Subject: r3324: made the smbtorture code completely warning free (This used to be commit 7067bb9b52223cafa28470f264f0b60646a07a01) --- source4/torture/ldap/basic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 574b01b226..4a0ae772d2 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -180,7 +180,7 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) return ret; } -BOOL torture_ldap_basic(int dummy) +BOOL torture_ldap_basic(void) { NTSTATUS status; struct ldap_connection *conn; -- cgit From 8408b3428d8c263f8453a0da8ef71e7fc1e4ec81 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 6 Nov 2004 20:15:39 +0000 Subject: r3583: - seperate the ldap client code and the ldap parsing code (vl: we should only sync the parsing code with trunk) - use hierachical talloc in the ldap client code metze (This used to be commit 1e9c0b68ca9ddb28877d45fc1b47653b13a7446d) --- source4/torture/ldap/basic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 4a0ae772d2..8b1aca05f4 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -82,7 +82,7 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) conn->searchid = 0; conn->next_msgid = 30; - msg = new_ldap_message(); + msg = new_ldap_message(conn); if (!msg) { return False; } @@ -147,7 +147,7 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) conn->next_msgid = 55; - msg = new_ldap_message(); + msg = new_ldap_message(conn); if (!msg) { return False; } @@ -200,7 +200,7 @@ BOOL torture_ldap_basic(void) url = talloc_asprintf(mem_ctx, "ldap://%s/", host); - status = torture_ldap_connection(&conn, url, userdn, secret); + status = torture_ldap_connection(mem_ctx, &conn, url, userdn, secret); if (!NT_STATUS_IS_OK(status)) { return False; } -- cgit From 759da3b915e2006d4c87b5ace47f399accd9ce91 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 27 Jan 2005 07:08:20 +0000 Subject: r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the large commit. I thought this was worthwhile to get done for consistency. (This used to be commit ec32b22ed5ec224f6324f5e069d15e92e38e15c0) --- source4/torture/ldap/basic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 8b1aca05f4..99f79c8c50 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -225,7 +225,7 @@ BOOL torture_ldap_basic(void) /* no more test we are closing */ - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); torture_ldap_close(conn); -- cgit From 501379431c7fc6c9a78e74eca43b208184debce6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 10 Feb 2005 07:08:40 +0000 Subject: r5305: removed libcli/ldap/ldap.h from includes.h (This used to be commit 0df3fdd8178085c40f9cd776cc3e1486ca559c8e) --- source4/torture/ldap/basic.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 99f79c8c50..936a8dbe51 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -22,6 +22,7 @@ */ #include "includes.h" +#include "libcli/ldap/ldap.h" BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) { -- cgit From 05bc2d7b2c11a3583a6d1221cfbd618eb6730518 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 21 Mar 2005 21:22:07 +0000 Subject: r5928: Use cli_credentials in: - gtk+ (returned by GtkHostBindingDialog as well now) - torture/ - librpc/ - lib/com/dcom/ (This used to be commit ccefd782335e01e8e6ecb2bcd28a4f999c53b1a6) --- source4/torture/ldap/basic.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 936a8dbe51..d0255abe01 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -23,6 +23,7 @@ #include "includes.h" #include "libcli/ldap/ldap.h" +#include "lib/cmdline/popt_common.h" BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) { @@ -188,9 +189,9 @@ BOOL torture_ldap_basic(void) TALLOC_CTX *mem_ctx; BOOL ret = True; const char *host = lp_parm_string(-1, "torture", "host"); - const char *username = lp_parm_string(-1, "torture", "username"); - const char *domain = lp_parm_string(-1, "torture", "userdomain"); - const char *password = lp_parm_string(-1, "torture", "password"); + const char *username = cli_credentials_get_username(cmdline_credentials); + const char *domain = cli_credentials_get_domain(cmdline_credentials); + const char *password = cli_credentials_get_password(cmdline_credentials); const char *userdn = lp_parm_string(-1, "torture", "ldap_userdn"); /*const char *basedn = lp_parm_string(-1, "torture", "ldap_basedn");*/ const char *secret = lp_parm_string(-1, "torture", "ldap_secret"); -- cgit From 2eb3d680625286431a3a60e37b75f47e0738f253 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 24 Mar 2005 04:14:06 +0000 Subject: r6028: A MAJOR update to intergrate the new credentails system fully with GENSEC, and to pull SCHANNEL into GENSEC, by making it less 'special'. GENSEC now no longer has it's own handling of 'set username' etc, instead it uses cli_credentials calls. In order to link the credentails code right though Samba, a lot of interfaces have changed to remove 'username, domain, password' arguments, and these have been replaced with a single 'struct cli_credentials'. In the session setup code, a new parameter 'workgroup' contains the client/server current workgroup, which seems unrelated to the authentication exchange (it was being filled in from the auth info). This allows in particular kerberos to only call back for passwords when it actually needs to perform the kinit. The kerberos code has been modified not to use the SPNEGO provided 'principal name' (in the mechListMIC), but to instead use the name the host was connected to as. This better matches Microsoft behaviour, is more secure and allows better use of standard kerberos functions. To achieve this, I made changes to our socket code so that the hostname (before name resolution) is now recorded on the socket. In schannel, most of the code from librpc/rpc/dcerpc_schannel.c is now in libcli/auth/schannel.c, and it looks much more like a standard GENSEC module. The actual sign/seal code moved to libcli/auth/schannel_sign.c in a previous commit. The schannel credentails structure is now merged with the rest of the credentails, as many of the values (username, workstation, domain) where already present there. This makes handling this in a generic manner much easier, as there is no longer a custom entry-point. The auth_domain module continues to be developed, but is now just as functional as auth_winbind. The changes here are consequential to the schannel changes. The only removed function at this point is the RPC-LOGIN test (simulating the load of a WinXP login), which needs much more work to clean it up (it contains copies of too much code from all over the torture suite, and I havn't been able to penetrate its 'structure'). Andrew Bartlett (This used to be commit 2301a4b38a21aa60917973451687063d83d18d66) --- source4/torture/ldap/basic.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index d0255abe01..b53515fdbc 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -38,14 +38,14 @@ BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const ch return ret; } -BOOL test_bind_sasl(struct ldap_connection *conn, const char *username, const char *domain, const char *password) +BOOL test_bind_sasl(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, username, domain, password); + status = torture_ldap_bind_sasl(conn, creds); if (!NT_STATUS_IS_OK(status)) { ret = False; } @@ -189,9 +189,6 @@ BOOL torture_ldap_basic(void) TALLOC_CTX *mem_ctx; BOOL ret = True; const char *host = lp_parm_string(-1, "torture", "host"); - const char *username = cli_credentials_get_username(cmdline_credentials); - const char *domain = cli_credentials_get_domain(cmdline_credentials); - const char *password = cli_credentials_get_password(cmdline_credentials); const char *userdn = lp_parm_string(-1, "torture", "ldap_userdn"); /*const char *basedn = lp_parm_string(-1, "torture", "ldap_basedn");*/ const char *secret = lp_parm_string(-1, "torture", "ldap_secret"); @@ -217,7 +214,7 @@ BOOL torture_ldap_basic(void) ret = False; } - if (!test_bind_sasl(conn, username, domain, password)) { + if (!test_bind_sasl(conn, cmdline_credentials)) { ret = False; } -- cgit From 2542d54e9384302c6c9a7b2b2bf4be07b6d95f9c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 11 May 2005 14:38:13 +0000 Subject: r6732: - move sasl send recv code to the ldap lib - support 'modrdn' ldif metze (This used to be commit b6a1734699953964fcde6fe6ea7048496492eb33) --- source4/torture/ldap/basic.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index b53515fdbc..7114aa2576 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -137,8 +137,7 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) { - BOOL ret = True; - struct ldap_message *msg, *result; + struct ldap_message *req, *rep; const char *val; printf("Testing SASL Compare: %s\n", basedn); @@ -149,37 +148,33 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) conn->next_msgid = 55; - msg = new_ldap_message(conn); - if (!msg) { + req = new_ldap_message(conn); + if (!req) { return False; } - msg->type = LDAP_TAG_CompareRequest; - msg->r.CompareRequest.dn = basedn; - msg->r.CompareRequest.attribute = talloc_strdup(msg->mem_ctx, "objectClass"); + req->type = LDAP_TAG_CompareRequest; + req->r.CompareRequest.dn = basedn; + req->r.CompareRequest.attribute = talloc_strdup(req->mem_ctx, "objectClass"); val = "domain"; - msg->r.CompareRequest.value = data_blob_talloc(msg->mem_ctx, val, strlen(val)); + req->r.CompareRequest.value = data_blob_talloc(req->mem_ctx, val, strlen(val)); - if (!ldap_sasl_send_msg(conn, msg, NULL)) { + rep = ldap_transaction(conn, req); + if (!rep) { return False; } DEBUG(5,("Code: %d DN: [%s] ERROR:[%s] REFERRAL:[%s]\n", - msg->r.CompareResponse.resultcode, - msg->r.CompareResponse.dn, - msg->r.CompareResponse.errormessage, - msg->r.CompareResponse.referral)); - - return True; - if (!result) { - return False; - } + rep->r.CompareResponse.resultcode, + rep->r.CompareResponse.dn, + rep->r.CompareResponse.errormessage, + rep->r.CompareResponse.referral)); - if (result->type != LDAP_TAG_CompareResponse) { + if (rep->type != LDAP_TAG_CompareResponse) { return False; } - return ret; + return True; } BOOL torture_ldap_basic(void) @@ -199,7 +194,7 @@ BOOL torture_ldap_basic(void) url = talloc_asprintf(mem_ctx, "ldap://%s/", host); - status = torture_ldap_connection(mem_ctx, &conn, url, userdn, secret); + status = torture_ldap_connection2(mem_ctx, &conn, url, userdn, secret); if (!NT_STATUS_IS_OK(status)) { return False; } -- cgit From 5b18cf22680c76abb1262a6b75a30b8a37899467 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 15 May 2005 20:16:26 +0000 Subject: r6795: Make some functions static and remove some unused ones. (This used to be commit 46509eb89980bfe6dabd71264d570ea356ee5a22) --- source4/torture/ldap/basic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 7114aa2576..c0daefa99d 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -25,7 +25,7 @@ #include "libcli/ldap/ldap.h" #include "lib/cmdline/popt_common.h" -BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) +static BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) { NTSTATUS status; BOOL ret = True; @@ -38,7 +38,7 @@ BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const ch return ret; } -BOOL test_bind_sasl(struct ldap_connection *conn, struct cli_credentials *creds) +static BOOL test_bind_sasl(struct ldap_connection *conn, struct cli_credentials *creds) { NTSTATUS status; BOOL ret = True; @@ -53,7 +53,7 @@ BOOL test_bind_sasl(struct ldap_connection *conn, struct cli_credentials *creds) return ret; } -BOOL test_multibind(struct ldap_connection *conn, const char *userdn, const char *password) +static BOOL test_multibind(struct ldap_connection *conn, const char *userdn, const char *password) { BOOL ret = True; -- cgit From 4b0e5bd75373ffa2d847706a71fd0349dfa15e71 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Jun 2005 09:10:17 +0000 Subject: r7527: - added a ldb_search_bytree() interface, which takes a ldb_parse_tree instead of a search expression. This allows our ldap server to pass its ASN.1 parsed search expressions straight to ldb, instead of going via strings. - updated all the ldb modules code to handle the new interface - got rid of the separate ldb_parse.h now that the ldb_parse structures are exposed externally - moved to C99 structure initialisation in ldb - switched ldap server to using ldb_search_bytree() (This used to be commit 96620ab2ee5d440bbbc51c1bc0cad9977770f897) --- source4/torture/ldap/basic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index c0daefa99d..931a1ee2cc 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -22,6 +22,7 @@ */ #include "includes.h" +#include "lib/ldb/include/ldb.h" #include "libcli/ldap/ldap.h" #include "lib/cmdline/popt_common.h" @@ -96,7 +97,7 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) msg->r.SearchRequest.timelimit = 0; msg->r.SearchRequest.sizelimit = 0; msg->r.SearchRequest.attributesonly = False; - msg->r.SearchRequest.filter = talloc_strdup(msg->mem_ctx, "(objectclass=*)"); + msg->r.SearchRequest.tree = ldb_parse_tree(msg->mem_ctx, "(objectclass=*)"); msg->r.SearchRequest.num_attributes = 0; msg->r.SearchRequest.attributes = NULL; -- cgit From c0947b0d7f809f5139fbfcdbd618ed7b0a77d2be Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 15 Jun 2005 00:27:51 +0000 Subject: r7593: simplified the memory management in the ldap code. Having a mem_ctx element in a structure is not necessary any more. (This used to be commit 912d0427f52eac811b27bf7e385b0642f7dc7f53) --- source4/torture/ldap/basic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 931a1ee2cc..97837d9ba8 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -97,7 +97,7 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) msg->r.SearchRequest.timelimit = 0; msg->r.SearchRequest.sizelimit = 0; msg->r.SearchRequest.attributesonly = False; - msg->r.SearchRequest.tree = ldb_parse_tree(msg->mem_ctx, "(objectclass=*)"); + msg->r.SearchRequest.tree = ldb_parse_tree(msg, "(objectclass=*)"); msg->r.SearchRequest.num_attributes = 0; msg->r.SearchRequest.attributes = NULL; @@ -121,7 +121,7 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) (char *)r->attributes[i].values[j].data)); if (!(*basedn) && strcasecmp("defaultNamingContext",r->attributes[i].name)==0) { - *basedn = talloc_asprintf(conn->mem_ctx, "%.*s", + *basedn = talloc_asprintf(conn, "%.*s", r->attributes[i].values[j].length, (char *)r->attributes[i].values[j].data); } @@ -156,9 +156,9 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) req->type = LDAP_TAG_CompareRequest; req->r.CompareRequest.dn = basedn; - req->r.CompareRequest.attribute = talloc_strdup(req->mem_ctx, "objectClass"); + req->r.CompareRequest.attribute = talloc_strdup(req, "objectClass"); val = "domain"; - req->r.CompareRequest.value = data_blob_talloc(req->mem_ctx, val, strlen(val)); + req->r.CompareRequest.value = data_blob_talloc(req, val, strlen(val)); rep = ldap_transaction(conn, req); if (!rep) { -- cgit From bab977dad76e9204278c7afe0bb905cda064f488 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 16 Jun 2005 05:39:40 +0000 Subject: r7626: a new ldap client library. Main features are: - hooked into events system, so requests can be truly async and won't interfere with other processing happening at the same time - uses NTSTATUS codes for errors (previously errors were mostly ignored). In a similar fashion to the DOS error handling, I have reserved a range of the NTSTATUS code 32 bit space for LDAP error codes, so a function can return a LDAP error code in a NTSTATUS - much cleaner packet handling (This used to be commit 2e3c660b2fc20e046d82bf1cc296422b6e7dfad0) --- source4/torture/ldap/basic.c | 103 +++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 48 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 97837d9ba8..69b9017d8a 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -24,6 +24,7 @@ #include "includes.h" #include "lib/ldb/include/ldb.h" #include "libcli/ldap/ldap.h" +#include "libcli/ldap/ldap_client.h" #include "lib/cmdline/popt_common.h" static BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) @@ -78,12 +79,14 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) { BOOL ret = True; struct ldap_message *msg, *result; + struct ldap_request *req; + int i; + struct ldap_SearchResEntry *r; + NTSTATUS status; printf("Testing RootDSE Search\n"); *basedn = NULL; - conn->searchid = 0; - conn->next_msgid = 30; msg = new_ldap_message(conn); if (!msg) { @@ -101,45 +104,50 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) msg->r.SearchRequest.num_attributes = 0; msg->r.SearchRequest.attributes = NULL; - if (!ldap_setsearchent(conn, msg, NULL)) { - printf("Could not setsearchent\n"); + req = ldap_request_send(conn, msg); + if (req == NULL) { + printf("Could not setup ldap search\n"); + return False; + } + + status = ldap_result_one(req, &result, LDAP_TAG_SearchResultEntry); + if (!NT_STATUS_IS_OK(status)) { + printf("search failed - %s\n", nt_errstr(status)); return False; } - result = ldap_getsearchent(conn, NULL); - if (result) { - int i; - struct ldap_SearchResEntry *r = &result->r.SearchResultEntry; + printf("received %d replies\n", req->num_replies); + + r = &result->r.SearchResultEntry; - DEBUG(1,("\tdn: %s\n", r->dn)); - for (i=0; inum_attributes; i++) { - int j; - for (j=0; jattributes[i].num_values; j++) { - DEBUG(1,("\t%s: %d %.*s\n", r->attributes[i].name, - r->attributes[i].values[j].length, - r->attributes[i].values[j].length, - (char *)r->attributes[i].values[j].data)); - if (!(*basedn) && - strcasecmp("defaultNamingContext",r->attributes[i].name)==0) { - *basedn = talloc_asprintf(conn, "%.*s", - r->attributes[i].values[j].length, - (char *)r->attributes[i].values[j].data); - } + DEBUG(1,("\tdn: %s\n", r->dn)); + for (i=0; inum_attributes; i++) { + int j; + for (j=0; jattributes[i].num_values; j++) { + DEBUG(1,("\t%s: %d %.*s\n", r->attributes[i].name, + r->attributes[i].values[j].length, + r->attributes[i].values[j].length, + (char *)r->attributes[i].values[j].data)); + if (!(*basedn) && + strcasecmp("defaultNamingContext",r->attributes[i].name)==0) { + *basedn = talloc_asprintf(conn, "%.*s", + r->attributes[i].values[j].length, + (char *)r->attributes[i].values[j].data); } } - } else { - ret = False; } - ldap_endsearchent(conn, NULL); + talloc_free(req); return ret; } static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) { - struct ldap_message *req, *rep; + struct ldap_message *msg, *rep; + struct ldap_request *req; const char *val; + NTSTATUS status; printf("Testing SASL Compare: %s\n", basedn); @@ -147,21 +155,25 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) return False; } - conn->next_msgid = 55; - - req = new_ldap_message(conn); - if (!req) { + msg = new_ldap_message(conn); + if (!msg) { return False; } - req->type = LDAP_TAG_CompareRequest; - req->r.CompareRequest.dn = basedn; - req->r.CompareRequest.attribute = talloc_strdup(req, "objectClass"); + msg->type = LDAP_TAG_CompareRequest; + msg->r.CompareRequest.dn = basedn; + msg->r.CompareRequest.attribute = talloc_strdup(msg, "objectClass"); val = "domain"; - req->r.CompareRequest.value = data_blob_talloc(req, val, strlen(val)); + msg->r.CompareRequest.value = data_blob_talloc(msg, val, strlen(val)); + + req = ldap_request_send(conn, msg); + if (!req) { + return False; + } - rep = ldap_transaction(conn, req); - if (!rep) { + status = ldap_result_one(req, &rep, LDAP_TAG_CompareResponse); + if (!NT_STATUS_IS_OK(status)) { + printf("error in ldap compare request - %s\n", nt_errstr(status)); return False; } @@ -171,13 +183,10 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) rep->r.CompareResponse.errormessage, rep->r.CompareResponse.referral)); - if (rep->type != LDAP_TAG_CompareResponse) { - return False; - } - return True; } + BOOL torture_ldap_basic(void) { NTSTATUS status; @@ -186,7 +195,6 @@ BOOL torture_ldap_basic(void) BOOL ret = True; const char *host = lp_parm_string(-1, "torture", "host"); const char *userdn = lp_parm_string(-1, "torture", "ldap_userdn"); - /*const char *basedn = lp_parm_string(-1, "torture", "ldap_basedn");*/ const char *secret = lp_parm_string(-1, "torture", "ldap_secret"); char *url; char *basedn; @@ -195,18 +203,18 @@ BOOL torture_ldap_basic(void) url = talloc_asprintf(mem_ctx, "ldap://%s/", host); - status = torture_ldap_connection2(mem_ctx, &conn, url, userdn, secret); + status = torture_ldap_connection(mem_ctx, &conn, url); if (!NT_STATUS_IS_OK(status)) { return False; } - /* other basic tests here */ - - if (!test_multibind(conn, userdn, secret)) { + if (!test_search_rootDSE(conn, &basedn)) { ret = False; } - if (!test_search_rootDSE(conn, &basedn)) { + /* other basic tests here */ + + if (!test_multibind(conn, userdn, secret)) { ret = False; } @@ -219,10 +227,9 @@ BOOL torture_ldap_basic(void) } /* no more test we are closing */ - + torture_ldap_close(conn); talloc_free(mem_ctx); - torture_ldap_close(conn); return ret; } -- cgit From e835621799647ee70630b389fb53d15b15d68355 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 17 Jul 2005 09:20:52 +0000 Subject: r8520: fixed a pile of warnings from the build farm gcc -Wall output on S390. This is an attempt to avoid the panic we're seeing in the automatic builds. The main fixes are: - assumptions that sizeof(size_t) == sizeof(int), mostly in printf formats - use of NULL format statements to perform dn searches. - assumption that sizeof() returns an int (This used to be commit a58ea6b3854973b694d2b1e22323ed7eb00e3a3f) --- source4/torture/ldap/basic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 69b9017d8a..7dfc81b692 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -125,13 +125,13 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) int j; for (j=0; jattributes[i].num_values; j++) { DEBUG(1,("\t%s: %d %.*s\n", r->attributes[i].name, - r->attributes[i].values[j].length, - r->attributes[i].values[j].length, + (int)r->attributes[i].values[j].length, + (int)r->attributes[i].values[j].length, (char *)r->attributes[i].values[j].data)); if (!(*basedn) && strcasecmp("defaultNamingContext",r->attributes[i].name)==0) { *basedn = talloc_asprintf(conn, "%.*s", - r->attributes[i].values[j].length, + (int)r->attributes[i].values[j].length, (char *)r->attributes[i].values[j].data); } } -- cgit From d4de4c2d210d2e8c9b5aedf70695594809ad6a0b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 30 Dec 2005 13:16:54 +0000 Subject: r12608: Remove some unused #include lines. (This used to be commit 70e7449318aa0e9d2639c76730a7d1683b2f4981) --- source4/torture/ldap/basic.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 7dfc81b692..64c4dbfdf0 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -22,8 +22,6 @@ */ #include "includes.h" -#include "lib/ldb/include/ldb.h" -#include "libcli/ldap/ldap.h" #include "libcli/ldap/ldap_client.h" #include "lib/cmdline/popt_common.h" -- cgit From 1a53c1dc927efbc6a594ed513feb9ab9247078e8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 4 Feb 2006 14:08:24 +0000 Subject: r13346: use private proto header files for the torture tests metze (This used to be commit 67837dbd2bcff8ec1917ba02884ee2eaa0776b46) --- source4/torture/ldap/basic.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 64c4dbfdf0..b7a2242c95 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -25,6 +25,8 @@ #include "libcli/ldap/ldap_client.h" #include "lib/cmdline/popt_common.h" +#include "torture/ldap/proto.h" + static BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) { NTSTATUS status; -- cgit From 909b111f587705a45f63540b39968f1af58a9b5d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 25 Mar 2006 16:01:28 +0000 Subject: r14720: Add torture_context argument to all torture tests (This used to be commit 3c7a5ce29108dd82210dc3e1f00414f545949e1d) --- source4/torture/ldap/basic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index b7a2242c95..7b041e9255 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -25,6 +25,7 @@ #include "libcli/ldap/ldap_client.h" #include "lib/cmdline/popt_common.h" +#include "torture/torture.h" #include "torture/ldap/proto.h" static BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) @@ -187,7 +188,7 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) } -BOOL torture_ldap_basic(void) +BOOL torture_ldap_basic(struct torture_context *torture) { NTSTATUS status; struct ldap_connection *conn; -- cgit From a39f239cb28e4ac6be207d4179bacffce97f1b3e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 18 Oct 2006 14:23:19 +0000 Subject: r19392: Use torture_setting_* rather than lp_parm_* where possible. (This used to be commit b28860978fe29c5b10abfb8c59d7182864e21dd6) --- source4/torture/ldap/basic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 7b041e9255..ba7130677c 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -194,9 +194,9 @@ BOOL torture_ldap_basic(struct torture_context *torture) struct ldap_connection *conn; TALLOC_CTX *mem_ctx; BOOL ret = True; - const char *host = lp_parm_string(-1, "torture", "host"); - const char *userdn = lp_parm_string(-1, "torture", "ldap_userdn"); - const char *secret = lp_parm_string(-1, "torture", "ldap_secret"); + const char *host = torture_setting_string(torture, "host", NULL); + const char *userdn = torture_setting_string(torture, "ldap_userdn", NULL); + const char *secret = torture_setting_string(torture, "ldap_secret", NULL); char *url; char *basedn; -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/torture/ldap/basic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index ba7130677c..e7d1365c24 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ -- cgit From 2151cde58014ea2e822c13d2f8a369b45dc19ca8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 22:28:14 +0000 Subject: r25554: Convert last instances of BOOL, True and False to the standard types. (This used to be commit 566aa14139510788548a874e9213d91317f83ca9) --- source4/torture/ldap/basic.c | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index e7d1365c24..3f030c97ba 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -27,37 +27,37 @@ #include "torture/torture.h" #include "torture/ldap/proto.h" -static BOOL test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) +static bool test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) { NTSTATUS status; - BOOL ret = True; + bool ret = true; status = torture_ldap_bind(conn, userdn, password); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; } return ret; } -static BOOL test_bind_sasl(struct ldap_connection *conn, struct cli_credentials *creds) +static bool test_bind_sasl(struct ldap_connection *conn, struct cli_credentials *creds) { NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing sasl bind as user\n"); status = torture_ldap_bind_sasl(conn, creds); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; } return ret; } -static BOOL test_multibind(struct ldap_connection *conn, const char *userdn, const char *password) +static bool test_multibind(struct ldap_connection *conn, const char *userdn, const char *password) { - BOOL ret = True; + bool ret = true; printf("Testing multiple binds on a single connnection as anonymous and user\n"); @@ -75,9 +75,9 @@ static BOOL test_multibind(struct ldap_connection *conn, const char *userdn, con return ret; } -static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) +static bool test_search_rootDSE(struct ldap_connection *conn, char **basedn) { - BOOL ret = True; + bool ret = true; struct ldap_message *msg, *result; struct ldap_request *req; int i; @@ -90,7 +90,7 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) msg = new_ldap_message(conn); if (!msg) { - return False; + return false; } msg->type = LDAP_TAG_SearchRequest; @@ -99,7 +99,7 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) msg->r.SearchRequest.deref = LDAP_DEREFERENCE_NEVER; msg->r.SearchRequest.timelimit = 0; msg->r.SearchRequest.sizelimit = 0; - msg->r.SearchRequest.attributesonly = False; + msg->r.SearchRequest.attributesonly = false; msg->r.SearchRequest.tree = ldb_parse_tree(msg, "(objectclass=*)"); msg->r.SearchRequest.num_attributes = 0; msg->r.SearchRequest.attributes = NULL; @@ -107,13 +107,13 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) req = ldap_request_send(conn, msg); if (req == NULL) { printf("Could not setup ldap search\n"); - return False; + return false; } status = ldap_result_one(req, &result, LDAP_TAG_SearchResultEntry); if (!NT_STATUS_IS_OK(status)) { printf("search failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("received %d replies\n", req->num_replies); @@ -142,7 +142,7 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) return ret; } -static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) +static bool test_compare_sasl(struct ldap_connection *conn, const char *basedn) { struct ldap_message *msg, *rep; struct ldap_request *req; @@ -152,12 +152,12 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) printf("Testing SASL Compare: %s\n", basedn); if (!basedn) { - return False; + return false; } msg = new_ldap_message(conn); if (!msg) { - return False; + return false; } msg->type = LDAP_TAG_CompareRequest; @@ -168,13 +168,13 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) req = ldap_request_send(conn, msg); if (!req) { - return False; + return false; } status = ldap_result_one(req, &rep, LDAP_TAG_CompareResponse); if (!NT_STATUS_IS_OK(status)) { printf("error in ldap compare request - %s\n", nt_errstr(status)); - return False; + return false; } DEBUG(5,("Code: %d DN: [%s] ERROR:[%s] REFERRAL:[%s]\n", @@ -183,16 +183,16 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) rep->r.CompareResponse.errormessage, rep->r.CompareResponse.referral)); - return True; + return true; } -BOOL torture_ldap_basic(struct torture_context *torture) +bool torture_ldap_basic(struct torture_context *torture) { NTSTATUS status; struct ldap_connection *conn; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; const char *host = torture_setting_string(torture, "host", NULL); const char *userdn = torture_setting_string(torture, "ldap_userdn", NULL); const char *secret = torture_setting_string(torture, "ldap_secret", NULL); @@ -205,25 +205,25 @@ BOOL torture_ldap_basic(struct torture_context *torture) status = torture_ldap_connection(mem_ctx, &conn, url); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } if (!test_search_rootDSE(conn, &basedn)) { - ret = False; + ret = false; } /* other basic tests here */ if (!test_multibind(conn, userdn, secret)) { - ret = False; + ret = false; } if (!test_bind_sasl(conn, cmdline_credentials)) { - ret = False; + ret = false; } if (!test_compare_sasl(conn, basedn)) { - ret = False; + ret = false; } /* no more test we are closing */ -- cgit From a72c5053c587f0ed6113ef514fe3739cb81e7abf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Dec 2007 23:32:43 +0100 Subject: r26353: Remove use of global_loadparm. (This used to be commit 17637e4490e42db6cdef619286c4d5a0982e9d1a) --- source4/torture/ldap/basic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/torture/ldap/basic.c') diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 3f030c97ba..76d412a7cd 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -27,6 +27,8 @@ #include "torture/torture.h" #include "torture/ldap/proto.h" +#include "param/param.h" + static bool test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) { NTSTATUS status; @@ -47,7 +49,7 @@ static bool test_bind_sasl(struct ldap_connection *conn, struct cli_credentials printf("Testing sasl bind as user\n"); - status = torture_ldap_bind_sasl(conn, creds); + status = torture_ldap_bind_sasl(conn, creds, global_loadparm); if (!NT_STATUS_IS_OK(status)) { ret = false; } -- cgit From b65dba2245bf382c47d65c95ac9b1efa43918fc0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 10 Dec 2007 04:33:16 +0100 Subject: r26355: Eliminate global_loadparm in more places. (This used to be commit 5d589a0d94bd76a9b4c9fc748854e8098ea43c4d) --- source4/torture/ldap/basic.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source4/torture/ldap/basic.c') 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; } -- cgit