Discussion:
[SCM] Samba Shared Repository - branch v4-8-test updated
Karolin Seeger
2018-04-06 11:51:02 UTC
Permalink
The branch, v4-8-test has been updated
via 8e149c8 s4: torture: Test all combinations of directory open with existing directory to ensure behavior is the same.
via 1f94e36 s4: torture: Test all combinations of directory create to ensure behavior is the same.
via 29aa75e s4: torture: Test all combinations of file open with existing file to ensure behavior is the same.
via d3ac788 s4: torture: Test all combinations of file create to ensure behavior is the same.
via 2f41822 s4: torture: Ensure a failed file create doesn't create the file.
via 03876304 s3: smbd: Files or directories can't be opened DELETE_ON_CLOSE without delete access.
via 879fccb ctdb-client: Client code should never free the client context
via a630cb9 ctdb-client: Add missing initialization of tevent_context
via aeed66e ctdb-client: Do not try to allocate 0 sized record
via 25edad4 Fix invocation of gnutls_aead_cipher_encrypt()
via 8a77ae0 Allow AESNI to be used on all processor supporting AESNI, not just Intel's This improves performance/reduced CPU usage. Tests performed: - Ran on Ivy Bridge and Ryzen and verified that AESNI is detected (crypto tests) - Ran on Ryzen, and observed 50% increased speed.
via 58befdd s3: docs: Add documentation for "smb2" and "smb2_credits" debug classes.
via b5bc2f5 s3: smbd: SMB2: Add DBGC_SMB2_CREDITS class to specifically debug credit issues.
via e9f5476 lib: debug: Add DBGC_XXX versions of the macros to allow class-specific messages.
via 49a9c98 s3: debug: smb2: Create a new DBGC_SMB2 debug class and mark all smbd/smb2_*.c files with it.
via 43cbf7f lib:replace: Fix linking when libtirpc-devel overwrites system headers
via ccda6d9 s3:smbd: map nterror on smb2_flush errorpath
via f66a35b ctdb-tests: Don't use nc -d or -w options
via 65ca557 s3: smbd: Fruit. Make the use of dom_sid_compare_domain() much clearer.
via 47b1ec0 s4: vfs: fruit tests: Add regression test for dealing with NFS ACE entries.
via c45da7e selftest: vfs.fruit: add xattr_tdb where possible
via 1f93e4d selftest: run vfs.fruit_netatalk test against seperate share
via 134c412 s3: smbd: vfs_fruit: Replace code in fruit_fget_nt_acl() with remove_virtual_nfs_aces().
via 9c80cb6 s3: smbd: vfs_fruit: Replace code in check_ms_nfs() with remove_virtual_nfs_aces().
via 2fc537b s3: smbd: vfs_fruit: Add remove_virtual_nfs_aces() a generic NFS ACE remover.
via 0aed473 s3: vfs_fruit. Change check_ms_nfs() to remove the virtual ACE's generated by fruit_fget_nt_acl().
via 8ea9d13 s3: vfs_fruit. If the security descriptor was modified, ensure we set the flags correctly to reflect the ACE's left.
via 9fab1dd s3: vfs_fruit: Ensure we operate on a copy of the incoming security descriptor.
via f1c0db3 s3: vfs_fruit. Ensure we only return one set of the 'virtual' UNIX ACE entries.
via 6785550 s3: smbd: Fix possible directory fd leak if the underlying OS doesn't support fdopendir()
via a02a98a s3: ldap: Ensure the ADS_STRUCT pointer doesn't get freed on error, we don't own it here.
from cbbb6ef s3:auth: make use of make_{server,session}_info_anonymous()

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


- Log -----------------------------------------------------------------
commit 8e149c84f07870b8131521a6fa13af60d0772861
Author: Jeremy Allison <***@samba.org>
Date: Wed Mar 28 13:19:12 2018 -0700

s4: torture: Test all combinations of directory open with existing directory to ensure behavior is the same.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Volker Lendecke <***@SerNet.DE>

Autobuild-User(master): Jeremy Allison <***@samba.org>
Autobuild-Date(master): Thu Mar 29 23:13:42 CEST 2018 on sn-devel-144

(cherry picked from commit c98cd0f25edaae7558f18fd331e2fef3aabb61f2)

Autobuild-User(v4-8-test): Karolin Seeger <***@samba.org>
Autobuild-Date(v4-8-test): Fri Apr 6 13:50:18 CEST 2018 on sn-devel-144

commit 1f94e367aacf2d61ee47d79b30396b14c8013113
Author: Jeremy Allison <***@samba.org>
Date: Wed Mar 28 13:17:14 2018 -0700

s4: torture: Test all combinations of directory create to ensure behavior is the same.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Volker Lendecke <***@SerNet.DE>
(cherry picked from commit fd9084336e7e86ccec83141d880fd7c336c23b6c)

commit 29aa75e66196fd16da9240798d5eaa07f364f232
Author: Jeremy Allison <***@samba.org>
Date: Wed Mar 28 11:44:40 2018 -0700

s4: torture: Test all combinations of file open with existing file to ensure behavior is the same.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Volker Lendecke <***@SerNet.DE>
(cherry picked from commit 820b35bb1ceb445eb3659b67eedfb0a2f5b2f976)

commit d3ac788221e5532c11a557cf8754917f8007040e
Author: Jeremy Allison <***@samba.org>
Date: Wed Mar 28 11:00:59 2018 -0700

s4: torture: Test all combinations of file create to ensure behavior is the same.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Volker Lendecke <***@SerNet.DE>
(cherry picked from commit 22fe8dcb77565495886244e88bb0433363d1f80a)

commit 2f418222ad1a6adf6252b265e1f53fd0a29cf473
Author: Jeremy Allison <***@samba.org>
Date: Wed Mar 28 10:54:30 2018 -0700

s4: torture: Ensure a failed file create doesn't create the file.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Volker Lendecke <***@SerNet.DE>
(cherry picked from commit 53cdf7a9a18ed547eade4c3cdd80d286058e440d)

commit 03876304a1f550330c622fee1e1f2e3e74d61f10
Author: Jeremy Allison <***@samba.org>
Date: Wed Mar 28 12:42:20 2018 -0700

s3: smbd: Files or directories can't be opened DELETE_ON_CLOSE without delete access.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Volker Lendecke <***@SerNet.DE>
(cherry picked from commit 2514bee0a3b0a12430e2679ee590075c54d4803a)

commit 879fccbb8acabbc396088babe469034424012541
Author: Amitay Isaacs <***@gmail.com>
Date: Thu Mar 8 11:35:55 2018 +1100

ctdb-client: Client code should never free the client context

This should never have been done.

Signed-off-by: Amitay Isaacs <***@gmail.com>
Reviewed-by: Martin Schwenke <***@meltin.net>
(cherry picked from commit 376e9794e2d19e8d17b0bdde36ce8a1a205986c6)

commit a630cb9a37b5ed423c5c23c021bc4bcbf28c5fc0
Author: Amitay Isaacs <***@gmail.com>
Date: Mon Mar 19 13:58:43 2018 +1100

ctdb-client: Add missing initialization of tevent_context

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13356

Signed-off-by: Amitay Isaacs <***@gmail.com>
Reviewed-by: Martin Schwenke <***@meltin.net>
(cherry picked from commit 4e37be92bfb790150b3791bef552aa4acf8f78b7)

commit aeed66ece0220d40fe33e66f726c4638e7c02393
Author: Amitay Isaacs <***@gmail.com>
Date: Mon Mar 19 13:38:28 2018 +1100

ctdb-client: Do not try to allocate 0 sized record

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13356

Signed-off-by: Amitay Isaacs <***@gmail.com>
Reviewed-by: Martin Schwenke <***@meltin.net>
(cherry picked from commit 92a68af1a8473dc2a5d9d6036830f944e968606d)

commit 25edad412a3d503114a805b434a729d5d2786b3f
Author: Timur I. Bakeyev <***@iXsystems.com>
Date: Thu Mar 22 05:47:58 2018 +0100

Fix invocation of gnutls_aead_cipher_encrypt()

Which was failing with GNUTLS_E_SHORT_MEMORY_BUFFER - The given memory
buffer is too short to hold parameters.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13352

Signed-off-by: Timur I. Bakeyev <***@iXsystems.com>
Reviewed-by: Garming Sam <***@catalyst.net.nz>
Reviewed-by: Gary Lockyer <***@catalyst.net.nz>

Autobuild-User(master): Garming Sam <***@samba.org>
Autobuild-Date(master): Fri Mar 23 07:25:30 CET 2018 on sn-devel-144

(cherry picked from commit b9f0c7f93c058685e24d104432978bd40b94b49f)

commit 8a77ae09ee1522d01746a4cb7fd5661b980b86d7
Author: Eric Vannier <***@google.com>
Date: Thu Mar 22 21:32:56 2018 -0700

Allow AESNI to be used on all processor supporting AESNI, not just Intel's This improves performance/reduced CPU usage. Tests performed: - Ran on Ivy Bridge and Ryzen and verified that AESNI is detected (crypto tests) - Ran on Ryzen, and observed 50% increased speed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13302

Signed-off-by: Eric Vannier <***@google.com>
Reviewed-by: Jeremy Allison <***@samba.org>
Reviewed-by: Björn Jacke <***@samba.org>

Autobuild-User(master): Jeremy Allison <***@samba.org>
Autobuild-Date(master): Tue Mar 27 13:50:09 CEST 2018 on sn-devel-144

(cherry picked from commit 77d88d75f6262a855e818a9b2b4018f8b6ced7b0)

