From 0060cf2f464d989cd88b10627f035f97d3b6f3ae Mon Sep 17 00:00:00 2001 From: Bob Campbell Date: Wed, 18 Jan 2017 15:55:49 +1300 Subject: [PATCH] torture/ntlm_auth: do not assume a line is less than 2047 bytes These tests would fail when ran in our cloud. This was due to lines that were more than 2047 bytes in length, causing us to fail readLine with a ReadChildError. This fix lets it read lines of any length, but in 2047 byte segments. Signed-off-by: Bob Campbell Reviewed-by: Garming Sam Reviewed-by: Andrew Bartlett BUG: https://bugzilla.samba.org/show_bug.cgi?id=12896 (cherry picked from commit 88e4b71e7856f5f1dc4cebd6d4408c9fd4499178) --- source3/torture/test_ntlm_auth.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source3/torture/test_ntlm_auth.py b/source3/torture/test_ntlm_auth.py index fffeb2696b2..076019c539b 100755 --- a/source3/torture/test_ntlm_auth.py +++ b/source3/torture/test_ntlm_auth.py @@ -37,10 +37,15 @@ def readLine(pipe): Read a line from the child's pipe, returns the string read. Throws ReadChildError if the read fails. """ - buf = os.read(pipe, 2047) - newline = buf.find('\n') - if newline == -1: - raise ReadChildError() + newline = -1 + buf = "" + while newline == -1: + more = os.read(pipe, 2047) + buf = buf + more + newline = buf.find('\n') + if more == "": + raise ReadChildError() + return buf[:newline] def writeLine(pipe, buf): -- 2.11.0