[SCM] Samba Shared Repository - branch v4-6-test updated

Karolin Seeger kseeger at samba.org
Thu Nov 2 15:57:02 UTC 2017


The branch, v4-6-test has been updated
       via  003eefb Revert "s3: smbclient: Test we can rename with a name containing."
       via  5b414d9 s3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd()
       via  35b1523 s4:pyparam: Fix resource leaks on error
       via  0d04dba s3:passdb: Make sure the salt is fully initialized before passing
       via  733aa17 s3:secrets: Do not leak memory of pw and old_pw
       via  781e5a6 ctdb-tests: Process-exists unit tests should wait until PID is registered
       via  5038300 ctdb-tests: Wait for fake_ctdbd to start, fail if it doesn't
       via  2340354 ctdb-tests: Skip starting fake_ctdbd when current node is disconnected
       via  b1f422e ctdb-tests: Wait for ctdb_eventd to start, fail if it doesn't
       via  ec36025 ctdb-tests: Allow wait_until() to be used in unit tests
       via  08100fc s3: smbclient: Test we can rename with a name containing.
       via  f01aac9 s3: smbclient: Ensure we call client_clean_name() before all operations on remote pathnames.
       via  f36e99e s3: client: Add new utility function client_clean_name().
       via  992d7dc vfs_glusterfs: Fix exporting subdirs with shadow_copy2
       via  6ef07b5 vfs_fruit: Replace closedir() by SMB_VFS_CLOSEDIR
      from  c1d6a04 VERSION: Bump version up to 4.6.10...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-6-test


- Log -----------------------------------------------------------------
commit 003eefb35e1880d7ea7e0933b9c8ac11e1c802d9
Author: Karolin Seeger <kseeger at samba.org>
Date:   Thu Nov 2 13:00:14 2017 +0100

    Revert "s3: smbclient: Test we can rename with a name containing."
    
    This reverts commit 8c7d944f106ca54581f5757bb8fa9c85169a04f2.
    
    Autobuild-User(v4-6-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-6-test): Thu Nov  2 16:56:03 CET 2017 on sn-devel-144

commit 5b414d94fe7aa05d1fb3ca8ee35c346ca6797bae
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Oct 25 19:39:34 2017 +0200

    s3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd()
    
    Found by cppcheck.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13100
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    (cherry picked from commit 16389bed0773952ca563b7bf1fecc2a737587257)

commit 35b152315506ce8bd796a700915b4bea5c6603dc
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Oct 25 19:25:20 2017 +0200

    s4:pyparam: Fix resource leaks on error
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13101
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit e56626e864492831a3dbbca2d4fb8f3281547a90)

commit 0d04dba0a5e606e7405e1b0b2007cf66b28c1b8a
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Oct 25 19:50:57 2017 +0200

    s3:passdb: Make sure the salt is fully initialized before passing
    
    Otherwise the magic member is not initialized.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13101
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 5274beba4cf722a34403dc07bf287815a6df6281)

commit 733aa17679bb4673b27d9f9adfdc9399ccfa2850
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Oct 25 19:30:28 2017 +0200

    s3:secrets: Do not leak memory of pw and old_pw
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13101
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit d6a418c13f0a41851ecc0579765502e076a5cd3b)

commit 781e5a67171df60978c0f759bd20e64b171c71fa
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Oct 25 12:15:23 2017 +1100

    ctdb-tests: Process-exists unit tests should wait until PID is registered
    
    Otherwise the client registration can race with the check in the test.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13097
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Thu Oct 26 13:32:24 CEST 2017 on sn-devel-144
    
    (cherry picked from commit 0e8b781e0740310d251bf1fa7db7a467d4f7f9b5)

commit 5038300ab9ef60d641d3955ba8b5e3b8a5045aaa
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Oct 25 17:52:04 2017 +1100

    ctdb-tests: Wait for fake_ctdbd to start, fail if it doesn't
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13097
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 6fad42103c0c812d5b5f4b42854fd7fd68846487)

commit 2340354e260d65e38c2d719af4074507cc968305
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Oct 25 21:43:56 2017 +1100

    ctdb-tests: Skip starting fake_ctdbd when current node is disconnected
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13097
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 274fef9b843aa1726c9d331a876504bc0a96a322)

