diff options
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 */ |