s3-selftest: Add more tests for ntlm_auth
authorAndrew Bartlett <abartlet@samba.org>
Thu, 1 Mar 2012 05:57:46 +0000 (16:57 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 1 Mar 2012 11:04:46 +0000 (22:04 +1100)
source3/script/tests/test_ntlm_auth_s3.sh
source3/torture/test_ntlm_auth.py

index 1655d7518b53396b9b215d2574b604bf2e0c5e19..ca7a952b7446716140571cbbd0b0427c3bf44962 100755 (executable)
@@ -25,6 +25,9 @@ testit "ntlm_auth" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARG
 # This should work even with NTLMv2
 testit "ntlm_auth with specified domain" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1`
 testit "ntlm_auth against winbindd" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd $ADDARGS || failed=`expr $failed + 1`
+testit "ntlm_auth with NTLMSSP client and gss-spnego server" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo --client-helper=ntlmssp-client-1 --server-helper=gss-spnego || failed=`expr $failed + 1`
+testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo --client-helper=gss-spnego-client --server-helper=gss-spnego || failed=`expr $failed + 1`
+testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server against winbind" $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 || failed=`expr $failed + 1`
 
 
 testok $0 $failed
index be725485a0ce4762cd11d91e8ca8cf2e0846644e..386bfb7f0c3aeec1b2a446eacc3faf1f26b8a15a 100755 (executable)
@@ -181,33 +181,90 @@ def main():
        server_out = server_out_w
        os.close(server_out_r)
 
-       # We're in the parent
-       writeLine(client_out, "YR")
-       buf = readLine(client_in)
+       if opts.client_helper == "ntlmssp-client-1" and opts.server_helper == "squid-2.5-ntlmssp":
 
-       if buf.count("YR ", 0, 3) != 1:
-               sys.exit(1)
+               # We're in the parent
+               writeLine(client_out, "YR")
+               buf = readLine(client_in)
+               
+               if buf.count("YR ", 0, 3) != 1:
+                       sys.exit(1)
+
+               writeLine(server_out, buf)
+               buf = readLine(server_in)
 
-       writeLine(server_out, buf)
-       buf = readLine(server_in)
+               if buf.count("TT ", 0, 3) != 1:
+                       sys.exit(2)
 
-       if buf.count("TT ", 0, 3) != 1:
-               sys.exit(2)
+               writeLine(client_out, buf)
+               buf = readLine(client_in)
+
+               if buf.count("AF ", 0, 3) != 1:
+                       sys.exit(3)
 
-       writeLine(client_out, buf)
-       buf = readLine(client_in)
+               # Client sends 'AF <base64 blob>' but server expects 'KK <abse64 blob>'
+               buf = buf.replace("AF", "KK", 1)
+               
+               writeLine(server_out, buf)
+               buf = readLine(server_in)
+               
+               if buf.count("AF ", 0, 3) != 1:
+                       sys.exit(4)
+
+       
+       if opts.client_helper == "ntlmssp-client-1" and opts.server_helper == "gss-spnego":
+               # We're in the parent
+               writeLine(client_out, "YR")
+               buf = readLine(client_in)
+               
+               if buf.count("YR ", 0, 3) != 1:
+                       sys.exit(1)
+
+               writeLine(server_out, buf)
+               buf = readLine(server_in)
+
+               if buf.count("TT ", 0, 3) != 1:
+                       sys.exit(2)
+
+               writeLine(client_out, buf)
+               buf = readLine(client_in)
+
+               if buf.count("AF ", 0, 3) != 1:
+                       sys.exit(3)
+
+               # Client sends 'AF <base64 blob>' but server expects 'KK <abse64 blob>'
+               buf = buf.replace("AF", "KK", 1)
+               
+               writeLine(server_out, buf)
+               buf = readLine(server_in)
+               
+               if buf.count("AF * ", 0, 5) != 1:
+                       sys.exit(4)
+
+
+       if opts.client_helper == "gss-spnego-client" and opts.server_helper == "gss-spnego":
+               # We're in the parent
+               writeLine(server_out, "YR")
+               buf = readLine(server_in)
+               
+               while True:
+                       if buf.count("AF ", 0, 3) != 1 and buf.count("TT ", 0, 3) != 1:
+                               sys.exit(1)
 
-       if buf.count("AF ", 0, 3) != 1:
-               sys.exit(3)
+                       writeLine(client_out, buf)
+                       buf = readLine(client_in)
+               
+                       if buf.count("AF", 0, 2) == 1:
+                               break
 
-       # Client sends 'AF <base64 blob>' but server expects 'KK <abse64 blob>'
-       buf = buf.replace("AF", "KK", 1)
+                       if buf.count("AF ", 0, 5) != 1 and buf.count("KK ", 0, 3) != 1 and buf.count("TT ", 0, 3) != 1:
+                               sys.exit(2)
 
-       writeLine(server_out, buf)
-       buf = readLine(server_in)
+                       writeLine(server_out, buf)
+                       buf = readLine(server_in)
 
-       if buf.count("AF ", 0, 3) != 1:
-               sys.exit(4)
+                       if buf.count("AF * ", 0, 5) == 1:
+                               break
 
        if opts.client_helper == "ntlmssp-client-1":
                writeLine(client_out, "GK")