torture: Fix ldap.basic multibind test
authorVolker Lendecke <vl@samba.org>
Tue, 4 Aug 2020 12:04:48 +0000 (14:04 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 20 Aug 2020 18:44:49 +0000 (18:44 +0000)
It gets LDAP_STRONG_AUTH_REQUIRED from current AD servers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Aug 20 18:44:49 UTC 2020 on sn-devel-184

selftest/knownfail.d/ldap
source4/torture/ldap/basic.c

index fb350639e8380325a03fb9e0dedc59c4ad20a3c0..0331d3687d41a6e27f52505aca16d3edf1da7305 100644 (file)
@@ -1,4 +1,3 @@
 # the attributes too long test returns the wrong error
 ^samba4.ldap.python.+test_attribute_ranges_too_long
 samba4.ldap.python\(ad_dc_default\).*__main__.BasicTests.test_ldapSearchNoAttributes
-samba4.ldap.basic.basic\(ad_dc_default\)
index 0f0ad6e91686cf632e51ae5ca34b86b2c518e86f..825ee835c65737ea0936cc1e1dcc7904c254a952 100644 (file)
@@ -48,20 +48,26 @@ static bool test_bind_sasl(struct torture_context *tctx,
 
 static bool test_multibind(struct ldap_connection *conn, const char *userdn, const char *password)
 {
-       NTSTATUS status;
+       NTSTATUS status, expected;
+       bool ok;
 
        printf("Testing multiple binds on a single connection as anonymous and user\n");
 
        status = torture_ldap_bind(conn, NULL, NULL);
-       if (NT_STATUS_IS_OK(status)) {
+       if (!NT_STATUS_IS_OK(status)) {
                printf("1st bind as anonymous failed with %s\n",
                       nt_errstr(status));
                return false;
        }
 
+       expected = NT_STATUS_LDAP(LDAP_STRONG_AUTH_REQUIRED);
        status = torture_ldap_bind(conn, userdn, password);
-       if (!NT_STATUS_IS_OK(status)) {
-               printf("2nd bind as authenticated user failed: %s\n",
+
+       ok = NT_STATUS_EQUAL(status, expected);
+       if (!ok) {
+               printf("2nd bind as authenticated user should have "
+                      "failed with: %s, got %s\n",
+                      nt_errstr(expected),
                       nt_errstr(status));
                return false;
        }