]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
13 months agotests/krb5: Add tests for errors produced when logging in with unusable accounts
Jo Sutton [Thu, 27 Jun 2024 00:29:52 +0000 (12:29 +1200)] 
tests/krb5: Add tests for errors produced when logging in with unusable accounts

Heimdal matches Windows in the no‐FAST case, but produces NTSTATUS codes
when it shouldn’t in the FAST case.

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

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
13 months agotests/krb5: Allow creation of disabled accounts for testing
Jo Sutton [Tue, 25 Jun 2024 00:51:48 +0000 (12:51 +1200)] 
tests/krb5: Allow creation of disabled accounts for testing

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

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
13 months agoctdb-failover: Split statd_callout add-client/del-client
Martin Schwenke [Fri, 10 May 2024 01:42:26 +0000 (11:42 +1000)] 
ctdb-failover: Split statd_callout add-client/del-client

rpc.statd is single-threaded and runs its HA callout synchronously. If
it is too slow then latency accumulates and rpc.statd's backlog grows.

Running a pair of add-client/del-client events with the current code
averages ~0.030s in my test environment.  This mean that 1000 clients
reclaiming locks after failover can easily cause 10s of latency.  This
could cause rpc.statd to become unresponsive, resulting in a time out
for an rpcinfo-based health check of the status service.

Split the add-client/del-client events out to a standalone
statd_callout executable, written in C, to be used as the HA callout
for rpc.statd.  All other functions move to statd_callout_helper.
Now, running a pair of add-client/del-client events in my test
environment averages only ~0.002s.  This seems less likely to cause
latency problems.

The standalone statd_callout executable needs to read a configuration
file, which is generated by statd_callout_helper from the "startup"
event.  It also needs access to a list of currently assigned public
IPs.

For backward compatibility, during installation a symlink is created
from $CTDB_BASE/statd-callout to the new statd_callout, which is
installed in the helper directory.

Testing this as part of the eventscript unit tests starts to become
even more of a hack than it used to be.  However, the dependency on
stubs and the corresponding setup of fake state makes it hard to move
this elsewhere.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Jun 25 04:24:57 UTC 2024 on atb-devel-224

13 months agoctdb-doc: Drop unnecessary, broken attempt at rpc.statd stack trace
Martin Schwenke [Mon, 4 Mar 2024 03:29:41 +0000 (14:29 +1100)] 
ctdb-doc: Drop unnecessary, broken attempt at rpc.statd stack trace

There is a typo here, since there will be no process called "status".
Instead of fixing it, drop this because rpc.statd isn't the focus of
this monitoring check and when systemd is init rpc.statd isn't
restarted with nfs-ganesha.  It stays running, so a confusing stack
trace for rpc.statd is always logged.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
13 months agoctdb-scripts: Fail monitoring after 1 x NFS-Ganesha not running
Martin Schwenke [Fri, 24 May 2024 01:55:59 +0000 (11:55 +1000)] 
ctdb-scripts: Fail monitoring after 1 x NFS-Ganesha not running

If ganesha.nfsd is gone then a node can't provide an NFS service, so
should be marked unhealthy.  A later restart may bring it back to
health.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
13 months agoctdb-doc: Add example for NFS-Ganesha RPC checking
Martin Schwenke [Mon, 4 Mar 2024 03:28:11 +0000 (14:28 +1100)] 
ctdb-doc: Add example for NFS-Ganesha RPC checking

This one does an rpcinfo check, along with statistics mitigation.  It
can be used in combination with the existing 20.nfs_ganesha.check.

The equivalent kernel NFS file only restarts every 10 failures.  This
one can be a little more proactive given that false positives are less
likely with the statistics mitigation.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
13 months agoctdb-scripts: Implement NFS statistics retrieval for NFS-Ganesha
Martin Schwenke [Mon, 4 Mar 2024 02:52:10 +0000 (13:52 +1100)] 
ctdb-scripts: Implement NFS statistics retrieval for NFS-Ganesha

Simplicity is preferred here over absolute correctness.  If the
ganesha_stats command exits with an error or times out then no output
is produced so, implicitly, the statistics do not change.  Also, the
statistics always change at startup.  However, it is likely that the
statistics change when NFS makes progress and do not change when NFS
does not make progress.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
13 months agoctdb-scripts: Add service_stats_command variable to NFS checks
Martin Schwenke [Mon, 19 Feb 2024 10:42:11 +0000 (21:42 +1100)] 
ctdb-scripts: Add service_stats_command variable to NFS checks

When monitoring an RPC service, the rpcinfo command might time out
even though the service is making progress.  In this case, it is just
slow, so counting the timeout as a failure and potentially restarting
the service will not help.  The problem is determining if a service is
making progress.

Add a new NFS checks service_stats_command.  This command is intended
to run a statistics command.  The output is naively compared using
cmp(1).  If the output changes then rpcinfo failures are converted to
successes.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
13 months agosmbd: Simplify callers of notify_filter_string
Volker Lendecke [Thu, 20 Jun 2024 18:25:24 +0000 (20:25 +0200)] 
smbd: Simplify callers of notify_filter_string

