tests/ntlm_auth: Port ntlm_auth tests to python: ntlm_auth against winbindd with...
authorSamuel Cabrero <scabrero@suse.de>
Fri, 31 Aug 2018 15:53:16 +0000 (17:53 +0200)
committerNoel Power <npower@samba.org>
Wed, 19 Dec 2018 11:42:12 +0000 (12:42 +0100)
Port ntlm_auth bash script tests to python

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Noel Power <npower@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/ntlm_auth.py
source3/script/tests/test_ntlm_auth_s3.sh

index 8a4d211c4f7468d1cd07e4e60bc98c5e003d4f55..7b680bd40e3f5cf70ceaf89e8cfc5685e5ebb493 100644 (file)
@@ -31,6 +31,7 @@ class NTLMAuthHelpersTests(NTLMAuthTestCase):
         out = get_string(self.check_output("wbinfo -n %s" % self.username))
         self.group_sid = out.split(" ")[0]
         self.assertTrue(self.group_sid.startswith("S-1-5-21-"))
+        self.bad_group_sid = self.group_sid[:-2]
 
     def test_specified_domain(self):
         """ ntlm_auth with specified domain """
@@ -149,6 +150,13 @@ class NTLMAuthHelpersTests(NTLMAuthTestCase):
                               server_use_winbind=True)
         self.assertTrue(ret)
 
+        ret = self.run_helper(client_username=self.username,
+                              client_password=self.password,
+                              client_domain=self.domain,
+                              require_membership=self.bad_group_sid,
+                              server_use_winbind=True)
+        self.assertFalse(ret)
+
     def test_require_membership_gss_spnego(self):
         """ ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server
         against winbind with require-membership-of """
index 3a411e0d2b0063617227927e4c248c83ac064fe6..725e9e3dbfab910e9d4145425c1adfd58163c8b2 100755 (executable)
@@ -269,7 +269,6 @@ EOF
 }
 
 # This should work even with NTLMv2
-testit_expect_failure "ntlm_auth against winbindd with failed require-membership-of" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd $ADDARGS --require-membership-of=$BADSID && failed=`expr $failed + 1`
 testit_expect_failure "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server against winbind with failed require-membership-of" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd --client-helper=gss-spnego-client --server-helper=gss-spnego $ADDARGS --require-membership-of=$BADSID && failed=`expr $failed + 1`
 
 testit "ntlm_auth plaintext authentication with require-membership-of" test_plaintext_check_output_stdout || failed=`expr $failed + 1`