[PATCH] remove xfile.[ch]
Jeremy Allison
jra at samba.org
Sat Dec 10 22:08:23 UTC 2016
On Sat, Dec 10, 2016 at 11:42:17AM -0800, Jeremy Allison wrote:
> On Fri, Dec 09, 2016 at 02:27:01PM +0100, Volker Lendecke wrote:
> > Hi!
> >
> > The attached patchset removes our stdio replacement xfile.[ch]. I
> > haven't been able to test everything, for example I don't have AIX
> > available, but the small unit tests I've done looked promising.
> >
> > Review appreciated!
>
> FYI. I'm trying to push this because it's obviously correct :-),
> but with this patchset I repeatably get with:
>
> make test TESTS=samba3.ntlm_auth
>
> the following:
>
> [1(0)/2 at 0s] samba3.ntlm_auth.krb5 with old ccache(ktest:local)
> UNEXPECTED(failure): samba3.ntlm_auth.krb5 with old ccache(ktest:local).ntlm_auth with krb5 gss-spnego-client and gss-spnego server(ktest:local)
> REASON: Exception: Exception: could not obtain winbind domain name!
> could not obtain winbind netbios name!
> could not obtain winbind domain name!
> command: /home/jeremy/src/samba/git/master/source3/script/tests/test_ntlm_auth_krb5.sh python /home/jeremy/src/samba/git/master/source3 /home/jeremy/src/samba/git/m
> expanded command: /home/jeremy/src/samba/git/master/source3/script/tests/test_ntlm_auth_krb5.sh python /home/jeremy/src/samba/git/master/source3 /home/jeremy/src/sa
> ERROR: Testsuite[samba3.ntlm_auth.krb5 with old ccache(ktest:local)]
> REASON: Exit code was 1
>
> which is driving me *nuts*, because there's absolutely
> no reason for it :-).
>
> Still investigating..
FYI. Here's the raw patch I used to track this
down, in case you're interested. It's *extremely*
dirty and writes to an absolute path in /tmp :-),
but taught me to debug a thorny, nasty python-based
tests problem so I thought others might find it
useful to save in their toolbox when debugging
other Samba tests python-related problems.
It's basically python-based printf debugging
(which I always find useful as a last resort :-).
Cheers,
Jeremy.
-------------- next part --------------
diff --git a/source3/torture/test_ntlm_auth.py b/source3/torture/test_ntlm_auth.py
index fffeb26..9ab98f4 100755
--- a/source3/torture/test_ntlm_auth.py
+++ b/source3/torture/test_ntlm_auth.py
@@ -26,10 +26,28 @@ import os
import sys
from optparse import OptionParser
+def dbg_buf(hdr, str):
+ file = open("/tmp/pylog", "a", 0666)
+ file.write(hdr);
+ file.write(":|")
+ file.write(str)
+ file.write("|\n")
+ file.close()
+ return
+
+def dbg(str):
+ file = open("/tmp/pylog", "a", 0666)
+ file.write(str)
+ file.write("\n")
+ file.close()
+ return
+
class ReadChildError(Exception):
+ dbg("ReadChildError")
pass
class WriteChildError(Exception):
+ dbg("WriteChildError")
pass
def readLine(pipe):
@@ -40,6 +58,8 @@ def readLine(pipe):
buf = os.read(pipe, 2047)
newline = buf.find('\n')
if newline == -1:
+ dbg("JRA: Missing newline")
+ dbg("JRA: in string |%s|" % buf)
raise ReadChildError()
return buf[:newline]
@@ -50,6 +70,7 @@ def writeLine(pipe, buf):
"""
written = os.write(pipe, buf)
if written != len(buf):
+ print "JRA: write error\n"
raise WriteChildError()
os.write(pipe, "\n")
@@ -108,9 +129,11 @@ def parseCommandLine():
(opts, args) = parser.parse_args()
if len(args) != 1:
+ dbg("Invalid args")
parser.error("Invalid number of arguments.")
if not os.access(args[0], os.X_OK):
+ dbg("Not exec")
parser.error("%s is not executable." % args[0])
return (opts, args[0])
@@ -123,6 +146,9 @@ def main():
"""
(opts, ntlm_auth_path) = parseCommandLine()
+ dbg(str(opts))
+ dbg(str(ntlm_auth_path))
+
(client_in_r, client_in_w) = os.pipe()
(client_out_r, client_out_w) = os.pipe()
@@ -155,6 +181,7 @@ def main():
if opts.target_hostname:
client_args.append("--target-hostname=%s" % opts.target_hostname)
+ dbg("JRA: executing %s %s\n" % (ntlm_auth_path, client_args))
os.execv(ntlm_auth_path, client_args)
client_in = client_in_r
@@ -188,6 +215,7 @@ def main():
server_args.append("--password=%s" % opts.server_password)
server_args.append("--domain=%s" % opts.server_domain)
if opts.sid:
+ dbg("No winbindd")
raise Exception("Server must be using winbindd for require-membership-of.")
else:
if opts.sid:
@@ -210,18 +238,21 @@ def main():
buf = readLine(client_in)
if buf.count("YR ", 0, 3) != 1:
+ dbg("Error #1")
sys.exit(1)
writeLine(server_out, buf)
buf = readLine(server_in)
if buf.count("TT ", 0, 3) != 1:
+ dbg("Error #2")
sys.exit(2)
writeLine(client_out, buf)
buf = readLine(client_in)
if buf.count("AF ", 0, 3) != 1:
+ dbg("Error #3")
sys.exit(3)
# Client sends 'AF <base64 blob>' but server expects 'KK <abse64 blob>'
@@ -231,6 +262,7 @@ def main():
buf = readLine(server_in)
if buf.count("AF ", 0, 3) != 1:
+ dbg("Error #4")
sys.exit(4)
@@ -240,18 +272,21 @@ def main():
buf = readLine(client_in)
if buf.count("YR ", 0, 3) != 1:
+ dbg("Error #5")
sys.exit(1)
writeLine(server_out, buf)
buf = readLine(server_in)
if buf.count("TT ", 0, 3) != 1:
+ dbg("Error #6")
sys.exit(2)
writeLine(client_out, buf)
buf = readLine(client_in)
if buf.count("AF ", 0, 3) != 1:
+ dbg("Error #7")
sys.exit(3)
# Client sends 'AF <base64 blob>' but server expects 'KK <abse64 blob>'
@@ -261,6 +296,7 @@ def main():
buf = readLine(server_in)
if buf.count("AF * ", 0, 5) != 1:
+ dbg("Error #8")
sys.exit(4)
@@ -268,22 +304,29 @@ def main():
# We're in the parent
writeLine(server_out, "YR")
buf = readLine(server_in)
+ dbg_buf("In buf 1", buf)
while True:
if buf.count("AF ", 0, 3) != 1 and buf.count("TT ", 0, 3) != 1:
+ dbg("Error #9")
sys.exit(1)
+ dbg_buf("Out buf", buf)
+
writeLine(client_out, buf)
buf = readLine(client_in)
+ dbg_buf("In buf 2", buf)
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:
+ dbg("Error #10")
sys.exit(2)
writeLine(server_out, buf)
buf = readLine(server_in)
+ dbg_buf("In buf 3", buf)
if buf.count("AF * ", 0, 5) == 1:
break
@@ -296,12 +339,14 @@ def main():
buf = readLine(client_in)
if buf.count("GK ", 0, 3) != 1:
+ dbg("Error #11")
sys.exit(4)
writeLine(client_out, "GF")
buf = readLine(client_in)
if buf.count("GF ", 0, 3) != 1:
+ dbg("Error #12")
sys.exit(4)
if opts.server_helper == "squid-2.5-ntlmssp":
@@ -309,12 +354,14 @@ def main():
buf = readLine(server_in)
if buf.count("GK ", 0, 3) != 1:
+ dbg("Error #13")
sys.exit(4)
writeLine(server_out, "GF")
buf = readLine(server_in)
if buf.count("GF ", 0, 3) != 1:
+ dbg("Error #14")
sys.exit(4)
os.close(server_in)
More information about the samba-technical
mailing list