commit b1f422e4bf9d7966677c09d3629c9befbab6a544
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Oct 25 18:52:10 2017 +1100

    ctdb-tests: Wait for ctdb_eventd to start, fail if it doesn't
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13097
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit dcbaebc232b49e6a64228f1bb7ce7cfc5d2120e2)

commit ec36025fb5ec6ef1a0d809a516368464b3e8210b
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Oct 25 12:04:49 2017 +1100

    ctdb-tests: Allow wait_until() to be used in unit tests
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13097
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit d69899238bfe468cd3e915f6d66e279811301d66)

commit 08100fc63e70ede62993f2bc2b2d2d43a448ba9d
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Oct 23 15:40:04 2017 -0700

    s3: smbclient: Test we can rename with a name containing.
    
    Samba always allowed this anyway, but it's a good place
    to ensure we don't regress.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13093
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Oct 24 23:32:58 CEST 2017 on sn-devel-144
    
    (cherry picked from commit 7abe56ccfa4aba75c5e166a7bd0bb8141c3f258b)

commit f01aac93c47570dcbe4274c0cb02ebc78f0910d4
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 20 15:09:38 2017 -0700

    s3: smbclient: Ensure we call client_clean_name() before all operations on remote pathnames.
    
    This allows names containing .. components to be resolved on the client side
    before being sent to the server. Relative names work in SMB1 but not in SMB2.
    Fix both client.c and clitar.c
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13093
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit f81c34c296f87127c6d1e4dd6ea74aa75660885d)

commit f36e99e3e5bee7131998c228355498c3cf8f8fdb
Author: Jeremy Allison <jra at samba.org>
Date:   Sat Oct 21 00:08:08 2017 +0000

    s3: client: Add new utility function client_clean_name().
    
    Correctly canonicalizes a remote pathname removing '..'
    elements before sending to a remote server. '..' elements
    work in SMB1 pathnames, but not in SMB2.
    
    Not yet used.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13093
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit d4d9d1941bdac9993968c34cf928c645e4152fd3)

commit 992d7dc089c58a955a3dff18b5c2a383d4d09e6f
Author: Michael Adam <obnox at samba.org>
Date:   Fri Oct 20 14:55:10 2017 +0200

    vfs_glusterfs: Fix exporting subdirs with shadow_copy2
    
    Since the glusterfs vfs module does not operate on a
    locally mounted path, but on a "virtual" path starting
    at the volume root, some assumptions of the code about
    the vfs connect path fail. One example is the shadow_copy2
    module which tries to detect the mount point from the
    connectpath. In order to circumvent this problem, this
    patch forces the "shadow:mountpoint" option to "/", which
    skips the mount-point-detection code.
    
    This patch will only have an effect if both the glusterfs
    and the shadow_copy2 module are listed in vfs objects
    in the right order, i.e. first shadow_copy2, and then
    glusterfs.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13091
    
    Pair-Programmed-With: Anoop C S <anoopcs at redhat.com>
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Signed-off-by: Anoop C S <anoopcs at redhat.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 1249801ec73c55449068dd72efde81ce6235ec8e)

commit 6ef07b532a6fd5aa1f598dcc0767ef7228218b26
Author: Anoop C S <anoopcs at redhat.com>
Date:   Fri Oct 13 20:38:31 2017 +0530

    vfs_fruit: Replace closedir() by SMB_VFS_CLOSEDIR
    
    Pointer to directory 'dh' inside fruit_rmdir() is obtained using
    SMB_VFS_OPENDIR. But this handle is closed directly by invoking
    closedir() rather than SMB_VFS_CLOSEDIR. This will result in a
    smbd crash if this handle was not obtained from local file system.
    Therefore use SMB_VFS_CLOSEDIR corresponding to SMB_VFS_OPENDIR
    to correctly close the directory handle.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13086
    
    Signed-off-by: Anoop C S <anoopcs at redhat.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Mon Oct 16 19:56:55 CEST 2017 on sn-devel-144
    
    (cherry picked from commit 7917f9721c9f8efdf9e7b7c50a9e5147250e36fe)

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

