[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Fri Oct 29 14:58:01 UTC 2021


The branch, master has been updated
       via  0b818c6b77e s3: docs-xml: Clarify the "delete veto files" paramter.
       via  e9ef970eee5 s3: smbd: Fix logic in can_delete_directory_fsp() to cope with dangling symlinks.
       via  26fecad2e66 s3: smbd: Fix logic in rmdir_internals() to cope with dangling symlinks.
       via  a37d16e7c55 s3: smbd: Fix rmdir_internals() to do an early return if lp_delete_veto_files() is not set.
       via  f254be19d65 s3: VFS: xattr_tdb. Allow unlinkat to cope with dangling symlinks.
       via  295d7d026ba s3: VFS: streams_depot. Allow unlinkat to cope with dangling symlinks.
       via  942123b9592 s3: smbd: Add two tests showing the ability to delete a directory containing a dangling symlink over SMB2 depends on "delete veto files" setting.
       via  73de1194c3c s3: smbd: Fix recursive directory delete of a directory containing veto file and msdfs links.
       via  ad0082d79a6 s3: smbd: Add two tests showing recursive directory delete of a directory containing veto file and msdfs links over SMB2.
      from  866c1633277 editorconfig: Heimdal has mixed spaces and tabs with different width

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


- Log -----------------------------------------------------------------
commit 0b818c6b77e972626d0b071bebcf4ce55619fb84
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Oct 25 12:42:02 2021 -0700

    s3: docs-xml: Clarify the "delete veto files" paramter.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14879
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Fri Oct 29 14:57:14 UTC 2021 on sn-devel-184

commit e9ef970eee5eca8ab3720279c54098e91d2dfda9
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Oct 25 12:36:57 2021 -0700

    s3: smbd: Fix logic in can_delete_directory_fsp() to cope with dangling symlinks.
    
    Remove knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14879
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 26fecad2e66e91a3913d88ee2e0889f266e91d89
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Oct 25 12:32:29 2021 -0700

    s3: smbd: Fix logic in rmdir_internals() to cope with dangling symlinks.
    
    Still need to add the same logic in can_delete_directory_fsp()
    before we can delete the knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14879
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit a37d16e7c55f85e3f2c9c8614755ea6307092d5f
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Oct 25 12:21:37 2021 -0700

    s3: smbd: Fix rmdir_internals() to do an early return if lp_delete_veto_files() is not set.
    
    Fix the comments to match what the code actually does. The
    exit at the end of the scan directory loop if we find a client
    visible filename is a change in behavior, but the previous
    behavior (not exist on visible filename, but delete it) was
    a bug and in non-tested code. Now it's testd.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14879
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit f254be19d6501a4f573843af97963e350a9ee2ed
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Oct 25 12:02:43 2021 -0700

    s3: VFS: xattr_tdb. Allow unlinkat to cope with dangling symlinks.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14879
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 295d7d026babe3cd5123d0f53adcb16868907f05
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Oct 25 12:01:58 2021 -0700

    s3: VFS: streams_depot. Allow unlinkat to cope with dangling symlinks.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14879
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 942123b95923f35a32df4196a072a3ed3468396a
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 21 16:37:27 2021 -0700

    s3: smbd: Add two tests showing the ability to delete a directory containing a dangling symlink over SMB2 depends on "delete veto files" setting.
    
    Add knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14879
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 73de1194c3c429ab93d722a852aa4f54213b112a
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 21 16:18:24 2021 -0700

    s3: smbd: Fix recursive directory delete of a directory containing veto file and msdfs links.
    
    Remove knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14878
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit ad0082d79a681b981154747dcde5713e1933b88f
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 21 15:06:20 2021 -0700

    s3: smbd: Add two tests showing recursive directory delete of a directory containing veto file and msdfs links over SMB2.
    
    Add knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14878
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

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

Summary of changes:
 docs-xml/smbdotconf/filename/deletevetofiles.xml   |   9 +-
 selftest/target/Samba3.pm                          |  20 ++
 source3/modules/vfs_streams_depot.c                |  10 +
 source3/modules/vfs_xattr_tdb.c                    |  10 +
 .../tests/test_delete_veto_files_only_rmdir.sh     | 183 +++++++++++++++++
 source3/script/tests/test_veto_rmdir.sh            | 217 +++++++++++++++++++++
 source3/selftest/tests.py                          |   6 +
 source3/smbd/close.c                               |  94 +++++++--
 source3/smbd/dir.c                                 |  55 +++++-
 9 files changed, 575 insertions(+), 29 deletions(-)
 create mode 100755 source3/script/tests/test_delete_veto_files_only_rmdir.sh
 create mode 100755 source3/script/tests/test_veto_rmdir.sh


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/filename/deletevetofiles.xml b/docs-xml/smbdotconf/filename/deletevetofiles.xml
index 581dc05396d..570d4ac60a0 100644
--- a/docs-xml/smbdotconf/filename/deletevetofiles.xml
+++ b/docs-xml/smbdotconf/filename/deletevetofiles.xml
@@ -4,9 +4,12 @@
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
 	<para>This option is used when Samba is attempting to 
-	delete a directory that contains one or more vetoed directories 
-	(see the <smbconfoption name="veto files"/>
-	option).  If this option is set to <constant>no</constant> (the default) then if a vetoed 
+	delete a directory that contains one or more vetoed files
+	or directories or non-visible files or directories (such
+	as dangling symlinks that point nowhere).
+	(see the <smbconfoption name="veto files"/>, <smbconfoption name="hide special files"/>,
+	<smbconfoption name="hide unreadable"/>, <smbconfoption name="hide unwriteable files"/>
+	options).  If this option is set to <constant>no</constant> (the default) then if a vetoed
 	directory contains any non-vetoed files or directories then the 
 	directory delete will fail. This is usually what you want.</para>
 
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index fdbba8411bc..8ecfc1aaf82 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1614,6 +1614,9 @@ sub setup_fileserver
 	my $bad_iconv_sharedir="$share_dir/bad_iconv";
 	push(@dirs, $bad_iconv_sharedir);
 
+	my $veto_sharedir="$share_dir/veto";
+	push(@dirs,$veto_sharedir);
+
 	my $ip4 = Samba::get_ipv4_addr("FILESERVER");
 	my $fileserver_options = "
 	kernel change notify = yes
@@ -1722,6 +1725,23 @@ sub setup_fileserver
 	comment = smb username is [%U]
 	vfs objects =
 
+[veto_files_nodelete]
+	path = $veto_sharedir
+	read only = no
+	msdfs root = yes
+	veto files = /veto_name*/
+	delete veto files = no
+
+[veto_files_delete]
+	path = $veto_sharedir
+	msdfs root = yes
+	veto files = /veto_name*/
+	delete veto files = yes
+
+[delete_veto_files_only]
+	path = $veto_sharedir
+	delete veto files = yes
+
 [homes]
 	comment = Home directories
 	browseable = No
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index 973edeeda24..ae73ba965a5 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -823,6 +823,16 @@ static int streams_depot_unlink_internal(vfs_handle_struct *handle,
 		ret = SMB_VFS_NEXT_LSTAT(handle, full_fname);
 	} else {
 		ret = SMB_VFS_NEXT_STAT(handle, full_fname);
+		if (ret == -1 && (errno == ENOENT || errno == ELOOP)) {
+			if (VALID_STAT(smb_fname->st) &&
+					S_ISLNK(smb_fname->st.st_ex_mode)) {
+				/*
+				 * Original name was a link - Could be
+				 * trying to remove a dangling symlink.
+				 */
+				ret = SMB_VFS_NEXT_LSTAT(handle, full_fname);
+			}
+		}
 	}
 	if (ret == -1) {
 		TALLOC_FREE(full_fname);
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c
index daa99b2cc3e..42c570b54b3 100644
--- a/source3/modules/vfs_xattr_tdb.c
+++ b/source3/modules/vfs_xattr_tdb.c
@@ -520,6 +520,16 @@ static int xattr_tdb_unlinkat(vfs_handle_struct *handle,
 		ret = SMB_VFS_NEXT_LSTAT(handle, full_fname);
 	} else {
 		ret = SMB_VFS_NEXT_STAT(handle, full_fname);
+		if (ret == -1 && (errno == ENOENT || errno == ELOOP)) {
+			if (VALID_STAT(smb_fname->st) &&
+					S_ISLNK(smb_fname->st.st_ex_mode)) {
+				/*
+				 * Original name was a link - Could be
+				 * trying to remove a dangling symlink.
+				 */
+				ret = SMB_VFS_NEXT_LSTAT(handle, full_fname);
+			}
+		}
 	}
 	if (ret == -1) {
 		goto out;
diff --git a/source3/script/tests/test_delete_veto_files_only_rmdir.sh b/source3/script/tests/test_delete_veto_files_only_rmdir.sh
new file mode 100755
index 00000000000..d2c3b2198f7
--- /dev/null
+++ b/source3/script/tests/test_delete_veto_files_only_rmdir.sh
@@ -0,0 +1,183 @@
+#!/bin/sh
+#
+# Check smbclient can (or cannot) delete a directory containing dangling symlinks.
+# BUG: https://bugzilla.samba.org/show_bug.cgi?id=14879
+#
+
+if [ $# -lt 6 ]; then
+cat <<EOF
+Usage: $0 SERVER SERVER_IP USERNAME PASSWORD SHAREPATH SMBCLIENT
+EOF
+exit 1;
+fi
+
+SERVER=${1}
+SERVER_IP=${2}
+USERNAME=${3}
+PASSWORD=${4}
+SHAREPATH=${5}
+SMBCLIENT=${6}
+shift 6
+SMBCLIENT="$VALGRIND ${SMBCLIENT}"
+ADDARGS="$@"
+
+incdir=$(dirname "$0")/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+failed=0
+
+rmdir_path="$SHAREPATH/dir"
+
+#
+# Using the share "[delete_veto_files_only]" we CAN delete
+# a directory containing only a dangling symlink.
+#
+test_dangle_symlink_delete_veto_rmdir()
+{
+    local dangle_symlink_path="$rmdir_path/bad_link"
+    local tmpfile=$PREFIX/smbclient.in.$$
+
+    # Create rmdir directory.
+    mkdir -p "$rmdir_path"
+    # Create dangling symlink underneath.
+    ln -s "nowhere-foo" "$dangle_symlink_path"
+
+    cat > "$tmpfile" <<EOF
+cd dir
+ls
+quit
+EOF
+
+    local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/delete_veto_files_only -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=$(eval "$cmd")
+    ret=$?
+
+    # Check for smbclient error.
+    if [ $ret != 0 ] ; then
+        echo "Failed accessing share delete_veto_files_only - $ret"
+        echo "$out"
+        return 1
+    fi
+
+    # We should NOT see the dangling symlink file.
+    echo "$out" | grep bad_link
+    ret=$?
+    if [ $ret -eq 0 ] ; then
+       echo "Saw dangling symlink bad_link in share delete_veto_files_only"
+       echo "$out"
+       return 1
+    fi
+
+    # Try and remove the directory, should succeed.
+    cat > "$tmpfile" <<EOF
+rd dir
+quit
+EOF
+
+    local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/delete_veto_files_only -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=$(eval "$cmd")
+    ret=$?
+
+    # Check for smbclient error.
+    if [ $ret != 0 ] ; then
+        echo "Failed accessing share delete_veto_files_only - $ret"
+        echo "$out"
+        return 1
+    fi
+
+    # We should get no NT_STATUS_ errors.
+    echo "$out" | grep NT_STATUS_
+    ret=$?
+    if [ $ret -eq 0 ] ; then
+       echo "Got error NT_STATUS_ in share delete_veto_files_only"
+       echo "$out"
+       return 1
+    fi
+
+    return 0
+}
+
+#
+# Using the share "[veto_files_nodelete]" we CANNOT delete
+# a directory containing only a dangling symlink.
+#
+test_dangle_symlink_veto_files_nodelete()
+{
+    local dangle_symlink_path="$rmdir_path/bad_link"
+    local tmpfile=$PREFIX/smbclient.in.$$
+
+    # Create rmdir directory.
+    mkdir -p "$rmdir_path"
+    # Create dangling symlink underneath.
+    ln -s "nowhere-foo" "$dangle_symlink_path"
+
+    cat > "$tmpfile" <<EOF
+cd dir
+ls
+quit
+EOF
+
+    local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/veto_files_nodelete -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=$(eval "$cmd")
+    ret=$?
+
+    # Check for smbclient error.
+    if [ $ret != 0 ] ; then
+        echo "Failed accessing share veto_files_nodelete - $ret"
+        echo "$out"
+        return 1
+    fi
+
+    # We should NOT see the dangling symlink file.
+    echo "$out" | grep bad_link
+    ret=$?
+    if [ $ret -eq 0 ] ; then
+       echo "Saw dangling symlink bad_link in share veto_files_nodelete"
+       echo "$out"
+       return 1
+    fi
+
+    # Try and remove the directory, should fail with DIRECTORY_NOT_EMPTY.
+    cat > "$tmpfile" <<EOF
+rd dir
+quit
+EOF
+
+    local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/veto_files_nodelete -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=$(eval "$cmd")
+    ret=$?
+
+    # Check for smbclient error.
+    if [ $ret != 0 ] ; then
+        echo "Failed accessing share veto_files_nodelete - $ret"
+        echo "$out"
+        return 1
+    fi
+
+    # We should get NT_STATUS_DIRECTORY_NOT_EMPTY errors.
+    echo "$out" | grep NT_STATUS_DIRECTORY_NOT_EMPTY
+    ret=$?
+    if [ $ret -ne 0 ] ; then
+       echo "Should get NT_STATUS_DIRECTORY_NOT_EMPTY in share veto_files_nodelete"
+       echo "$out"
+       return 1
+    fi
+
+    return 0
+}
+
+
+testit "rmdir can delete directory containing dangling symlink" \
+   test_dangle_symlink_delete_veto_rmdir || failed=$(expr "$failed" + 1)
+
+rm -rf "$rmdir_path"
+
+testit "rmdir cannot delete directory delete_veto_files_no containing dangling symlink" \
+   test_dangle_symlink_veto_files_nodelete || failed=$(expr "$failed" + 1)
+
+rm -rf "$rmdir_path"
+exit "$failed"
diff --git a/source3/script/tests/test_veto_rmdir.sh b/source3/script/tests/test_veto_rmdir.sh
new file mode 100755
index 00000000000..d3df8f1bba0
--- /dev/null
+++ b/source3/script/tests/test_veto_rmdir.sh
@@ -0,0 +1,217 @@
+#!/bin/sh
+#
+# Check smbclient can (or cannot) delete a directory containing veto files.
+# BUG: https://bugzilla.samba.org/show_bug.cgi?id=14878
+#
+
+if [ $# -lt 6 ]; then
+cat <<EOF
+Usage: $0 SERVER SERVER_IP USERNAME PASSWORD SHAREPATH SMBCLIENT
+EOF
+exit 1;
+fi
+
+SERVER=${1}
+SERVER_IP=${2}
+USERNAME=${3}
+PASSWORD=${4}
+SHAREPATH=${5}
+SMBCLIENT=${6}
+shift 6
+SMBCLIENT="$VALGRIND ${SMBCLIENT}"
+ADDARGS="$@"
+
+incdir=$(dirname "$0")/../../../testprogs/blackbox
+. "$incdir"/subunit.sh
+
+failed=0
+
+rmdir_path="$SHAREPATH/dir"
+
+test_veto_nodelete_rmdir()
+{
+    local veto_path="$rmdir_path/veto_name1"
+    local msdfs_link_path="$rmdir_path/dfs_link"
+    local tmpfile=$PREFIX/smbclient.in.$$
+
+    # Create rmdir directory.
+    mkdir -p "$rmdir_path"
+    # Create veto file underneath.
+    touch "$veto_path"
+    # Create msdfs link underneath.
+    ln -s "msdfs:$SERVER_IP\\ro-tmp" "$msdfs_link_path"
+
+    cat > "$tmpfile" <<EOF
+cd dir
+ls
+quit
+EOF
+
+    local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/veto_files_nodelete -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=$(eval "$cmd")
+    ret=$?
+
+    # Check for smbclient error.
+    if [ $ret != 0 ] ; then
+        echo "Failed accessing share veto_files_nodelete - $ret"
+        echo "$out"
+        return 1
+    fi
+
+    # We should only see the dfs_link file.
+    echo "$out" | grep dfs_link
+    ret=$?
+    if [ $ret -ne 0 ] ; then
+       echo "Failed to see dfs_link in share veto_files_nodelete"
+       echo "$out"
+       return 1
+    fi
+
+    # Now remove the dfs_link file.
+    rm -rf "$msdfs_link_path"
+
+    # Try and remove the directory, should fail with NT_STATUS_DIRECTORY_NOT_EMPTY.
+    cat > "$tmpfile" <<EOF
+rd dir
+quit
+EOF
+
+    local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/veto_files_nodelete -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=$(eval "$cmd")
+    ret=$?
+
+    # Check for smbclient error.
+    if [ $ret != 0 ] ; then
+        echo "Failed accessing share veto_files_nodelete - $ret"
+        echo "$out"
+        return 1
+    fi
+
+    # We should get NT_STATUS_DIRECTORY_NOT_EMPTY.
+    echo "$out" | grep NT_STATUS_DIRECTORY_NOT_EMPTY
+    ret=$?
+    if [ $ret -ne 0 ] ; then
+       echo "Failed to get error NT_STATUS_DIRECTORY_NOT_EMPTY in share veto_files_nodelete"
+       echo "$out"
+       return 1
+    fi
+
+    # remove the veto file - directory should now be empty.
+    rm -rf "$veto_path"
+
+    # Try and remove the directory, should now succeed.
+    cat > "$tmpfile" <<EOF
+rd dir
+quit
+EOF
+
+    local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/veto_files_nodelete -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=$(eval "$cmd")
+    ret=$?
+
+    # Check for smbclient error.
+    if [ $ret != 0 ] ; then
+        echo "Failed accessing share veto_files_nodelete - $ret"
+        echo "$out"
+        return 1
+    fi
+
+    # We should get no NT_STATUS_ errors.
+    echo "$out" | grep NT_STATUS_
+    ret=$?
+    if [ $ret -eq 0 ] ; then
+       echo "Got error NT_STATUS_ in share veto_files_nodelete"
+       echo "$out"
+       return 1
+    fi
+
+    return 0
+}
+
+test_veto_delete_rmdir()
+{
+    local veto_path="$rmdir_path/veto_name1"
+    local msdfs_link_path="$rmdir_path/dfs_link"
+    local tmpfile=$PREFIX/smbclient.in.$$
+
+    # Create rmdir directory.
+    mkdir -p "$rmdir_path"
+    # Create veto file underneath.
+    touch "$veto_path"
+    # Create msdfs link underneath.
+    ln -s "msdfs:$SERVER_IP\\ro-tmp" "$msdfs_link_path"
+
+    cat > "$tmpfile" <<EOF
+cd dir
+ls
+quit
+EOF
+
+    local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/veto_files_delete -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=$(eval "$cmd")
+    ret=$?
+
+    # Check for smbclient error.
+    if [ $ret != 0 ] ; then
+        echo "Failed accessing share veto_files_delete - $ret"
+        echo "$out"
+        return 1
+    fi
+
+    # We should only see the dfs_link file.
+    echo "$out" | grep dfs_link
+    ret=$?
+    if [ $ret -ne 0 ] ; then
+       echo "Failed to see dfs_link in share veto_files_delete"
+       echo "$out"
+       return 1
+    fi
+
+    # Now remove the dfs_link file.
+    rm -rf "$msdfs_link_path"
+
+    # Try and remove the directory, should now succeed.
+    cat > "$tmpfile" <<EOF
+rd dir
+quit
+EOF
+
+    local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/veto_files_delete -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=$(eval "$cmd")
+    ret=$?
+
+    # Check for smbclient error.
+    if [ $ret != 0 ] ; then
+        echo "Failed accessing share veto_files_delete - $ret"
+        echo "$out"
+        return 1
+    fi
+
+    # We should get no NT_STATUS_ errors.
+    echo "$out" | grep NT_STATUS_
+    ret=$?
+    if [ $ret -eq 0 ] ; then
+       echo "Got error NT_STATUS_ in share veto_files_delete"
+       echo "$out"
+       return 1
+    fi
+
+    return 0
+}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list