From f7f38ccf1b8a38b2e883e7f242c4f2eef6ab957c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 24 Feb 2020 09:42:46 -0800 Subject: [PATCH 1/2] libsmb: Pass the correct path to cli_posix_stat() This fixes doing strlen() on talloc_tos(), about which valgrind is pretty unhappy. Without this patch we survive the tests because we have fallbacks to the non-posix flavors of stat(). With this patch in place cli_posix_stat() becomes functional in this code path. This creates conflicts with the readdir libsmbclient tests, which need fixing separately. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101 Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison (cherry picked from commit 51551e0d53fa6abf2c7036ec8a8758f68249b5da) --- selftest/knownfail.d/libsmbclient | 2 ++ source3/libsmb/libsmb_file.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 selftest/knownfail.d/libsmbclient diff --git a/selftest/knownfail.d/libsmbclient b/selftest/knownfail.d/libsmbclient new file mode 100644 index 00000000000..dddd6d24920 --- /dev/null +++ b/selftest/knownfail.d/libsmbclient @@ -0,0 +1,2 @@ +samba4.libsmbclient.readdirplus2.NT1.readdirplus2.* +samba4.libsmbclient.readdirplus_seek.NT1.readdirplus_seek.* diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index 1577010e490..2f1fc96fb5f 100644 --- a/source3/libsmb/libsmb_file.c +++ b/source3/libsmb/libsmb_file.c @@ -507,7 +507,7 @@ SMBC_getatr(SMBCCTX * context, if (srv->try_posixinfo) { SMB_STRUCT_STAT sbuf; - status = cli_posix_stat(targetcli, frame, &sbuf); + status = cli_posix_stat(targetcli, targetpath, &sbuf); if (NT_STATUS_IS_OK(status)) { setup_stat_from_stat_ex(&sbuf, path, sb); -- 2.25.1 From 459fc40b0c0769570c251f35c2f28b436792ec1e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 24 Feb 2020 09:43:12 -0800 Subject: [PATCH 2/2] libsmb: Fill in device which we don't get from cli_posix_stat SMB1 unix extensions don't carry st_dev for stat BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101 Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Feb 26 00:50:32 UTC 2020 on sn-devel-184 (cherry picked from commit c3242b4dfc8247e7ef41fc07e40d88fdc4963898) --- source3/libsmb/libsmb_file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index 2f1fc96fb5f..0e85ab67642 100644 --- a/source3/libsmb/libsmb_file.c +++ b/source3/libsmb/libsmb_file.c @@ -509,6 +509,7 @@ SMBC_getatr(SMBCCTX * context, status = cli_posix_stat(targetcli, targetpath, &sbuf); if (NT_STATUS_IS_OK(status)) { + sbuf.st_ex_dev = srv->dev; setup_stat_from_stat_ex(&sbuf, path, sb); TALLOC_FREE(frame); -- 2.25.1