commit 58befddfce55fd1ade66d206dbdc3274dd2a790e
Author: Jeremy Allison <***@samba.org>
Date: Wed Mar 21 12:56:12 2018 -0700

s3: docs: Add documentation for "smb2" and "smb2_credits" debug classes.

https://bugzilla.samba.org/show_bug.cgi?id=13347

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Böhme <***@samba.org>
(cherry picked from commit fc922bd29b40a20450f16728fa7347f8f83d3bcd)

commit b5bc2f593d364bf173c13ef0cca9663db6019b69
Author: Jeremy Allison <***@samba.org>
Date: Wed Mar 21 12:52:49 2018 -0700

s3: smbd: SMB2: Add DBGC_SMB2_CREDITS class to specifically debug credit issues.

https://bugzilla.samba.org/show_bug.cgi?id=13347

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Böhme <***@samba.org>
(cherry picked from commit ad973fddef00d6d92443be89e7f5404006a94d99)

commit e9f54762fa607ad321016df2284c918547a40264
Author: Jeremy Allison <***@samba.org>
Date: Wed Mar 21 12:40:50 2018 -0700

lib: debug: Add DBGC_XXX versions of the macros to allow class-specific messages.

https://bugzilla.samba.org/show_bug.cgi?id=13347

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Böhme <***@samba.org>
(cherry picked from commit cdde6d93605d15a59e816a35e8e02ca193bf1403)

commit 49a9c984974fe8c31aada72224cda434358c38f7
Author: Jeremy Allison <***@samba.org>
Date: Wed Mar 21 12:01:05 2018 -0700

s3: debug: smb2: Create a new DBGC_SMB2 debug class and mark all smbd/smb2_*.c files with it.

Will allow easier smb2-specific debugging.

https://bugzilla.samba.org/show_bug.cgi?id=13347

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Böhme <***@samba.org>
(cherry picked from commit 8dabcf8948c2e514b489169c34673e093519b583)

commit 43cbf7f7728414a6e0d0feb76d4e3a4729df55de
Author: Noel Power <***@suse.com>
Date: Thu Mar 15 16:46:39 2018 +0000

lib:replace: Fix linking when libtirpc-devel overwrites system headers

Some systems (like SUSE currently) install the new tirpc headers by
overwritting the existing system location used by gcc. This patch will
detect if the headers in the system location belong to tirpc or not.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13341

Signed-off-by: Noel Power <***@suse.com>
Reviewed-by: Andreas Schneider <***@samba.org>
Reviewed-by: Alexander Bokovoy <***@samba.org>
(cherry picked from commit 618c714b6b6c0b63993299b40b9a466adb753cc2)

commit ccda6d9b8c893d6432ac92c5c542cbde6039ad74
Author: Anton Nefedov via samba-technical <samba-***@lists.samba.org>
Date: Thu Mar 15 14:38:41 2018 +0300

s3:smbd: map nterror on smb2_flush errorpath

smbd_smb2_flush_recv() expects nterror in tevent_req, and otherwise
aborts in tevent_req_is_nterror()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13338

Signed-off-by: Anton Nefedov <***@virtuozzo.com>
Reviewed-by: Volker Lendecke <***@samba.org>
Reviewed-by: Jeremy Allison <***@samba.org>
(cherry picked from commit 98623129446672521b7fa41d3457b8ce95db828c)

commit f66a35b8beb8101a0064dfd58e494ec2f2fa40fd
Author: Martin Schwenke <***@meltin.net>
Date: Thu Mar 8 11:49:56 2018 +1100

ctdb-tests: Don't use nc -d or -w options

nmap-ncat is used in some distributions to replace netcat. It has a
different meaning for these options.

We can get the same effect as the current combination of -d and -w by
piping a sleep process to nc. Subsequent use of $! works because it
gets the last process in pipeline.

Note that redirecting from /dev/null doesn't work with some versions
of nc. They just exit when they get EOF.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13327

Signed-off-by: Martin Schwenke <***@meltin.net>
Reviewed-by: Amitay Isaacs <***@gmail.com>

(cherry picked from commit 9e954bcbf43d67a18ee55f84cda0b09028f96b92)

commit 65ca5574b769d8b211b4c9550b62f8af126346e9
Author: Jeremy Allison <***@samba.org>
Date: Mon Mar 19 15:46:41 2018 -0700

s3: smbd: Fruit. Make the use of dom_sid_compare_domain() much clearer.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>
(cherry picked from commit 5c909ea4530d4e7e4aa27046c45e3e48b094a411)

commit 47b1ec0a5ea458f9a8a21c29afca9ff21e2fbd8f
Author: Jeremy Allison <***@samba.org>
Date: Thu Mar 15 14:45:06 2018 -0700

s4: vfs: fruit tests: Add regression test for dealing with NFS ACE entries.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>

Autobuild-User(master): Jeremy Allison <***@samba.org>
Autobuild-Date(master): Sat Mar 17 04:04:32 CET 2018 on sn-devel-144

(cherry picked from commit a6054c01c29c2507e0d5a6aa110fee4fd5c5eeb9)

commit c45da7ee611ea9ac8ff8b88c8eeecbc06dfb7def
Author: Ralph Boehme <***@samba.org>
Date: Fri Mar 16 21:57:31 2018 +0100

selftest: vfs.fruit: add xattr_tdb where possible

This makes the tests indepent from fs xattr support.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Ralph Boehme <***@samba.org>
Reviewed-by: Jeremy Allison <***@samba.org>
(cherry picked from commit 49996ca9324596b6cd72eb8051ca3676dab17191)

commit 1f93e4d2e703a61c689b040ff5f6ae60dacc7e75
Author: Ralph Boehme <***@samba.org>
Date: Fri Mar 16 21:55:26 2018 +0100

selftest: run vfs.fruit_netatalk test against seperate share

These tests require a fs with xattr support. This allows adding
xattr_tdb to all other shares in the next commit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Ralph Boehme <***@samba.org>
Reviewed-by: Jeremy Allison <***@samba.org>
(cherry picked from commit 013aaffe7ff0ed4c30495761bb3208c29b3b5de2)

commit 134c41255ca492d533d6e9cbeedabf1ac87aa7e4
Author: Jeremy Allison <***@samba.org>
Date: Thu Mar 15 09:57:09 2018 -0700

s3: smbd: vfs_fruit: Replace code in fruit_fget_nt_acl() with remove_virtual_nfs_aces().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>
(cherry picked from commit 875ff2575feb96d06cf2290e5b6a226b32ef9758)

commit 9c80cb6a030cc000a52a3dc04d3794471c40ca82
Author: Jeremy Allison <***@samba.org>
Date: Thu Mar 15 09:54:41 2018 -0700

s3: smbd: vfs_fruit: Replace code in check_ms_nfs() with remove_virtual_nfs_aces().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>
(cherry picked from commit a3c925d80433e3d4fe1b1b315edf6520cacf0a9e)

commit 2fc537b71998b9ea9a7492cb1d053e5b511da931
Author: Jeremy Allison <***@samba.org>
Date: Thu Mar 15 09:52:30 2018 -0700

s3: smbd: vfs_fruit: Add remove_virtual_nfs_aces() a generic NFS ACE remover.

Not yet used, will be used to tidyup existing code.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>
(cherry picked from commit ef091e2cf836793e2aa533990913609ccab5119a)

commit 0aed47322cd8e9a8df09aaa222fa30bb2215c5b4
Author: Jeremy Allison <***@samba.org>
Date: Fri Mar 2 13:53:55 2018 -0800

s3: vfs_fruit. Change check_ms_nfs() to remove the virtual ACE's generated by fruit_fget_nt_acl().

Ensures they don't get stored in the underlying ACL.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>

Autobuild-User(master): Ralph Böhme <***@samba.org>
Autobuild-Date(master): Thu Mar 8 04:09:38 CET 2018 on sn-devel-144

(cherry picked from commit e0b147f650fe59f606d1faffe57059e6e9d7837b)

commit 8ea9d133048be3a04d5e4b92f0e497ac426e28cc
Author: Jeremy Allison <***@samba.org>
Date: Fri Mar 2 13:51:54 2018 -0800

s3: vfs_fruit. If the security descriptor was modified, ensure we set the flags correctly to reflect the ACE's left.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>
(cherry picked from commit 8edad37e476295e25932778721d8ef33713f6853)

commit 9fab1ddc2db5f88dbc9b396051cdc9d8d0195f4b
Author: Jeremy Allison <***@samba.org>
Date: Fri Mar 2 13:21:37 2018 -0800

s3: vfs_fruit: Ensure we operate on a copy of the incoming security descriptor.

This will allow us to modify it in the next commit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>
(cherry picked from commit 019a1bc4caf3439adcaac48b384e86d84a1ad383)

commit f1c0db35d5d6c75a5a6c6778a9093fa8e04053b8
Author: Jeremy Allison <***@samba.org>
Date: Fri Mar 2 13:07:48 2018 -0800

s3: vfs_fruit. Ensure we only return one set of the 'virtual' UNIX ACE entries.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13319

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>
(cherry picked from commit e9059c7b40069cfb036bfb95958b78c6a2c800e4)

commit 678555091a5d6de1f0a32a2dd5e9ced2a9cf1b30
Author: Jeremy Allison <***@samba.org>
Date: Wed Feb 14 13:23:12 2018 -0800

s3: smbd: Fix possible directory fd leak if the underlying OS doesn't support fdopendir()

HPUX has this problem.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13270

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>

Autobuild-User(master): Ralph Böhme <***@samba.org>
Autobuild-Date(master): Fri Feb 23 22:56:35 CET 2018 on sn-devel-144

(cherry picked from commit 5ad5e7966f555b1d2b39d276646934a2cd2535e6)

