]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 months agos3/brlock: split out brl_get_locks_readonly_parse()
Stefan Metzmacher [Mon, 6 Jan 2025 14:59:27 +0000 (15:59 +0100)] 
s3/brlock: split out brl_get_locks_readonly_parse()

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

Pair-Programmed-With: Ralph Boehme <slow@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 months agosmbtorture: add test "open-brlock-deadlock"
Ralph Boehme [Thu, 9 Jan 2025 11:27:43 +0000 (12:27 +0100)] 
smbtorture: add test "open-brlock-deadlock"

smbtorture reproducer for bug 15767. As it needs a very specific setup that
can't easily be done in selftest, the test is only executed when manually called
with

  --option=torture:open_brlock_deadlock_timemout=SEC

To prepare the setup for the test set:

  tdb_hash_size:locking.tdb = 1
  tdb_hash_size:brlock.tdb = 1

and remove both tdb from disk which is needed so the TDBs get recreated with the
new hash_size.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agodbwrap: check for option "tdb_hash_size:DBNAME.tdb" in db_open()
Ralph Boehme [Thu, 9 Jan 2025 07:57:17 +0000 (08:57 +0100)] 
dbwrap: check for option "tdb_hash_size:DBNAME.tdb" in db_open()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agos3: Fix use of dbwrap_transaction_cancel() in machine_account_secrets.c
Pavel Filipenský [Thu, 20 Feb 2025 19:33:19 +0000 (20:33 +0100)] 
s3: Fix use of dbwrap_transaction_cancel() in machine_account_secrets.c

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Mar 29 19:02:35 UTC 2025 on atb-devel-224

4 months agopylibsmb: avoid unnecessary check of sid/gid counts
Douglas Bagnall [Thu, 6 Mar 2025 23:01:14 +0000 (12:01 +1300)] 
pylibsmb: avoid unnecessary check of sid/gid counts

This causes compiler conniptions because the check is tautologically
false with 64 bit size_t, while a 32 bit ssize_t that wraps to a
negative number is rejected by PyList_New(). Besides which, out of
bounds access is blocked by PyList_SetItem(), and talloc won't create
arrays that large.

The trouble is picky compilers can say things like:

