tests/ntlm_auth: Port ntlm_auth tests to python: ntlm_auth against winbindd with...
authorSamuel Cabrero <scabrero@suse.de>
Fri, 31 Aug 2018 15:41:40 +0000 (17:41 +0200)
committerNoel Power <npower@samba.org>
Wed, 19 Dec 2018 11:42:11 +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>
Signed-off-by: Noel Power <noel.power@suse.com>
python/samba/tests/ntlm_auth.py
source3/script/tests/test_ntlm_auth_s3.sh

index c3e0dc3..cc7f5b1 100644 (file)
@@ -28,6 +28,9 @@ class NTLMAuthHelpersTests(NTLMAuthTestCase):
         self.username = os.environ["DC_USERNAME"]
         self.password = os.environ["DC_PASSWORD"]
         self.domain = os.environ["DOMAIN"]
+        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-"))
 
     def test_specified_domain(self):
         """ ntlm_auth with specified domain """
@@ -135,3 +138,13 @@ class NTLMAuthHelpersTests(NTLMAuthTestCase):
                               server_helper="gss-spnego",
                               server_use_winbind=True)
         self.assertTrue(ret)
+
+    def test_require_membership(self):
+        """ ntlm_auth against winbindd with require-membership-of """
+
+        ret = self.run_helper(client_username=self.username,
+                              client_password=self.password,
+                              client_domain=self.domain,
+                              require_membership=self.group_sid,
+                              server_use_winbind=True)
+        self.assertTrue(ret)
index 4df0788..9ca123f 100755 (executable)
@@ -269,7 +269,6 @@ EOF
 }
 
 # This should work even with NTLMv2
-testit "ntlm_auth against winbindd with 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=$SID || failed=`expr $failed + 1`
 testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server against winbind with 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=$SID || failed=`expr $failed + 1`
 
 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`