commit a02a98af8b20b8860252cbde372ef8f6a3b286f4
Author: Jeremy Allison <***@samba.org>
Date: Wed Jan 24 14:09:43 2018 -0800

s3: ldap: Ensure the ADS_STRUCT pointer doesn't get freed on error, we don't own it here.

Thanks to Isaac Boukris <***@gmail.com> for finding the
issue and testing this fix.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13244

Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: Volker Lendecke <***@samba.org>

Autobuild-User(master): Jeremy Allison <***@samba.org>
Autobuild-Date(master): Fri Jan 26 02:25:20 CET 2018 on sn-devel-144

(cherry picked from commit e7425bd5245ffea68b7e8f794c9b5f864d103769)

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

Summary of changes:
ctdb/client/client_connect.c | 1 -
ctdb/client/client_db.c | 20 +-
ctdb/tests/complex/30_nfs_tickle_killtcp.sh | 2 +-
ctdb/tests/complex/31_nfs_tickle.sh | 2 +-
ctdb/tests/complex/32_cifs_tickle.sh | 2 +-
ctdb/tests/complex/34_nfs_tickle_restart.sh | 2 +-
ctdb/tests/complex/36_smb_reset_server.sh | 2 +-
ctdb/tests/complex/37_nfs_reset_server.sh | 2 +-
docs-xml/smbdotconf/logging/loglevel.xml | 2 +
lib/crypto/aes.c | 16 --
lib/replace/wscript | 10 +-
lib/util/debug.c | 2 +
lib/util/debug.h | 32 +++
selftest/target/Samba3.pm | 20 +-
source3/libads/ldap_utils.c | 9 +
source3/modules/vfs_fruit.c | 93 +++++++-
source3/selftest/tests.py | 2 +-
source3/smbd/open.c | 12 +
source3/smbd/smb2_break.c | 3 +
source3/smbd/smb2_close.c | 3 +
source3/smbd/smb2_create.c | 3 +
source3/smbd/smb2_flush.c | 5 +-
source3/smbd/smb2_getinfo.c | 3 +
source3/smbd/smb2_glue.c | 3 +
source3/smbd/smb2_ioctl.c | 3 +
source3/smbd/smb2_ioctl_dfs.c | 3 +
source3/smbd/smb2_ioctl_filesys.c | 3 +
source3/smbd/smb2_ioctl_named_pipe.c | 3 +
source3/smbd/smb2_ioctl_network_fs.c | 3 +
source3/smbd/smb2_keepalive.c | 3 +
source3/smbd/smb2_lock.c | 3 +
source3/smbd/smb2_negprot.c | 3 +
source3/smbd/smb2_notify.c | 3 +
source3/smbd/smb2_query_directory.c | 12 +-
source3/smbd/smb2_read.c | 3 +
source3/smbd/smb2_server.c | 51 ++--
source3/smbd/smb2_sesssetup.c | 3 +
source3/smbd/smb2_setinfo.c | 3 +
source3/smbd/smb2_tcon.c | 3 +
source3/smbd/smb2_write.c | 3 +
source4/dsdb/samdb/ldb_modules/encrypted_secrets.c | 6 +-
source4/torture/basic/delete.c | 257 ++++++++++++++++++++-
source4/torture/vfs/fruit.c | 171 ++++++++++++++
43 files changed, 714 insertions(+), 76 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/client/client_connect.c b/ctdb/client/client_connect.c
index 89a602d..1e4157e 100644
--- a/ctdb/client/client_connect.c
+++ b/ctdb/client/client_connect.c
@@ -297,7 +297,6 @@ static void client_dead_handler(void *private_data)
ctdb_client_callback_func_t callback = client->callback;
void *callback_data = client->private_data;

- talloc_free(client);
if (callback != NULL) {
callback(callback_data);
return;
diff --git a/ctdb/client/client_db.c b/ctdb/client/client_db.c
index e86830e..c0ecdeb 100644
--- a/ctdb/client/client_db.c
+++ b/ctdb/client/client_db.c
@@ -1191,6 +1191,7 @@ struct tevent_req *ctdb_fetch_lock_send(TALLOC_CTX *mem_ctx,
if (tevent_req_nomem(state->h, req)) {
return tevent_req_post(req, ev);
}
+ state->h->ev = ev;
state->h->client = client;
state->h->db = db;
state->h->key.dptr = talloc_memdup(state->h, key.dptr, key.dsize);
@@ -1413,14 +1414,19 @@ struct ctdb_record_handle *ctdb_fetch_lock_recv(struct tevent_req *req,
offset = ctdb_ltdb_header_len(&h->header);

data->dsize = h->data.dsize - offset;
- data->dptr = talloc_memdup(mem_ctx, h->data.dptr + offset,
- data->dsize);
- if (data->dptr == NULL) {
- TALLOC_FREE(state->h);
- if (perr != NULL) {
- *perr = ENOMEM;
+ if (data->dsize == 0) {
+ data->dptr = NULL;
+ } else {
+ data->dptr = talloc_memdup(mem_ctx,
+ h->data.dptr + offset,
+ data->dsize);
+ if (data->dptr == NULL) {
+ TALLOC_FREE(state->h);
+ if (perr != NULL) {
+ *perr = ENOMEM;
+ }
+ return NULL;
}
- return NULL;
}
}

diff --git a/ctdb/tests/complex/30_nfs_tickle_killtcp.sh b/ctdb/tests/complex/30_nfs_tickle_killtcp.sh
index d1e7d71..40ec6ba 100755
--- a/ctdb/tests/complex/30_nfs_tickle_killtcp.sh
+++ b/ctdb/tests/complex/30_nfs_tickle_killtcp.sh
@@ -46,7 +46,7 @@ test_port=2049

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."

-nc -d -w 30 $test_ip $test_port &
+sleep 30 | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

diff --git a/ctdb/tests/complex/31_nfs_tickle.sh b/ctdb/tests/complex/31_nfs_tickle.sh
index c82d31d..0b6990f 100755
--- a/ctdb/tests/complex/31_nfs_tickle.sh
+++ b/ctdb/tests/complex/31_nfs_tickle.sh
@@ -54,7 +54,7 @@ test_port=2049

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."

-nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
+sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

diff --git a/ctdb/tests/complex/32_cifs_tickle.sh b/ctdb/tests/complex/32_cifs_tickle.sh
index da369b9..3668245 100755
--- a/ctdb/tests/complex/32_cifs_tickle.sh
+++ b/ctdb/tests/complex/32_cifs_tickle.sh
@@ -52,7 +52,7 @@ test_port=445

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."

-nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
+sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

diff --git a/ctdb/tests/complex/34_nfs_tickle_restart.sh b/ctdb/tests/complex/34_nfs_tickle_restart.sh
index 6350db6..2aab061 100755
--- a/ctdb/tests/complex/34_nfs_tickle_restart.sh
+++ b/ctdb/tests/complex/34_nfs_tickle_restart.sh
@@ -53,7 +53,7 @@ test_port=2049

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."

-nc -d -w 600 $test_ip $test_port &
+sleep 600 | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

diff --git a/ctdb/tests/complex/36_smb_reset_server.sh b/ctdb/tests/complex/36_smb_reset_server.sh
index 5723ac7..beff1a2 100755
--- a/ctdb/tests/complex/36_smb_reset_server.sh
+++ b/ctdb/tests/complex/36_smb_reset_server.sh
@@ -52,7 +52,7 @@ sleep_for 5

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with nc..."

-nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
+sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

diff --git a/ctdb/tests/complex/37_nfs_reset_server.sh b/ctdb/tests/complex/37_nfs_reset_server.sh
index d6dd0f0..07bd034 100755
--- a/ctdb/tests/complex/37_nfs_reset_server.sh
+++ b/ctdb/tests/complex/37_nfs_reset_server.sh
@@ -52,7 +52,7 @@ sleep_for 5

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with nc..."

-nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
+sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

diff --git a/docs-xml/smbdotconf/logging/loglevel.xml b/docs-xml/smbdotconf/logging/loglevel.xml
index 1a3767d..d3b5c45 100644
--- a/docs-xml/smbdotconf/logging/loglevel.xml
+++ b/docs-xml/smbdotconf/logging/loglevel.xml
@@ -22,6 +22,8 @@
<listitem><para><parameter moreinfo="none">printdrivers</parameter></para></listitem>
<listitem><para><parameter moreinfo="none">lanman</parameter></para></listitem>
<listitem><para><parameter moreinfo="none">smb</parameter></para></listitem>
+ <listitem><para><parameter moreinfo="none">smb2</parameter></para></listitem>
+ <listitem><para><parameter moreinfo="none">smb2_credits</parameter></para></listitem>
<listitem><para><parameter moreinfo="none">rpc_parse</parameter></para></listitem>
<listitem><para><parameter moreinfo="none">rpc_srv</parameter></para></listitem>
<listitem><para><parameter moreinfo="none">rpc_cli</parameter></para></listitem>
diff --git a/lib/crypto/aes.c b/lib/crypto/aes.c
index c226ac1..d16d715 100644
--- a/lib/crypto/aes.c
+++ b/lib/crypto/aes.c
@@ -66,22 +66,6 @@ static bool has_intel_aes_instructions(void)
return (bool)has_aes_instructions;
}

- __cpuid(cpuid_results, 0);
- /*
- * MSB LSB
- * EBX = 'u' 'n' 'e' 'G'
- * EDX = 'I' 'e' 'n' 'i'
- * ECX = 'l' 'e' 't' 'n'
- */
- if (memcmp((unsigned char *)&cpuid_results[1], "Genu", 4) != 0 ||
- memcmp((unsigned char *)&cpuid_results[3],
- "ineI", 4) != 0 ||
- memcmp((unsigned char *)&cpuid_results[2],
- "ntel", 4) != 0) {
- has_aes_instructions = 0;
- return (bool)has_aes_instructions;
- }
-
__cpuid(cpuid_results, 1);
has_aes_instructions = !!(cpuid_results[2] & (1 << 25));
return (bool)has_aes_instructions;
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 2c638b7..0e04bf7 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -68,7 +68,15 @@ def configure(conf):
conf.CHECK_HEADERS('aio.h sys/unistd.h alloca.h float.h')

conf.SET_TARGET_TYPE('tirpc', 'EMPTY')
- conf.CHECK_HEADERS('rpc/rpc.h rpc/nettype.h')
+
+ if conf.CHECK_CODE(
+ '\n#ifndef _TIRPC_RPC_H\n#error "no tirpc headers in system path"\n#endif\n',
+ 'HAVE_RPC_RPC_HEADERS',
+ headers=['rpc/rpc.h', 'rpc/nettype.h'],
+ msg='Checking for tirpc rpc headers in default system path'):
+ if conf.CONFIG_SET('HAVE_RPC_RPC_H'):
+ conf.undefine('HAVE_RPC_RPC_H')
+
if not conf.CONFIG_SET('HAVE_RPC_RPC_H'):
if conf.CHECK_CFG(package='libtirpc', args='--cflags --libs',
msg='Checking for libtirpc headers',
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 6428550..d010b72 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -541,6 +541,8 @@ static const char *default_classname_table[] = {
[DBGC_AUTH_AUDIT_JSON] = "auth_json_audit",
[DBGC_KERBEROS] = "kerberos",
[DBGC_DRS_REPL] = "drs_repl",
+ [DBGC_SMB2] = "smb2",
+ [DBGC_SMB2_CREDITS] = "smb2_credits",
};

/*
diff --git a/lib/util/debug.h b/lib/util/debug.h
index e82553a..1e184b4 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -93,6 +93,8 @@ bool dbghdr( int level, const char *location, const char *func);
#define DBGC_AUTH_AUDIT_JSON 25
#define DBGC_KERBEROS 26
#define DBGC_DRS_REPL 27
+#define DBGC_SMB2 28
+#define DBGC_SMB2_CREDITS 29

/* So you can define DBGC_CLASS before including debug.h */
#ifndef DBGC_CLASS
@@ -216,6 +218,14 @@ extern int *DEBUGLEVEL_CLASS;
&& (dbgtext("%s: ", __func__)) \
&& (dbgtext body) )

+/* Prefix messages with the function name - class specific */
+#define DBGC_PREFIX(dbgc_class, level, body ) \
+ (void)( ((level) <= MAX_DEBUG_LEVEL) && \
+ unlikely(DEBUGLEVEL_CLASS[ dbgc_class ] >= (level)) \
+ && (dbghdrclass(level, dbgc_class, __location__, __func__ )) \
+ && (dbgtext("%s: ", __func__)) \
+ && (dbgtext body) )
+
/*
* Debug levels matching RFC 3164
*/
@@ -231,12 +241,34 @@ extern int *DEBUGLEVEL_CLASS;
#define DBG_INFO(...) DBG_PREFIX(DBGLVL_INFO, (__VA_ARGS__))
#define DBG_DEBUG(...) DBG_PREFIX(DBGLVL_DEBUG, (__VA_ARGS__))

+#define DBGC_ERR(dbgc_class, ...) DBGC_PREFIX(dbgc_class, \
+ DBGLVL_ERR, (__VA_ARGS__))
+#define DBGC_WARNING(dbgc_class, ...) DBGC_PREFIX(dbgc_class, \
+ DBGLVL_WARNING, (__VA_ARGS__))
+#define DBGC_NOTICE(dbgc_class, ...) DBGC_PREFIX(dbgc_class, \
+ DBGLVL_NOTICE, (__VA_ARGS__))
+#define DBGC_INFO(dbgc_class, ...) DBGC_PREFIX(dbgc_class, \
+ DBGLVL_INFO, (__VA_ARGS__))
+#define DBGC_DEBUG(dbgc_class, ...) DBGC_PREFIX(dbgc_class, \
+ DBGLVL_DEBUG, (__VA_ARGS__))
+
#define D_ERR(...) DEBUG(DBGLVL_ERR, (__VA_ARGS__))
#define D_WARNING(...) DEBUG(DBGLVL_WARNING, (__VA_ARGS__))
#define D_NOTICE(...) DEBUG(DBGLVL_NOTICE, (__VA_ARGS__))
#define D_INFO(...) DEBUG(DBGLVL_INFO, (__VA_ARGS__))
#define D_DEBUG(...) DEBUG(DBGLVL_DEBUG, (__VA_ARGS__))