This is exactly the application talloc_tos() was made for

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jun 24 17:27:04 UTC 2024 on atb-devel-224

13 months agosmbd: Simplify notify_filter_string
Volker Lendecke [Thu, 20 Jun 2024 18:19:52 +0000 (20:19 +0200)] 
smbd: Simplify notify_filter_string

Just a single NULL check through talloc_asprintf_addbuf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbd: Modernize a DEBUG
Volker Lendecke [Thu, 20 Jun 2024 18:06:44 +0000 (20:06 +0200)] 
smbd: Modernize a DEBUG

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agolib: Align an integer type
Volker Lendecke [Mon, 17 Jun 2024 10:45:32 +0000 (12:45 +0200)] 
lib: Align an integer type

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbd: Simplify smbd_do_qfilepathinfo()
Volker Lendecke [Mon, 17 Jun 2024 13:24:57 +0000 (15:24 +0200)] 
smbd: Simplify smbd_do_qfilepathinfo()

Use fsctl_get_reparse_tag()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agolib: Avoid an includes.h
Volker Lendecke [Mon, 10 Jun 2024 12:32:27 +0000 (14:32 +0200)] 
lib: Avoid an includes.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agolib: Move 286 bytes from R/W data to R/O text segment
Volker Lendecke [Mon, 10 Jun 2024 14:08:04 +0000 (16:08 +0200)] 
lib: Move 286 bytes from R/W data to R/O text segment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agotdb: Update times in tdb_transaction_commit per fd, not per name
Volker Lendecke [Fri, 14 Jun 2024 15:48:52 +0000 (17:48 +0200)] 
tdb: Update times in tdb_transaction_commit per fd, not per name

We might have a relative filename in tdb->name, so we might do the
wrong thing here. And as we have the fd, why not use it...

We call futimens in vfs_default without #ifdef and it's Posix 2018 or
before. So I don't think we need to check for it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbd: Fix DEBUG messages
Volker Lendecke [Fri, 14 Jun 2024 16:28:10 +0000 (18:28 +0200)] 
smbd: Fix DEBUG messages

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agocredentials: Protect the cred's nt hash with talloc_keep_secret
Volker Lendecke [Fri, 24 May 2024 15:16:14 +0000 (17:16 +0200)] 
credentials: Protect the cred's nt hash with talloc_keep_secret

This avoids the need for an explict ZERO_STRUCT before TALLOC_FREE

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agospnego: Fix typos
Volker Lendecke [Thu, 30 May 2024 12:06:39 +0000 (14:06 +0200)] 
spnego: Fix typos

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agogensec: Fix whitespace
Volker Lendecke [Thu, 30 May 2024 12:04:51 +0000 (14:04 +0200)] 
gensec: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agogse: Simplify gse_errstr() with talloc_asprintf_addbuf()
Volker Lendecke [Wed, 29 May 2024 15:27:11 +0000 (17:27 +0200)] 
gse: Simplify gse_errstr() with talloc_asprintf_addbuf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agogse: Avoid explicit ZERO_STRUCT in gse_errstr()
Volker Lendecke [Wed, 29 May 2024 15:25:54 +0000 (17:25 +0200)] 
gse: Avoid explicit ZERO_STRUCT in gse_errstr()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agolibsmb: "clang-format" for an if-condition
Volker Lendecke [Fri, 31 May 2024 09:42:45 +0000 (11:42 +0200)] 
libsmb: "clang-format" for an if-condition

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agolib: Remove pointless \ line endings
Volker Lendecke [Fri, 31 May 2024 09:41:28 +0000 (11:41 +0200)] 
lib: Remove pointless \ line endings

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agotdb: Fix a typo
Volker Lendecke [Fri, 31 May 2024 06:51:45 +0000 (08:51 +0200)] 
tdb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agoheimdal_build: Fix whitespace
Volker Lendecke [Mon, 29 Apr 2024 11:11:36 +0000 (13:11 +0200)] 
heimdal_build: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agotorture4: Fix some whitespace
Volker Lendecke [Fri, 31 May 2024 19:28:50 +0000 (21:28 +0200)] 
torture4: Fix some whitespace

Review with "git show -w"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agopackaging: Add missing quotes in smbprint
Andreas Schneider [Wed, 19 Jun 2024 09:50:26 +0000 (11:50 +0200)] 
packaging: Add missing quotes in smbprint

Found by Covscan.

