From: Volker Lendecke Date: Tue, 4 Aug 2020 11:58:37 +0000 (+0200) Subject: torture: Inline test_bind_simple() X-Git-Tag: talloc-2.3.2~764 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5e85f4b0840925a0495bb446cd1dea5ebf36932;p=thirdparty%2Fsamba.git torture: Inline test_bind_simple() Avoid losing the specific error code with this simple wrapper function Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 51367af8956..0f0ad6e9168 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -30,19 +30,6 @@ #include "torture/ldap/proto.h" -static bool test_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) -{ - NTSTATUS status; - bool ret = true; - - status = torture_ldap_bind(conn, userdn, password); - if (!NT_STATUS_IS_OK(status)) { - ret = false; - } - - return ret; -} - static bool test_bind_sasl(struct torture_context *tctx, struct ldap_connection *conn, struct cli_credentials *creds) { @@ -61,22 +48,25 @@ static bool test_bind_sasl(struct torture_context *tctx, static bool test_multibind(struct ldap_connection *conn, const char *userdn, const char *password) { - bool ret = true; + NTSTATUS status; printf("Testing multiple binds on a single connection as anonymous and user\n"); - ret = test_bind_simple(conn, NULL, NULL); - if (!ret) { - printf("1st bind as anonymous failed\n"); - return ret; + status = torture_ldap_bind(conn, NULL, NULL); + if (NT_STATUS_IS_OK(status)) { + printf("1st bind as anonymous failed with %s\n", + nt_errstr(status)); + return false; } - ret = test_bind_simple(conn, userdn, password); - if (!ret) { - printf("2nd bind as authenticated user failed\n"); + status = torture_ldap_bind(conn, userdn, password); + if (!NT_STATUS_IS_OK(status)) { + printf("2nd bind as authenticated user failed: %s\n", + nt_errstr(status)); + return false; } - return ret; + return true; } static bool test_search_rootDSE(struct ldap_connection *conn, const char **basedn,