The branch, v4-7-test has been updated via 3c45cc8 s4:pyparam: Fix resource leaks on error via 81047d0 s3:modules: Check correct variable for NULL in posixacl_xattr via bdbbc80 s3:passdb: Make sure the salt is fully initialized before passing via e4a4a43 s3:secrets: Do not leak memory of pw and old_pw via bd6e153 s3:vfs_glusterfs: Fix a double free in vfs_gluster_getwd() via 8bb2f28 s4:scripting: Fix ntstatus_gen.h generation on 32bit via 8875241 ctdb-tests: Process-exists unit tests should wait until PID is registered via 020afdc ctdb-tests: Wait for fake_ctdbd to start, fail if it doesn't via 418c5c5 ctdb-tests: Skip starting fake_ctdbd when current node is disconnected via 4dc2604 ctdb-tests: Wait for ctdb_eventd to start, fail if it doesn't via a3b2963 ctdb-tests: Allow wait_until() to be used in unit tests via ab7d073 replmd: check for duplicate values in MOD_REPLACE case via 1167d46 linked attribute tests: test against duplicates in replace via 3379b70 s3: smbclient: Test we can rename with a name containing. via 5e86ee4 s3: smbclient: Ensure we call client_clean_name() before all operations on remote pathnames. via f3f306c s3: client: Add new utility function client_clean_name(). via 5e1abab vfs_glusterfs: Fix exporting subdirs with shadow_copy2 via 9a5761b replace: Link to -lbsd when building replace.c by hand via 62e9e06 vfs_fruit: Replace closedir() by SMB_VFS_CLOSEDIR via 7963780 selftest: Also run smbtorture smb2.compound with aio enabled via d9723a2 torture: Add testcase for compound CREATE-WRITE-CLOSE request via f66d6cc smbd/aio: Do not go async for SMB2 compound requests via c1dbeb2 smbd: Move check for SMB2 compound request to new function from eec0b43 vfs_catia: Fix a potential memleak
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-7-test - Log ----------------------------------------------------------------- commit 3c45cc8a3abe2fcd7986a9db93bd83773640c864 Author: Andreas Schneider <a...@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 <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit e56626e864492831a3dbbca2d4fb8f3281547a90) Autobuild-User(v4-7-test): Karolin Seeger <ksee...@samba.org> Autobuild-Date(v4-7-test): Wed Nov 1 14:59:46 CET 2017 on sn-devel-144 commit 81047d00c909caec4211b60c8dd3a4c2e1118f49 Author: Andreas Schneider <a...@samba.org> Date: Wed Oct 25 19:55:32 2017 +0200 s3:modules: Check correct variable for NULL in posixacl_xattr BUG: https://bugzilla.samba.org/show_bug.cgi?id=13101 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Fri Oct 27 04:54:22 CEST 2017 on sn-devel-144 (cherry picked from commit 327190893f5f3352a2e6abc4872b54092ee7de68) commit bdbbc80a2c54724f4b31a7a1e0d95d04fa42e88c Author: Andreas Schneider <a...@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 <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit 5274beba4cf722a34403dc07bf287815a6df6281) commit e4a4a4368200ad720859c5cd33eb173a33d5c078 Author: Andreas Schneider <a...@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 <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit d6a418c13f0a41851ecc0579765502e076a5cd3b) commit bd6e153f34efe86d2b5f63459254b65f7c863c3d Author: Andreas Schneider <a...@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 <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit 16389bed0773952ca563b7bf1fecc2a737587257) commit 8bb2f283dfb60189a0e0a44e572f463f76a56f6d Author: Andreas Schneider <a...@samba.org> Date: Wed Oct 25 17:37:24 2017 +0200 s4:scripting: Fix ntstatus_gen.h generation on 32bit The hex() function results in different output on 32bit systems. It adds a L for long for some numbers. Thus we have a different header file. This patch makes sure we have a consistent file generation on different paltforms. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13099 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> Autobuild-User(master): David Disseldorp <dd...@samba.org> Autobuild-Date(master): Wed Oct 25 22:28:39 CEST 2017 on sn-devel-144 (cherry picked from commit 2d260b28f50ea6ee704d9fab2aaf26f760fa110f) commit 88752411daf64af59bd00c60c36ca1ced3c044f0 Author: Martin Schwenke <mar...@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 <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> Autobuild-User(master): Amitay Isaacs <ami...@samba.org> Autobuild-Date(master): Thu Oct 26 13:32:24 CEST 2017 on sn-devel-144 (cherry picked from commit 0e8b781e0740310d251bf1fa7db7a467d4f7f9b5) commit 020afdc685faf27941c4ba14fe532220db635acc Author: Martin Schwenke <mar...@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 <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> (cherry picked from commit 6fad42103c0c812d5b5f4b42854fd7fd68846487) commit 418c5c5cecd5b793d6213689350378c8c11dfcab Author: Martin Schwenke <mar...@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 <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> (cherry picked from commit 274fef9b843aa1726c9d331a876504bc0a96a322) commit 4dc2604ac88122eb57a98ae3e4424b580d097361 Author: Martin Schwenke <mar...@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 <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> (cherry picked from commit dcbaebc232b49e6a64228f1bb7ce7cfc5d2120e2) commit a3b29638644406cd2973ef2a45199a372ef95dfe Author: Martin Schwenke <mar...@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 <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> (cherry picked from commit d69899238bfe468cd3e915f6d66e279811301d66) commit ab7d073256a788ba35e0c2c0ceeb42d6c84897de Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Wed Oct 25 10:12:09 2017 +1300 replmd: check for duplicate values in MOD_REPLACE case Because we already have a sorted parsed_dn list, this is a simple linear scan. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13095 Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> (cherry picked from commit 625e65d9f354059d0b44ca7df329d862d93378c4) commit 1167d461d540422b6defff65dcd64f52e139398c Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Wed Oct 25 10:54:42 2017 +1300 linked attribute tests: test against duplicates in replace We should not be able to introduce duplicate links using MOD_REPLACE. It turns out we could and weren't testing. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13095 Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> (cherry picked from commit 046fc1f7de685afcbb7f0b92f0280ff0109ed4b7) commit 3379b707823df075bdac74c541906afe104a2443 Author: Jeremy Allison <j...@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 <j...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Tue Oct 24 23:32:58 CEST 2017 on sn-devel-144 (cherry picked from commit 7abe56ccfa4aba75c5e166a7bd0bb8141c3f258b) commit 5e86ee4607221921cc525817d5e0660111ce2e8d Author: Jeremy Allison <j...@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 <j...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> (cherry picked from commit f81c34c296f87127c6d1e4dd6ea74aa75660885d) commit f3f306c672eaeccb0d3b61b5c5f1f34fd7c542c8 Author: Jeremy Allison <j...@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 <j...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> (cherry picked from commit d4d9d1941bdac9993968c34cf928c645e4152fd3) commit 5e1abab6af20f71334018164ba21307c439bbef2 Author: Michael Adam <ob...@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 <anoo...@redhat.com> Signed-off-by: Michael Adam <ob...@samba.org> Signed-off-by: Anoop C S <anoo...@redhat.com> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit 1249801ec73c55449068dd72efde81ce6235ec8e) commit 9a5761ba01d314adba5e6e745e74496d70dffeac Author: Andrew Bartlett <abart...@samba.org> Date: Sat Oct 14 22:38:18 2017 +1300 replace: Link to -lbsd when building replace.c by hand This ensures that we correctly detect HAVE_IFACE_GETIFADDRS et al, which are based on a "build the source" style test. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13087 Signed-off-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> (cherry picked from commit 593dacd274a22583cac4e091a08bf2ded0ae9703) commit 62e9e06877e748e89aef2739a32140d11473f542 Author: Anoop C S <anoo...@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 <anoo...@redhat.com> Reviewed-by: Ralph Boehme <s...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> Autobuild-User(master): Günther Deschner <g...@samba.org> Autobuild-Date(master): Mon Oct 16 19:56:55 CEST 2017 on sn-devel-144 (cherry picked from commit 7917f9721c9f8efdf9e7b7c50a9e5147250e36fe) commit 79637804198bcaee85c7ba46258833356a905705 Author: Christof Schmitt <c...@samba.org> Date: Wed Sep 20 16:13:38 2017 -0700 selftest: Also run smbtorture smb2.compound with aio enabled BUG: https://bugzilla.samba.org/show_bug.cgi?id=13047 Signed-off-by: Christof Schmitt <c...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Fri Sep 22 09:49:30 CEST 2017 on sn-devel-144 (cherry picked from commit 3a360f552d6641952931d3aa8a9ce85a648de3e1) commit d9723a2c3f5f8ee6be3cf0f9d476a15db629c91a Author: Christof Schmitt <c...@samba.org> Date: Wed Sep 20 16:07:50 2017 -0700 torture: Add testcase for compound CREATE-WRITE-CLOSE request BUG: https://bugzilla.samba.org/show_bug.cgi?id=13047 Signed-off-by: Christof Schmitt <c...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit 508aebf40abe83b6319700260c405ada0566a46b) commit f66d6cca42dd334dcdb71bbb3b50179c419f5f4e Author: Christof Schmitt <c...@samba.org> Date: Thu Sep 21 12:08:01 2017 -0700 smbd/aio: Do not go async for SMB2 compound requests BUG: https://bugzilla.samba.org/show_bug.cgi?id=13047 Signed-off-by: Christof Schmitt <c...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit a2b081e159403e10295a1bc089b48e816ce698b9) commit c1dbeb2f702137c734e30e30c0beda19bcdc4543 Author: Christof Schmitt <c...@samba.org> Date: Thu Sep 21 17:41:25 2017 -0700 smbd: Move check for SMB2 compound request to new function BUG: https://bugzilla.samba.org/show_bug.cgi?id=13047 Signed-off-by: Christof Schmitt <c...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit cfa2c3083080016a1288474b8879039db4dbf6b1) ----------------------------------------------------------------------- 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/ctdb.process-exists.002.sh | 2 + ctdb/tests/tool/ctdb.process-exists.003.sh | 2 + ctdb/tests/tool/scripts/local.sh | 6 +- lib/replace/wscript | 12 +- selftest/knownfail | 1 + source3/client/client.c | 230 +++++++++++++++++++++++- source3/client/client_proto.h | 1 + source3/client/clitar.c | 31 ++++ source3/modules/posixacl_xattr.c | 2 +- source3/modules/vfs_fruit.c | 2 +- source3/modules/vfs_glusterfs.c | 13 +- source3/passdb/machine_account_secrets.c | 18 +- source3/script/tests/test_smbclient_s3.sh | 48 +++++ source3/selftest/tests.py | 4 + source3/smbd/aio.c | 8 + source3/smbd/globals.h | 1 + source3/smbd/smb2_read.c | 2 +- source3/smbd/smb2_server.c | 5 + source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 37 ++++ source4/dsdb/tests/python/linked_attributes.py | 10 ++ source4/param/pyparam.c | 6 + source4/scripting/bin/gen_ntstatus.py | 2 +- source4/torture/smb2/compound.c | 73 ++++++++ 29 files changed, 560 insertions(+), 79 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 4f1227f..d72c471 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/ctdb.process-exists.002.sh b/ctdb/tests/tool/ctdb.process-exists.002.sh index fe3dfd4..ace7749 100755 --- a/ctdb/tests/tool/ctdb.process-exists.002.sh +++ b/ctdb/tests/tool/ctdb.process-exists.002.sh @@ -16,6 +16,8 @@ srvid="0xaebbccdd12345678" dummy_client -d INFO -s "$ctdbd_socket" -S "$srvid" & pid=$! +wait_until 10 $CTDB process-exists "$pid" + srvid2="0x1234567812345678" required_result 1 "PID $pid with SRVID $srvid2 does not exist" simple_test "$pid" "$srvid2" diff --git a/ctdb/tests/tool/ctdb.process-exists.003.sh b/ctdb/tests/tool/ctdb.process-exists.003.sh index bb1ef9a..29c42a1 100755 --- a/ctdb/tests/tool/ctdb.process-exists.003.sh +++ b/ctdb/tests/tool/ctdb.process-exists.003.sh @@ -16,6 +16,8 @@ srvid="0xaebbccdd12345678" dummy_client -d INFO -s "$ctdbd_socket" -n 10 -S "$srvid" & pid=$! +wait_until 10 $CTDB process-exists "$pid" + srvid2="0x1234567812345678" required_result 1 "PID $pid with SRVID $srvid2 does not exist" simple_test "$pid" "$srvid2" 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/lib/replace/wscript b/lib/replace/wscript index 7c50e1d..7357eea 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -251,10 +251,13 @@ def configure(conf): conf.CHECK_FUNCS('prctl dirname basename') + strlcpy_in_bsd = False + # libbsd on some platforms provides strlcpy and strlcat if not conf.CHECK_FUNCS('strlcpy strlcat'): - conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', - checklibc=True) + if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', + checklibc=True): + strlcpy_in_bsd = True if not conf.CHECK_FUNCS('getpeereid'): conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): @@ -611,6 +614,9 @@ removeea setea # look for a method of finding the list of network interfaces for method in ['HAVE_IFACE_GETIFADDRS', 'HAVE_IFACE_AIX', 'HAVE_IFACE_IFCONF', 'HAVE_IFACE_IFREQ']: + bsd_for_strlcpy = '' + if strlcpy_in_bsd: + bsd_for_strlcpy = ' bsd' if conf.CHECK_CODE(''' #define %s 1 #define NO_CONFIG_H 1 @@ -623,7 +629,7 @@ removeea setea #include "test/getifaddrs.c" ''' % method, method, - lib='nsl socket', + lib='nsl socket' + bsd_for_strlcpy, addmain=False, execute=True): break diff --git a/selftest/knownfail b/selftest/knownfail index f41b99d..dfa055f 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -171,6 +171,7 @@ ^samba3.smb2.setinfo.setinfo ^samba3.smb2.session.*reauth5 # some special anonymous checks? ^samba3.smb2.compound.interim2 # wrong return code (STATUS_CANCELLED) +^samba3.smb2.compound.aio.interim2 # wrong return code (STATUS_CANCELLED) ^samba3.smb2.replay.channel-sequence ^samba3.smb2.replay.replay3 ^samba3.smb2.replay.replay4 diff --git a/source3/client/client.c b/source3/client/client.c index 5ef9ad5..b4a6c7d 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -346,6 +346,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. ****************************************************************************/ @@ -399,7 +430,7 @@ static int do_cd(const char *new_dir) } 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, "", popt_get_cmdline_auth_info(), @@ -443,7 +474,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; @@ -953,6 +984,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()); @@ -1005,6 +1041,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)) { @@ -1201,7 +1245,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; } @@ -1267,6 +1311,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; @@ -1286,6 +1334,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,'\\','/'); @@ -1316,6 +1368,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 @@ -1385,7 +1441,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; } @@ -1443,6 +1499,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; @@ -1461,6 +1521,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; @@ -1557,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 +1696,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 +1930,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; @@ -2021,7 +2096,7 @@ static int cmd_put(void) return 1; } - rname = clean_name(ctx, rname); + rname = client_clean_name(ctx, rname); if (!rname) { return 1; } @@ -2230,6 +2305,19 @@ static int cmd_mput(void) break; } normalize_name(rname); + { + char *tmp_rname = + client_clean_name(ctx, rname); -- Samba Shared Repository