diff options
Diffstat (limited to 'source4/torture/ldap/common.c')
-rw-r--r-- | source4/torture/ldap/common.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/source4/torture/ldap/common.c b/source4/torture/ldap/common.c index 7a3d8e48be..ee3199bccd 100644 --- a/source4/torture/ldap/common.c +++ b/source4/torture/ldap/common.c @@ -3,19 +3,39 @@ NTSTATUS torture_ldap_bind(struct ldap_connection *conn, const char *userdn, const char *password) { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; - struct ldap_message *response; + int result; if (!conn) { printf("We need a valid ldap_connection structure and be connected\n"); return status; } - response = ldap_bind_simple(conn, userdn, password); - if (!response || (response->r.BindResponse.response.resultcode != 0)) { + result = ldap_bind_simple(conn, userdn, password); + if (result != LDAP_SUCCESS) { printf("Failed to bind with provided credentials\n"); /* FIXME: what abut actually implementing an ldap_connection_free() function ? :-) sss */ - destroy_ldap_message(response); + return status; + } + + return NT_STATUS_OK; +} + +NTSTATUS torture_ldap_bind_sasl(struct ldap_connection *conn, const char *username, const char *domain, const char *password) +{ + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + int result; + + if (!conn) { + printf("We need a valid ldap_connection structure and be connected\n"); + return status; + } + + result = ldap_bind_sasl(conn, username, domain, password); + if (result != LDAP_SUCCESS) { + printf("Failed to bind with provided credentialsi and SASL mechanism\n"); + /* FIXME: what abut actually implementing an ldap_connection_free() function ? + :-) sss */ return status; } |