Summary of changes:
 ctdb/tests/eventd/scripts/local.sh          |   7 +-
 ctdb/tests/scripts/common.sh                |  44 ++++++
 ctdb/tests/scripts/integration.bash         |  44 ------
 ctdb/tests/tool/ctdb.getcapabilities.003.sh |  13 +-
 ctdb/tests/tool/ctdb.lvs.008.sh             |  13 +-
 ctdb/tests/tool/ctdb.process-exists.001.sh  |   2 +
 ctdb/tests/tool/scripts/local.sh            |   6 +-
 source3/client/client.c                     | 222 ++++++++++++++++++++++++++--
 source3/client/client_proto.h               |   1 +
 source3/client/clitar.c                     |  31 ++++
 source3/modules/vfs_fruit.c                 |   2 +-
 source3/modules/vfs_glusterfs.c             |  13 +-
 source3/passdb/machine_account_secrets.c    |  18 ++-
 source4/param/pyparam.c                     |   6 +
 14 files changed, 348 insertions(+), 74 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/tests/eventd/scripts/local.sh b/ctdb/tests/eventd/scripts/local.sh
index 343205e..c8f7775 100644
--- a/ctdb/tests/eventd/scripts/local.sh
+++ b/ctdb/tests/eventd/scripts/local.sh
@@ -42,7 +42,7 @@ cleanup_eventd ()
 
 setup_eventd ()
 {
-	debug "Setting up eventd"
+	echo "Setting up eventd"
 
 	if [ -n "$1" ]; then
 		extra_args="-D $1"
@@ -53,9 +53,8 @@ setup_eventd ()
 		-e "$eventd_scriptdir" \
 		-l "file:" -d "DEBUG" $extra_args 2>&1 | tee "$eventd_logfile" &
 	# Wait till eventd is running
-	while [ ! -S "$eventd_socket" ] ; do
-		sleep 1
-	done
+	wait_until 10 test -S "$eventd_socket" || \
+		die "ctdb_eventd failed to start"
 
 	test_cleanup cleanup_eventd
 }
diff --git a/ctdb/tests/scripts/common.sh b/ctdb/tests/scripts/common.sh
index 287fb71..e20b6d0 100644
--- a/ctdb/tests/scripts/common.sh
+++ b/ctdb/tests/scripts/common.sh
@@ -43,3 +43,47 @@ die ()
 {
     echo "$1" >&2 ; exit ${2:-1}
 }
+
+# Wait until either timeout expires or command succeeds.  The command
+# will be tried once per second, unless timeout has format T/I, where
+# I is the recheck interval.
+wait_until ()
+{
+    local timeout="$1" ; shift # "$@" is the command...
+
+    local interval=1
+    case "$timeout" in
+	*/*)
+	    interval="${timeout#*/}"
+	    timeout="${timeout%/*}"
+    esac
+
+    local negate=false
+    if [ "$1" = "!" ] ; then
+	negate=true
+	shift
+    fi
+
+    echo -n "<${timeout}|"
+    local t=$timeout
+    while [ $t -gt 0 ] ; do
+	local rc=0
+	"$@" || rc=$?
+	if { ! $negate && [ $rc -eq 0 ] ; } || \
+	    { $negate && [ $rc -ne 0 ] ; } ; then
+	    echo "|$(($timeout - $t))|"
+	    echo "OK"
+	    return 0
+	fi
+	local i
+	for i in $(seq 1 $interval) ; do
+	    echo -n .
+	done
+	t=$(($t - $interval))
+	sleep $interval
+    done
+
+    echo "*TIMEOUT*"
+
+    return 1
+}
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index b2a3451..86dbbdc 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -259,50 +259,6 @@ delete_ip_from_all_nodes ()
 
 #######################################
 
