From 9899557a0c3e125000175f308edda2a489afe237 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Sun, 12 Apr 2020 11:01:50 +0300 Subject: [PATCH] Revert POSIX stat tuning code Resolves: rhbz#1801442 --- ...-to-find-posix-stat-info-in-SMBC_get.patch | 91 +++++++++++++++++++ samba.spec | 7 +- 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 0001-libsmb-Don-t-try-to-find-posix-stat-info-in-SMBC_get.patch diff --git a/0001-libsmb-Don-t-try-to-find-posix-stat-info-in-SMBC_get.patch b/0001-libsmb-Don-t-try-to-find-posix-stat-info-in-SMBC_get.patch new file mode 100644 index 0000000..ba901a4 --- /dev/null +++ b/0001-libsmb-Don-t-try-to-find-posix-stat-info-in-SMBC_get.patch @@ -0,0 +1,91 @@ +From 686ea46cbc9538355815fe800e441d67fee6a9db Mon Sep 17 00:00:00 2001 +From: Volker Lendecke +Date: Thu, 19 Mar 2020 11:01:41 +0100 +Subject: [PATCH] libsmb: Don't try to find posix stat info in SMBC_getatr() + +This wrongly used "frame" instead of "fname", which can never have +worked. A first attempt to fix in 51551e0d53fa6 caused a few followup +patches in an attempt to clean up the test failures 51551e0d53fa6 +introduced. They were reverted after a few discussions. So rather than +changing behaviour, just remove the code that introduced the valgrind +error again. + +Signed-off-by: Volker Lendecke +Reviewed-by: Andreas Schneider + +Autobuild-User(master): Jeremy Allison +Autobuild-Date(master): Fri Mar 20 05:06:07 UTC 2020 on sn-devel-184 + +(cherry picked from commit 39c910fd9cba3caf7414274b678b9eee33d7e20b) +--- + source3/include/libsmb_internal.h | 1 - + source3/libsmb/libsmb_file.c | 20 -------------------- + source3/libsmb/libsmb_server.c | 9 --------- + 3 files changed, 30 deletions(-) + +diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h +index 21a11c1a024..feedddd0877 100644 +--- a/source3/include/libsmb_internal.h ++++ b/source3/include/libsmb_internal.h +@@ -76,7 +76,6 @@ typedef struct DOS_ATTR_DESC { + struct _SMBCSRV { + struct cli_state *cli; + dev_t dev; +- bool try_posixinfo; + bool no_pathinfo; + bool no_pathinfo2; + bool no_pathinfo3; +diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c +index 1577010e490..f0a16c61a83 100644 +--- a/source3/libsmb/libsmb_file.c ++++ b/source3/libsmb/libsmb_file.c +@@ -504,26 +504,6 @@ 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, +diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c +index d4f71d8c8b7..0067df48cac 100644 +--- a/source3/libsmb/libsmb_server.c ++++ b/source3/libsmb/libsmb_server.c +@@ -657,15 +657,6 @@ SMBC_server_internal(TALLOC_CTX *ctx, + ZERO_STRUCTP(srv); + DLIST_ADD(srv->cli, c); + srv->dev = (dev_t)(str_checksum(server) ^ str_checksum(share)); +- srv->try_posixinfo = false; +- /* +- * Until SMB2 POSIX is done, only +- * try POSIX stat on SMB1 with POSIX capabilities. +- */ +- if ((smbXcli_conn_protocol(c->conn) < PROTOCOL_SMB2_02) && +- (smb1cli_conn_capabilities(c->conn) & CAP_UNIX)) { +- srv->try_posixinfo = true; +- } + srv->no_pathinfo = False; + srv->no_pathinfo2 = False; + srv->no_pathinfo3 = False; +-- +2.26.0 + diff --git a/samba.spec b/samba.spec index e4fd049..45731d1 100644 --- a/samba.spec +++ b/samba.spec @@ -8,7 +8,7 @@ %define samba_requires_eq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not") -%define main_release 0 +%define main_release 1 %define samba_version 4.12.1 %define talloc_version 2.3.1 @@ -125,6 +125,7 @@ Source14: samba.pamd Source201: README.downgrade Patch100: new_mit_118.patch +Patch101: 0001-libsmb-Don-t-try-to-find-posix-stat-info-in-SMBC_get.patch Requires(pre): /usr/sbin/groupadd Requires(post): systemd @@ -3559,6 +3560,10 @@ fi %endif %changelog +* Sun Apr 12 2020 Alexander Bokovoy - 4.12.1-1 +- Revert POSIX stat tuning in libsmbclient +- Resolves: rhbz#1801442 + * Tue Apr 07 2020 Guenther Deschner - 4.12.1-0 - Update to Samba 4.12.1