+#define DC_ERR(...) DEBUGC(dbgc_class, \
+ DBGLVL_ERR, (__VA_ARGS__))
+#define DC_WARNING(...) DEBUGC(dbgc_class, \
+ DBGLVL_WARNING, (__VA_ARGS__))
+#define DC_NOTICE(...) DEBUGC(dbgc_class, \
+ DBGLVL_NOTICE, (__VA_ARGS__))
+#define DC_INFO(...) DEBUGC(dbgc_class, \
+ DBGLVL_INFO, (__VA_ARGS__))
+#define DC_DEBUG(...) DEBUGC(dbgc_class, \
+ DBGLVL_DEBUG, (__VA_ARGS__))
+
/* The following definitions come from lib/debug.c */

/** Possible destinations for the debug log (in order of precedence -
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index f2dcdd1..7e4224a 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1929,6 +1929,16 @@ sub provision($$$$$$$$$)

[vfs_fruit]
path = $shrdir
+ vfs objects = catia fruit streams_xattr acl_xattr xattr_tdb
+ fruit:resource = file
+ fruit:metadata = netatalk
+ fruit:locking = netatalk
+ fruit:encoding = native
+ fruit:veto_appledouble = no
+
+[vfs_fruit_xattr]
+ path = $shrdir
+ # This is used by vfs.fruit tests that require real fs xattr
vfs objects = catia fruit streams_xattr acl_xattr
fruit:resource = file
fruit:metadata = netatalk
@@ -1938,29 +1948,29 @@ sub provision($$$$$$$$$)

[vfs_fruit_metadata_stream]
path = $shrdir
- vfs objects = fruit streams_xattr acl_xattr
+ vfs objects = fruit streams_xattr acl_xattr xattr_tdb
fruit:resource = file
fruit:metadata = stream
fruit:veto_appledouble = no

[vfs_fruit_stream_depot]
path = $shrdir
- vfs objects = fruit streams_depot acl_xattr
+ vfs objects = fruit streams_depot acl_xattr xattr_tdb
fruit:resource = stream
fruit:metadata = stream
fruit:veto_appledouble = no

[vfs_wo_fruit]
path = $shrdir
- vfs objects = streams_xattr acl_xattr
+ vfs objects = streams_xattr acl_xattr xattr_tdb

[vfs_wo_fruit_stream_depot]
path = $shrdir
- vfs objects = streams_depot acl_xattr
+ vfs objects = streams_depot acl_xattr xattr_tdb

[vfs_fruit_timemachine]
path = $shrdir
- vfs objects = fruit streams_xattr acl_xattr
+ vfs objects = fruit streams_xattr acl_xattr xattr_tdb
fruit:resource = file
fruit:metadata = stream
fruit:time machine = yes
diff --git a/source3/libads/ldap_utils.c b/source3/libads/ldap_utils.c
index a4adbc0..0c37b06 100644
--- a/source3/libads/ldap_utils.c
+++ b/source3/libads/ldap_utils.c
@@ -105,9 +105,18 @@ static ADS_STATUS ads_do_search_retry_internal(ADS_STRUCT *ads, const char *bind
status = ads_connect(ads);

if (!ADS_ERR_OK(status)) {
+ bool orig_is_mine = ads->is_mine;
+
DEBUG(1,("ads_search_retry: failed to reconnect (%s)\n",
ads_errstr(status)));
+ /*
+ * We need to keep the ads pointer
+ * from being freed here as we don't own it and
+ * callers depend on it being around.
+ */
+ ads->is_mine = false;
ads_destroy(&ads);
+ ads->is_mine = orig_is_mine;
SAFE_FREE(bp);
return status;
}
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index ec76f71..1a05d0b 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -2954,10 +2954,54 @@ static NTSTATUS readdir_attr_macmeta(struct vfs_handle_struct *handle,
return status;
}

+static NTSTATUS remove_virtual_nfs_aces(struct security_descriptor *psd)
+{
+ NTSTATUS status;
+ uint32_t i;
+
+ if (psd->dacl == NULL) {
+ return NT_STATUS_OK;
+ }
+
+ for (i = 0; i < psd->dacl->num_aces; i++) {
+ /* MS NFS style mode/uid/gid */
+ int cmp = dom_sid_compare_domain(
+ &global_sid_Unix_NFS,
+ &psd->dacl->aces[i].trustee);
+ if (cmp != 0) {
+ /* Normal ACE entry. */
+ continue;
+ }
+
+ /*
+ * security_descriptor_dacl_del()
+ * *must* return NT_STATUS_OK as we know
+ * we have something to remove.
+ */
+
+ status = security_descriptor_dacl_del(psd,
+ &psd->dacl->aces[i].trustee);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_WARNING("failed to remove MS NFS style ACE: %s\n",
+ nt_errstr(status));
+ return status;
+ }
+
+ /*
+ * security_descriptor_dacl_del() may delete more
+ * then one entry subsequent to this one if the
+ * SID matches, but we only need to ensure that
+ * we stay looking at the same element in the array.
+ */
+ i--;
+ }
+ return NT_STATUS_OK;
+}
+
/* Search MS NFS style ACE with UNIX mode */
static NTSTATUS check_ms_nfs(vfs_handle_struct *handle,
files_struct *fsp,
- const struct security_descriptor *psd,
+ struct security_descriptor *psd,
mode_t *pmode,
bool *pdo_chmod)
{
@@ -2991,7 +3035,12 @@ static NTSTATUS check_ms_nfs(vfs_handle_struct *handle,
}
}