-# Wait until either timeout expires or command succeeds.  The command
-# will be tried once per second, unless timeout has format T/I, where
-# I is the recheck interval.
-wait_until ()
-{
-    local timeout="$1" ; shift # "$@" is the command...
-
-    local interval=1
-    case "$timeout" in
-	*/*)
-	    interval="${timeout#*/}"
-	    timeout="${timeout%/*}"
-    esac
-
-    local negate=false
-    if [ "$1" = "!" ] ; then
-	negate=true
-	shift
-    fi
-
-    echo -n "<${timeout}|"
-    local t=$timeout
-    while [ $t -gt 0 ] ; do
-	local rc=0
-	"$@" || rc=$?
-	if { ! $negate && [ $rc -eq 0 ] ; } || \
-	    { $negate && [ $rc -ne 0 ] ; } ; then
-	    echo "|$(($timeout - $t))|"
-	    echo "OK"
-	    return 0
-	fi
-	local i
-	for i in $(seq 1 $interval) ; do
-	    echo -n .
-	done
-	t=$(($t - $interval))
-	sleep $interval
-    done
-
-    echo "*TIMEOUT*"
-
-    return 1
-}
-
 sleep_for ()
 {
     echo -n "=${1}|"
diff --git a/ctdb/tests/tool/ctdb.getcapabilities.003.sh b/ctdb/tests/tool/ctdb.getcapabilities.003.sh
index 91d38b8..74702d5 100755
--- a/ctdb/tests/tool/ctdb.getcapabilities.003.sh
+++ b/ctdb/tests/tool/ctdb.getcapabilities.003.sh
@@ -10,12 +10,13 @@ setup_nodes <<EOF
 192.168.20.43
 EOF
 
-setup_ctdbd <<EOF
-NODEMAP
-0       192.168.20.41   0x1     CURRENT RECMASTER
-1       192.168.20.42   0x0
-2       192.168.20.43   0x0
-EOF
+# Don't setup ctdbd - disconnected on current node
+#setup_ctdbd <<EOF
+#NODEMAP
+#0       192.168.20.41   0x1     CURRENT RECMASTER
+#1       192.168.20.42   0x0
+#2       192.168.20.43   0x0
+#EOF
 
 required_result 1 <<EOF
 connect() failed, errno=2
diff --git a/ctdb/tests/tool/ctdb.lvs.008.sh b/ctdb/tests/tool/ctdb.lvs.008.sh
index a0e24b1..6cdd702 100755
--- a/ctdb/tests/tool/ctdb.lvs.008.sh
+++ b/ctdb/tests/tool/ctdb.lvs.008.sh
@@ -13,12 +13,13 @@ EOF
 setup_lvs <<EOF
 EOF
 
-setup_ctdbd <<EOF
-NODEMAP
-0       192.168.20.41   0x1     CURRENT RECMASTER
-1       192.168.20.42   0x0
-2       192.168.20.43   0x0
-EOF
+# Don't setup ctdbd - disconnected on current node
+#setup_ctdbd <<EOF
+#NODEMAP
+#0       192.168.20.41   0x1     CURRENT RECMASTER
+#1       192.168.20.42   0x0
+#2       192.168.20.43   0x0
+#EOF
 
 #####
 
diff --git a/ctdb/tests/tool/ctdb.process-exists.001.sh b/ctdb/tests/tool/ctdb.process-exists.001.sh
index 2339344..1b6d213 100755
--- a/ctdb/tests/tool/ctdb.process-exists.001.sh
+++ b/ctdb/tests/tool/ctdb.process-exists.001.sh
@@ -14,6 +14,8 @@ EOF
 dummy_client -s $ctdbd_socket &
 pid=$!
 
+wait_until 10 $CTDB process-exists "$pid"
+
 ok "PID $pid exists"
 simple_test "$pid"
 
diff --git a/ctdb/tests/tool/scripts/local.sh b/ctdb/tests/tool/scripts/local.sh
index 2c9be2d..7cee84a 100644
--- a/ctdb/tests/tool/scripts/local.sh
+++ b/ctdb/tests/tool/scripts/local.sh
@@ -48,10 +48,14 @@ cleanup_ctdbd ()
 
 setup_ctdbd ()
 {
-	debug "Setting up fake ctdbd"
+	echo "Setting up fake ctdbd"
 
 	$VALGRIND fake_ctdbd -d "$FAKE_CTDBD_DEBUGLEVEL" \
 		  -s "$ctdbd_socket" -p "$ctdbd_pidfile"
+	# Wait till fake_ctdbd is running
+	wait_until 10 test -S "$ctdbd_socket" || \
+		die "fake_ctdbd failed to start"
+
 	test_cleanup cleanup_ctdbd
 }
 
diff --git a/source3/client/client.c b/source3/client/client.c
index f808c9c..bb2518a 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -349,6 +349,37 @@ static void normalize_name(char *newdir)
 }
 
 /****************************************************************************
+ Local name cleanup before sending to server. SMB1 allows relative pathnames,
+ but SMB2 does not, so we need to resolve them locally.
+****************************************************************************/
+
+char *client_clean_name(TALLOC_CTX *ctx, const char *name)
+{
+	char *newname = NULL;
+	if (name == NULL) {
+		return NULL;
+	}
+
+	/* First ensure any path separators are correct. */
+	newname = talloc_strdup(ctx, name);
+	if (newname == NULL) {
+		return NULL;
+	}
+	normalize_name(newname);
+
+	/* Now remove any relative (..) path components. */
+	if (cli->requested_posix_capabilities & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
+		newname = unix_clean_name(ctx, newname);
+	} else {
+		newname = clean_name(ctx, newname);
+	}
+	if (newname == NULL) {
+		return NULL;
+	}
+	return newname;
+}
+
+/****************************************************************************
  Change directory - inner section.
 ****************************************************************************/
 
