diff options
author | Simo Sorce <idra@samba.org> | 2004-08-12 22:25:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:57:57 -0500 |
commit | 9dc1e17c353d61a82a5500d1fad787dda8c766c3 (patch) | |
tree | 9939bb41d5c92ee77c6da55c06feebe2060f0b4f /source4/torture/ldap/basic.c | |
parent | 16c52f7a0786a2583c32fb44ee12ff4f1863f355 (diff) | |
download | samba-9dc1e17c353d61a82a5500d1fad787dda8c766c3.tar.gz samba-9dc1e17c353d61a82a5500d1fad787dda8c766c3.tar.bz2 samba-9dc1e17c353d61a82a5500d1fad787dda8c766c3.zip |
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)
Diffstat (limited to 'source4/torture/ldap/basic.c')
-rw-r--r-- | source4/torture/ldap/basic.c | 31 |
1 files changed, 29 insertions, 2 deletions
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 */ |