- return NT_STATUS_OK;
+ /*
+ * Remove any incoming virtual ACE entries generated by
+ * fruit_fget_nt_acl().
+ */
+
+ return remove_virtual_nfs_aces(psd);
}

/****************************************************************************
@@ -5708,6 +5757,13 @@ static NTSTATUS fruit_fget_nt_acl(vfs_handle_struct *handle,
return NT_STATUS_OK;
}

+ /* First remove any existing ACE's with NFS style mode/uid/gid SIDs. */
+ status = remove_virtual_nfs_aces(*ppdesc);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_WARNING("failed to remove MS NFS style ACEs\n");
+ return status;
+ }
+
/* MS NFS style mode */
sid_compose(&sid, &global_sid_Unix_NFS_Mode, fsp->fsp_name->st.st_ex_mode);
init_sec_ace(&ace, &sid, SEC_ACE_TYPE_ACCESS_DENIED, 0, 0);
@@ -5741,24 +5797,53 @@ static NTSTATUS fruit_fget_nt_acl(vfs_handle_struct *handle,
static NTSTATUS fruit_fset_nt_acl(vfs_handle_struct *handle,
files_struct *fsp,
uint32_t security_info_sent,
- const struct security_descriptor *psd)
+ const struct security_descriptor *orig_psd)
{
NTSTATUS status;
bool do_chmod;
mode_t ms_nfs_mode = 0;
int result;
+ struct security_descriptor *psd = NULL;
+ uint32_t orig_num_aces = 0;
+
+ if (orig_psd->dacl != NULL) {
+ orig_num_aces = orig_psd->dacl->num_aces;
+ }
+
+ psd = security_descriptor_copy(talloc_tos(), orig_psd);
+ if (psd == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }

DBG_DEBUG("fruit_fset_nt_acl: %s\n", fsp_str_dbg(fsp));

status = check_ms_nfs(handle, fsp, psd, &ms_nfs_mode, &do_chmod);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("fruit_fset_nt_acl: check_ms_nfs failed%s\n", fsp_str_dbg(fsp)));
+ TALLOC_FREE(psd);
return status;
}

+ /*
+ * If only ms_nfs ACE entries were sent, ensure we set the DACL
+ * sent/present flags correctly now we've removed them.
+ */
+
+ if (orig_num_aces != 0) {
+ /*
+ * Are there any ACE's left ?
+ */
+ if (psd->dacl->num_aces == 0) {
+ /* No - clear the DACL sent/present flags. */
+ security_info_sent &= ~SECINFO_DACL;
+ psd->type &= ~SEC_DESC_DACL_PRESENT;
+ }
+ }
+
status = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("fruit_fset_nt_acl: SMB_VFS_NEXT_FSET_NT_ACL failed%s\n", fsp_str_dbg(fsp)));
+ TALLOC_FREE(psd);
return status;
}

@@ -5776,10 +5861,12 @@ static NTSTATUS fruit_fset_nt_acl(vfs_handle_struct *handle,
result, (unsigned)ms_nfs_mode,
strerror(errno)));
status = map_nt_error_from_unix(errno);
+ TALLOC_FREE(psd);
return status;
}
}

+ TALLOC_FREE(psd);
return NT_STATUS_OK;
}
--
Samba Shared Repository
Karolin Seeger
2018-04-10 12:45:01 UTC
Permalink
The branch, v4-8-test has been updated
via bc11f28 s3: smbd: Fix memory leak in vfswrap_getwd()
via 5afebb2 s3: lib: messages: Don't use the result of sec_init() before calling sec_init().
via 2c3060b dsdb: Fix CID 1034966 Uninitialized scalar variable
via a9ed196 s3:smbd: don't use the directory cache for SMB2/3
via eb9085b ctdb-scripts: Drop "net serverid wipe" from 50.samba event script
via 365569d ms_schema: fix python2.6 incompatibility
via 9230fe2 samba-tool visualize: fix python2.6 incompatibility
from 8e149c8 s4: torture: Test all combinations of directory open with existing directory to ensure behavior is the same.

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


- Log -----------------------------------------------------------------
commit bc11f2851af7e71c91f90224c90528f2c7755f6a
Author: Jeremy Allison <***@samba.org>
Date: Fri Apr 6 13:52:52 2018 -0700

s3: smbd: Fix memory leak in vfswrap_getwd()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13372

Signed-off-by: Andrew Walker <***@ixsystems.com>.
Reviewed-by: Jeremy Allison <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>

Autobuild-User(master): Jeremy Allison <***@samba.org>
Autobuild-Date(master): Mon Apr 9 21:48:12 CEST 2018 on sn-devel-144

(cherry picked from commit 461a1172ff819692aa0a2dc5ce7fc5379c8a529e)

Autobuild-User(v4-8-test): Karolin Seeger <***@samba.org>
Autobuild-Date(v4-8-test): Tue Apr 10 14:44:28 CEST 2018 on sn-devel-144

commit 5afebb251c6b87d264ea66a20b29c79e8aa1215d
Author: Lutz Justen <***@google.com>
Date: Wed Apr 4 09:50:12 2018 -0700

s3: lib: messages: Don't use the result of sec_init() before calling sec_init().

Commit ad8c7171ba86e8a47d78b0c7329bb814e5a8871e accidently
moved sec_init() to the point after sec_initial_uid() is
called in the call to directory_create_or_exist_strict().
I missed this in the review (sorry). This works as root
as initial_uid/initial_gid are static (and so initialized
as zero) but doesn't work on ChromeOS as this code isn't
running as root.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13368

Signed-off-by: Lutz Justen <***@google.com>
Reviewed-by: Jeremy Allison <***@samba.org>
Reviewed-by: Andreas Schneider <***@samba.org>

Autobuild-User(master): Jeremy Allison <***@samba.org>
Autobuild-Date(master): Wed Apr 4 23:52:02 CEST 2018 on sn-devel-144

(cherry picked from commit e895b6cf4a7eb3d50d618a022be74db85975bf69)

commit 2c3060b6a6c8d03286906adb89452788988feeeb
Author: Volker Lendecke <***@samba.org>
Date: Wed Mar 28 15:43:53 2018 -0500

dsdb: Fix CID 1034966 Uninitialized scalar variable

"continue" in a do-while loop jumps to the "while"-check, so "id_exists" needs
to be initialized by that point.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13367

Signed-off-by: Volker Lendecke <***@samba.org>
Reviewed-by: Jeremy Allison <***@samba.org>
Reviewed-by: Stefan Metzmacher <***@samba.org>
(cherry picked from commit 925d1f23291c4bdbc832977b2b4577964b8301c8)

commit a9ed1968e8bf435d98a9fa02d1f0265398c45523
Author: Ralph Boehme <***@samba.org>
Date: Thu Mar 29 20:06:47 2018 +0200

s3:smbd: don't use the directory cache for SMB2/3

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13363

Signed-off-by: Ralph Boehme <***@samba.org>
Reviewed-by: Jeremy Allison <***@samba.org>

Autobuild-User(master): Jeremy Allison <***@samba.org>
Autobuild-Date(master): Fri Mar 30 03:51:48 CEST 2018 on sn-devel-144

(cherry picked from commit 66052fdccd28922cf1caa2bc750e39051a6414cf)

commit eb9085b3ef8610970a4168566f73395fd3c900d5
Author: Amitay Isaacs <***@gmail.com>
Date: Thu Mar 29 10:45:19 2018 +1100

ctdb-scripts: Drop "net serverid wipe" from 50.samba event script

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13359

There is no serverid database anymore.

Signed-off-by: Amitay Isaacs <***@gmail.com>
Reviewed-by: Volker Lendecke <***@samba.org>
Reviewed-by: Martin Schwenke <***@meltin.net>

Autobuild-User(master): Martin Schwenke <***@samba.org>
Autobuild-Date(master): Sat Mar 31 08:34:00 CEST 2018 on sn-devel-144

(cherry picked from commit 6b75d2c650aa9ee632122fa87ea8a2a98f1fa613)

commit 365569dfc70a45ff9ba4b3baf9e3ea7de66eff4e
Author: Björn Baumbach <***@sernet.de>
Date: Thu Mar 15 18:32:31 2018 +0100

ms_schema: fix python2.6 incompatibility

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13337

Signed-off-by: Björn Baumbach <***@sernet.de>
Reviewed-by: Andrew Bartlett <***@samba.org>
Reviewed-by: Douglas Bagnall <***@catalyst.net.nz>
(cherry picked from commit a27db0b61e40b6b503b53e3579867e227f1971b8)

commit 9230fe25287dd3ee53c9384f73f62b4e4ed8dd1e
Author: Björn Baumbach <***@sernet.de>
Date: Tue Mar 20 12:15:22 2018 +0100

samba-tool visualize: fix python2.6 incompatibility

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13337

Signed-off-by: Björn Baumbach <***@sernet.de>
Reviewed-by: Andrew Bartlett <***@samba.org>
Reviewed-by: Douglas Bagnall <***@catalyst.net.nz>

