The branch, master has been updated
       via  e535bcc698b s3: vfs_widelinks: Allow case insensitivity to work on 
DFS widelinks shares.
       via  e37e4f47493 s3/torture: Add test for widelink case insensitivity on 
a MSDFS share.
      from  db342d86a9c samba-tool user readpasswords: avoid `assert` for 
validation

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e535bcc698bd5eb31f5c5e0c144692988a044e79
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jun 10 17:25:32 2024 -0700

    s3: vfs_widelinks: Allow case insensitivity to work on DFS widelinks shares.
    
    Remove knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15662
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <noel.po...@suse.com>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Tue Jun 11 17:00:38 UTC 2024 on atb-devel-224

commit e37e4f474935819c75c078e52715cf3212f77359
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jun 10 15:14:19 2024 -0700

    s3/torture: Add test for widelink case insensitivity on a MSDFS share.
    
    Add knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15662
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <noel.po...@suse.com>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_widelinks.c              | 13 ++++-
 source3/script/tests/test_widelink_dfs_ci.sh | 72 ++++++++++++++++++++++++++++
 source3/selftest/tests.py                    | 11 +++++
 3 files changed, 94 insertions(+), 2 deletions(-)
 create mode 100755 source3/script/tests/test_widelink_dfs_ci.sh


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_widelinks.c b/source3/modules/vfs_widelinks.c
index c5b5084e108..4339f6de9e0 100644
--- a/source3/modules/vfs_widelinks.c
+++ b/source3/modules/vfs_widelinks.c
@@ -383,8 +383,17 @@ static int widelinks_openat(vfs_handle_struct *handle,
                }
                lstat_ret = SMB_VFS_NEXT_LSTAT(handle,
                                full_fname);
-               if (lstat_ret != -1 &&
-                   VALID_STAT(full_fname->st) &&
+               if (lstat_ret == -1) {
+                       /*
+                        * Path doesn't exist. We must
+                        * return errno from LSTAT.
+                        */
+                       int saved_errno = errno;
+                       TALLOC_FREE(full_fname);
+                       errno = saved_errno;
+                       return -1;
+               }
+               if (VALID_STAT(full_fname->st) &&
                    S_ISLNK(full_fname->st.st_ex_mode)) {
                        fsp->fsp_name->st = full_fname->st;
                }
diff --git a/source3/script/tests/test_widelink_dfs_ci.sh 
b/source3/script/tests/test_widelink_dfs_ci.sh
new file mode 100755
index 00000000000..6ae5cf5bd7f
--- /dev/null
+++ b/source3/script/tests/test_widelink_dfs_ci.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+# regression test for dfs access with wide links enabled on dfs share
+# Ensure we still maintain case insensitivity.
+
+if [ $# -lt 7 ]; then
+       cat <<EOF
+Usage: test_widelink_dfs_ci.sh SERVER SERVER_IP SHARE USERNAME PASSWORD PREFIX 
SMBCLIENT <smbclient arguments>
+EOF
+       exit 1
+fi
+
+SERVER="$1"
+SERVER_IP="$2"
+SHARE="$3"
+USERNAME="$4"
+PASSWORD="$5"
+PREFIX="$6"
+SMBCLIENT="$7"
+shift 7
+ADDARGS="$@"
+
+incdir=$(dirname "$0")"/../../../testprogs/blackbox"
+. "$incdir/subunit.sh"
+. "$incdir/common_test_fns.inc"
+
+failed=0
+
+# Do not let deprecated option warnings muck this up
+SAMBA_DEPRECATED_SUPPRESS=1
+export SAMBA_DEPRECATED_SUPPRESS
+
+# Test chdir'ing into a lowercase directory with upper case.
+test_ci()
+{
+        tmpfile="$PREFIX/smbclient_ci_commands"
+
+        cat >"$tmpfile" <<EOF
+mkdir x
+cd X
+cd ..
+rmdir x
+quit
+EOF
+
+        cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD 
//$SERVER/msdfs-share-wl -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
+        eval echo "$cmd"
+        out=$(eval "$cmd")
+        ret=$?
+        rm -f "$tmpfile"
+
+        if [ $ret != 0 ]; then
+                echo "$out"
+                echo "failed create x then chdir into X with error $ret"
+                return 1
+        fi
+
+       echo "$out" | grep 'NT_STATUS_'
+       ret="$?"
+       if [ "$ret" -eq 0 ]; then
+               echo "$out"
+               echo "Error create x then chdir into X"
+               return 1
+        fi
+       return 0
+}
+
+testit "creating a directory x and chdir into it" \
+        test_ci ||
+       failed=$((failed + 1))
+
+testok "$0" "$failed"
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index f7b48dbad38..773c8598eb3 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -1811,6 +1811,17 @@ plantestsuite("samba3.blackbox.smbclient-bug15435",
                smbclient3,
                configuration])
 
+plantestsuite("samba3.blackbox.widelink_dfs_ci",
+              "fileserver",
+              [os.path.join(samba3srcdir, 
"script/tests/test_widelink_dfs_ci.sh"),
+               "$SERVER",
+               "$SERVER_IP",
+               "msdfs-share-wl",
+               "$USERNAME",
+               "$PASSWORD",
+               "$PREFIX",
+               smbclient3])
+
 
 if have_cluster_support:
     t = "readdir-timestamp"


-- 
Samba Shared Repository

Reply via email to