[SCM] Samba Shared Repository - branch v4-17-test updated
Jule Anger
janger at samba.org
Thu Aug 3 12:47:01 UTC 2023
The branch, v4-17-test has been updated
via 10f3fafc6f4 s3/modules: Fix DFS links when widelinks = yes
via b63c917cf74 s3/modules: Add flag indicating if connected share is a dfs share
via 98a53e95a0f sefltest: Add new regression test dfs with widelinks = yes
via 9ace53099ed selftest: Add new dfs share (with widelinks enabled)
from d94cbb10b88 s3/utils: avoid erronous NO MEMORY detection
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-17-test
- Log -----------------------------------------------------------------
commit 10f3fafc6f4fedbc182894c3d03fd2939cfcee18
Author: Noel Power <noel.power at 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 <jra at samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15435
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at 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-17-test): Jule Anger <janger at samba.org>
Autobuild-Date(v4-17-test): Thu Aug 3 12:46:29 UTC 2023 on sn-devel-184
commit b63c917cf742682f909597349d2f1f513c422ec7
Author: Noel Power <noel.power at 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 <jra at samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15435
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 2668dcd0968133cca4f8410bf8c41ed0483f5d87)
commit 98a53e95a0f36e60355e3e2d2719018cd485f436
Author: Noel Power <noel.power at 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.power at suse.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 3d2e9db8b95f9f45d486f8272e53584975f177fa)
commit 9ace53099ed5cc9cb3cabe2f104882b0f260ea43
Author: Noel Power <noel.power at 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.power at suse.com>
Reviewed-by: Jeremy Allison <jra at 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 3336c5b8e97..8f680b73d87 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -3023,6 +3023,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 2a35ea5eb68..c68468a950b 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 dirent *widelinks_readdir(vfs_handle_struct *handle,
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 887bf6d5293..360351336a2 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -1515,6 +1515,16 @@ plantestsuite(
"",
"-b $PREFIX/clusteredmember/unclists/tmp.txt -N 5 -o 10"])
+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_machine_account",
"clusteredmember",
--
Samba Shared Repository
More information about the samba-cvs
mailing list