Autobuild-User(master): Douglas Bagnall <***@samba.org>
Autobuild-Date(master): Wed Mar 21 09:25:51 CET 2018 on sn-devel-144

(cherry picked from commit 9312a1cdafbd5a0140d72502487c4e478dc578d2)

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

Summary of changes:
ctdb/config/events.d/50.samba | 2 --
.../smbdotconf/misc/directorynamecachesize.xml | 5 ++--
python/samba/ms_schema.py | 2 +-
python/samba/netcmd/visualize.py | 6 +++-
source3/lib/messages.c | 9 ++++--
source3/modules/vfs_default.c | 9 ++++--
source3/smbd/dir.c | 32 ++++++++++++++++++++--
source4/dsdb/samdb/ldb_modules/samldb.c | 1 +
8 files changed, 52 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/events.d/50.samba b/ctdb/config/events.d/50.samba
index 4c32e4e..f0d8e84 100755
--- a/ctdb/config/events.d/50.samba
+++ b/ctdb/config/events.d/50.samba
@@ -53,8 +53,6 @@ service_start ()
# start Samba service. Start it reniced, as under very heavy load
# the number of smbd processes will mean that it leaves few cycles
# for anything else
- net serverid wipe
-
if [ -n "$CTDB_SERVICE_NMB" ] ; then
nice_service "$CTDB_SERVICE_NMB" start || die "Failed to start nmbd"
fi
diff --git a/docs-xml/smbdotconf/misc/directorynamecachesize.xml b/docs-xml/smbdotconf/misc/directorynamecachesize.xml
index 7a89bf2..22999a6 100644
--- a/docs-xml/smbdotconf/misc/directorynamecachesize.xml
+++ b/docs-xml/smbdotconf/misc/directorynamecachesize.xml
@@ -4,8 +4,9 @@
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
<para>
- This parameter specifies the size of the directory name cache.
- It will be needed to turn this off for *BSD systems.
+ This parameter specifies the size of the directory name cache for SMB1
+ connections. It is not used for SMB2. It will be needed to turn this off
+ for *BSD systems.
</para>

</description>
diff --git a/python/samba/ms_schema.py b/python/samba/ms_schema.py
index a8c9363..53ec02d 100644
--- a/python/samba/ms_schema.py
+++ b/python/samba/ms_schema.py
@@ -277,7 +277,7 @@ def __transform_entry(entry, objectClass):

header.append(["objectGUID", str(uuid.uuid4()), False])

- entry = header + [x for x in entry if x[0].lower() not in {'dn', 'changetype', 'objectcategory'}]
+ entry = header + [x for x in entry if x[0].lower() not in set(['dn', 'changetype', 'objectcategory'])]

return entry

diff --git a/python/samba/netcmd/visualize.py b/python/samba/netcmd/visualize.py
index 473872a..3e5b950 100644
--- a/python/samba/netcmd/visualize.py
+++ b/python/samba/netcmd/visualize.py
@@ -176,7 +176,11 @@ def get_partition_maps(samdb):
"DNSDOMAIN": "DC=DomainDnsZones,%s" % base_dn,
"DNSFOREST": "DC=ForestDnsZones,%s" % base_dn
}
- long_to_short = {v: k for k, v in short_to_long.iteritems()}
+
+ long_to_short = {}
+ for s, l in short_to_long.iteritems():
+ long_to_short[l] = s
+
return short_to_long, long_to_short


diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 464233f..5a31f34 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -457,6 +457,13 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx,
const char *priv_path;
bool ok;

+ /*
+ * sec_init() *must* be called before any other
+ * functions that use sec_XXX(). e.g. sec_initial_uid().
+ */
+
+ sec_init();
+
lck_path = lock_path("msg.lock");
if (lck_path == NULL) {
return NT_STATUS_NO_MEMORY;
@@ -507,8 +514,6 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx,
goto done;
}

- sec_init();
-
ctx->msg_dgm_ref = messaging_dgm_ref(ctx,
ctx->event_ctx,
&ctx->id.unique_id,
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index a26bec4..a9c87e4 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2229,9 +2229,12 @@ static struct smb_filename *vfswrap_getwd(vfs_handle_struct *handle,
NULL,
NULL,
0);
- if (smb_fname == NULL) {
- SAFE_FREE(result);
- }
+ /*
+ * sys_getwd() *always* returns malloced memory.
+ * We must free here to avoid leaks:
+ * BUG:https://bugzilla.samba.org/show_bug.cgi?id=13372
+ */
+ SAFE_FREE(result);
return smb_fname;
}

diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 6621b4e..801daa5 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1219,7 +1219,15 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
mask, smb_fname_str_dbg(&smb_fname),
dname, fname));

- DirCacheAdd(dirptr->dir_hnd, dname, cur_offset);
+ if (!conn->sconn->using_smb2) {
+ /*
+ * The dircache is only needed for SMB1 because SMB1
+ * uses a name for the resume wheras SMB2 always
+ * continues from the next position (unless it's told to
+ * restart or close-and-reopen the listing).
+ */
+ DirCacheAdd(dirptr->dir_hnd, dname, cur_offset);
+ }

TALLOC_FREE(dname);

@@ -1646,7 +1654,16 @@ static struct smb_Dir *OpenDir_internal(TALLOC_CTX *mem_ctx,
}

dirp->conn = conn;
- dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
+
+ if (!conn->sconn->using_smb2) {
+ /*
+ * The dircache is only needed for SMB1 because SMB1 uses a name
+ * for the resume wheras SMB2 always continues from the next
+ * position (unless it's told to restart or close-and-reopen the
+ * listing).
+ */
+ dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
+ }

if (sconn && !sconn->using_smb2) {
sconn->searches.dirhandles_open++;
@@ -1768,7 +1785,16 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn,
}

dirp->conn = conn;
- dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
+
+ if (!conn->sconn->using_smb2) {
+ /*
+ * The dircache is only needed for SMB1 because SMB1 uses a name
+ * for the resume wheras SMB2 always continues from the next
+ * position (unless it's told to restart or close-and-reopen the
+ * listing).
+ */
+ dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
+ }

dirp->dir_smb_fname = cp_smb_filename(dirp, fsp->fsp_name);
if (!dirp->dir_smb_fname) {
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 3e429e1..11da629 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -875,6 +875,7 @@ static int samldb_add_handle_msDS_IntId(struct samldb_ctx *ac)
* order to be sure.
*/
if (dsdb_attribute_by_attributeID_id(schema, msds_intid)) {
+ id_exists = true;
msds_intid = generate_random() % 0X3FFFFFFF;
msds_intid += 0x80000000;
continue;
--
Samba Shared Repository
Karolin Seeger
2018-04-11 15:12:02 UTC
Permalink
The branch, v4-8-test has been updated
via bb5526d winbindd: Do not ignore domain in the LOOKUPNAME request
via 40ee786 Add test for wbinfo name lookup
via 8056016 nsswitch: Fix wbcListGroups test
via f901e8c nsswitch: Fix wbcListUsers test
via d2799ab test_smbclient_s3.sh: Use correct separator in "list with backup privilege" test
via 7abe54b s3: smbd: Unix extensions attempts to change wrong field in fchown call.
from bc11f28 s3: smbd: Fix memory leak in vfswrap_getwd()

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


- Log -----------------------------------------------------------------
commit bb5526d01fabd308d848a0b72332a2361438fcf5
Author: Christof Schmitt <***@samba.org>
Date: Wed Feb 28 12:05:34 2018 -0700

winbindd: Do not ignore domain in the LOOKUPNAME request

A LOOKUPNAME request with a domain and a name containing a winbind
separator character would return the result for the joined domain,
instead of the specified domain.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13312

Signed-off-by: Christof Schmitt <***@samba.org>
Reviewed-by: Andreas Schneider <***@samba.org>

Autobuild-User(master): Andreas Schneider <***@cryptomilk.org>
Autobuild-Date(master): Fri Apr 6 21:03:31 CEST 2018 on sn-devel-144

(cherry picked from commit 1775ac8aa4dc00b9a0845ade238254ebb8b32429)

Autobuild-User(v4-8-test): Karolin Seeger <***@samba.org>
Autobuild-Date(v4-8-test): Wed Apr 11 17:11:21 CEST 2018 on sn-devel-144

commit 40ee7863a558568c69ee990fb8405ab51febae34
Author: Christof Schmitt <***@samba.org>
Date: Wed Feb 28 13:10:43 2018 -0700

Add test for wbinfo name lookup

This demonstrates that wbinfo -n / --name-to-sid returns information
instead of failing the request. More specifically the query for
INVALIDDOMAIN//user returns the user SID for the joined domain, instead
of failing the request.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13312

Signed-off-by: Christof Schmitt <***@samba.org>
Reviewed-by: Andreas Schneider <***@samba.org>
(cherry picked from commit 552a00ec1f6795b9025298931a6cc50ebe552052)

commit 80560167956cde78652d804cdf26385f759ba39b
Author: Christof Schmitt <***@samba.org>
Date: Fri Mar 30 14:35:03 2018 -0700

nsswitch: Fix wbcListGroups test

With an AD DC, wbcListGroups returns the users in the DOMAIN SEPARATOR
GROUPNAME format. The test then calls wbcLookupName with the domain
name and the previous string (including domain and separator) as
username. Fix this by passing the correct username and adding some
additional checks.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13312

Signed-off-by: Christof Schmitt <***@samba.org>
Reviewed-by: Andreas Schneider <***@samba.org>
(cherry picked from commit f4db4e86c341a89357082e81e30c302440647530)

commit f901e8cc594526e50a18cf58edef48ca5b74bb29
Author: Christof Schmitt <***@samba.org>
Date: Fri Mar 30 14:28:46 2018 -0700

nsswitch: Fix wbcListUsers test

With an AD DC, wbcListUsers returns the users in the DOMAIN SEPARATOR
USERNAME format. The test then calls wbcLookupName with the domain name
and the previous string (including domain and separator) as username.
Fix this by passing the correct username and adding some additional
checks.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13312

Signed-off-by: Christof Schmitt <***@samba.org>
Reviewed-by: Andreas Schneider <***@samba.org>
(cherry picked from commit 3c146be404affc894c0c702bbfbfcc4fb9ed902b)

commit d2799ab5e45ad184bcb26fa8d0770711fe1907e8
Author: Christof Schmitt <***@samba.org>
Date: Fri Mar 16 13:52:14 2018 -0700

test_smbclient_s3.sh: Use correct separator in "list with backup privilege" test

Samba selftest uses the forward slash as winbind separator and in the
USERNAME passed to the test. "net sam rights" expect the backslash. Map
the separator used in selftest to a backslash to avoid creating an
incorrect username DOMAIN\DOMAIN/USERNAME.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13312

Signed-off-by: Christof Schmitt <***@samba.org>
Reviewed-by: Andreas Schneider <***@samba.org>
(cherry picked from commit 6f07afad07d9c670a00d9d314a8134efdda5e424)

commit 7abe54b57f65c4e89ca34178690c3b19c1e4626f
Author: Jeremy Allison <***@samba.org>
Date: Mon Apr 9 09:32:23 2018 -0700

s3: smbd: Unix extensions attempts to change wrong field in fchown call.

Cut and paste error.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13375

Reported-by: Rungta, Vandana <***@amazon.com>
Signed-off-by: Jeremy Allison <***@samba.org>
Reviewed-by: David Disseldorp <***@samba.org>

Autobuild-User(master): David Disseldorp <***@samba.org>
Autobuild-Date(master): Tue Apr 10 00:45:56 CEST 2018 on sn-devel-144

(cherry picked from commit 3227b110d065500ed84fc70063da70ab35823a2e)

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

Summary of changes:
nsswitch/libwbclient/tests/wbclient.c | 66 ++++++++++++++++++++++++++++++-
nsswitch/tests/test_wbinfo_name_lookup.sh | 40 +++++++++++++++++++
source3/script/tests/test_smbclient_s3.sh | 10 +++--
source3/selftest/tests.py | 4 ++
source3/smbd/trans2.c | 4 +-
source3/winbindd/winbindd_lookupname.c | 33 ++++++++++------
6 files changed, 138 insertions(+), 19 deletions(-)
create mode 100755 nsswitch/tests/test_wbinfo_name_lookup.sh


Changeset truncated at 500 lines:

diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index e80afc4..d107942 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -296,6 +296,7 @@ static bool test_wbc_users(struct torture_context *tctx)
char *name = NULL;
char *sid_string = NULL;
wbcErr ret = false;
+ char separator;

torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
"%s", "wbcInterfaceDetails failed");
@@ -306,6 +307,7 @@ static bool test_wbc_users(struct torture_context *tctx)
ret,
fail,
"Failed to allocate domain_name");
+ separator = details->winbind_separator;
wbcFreeMemory(details);
details = NULL;

