]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
13 months agos3/lib: modernize set_namearray()
Ralph Boehme [Sat, 20 Jan 2024 11:58:52 +0000 (12:58 +0100)] 
s3/lib: modernize set_namearray()

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/lib: move path_to_strv() to util_path.c
Ralph Boehme [Tue, 23 Jan 2024 11:29:36 +0000 (12:29 +0100)] 
s3/lib: move path_to_strv() to util_path.c

More callers are coming.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/lib: remove name_compare_entry typedef
Ralph Boehme [Sat, 20 Jan 2024 18:12:09 +0000 (19:12 +0100)] 
s3/lib: remove name_compare_entry typedef

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: remove net groupmap delete stuff
Ralph Boehme [Wed, 31 Jan 2024 16:48:07 +0000 (17:48 +0100)] 
selftest: remove net groupmap delete stuff

Likely not needed anymore since we now cleanup the fileserver env.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: ensure the "fileserver" test environment is removed before provisioning
Ralph Boehme [Wed, 31 Jan 2024 16:45:29 +0000 (17:45 +0100)] 
selftest: ensure the "fileserver" test environment is removed before provisioning

This was likely taken by copy/paste from somewhere else where it might have made
sense.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: setup "fileserver" testenv specific directories after calling provision()
Ralph Boehme [Wed, 31 Jan 2024 18:37:54 +0000 (19:37 +0100)] 
selftest: setup "fileserver" testenv specific directories after calling provision()