"Error: SHELLCHECK_WARNING (CWE-569):
/usr/bin/smbprint:49:21: warning[SC1083]: This } is literal. Check expression (missing ;/\n?) or quote it.
   47|   #   Concat this with /.config to get the config file.
   48|   #
   49|-> eval acct_file=\${$#}
   50|   spool_dir=$(dirname $acct_file)
   51|   config_file=$spool_dir/.config"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jun 24 07:14:54 UTC 2024 on atb-devel-224

13 months agos3:registry: Add missing return value checks
Andreas Schneider [Wed, 19 Jun 2024 09:47:41 +0000 (11:47 +0200)] 
s3:registry: Add missing return value checks

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agos3:registry: Avoid possible double frees
Andreas Schneider [Wed, 19 Jun 2024 09:46:15 +0000 (11:46 +0200)] 
s3:registry: Avoid possible double frees

Found by Covscan.

"Error: USE_AFTER_FREE (CWE-416):
samba-4.20.0rc2/source3/registry/reg_perfcount.c:309: freed_arg: ""_reg_perfcount_multi_sz_from_tdb"" frees ""*retbuf"".
samba-4.20.0rc2/source3/registry/reg_perfcount.c:313: double_free: Calling ""_reg_perfcount_multi_sz_from_tdb"" frees pointer ""*retbuf"" which has already been freed.
  311|    for(i = 1; i <= base_index; i++)
  312|    {
  313|->  buffer_size = _reg_perfcount_multi_sz_from_tdb(names, i*2, retbuf, buffer_size);
  314|    }
  315|    tdb_close(names);"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agos3:registry: Remove trailing spaces in reg_perfcount.c
Andreas Schneider [Wed, 19 Jun 2024 09:45:01 +0000 (11:45 +0200)] 
s3:registry: Remove trailing spaces in reg_perfcount.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agos4:dsdb: Avoid possible underflows with new_len
Andreas Schneider [Wed, 19 Jun 2024 09:33:00 +0000 (11:33 +0200)] 
s4:dsdb: Avoid possible underflows with new_len

Found by Covscan.

"Error: INTEGER_OVERFLOW (CWE-190):
samba-4.20.0rc2/source4/dsdb/schema/schema_query.c:403: tainted_data_argument: The check ""i < new_len"" contains the tainted expression ""i"" which causes ""new_len"" to be considered tainted.
samba-4.20.0rc2/source4/dsdb/schema/schema_query.c:407: overflow: The expression ""new_len - i"" is deemed underflowed because at least one of its arguments has underflowed.
samba-4.20.0rc2/source4/dsdb/schema/schema_query.c:407: overflow: The expression ""(new_len - i) * 8UL"" is deemed underflowed because at least one of its arguments has underflowed.
samba-4.20.0rc2/source4/dsdb/schema/schema_query.c:407: overflow_sink: ""(new_len - i) * 8UL"", which might have underflowed, is passed to ""memmove(val1, val2, (new_len - i) * 8UL)"". [Note: The source code implementation of the function has been overridden by a builtin model.]
  405|    const char **val2 = &attr_list[i];
  406|    if (ldb_attr_cmp(*val1, *val2) == 0) {
  407|->  memmove(val1, val2, (new_len - i) * sizeof( *attr_list));
  408|    attr_list[new_len-1] = NULL;
  409|    new_len--;"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agos4:dsdb: Remove trailing spaces in schema_query.c
Andreas Schneider [Wed, 19 Jun 2024 09:26:12 +0000 (11:26 +0200)] 
s4:dsdb: Remove trailing spaces in schema_query.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agos4:torture: Initialize struct wrepl_wins_name
Andreas Schneider [Wed, 19 Jun 2024 09:21:12 +0000 (11:21 +0200)] 
s4:torture: Initialize struct wrepl_wins_name

Found by Covscan.

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/nbt/winsreplication.c:5040: var_decl: Declaring variable ""wins_name_"" without initializer.
samba-4.20.0rc2/source4/torture/nbt/winsreplication.c:5041: assign: Assigning: ""wins_name"" = ""&wins_name_"", which points to uninitialized data.
samba-4.20.0rc2/source4/torture/nbt/winsreplication.c:6680: uninit_use_in_call: Using uninitialized value ""*wins_name"". Field ""wins_name->is_group"" is uninitialized when calling ""test_wrepl_update_one"".
 6678|    wins_name->unknown = ""255.255.255.255"";
 6679|
 6680|->  ret &= test_wrepl_update_one(tctx, ctx, &ctx->b, wins_name);
 6681|    ret &= test_wrepl_is_applied(tctx, ctx, &ctx->b, wins_name, true);
 6682|    } else {"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agos4:torture: Remove trailing spaces in winsreplication.c
Andreas Schneider [Wed, 19 Jun 2024 09:20:37 +0000 (11:20 +0200)] 
s4:torture: Remove trailing spaces in winsreplication.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agos3:utils: Fix get_window_height() return value
Andreas Schneider [Wed, 19 Jun 2024 09:17:22 +0000 (11:17 +0200)] 
s3:utils: Fix get_window_height() return value

Found by Covscan.

"Error: INTEGER_OVERFLOW (CWE-190):
samba-4.20.0rc2/source3/utils/regedit_list.c:522: tainted_data_return: Called function ""get_window_height(list)"", and a possible return value may be less than zero.
samba-4.20.0rc2/source3/utils/regedit_list.c:522: cast_underflow: An assign of a possibly negative number to an unsigned type, which might trigger an underflow.
samba-4.20.0rc2/source3/utils/regedit_list.c:526: overflow: The expression ""list->cursor_row -= page"" is deemed underflowed because at least one of its arguments has underflowed.
samba-4.20.0rc2/source3/utils/regedit_list.c:529: overflow_sink: ""list->cursor_row"", which might have underflowed, is passed to ""data_get_row_n(list, list->cursor_row)"".
  527|    list->start_row -= page;
  528|    }
  529|->  tmp = data_get_row_n(list, list->cursor_row);
  530|    break;
  531|    case ML_CURSOR_PGDN:"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agos3:rpc_server: Make sure struct security_ace is initialized
Andreas Schneider [Tue, 18 Jun 2024 13:57:45 +0000 (15:57 +0200)] 
s3:rpc_server: Make sure struct security_ace is initialized

Found by Covscan.

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source3/rpc_server/samr/srv_samr_nt.c:235: var_decl: Declaring variable ""ace"" without initializer.
samba-4.20.0rc2/source3/rpc_server/samr/srv_samr_nt.c:269: uninit_use_in_call: Using uninitialized value ""*ace"". Field ""ace->object"" is uninitialized when calling ""make_sec_acl"".
  267|    /* create the security descriptor */
  268|
  269|->  if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) == NULL)
  270|    return NT_STATUS_NO_MEMORY;
  271|"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agos3:lib: Make sure struct security_ace is fully initialized
