]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
13 months agoselftest: Add tests for keytab update
Pavel Filipenský [Fri, 3 Sep 2021 17:10:01 +0000 (19:10 +0200)] 
selftest: Add tests for keytab update

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: Add "sync machine password to keytab" to env. ad_member_idmap_nss
Pavel Filipenský [Fri, 3 Sep 2021 17:07:48 +0000 (19:07 +0200)] 
selftest: Add "sync machine password to keytab" to env. ad_member_idmap_nss

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3:utils: Change net_ads_keytab_create() to call sync_pw2keytabs()
Pavel Filipenský [Thu, 15 Feb 2024 10:10:06 +0000 (11:10 +0100)] 
s3:utils: Change net_ads_keytab_create() to call sync_pw2keytabs()

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3:libnet: Sync keytab during libnet_join_create_keytab()
Pavel Filipenský [Tue, 13 Feb 2024 12:43:50 +0000 (13:43 +0100)] 
s3:libnet: Sync keytab during libnet_join_create_keytab()

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3: Sync machine account password in secrets_{prepare,finish}_password_change
Pavel Filipenský [Thu, 21 Dec 2023 12:57:38 +0000 (13:57 +0100)] 
s3: Sync machine account password in secrets_{prepare,finish}_password_change

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3:ads: Remove 'kerberos method' warning for 'net ads keytab' functions
Pavel Filipenský [Fri, 26 Jul 2024 11:15:03 +0000 (13:15 +0200)] 
s3:ads: Remove 'kerberos method' warning for 'net ads keytab' functions

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3:ads: Do not update system keytab from "net ads changetrustpw"
Pavel Filipenský [Thu, 21 Dec 2023 12:57:38 +0000 (13:57 +0100)] 
s3:ads: Do not update system keytab from "net ads changetrustpw"

It will be done in secrets_{prepare,finish}_password_change

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3:lib: Sync machine password to keytab: helper functions
Pavel Filipenský [Mon, 6 Sep 2021 14:58:17 +0000 (16:58 +0200)] 
s3:lib: Sync machine password to keytab: helper functions

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3:libads: Request "msDS-KeyVersionNumber" from ads_find_machine_acct()
Pavel Filipenský [Tue, 23 Jan 2024 16:19:30 +0000 (17:19 +0100)] 
s3:libads: Request "msDS-KeyVersionNumber" from ads_find_machine_acct()

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3:libads: Use the TRACE SUPPORT for keys operations
Pavel Filipenský [Thu, 7 Dec 2023 16:49:07 +0000 (17:49 +0100)] 
s3:libads: Use the TRACE SUPPORT for keys operations

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agokrb5_wrap: Add TRACE SUPPORT for keys operations
Pavel Filipenský [Wed, 7 Jul 2021 18:06:48 +0000 (20:06 +0200)] 
krb5_wrap: Add TRACE SUPPORT for keys operations

The trace looks like below. Useful is the last filed - hex dump of the
data - allows to search for all manipulations.

KEYTAB_TRACE sync_pw2keytabs_process_keytab:622 add ADMEMKEYTAB$@ADDOM.SAMBA.EXAMPLE.COM 14 17 C66D244CB26005C7D6FF9FC00FCBBE4A

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3:testparm: Add check for "sync machine password to keytab" to testparm
Pavel Filipenský [Sun, 17 Dec 2023 15:15:00 +0000 (16:15 +0100)] 
s3:testparm: Add check for "sync machine password to keytab" to testparm

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agodocs:smbdotconf: Add parameter 'sync machine password script'
Pavel Filipenský [Wed, 28 Feb 2024 12:30:55 +0000 (13:30 +0100)] 
docs:smbdotconf: Add parameter 'sync machine password script'

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

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agodocs:smbdotconf: Add parameter 'sync machine password to keytab'
Pavel Filipenský [Fri, 3 Sep 2021 17:07:01 +0000 (19:07 +0200)] 
docs:smbdotconf: Add parameter 'sync machine password to keytab'

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3:lib: Merge library trusts_util into library ads
Pavel Filipenský [Wed, 2 Jun 2021 13:20:46 +0000 (15:20 +0200)] 
s3:lib: Merge library trusts_util into library ads