../../source3/libsmb/pylibsmb.c: In function ‘py_smb_posix_whoami’:
../../source3/libsmb/pylibsmb.c:2226:22: warning: comparison is always
false due to limited range of data type [-Wtype-limits]
 2226 |         if (num_gids > PY_SSIZE_T_MAX) {

 which draws endless but useless developer attention.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agoldb_tdb: wrap can cope with NULL path
Douglas Bagnall [Wed, 27 Nov 2024 20:33:16 +0000 (09:33 +1300)] 
ldb_tdb: wrap can cope with NULL path

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopython:join: do not suppress unexpected DNS enum errors
Douglas Bagnall [Fri, 9 Aug 2024 22:37:24 +0000 (10:37 +1200)] 
python:join: do not suppress unexpected DNS enum errors

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopyldb: consistent results in py_ldb_msg_richcmp
Douglas Bagnall [Mon, 24 Jun 2024 11:02:45 +0000 (23:02 +1200)] 
pyldb: consistent results in py_ldb_msg_richcmp

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agodsdb:group_audit: log_membership_changes: match doxygen to code
Douglas Bagnall [Tue, 17 Jan 2023 21:13:23 +0000 (10:13 +1300)] 
dsdb:group_audit: log_membership_changes: match doxygen to code

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agolib/compression: add a windows python script for test vectors
Douglas Bagnall [Fri, 23 Dec 2022 08:36:26 +0000 (21:36 +1300)] 
lib/compression: add a windows python script for test vectors

The C program we have (generate-windows-test-vectors.c) uses a higher
level API than MS-XCA refers to, which plays tricks like refusing to
do compression if the result would be larger than the original. It
does that because I could not successfully compile something using the
correct RtlCompressBuffer API in Cygwin.

It turns out you don't need to compile anything; using the Python
ctypes library, the Windows libraries are available to Python.

The compression *is* the same, which is what we expected.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agos4/dns/dlz: log when falling back to obsolete dns ldb path
Douglas Bagnall [Fri, 20 Jan 2023 00:07:43 +0000 (13:07 +1300)] 
s4/dns/dlz: log when falling back to obsolete dns ldb path

Prior to 4.8 or so, the dlz dns files were kept in samba/private, but
sharing those files is a bit less than private so a new bind-dns
directory was added. As part of that patch set efforts were made to
fallback gracefully to the old locations. But now that silent grace is
causing confusion; the time has come to fallback resentfully.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months ago.github: CodeQL triggers on current branches
Douglas Bagnall [Fri, 14 Mar 2025 03:53:42 +0000 (16:53 +1300)] 
.github: CodeQL triggers on current branches

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Mar 29 12:38:10 UTC 2025 on atb-devel-224

4 months ago.gitlab: CodeQL runner runs a bootstrap.sh
Douglas Bagnall [Fri, 14 Mar 2025 03:45:18 +0000 (16:45 +1300)] 
.gitlab: CodeQL runner runs a bootstrap.sh

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 months ago.github: add CodeQL workflow
Douglas Bagnall [Fri, 14 Mar 2025 03:21:41 +0000 (16:21 +1300)] 
.github: add CodeQL workflow

This is the automatically generated config file for CodeQL, a code
query language, which can be used to run bespoke static analysis
tasks.

It is currently set to "autobuild" mode, which in Github's terminology
means it tries `./configure && make`, which fails because configure
looks for packages that aren't installed.

In another commit or two we'll add the necessary bootstrap lines, and
perhaps remove some of the unneeded bits.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
4 months agoctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn"
Martin Schwenke [Fri, 14 Mar 2025 06:28:43 +0000 (17:28 +1100)] 
ctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn"

Best reviewed with "git show -w".

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agoctdb-scripts: Add ctdb_diagnostics -l option
yogita72 [Tue, 11 Mar 2025 23:55:19 +0000 (23:55 +0000)] 
ctdb-scripts: Add ctdb_diagnostics -l option

Allows ctdb_diagnostics to be run on the local node without onnode.

Signed-off-by: yogita72 <yogita.bijani@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agosamba-tool backup restore: cope with no sysvol
Douglas Bagnall [Wed, 26 Mar 2025 02:55:33 +0000 (15:55 +1300)] 
samba-tool backup restore: cope with no sysvol

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15661
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Mar 29 08:25:39 UTC 2025 on atb-devel-224

4 months agosamba-tool testparm: avoid lowering debug level
Douglas Bagnall [Wed, 19 Mar 2025 00:53:37 +0000 (13:53 +1300)] 
samba-tool testparm: avoid lowering debug level

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agosamba-tool testparm: drop unsupported options
Douglas Bagnall [Wed, 19 Mar 2025 00:52:34 +0000 (13:52 +1300)] 
samba-tool testparm: drop unsupported options

These have been useless since 2011.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agosamba-tool gpo: use a real XML parser to check entity validity
Douglas Bagnall [Wed, 19 Mar 2025 00:16:12 +0000 (13:16 +1300)] 
samba-tool gpo: use a real XML parser to check entity validity

The expat parser comes with the Python standard library, so we can use
it to check the entities work, rather than relying on a fragile
regular expression.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agosamba-tool gpo: separate function for dtd header generation
Douglas Bagnall [Tue, 18 Mar 2025 23:50:31 +0000 (12:50 +1300)] 
samba-tool gpo: separate function for dtd header generation

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopytest: source_tree_topdir() checks more thoroughly
Douglas Bagnall [Thu, 20 Mar 2025 03:43:41 +0000 (16:43 +1300)] 
pytest: source_tree_topdir() checks more thoroughly

We are more certain of how many ../ steps we are from top than we are
that the existence of a thing called 'source4' is a definite sign
that this is a full source tree. So we check fewer depths and more
subdirectories.

This also modernises the return type to be a pathlib.Path, which works
without change for current callers.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopython: make source_tree_topdir() test-only
Douglas Bagnall [Tue, 18 Mar 2025 23:04:26 +0000 (12:04 +1300)] 
python: make source_tree_topdir() test-only

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agopython: remove unused in_source_tree() function
Douglas Bagnall [Tue, 18 Mar 2025 23:00:02 +0000 (12:00 +1300)] 
python: remove unused in_source_tree() function

We don't use it and don't want non-tests changing their behaviour
based on this kind of thing anyway.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agovfs: Fix Bug 15791, vfs_acl_tdb unlinkat()
Volker Lendecke [Tue, 28 Jan 2025 13:03:49 +0000 (14:03 +0100)] 
vfs: Fix Bug 15791, vfs_acl_tdb unlinkat()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15791
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agovfs: Fix a lock order violation in unlinkat_acl_tdb()
Volker Lendecke [Wed, 26 Feb 2025 15:04:01 +0000 (16:04 +0100)] 
vfs: Fix a lock order violation in unlinkat_acl_tdb()

unlinkat is called when the share mode record is locked.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15791
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 months agovfs_vxfs: pathref fixes
Saurabh Singh [Wed, 12 Mar 2025 09:18:07 +0000 (14:48 +0530)] 
vfs_vxfs: pathref fixes

These fixes are required as after the pathref changes done in vxfs code, set
and get attribute was not working. fsp_get_io_fd(fsp) was returing -1 always.

Signed-off-by: Saurabh Singh <saurabh.singh@veritas.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Mar 28 09:02:10 UTC 2025 on atb-devel-224

4 months agosmbd: fix handling of directory leases and oplock levels
Ralph Boehme [Sat, 22 Mar 2025 15:59:07 +0000 (16:59 +0100)] 
smbd: fix handling of directory leases and oplock levels

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Mar 28 07:53:25 UTC 2025 on atb-devel-224

4 months agosmbtorture: add test smb2.dirlease.oplocks
Ralph Boehme [Sat, 22 Mar 2025 15:57:13 +0000 (16:57 +0100)] 
smbtorture: add test smb2.dirlease.oplocks

Verifies server correctly ignores oplock on directories and only grants leases.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
4 months agolib: Slightly simplify ad_alloc()
Volker Lendecke [Tue, 25 Feb 2025 16:31:16 +0000 (17:31 +0100)] 
lib: Slightly simplify ad_alloc()

Use a struct initialization to avoid talloc_zero()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Mar 27 14:11:11 UTC 2025 on atb-devel-224

4 months agolib: Simplify ad_alloc()
Volker Lendecke [Tue, 25 Feb 2025 16:27:20 +0000 (17:27 +0100)] 
lib: Simplify ad_alloc()

I don't see how "adsize" can be 0 here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agotevent: Fix some whitespace
Volker Lendecke [Sat, 22 Feb 2025 07:12:06 +0000 (08:12 +0100)] 
tevent: Fix some whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Remove some dead code from ad_init()
Volker Lendecke [Tue, 25 Feb 2025 16:35:53 +0000 (17:35 +0100)] 
lib: Remove some dead code from ad_init()

"rc" was never set to anything but 0.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agotevent: Fix some whitespace
Volker Lendecke [Mon, 10 Mar 2025 19:35:59 +0000 (20:35 +0100)] 
tevent: Fix some whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolibcli: Fix whitespace
Volker Lendecke [Tue, 11 Mar 2025 07:30:37 +0000 (08:30 +0100)] 
libcli: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agoloadparm: move log message to a higher log level
Bjoern Jacke [Mon, 10 Mar 2025 10:53:38 +0000 (10:53 +0000)] 
loadparm: move log message to a higher log level

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agoreplace: fix hex_upper -> hexchars_upper
Bjoern Jacke [Thu, 20 Feb 2025 16:14:54 +0000 (16:14 +0000)] 
replace: fix hex_upper -> hexchars_upper

It seems we don't have many systems without a working snprintf anymore...

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Implement snapper_gmt_fstatat()
Volker Lendecke [Fri, 24 Jan 2025 15:37:42 +0000 (16:37 +0100)] 
vfs: Implement snapper_gmt_fstatat()

Make snapper_gmt_stat() and snapper_gmt_lstat() use that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Implement dfq_fstatat()
Volker Lendecke [Tue, 28 Jan 2025 17:38:18 +0000 (18:38 +0100)] 
vfs: Implement dfq_fstatat()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Implement catia_fstatat()
Volker Lendecke [Tue, 28 Jan 2025 11:44:05 +0000 (12:44 +0100)] 
vfs: Implement catia_fstatat()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Implement cap_fstatat()
Volker Lendecke [Tue, 28 Jan 2025 04:58:24 +0000 (05:58 +0100)] 
vfs: Implement cap_fstatat()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Fix typos.
Volker Lendecke [Thu, 20 Mar 2025 17:42:37 +0000 (18:42 +0100)] 
vfs: Fix typos.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agovfs: Fix whitespace
Volker Lendecke [Thu, 20 Mar 2025 17:38:54 +0000 (18:38 +0100)] 
vfs: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agonet: Remove a call to SMB_VFS_STAT and dirfsp==NULL in create_file
Volker Lendecke [Thu, 20 Mar 2025 16:59:55 +0000 (17:59 +0100)] 
net: Remove a call to SMB_VFS_STAT and dirfsp==NULL in create_file

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agonet: Fix a panic in "net vfs getntacl"
Volker Lendecke [Thu, 20 Mar 2025 16:57:11 +0000 (17:57 +0100)] 
net: Fix a panic in "net vfs getntacl"

We have to explicitly free smb_fname, because after openat_pathref_fsp
we have a file descriptor around. If we then later talloc_free() the
connection_struct, fd_handle_destructor() panics because talloc_free()
does not free smb_fname before the connection_struct.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Pass "dirfsp" to ad_collect_one_stream()
Volker Lendecke [Thu, 20 Mar 2025 08:47:15 +0000 (09:47 +0100)] 
lib: Pass "dirfsp" to ad_collect_one_stream()

Avoid a call to SMB_VFS_CREATE_FILE with dirfsp==NULL

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Use dirfsp/relname in ad_unconvert()
Volker Lendecke [Thu, 20 Mar 2025 08:32:39 +0000 (09:32 +0100)] 
lib: Use dirfsp/relname in ad_unconvert()

Replace a call to SMB_VFS_STAT with SMB_VFS_FSTATAT, avoid a call to
SMB_VFS_CREATE_FILE with "dirfsp == NULL".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Add adouble_name()
Volker Lendecke [Thu, 20 Mar 2025 08:30:39 +0000 (09:30 +0100)] 
lib: Add adouble_name()

Just prepend "._" to a relname.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Avoid a VFS_STAT call in "net vfs stream2adouble"
Volker Lendecke [Wed, 19 Mar 2025 16:45:59 +0000 (17:45 +0100)] 
lib: Avoid a VFS_STAT call in "net vfs stream2adouble"

Call filename_convert_dirfsp() in ad_unconvert, which takes care of
proper symlink redirects. This will be used more in further patches.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Convert ad_unconvert() to NTSTATUS
Volker Lendecke [Wed, 19 Mar 2025 16:29:40 +0000 (17:29 +0100)] 
lib: Convert ad_unconvert() to NTSTATUS

Drop error information later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Convert ad_collect_one_stream() to NTSTATUS
Volker Lendecke [Wed, 19 Mar 2025 16:11:49 +0000 (17:11 +0100)] 
lib: Convert ad_collect_one_stream() to NTSTATUS

Drop error information later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Convert ad_unconvert_open_ad() to NTSTATUS
Volker Lendecke [Wed, 19 Mar 2025 16:09:58 +0000 (17:09 +0100)] 
lib: Convert ad_unconvert_open_ad() to NTSTATUS

Drop error information later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agolib: Convert ad_unconvert_get_streams() to NTSTATUS
Volker Lendecke [Wed, 19 Mar 2025 14:49:21 +0000 (15:49 +0100)] 
lib: Convert ad_unconvert_get_streams() to NTSTATUS

Drop error information later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
4 months agosmbd: implement modern write time update logic
Ralph Boehme [Mon, 10 Mar 2025 15:31:13 +0000 (16:31 +0100)] 
smbd: implement modern write time update logic

The gist of this is:

1. A write or other modifications as per MS-FSA "2.1.4.17 Algorithm for Noting
that a File Has Been Modified" immediately update the file times, there's no
delayed update.

2. Setting a timestamp on a handle only disables further timestamp updates via
that handle. Modifications via other handles must still update the timestamps.

This can not be implemented by storing the sticky writetime in the
share_mode_data record for performance reasons, as from 2 it follows that the
record would have to be checked and updated for every write on all handles.

Instead, writes on handles with sticky writetime in effect, record the current
timestamp before the modification and reset the filesystem timestamp to the
recorded value after doing the modification.

For reference, these are the relevant pieces from MS-FSA:

2.1.1.6 Abstract Date Model: Per Open

- UserSetModificationTime: A Boolean that is TRUE if a user has explicitly set
File.LastModificationTime through this Open.

- UserSetChangeTime: A Boolean that is TRUE if a user has explicitly set
File.LastChangeTime through this Open.

- UserSetAccessTime: A Boolean that is TRUE if a user has explicitly set
File.LastAccessTime through this Open.

2.1.4.17 Algorithm for Noting That a File Has Been Modified

The inputs for this algorithm are as follows:
- Open: The Open through which the file was modified.

The pseudocode for the algorithm is as follows:

The object store SHOULD<43>:

- If Open.UserSetModificationTime is FALSE, set Open.File.LastModificationTime
to the current system time.

- If Open.UserSetChangeTime is FALSE, set Open.File.LastChangeTime to the
current system time.

- If Open.UserSetAccessTime is FALSE, set Open.File.LastAccessTime to the
current system time.

- Set Open.File.FileAttributes.FILE_ATTRIBUTE_ARCHIVE to TRUE.

This then gets used for eg writes:

2.1.5.4 Server Requests a Write

...

- The object store MUST note that the file has been modified as specified in
section 2.1.4.17 with Open equal to Open.

...

Note the following differences between Windows behaviour and current
MS-FSA, these are documentation bugs that will be fixed in later
releases as discussed here:

https://lists.samba.org/archive/cifs-protocol/2025-March/004453.html

* When processing FileEndOfFileInformation timestamps must be updated
if new size equals current size

* When processing FileAllocationInformation timestamps must be updated
if new size equals current size

* When processing FileAllocationInformation,
  If (the new allocation size is less than the existing allocation)
    Set the modification time (which will also updates the change time)
  Else
    Update the LastChangeTime

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Mar 27 06:37:31 UTC 2025 on atb-devel-224

4 months agosmbtorture: add "smb2.timestamps.modern_write_time_update-2"
Ralph Boehme [Mon, 10 Mar 2025 18:03:42 +0000 (19:03 +0100)] 
smbtorture: add "smb2.timestamps.modern_write_time_update-2"

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: add "smb2.timestamps.modern_write_time_update-1"
Ralph Boehme [Mon, 3 Mar 2025 15:36:24 +0000 (16:36 +0100)] 
smbtorture: add "smb2.timestamps.modern_write_time_update-1"

This checks for modern Windows timestamp update behaviour over
SMB2. Same as "base.delaywrite.modern_write_time_update-1" but for
SMB2.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: add "base.delaywrite.modern_write_time_update-1"
Ralph Boehme [Thu, 6 Mar 2025 11:01:20 +0000 (12:01 +0100)] 
smbtorture: add "base.delaywrite.modern_write_time_update-1"

The test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "smb2.timestamps.delayed-2write" for modern SMB delayed write
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "smb2.timestamps.delayed-2write" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "smb2.timestamps.delayed-write-vs-setbasic" for modern SMB delayed...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "smb2.timestamps.delayed-write-vs-setbasic" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "smb2.timestamps.delayed-write-vs-flush" for modern SMB delayed...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "smb2.timestamps.delayed-write-vs-flush" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "smb2.timestamps.delayed-write-vs-seteof" for modern SMB delayed...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "smb2.timestamps.delayed-write-vs-seteof" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 6" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 6" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 5b" for modern SMB...
Ralph Boehme [Thu, 6 Mar 2025 17:48:59 +0000 (18:48 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 5b" for modern SMB delayed write

No need to run the loops for so long with modern write time behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 5" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 5" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 4" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 4" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 3c" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 3c" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 3b" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 3b" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 3a" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 3a" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time 3" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time 3" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time using 2 connections...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time using 2 connections" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.update of write time using SET_ALLOCATION_SIZE...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.update of write time using SET_ALLOCATION_SIZE" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.update of write time using SET_END_OF_FILE" for...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.update of write time using SET_END_OF_FILE" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.update of write time and SMBwrite truncate expand...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.update of write time and SMBwrite truncate expand" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.update of write time and SMBwrite truncate" for...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.update of write time and SMBwrite truncate" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.delayed update of write time" for modern SMB...
Ralph Boehme [Tue, 4 Mar 2025 15:32:11 +0000 (16:32 +0100)] 
smbtorture: adjust "base.delaywrite.delayed update of write time" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: adjust "base.delaywrite.finfo update on close" for modern SMB delayed...
Ralph Boehme [Mon, 3 Mar 2025 20:19:55 +0000 (21:19 +0100)] 
smbtorture: adjust "base.delaywrite.finfo update on close" for modern SMB delayed write

The adjusted test passes against Windows Server 2022.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: change variable name in SET_INFO_FILE_EX macro
Ralph Boehme [Mon, 10 Mar 2025 15:18:30 +0000 (16:18 +0100)] 
smbtorture: change variable name in SET_INFO_FILE_EX macro

Allows using the variable name sfinfo in functions that use the macro. No change
in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbtorture: whitespace in test_delayed_write_update2()
Ralph Boehme [Wed, 5 Mar 2025 05:09:40 +0000 (06:09 +0100)] 
smbtorture: whitespace in test_delayed_write_update2()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agolibtorture: add torture_assert_nttime_not_equal[_goto]()
Ralph Boehme [Thu, 6 Mar 2025 11:41:57 +0000 (12:41 +0100)] 
libtorture: add torture_assert_nttime_not_equal[_goto]()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: remove get_change_timespec()
Ralph Boehme [Fri, 14 Mar 2025 06:59:33 +0000 (07:59 +0100)] 
smbd: remove get_change_timespec()

Return ctime from the filesystem instead of mtime. Adjust existing tests
by removing ctime check.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agosmbd: check allocsize change request against current allocsize
Ralph Boehme [Mon, 10 Mar 2025 13:03:33 +0000 (14:03 +0100)] 
smbd: check allocsize change request against current allocsize

Cf MS-FSA 2.1.5.15.1 FileAllocationInformation:

  If Open.Stream.AllocationSize is equal to NewAllocationSize,
  the operation MUST return STATUS_SUCCESS.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 months agomanpages:smb.conf: disable roaming profiles with 'logon path ='
Douglas Bagnall [Thu, 20 Mar 2025 21:28:23 +0000 (10:28 +1300)] 
manpages:smb.conf: disable roaming profiles with 'logon path ='

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Mar 26 01:51:40 UTC 2025 on atb-devel-224

4 months agomanpages:net: use &doc.version;
Douglas Bagnall [Thu, 20 Mar 2025 00:23:00 +0000 (13:23 +1300)] 
manpages:net: use &doc.version;

and we don't claim it is "complete", which *maybe* was true for
3.0.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agodoc: mention an smbspool / krb5 detail
Björn Jacke [Wed, 28 Aug 2013 20:53:17 +0000 (22:53 +0200)] 
doc: mention an smbspool / krb5 detail

argv[2] (username) is being used for krb5 ticket cache. Thanks to
Christian Perrier.

REF: https://bugs.debian.org/387266
BUG: https://bugzilla.samba.org/show_bug.cgi?id=4104

Signed-off-by: Björn Jacke <bjacke@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agomanpages:vfs_shell_snap: format smbconf examples on one line
Douglas Bagnall [Wed, 19 Mar 2025 03:20:20 +0000 (16:20 +1300)] 
manpages:vfs_shell_snap: format smbconf examples on one line

The HTML version has been looking like:

    [share]
    vfs objects = shell_snap
    shell_snap:check path command =
       snap_check_path.sh
    shell_snap:create command =
       snap_create.sh
    shell_snap:delete command =
       snap_delete.sh

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agomanpages: avoid extra blank line at end of <programlisting>
Douglas Bagnall [Wed, 19 Mar 2025 03:13:46 +0000 (16:13 +1300)] 
manpages: avoid extra blank line at end of <programlisting>

Any whitespace there makes the program listing an extra line longer in
HTML put which is probably never intentional.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agosamba-tool domain backup: add --no-sysvol option
Thomas Karlsson [Wed, 19 Mar 2025 01:40:22 +0000 (14:40 +1300)] 
samba-tool domain backup: add --no-sysvol option

In some circumstances sysvol is not wanted in a backup.

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

Signed-off-by: Thomas Karlsson <thomas.karlsson@relea.se>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agopython:gp_cert_auto_enrol: fix GUID stringification
Douglas Bagnall [Mon, 24 Mar 2025 22:26:12 +0000 (22:26 +0000)] 
python:gp_cert_auto_enrol: fix GUID stringification

We were using some broken ad-hoc unpacking to do what the ndr
unpacker does perfectly well.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Tue Mar 25 05:21:49 UTC 2025 on atb-devel-224

4 months agosamba-tool gpo: better entities check copes with new lines
Douglas Bagnall [Fri, 14 Mar 2025 04:45:18 +0000 (17:45 +1300)] 
samba-tool gpo: better entities check copes with new lines

Per https://www.w3.org/TR/xml/#sec-entity-decl (and MS references)
there is always some whitespace between '<!ENTITY' and the name, and
between the name and whatever is next. Also, it is valid XML to have
newlines inside entity declarations, like this:

<!ENTITY
    bubble
      "*S-1-5-113"
      >

We used to create such files, so we should allow them.

There is a kind of entity that has '%' before the name, and there are
non-ascii names, which we continue not to support.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agosamba-tool gpo backup fix --generalize
Douglas Bagnall [Fri, 14 Mar 2025 08:55:29 +0000 (21:55 +1300)] 
samba-tool gpo backup fix --generalize

This was broken with commit ce56d336f234febfd4cb3da11dd584842c24ce1d
but we didn't notice because the test was already broken.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agopytest: samba-tool gpo: fix has_difference(sortlines=True)
Douglas Bagnall [Fri, 14 Mar 2025 06:52:57 +0000 (19:52 +1300)] 
pytest: samba-tool gpo: fix has_difference(sortlines=True)

We had

             file1 = open(path1).readlines()
             file1.sort()
             file2 = open(path1).readlines()
             file2.sort()

which is opening path1 in both cases.

This meant we were testing nothing because the assertions are all that
the files are the same -- though the only affected check is one in
test_backup_restore_generalize().

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agopython:netcmd:gpo: fix crash when updating an MOTD GPO
Andreas Hasenack [Tue, 18 Feb 2025 15:43:46 +0000 (12:43 -0300)] 
python:netcmd:gpo: fix crash when updating an MOTD GPO

When the policy exists already, there is no exception and the code
tries to use the "data" variable, but it doesn't exist because it was
only defined in the exception handling.

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

Signed-off-by: Andreas Hasenack <andreas.hasenack@canonical.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agopytest: check we can set GPO more than once
Douglas Bagnall [Fri, 14 Mar 2025 05:22:53 +0000 (18:22 +1300)] 
pytest: check we can set GPO more than once

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agopytest: samba-tool gpo: close opened files
Douglas Bagnall [Fri, 14 Mar 2025 06:48:54 +0000 (19:48 +1300)] 
pytest: samba-tool gpo: close opened files

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agosamba-tool gpo: close opened files
Douglas Bagnall [Fri, 14 Mar 2025 06:47:53 +0000 (19:47 +1300)] 
samba-tool gpo: close opened files

It is almost certain that we are not going to run out of files, as
they get garbage collected anyway, but in some circumstances these can
fill your screen with "ResourceWarning: unclosed file" messages, which
hides the real messages.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
4 months agopython:ntacls: pull allow list out of loop
Douglas Bagnall [Fri, 7 Mar 2025 02:51:18 +0000 (15:51 +1300)] 
python:ntacls: pull allow list out of loop

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Mar 19 15:56:38 UTC 2025 on atb-devel-224

4 months agopython/ntacls.py: only allow allow and deny ACEs in setntacl()
Ralph Boehme [Mon, 31 Jul 2023 13:24:19 +0000 (15:24 +0200)] 
python/ntacls.py: only allow allow and deny ACEs in setntacl()

Commit 27dd0afb62d4f7427c966e984c7c8b01bc4d93b5 introduced a
regression.

Before that commit we included only SEC_ACE_TYPE_ACCESS_ALLOWED(0)
as 'not type & SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT' filtered out
SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT(5), but also
SEC_ACE_TYPE_ACCESS_DENIED and SEC_ACE_TYPE_ACCESS_DENIED_OBJECT.

After that commit we started to include
SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT, which is wrong.

It was also always wrong to exclude SEC_ACE_TYPE_ACCESS_DENIED(1).

So now we make it explicit that we only include
SEC_ACE_TYPE_ACCESS_ALLOWED and SEC_ACE_TYPE_ACCESS_DENIED.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 months agopython/provision: avoid SDDL conversion in set_dir_acl()
Ralph Boehme [Mon, 31 Jul 2023 13:56:26 +0000 (15:56 +0200)] 
python/provision: avoid SDDL conversion in set_dir_acl()

This is not needed and has the potential to loose
information if the sddl code wouldn't have all features
implemented.

No intended change in behaviour.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 months agopython/policies.py: avoid SDDL conversion for dsacl2fsacl
Ralph Boehme [Mon, 31 Jul 2023 13:56:26 +0000 (15:56 +0200)] 
python/policies.py: avoid SDDL conversion for dsacl2fsacl

This is not needed and has the potential to loose
information if the sddl code wouldn't have all features
implemented.

No intended change in behaviour.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
4 months agopython/gpo.py: avoid SDDL conversion for dsacl2fsacl
Ralph Boehme [Mon, 31 Jul 2023 13:56:26 +0000 (15:56 +0200)] 
python/gpo.py: avoid SDDL conversion for dsacl2fsacl

This is not needed and has the potential to loose
information if the sddl code wouldn't have all features
implemented.

No intended change in behaviour.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>