@@ -400,9 +431,8 @@ static int do_cd(const char *new_dir)
 			goto out;
 		}
 	}
-	client_set_cur_dir(new_cd);
 
-	new_cd = clean_name(ctx, new_cd);
+	new_cd = client_clean_name(ctx, new_cd);
 	client_set_cur_dir(new_cd);
 
 	status = cli_resolve_path(ctx, "", auth_info, cli, new_cd,
@@ -446,7 +476,7 @@ static int do_cd(const char *new_dir)
 			client_set_cur_dir(saved_dir);
 			goto out;
 		}
-		targetpath = clean_name(ctx, targetpath);
+		targetpath = client_clean_name(ctx, targetpath);
 		if (!targetpath) {
 			client_set_cur_dir(saved_dir);
 			goto out;
@@ -955,6 +985,11 @@ static int cmd_dir(void)
 		return 1;
 	}
 
+	mask = client_clean_name(ctx, mask);
+	if (mask == NULL) {
+		return 1;
+	}
+
 	if (showacls) {
 		/* cwd is only used if showacls is on */
 		client_set_cwd(client_get_cur_dir());
@@ -1007,6 +1042,14 @@ static int cmd_du(void)
 	} else {
 		mask = talloc_strdup(ctx, "*");
 	}
+	if (!mask) {
+		return 1;
+	}
+
+	mask = client_clean_name(ctx, mask);
+	if (mask == NULL) {
+		return 1;
+	}
 
 	status = do_list(mask, attribute, do_du, recurse, true);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -1203,7 +1246,7 @@ static int cmd_get(void)
 	if (!rname) {
 		return 1;
 	}
-	rname = clean_name(ctx, rname);
+	rname = client_clean_name(ctx, rname);
 	if (!rname) {
 		return 1;
 	}
@@ -1269,6 +1312,10 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
 		if (!rname) {
 			return NT_STATUS_NO_MEMORY;
 		}
+		rname = client_clean_name(ctx, rname);
+		if (rname == NULL) {
+			return NT_STATUS_NO_MEMORY;
+		}
 		do_get(rname, finfo->name, false);
 		TALLOC_FREE(rname);
 		return NT_STATUS_OK;
@@ -1288,6 +1335,10 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
 	if (!new_cd) {
 		return NT_STATUS_NO_MEMORY;
 	}
+	new_cd = client_clean_name(ctx, new_cd);
+	if (new_cd == NULL) {
+		return NT_STATUS_NO_MEMORY;
+	}
 	client_set_cur_dir(new_cd);
 
 	string_replace(finfo->name,'\\','/');
@@ -1318,6 +1369,10 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
 		return NT_STATUS_NO_MEMORY;
 	}
 