This ensures provision() can remove st/fileserver/* from previous runs.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: setup "simpleserver" testenv specific directories after calling provision()
Ralph Boehme [Wed, 31 Jan 2024 18:36:33 +0000 (19:36 +0100)] 
selftest: setup "simpleserver" testenv specific directories after calling provision()

This ensures provision() can remove st/simpleserver/* from previous runs.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: remove check for $no_delete_prefix
Ralph Boehme [Wed, 31 Jan 2024 16:44:00 +0000 (17:44 +0100)] 
selftest: remove check for $no_delete_prefix

provision_ctdb() was always called with $no_delete_prefix undefined
from  setup_ctdb(), so we can just remove the check.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agolibcli:security: allow spaces after BAD:
Douglas Bagnall [Wed, 24 Jul 2024 05:24:59 +0000 (17:24 +1200)] 
libcli:security: allow spaces after BAD:

In AD_DS_Classes_Windows_Server_v1903.ldf from
https://www.microsoft.com/en-us/download/details.aspx?id=23782, we see

  defaultSecurityDescriptor: O:BAG:BAD: (A;;RPWPCRCCDCLCLORCWOWDSDDTSW;;;DA)(A;;RPLCLORC;;;AU)

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Jul 25 06:27:27 UTC 2024 on atb-devel-224

13 months agoselftest: Move MIT Kerberos knownfails to separate files in their own directory
Jo Sutton [Wed, 17 Jul 2024 03:45:29 +0000 (15:45 +1200)] 
selftest: Move MIT Kerberos knownfails to separate files in their own directory

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jo Sutton <jsutton@samba.org>
Autobuild-Date(master): Tue Jul 23 23:47:43 UTC 2024 on atb-devel-224

13 months agoselftest: Move Heimdal Kerberos knownfails to separate files in their own directory
Jo Sutton [Wed, 17 Jul 2024 03:44:05 +0000 (15:44 +1200)] 
selftest: Move Heimdal Kerberos knownfails to separate files in their own directory

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agoselftest: Consolidate MIT Kerberos knownfails into a single file
Jo Sutton [Wed, 17 Jul 2024 02:42:25 +0000 (14:42 +1200)] 
selftest: Consolidate MIT Kerberos knownfails into a single file

There is no longer any meaningful distinction between the two files.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agos3:tests: let modprinter.pl use $TMPDIR
Stefan Metzmacher [Tue, 23 Jul 2024 09:46:57 +0000 (11:46 +0200)] 
s3:tests: let modprinter.pl use $TMPDIR

We should avoid using /tmp in selftest

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): Tue Jul 23 13:53:13 UTC 2024 on atb-devel-224

13 months agothird_party: Update pam_wrapper to version 1.1.7
Andreas Schneider [Tue, 23 Jul 2024 08:41:30 +0000 (10:41 +0200)] 
third_party: Update pam_wrapper to version 1.1.7

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest:Samba3: don't use PAM_WRAPPER_KEEP_DIR and PAM_WRAPPER_DEBUGLEVEL
Stefan Metzmacher [Tue, 23 Jul 2024 07:27:37 +0000 (09:27 +0200)] 
selftest:Samba3: don't use PAM_WRAPPER_KEEP_DIR and PAM_WRAPPER_DEBUGLEVEL

They are both only for debugging problems.

In normal runs we don't need them and this avoids leaving to many
/tmp/pam.* directories arround.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
13 months agoctdb-daemon: Use ctdb_parse_node_address() in ctdbd
Martin Schwenke [Mon, 8 Jul 2024 07:57:27 +0000 (17:57 +1000)] 
ctdb-daemon: Use ctdb_parse_node_address() in ctdbd

While here, fix a trivial memory leak (ctdbd will exit anyway if this
function fails).

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Jul 23 12:39:18 UTC 2024 on atb-devel-224

13 months agoctdb-daemon: Use ctdb_read_nodes() in ctdbd
Martin Schwenke [Fri, 5 Jul 2024 08:07:36 +0000 (18:07 +1000)] 
ctdb-daemon: Use ctdb_read_nodes() in ctdbd

ctdb_control_getnodesfile() calls ctdb_read_nodes(), which returns a
struct ctdb_node_map rather than the old version, so update associated
marshalling.  While here modernise a debug message and wrap the
function arguments.

For ctdb_load_nodes_file() to use ctdb_read_nodes(), tweak
convert_node_map_to_list() to also use the modern node map structure.

Remove unused copy of ctdb_read_nodes_file().

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
13 months agoctdb-protocol: Move ctdb_node_map_* to protocol_api.h
Martin Schwenke [Fri, 5 Jul 2024 07:58:46 +0000 (17:58 +1000)] 
ctdb-protocol: Move ctdb_node_map_* to protocol_api.h

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
13 months agoctdb-tests: Use ctdb_read_nodes() in the fake ctdbd
Martin Schwenke [Fri, 5 Jul 2024 07:45:44 +0000 (17:45 +1000)] 
ctdb-tests: Use ctdb_read_nodes() in the fake ctdbd

Remove unused copy of ctdb_read_nodes_file().

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
13 months agoctdb-tools: Use ctdb_read_nodes() in the ctdb tool
Martin Schwenke [Fri, 5 Jul 2024 07:37:26 +0000 (17:37 +1000)] 
ctdb-tools: Use ctdb_read_nodes() in the ctdb tool

Remove unused copy of ctdb_read_nodes_file().

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
13 months agoctdb-conf: Add a common node address handling module
Martin Schwenke [Fri, 5 Jul 2024 07:34:09 +0000 (17:34 +1000)] 
ctdb-conf: Add a common node address handling module

These functions are intended to be used in ctdbd, the ctdb tool and
fake_ctdbd, replacing the different copies in each place.

ctdb_read_nodes() will replace ctdb_read_nodes_file().  The name
change is intentional - in future the location may be something other
than a simple filename.

The static copies of ctdb_read_nodes_file() and node_map_add() are
slightly sanitised versions of those in tools/ctdb.c, with a call to
ctdb_parse_node_address().  A bit more care is taken in node_map_add()
to avoid undefined behaviour if talloc_realloc() fails.

ctdb_parse_node_address() will replace ctdb_parse_address().  There is
an obvious argument change, since the ctdb context argument was
unused.  It can only fail on an invalid node address, so return a
bool.  This function might be changed later to allow the input address
string to include an optional port.

Where to put this module isn't entirely clear.  It could go in common,
so be part of ctdb-util.  However, if it later needs
ctdb-conf (e.g. to allow the node list location to be configurable)
then there would be a direct cyclic dependency.  This is configuration
handling, so conf/ seems sane.  However, I didn't want to put it into
the ctdb-conf target, since some code might need to parse a nodes list
but not need to parse ctdb.conf.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
13 months agoctdb-protocol: Move definition of CTDB_PORT to protocol
Martin Schwenke [Mon, 8 Jul 2024 07:58:55 +0000 (17:58 +1000)] 
ctdb-protocol: Move definition of CTDB_PORT to protocol

Users of CTDB_PORT will all pick up the new definition.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
13 months agoctdb-build: Remove unused dependencies on ctdb-util
Martin Schwenke [Fri, 5 Jul 2024 07:19:47 +0000 (17:19 +1000)] 
ctdb-build: Remove unused dependencies on ctdb-util

Since commit ba8f8ef33cd99ea60fc2682727a5497995b5f569.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
13 months agos3:printing: Allow to run samba-bgqd as a standalone systemd service
Andreas Schneider [Fri, 12 Jul 2024 12:18:26 +0000 (14:18 +0200)] 
s3:printing: Allow to run samba-bgqd as a standalone systemd service

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jul 19 11:13:28 UTC 2024 on atb-devel-224

13 months agos4:torture: Initialize struct cldap_netlogon
Andreas Schneider [Wed, 17 Jul 2024 08:58:09 +0000 (10:58 +0200)] 
s4:torture: Initialize struct cldap_netlogon

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/ldap/cldapbench.c:40: var_decl: Declaring variable ""io"" without initializer.
samba-4.20.0rc2/source4/torture/ldap/cldapbench.c:45: uninit_use_in_call: Using uninitialized value ""io.in.map_response"" when calling ""cldap_netlogon_recv"".
   43|    TALLOC_CTX *tmp_ctx = talloc_new(NULL);
   44|    io.in.version = 6;
   45|->  status = cldap_netlogon_recv(req, tmp_ctx, &io);
   46|    talloc_free(req);
   47|    if (NT_STATUS_IS_OK(status)) {"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jul 18 13:48:03 UTC 2024 on atb-devel-224

13 months agos4:torture: Remove trailing spaces from cldapbench.c
Andreas Schneider [Wed, 17 Jul 2024 08:57:43 +0000 (10:57 +0200)] 
s4:torture: Remove trailing spaces from cldapbench.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
13 months agos4:torture: Initialize struct netr_LogonSamLogonEx
Andreas Schneider [Wed, 17 Jul 2024 08:55:28 +0000 (10:55 +0200)] 
s4:torture: Initialize struct netr_LogonSamLogonEx

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/rpc/schannel.c:49: var_decl: Declaring variable ""r"" without initializer.
samba-4.20.0rc2/source4/torture/rpc/schannel.c:152: uninit_use_in_call: Using uninitialized value ""r.in.validation_level"" when calling ""torture_comment"".
  150|    ""LogonSamLogonEx failed"");
  151|    } else {
  152|->  torture_comment(tctx,
  153|    ""Skip auth_level[%u] Testing LogonSamLogonEx with name %s using %s and validation_level: %d\n"",
  154|    auth_level, ninfo.identity_info.account_name.string, crypto_alg,"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
13 months agonsswitch: Fix integer size types in winbind_write_sock()
Andreas Schneider [Wed, 17 Jul 2024 08:50:30 +0000 (10:50 +0200)] 
nsswitch: Fix integer size types in winbind_write_sock()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
13 months agoexamples:winexe: Initialize integer
Andreas Schneider [Tue, 16 Jul 2024 15:03:19 +0000 (17:03 +0200)] 
examples:winexe: Initialize integer

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/examples/winexe/winexesvc.c:147: var_decl: Declaring variable ""res"" without initializer.
samba-4.20.0rc2/examples/winexe/winexesvc.c:156: uninit_use: Using uninitialized value ""res"".
  154|    GetOverlappedResult(pipe->h, &pipe->o, (LPDWORD)&res, TRUE);
  155|    FlushFileBuffers(pipe->h);
  156|->  return res;
  157|   }
  158|"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
13 months agoauth:gensec: Fully initialize struct spnego_data
Andreas Schneider [Tue, 16 Jul 2024 15:01:22 +0000 (17:01 +0200)] 
auth:gensec: Fully initialize struct spnego_data

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/auth/gensec/spnego.c:1129: var_decl: Declaring variable ""spnego_out"" without initializer.
samba-4.20.0rc2/auth/gensec/spnego.c:1154: uninit_use_in_call: Using uninitialized value ""spnego_out.negTokenTarg.negResult"" when calling ""spnego_write_data"".
 1152|    }
 1153|
 1154|->  if (spnego_write_data(out_mem_ctx, out, &spnego_out) == -1) {
 1155|    DEBUG(1, (""Failed to write SPNEGO reply to NEG_TOKEN_TARG\n""));
 1156|    return NT_STATUS_INVALID_PARAMETER;"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
13 months agos4:torture: Initialize union spoolss_KeyNames
Andreas Schneider [Tue, 16 Jul 2024 14:59:12 +0000 (16:59 +0200)] 
s4:torture: Initialize union spoolss_KeyNames

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/rpc/spoolss.c:7835: var_decl: Declaring variable ""key_buffer"" without initializer.
samba-4.20.0rc2/source4/torture/rpc/spoolss.c:7906: uninit_use: Using uninitialized value ""key_buffer.string_array"".
 7904|
 7905|    if (array) {
 7906|->  *array = key_buffer.string_array;
 7907|    }
 7908|"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
13 months agoexamples:winexe: Fully initialize EXPLICIT_ACCESS
Andreas Schneider [Tue, 16 Jul 2024 08:45:53 +0000 (10:45 +0200)] 
examples:winexe: Fully initialize EXPLICIT_ACCESS

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/examples/winexe/winexesvc.c:60: var_decl: Declaring variable ""ea"" without initializer.
samba-4.20.0rc2/examples/winexe/winexesvc.c:86: uninit_use_in_call: Using uninitialized value ""ea"". Field ""ea.Trustee.pMultipleTrustee"" is uninitialized when calling ""SetEntriesInAclA"".
   84|
   85|    /* Create a new ACL that contains the new ACEs */
   86|->  dwRes = SetEntriesInAcl(1, &ea, NULL, &pACL);
   87|    if (ERROR_SUCCESS != dwRes) {
   88|    dbg(""SetEntriesInAcl Error %lu\n"", GetLastError());"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
13 months agos4:torture: Initialize pointer with NULL
Andreas Schneider [Tue, 16 Jul 2024 08:33:38 +0000 (10:33 +0200)] 
s4:torture: Initialize pointer with NULL

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/smb2/durable_open.c:1447: var_decl: Declaring variable ""tree2"" without initializer.
samba-4.20.0rc2/source4/torture/smb2/durable_open.c:1492: uninit_use_in_call: Using uninitialized value ""tree2"" when calling ""smb2_util_unlink"".
 1490|    }
 1491|
 1492|->  smb2_util_unlink(tree2, fname);
 1493|
 1494|    talloc_free(tree);"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
