[HELP?] Weird problem with SMB client code

Tim Beale timbeale at catalyst.net.nz
Fri Dec 14 02:41:40 UTC 2018


I'm hitting a weird problem with the SMB client code. I'll continue
debugging it in the new year, but just posting it here in case it rings
any bells with anyone.

If I have an SMBv2 connection, and cli_list() is the first call I make
on the connection, then I get an NT_STATUS_INTERNAL_ERROR back from the
server. I couldn't see any obvious error message on the server (at debug
level 5).

It doesn't happen on SMBv1 connections. If I do another SMB operation
first, then it's fine. E.g. I'm working around the problem by just
calling cli_list() a 2nd time if it fails.

It doesn't seem to be a problem with smbclient, but I'm not sure what
the pylibsmb code is doing differently. The main differences in
smbclient I could see were:
- It does a cli_resolve_path() first. I'm not really sure what this is
doing. I tried it, but it didn't seem to help (but maybe I wasn't
calling it properly).
- A slightly different API is used to connect (cli_cm_open() vs
cli_full_connection_creds_send()).

If anyone wants to see the problem first-hand, you can checkout the
tim-smb-wip branch on samba-team/devel/samba.git and then go: make test
TESTS=samba.tests.ntacls_backup
The test throws errors:
    return self.smb_conn.list(smb_path, attribs=SMB_FILE_ATTRIBUTE_FLAGS)
NTSTATUSError: (3221225701, 'An internal error occurred.')

Attached is a hacky work-around that makes the problem go away if you
apply it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-TODO-Weird-problem-with-SMBv2-cli_list.patch
Type: text/x-patch
Size: 1447 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20181214/86ffdd53/0001-TODO-Weird-problem-with-SMBv2-cli_list.bin>


More information about the samba-technical mailing list