From eca3a14870f6632957a0ffeba1309d5da67cb9a1 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 1 Mar 2012 16:57:46 +1100 Subject: s3-selftest: Add more tests for ntlm_auth --- source3/torture/test_ntlm_auth.py | 95 +++++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 19 deletions(-) (limited to 'source3/torture/test_ntlm_auth.py') diff --git a/source3/torture/test_ntlm_auth.py b/source3/torture/test_ntlm_auth.py index be725485a0..386bfb7f0c 100755 --- a/source3/torture/test_ntlm_auth.py +++ b/source3/torture/test_ntlm_auth.py @@ -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 ' but server expects 'KK ' + 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 ' but server expects 'KK ' + 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 ' but server expects 'KK ' - 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") -- cgit