13 months agos3:smbd: Initialize struct security_ace array
Andreas Schneider [Tue, 16 Jul 2024 08:31:53 +0000 (10:31 +0200)] 
s3:smbd: Initialize struct security_ace array

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source3/smbd/posix_acls.c:4599: var_decl: Declaring variable ""aces"" without initializer.
samba-4.20.0rc2/source3/smbd/posix_acls.c:4676: uninit_use_in_call: Using uninitialized value ""*aces"". Field ""aces->object"" is uninitialized when calling ""make_sec_acl"".
 4674|    idx++;
 4675|
 4676|->  new_dacl = make_sec_acl(ctx,
 4677|    NT4_ACL_REVISION,
 4678|    idx,"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
13 months agos4:torture: Add new LSA test_query_forest_trust_info()
Andreas Schneider [Tue, 19 Mar 2024 09:24:44 +0000 (10:24 +0100)] 
s4:torture: Add new LSA test_query_forest_trust_info()

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 Jul 18 12:36:25 UTC 2024 on atb-devel-224

13 months agos4:torture: Split out a new LSA test_set_forest_trust_info() function
Andreas Schneider [Tue, 19 Mar 2024 08:43:40 +0000 (09:43 +0100)] 
s4:torture: Split out a new LSA test_set_forest_trust_info() function

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: Remove samba4.rpc.lsa.forest.trust from knownfail
Andreas Schneider [Tue, 19 Mar 2024 09:30:04 +0000 (10:30 +0100)] 
selftest: Remove samba4.rpc.lsa.forest.trust from knownfail

The test needs --option="torture:Forest_Trust_Dom2_Binding=..." in order
to be useful, so the skip is correct, but the knownfail entry should
have been removed with e5163dfd57694351bf556565e92f74b71221db29.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agopython:tests: make test_export_keytab_nochange_update() more reliable
Stefan Metzmacher [Wed, 17 Jul 2024 07:03:34 +0000 (07:03 +0000)] 
python:tests: make test_export_keytab_nochange_update() more reliable

net.export_keytab() includes the current timestamp into the resulting
keytab. So we need to make sure the two compared exports actually
run within the same second.

And klist may also print the keytab filename...

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 Jul 17 14:21:30 UTC 2024 on atb-devel-224

13 months agos3:auth: allow real plaintext authentication
Stefan Metzmacher [Fri, 12 Jul 2024 15:12:46 +0000 (17:12 +0200)] 
s3:auth: allow real plaintext authentication

In standalone setups we use the PAM stack to verify
the plaintext authentication, so we need to pass it
down...

There are still production systems out there
(legacy audio/video recording systems...)
using this.

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

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 Jul 17 11:17:54 UTC 2024 on atb-devel-224

13 months agoselftest: setup pam_matrix in the simpleserver env
Stefan Metzmacher [Fri, 12 Jul 2024 18:23:52 +0000 (20:23 +0200)] 
selftest: setup pam_matrix in the simpleserver env

This allows testing a plaintext password authentication
on a standalone server using the PAM stack to verify it.

There are still production systems out in the wild using this...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agos3:auth: let smb_pam_conv() handle resp=NULL
Stefan Metzmacher [Mon, 15 Jul 2024 16:47:24 +0000 (18:47 +0200)] 
s3:auth: let smb_pam_conv() handle resp=NULL

pam_matrix calls smb_pam_conv() with resp=NULL in some situation,
we should not segfault...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agothird_party/pam_wrapper: add pam_matrix module
Stefan Metzmacher [Mon, 15 Jul 2024 16:43:37 +0000 (18:43 +0200)] 
third_party/pam_wrapper: add pam_matrix module

This allows testing pam with simple passwords.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agos3:passdb: don't clear the LM HASH without a password change
Stefan Metzmacher [Fri, 12 Jul 2024 17:38:40 +0000 (19:38 +0200)] 
s3:passdb: don't clear the LM HASH without a password change

Updating things like the bad pwd count should not clear the
stored LM HASH with 'lanman auth = no'.

This allows testing with 'lanman auth = no' and 'lanman auth = yes'.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agos3:selftest: add samba3.blackbox.smb1_lanman_plaintext tests
Stefan Metzmacher [Mon, 15 Jul 2024 16:32:42 +0000 (18:32 +0200)] 
s3:selftest: add samba3.blackbox.smb1_lanman_plaintext tests

This demonstrates that we currently have problems with
plaintext and lanman authentication. In both domain member
and standalone setups.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agoselftest:Samba3: allow lanman auth in setup_nt4_member
Stefan Metzmacher [Mon, 15 Jul 2024 16:31:18 +0000 (18:31 +0200)] 
selftest:Samba3: allow lanman auth in setup_nt4_member

Note that the LM HASH is only generated for passwords
up to 14 characters...

We use extra_options_before_inject in order to
allow overriding any existing parameter.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agoselftest:Samba3: add simpleserver globals before include = global_inject.conf
Stefan Metzmacher [Fri, 12 Jul 2024 16:26:07 +0000 (18:26 +0200)] 
selftest:Samba3: add simpleserver globals before include = global_inject.conf

This allows overriding any existing parameter.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agolibcli/auth: fix debug level 100 valgrind warnings in SMBOWFencrypt_ntv2()
Stefan Metzmacher [Mon, 3 Jun 2024 10:56:02 +0000 (12:56 +0200)] 
libcli/auth: fix debug level 100 valgrind warnings in SMBOWFencrypt_ntv2()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
13 months agos3:lib: Fix a typo in MACRO
Pavel Filipenský [Tue, 23 Jan 2024 09:01:35 +0000 (10:01 +0100)] 
s3:lib: Fix a typo in MACRO

DEBUG_PASSWORDS --> DEBUG_PASSWORD

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Wed Jul 17 08:49:46 UTC 2024 on atb-devel-224

13 months agolibnet: Fix debug text
Pavel Filipenský [Tue, 26 Mar 2024 20:48:58 +0000 (21:48 +0100)] 
libnet: Fix debug text

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Reviewed-by: Martin Schwenke <martin@meltin.net>
13 months agos3:librpc: Fix a typo in DEBUG text
Pavel Filipenský [Wed, 22 Nov 2023 12:59:20 +0000 (13:59 +0100)] 
s3:librpc: Fix a typo in DEBUG text

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Reviewed-by: Martin Schwenke <martin@meltin.net>
13 months agopython:tests: Fix spelling in to test_samba_dnsupdate_no_change
Pavel Filipenský [Mon, 15 Jul 2024 08:31:18 +0000 (10:31 +0200)] 
python:tests: Fix spelling in to test_samba_dnsupdate_no_change

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Reviewed-by: Martin Schwenke <martin@meltin.net>
13 months agodocs-xml: Mention winbind consistently in samba-dcerpcd.8
Pavel Filipenský [Sun, 26 May 2024 07:04:17 +0000 (09:04 +0200)] 
docs-xml: Mention winbind consistently in samba-dcerpcd.8

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Reviewed-by: Martin Schwenke <martin@meltin.net>
13 months agoctdb-tests: Correctly handle adding a deleted node at the end
Martin Schwenke [Thu, 11 Jul 2024 02:14:07 +0000 (12:14 +1000)] 
ctdb-tests: Correctly handle adding a deleted node at the end

The current fake_ctdbd code for reloading the nodes file overruns the
allocation when adding a deleted node at the end.  This is a very
unlikely case, but it might as well work.

Check the size of the internal node map when marking a node deleted.
Also, update the code that adds a node to correctly set the deleted
flag when appropriate.

The included test case tests this.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Jul 17 00:06:53 UTC 2024 on atb-devel-224

13 months agoctdb-tests: Add more reloadnodes unit tests
Martin Schwenke [Sat, 22 Jun 2024 04:54:53 +0000 (14:54 +1000)] 
ctdb-tests: Add more reloadnodes unit tests

There are no existing tests to exercise node IP address change
detection.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos4:torture: Do not set sr.in.info to info be we queried the info
Andreas Schneider [Mon, 8 Jul 2024 09:39:28 +0000 (11:39 +0200)] 
s4:torture: Do not set sr.in.info to info be we queried the info

`sr.in.info = info` is correctly set later after we called
dcerpc_lsa_QueryTrustedDomainInfoByName_r() which filling the info
pointer with data.

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/rpc/forest_trust.c:211: var_decl: Declaring variable ""info"" without initializer.
samba-4.20.0rc2/source4/torture/rpc/forest_trust.c:248: uninit_use: Using uninitialized value ""info"".
  246|    sr.in.trusted_domain = talloc_zero(tctx, struct lsa_String);
  247|    sr.in.trusted_domain->string = name;
  248|->  sr.in.info = info;
  249|
  250|    for (c = 0; il[c].info_level != -1; c++) {"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Jul 16 12:42:39 UTC 2024 on atb-devel-224

13 months agolib:param: Add missing return code check
Andreas Schneider [Mon, 8 Jul 2024 10:26:47 +0000 (12:26 +0200)] 
lib:param: Add missing return code check

"Error: NEGATIVE_RETURNS (CWE-394):
samba-4.20.0rc2/lib/param/loadparm.c:1275: negative_return_fn: Function ""lpcfg_map_parameter(""printing"")"" returns a negative number.
samba-4.20.0rc2/lib/param/loadparm.c:1275: assign: Assigning: ""parm_num"" = ""lpcfg_map_parameter(""printing"")"".
samba-4.20.0rc2/lib/param/loadparm.c:1278: negative_returns: Using variable ""parm_num"" as an index to array ""parm_table"".
 1276|    }
 1277|
 1278|->  if (!lp_set_enum_parm(&parm_table[parm_num], pszParmValue, (int*)ptr)) {
 1279|    return false;
 1280|    }"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos3:services: Initialize struct security_ace array
Andreas Schneider [Mon, 8 Jul 2024 10:21:06 +0000 (12:21 +0200)] 
s3:services: Initialize struct security_ace array

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos4:torture: Remove tailing spaces in forest_trust.c
Andreas Schneider [Mon, 8 Jul 2024 09:40:51 +0000 (11:40 +0200)] 
s4:torture: Remove tailing spaces in forest_trust.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos3:modules: Make nread a size_t and check for possible overflow
Andreas Schneider [Mon, 8 Jul 2024 09:25:32 +0000 (11:25 +0200)] 
s3:modules: Make nread a size_t and check for possible overflow

"Error: INTEGER_OVERFLOW (CWE-190):
samba-4.20.0rc2/source3/modules/vfs_preopen.c:215: tainted_data_return: Called function ""read(sock_fd, namebuf + nread, talloc_get_size(namebuf) - nread)"", and a possible return value may be less than zero.
samba-4.20.0rc2/source3/modules/vfs_preopen.c:215: assign: Assigning: ""thistime"" = ""read(sock_fd, namebuf + nread, talloc_get_size(namebuf) - nread)"".
samba-4.20.0rc2/source3/modules/vfs_preopen.c:221: overflow: The expression ""nread"" is considered to have possibly overflowed.
samba-4.20.0rc2/source3/modules/vfs_preopen.c:215: overflow: The expression ""talloc_get_size(namebuf) - nread"" is deemed overflowed because at least one of its arguments has overflowed.
samba-4.20.0rc2/source3/modules/vfs_preopen.c:215: overflow_sink: ""talloc_get_size(namebuf) - nread"", which might have underflowed, is passed to ""read(sock_fd, namebuf + nread, talloc_get_size(namebuf) - nread)"". [Note: The source code implementation of the function has been overridden by a builtin model.]
  213|    ssize_t thistime;
  214|
  215|->  thistime = read(sock_fd, namebuf + nread,
  216|    talloc_get_size(namebuf) - nread);
  217|    if (thistime <= 0) {"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos3:modules: Move chunk out of the loop
Andreas Schneider [Mon, 8 Jul 2024 09:24:34 +0000 (11:24 +0200)] 
s3:modules: Move chunk out of the loop

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos3:modules: Rename thistime to chunk
Andreas Schneider [Mon, 8 Jul 2024 09:23:39 +0000 (11:23 +0200)] 
s3:modules: Rename thistime to chunk

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agolibgpo: Initialize struct security_ace array
Andreas Schneider [Mon, 8 Jul 2024 09:13:35 +0000 (11:13 +0200)] 
libgpo: Initialize struct security_ace array

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/libgpo/gpo_reg.c:708: var_decl: Declaring variable ""ace"" without initializer.
samba-4.20.0rc2/libgpo/gpo_reg.c:755: uninit_use_in_call: Using uninitialized value ""*ace"". Field ""ace->object"" is uninitialized when calling ""make_sec_acl"".
  753|         mask, inherit_flags);
  754|
  755|->  theacl = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 6, ace);
  756|    W_ERROR_HAVE_NO_MEMORY(theacl);
  757|"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos4:torture: Initialize struct smb_nttrans
