The branch, v4-19-test has been updated via 1231268c219 s3/modules: Fix DFS links when widelinks = yes via 368b3e6102b s3/modules: Add flag indicating if connected share is a dfs share via ece48278912 sefltest: Add new regression test dfs with widelinks = yes via d59392056e7 selftest: Add new dfs share (with widelinks enabled) from e7f91e1d22b vfs_aio_pthread: fix segfault if samba-tool ntacl get
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-19-test - Log ----------------------------------------------------------------- commit 1231268c219a2f00ad62c7d109db96129b0d2388 Author: Noel Power <noel.po...@suse.com> Date: Thu Jul 27 13:26:21 2023 +0100 s3/modules: Fix DFS links when widelinks = yes In openat(), even if we fail to open the file, propagate stat if and only if the object is a link in a DFS share. This allows calling code to further process the link. Also remove knownfail Pair-Programmed-With: Jeremy Alison <j...@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=15435 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Sat Jul 29 00:43:52 UTC 2023 on atb-devel-224 (cherry picked from commit 0bf8b25aacdf2f5c746922320b32e3f0886c81f5) Autobuild-User(v4-19-test): Jule Anger <jan...@samba.org> Autobuild-Date(v4-19-test): Thu Aug 3 14:30:32 UTC 2023 on atb-devel-224 commit 368b3e6102b5a7d9df0f243ced7d75fe8605eb79 Author: Noel Power <noel.po...@suse.com> Date: Thu Jul 27 17:36:29 2023 +0100 s3/modules: Add flag indicating if connected share is a dfs share Not used yet, will be used in the next commit to avoid testing if the connected share is a dfs one. Pair-Programmed-With: Jeremy Alison <j...@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=15435 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit 2668dcd0968133cca4f8410bf8c41ed0483f5d87) commit ece48278912e14432f34f6d0edcd26768e299406 Author: Noel Power <noel.po...@suse.com> Date: Fri Jul 28 09:41:59 2023 +0100 sefltest: Add new regression test dfs with widelinks = yes Adds a new test trying to cd into dfs path on share with widelinks enabled, should generate an error (see BUG:) Add a knownfail so CI continues BUG: https://bugzilla.samba.org/show_bug.cgi?id=15435 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit 3d2e9db8b95f9f45d486f8272e53584975f177fa) commit d59392056e796c2c491e5f53dac2f9161b329bf4 Author: Noel Power <noel.po...@suse.com> Date: Fri Jul 28 09:40:57 2023 +0100 selftest: Add new dfs share (with widelinks enabled) Adds share (to be used in later test) that has dfs node but additionally has widelinks set to yes BUG: https://bugzilla.samba.org/show_bug.cgi?id=15435 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit b57cdfd7efb161cf96b3a39dc7a1652db817e602) ----------------------------------------------------------------------- Summary of changes: selftest/target/Samba3.pm | 5 ++++ source3/modules/vfs_widelinks.c | 30 +++++++++++++++++++--- source3/script/tests/test_bug15435_widelink_dfs.sh | 28 ++++++++++++++++++++ source3/selftest/tests.py | 10 ++++++++ 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100755 source3/script/tests/test_bug15435_widelink_dfs.sh Changeset truncated at 500 lines: diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index b4c3c130e9a..39831afc599 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -3034,6 +3034,11 @@ sub provision($$) msdfs root = yes msdfs shuffle referrals = yes guest ok = yes +[msdfs-share-wl] + path = $msdfs_shrdir + msdfs root = yes + wide links = yes + guest ok = yes [msdfs-share2] path = $msdfs_shrdir2 msdfs root = yes diff --git a/source3/modules/vfs_widelinks.c b/source3/modules/vfs_widelinks.c index 0045242ba81..29f2d4834f6 100644 --- a/source3/modules/vfs_widelinks.c +++ b/source3/modules/vfs_widelinks.c @@ -106,6 +106,7 @@ struct widelinks_config { bool active; + bool is_dfs_share; char *cwd; }; @@ -134,7 +135,8 @@ static int widelinks_connect(struct vfs_handle_struct *handle, DBG_ERR("vfs_widelinks module loaded with " "widelinks = no\n"); } - + config->is_dfs_share = + (lp_host_msdfs() && lp_msdfs_root(SNUM(handle->conn))); SMB_VFS_HANDLE_SET_DATA(handle, config, NULL, /* free_fn */ @@ -346,7 +348,7 @@ static int widelinks_openat(vfs_handle_struct *handle, { struct vfs_open_how how = *_how; struct widelinks_config *config = NULL; - + int ret; SMB_VFS_HANDLE_GET_DATA(handle, config, struct widelinks_config, @@ -363,11 +365,33 @@ static int widelinks_openat(vfs_handle_struct *handle, how.flags = (how.flags & ~O_NOFOLLOW); } - return SMB_VFS_NEXT_OPENAT(handle, + ret = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, &how); + if (config->is_dfs_share && ret == -1 && errno == ENOENT) { + struct smb_filename *full_fname = NULL; + int lstat_ret; + + full_fname = full_path_from_dirfsp_atname(talloc_tos(), + dirfsp, + smb_fname); + if (full_fname == NULL) { + errno = ENOMEM; + return -1; + } + lstat_ret = SMB_VFS_NEXT_LSTAT(handle, + full_fname); + if (lstat_ret != -1 && + VALID_STAT(full_fname->st) && + S_ISLNK(full_fname->st.st_ex_mode)) { + fsp->fsp_name->st = full_fname->st; + } + TALLOC_FREE(full_fname); + errno = ENOENT; + } + return ret; } static struct vfs_fn_pointers vfs_widelinks_fns = { diff --git a/source3/script/tests/test_bug15435_widelink_dfs.sh b/source3/script/tests/test_bug15435_widelink_dfs.sh new file mode 100755 index 00000000000..e239cd0c274 --- /dev/null +++ b/source3/script/tests/test_bug15435_widelink_dfs.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# regression test for dfs access with wide links enabled on dfs share + +if [ $# -lt 5 ]; then + cat <<EOF +Usage: test_smbclient_basic.sh SERVER SERVER_IP DOMAIN USERNAME PASSWORD SMBCLIENT <smbclient arguments> +EOF + exit 1 +fi + +SERVER="$1" +SERVER_IP="$2" +USERNAME="$3" +PASSWORD="$4" +smbclient="$5" +CONFIGURATION="$6" +shift 6 +ADDARGS="$@" + +incdir=$(dirname $0)/../../../testprogs/blackbox +. $incdir/subunit.sh +. $incdir/common_test_fns.inc + +# TEST +test_smbclient "smbclient as $DOMAIN\\$USERNAME" 'ls' "//$SERVER/msdfs-share-wl" -U$DOMAIN\\$USERNAME%$PASSWORD $ADDARGS -c 'cd msdfs-src1' || failed=$(expr $failed + 1) + +exit $failed diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index a10969adbb4..e6d544d9f87 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -1725,6 +1725,16 @@ if have_cluster_support: "$SERVERCONFFILE", "$SERVER_IP"]) +plantestsuite("samba3.blackbox.smbclient-bug15435", + "fileserver", + [os.path.join(samba3srcdir, "script/tests/test_bug15435_widelink_dfs.sh"), + "$SERVER", + "$SERVER_IP", + "$USERNAME", + "$PASSWORD", + smbclient3, + configuration]) + plantestsuite( "samba3.net_lookup_ldap", "ad_dc:local", -- Samba Shared Repository