@@ -323,9 +325,38 @@ static bool test_wbc_users(struct torture_context *tctx)
struct wbcDomainSid sid;
enum wbcSidType name_type;
uint32_t num_sids;
+ const char *user;
+ char *c;
+
+ c = strchr(users[i], separator);
+
+ if (c == NULL) {
+ /*
+ * NT4 DC
+ * user name does not contain DOMAIN SEPARATOR prefix.
+ */
+
+ user = users[i];
+ } else {
+ /*
+ * AD DC
+ * user name starts with DOMAIN SEPARATOR prefix.
+ */
+ const char *dom;
+
+ *c = '\0';
+ dom = users[i];
+ user = c + 1;
+
+ torture_assert_str_equal_goto(tctx, dom, domain_name,
+ ret, fail, "Domain part "
+ "of user name does not "
+ "match domain name.\n");
+ }

torture_assert_wbc_ok_goto_fail(tctx,
- wbcLookupName(domain_name, users[i], &sid, &name_type),
+ wbcLookupName(domain_name, user,
+ &sid, &name_type),
"wbcLookupName of %s failed",
users[i]);
torture_assert_int_equal_goto(tctx,
@@ -399,6 +430,7 @@ static bool test_wbc_groups(struct torture_context *tctx)
char *domain = NULL;
char *name = NULL;
char *sid_string = NULL;
+ char separator;

torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
"%s", "wbcInterfaceDetails failed");
@@ -409,6 +441,7 @@ static bool test_wbc_groups(struct torture_context *tctx)
ret,
fail,
"Failed to allocate domain_name");
+ separator = details->winbind_separator;
wbcFreeMemory(details);
details = NULL;