Andreas Schneider [Mon, 8 Jul 2024 09:12:02 +0000 (11:12 +0200)] 
s4:torture: Initialize struct smb_nttrans

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/basic/scanner.c:368: var_decl: Declaring variable ""parms"" without initializer.
samba-4.20.0rc2/source4/torture/basic/scanner.c:388: uninit_use_in_call: Using uninitialized value ""parms.in.setup"" when calling ""smb_raw_nttrans"".
  386|    parms.in.data = ntdata_blob;
  387|
  388|->  status = smb_raw_nttrans(cli->tree, mem_ctx, &parms);
  389|
  390|    if (NT_STATUS_IS_ERR(status)) {"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos4:torture: Remove tailing spaces in scanner.c
Andreas Schneider [Mon, 8 Jul 2024 09:11:26 +0000 (11:11 +0200)] 
s4:torture: Remove tailing spaces in scanner.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos4:torture: Initialize struct smb2_create
Andreas Schneider [Mon, 8 Jul 2024 09:05:45 +0000 (11:05 +0200)] 
s4:torture: Initialize struct smb2_create

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/smb2/sharemode.c:639: var_decl: Declaring variable ""cr3"" without initializer.
samba-4.20.0rc2/source4/torture/smb2/sharemode.c:736: uninit_use_in_call: Using uninitialized value ""cr3.out.file.handle"" when calling ""smb2_util_close"".
  734|    smb2_util_close(tree, cr1.out.file.handle);
  735|    smb2_util_close(tree, cr2.out.file.handle);
  736|->  smb2_util_close(tree, cr3.out.file.handle);
  737|    smb2_util_unlink(tree, fname);
  738|    return ret;"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agolib:util: Move open() of /dev/null into the if-clause
Andreas Schneider [Mon, 8 Jul 2024 08:14:39 +0000 (10:14 +0200)] 
lib:util: Move open() of /dev/null into the if-clause

"Error: RESOURCE_LEAK (CWE-772):
samba-4.20.0rc2/lib/util/close_low_fd.c:40: open_fn: Returning handle opened by ""open"". [Note: The source code implementation of the function has been overridden by a user model.]
samba-4.20.0rc2/lib/util/close_low_fd.c:40: var_assign: Assigning: ""dev_null"" = handle returned from ""open(""/dev/null"", 2, 0)"".
samba-4.20.0rc2/lib/util/close_low_fd.c:52: overwrite_var: Overwriting handle ""dev_null"" in ""dev_null = open(""/dev/null"", 2, 0)"" leaks the handle.
   50|    }
   51|
   52|->  dev_null = open(""/dev/null"", O_RDWR, 0);
   53|    if (dev_null == -1) {
   54|    dev_null = open(""/dev/null"", O_WRONLY, 0);"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agolibcli:nbt: Initialize struct nbt_name_register
Andreas Schneider [Fri, 5 Jul 2024 12:00:11 +0000 (14:00 +0200)] 
libcli:nbt: Initialize struct nbt_name_register

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/libcli/nbt/pynbt.c:277: var_decl: Declaring variable ""io"" without initializer.
samba-4.20.0rc2/libcli/nbt/pynbt.c:305: uninit_use_in_call: Using uninitialized value ""io.in.nb_flags"" when calling ""nbt_name_register"".
  303|    return NULL;
  304|
  305|->  status = nbt_name_register(node->socket, NULL, &io);
  306|
  307|    if (NT_STATUS_IS_ERR(status)) {"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos4:torture: Initialize union smb_open
Andreas Schneider [Fri, 5 Jul 2024 11:58:53 +0000 (13:58 +0200)] 
s4:torture: Initialize union smb_open

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/raw/open.c:1136: var_decl: Declaring variable ""io1"" without initializer.
samba-4.20.0rc2/source4/torture/raw/open.c:1198: uninit_use_in_call: Using uninitialized value ""io1.ntcreatex.out.file.fnum"" when calling ""smbcli_close"".
 1196|    done:
 1197|    smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
 1198|->  smbcli_close(cli->tree, io1.ntcreatex.out.file.fnum);
 1199|    smbcli_deltree(cli->tree, BASEDIR);
 1200|    return ret;"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agos4:torture: Initialize struct netr_IdentityInfo
Andreas Schneider [Fri, 5 Jul 2024 11:37:30 +0000 (13:37 +0200)] 
s4:torture: Initialize struct netr_IdentityInfo

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/rpc/samr.c:3601: var_decl: Declaring variable ""identity"" without initializer.
samba-4.20.0rc2/source4/torture/rpc/samr.c:3650: uninit_use: Using uninitialized value ""identity"". Field ""identity.domain_name.length"" is uninitialized.
 3648|    }
 3649|
 3650|->  pinfo.identity_info = identity;
 3651|    logon.password = &pinfo;
 3652|"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
13 months agopython:tests: pass bytes.decode() instead of str(bytes) to assertMultiLineEqual(...
Stefan Metzmacher [Mon, 15 Jul 2024 18:14:46 +0000 (20:14 +0200)] 
python:tests: pass bytes.decode() instead of str(bytes) to assertMultiLineEqual() to get better failure output

When not equal a diff of the two strings highlighting the differences
will be included this way.

This is a flapping test.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jul 16 07:40:41 UTC 2024 on atb-devel-224

13 months agopython:tests: Use assertMultiLineEqual() to get better failure output
Andreas Schneider [Mon, 15 Jul 2024 08:25:50 +0000 (10:25 +0200)] 
python:tests: Use assertMultiLineEqual() to get better failure output

When not equal a diff of the two strings highlighting the differences
will be included this way.

This is a flapping test.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jul 15 13:51:03 UTC 2024 on atb-devel-224

13 months agosmbd: Show blk and chr devices as nfs reparse points
Volker Lendecke [Mon, 8 Jul 2024 09:23:14 +0000 (11:23 +0200)] 
smbd: Show blk and chr devices as nfs reparse points

Can't test these in selftest, we can't create devices and I don't want
us to depend on /dev to exist. Tested manually on a system where
/dev/null exists:

Try "help" to get a list of possible commands.
smb: \> allinfo null
altname: null
create_time:    Fri Jun 21 02:45:59 PM 2024 CEST
access_time:    Fri Jun 21 02:45:59 PM 2024 CEST
write_time:     Fri Jun 21 02:45:59 PM 2024 CEST
change_time:    Fri Jun 21 02:45:59 PM 2024 CEST
attributes:  (480)
stream: [::$DATA], 0 bytes
0x80000014 (IO_REPARSE_TAG_NFS)
 0x524843 (NFS_SPECFILE_CHR)
 1/3
smb: \>

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): Fri Jul 12 21:36:16 UTC 2024 on atb-devel-224

13 months agosmbd: Report sockets as NFS style reparse points
Volker Lendecke [Sun, 7 Jul 2024 18:39:30 +0000 (20:39 +0200)] 
smbd: Report sockets as NFS style reparse points

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbd: Factor out fsctl_get_reparse_point_int
Volker Lendecke [Sun, 7 Jul 2024 18:37:49 +0000 (20:37 +0200)] 
smbd: Factor out fsctl_get_reparse_point_int

We'll use it for the other special files as well

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbd: Show sockets as reparse points in fdos_mode
Volker Lendecke [Mon, 8 Jul 2024 08:25:05 +0000 (10:25 +0200)] 
smbd: Show sockets as reparse points in fdos_mode

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agotests: Sockets should be shown as NFS reparse points
Volker Lendecke [Sun, 7 Jul 2024 18:28:59 +0000 (20:28 +0200)] 
tests: Sockets should be shown as NFS reparse points

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agotests: Factor out do_test_nfs_reparse
Volker Lendecke [Sun, 7 Jul 2024 18:21:12 +0000 (20:21 +0200)] 
tests: Factor out do_test_nfs_reparse

Will be used for sockets next

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbd: Report FIFOs as NFS style reparse points
Volker Lendecke [Fri, 5 Jul 2024 15:58:55 +0000 (17:58 +0200)] 
smbd: Report FIFOs as NFS style reparse points

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbd: Turn an if-statement getting reparse points into a switch
Volker Lendecke [Fri, 5 Jul 2024 15:31:19 +0000 (17:31 +0200)] 
smbd: Turn an if-statement getting reparse points into a switch

There will be more cases soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbd: Show fifos as reparse points in fdos_mode
Volker Lendecke [Fri, 5 Jul 2024 15:57:44 +0000 (17:57 +0200)] 
smbd: Show fifos as reparse points in fdos_mode

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbd: Turn file type handling in fdos_mode into a switch
Volker Lendecke [Fri, 5 Jul 2024 15:56:40 +0000 (17:56 +0200)] 
smbd: Turn file type handling in fdos_mode into a switch

There will be more cases soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agosmbd: Add DBG to return tag for SMB_FILE_ATTRIBUTE_TAG_INFORMATION
Volker Lendecke [Fri, 5 Jul 2024 15:30:49 +0000 (17:30 +0200)] 
smbd: Add DBG to return tag for SMB_FILE_ATTRIBUTE_TAG_INFORMATION

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agotests: FIFOs should be shown as NFS reparse points
Volker Lendecke [Mon, 17 Jun 2024 10:45:18 +0000 (12:45 +0200)] 
tests: FIFOs should be shown as NFS reparse points

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agotests: Run reparsepoint tests in fileserver_smb1
Volker Lendecke [Fri, 5 Jul 2024 16:03:10 +0000 (18:03 +0200)] 
tests: Run reparsepoint tests in fileserver_smb1

We'll need posix extensions soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agovfs: xattr calls give EBADF for sockets
Volker Lendecke [Mon, 8 Jul 2024 17:37:01 +0000 (19:37 +0200)] 
vfs: xattr calls give EBADF for sockets

This is required for make test with disabled O_PATH

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
13 months agopidl: Wireshark: Another C99 type conversion
John Thacker [Wed, 3 Jul 2024 12:03:41 +0000 (08:03 -0400)] 
pidl: Wireshark: Another C99 type conversion

Pick up change from Wireshark:

    commit bdb719f846f9d8f7800b9f50dadfde5e7f7a89e1
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Sun Jun 23 08:15:45 2024 -0400

        pidl: Another C99 type conversion

        Change an automated sizeof() call in the pidl dissector generation from
        prefixing a "g" to getting the actual C type.

        Ping #19116

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jul 12 11:08:03 UTC 2024 on atb-devel-224

13 months agopidl: Wireshark: Don't assign hash undef, assign it an empty array
John Thacker [Wed, 3 Jul 2024 12:00:59 +0000 (08:00 -0400)] 
pidl: Wireshark: Don't assign hash undef, assign it an empty array

Pick up change from Wireshark:

    commit ade6577f109e2bf741909226254b758e79a816f1
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Fri Jun 21 20:27:51 2024 -0400

        pidl: Don't assign hash undef, assign it an empty array

        Perl works, but complains if warnings are on, if a hash is
        initialized to undef instead of to empty. Upstream Samba turned on
        warnings in the next commit to catch things like this.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agopidl: Wireshark: Remove init of proto variables
John Thacker [Wed, 3 Jul 2024 11:58:04 +0000 (07:58 -0400)] 
pidl: Wireshark: Remove init of proto variables

Pick up change from Wireshark:

    commit 10b046cbdd110dbae8f4cab048e5954bf6955402
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Sat Jun 22 20:31:40 2024 -0400

        pidl: Remove init of proto variables

        Remove initialization of proto variables from pidl generated dissectors
        and regenerate.
        Follow up to 2a9bc63325c99653c5da873c273430add3b5e9dd

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agopidl: Wireshark: Convert the pidl dissector generation code to C99 types
John Thacker [Wed, 3 Jul 2024 11:56:42 +0000 (07:56 -0400)] 
pidl: Wireshark: Convert the pidl dissector generation code to C99 types

Pick up change from Wireshark:

    commit 4df8d2884ddfe72a03d0b322c10ae515a8366ea4
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Sat Jun 22 11:21:47 2024 -0400

        pidl: Convert the pidl dissector generation code to C99 types

        Switch the Wireshark.pm pidl dissector generation code to using C99
        types, and regenerated the dcerpc pidl dissectors.

        Ping #19116

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agopidl: Wireshark: Update test for removal of ett initialization
John Thacker [Wed, 3 Jul 2024 11:54:40 +0000 (07:54 -0400)] 
pidl: Wireshark: Update test for removal of ett initialization

Pick up change from Wireshark:

    commit 6e4c81b324e9b1752ce6bc253a09355512b5b387
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Sat Jun 22 11:10:48 2024 -0400

        pidl: Update test for removal of ett initialization

        Also remove trailing whitespace

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agopidl: Wireshark: Const-ify dcerpc_sub_dissector structures.
John Thacker [Wed, 3 Jul 2024 11:52:42 +0000 (07:52 -0400)] 
pidl: Wireshark: Const-ify dcerpc_sub_dissector structures.

Pick up change from Wireshark:

    commit 8a2a42241fd148ce735e776a6a1e6b49b64d215e
    Author: Darius Davis <darius-wireshark@free-range.com.au>
    Date:   Sun May 19 17:39:38 2024 +1000

        Const-ify dcerpc_sub_dissector structures.

        This moves about 56 kBytes of data from a read-write data section to read-only.

        The various dissectors were _not_ regenerated for this commit.  Instead, this
        commit was produced using the following command:

           find * -type f -exec sed -i -e 's/\(["'\'']\|^\)static dcerpc_sub_dissector/\1static const dcerpc_sub_dissector/' \{\} \;

        This updates the generator script and its test, as well as making an identical
        change to all of the dissectors, regardless of whether or not those dissectors
        were produced by the generator script.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agopidl: Wireshark: Don't initialise static hf and ett variables.
