[SCM] Samba Shared Repository - branch master updated
The branch, master has been updated via 1fce72f796e samba-tool: Add domain member leave from 8082e2eb7e3 lib/dbwrap: reset deleted record to tdb_null https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 1fce72f796e44e9d7fc40f8f8052d08b5e0b2ec2 Author: David Mulder Date: Thu Nov 4 08:42:06 2021 -0600 samba-tool: Add domain member leave Signed-off-by: David Mulder Reviewed-by: Rowland Penny Autobuild-User(master): David Mulder Autobuild-Date(master): Thu Nov 4 20:43:32 UTC 2021 on sn-devel-184 --- Summary of changes: python/samba/netcmd/domain.py | 31 +++ 1 file changed, 31 insertions(+) Changeset truncated at 500 lines: diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index de6f2b0ca1d..eb52557212e 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -718,6 +718,36 @@ class cmd_domain_join(Command): raise CommandError("Invalid role '%s' (possible values: MEMBER, DC, RODC)" % role) +class cmd_domain_leave(Command): +"""Cause a domain member to leave the joined domain.""" + +synopsis = "%prog [options]" + +takes_optiongroups = { +"sambaopts": options.SambaOptions, +"versionopts": options.VersionOptions, +"credopts": options.CredentialsOptions, +} + +takes_options = [ +Option("--keep-account", action="store_true", + help="Disable the machine account instead of deleting it.") +] + +takes_args = [] + +def run(self, sambaopts=None, credopts=None, versionopts=None, +keep_account=False): +lp = sambaopts.get_loadparm() +creds = credopts.get_credentials(lp) + +s3_lp = s3param.get_context() +smb_conf = lp.configfile if lp.configfile else default_path() +s3_lp.load(smb_conf) +s3_net = s3_Net(creds, s3_lp) +s3_net.leave(keep_account) + + class cmd_domain_demote(Command): """Demote ourselves from the role of Domain Controller.""" @@ -4346,6 +4376,7 @@ class cmd_domain(SuperCommand): subcommands["exportkeytab"] = cmd_domain_export_keytab() subcommands["info"] = cmd_domain_info() subcommands["join"] = cmd_domain_join() +subcommands["leave"] = cmd_domain_leave() if is_ad_dc_built(): subcommands["demote"] = cmd_domain_demote() subcommands["provision"] = cmd_domain_provision() -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated
The branch, master has been updated via 8082e2eb7e3 lib/dbwrap: reset deleted record to tdb_null via 1fa006f1f71 CI: add a test for bug 14882 via c1470b120bb s3/libsmb: check for global parametric option "libsmb:client_guid" from 141f3f5f9a5 s3: smbd: Ensure in the directory scanning loops inside rmdir_internals() we don't overwrite the 'ret' variable. https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 8082e2eb7e33c0993135791c03823886f5aa8496 Author: Ralph Boehme Date: Fri Oct 29 22:03:42 2021 +0200 lib/dbwrap: reset deleted record to tdb_null This allows the calling the following sequence of dbwrap functions: dbwrap_delete_record(rec); data = dbwrap_record_get_value(rec); without triggering the assert rec->value_valid inside dbwrap_record_get_value(). Note that dbwrap_record_storev() continues to invalidate the record, so this change somewhat blurs our semantics. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14882 Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Thu Nov 4 19:49:47 UTC 2021 on sn-devel-184 commit 1fa006f1f71cce03d92e76efda3ff055aae4eb91 Author: Ralph Boehme Date: Fri Oct 29 06:27:38 2021 +0200 CI: add a test for bug 14882 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14882 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison commit c1470b120bb75ea73ba90dc83ab7efcbb733b1a7 Author: Stefan Metzmacher Date: Mon Oct 5 08:52:32 2020 +0200 s3/libsmb: check for global parametric option "libsmb:client_guid" Useful in test. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14882 Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- Summary of changes: lib/dbwrap/dbwrap.c| 9 +-- source3/libsmb/clientgen.c | 9 ++- .../script/tests/test_smbXsrv_client_dead_rec.sh | 76 ++ source3/selftest/tests.py | 7 ++ 4 files changed, 94 insertions(+), 7 deletions(-) create mode 100755 source3/script/tests/test_smbXsrv_client_dead_rec.sh Changeset truncated at 500 lines: diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c index cc685a2fa69..7555efaa3ab 100644 --- a/lib/dbwrap/dbwrap.c +++ b/lib/dbwrap/dbwrap.c @@ -110,16 +110,13 @@ NTSTATUS dbwrap_record_delete(struct db_record *rec) { NTSTATUS status; - /* -* Invalidate before rec->delete_rec() is called, give -* rec->delete_rec() the chance to re-validate rec->value. -*/ - rec->value_valid = false; - status = rec->delete_rec(rec); if (!NT_STATUS_IS_OK(status)) { return status; } + + rec->value = tdb_null; + return NT_STATUS_OK; } diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index a5929ecc7df..5f0b9daf333 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -79,7 +79,14 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx, if (!GUID_all_zero(_state_client_guid)) { client_guid = cli_state_client_guid; } else { - client_guid = GUID_random(); + const char *str = NULL; + + str = lp_parm_const_string(-1, "libsmb", "client_guid", NULL); + if (str != NULL) { + GUID_from_string(str, _guid); + } else { + client_guid = GUID_random(); + } } /* Check the effective uid - make sure we are not setuid */ diff --git a/source3/script/tests/test_smbXsrv_client_dead_rec.sh b/source3/script/tests/test_smbXsrv_client_dead_rec.sh new file mode 100755 index 000..0ed10e78a7a --- /dev/null +++ b/source3/script/tests/test_smbXsrv_client_dead_rec.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# +# Test smbd doesn't crash if there an existing dead record for a client with a +# specific client-guid in smbXsrv_client_global.tdb +# + +if [ $# -lt 2 ]; then +echo Usage: test_smbXsrv_client_dead_rec.sh SERVERCONFFILE IP SHARENAME +exit 1 +fi + +CONF=$1 +SERVER=$2 +SHARE=$3 + +SMBCLIENT="$BINDIR/smbclient" +SMBSTATUS="$BINDIR/smbstatus" + +SMBD_LOG_FILE="$SMBD_TEST_LOG" +if [ -n "$SMBD_DONT_LOG_STDOUT" ]; then + SMBD_LOG_FILE=$(dirname "$SMBD_TEST_LOG")/logs/log.smbd +fi +SMBD_LOG_FILE=$(realpath "$SMBD_LOG_FILE") + +incdir=$(dirname "$0")/../../../testprogs/blackbox +. "$incdir"/subunit.sh + +failed=0 + +cd "$SELFTEST_TMPDIR" || exit 1 + +# +# Note if we already have any panics in the smbd log. +# +panic_count_0=$(grep -c PANIC "$SMBD_LOG_FILE") + +# Create the smbclient communication pipes. +rm -f
[SCM] Samba Shared Repository - branch master updated
The branch, master has been updated via 141f3f5f9a5 s3: smbd: Ensure in the directory scanning loops inside rmdir_internals() we don't overwrite the 'ret' variable. via adfad639096 s3: smbtorture3: Add test for setting delete on close on a directory, then creating a file within to see if delete succeeds. from b919798f575 smbd: early out in is_visible_fsp() https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 141f3f5f9a5ef556cc7864b2afbf8ad48b7ebe77 Author: Jeremy Allison Date: Wed Nov 3 19:02:36 2021 -0700 s3: smbd: Ensure in the directory scanning loops inside rmdir_internals() we don't overwrite the 'ret' variable. If we overwrite with ret=0, we return NT_STATUS_OK even when we goto err. This function should be restructured to use NT_STATUS internally, and make 'int ret' transitory, but that's a patch for another time. Remove knownfail. BUG: BUG: https://bugzilla.samba.org/show_bug.cgi?id=14892 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Thu Nov 4 09:10:27 UTC 2021 on sn-devel-184 commit adfad6390962022277cc6aacaa388af86e46b71c Author: Jeremy Allison Date: Wed Nov 3 16:50:10 2021 -0700 s3: smbtorture3: Add test for setting delete on close on a directory, then creating a file within to see if delete succeeds. Exposes an existing problem where "ret" is overwritten in the directory scan. Add knownfail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14892 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- Summary of changes: source3/selftest/tests.py | 15 + source3/smbd/close.c| 13 +++-- source3/torture/proto.h | 1 + source3/torture/test_smb2.c | 136 source3/torture/torture.c | 4 ++ 5 files changed, 163 insertions(+), 6 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 5aba11c11b1..41ed728a03e 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -256,6 +256,21 @@ plantestsuite("samba3.smbtorture_s3.plain.%s" % "SMB2-LIST-DIR-ASYNC", smbtorture3, "", "-l $LOCAL_PATH"]) +# +# SMB2-DEL-ON-CLOSE-NONEMPTY needs to run against a special fileserver share veto_files_delete +# +plantestsuite("samba3.smbtorture_s3.plain.%s" % "SMB2-DEL-ON-CLOSE-NONEMPTY", +"fileserver", +[os.path.join(samba3srcdir, + "script/tests/test_smbtorture_s3.sh"), +'SMB2-DEL-ON-CLOSE-NONEMPTY', +'//$SERVER_IP/veto_files_delete', +'$USERNAME', +'$PASSWORD', +smbtorture3, +"", +"-l $LOCAL_PATH"]) + shares = [ diff --git a/source3/smbd/close.c b/source3/smbd/close.c index ad10215a4fa..e6272376739 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -1058,6 +1058,7 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp) struct smb_filename *smb_dname_full = NULL; struct smb_filename *direntry_fname = NULL; char *fullname = NULL; + int retval; if (ISDOT(dname) || ISDOTDOT(dname)) { TALLOC_FREE(talloced); @@ -1092,8 +1093,8 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp) goto err; } - ret = SMB_VFS_LSTAT(conn, smb_dname_full); - if (ret != 0) { + retval = SMB_VFS_LSTAT(conn, smb_dname_full); + if (retval != 0) { int saved_errno = errno; TALLOC_FREE(talloced); TALLOC_FREE(fullname); @@ -1136,8 +1137,8 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp) } /* Not a DFS link - could it be a dangling symlink ? */ - ret = SMB_VFS_STAT(conn, smb_dname_full); - if (ret == -1 && (errno == ENOENT || errno == ELOOP)) { + retval = SMB_VFS_STAT(conn, smb_dname_full); + if (retval == -1 && (errno == ENOENT || errno == ELOOP)) { /* * Dangling symlink. * Allow delete as "delete veto files = yes" @@ -1240,8 +1241,8 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp) * Todo: use SMB_VFS_STATX() once that's available. */ -