Andreas Schneider [Tue, 18 Jun 2024 13:48:38 +0000 (15:48 +0200)] 
s3:lib: Make sure struct security_ace is fully initialized

Found by Covscan.

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source3/lib/sharesec.c:275: var_decl: Declaring variable ""ace"" without initializer.
samba-4.20.0rc2/source3/lib/sharesec.c:285: uninit_use_in_call: Using uninitialized value ""ace"". Field ""ace.object"" is uninitialized when calling ""make_sec_acl"".
  283|    init_sec_ace(&ace, &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, sa, 0);
  284|
  285|->  if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, 1, &ace)) != NULL) {
  286|    psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1,
  287|        SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL,"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agos3:lib: Remove trailing spaces in sharesec.c
Andreas Schneider [Tue, 18 Jun 2024 13:48:17 +0000 (15:48 +0200)] 
s3:lib: Remove trailing spaces in sharesec.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agonsswitch:krb5_plugin: Avoid a possible double free
Andreas Schneider [Tue, 18 Jun 2024 13:45:53 +0000 (15:45 +0200)] 
nsswitch:krb5_plugin: Avoid a possible double free

Found by Covscan.

"Error: USE_AFTER_FREE (CWE-416):
samba-4.20.0rc2/nsswitch/krb5_plugin/winbind_krb5_localauth.c:122: freed_arg: ""wbcFreeMemory"" frees ""pwd"".
samba-4.20.0rc2/nsswitch/krb5_plugin/winbind_krb5_localauth.c:144: pass_freed_arg: Passing freed pointer ""pwd"" as an argument to ""wbcFreeMemory"".
  142|    break;
  143|    }
  144|->  wbcFreeMemory(pwd);
  145|    if (code != 0) {
  146|    goto out;"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
13 months agoauth/credentials: don't ignore "client use kerberos" and --use-kerberos for machine...
Stefan Metzmacher [Tue, 18 Jun 2024 18:28:25 +0000 (20:28 +0200)] 
auth/credentials: don't ignore "client use kerberos" and --use-kerberos for machine accounts

We only turn desired into off in the NT4 domain member case.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jun 19 10:17:28 UTC 2024 on atb-devel-224

13 months agoauth/credentials: add tests for cli_credentials_get_kerberos_state[_obtained]()
Stefan Metzmacher [Tue, 18 Jun 2024 17:02:05 +0000 (19:02 +0200)] 
auth/credentials: add tests for cli_credentials_get_kerberos_state[_obtained]()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agoauth/credentials: add cli_credentials_get_kerberos_state_obtained() helper
Stefan Metzmacher [Tue, 18 Jun 2024 16:53:48 +0000 (18:53 +0200)] 
auth/credentials: add cli_credentials_get_kerberos_state_obtained() helper

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agotestprogs/blackbox: add test_ldap_token.sh to test "client use kerberos" and --use...
Stefan Metzmacher [Tue, 18 Jun 2024 17:34:30 +0000 (19:34 +0200)] 
testprogs/blackbox: add test_ldap_token.sh to test "client use kerberos" and --use-kerberos

This shows that they are ignored for machine accounts as domain member.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agotestprogs/blackbox: let test_trust_token.sh check for S-1-18-1 with kerberos
Stefan Metzmacher [Tue, 18 Jun 2024 17:11:09 +0000 (19:11 +0200)] 
testprogs/blackbox: let test_trust_token.sh check for S-1-18-1 with kerberos

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agovfs_recycle: remember resolved config->repository in vfs_recycle_connect()
Stefan Metzmacher [Fri, 14 Jun 2024 08:07:02 +0000 (10:07 +0200)] 
vfs_recycle: remember resolved config->repository in vfs_recycle_connect()

This should not change during the lifetime of the tcon.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agoRevert "TMP-REPRODUCE: vfs_recycle: demonstrate memory corruption in recycle_unlink_i...
Stefan Metzmacher [Tue, 18 Jun 2024 12:18:17 +0000 (14:18 +0200)] 
Revert "TMP-REPRODUCE: vfs_recycle: demonstrate memory corruption in recycle_unlink_internal()"

This was only added to demonstrate the problem more reliable.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agovfs_recycle: fix memory hierarchy
Stefan Metzmacher [Fri, 14 Jun 2024 08:07:02 +0000 (10:07 +0200)] 
vfs_recycle: fix memory hierarchy

If the configuration is reloaded strings and string lists
in recycle_config_data could become stale pointers
leading to segmentation faults...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agovfs_recycle: use the correct return in SMB_VFS_HANDLE_GET_DATA()
Stefan Metzmacher [Fri, 14 Jun 2024 08:07:02 +0000 (10:07 +0200)] 
vfs_recycle: use the correct return in SMB_VFS_HANDLE_GET_DATA()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agovfs_recycle: use a talloc_stackframe() in recycle_unlink_internal()
Stefan Metzmacher [Fri, 14 Jun 2024 08:07:02 +0000 (10:07 +0200)] 
vfs_recycle: use a talloc_stackframe() in recycle_unlink_internal()

That makes the cleanup more clear...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agovfs_recycle: directly allocate smb_fname_final->base_name
Stefan Metzmacher [Fri, 14 Jun 2024 08:07:02 +0000 (10:07 +0200)] 
vfs_recycle: directly allocate smb_fname_final->base_name

We can use talloc_asprintf() instead of asprintf() followed
by talloc_strdup().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agovfs_recycle: don't unlink on allocation failure
Stefan Metzmacher [Fri, 14 Jun 2024 08:07:02 +0000 (10:07 +0200)] 
vfs_recycle: don't unlink on allocation failure

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agoTMP-REPRODUCE: vfs_recycle: demonstrate memory corruption in recycle_unlink_internal()
Stefan Metzmacher [Fri, 14 Jun 2024 11:40:35 +0000 (13:40 +0200)] 
TMP-REPRODUCE: vfs_recycle: demonstrate memory corruption in recycle_unlink_internal()

Forcing a reload of the smb.conf option values means the pointer learned
in vfs_recycle_connect() become stale.

This will be reverted at the end of the patset again.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agotest_recycle.sh: make sure we don't see panics on the log files
Stefan Metzmacher [Fri, 14 Jun 2024 11:40:35 +0000 (13:40 +0200)] 
test_recycle.sh: make sure we don't see panics on the log files

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
13 months agovfs_default: also call vfs_offload_token_ctx_init in vfswrap_offload_write_send
Stefan Metzmacher [Mon, 17 Jun 2024 08:41:53 +0000 (10:41 +0200)] 
vfs_default: also call vfs_offload_token_ctx_init in vfswrap_offload_write_send

If a client for whatever reason calls FSCTL_SRV_COPYCHUNK[_WRITE] without
FSCTL_SRV_REQUEST_RESUME_KEY, we call vfswrap_offload_write_send
before vfswrap_offload_read_send.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jun 17 18:02:27 UTC 2024 on atb-devel-224

13 months agos4:torture/smb2: add smb2.ioctl.copy_chunk_bug15644
Stefan Metzmacher [Mon, 17 Jun 2024 09:18:07 +0000 (11:18 +0200)] 
s4:torture/smb2: add smb2.ioctl.copy_chunk_bug15644

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
13 months agoctdb/docs: Include ceph rados namespace support in man page
Günther Deschner [Fri, 7 Jun 2024 09:10:07 +0000 (14:40 +0530)] 
ctdb/docs: Include ceph rados namespace support in man page

Document the new optional argument to specify the namespace to be
associated with RADOS objects in a pool.

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Fri Jun 14 07:42:25 UTC 2024 on atb-devel-224

13 months agoctdb/ceph: Add optional namespace support for mutex helper
Günther Deschner [Fri, 7 Jun 2024 09:09:37 +0000 (14:39 +0530)] 
ctdb/ceph: Add optional namespace support for mutex helper

RADOS objects within a pool can be associated to a namespace for
logical separation. librados already provides an API to configure
such a namespace with respect to a context. Make use of it as an
optional argument to the helper binary.

Pair-Programmed-With: Anoop C S <anoopcs@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
13 months agogitlab-ci: Update image to Fedora 40
Andreas Schneider [Tue, 30 Apr 2024 09:30:48 +0000 (11:30 +0200)] 
gitlab-ci: Update image to Fedora 40

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jun 13 13:29:48 UTC 2024 on atb-devel-224

13 months agogitlab-ci: Add CentOS 9 Stream
Andreas Schneider [Fri, 7 Jun 2024 12:16:28 +0000 (14:16 +0200)] 
gitlab-ci: Add CentOS 9 Stream

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agogitlab-ci: Remove CentOS7 which is EOL
Andreas Schneider [Fri, 7 Jun 2024 12:09:43 +0000 (14:09 +0200)] 
gitlab-ci: Remove CentOS7 which is EOL

See
https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: Set NSS_WRAPPER_HOSTS for smbclient
Andreas Schneider [Thu, 6 Jun 2024 09:51:53 +0000 (11:51 +0200)] 
selftest: Set NSS_WRAPPER_HOSTS for smbclient

This is calling getaddrinfo()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: Create the cmd outside of the loop
Andreas Schneider [Thu, 6 Jun 2024 09:51:24 +0000 (11:51 +0200)] 
selftest: Create the cmd outside of the loop

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos4:torture: Add missing NULL checks in spoolss.c
Andreas Schneider [Tue, 30 Apr 2024 15:31:00 +0000 (17:31 +0200)] 
s4:torture: Add missing NULL checks in spoolss.c

source4/torture/rpc/spoolss.c: In function
  ‘check_printer_driver_file.isra’:
source4/torture/rpc/spoolss.c:10850:58: error: ‘%s’ directive argument
  is null [-Werror=format-overflow=]
10850 |         const char *remote_name = talloc_asprintf(tctx, "%s\\%d\\%s",
      |                                                          ^~

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agolib:util: Fix size of tmp array
Andreas Schneider [Tue, 30 Apr 2024 11:01:20 +0000 (13:01 +0200)] 
lib:util: Fix size of tmp array

lib/util/util.c: In function ‘dump_data_block16’:
lib/util/util.c:503:40: error: ‘%04zX’ directive output may be truncated
writing between 4 and 16 bytes into a region of size 15
[-Werror=format-truncation=]
  503 |         snprintf(tmp, sizeof(tmp), "%s[%04zX]", prefix, idx);
      |                                        ^~~~~

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agolib:util: Remove tailing spaces in util.c
Andreas Schneider [Tue, 30 Apr 2024 10:54:48 +0000 (12:54 +0200)] 
lib:util: Remove tailing spaces in util.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agothird_party: Update socket_wrapper to version 1.4.3
Andreas Schneider [Thu, 13 Jun 2024 05:47:26 +0000 (07:47 +0200)] 
third_party: Update socket_wrapper to version 1.4.3

This fixes issues with bind compiled with jemalloc.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jun 13 08:41:39 UTC 2024 on atb-devel-224

13 months agothird_party: Update uid_wrapper to version 1.3.1
Andreas Schneider [Thu, 13 Jun 2024 05:41:41 +0000 (07:41 +0200)] 
third_party: Update uid_wrapper to version 1.3.1

This fixes issues with bind compiled with jemalloc.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agogitlab-ci: Set git safe.directory for devel repo
Andreas Schneider [Fri, 7 Jun 2024 14:20:10 +0000 (16:20 +0200)] 
gitlab-ci: Set git safe.directory for devel repo

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agobootstrap: Fix building CentOS 8 Stream container images
Andreas Schneider [Mon, 10 Jun 2024 13:28:30 +0000 (15:28 +0200)] 
bootstrap: Fix building CentOS 8 Stream container images

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agobootstrap: Set git safe.directory
Andreas Schneider [Thu, 6 Jun 2024 14:10:14 +0000 (16:10 +0200)] 
bootstrap: Set git safe.directory

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agobootstrap: Fix runner tags
Andreas Schneider [Thu, 6 Jun 2024 12:41:02 +0000 (14:41 +0200)] 
bootstrap: Fix runner tags

See https://docs.gitlab.com/ee/ci/runners/hosted_runners/linux.html

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agopython/samba/tests/krb5: Add tests for password expiry with krb5 ENC-TS
Andrew Bartlett [Tue, 11 Jun 2024 22:24:18 +0000 (10:24 +1200)] 
python/samba/tests/krb5: Add tests for password expiry with krb5 ENC-TS

This augments the PKINIT based tests to show this is correctly handled
for the fare more usual case.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun 13 00:45:36 UTC 2024 on atb-devel-224

13 months agopython/samba/tests/krb5: Add check to confirm UF_SMARCARD_REQUIRED password is expire...
Andrew Bartlett [Tue, 11 Jun 2024 20:51:54 +0000 (08:51 +1200)] 
python/samba/tests/krb5: Add check to confirm UF_SMARCARD_REQUIRED password is expired on NTLM

8944a10b145e99eb6372cace8225e4c5e9d6160e broke password expiry
checking on NTLM, but that is fixed after CID 1603594 triggered
815d696d4471f1b3a4267eb774eb80b07576031b.  In the past we could
not have password expiry times small enough to test expiry
(unlike "must change now"), but having no test was not good.

As we are already doing the sleep() here, add a test to the
password rotation test.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
13 months agopython: remove string_to_byte_array()
Douglas Bagnall [Wed, 12 Jun 2024 00:16:46 +0000 (12:16 +1200)] 
python: remove string_to_byte_array()

This was a useful function during the Python 2 -> 3 migration, but it
is not used any more. In all the cases it was used, we knew we already
had a bytes object, and this was just an inefficient way of confirming
that.

In cases where we actually want to cast a string into a mutable list
of byte-sized ints, the builtin bytearray() function will do a better
job than this, because it will encode high unicode characters as utf-8
bytes, rather than adding them as out-of-range values in the list.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 12 09:16:39 UTC 2024 on atb-devel-224

13 months agosamba-tool ldapcmp: remove a dodgy unused method
Douglas Bagnall [Tue, 11 Jun 2024 23:42:27 +0000 (11:42 +1200)] 
samba-tool ldapcmp: remove a dodgy unused method

We have bindings for stringifying GUIDs, so I intended to replace this
rather complicated code with that, but it turns out that this method
has been unused since 5d42260eecfd4f26cc82637ce1bc989083c9eb9d in 2013.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopytest: simplify and fix HEXDUMP_FILTER used in hexdumps
Douglas Bagnall [Tue, 11 Jun 2024 23:34:36 +0000 (11:34 +1200)] 
pytest: simplify and fix HEXDUMP_FILTER used in hexdumps

The old test

   x if ((len(repr(chr(x))) == 3) and (x < 127)) else ord('.')

went through some contortions to see if the character was printable, and
it got it slightly wrong. The idea was that `repr(chr(97)` is "'a'",
while `repr(chr(167)` is "'\xa7'", which we can distinguish using the
length. But that miscategorised the backslash character, which is
represented as "'\\'", a string of length 4, so it was show as '.'
instead.

Instead we notice that the characters we want to print in a hexdump
are exactly those between 32 and 126, inclusive.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agosamba-tool domain trust: avoid useless use of string_to_byte_array
Douglas Bagnall [Tue, 11 Jun 2024 23:21:59 +0000 (11:21 +1200)] 
samba-tool domain trust: avoid useless use of string_to_byte_array

`pw.encode('utf-16-le')` is always bytes.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopython:lsa_utils: avoid useless use of py2-compat string_to_byte_array
Douglas Bagnall [Tue, 11 Jun 2024 23:21:09 +0000 (11:21 +1200)] 
python:lsa_utils: avoid useless use of py2-compat string_to_byte_array

`pw.encode('utf-16-le')` is always bytes.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopython:join: avoid useless use of py2-compat string_to_byte_array
Douglas Bagnall [Tue, 11 Jun 2024 23:19:55 +0000 (11:19 +1200)] 
python:join: avoid useless use of py2-compat string_to_byte_array

This was a workaround for the migration to Python 3, but is now just
extra work for the computer and cognitive load for us.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopy:emulate: remove py2 str/bytes workaround in traffic_packets
Douglas Bagnall [Tue, 11 Jun 2024 23:17:22 +0000 (11:17 +1200)] 
py:emulate: remove py2 str/bytes workaround in traffic_packets

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopy:emulate: remove py2 str/bytes workaround in traffic
Douglas Bagnall [Tue, 11 Jun 2024 23:16:48 +0000 (11:16 +1200)] 
py:emulate: remove py2 str/bytes workaround in traffic

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopytest: remove py2 str/bytes workaround in auth_log_samlogon
Douglas Bagnall [Tue, 11 Jun 2024 23:15:50 +0000 (11:15 +1200)] 
pytest: remove py2 str/bytes workaround in auth_log_samlogon

It is likely not necessary to cast to list() in most cases.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopytest: remove py2 str/bytes workaround in samr_change_password
Douglas Bagnall [Tue, 11 Jun 2024 23:15:23 +0000 (11:15 +1200)] 
pytest: remove py2 str/bytes workaround in samr_change_password

It is likely not necessary to cast to list().

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopytest: remove py2 str/bytes workaround in lsa_utils
Douglas Bagnall [Tue, 11 Jun 2024 23:14:42 +0000 (11:14 +1200)] 
pytest: remove py2 str/bytes workaround in lsa_utils

It is likely not necessary to cast to list() in most cases.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopytest: remove py2 str/bytes workaround in dns_base
Douglas Bagnall [Tue, 11 Jun 2024 23:14:07 +0000 (11:14 +1200)] 
pytest: remove py2 str/bytes workaround in dns_base

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agopytest: remove py2 str/bytes workaround in py_credentials
Douglas Bagnall [Tue, 11 Jun 2024 23:13:24 +0000 (11:13 +1200)] 
pytest: remove py2 str/bytes workaround in py_credentials

It is likely not necessary to cast to list() in most cases.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/pytest: remove py2 str/bytes workaround in getnc_exop
Douglas Bagnall [Tue, 11 Jun 2024 23:11:27 +0000 (11:11 +1200)] 
s4/pytest: remove py2 str/bytes workaround in getnc_exop

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos3/smbd: fix nested chdir into msdfs links on (widelinks = yes) share
Noel Power [Fri, 7 Jun 2024 18:35:47 +0000 (19:35 +0100)] 
s3/smbd: fix nested chdir into msdfs links on (widelinks = yes) share

This patch also removes known fail for existing test

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun 11 19:31:40 UTC 2024 on atb-devel-224

13 months agoselftest: Add a python blackbox test for some misc (widelink) DFS tests
Noel Power [Tue, 11 Jun 2024 10:19:50 +0000 (11:19 +0100)] 
selftest: Add a python blackbox test for some misc (widelink) DFS tests

On master attempting to chdir into a nested dfs link

e.g. cd dfslink (works)
     cd dfslink/another_dfslink (fails)

[1] Add a test for this scenario (nested chdir)
[2] Add test for enumerating a dfs link in root of dfs share
[3] Add a test to check case insensitive chdir into dfs link on widelink
  enabled share

Add knownfails for tests 1 and 3

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15435

13 months agos3: vfs_widelinks: Allow case insensitivity to work on DFS widelinks shares.
Jeremy Allison [Tue, 11 Jun 2024 00:25:32 +0000 (17:25 -0700)] 
s3: vfs_widelinks: Allow case insensitivity to work on DFS widelinks shares.

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun 11 17:00:38 UTC 2024 on atb-devel-224

13 months agos3/torture: Add test for widelink case insensitivity on a MSDFS share.
Jeremy Allison [Mon, 10 Jun 2024 22:14:19 +0000 (15:14 -0700)] 
s3/torture: Add test for widelink case insensitivity on a MSDFS share.

Add knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
13 months agosamba-tool user readpasswords: avoid `assert` for validation
Douglas Bagnall [Fri, 2 Feb 2024 02:01:21 +0000 (15:01 +1300)] 
samba-tool user readpasswords: avoid `assert` for validation

`assert` can be optimised away if python is run with `-O`.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jun 11 05:32:28 UTC 2024 on atb-devel-224

13 months agos4:auth: Handle expired accounts in authsam_account_ok() (CID 1603594)
Jo Sutton [Tue, 11 Jun 2024 02:58:11 +0000 (14:58 +1200)] 
s4:auth: Handle expired accounts in authsam_account_ok() (CID 1603594)

We check the ACB_PW_EXPIRED bit to determine whether the account is
expired. Since ACB_PW_EXPIRED can’t be represented in a 16‐bit integer,
we must increase the width of acct_flags so as not to lose that bit.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4:dsdb: Remove trailing whitespace
Jo Sutton [Fri, 24 May 2024 01:05:58 +0000 (13:05 +1200)] 
s4:dsdb: Remove trailing whitespace

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4:auth: Add temporary memory context to authsam_reread_user_logon_data()
Jo Sutton [Mon, 29 Apr 2024 05:07:43 +0000 (17:07 +1200)] 
s4:auth: Add temporary memory context to authsam_reread_user_logon_data()

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4:auth: Add common out path to authsam_reread_user_logon_data()
Jo Sutton [Mon, 29 Apr 2024 05:09:12 +0000 (17:09 +1200)] 
s4:auth: Add common out path to authsam_reread_user_logon_data()

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agoldb: Attach appropriate ldb context to returned result
Jo Sutton [Wed, 1 May 2024 04:54:01 +0000 (16:54 +1200)] 
ldb: Attach appropriate ldb context to returned result

This is done by adding a new API that avoids the problems of
ldb_dn_copy() and makes it clear that a struct ldb_context *
pointer will be stored in the new copy.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
13 months agos4/torture: Remove already existing test_dir
Anoop C S [Wed, 29 May 2024 13:22:10 +0000 (18:52 +0530)] 
s4/torture: Remove already existing test_dir

In configurations where vfs_acl_xattr is used with 'ignore system acls'
option we encounter NT_STATUS_ACCESS_DENIED while trying to open an
already existing test_dir in smb2.delete-on-close-perms.READONLY. Due
to missing SEC_STD_DELETE permission from the list of allowed ACEs it
couldn't be removed via previous call to smb2_deltree(). Thus as seen
with other tests we now call set_dir_delete_perms() so that subsequent
attempt to remove it can succeed.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jun 10 13:17:58 UTC 2024 on atb-devel-224

13 months agos4/torture: Create test_dir with SEC_RIGHTS_DIR_ALL
Anoop C S [Wed, 29 May 2024 13:11:32 +0000 (18:41 +0530)] 
s4/torture: Create test_dir with SEC_RIGHTS_DIR_ALL

In shares where acl_xattr vfs module is loaded with 'ignore system acls'
set, smb2.delete-on-close-perms.FIND_and_set_DOC fails to open test_dir
due to NT_STATUS_ACCESS_DENIED as it lacks few permissions for owner
when created using create_dir(). Test case aims to set delete-on-close
for which delete permission is necessary in first place. Therefore we
now perform the creation and subsequent opening of directory using
torture_smb2_testdir() so that the open handle comes with SEC_STD_DELETE
permission.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>