1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3-selftest: Add more tests for ntlm_auth

This commit is contained in:
Andrew Bartlett 2012-03-01 16:57:46 +11:00
parent 74c6d2bcf4
commit eca3a14870
2 changed files with 79 additions and 19 deletions

View File

@ -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

View File

@ -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)
writeLine(client_out, buf)
buf = readLine(client_in)
if buf.count("AF ", 0, 3) != 1:
sys.exit(3)
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)
# 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)
writeLine(server_out, buf)
buf = readLine(server_in)
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)
if buf.count("AF ", 0, 3) != 1:
sys.exit(4)
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)
writeLine(client_out, buf)
buf = readLine(client_in)
if buf.count("AF", 0, 2) == 1:
break
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)
if buf.count("AF * ", 0, 5) == 1:
break
if opts.client_helper == "ntlmssp-client-1":
writeLine(client_out, "GK")