John Thacker [Wed, 3 Jul 2024 11:50:55 +0000 (07:50 -0400)] 
pidl: Wireshark: Don't initialise static hf and ett variables.

Pick up change from Wireshark:

    commit 9ca6eff53db29cad7dfc7e57fba4d68e9c838ab5
    Author: Anders Broman <a.broman58@gmail.com>
    Date:   Thu May 2 14:14:29 2024 +0200

        PIDL: Don't initialise static hf and ett variables.

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agopidl: Wireshark: Remove init of proto variables
John Thacker [Wed, 3 Jul 2024 11:49:15 +0000 (07:49 -0400)] 
pidl: Wireshark: Remove init of proto variables

Pick up change from Wireshark as it applies to PIDL:

    commit 2a9bc63325c99653c5da873c273430add3b5e9dd
    Author: Stig Bjørlykke <stig@bjorlykke.org>
    Date:   Mon Nov 20 08:16:40 2023 +0100

        Remove init of proto variables

        Remove init of proto, header field, expert info and subtree variables.
        This will reduces the binary size by approximate 1266320 bytes due to
        using .bss to zero-initialize the fields.

        The conversion is done using the tools/convert-proto-init.py script

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agopidl: Update Wireshark generated DRSUAPI code
John Thacker [Wed, 3 Jul 2024 11:42:26 +0000 (07:42 -0400)] 
pidl: Update Wireshark generated DRSUAPI code