Function trust_pw_change() originally from library trustis_util was updated
to call functionality from ads library. This would introduce circular
dependency between the two libraries. To avoid it, trusts_util is merged
into ads.

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

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoWHATSNEW.txt: document "veto files" and "hide files"
Ralph Boehme [Fri, 2 Feb 2024 14:14:27 +0000 (15:14 +0100)] 
WHATSNEW.txt: document "veto files" and "hide files"

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jul 26 11:10:42 UTC 2024 on atb-devel-224

13 months agos3/lib: return error from set_namearray()
Ralph Boehme [Wed, 7 Feb 2024 10:40:29 +0000 (11:40 +0100)] 
s3/lib: return error from set_namearray()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: return errors from token_contains_name()
Ralph Boehme [Fri, 2 Feb 2024 07:10:54 +0000 (08:10 +0100)] 
smbd: return errors from token_contains_name()

Invalid names in "valid users", "invalid users", "read list", "write list",
"veto files" and "hide files" are logged and ignored, but a failure to contact
winbind or a DC from winbind, or a memory allocation failure, now all trigger a
failure of the tree connect.

Manually tested with smbclient with the following hack in winbindd:

---8<---
  $ git di
   source3/winbindd/winbindd_cache.c | 7 +++++++
   1 file changed, 7 insertions(+)

  diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
  index c889489dbbbc..8ccf0a28e11a 100644
  --- a/source3/winbindd/winbindd_cache.c
  +++ b/source3/winbindd/winbindd_cache.c
  @@ -1821,6 +1821,13 @@ NTSTATUS wb_cache_name_to_sid(struct winbindd_domain *domain,
          ZERO_STRUCTP(sid);
          *type = SID_NAME_UNKNOWN;

  +       if (strequal(name, "unknown")) {
  +               return NT_STATUS_OK;
  +       }
  +       if (strequal(name, "iotimeout")) {
  +               return NT_STATUS_IO_TIMEOUT;
  +       }
  +
          status = wcache_name_to_sid(domain, domain_name, name, sid, type);
          if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
                  return status;
---8<---

  veto files = ../unknown/file1/../slow/file2

  $ bin/smbclient -U slow%x //localhost/test -c quit
  $

In the log:

  [2024/03/04 15:21:33.659356,  1, pid=977167, effective(0, 0), real(0, 0)] ../../source3/lib/util_namearray.c:128(token_contains_name)
    token_contains_name: lookup_name 'unknown' failed

  veto files = ../iotimeout/file1/../slow/file2

  $ bin/smbclient -U slow%x //localhost/test -c quit
  tree connect failed: NT_STATUS_LOGON_FAILURE
  $

  [2024/03/04 15:22:15.655811,  0, pid=977177, effective(0, 0), real(0, 0)] ../../source3/lib/util_namearray.c:131(token_contains_name)
    token_contains_name: lookup_name 'iotimeout' failed NT_STATUS_NO_SUCH_DOMAIN
  [2024/03/04 15:22:15.655846,  1, pid=977177, effective(0, 0), real(0, 0)] ../../source3/smbd/uid.c:381(change_to_user_impersonate)
    change_to_user_impersonate: SMB user slow (unix user slow) not permitted access to share test.
  [2024/03/04 15:22:15.655855,  0, pid=977177, effective(0, 0), real(0, 0)] ../../source3/smbd/smb2_service.c:689(make_connection_snum)
    make_connection_snum: Can't become connected user!

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/lib: use lookup_name_smbconf_ex() in token_contains_name()
Ralph Boehme [Fri, 9 Feb 2024 14:24:27 +0000 (15:24 +0100)] 
s3/lib: use lookup_name_smbconf_ex() in token_contains_name()

No change in behaviour as we still ignore lookup erros as well as a not-found
result.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/passdb: add lookup_name_smbconf_ex() using lookup_name_internal()
Ralph Boehme [Fri, 9 Feb 2024 08:40:23 +0000 (09:40 +0100)] 
s3/passdb: add lookup_name_smbconf_ex() using lookup_name_internal()

Returns NTSTATUS instead of bool. lookup_name_smbconf() becomes a thin
wrapper around lookup_name_smbconf_ex().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/passdb: factor out lookup_name_internal()
Ralph Boehme [Fri, 9 Feb 2024 09:53:35 +0000 (10:53 +0100)] 
s3/passdb: factor out lookup_name_internal()

lookup_name() becomes a thin wrapper around lookup_name_internal(). Prepares for
adding more callers to lookup_name_internal() that are interested in the
NTSTATUS return value to distinguish between NAME_NOT_FOUND lookup results and
real errors.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/passdb: use winbind_lookup_name_ex() in lookup_name() instead of winbind_lookup_name()
Ralph Boehme [Thu, 8 Feb 2024 17:20:15 +0000 (18:20 +0100)] 
s3/passdb: use winbind_lookup_name_ex() in lookup_name() instead of winbind_lookup_name()

No change in behaviour, prepares for returning NTSTATUS instead of bool from
lookup_name().

Review-with: git show -w

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/passdb: add winbind_lookup_name_ex()
Ralph Boehme [Thu, 8 Feb 2024 17:20:15 +0000 (18:20 +0100)] 
s3/passdb: add winbind_lookup_name_ex()

Differs from winbind_lookup_name() by

- returning NTSTATUS instead of bool, so callers can distinguish between
STATUS_NAME_NOT_FOUND lookup results and real errors.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3-errormap: add WBC_ERR_NOT_MAPPED -> NT_STATUS_NONE_MAPPED
Ralph Boehme [Fri, 16 Feb 2024 16:16:57 +0000 (17:16 +0100)] 
s3-errormap: add WBC_ERR_NOT_MAPPED -> NT_STATUS_NONE_MAPPED

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3-errormap: move map_nt_error_from_wbcErr() back into errormap.c
Ralph Boehme [Thu, 8 Feb 2024 11:09:33 +0000 (12:09 +0100)] 
s3-errormap: move map_nt_error_from_wbcErr() back into errormap.c

This basically reverts commit 313db81ad3de6cf7759d6a0fc21ee32419b2e62b.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/rpc_client: fix handling of NT_STATUS_SOME_NOT_MAPPED
Ralph Boehme [Wed, 6 Mar 2024 13:23:45 +0000 (14:23 +0100)] 
s3/rpc_client: fix handling of NT_STATUS_SOME_NOT_MAPPED

In this case names that couldn't be resolved will be have a NULL sid pointer
which would trigger a crash in sid_copy().

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
13 months agowinbindd: let LookupNames return NT_STATUS_OK and SID_NAME_UNKNOWN for unmapped names
Ralph Boehme [Fri, 16 Feb 2024 15:44:57 +0000 (16:44 +0100)] 
winbindd: let LookupNames return NT_STATUS_OK and SID_NAME_UNKNOWN for unmapped names

Previously LookupNames would fail if a name could not be translated, so winbindd
clients like libwbclient couldn't differentiate between not being able to talk
to a DC and just an unkown name.

As a visible change this alters

  $ bin/wbinfo -n Idontexist
  failed to call wbcLookupName: WBC_ERR_DOMAIN_NOT_FOUND
  Could not lookup name Idontexist

to

  $ bin/wbinfo -n Idontexist
  failed to call wbcLookupName: WBC_ERR_SOME_NOT_MAPPED
  Could not lookup name Idontexist

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agolibwbclient: prepare wbcCtxLookupName() for dealing with WBC_SID_NAME_UNKNOWN
Ralph Boehme [Fri, 16 Feb 2024 15:38:11 +0000 (16:38 +0100)] 
libwbclient: prepare wbcCtxLookupName() for dealing with WBC_SID_NAME_UNKNOWN

This changes the wbcErr from WBC_ERR_DOMAIN_NOT_FOUND to WBC_ERR_NOT_MAPPED.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agolibwbclient: add error WBC_ERR_NOT_MAPPED
Ralph Boehme [Fri, 16 Feb 2024 15:33:57 +0000 (16:33 +0100)] 
libwbclient: add error WBC_ERR_NOT_MAPPED

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agowinbindd: properly initialize sid and type in wb_cache_name_to_sid()
Ralph Boehme [Fri, 16 Feb 2024 15:42:59 +0000 (16:42 +0100)] 
winbindd: properly initialize sid and type in wb_cache_name_to_sid()

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agowinbindd: collapse two if expressions
Ralph Boehme [Fri, 16 Feb 2024 15:19:34 +0000 (16:19 +0100)] 
winbindd: collapse two if expressions

No change in behaviour.

After calling set_domain_offline() domain->offline will be set to false, iow
everytime

  if (!domain->internal && was_online)

is true,

  if (!domain->internal &&
      !domain->online &&
      was_online)

will also true, so we can drop the second if expression.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agowinbindd: reformatting
Ralph Boehme [Fri, 16 Feb 2024 15:17:33 +0000 (16:17 +0100)] 
winbindd: reformatting

No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agowinbindd: rename variable old_status to was_online in wb_cache_name_to_sid()
Ralph Boehme [Fri, 16 Feb 2024 15:12:43 +0000 (16:12 +0100)] 
winbindd: rename variable old_status to was_online in wb_cache_name_to_sid()

A lot easier to make sense of the complex logic when using this name.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoCI: add a test for per-user (and per-group) veto files
Ralph Boehme [Thu, 25 Jan 2024 14:03:10 +0000 (15:03 +0100)] 
CI: add a test for per-user (and per-group) veto files

Not adding a specific test for per-user hide files as that uses the exact same
mechanism as the per-user veto files.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoCI: fix test file cleanup
Ralph Boehme [Thu, 25 Jan 2024 15:26:42 +0000 (16:26 +0100)] 
CI: fix test file cleanup

Test files are stored beneath "$SHAREPATH/dir1", not "$SHAREPATH/dir_1".

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/lib: add per-user support to set_namearray()
Ralph Boehme [Fri, 2 Feb 2024 11:04:10 +0000 (12:04 +0100)] 
s3/lib: add per-user support to set_namearray()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: move token_contains_name() to util_namearray.c and make it public
Ralph Boehme [Wed, 7 Feb 2024 07:46:43 +0000 (08:46 +0100)] 
smbd: move token_contains_name() to util_namearray.c and make it public

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agoselftest: add groups "group1" and "group2" to Samba3
Ralph Boehme [Thu, 25 Jan 2024 07:07:49 +0000 (08:07 +0100)] 
selftest: add groups "group1" and "group2" to Samba3

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agos3/lib: move set_namearray() to util_namearray.c
Ralph Boehme [Wed, 7 Feb 2024 09:21:33 +0000 (10:21 +0100)] 
s3/lib: move set_namearray() to util_namearray.c

Needed to fix circular dependencies between samba-passdb, secrets3 and
samba3util (iirc).

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: maintain veto_list and hide_list in the vuid cache
Ralph Boehme [Wed, 7 Feb 2024 09:18:13 +0000 (10:18 +0100)] 
smbd: maintain veto_list and hide_list in the vuid cache

Prepares for adding per-user support to both options. I don't think it makes
sense also adding per-user support to "veto oplock files" and "aio write behind"
so I'm ignoring those.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: prepare free_conn_session_info_if_unused() for more cleanup logic
Ralph Boehme [Tue, 23 Jan 2024 14:29:17 +0000 (15:29 +0100)] 
smbd: prepare free_conn_session_info_if_unused() for more cleanup logic

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
13 months agosmbd: move target code out of loop body
Ralph Boehme [Tue, 23 Jan 2024 14:19:12 +0000 (15:19 +0100)] 
smbd: move target code out of loop body

Reduces indentation of the code code that is run in this function and prepares
for adding more of it.

Review with: git show -w

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
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>