From: Samuel Cabrero Date: Fri, 31 Aug 2018 16:24:56 +0000 (+0200) Subject: tests/ntlm_auth: Port ntlm_auth tests to python: ntlm_auth plaintext authentication... X-Git-Tag: tdb-1.3.17~237 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfa149276f1e2c1a64208ff33ca161008f012d6d;p=thirdparty%2Fsamba.git tests/ntlm_auth: Port ntlm_auth tests to python: ntlm_auth plaintext authentication with require-membership-of Port ntlm_auth bash script tests to python Signed-off-by: Samuel Cabrero Reviewed-by: Noel Power Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/ntlm_auth.py b/python/samba/tests/ntlm_auth.py index 089f30933de..f62165b626a 100644 --- a/python/samba/tests/ntlm_auth.py +++ b/python/samba/tests/ntlm_auth.py @@ -178,3 +178,17 @@ class NTLMAuthHelpersTests(NTLMAuthTestCase): server_helper="gss-spnego", server_use_winbind=True) self.assertFalse(ret) + + def test_plaintext_with_membership(self): + """ ntlm_auth plaintext authentication with require-membership-of """ + + proc = Popen([self.ntlm_auth_path, + "--require-membership-of", self.group_sid, + "--helper-protocol", "squid-2.5-basic"], + stdout=PIPE, stdin=PIPE, stderr=PIPE) + creds = "%s%s%s %s\n" % (self.domain, self.winbind_separator, + self.username, + self.password) + (out, err) = proc.communicate(input=creds.encode('utf-8')) + self.assertEqual(proc.returncode, 0) + self.assertTrue(out.startswith(b"OK\n")) diff --git a/source3/script/tests/test_ntlm_auth_s3.sh b/source3/script/tests/test_ntlm_auth_s3.sh index 3b3c5dfe7ef..2a4942bb9f5 100755 --- a/source3/script/tests/test_ntlm_auth_s3.sh +++ b/source3/script/tests/test_ntlm_auth_s3.sh @@ -24,37 +24,6 @@ BADSID=`eval $BINDIR/wbinfo -n $USERNAME | cut -d ' ' -f1 | sed 's/..$//'` failed=0 -test_plaintext_check_output_stdout() -{ - tmpfile=$PREFIX/ntlm_commands - - cat > $tmpfile </dev/null 2>&1 - - if [ $? = 0 ] ; then - # authenticated .. succeed - true - else - echo failed to get successful authentication - false - fi -} - test_plaintext_check_output_fail() { tmpfile=$PREFIX/ntlm_commands @@ -269,7 +238,6 @@ EOF } # This should work even with NTLMv2 -testit "ntlm_auth plaintext authentication with require-membership-of" test_plaintext_check_output_stdout || failed=`expr $failed + 1` testit "ntlm_auth plaintext authentication with failed require-membership-of" test_plaintext_check_output_fail || failed=`expr $failed + 1` testit "ntlm_auth ntlm-server-1 with fixed password" test_ntlm_server_1_check_output || failed=`expr $failed + 1`