+	mget_mask = client_clean_name(ctx, mget_mask);
+	if (mget_mask == NULL) {
+		return NT_STATUS_NO_MEMORY;
+	}
 	status = do_list(mget_mask,
 			 (FILE_ATTRIBUTE_SYSTEM
 			  | FILE_ATTRIBUTE_HIDDEN
@@ -1387,7 +1442,7 @@ static int cmd_more(void)
 	if (!rname) {
 		return 1;
 	}
-	rname = clean_name(ctx,rname);
+	rname = client_clean_name(ctx,rname);
 	if (!rname) {
 		return 1;
 	}
@@ -1445,6 +1500,10 @@ static int cmd_mget(void)
 		if (!mget_mask) {
 			return 1;
 		}
+		mget_mask = client_clean_name(ctx, mget_mask);
+		if (mget_mask == NULL) {
+			return 1;
+		}
 		status = do_list(mget_mask, attribute, do_mget, false, true);
 		if (!NT_STATUS_IS_OK(status)) {
 			return 1;
@@ -1463,6 +1522,10 @@ static int cmd_mget(void)
 		if (!mget_mask) {
 			return 1;
 		}
+		mget_mask = client_clean_name(ctx, mget_mask);
+		if (mget_mask == NULL) {
+			return 1;
+		}
 		status = do_list(mget_mask, attribute, do_mget, false, true);
 		if (!NT_STATUS_IS_OK(status)) {
 			return 1;
@@ -1558,6 +1621,10 @@ static int cmd_mkdir(void)
 	if (!mask) {
 		return 1;
 	}
+	mask = client_clean_name(ctx, mask);
+	if (mask == NULL) {
+		return 1;
+	}
 
 	if (recurse) {
 		char *ddir = NULL;
@@ -1628,6 +1695,10 @@ static int cmd_altname(void)
 	if (!name) {
 		return 1;
 	}
+	name = client_clean_name(ctx, name);
+	if (name == NULL) {
+		return 1;
+	}
 	do_altname(name);
 	return 0;
 }
@@ -1858,7 +1929,10 @@ static int cmd_allinfo(void)
 	if (!name) {
 		return 1;
 	}
-
+	name = client_clean_name(ctx, name);
+	if (name == NULL) {
+		return 1;
+	}
 	do_allinfo(name);
 
 	return 0;
@@ -2020,7 +2094,7 @@ static int cmd_put(void)
 		return 1;
 	}
 
-	rname = clean_name(ctx, rname);
+	rname = client_clean_name(ctx, rname);
 	if (!rname) {
 		return 1;
 	}
@@ -2222,6 +2296,19 @@ static int cmd_mput(void)
 						break;
 					}
 					normalize_name(rname);
+					{
+						char *tmp_rname =
+							client_clean_name(ctx, rname);
+						if (tmp_rname == NULL) {
+							break;
+						}
+						SAFE_FREE(rname);
+						rname = smb_xstrdup(tmp_rname);
+						TALLOC_FREE(tmp_rname);
+						if (rname == NULL) {
+							break;
+						}
+					}
 					if (!NT_STATUS_IS_OK(cli_chkpath(cli, rname)) &&
 					    !do_mkdir(rname)) {
 						DEBUG (0, ("Unable to make dir, skipping..."));
@@ -2252,6 +2339,18 @@ static int cmd_mput(void)
 
 			normalize_name(rname);
 
+			{
+				char *tmp_rname = client_clean_name(ctx, rname);
+				if (tmp_rname == NULL) {
+					break;
+				}
+				SAFE_FREE(rname);
+				rname = smb_xstrdup(tmp_rname);
+				TALLOC_FREE(tmp_rname);
+				if (rname == NULL) {
+					break;
+				}
+			}
 			do_put(rname, lname, false);
 		}
 		free_file_list(file_list);
@@ -2422,6 +2521,10 @@ static int cmd_del(void)
 	if (!mask) {
 		return 1;
 	}
+	mask = client_clean_name(ctx, mask);
+	if (mask == NULL) {
+		return 1;
+	}
 
 	status = do_list(mask,attribute,do_del,false,false);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -2462,6 +2565,10 @@ static int cmd_wdel(void)
 	if (!mask) {
 		return 1;
 	}
+	mask = client_clean_name(ctx, mask);
+	if (mask == NULL) {
+		return 1;
+	}
 
 	status = cli_resolve_path(ctx, "", auth_info, cli, mask, &targetcli,
 				  &targetname);
@@ -2502,6 +2609,10 @@ static int cmd_open(void)
 	if (!mask) {
 		return 1;
 	}
+	mask = client_clean_name(ctx, mask);
+	if (mask == NULL) {
+		return 1;
+	}
 
 	status = cli_resolve_path(ctx, "", auth_info, cli, mask, &targetcli,
 				  &targetname);
@@ -2617,6 +2728,10 @@ static int cmd_posix_open(void)
 	if (!mask) {
 		return 1;
 	}
+	mask = client_clean_name(ctx, mask);
+	if (mask == NULL) {
+		return 1;
+	}
 
 	if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list