From: Andreas Schneider Date: Mon, 25 Nov 2019 10:11:13 +0000 (+0100) Subject: libsmbclient: If over SMB1 first try to do a posix stat on the file. X-Git-Tag: samba-4.10.13~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2f8fdb410959f1c2cfa87ac7980d721674635dd;p=thirdparty%2Fsamba.git libsmbclient: If over SMB1 first try to do a posix stat on the file. Disable in future, if server doesn't support this. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Thu Dec 19 15:44:25 UTC 2019 on sn-devel-184 (cherry picked from commit 8b04590e4d8f817ad6d194bb9d622c18734e3011) --- diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index d73b0b68c07..140574e4cb8 100644 --- a/source3/libsmb/libsmb_file.c +++ b/source3/libsmb/libsmb_file.c @@ -504,6 +504,26 @@ SMBC_getatr(SMBCCTX * context, return False; } + if (srv->try_posixinfo) { + SMB_STRUCT_STAT sbuf; + + status = cli_posix_stat(targetcli, frame, &sbuf); + if (NT_STATUS_IS_OK(status)) { + setup_stat_from_stat_ex(&sbuf, path, sb); + + TALLOC_FREE(frame); + return true; + } + if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED) || + NT_STATUS_EQUAL(status, NT_STATUS_INVALID_LEVEL)) { + /* + * Turn this off if the server doesn't + * support it. + */ + srv->try_posixinfo = false; + } + } + if (!srv->no_pathinfo2) { status = cli_qpathinfo2(targetcli, targetpath,