Picked from Wireshark:

    commit b1249b0be4badc44cbbb30ff414d32d1b884a668
    Author: hidd3ncod3s Sec <hidd3ncod3s@gmail.com>
    Date:   Tue Aug 15 04:29:08 2023 +0000

        DCERPC: Update DRSUAPI support

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months ago.gitlab-ci-main.yml: Add safe.directory '*'
Pavel Filipenský [Thu, 4 Jul 2024 09:08:03 +0000 (11:08 +0200)] 
.gitlab-ci-main.yml: Add safe.directory '*'

This is to fix the error when pushing to personal gitlab repo:

2024-07-04 08:16:05,460 Running: 'git clone --recursive --shared /builds/pfilipen/samba /builds/samba-testbase/master' in '/builds/pfilipen/samba'
Cloning into '/builds/samba-testbase/master'...
fatal: detected dubious ownership in repository at '/builds/pfilipen/samba/.git'
To add an exception for this directory, call:
git config --global --add safe.directory /builds/pfilipen/samba/.git
fatal: Could not read from remote repository.

Instead of adding more and more explicit repositories
we should just allow any, we're in an isolated environment...

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
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 Jul 10 10:35:00 UTC 2024 on atb-devel-224

13 months agocmdline:burn: list commands to always burn; warn on unknown
Douglas Bagnall [Fri, 5 Jul 2024 02:31:58 +0000 (14:31 +1200)] 
cmdline:burn: list commands to always burn; warn on unknown