@@ -425,10 +458,39 @@ static bool test_wbc_groups(struct torture_context *tctx)
for (i=0; i < MIN(num_groups,100); i++) {
struct wbcDomainSid sid;
enum wbcSidType name_type;
+ const char *group;
+ char *c;
+
+ c = strchr(groups[i], separator);
+
+ if (c == NULL) {
+ /*
+ * NT4 DC
+ * group name does not contain DOMAIN SEPARATOR prefix.
+ */
+
+ group = groups[i];
+ } else {
+ /*
+ * AD DC
+ * group name starts with DOMAIN SEPARATOR prefix.
+ */
+ const char *dom;
+
+
+ *c = '\0';
+ dom = groups[i];
+ group = c + 1;
+
+ torture_assert_str_equal_goto(tctx, dom, domain_name,
+ ret, fail, "Domain part "
+ "of group name does not "
+ "match domain name.\n");
+ }

torture_assert_wbc_ok_goto_fail(tctx,
wbcLookupName(domain_name,
- groups[i],
+ group,
&sid,
&name_type),
"wbcLookupName for %s failed",
diff --git a/nsswitch/tests/test_wbinfo_name_lookup.sh b/nsswitch/tests/test_wbinfo_name_lookup.sh
new file mode 100755
index 0000000..696e25b
--- /dev/null
+++ b/nsswitch/tests/test_wbinfo_name_lookup.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Blackbox test for wbinfo name lookup
+if [ $# -lt 2 ]; then
+cat <<EOF
+Usage: test_wbinfo.sh DOMAIN DC_USERNAME
+EOF
+exit 1;
+fi
+
+DOMAIN=$1
+DC_USERNAME=$2
+shift 2
+
+failed=0
+sambabindir="$BINDIR"
+wbinfo="$VALGRIND $sambabindir/wbinfo"
+
+. `dirname $0`/../../testprogs/blackbox/subunit.sh
+
+# Correct query is expected to work
+testit "name-to-sid.single-separator" \
+ $wbinfo -n $DOMAIN/$DC_USERNAME || \
+ failed=$(expr $failed + 1)
+
+# Two separator characters should fail
+testit_expect_failure "name-to-sid.double-separator" \
+ $wbinfo -n $DOMAIN//$DC_USERNAME || \
+ failed=$(expr $failed + 1)
+
+# Invalid domain is expected to fail
+testit_expect_failure "name-to-sid.invalid-domain" \
+ $wbinfo -n INVALID/$DC_USERNAME || \
+ failed=$(expr $failed + 1)
+
+# Invalid domain with two separator characters is expected to fail
+testit_expect_failure "name-to-sid.double-separator-invalid-domain" \
+ $wbinfo -n INVALID//$DC_USERNAME || \
+ failed=$(expr $failed + 1)
+
+exit $failed
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 8017d19..e48ad30 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -643,13 +643,17 @@ test_backup_privilege_list()
{
tmpfile=$PREFIX/smbclient_backup_privilege_list

+ # selftest uses the forward slash as a separator, but "net sam rights
+ # grant" requires the backslash separator
+ USER_TMP=$(printf '%s' "$USERNAME" | tr '/' '\\')
+
# If we don't have a DOMAIN component to the username, add it.
- echo "$USERNAME" | grep '\\' 2>&1
+ printf '%s' "$USER_TMP" | grep '\\' 2>&1
ret=$?
if [ $ret != 0 ] ; then
- priv_username="$DOMAIN\\$USERNAME"
+ priv_username="$DOMAIN\\$USER_TMP"
else
- priv_username=$USERNAME
+ priv_username="$USER_TMP"
fi

$NET sam rights grant $priv_username SeBackupPrivilege 2>&1
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index e1b0e35..092605d 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -207,6 +207,10 @@ for env in ["nt4_member", "ad_member"]:
env = "ad_member"
t = "--krb5auth=$DOMAIN/$DC_USERNAME%$DC_PASSWORD"
plantestsuite("samba3.wbinfo_simple.(%s:local).%s" % (env, t), "%s:local" % env, [os.path.join(srcdir(), "nsswitch/tests/test_wbinfo_simple.sh"), t])
+plantestsuite("samba3.wbinfo_name_lookup", env,
+ [ os.path.join(srcdir(),
+ "nsswitch/tests/test_wbinfo_name_lookup.sh"),
+ '$DOMAIN', '$DC_USERNAME' ])
t = "WBCLIENT-MULTI-PING"
plantestsuite("samba3.smbtorture_s3.%s" % t, env, [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//foo/bar', '""', '""', smbtorture3, ""])
plantestsuite("samba3.substitutions", env, [os.path.join(samba3srcdir, "script/tests/test_substitutions.sh"), "$SERVER", "alice", "Secret007", "$PREFIX"])
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 512918e..0b62fd4 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -7777,10 +7777,10 @@ static NTSTATUS smb_set_file_unix_basic(connection_struct *conn,

DEBUG(10,("smb_set_file_unix_basic: SMB_SET_FILE_UNIX_BASIC "
"changing group %u for file %s\n",
- (unsigned int)set_owner,
+ (unsigned int)set_grp,
smb_fname_str_dbg(smb_fname)));
if (fsp && fsp->fh->fd != -1) {
- ret = SMB_VFS_FCHOWN(fsp, set_owner, (gid_t)-1);
+ ret = SMB_VFS_FCHOWN(fsp, (uid_t)-1, set_grp);
} else {
/*
* UNIX extensions calls must always operate
diff --git a/source3/winbindd/winbindd_lookupname.c b/source3/winbindd/winbindd_lookupname.c
index 1be29fd..b022691 100644
--- a/source3/winbindd/winbindd_lookupname.c
+++ b/source3/winbindd/winbindd_lookupname.c
@@ -35,7 +35,8 @@ struct tevent_req *winbindd_lookupname_send(TALLOC_CTX *mem_ctx,
{
struct tevent_req *req, *subreq;
struct winbindd_lookupname_state *state;
- char *domname, *name, *p;
+ const char *domname = NULL, *name = NULL;
+ char *p = NULL;

req = tevent_req_create(mem_ctx, &state,
struct winbindd_lookupname_state);
@@ -49,17 +50,25 @@ struct tevent_req *winbindd_lookupname_send(TALLOC_CTX *mem_ctx,
sizeof(request->data.name.dom_name)-1]='\0';
request->data.name.name[sizeof(request->data.name.name)-1]='\0';

- /* cope with the name being a fully qualified name */
- p = strstr(request->data.name.name, lp_winbind_separator());
- if (p) {
- *p = 0;
- domname = request->data.name.name;
- name = p+1;
- } else if ((p = strchr(request->data.name.name, '@')) != NULL) {
- /* upn */
- domname = p + 1;
- *p = 0;
- name = request->data.name.name;
+ if (strlen(request->data.name.dom_name) == 0) {
+ /* cope with the name being a fully qualified name */
+ p = strstr(request->data.name.name, lp_winbind_separator());
+ if (p != NULL) {
+ *p = '\0';
+ domname = request->data.name.name;
+ name = p + 1;
+ } else {
+ p = strchr(request->data.name.name, '@');
+ if (p != NULL) {
+ /* upn */
+ domname = p + 1;
+ *p = '\0';
+ name = request->data.name.name;
+ } else {
+ domname = "";
+ name = request->data.name.name;
+ }
+ }
} else {
domname = request->data.name.dom_name;
name = request->data.name.name;
--
Samba Shared Repository
Stefan Metzmacher
2018-04-12 20:56:03 UTC
Permalink
The branch, v4-8-test has been updated
via 7e01028 torture: Test compound request request counters
via de39857 s3:smb2_server: correctly maintain request counters for compound requests
from bb5526d winbindd: Do not ignore domain in the LOOKUPNAME request

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


- Log -----------------------------------------------------------------
commit 7e010280ade0834638c58ca7c60ed2f0ff78c112
Author: Volker Lendecke <***@samba.org>
Date: Wed Apr 11 15:11:10 2018 +0200

torture: Test compound request request counters

This will send an unfixed smbd into the

SMB_ASSERT(op->request_count > 0);

in smbd_smb2_request_reply_update_counts

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13215
Signed-off-by: Volker Lendecke <***@samba.org>
Reviewed-by: Stefan Metzmacher <***@samba.org>

Autobuild-User(master): Volker Lendecke <***@samba.org>
Autobuild-Date(master): Thu Apr 12 14:38:39 CEST 2018 on sn-devel-144

(cherry picked from commit 40edd1bc273f664d5567ef5be169033899acee1f)

Autobuild-User(v4-8-test): Stefan Metzmacher <***@samba.org>
Autobuild-Date(v4-8-test): Thu Apr 12 22:55:22 CEST 2018 on sn-devel-144

commit de398573fe753a347cba35666fcf84b30a3307f7
Author: Stefan Metzmacher <***@samba.org>
Date: Wed Apr 11 12:14:59 2018 +0200

s3:smb2_server: correctly maintain request counters for compound requests

If a session expires during a compound request chain,
we exit smbd_smb2_request_dispatch() with
'return smbd_smb2_request_error(req, ...)' before
calling smbd_smb2_request_dispatch_update_counts().

As req->request_counters_updated was only reset
within smbd_smb2_request_dispatch_update_counts(),
smbd_smb2_request_reply_update_counts() was called
twice on the same request, which triggers
SMB_ASSERT(op->request_count > 0);

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13215

Signed-off-by: Stefan Metzmacher <***@samba.org>
Reviewed-by: Volker Lendecke <***@samba.org>
(cherry picked from commit 87e25cd1e45bfe57292b62ffc44ddafc01c61ca0)

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

Summary of changes:
source3/smbd/smb2_server.c | 6 +++-
source4/torture/smb2/compound.c | 77 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index ee03a8e..177e5ff 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -2180,7 +2180,7 @@ static NTSTATUS smbd_smb2_request_dispatch_update_counts(
bool update_open = false;
NTSTATUS status = NT_STATUS_OK;

- req->request_counters_updated = false;
+ SMB_ASSERT(!req->request_counters_updated);

if (xconn->protocol < PROTOCOL_SMB2_22) {
return NT_STATUS_OK;
@@ -2315,6 +2315,8 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)

DO_PROFILE_INC(request);

+ SMB_ASSERT(!req->request_counters_updated);
+
/* TODO: verify more things */

flags = IVAL(inhdr, SMB2_HDR_FLAGS);
@@ -2755,6 +2757,8 @@ static void smbd_smb2_request_reply_update_counts(struct smbd_smb2_request *req)
return;
}

+ req->request_counters_updated = false;
+
if (xconn->protocol < PROTOCOL_SMB2_22) {
return;
}
diff --git a/source4/torture/smb2/compound.c b/source4/torture/smb2/compound.c
index c592308..d2d4d7e 100644
--- a/source4/torture/smb2/compound.c
+++ b/source4/torture/smb2/compound.c
@@ -1030,6 +1030,81 @@ done:
return ret;
}

+static bool test_compound_invalid4(struct torture_context *tctx,
+ struct smb2_tree *tree)
+{
+ struct smb2_create cr;
+ struct smb2_read rd;
+ NTSTATUS status;
+ const char *fname = "compound_invalid4.dat";
+ struct smb2_close cl;
+ bool ret = true;
+ bool ok;
+ struct smb2_request *req[2];
+
+ smb2_transport_credits_ask_num(tree->session->transport, 2);
+
+ smb2_util_unlink(tree, fname);
+
+ ZERO_STRUCT(cr);
+ cr.in.security_flags = 0x00;
+ cr.in.oplock_level = 0;
+ cr.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
+ cr.in.create_flags = 0x00000000;
+ cr.in.reserved = 0x00000000;
+ cr.in.desired_access = SEC_RIGHTS_FILE_ALL;
+ cr.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ cr.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE |
+ NTCREATEX_SHARE_ACCESS_DELETE;
+ cr.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
+ cr.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
+ NTCREATEX_OPTIONS_ASYNC_ALERT |
+ NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
+ 0x00200000;
+ cr.in.fname = fname;
+
+ status = smb2_create(tree, tctx, &cr);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ smb2_transport_compound_start(tree->session->transport, 2);
+
+ ZERO_STRUCT(rd);
+ rd.in.file.handle = cr.out.file.handle;
+ rd.in.length = 1;
+ rd.in.offset = 0;
+ req[0] = smb2_read_send(tree, &rd);
+
+ smb2_transport_compound_set_related(tree->session->transport, true);
+
+ /*
+ * Send a completely bogus request as second compound
+ * element. This triggers smbd_smb2_request_error() in in
+ * smbd_smb2_request_dispatch() before calling
+ * smbd_smb2_request_dispatch_update_counts().
+ */
+
+ req[1] = smb2_request_init_tree(tree, 0xff, 0x04, false, 0);
+ smb2_transport_send(req[1]);
+
+ status = smb2_read_recv(req[0], tctx, &rd);
+ CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
+
+ ok = smb2_request_receive(req[1]);
+ torture_assert(tctx, ok, "Invalid request failed\n");
+ CHECK_STATUS(req[1]->status, NT_STATUS_INVALID_PARAMETER);
+
+ ZERO_STRUCT(cl);
+ cl.in.file.handle = cr.out.file.handle;
+
+ status = smb2_close(tree, &cl);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ smb2_util_unlink(tree, fname);
+done:
+ return ret;
+}
+
/* Send a compound request where we expect the last request (Create, Notify)
* to go asynchronous. This works against a Win7 server and the reply is
* sent in two different packets. */
@@ -1297,6 +1372,8 @@ struct torture_suite *torture_smb2_compound_init(TALLOC_CTX *ctx)
torture_suite_add_1smb2_test(suite, "invalid1", test_compound_invalid1);
torture_suite_add_1smb2_test(suite, "invalid2", test_compound_invalid2);
torture_suite_add_1smb2_test(suite, "invalid3", test_compound_invalid3);
+ torture_suite_add_1smb2_test(
+ suite, "invalid4", test_compound_invalid4);
torture_suite_add_1smb2_test(suite, "interim1", test_compound_interim1);
torture_suite_add_1smb2_test(suite, "interim2", test_compound_interim2);
torture_suite_add_1smb2_test(suite, "compound-break", test_compound_break);
--
Samba Shared Repository
Loading...