We burn arguments to all unknown options containing "pass" (e.g.
"--passionate=false") in case they are a password option, but is bad
in the case where the unknown option takes no argument but the next
option *is* a password (like "--overpass --password2 barney". In that
case "--password2" would be burnt and not "barney".

The burning behaviour doesn't change with this commit, but users will now
see an error message explaining that the option was unknown. This is not
so much aimed at end users -- for who an invalid option will hopefully
lead to --help like output -- but to developers who add a new "pass"
option.

This also slightly speeds up the processing of known password options,
which is a little bit important because we are in a race to replace the
command line in /proc before an attacker sees it.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Jul 10 06:28:08 UTC 2024 on atb-devel-224

13 months agocmdline: samba-tool test for bad option warning
Douglas Bagnall [Fri, 5 Jul 2024 04:13:04 +0000 (16:13 +1200)] 
cmdline: samba-tool test for bad option warning

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
13 months agovfs_ceph: Disable the module on unsupported Ceph versions
Anoop C S [Mon, 8 Jul 2024 07:24:06 +0000 (12:54 +0530)] 
vfs_ceph: Disable the module on unsupported Ceph versions

For the last major release(v4.20) we had a warning issued(fe16ae1fe834)
to inform about the plan to disable building vfs_ceph in the absence of
certain required APIs. This is now due to make the changes and further
disable building the module if minimum required libcephfs APIs are not
present. As we speak this requirement includes ceph_select_filesystem()
and *at() variants of libcephfs APIs. These were around since v17(even
earlier for ceph_select_filesystem) which is the lowest non-EOL version
of Ceph available[1] at the moment.

[1] https://docs.ceph.com/en/latest/releases/#ceph-releases-index

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Tue Jul  9 13:05:47 UTC 2024 on atb-devel-224

13 months agoldap_server: Add a ldapsrv debug class to log LDAP queries
Andréas Leroux [Fri, 5 Jul 2024 12:21:33 +0000 (14:21 +0200)] 
ldap_server: Add a ldapsrv debug class to log LDAP queries

Patch updated for recent samba versions in merge request #3295 by kvvloten
Initial patch created by Jeremy Allison (https://www.spinics.net/lists/samba/msg161128.html) to log LDAP server queries/functions in a separate file

Signed-off-by: Andréas Leroux <aleroux@tranquil.it>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jul  9 08:37:22 UTC 2024 on atb-devel-224

13 months agos3:rpc_server: Initialize array
Andreas Schneider [Tue, 2 Jul 2024 09:41:41 +0000 (11:41 +0200)] 
s3:rpc_server: Initialize array

"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source3/rpc_server/svcctl/srv_svcctl_nt.c:163: var_decl: Declaring variable ""ace"" without initializer.
samba-4.20.0rc2/source3/rpc_server/svcctl/srv_svcctl_nt.c:182: uninit_use_in_call: Using uninitialized value ""*ace"". Field ""ace->object"" is uninitialized when calling ""make_sec_acl"".
  180|    /* create the security descriptor */
  181|
  182|->  if ( !(theacl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) )
  183|    return NULL;
  184|"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jul  8 08:37:46 UTC 2024 on atb-devel-224