gd/samba/.git
21 months agos3-librpc: use nbt_server_type in ads.idl master-ads-autogen-only
Günther Deschner [Thu, 18 Aug 2016 14:35:29 +0000 (16:35 +0200)]
s3-librpc: use nbt_server_type in ads.idl

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
21 months agos3-librpc: add ads.idl and convert ads_struct to talloc.
Günther Deschner [Wed, 17 Aug 2016 09:58:02 +0000 (11:58 +0200)]
s3-librpc: add ads.idl and convert ads_struct to talloc.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
21 months agodocs-xml:manpages: update vfs_fileid.8.xml for the recent changes
Stefan Metzmacher [Tue, 28 Jun 2022 16:25:46 +0000 (16:25 +0000)]
docs-xml:manpages: update vfs_fileid.8.xml for the recent changes

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Jul  5 16:01:10 UTC 2022 on sn-devel-184

21 months agos3:vfs_fileid: add 'fileid:nolock_all_inodes = BOOL'
Stefan Metzmacher [Wed, 29 Jun 2022 15:50:08 +0000 (17:50 +0200)]
s3:vfs_fileid: add 'fileid:nolock_all_inodes = BOOL'

This adds the feature of the 'hostname' algorithm,
but provides it for all algorithms, including 'next_module'.

This can be used to deliberately break lock coherency, but
keep the devid/inode pair untouched, as this will only
alter file_id.extid:

  vfs objects = fileid
  fileid:algorithm = next_module
  fileid:nolock_all_inodes = yes

This should be preferred unless someone is already using the
'hostname' algorithm.

Note this is only for testing (or read only shares if at all...)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos3:vfs_fileid: add 'fileid:nolock_all_dirs = BOOL'
Stefan Metzmacher [Wed, 29 Jun 2022 15:50:08 +0000 (17:50 +0200)]
s3:vfs_fileid: add 'fileid:nolock_all_dirs = BOOL'

This adds the feature of the 'fsname_nodirs' algorithm,
but provides it for all algorithms, including 'next_module'.

This can be used to deliberately break lock coherency, but
keep the devid/inode pair untouched, e.g.

  vfs objects = fileid
  fileid:algorithm = next_module
  fileid:nolock_all_dirs = yes

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos3:vfs_fileid: introduce 'fileid:nolock_paths'
Stefan Metzmacher [Wed, 29 Jun 2022 15:14:22 +0000 (17:14 +0200)]
s3:vfs_fileid: introduce 'fileid:nolock_paths'

This brings much more flexibility compared to:
- 'fsname_norootdir', 'fsname_norootdir_ext',
  which only allow the nolock behavior for the share root
- 'fileid:nolockinode', which only gets a single inode number,
  and ignores the devide id completely.

You can specify path names, which are relative to the shareroot
or absolute.

These names are only evaluated at SMB_VFS_CONNECT() time,
where they are converted into devide and inode pairs.
It means they are completely ignored if the path doesn't
exist yet, or is replaced by a new inode later.

This allows:

- 'fileid:algorithm = fsname_norootdir'
  to be replaced by:
  'fileid:algorithm = fsname' (the default)
  'fileid:nolock_paths = .'

- 'fileid:algorithm = fsname_norootdir_ext'
  to be replaced by:
  'fileid:algorithm = fsname' (the default)
  'fileid:nolock_paths = .'
  'fileid:nolock_max_slots = 18446744073709551615'

And 'fileid:nolockinode = 1234567' and be replaced by
'fileid:nolock_paths = Very/Contended/Path' or
'fileid:nolock_paths = . Very/Contended/Path1 /data/conteded.dir',
if the share root and two additional inodes should be handled
by the 'nolock' behavior.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos3:vfs_fileid: introduce 'fileid:nolock_max_slots'
Stefan Metzmacher [Wed, 29 Jun 2022 15:09:51 +0000 (17:09 +0200)]
s3:vfs_fileid: introduce 'fileid:nolock_max_slots'

This controlls the maximum number of concurrent locking slots
on each host. It specifies the maximal number of locking.tdb
records for a single inode.

It can be used to deliberately break lock coherency not
only between cluster nodes, but also between processes on
each node.

This allows administrators to control the behavior that's
currently only available by 'fsname_norootdir_ext' to
other cases as well.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos3:vfs_fileid: also imply the generic nolock logic to the legacy 'hostname' algorithm
Stefan Metzmacher [Wed, 29 Jun 2022 15:06:12 +0000 (17:06 +0200)]
s3:vfs_fileid: also imply the generic nolock logic to the legacy 'hostname' algorithm

That way the file_id.extid is consistenly filled for all cases
where we deliberately break lock coherency.

This will simplify further changes and give administrators more
flexibility.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos3:vfs_fileid: also handle 'fsname_nodirs' via fileid_is_nolock_inode()
Stefan Metzmacher [Wed, 29 Jun 2022 15:02:32 +0000 (17:02 +0200)]
s3:vfs_fileid: also handle 'fsname_nodirs' via fileid_is_nolock_inode()

This means we'll be able to provide the 'nolock' feature for all
directories also with other algorithms than 'fsname' in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos3:vfs_fileid: always add the 'nolock' behavior via file_id.extid
Stefan Metzmacher [Wed, 29 Jun 2022 14:47:50 +0000 (16:47 +0200)]
s3:vfs_fileid: always add the 'nolock' behavior via file_id.extid

file_id.extid was filled with getpid() by 'fsname_norootdir_ext'.

However instead of forcing the existing 'hostname' algorithm for the 'nolock'
case, we'll now generate file_id.extid also based the hostname, vnn
and for 'fsname_norootdir_ext' also the pid.

This simplifies further changes and gives us the ability to generate stable
results for file_id.{devid,inode} based on the main algorithm. This is important
as we have a push_file_id_16() helper function used in places to generate a
stable identifier of the file that is also client visible and might be stored on
stable storage (acl_tdb, xattr_tdb). While the file_id.extid is only used
internally in volatile databases.

Review with: git show --patience

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos3:vfs_fileid: introduce algorithm 'next_module'
Stefan Metzmacher [Wed, 29 Jun 2022 14:35:47 +0000 (16:35 +0200)]
s3:vfs_fileid: introduce algorithm 'next_module'

This can be use to get just bypass the fileid module for the
common case. But it allows 'fileid:nolockinode' (and in future
other things) to work in order to avoid lock contention
for all 'nolock' inodes.

If we would have started from scratch all the nolock
logic would have been in its own vfs module, just
altering file_id.extid

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos3:vfs_fileid: maintain an array of nolock inodes
Stefan Metzmacher [Wed, 29 Jun 2022 14:31:22 +0000 (16:31 +0200)]
s3:vfs_fileid: maintain an array of nolock inodes

This way 'fsname_norootdir[_ext]' is not overwritten by
'fileid:nolockinode' and both can work independently.

It will also allow us to add more nolock inodes under
other conditions in the following changes.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos3:vfs_fileid: move to a single mapping_fn() returning struct file_id
Stefan Metzmacher [Wed, 22 Jun 2022 15:33:49 +0000 (17:33 +0200)]
s3:vfs_fileid: move to a single mapping_fn() returning struct file_id

This makes the code much less magic (at least for me) and
it will allow further changes to be made easier.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos4:torture/smb2: add smb2.bench.path-contention-shared
Stefan Metzmacher [Thu, 23 Jun 2022 10:23:53 +0000 (12:23 +0200)]
s4:torture/smb2: add smb2.bench.path-contention-shared

This test tortures contention on a single path where
all opens are shared stat opens without any oplock/lease
interaction.

It opens 'nproc' connections to the share and runs
for 'timelimit' seconds, while it opens and closes
the 'bench_path' on each connection as fast as possible.

The number of concurrent connections can be specified
with:

  --option="torture:nprocs=256"

while the default is 4.

The runtime can be specified by

  --option='torture:timelimit=30'

the default being 10.

By default the test operates on the share root directory, but
the path can be changed with:

  --option='torture:bench_path=Apps\1\2\3\4\5\6\7\8\9\10'

pointing to an existing file or directory.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 months agos4:torture/smb2: rename 'smb2.bench-oplock' to 'smb2.bench.oplock'
Stefan Metzmacher [Tue, 28 Jun 2022 14:44:51 +0000 (14:44 +0000)]
s4:torture/smb2: rename 'smb2.bench-oplock' to 'smb2.bench.oplock'

We should have a toplevel 'smb2.bench' suite for all benchmark tests.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
22 months agos3: libads: Fix coverity false positive.
Jeremy Allison [Fri, 1 Jul 2022 15:49:42 +0000 (08:49 -0700)]
s3: libads: Fix coverity false positive.

dn is always returned as NULL on error in ads_build_path(),
but coverity can't see that. Easy change to quieten it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Jul  4 16:42:28 UTC 2022 on sn-devel-184

22 months agos4:mitkdc: Always set SDB_F_FOR_{TGS,AS}_REQ flag for DAL >= 9
Samuel Cabrero [Mon, 27 Jun 2022 14:04:56 +0000 (16:04 +0200)]
s4:mitkdc: Always set SDB_F_FOR_{TGS,AS}_REQ flag for DAL >= 9

The KRB5_KDB_FLAG_REFERRAL_OK is to indicate wether a realm referral is
allowed. In AD this is always allowed. Also there is no way to pass that
indication to the SamDB layer.

Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Samuel Cabrero <scabrero@samba.org>
Autobuild-Date(master): Mon Jul  4 12:22:16 UTC 2022 on sn-devel-184

22 months agos3:dbwrap_ctdb: improve the error handling in ctdb_async_ctx_init_internal()
Stefan Metzmacher [Mon, 13 Jun 2022 09:35:31 +0000 (11:35 +0200)]
s3:dbwrap_ctdb: improve the error handling in ctdb_async_ctx_init_internal()

We should not map any error from ctdbd_init_async_connection() to EIO.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jul  1 18:34:17 UTC 2022 on sn-devel-184

22 months agos3:ctdbd_conn: make sure ctdbd_init_async_connection() never returns 0 with conn...
Stefan Metzmacher [Mon, 13 Jun 2022 09:32:30 +0000 (11:32 +0200)]
s3:ctdbd_conn: make sure ctdbd_init_async_connection() never returns 0 with conn = NULL

This should not happen anywhere, but it clears the expectation of the
caller and simplifies the error handling there.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
22 months agotestparm: clarify "Weak crypto is allowed" message
Michael Tokarev [Fri, 20 May 2022 06:48:32 +0000 (09:48 +0300)]
testparm: clarify "Weak crypto is allowed" message

The message testparm prints about weak crypto is really
misleading: "Weak crypto is allowed" is often interpreted
in a way that smb.conf settings are bad by allowing weak
crypto.  While the actual meaning is about the ability to
fall back to weaker crypto for (backwards) compatibility,
and this has nothing to do with samba settings, it is the
gnutls settings. Clarify both of these, and eliminate an
if() and a local variable.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jul  1 14:35:09 UTC 2022 on sn-devel-184

22 months agos4:torture: check return of ndr_pull_init_blob() via torture_assert()
Pavel Filipenský [Tue, 28 Jun 2022 08:52:13 +0000 (10:52 +0200)]
s4:torture: check return of ndr_pull_init_blob() via torture_assert()

Reported by covscan.

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jul  1 08:12:49 UTC 2022 on sn-devel-184

22 months agos3:printing: Do not clear the printer-list.tdb
Andreas Schneider [Wed, 22 Jun 2022 16:56:26 +0000 (18:56 +0200)]
s3:printing: Do not clear the printer-list.tdb

With the new dcerpc architecture we need to keep printer-list.tdb
around. A spoolss dcerpc call will start rpc-spoolssd which will then
start the background queue process. However in order to enum the
printers we need have a printer-list.tdb. Depending on the number of
printers this task can take several seconds. It is unlinkly that
the printer-list will change all the time, so we might provide outdated
data till it gets refreshed, but this is better than providing no
printer list at all.

If there are a lot of printers, the idle_seconds for the rpc-spoolssd
should be increased so that the background task can finish.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun 30 22:08:39 UTC 2022 on sn-devel-184

22 months agos3: libads: Fix return from malloc check.
Jeremy Allison [Wed, 29 Jun 2022 15:29:28 +0000 (08:29 -0700)]
s3: libads: Fix return from malloc check.

We shouldn't be checking *realm != '\0' here, just
the return from malloc.

Coverity CID: 1506719.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun 30 16:28:30 UTC 2022 on sn-devel-184

22 months agos3: winbind: Add missing NULL check for returned talloc'ed ADS struct.
Jeremy Allison [Wed, 29 Jun 2022 15:20:21 +0000 (08:20 -0700)]
s3: winbind: Add missing NULL check for returned talloc'ed ADS struct.

Coverity CID: 1506720.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
22 months agoctdb-tests: Add new tool unit tests to cover UNKNOWN state
Martin Schwenke [Thu, 26 May 2022 22:38:11 +0000 (08:38 +1000)]
ctdb-tests: Add new tool unit tests to cover UNKNOWN state

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Jun 28 10:16:59 UTC 2022 on sn-devel-184

22 months agoctdb-tool: Add UNKNOWN pseudo state
Vinit Agnihotri [Tue, 26 Apr 2022 07:20:21 +0000 (17:20 +1000)]
ctdb-tool: Add UNKNOWN pseudo state

When a node is starting, CTDB reports remote nodes as unhealthy by
default.  This can be misleading.

To hide this, report an "UNKNOWN" pseudo state when a remote node is
not disconnected and the runstate is less than or equal to
"FIRST_RECOVERY".

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
22 months agoctdb-tests: Add runstate handling to fake ctdbd
Vinit Agnihotri [Tue, 26 Apr 2022 07:20:21 +0000 (17:20 +1000)]
ctdb-tests: Add runstate handling to fake ctdbd

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
22 months agoctdb-tests: Return error on empty fake ctdbd configuration blocks
Martin Schwenke [Mon, 27 Jun 2022 00:34:13 +0000 (10:34 +1000)]
ctdb-tests: Return error on empty fake ctdbd configuration blocks

These would be unintended errors.  The block should be omitted to keep
the default value.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
22 months agos3:libads: Check if we have a valid sockaddr
Andreas Schneider [Wed, 22 Jun 2022 18:54:15 +0000 (20:54 +0200)]
s3:libads: Check if we have a valid sockaddr

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jun 27 20:39:31 UTC 2022 on sn-devel-184

22 months agos4:libads: Fix trailing whitespaces in ldap.c
Andreas Schneider [Wed, 22 Jun 2022 18:53:42 +0000 (20:53 +0200)]
s4:libads: Fix trailing whitespaces in ldap.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3: net_ads: Cleanup, remove unused talloc_ctx in net_ads_kerberos_kinit().
Jeremy Allison [Sat, 25 Jun 2022 00:02:43 +0000 (17:02 -0700)]
s3: net_ads: Cleanup, remove unused talloc_ctx in net_ads_kerberos_kinit().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jun 27 16:48:32 UTC 2022 on sn-devel-184

22 months agos3:libads: RIP ads_destroy()
Samuel Cabrero [Wed, 15 Jun 2022 10:36:02 +0000 (12:36 +0200)]
s3:libads: RIP ads_destroy()

All ADS_STRUCT members are allocated under its talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->config.config_path under ADS_STRUCT talloc context
Samuel Cabrero [Wed, 15 Jun 2022 10:29:15 +0000 (12:29 +0200)]
s3:libads: Allocate ads->config.config_path under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->config.schema_path under ADS_STRUCT talloc context
Samuel Cabrero [Wed, 15 Jun 2022 10:26:06 +0000 (12:26 +0200)]
s3:libads: Allocate ads->config.schema_path under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->config.client_site_name under ADS_STRUCT talloc context
Samuel Cabrero [Wed, 15 Jun 2022 10:16:23 +0000 (12:16 +0200)]
s3:libads: Allocate ads->config.client_site_name under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->config.server_site_name under ADS_STRUCT talloc context
Samuel Cabrero [Wed, 15 Jun 2022 10:09:21 +0000 (12:09 +0200)]
s3:libads: Allocate ads->config.server_site_name under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->config.ldap_server_name under ADS_STRUCT talloc context
Samuel Cabrero [Wed, 15 Jun 2022 10:03:56 +0000 (12:03 +0200)]
s3:libads: Allocate ads->config.ldap_server_name under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->config.bind_path under ADS_STRUCT talloc context
Samuel Cabrero [Wed, 15 Jun 2022 09:36:25 +0000 (11:36 +0200)]
s3:libads: Allocate ads->config.bind_path under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Return ADS_STATUS from ads_build_dn()
Samuel Cabrero [Wed, 15 Jun 2022 08:50:22 +0000 (10:50 +0200)]
s3:libads: Return ADS_STATUS from ads_build_dn()

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Return ADS_STATUS from ads_build_path()
Samuel Cabrero [Wed, 15 Jun 2022 08:38:51 +0000 (10:38 +0200)]
s3:libads: Return ADS_STATUS from ads_build_path()

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->config.realm under ADS_STRUCT talloc context
Samuel Cabrero [Mon, 13 Jun 2022 15:44:02 +0000 (17:44 +0200)]
s3:libads: Allocate ads->config.realm under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->auth.ccache_name under ADS_STRUCT talloc context
Samuel Cabrero [Mon, 13 Jun 2022 15:13:20 +0000 (17:13 +0200)]
s3:libads: Allocate ads->auth.ccache_name under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Print ads->auth.ccache_name in ndr_print_ads_struct()
Samuel Cabrero [Mon, 13 Jun 2022 15:04:47 +0000 (17:04 +0200)]
s3:libads: Print ads->auth.ccache_name in ndr_print_ads_struct()

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->auth.kdc_server under ADS_STRUCT talloc context
Samuel Cabrero [Mon, 13 Jun 2022 15:03:01 +0000 (17:03 +0200)]
s3:libads: Allocate ads->auth.kdc_server under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->auth.user_name under ADS_STRUCT talloc context
Samuel Cabrero [Mon, 13 Jun 2022 14:53:32 +0000 (16:53 +0200)]
s3:libads: Allocate ads->auth.user_name under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->auth.password under ADS_STRUCT talloc context
Samuel Cabrero [Mon, 13 Jun 2022 11:56:10 +0000 (13:56 +0200)]
s3:libads: Allocate ads->auth.password under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->auth.realm under ADS_STRUCT talloc context
Samuel Cabrero [Mon, 13 Jun 2022 10:38:24 +0000 (12:38 +0200)]
s3:libads: Allocate ads->auth.realm under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->server.ldap_server under ADS_STRUCT talloc context
Samuel Cabrero [Fri, 10 Jun 2022 14:55:43 +0000 (16:55 +0200)]
s3:libads: Allocate ads->server.ldap_server under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ads->server.workgroup under ADS_STRUCT talloc context
Samuel Cabrero [Fri, 10 Jun 2022 14:09:48 +0000 (16:09 +0200)]
s3:libads: Allocate ads->server.workgroup under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Alloc ads->server.realm under ADS_STRUCT talloc context
Samuel Cabrero [Fri, 10 Jun 2022 13:04:51 +0000 (15:04 +0200)]
s3:libads: Alloc ads->server.realm under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Remove no longer used is_mine flag from ADS_STRUCT
Samuel Cabrero [Wed, 22 Jun 2022 08:50:44 +0000 (10:50 +0200)]
s3:libads: Remove no longer used is_mine flag from ADS_STRUCT

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate ADS_STRUCT under a talloc context
Samuel Cabrero [Thu, 26 May 2022 15:28:34 +0000 (17:28 +0200)]
s3:libads: Allocate ADS_STRUCT under a talloc context

The ads_destroy() function is now static and only called from the
ADS_STRUCT destructor.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_check_int(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 13:13:02 +0000 (15:13 +0200)]
s3:net: Refactor net_ads_check_int(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Move the ads_destroy() function up in the file
Samuel Cabrero [Thu, 26 May 2022 13:02:31 +0000 (15:02 +0200)]
s3:libads: Move the ads_destroy() function up in the file

Will be static soon

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Remove unused define
Samuel Cabrero [Thu, 26 May 2022 12:50:58 +0000 (14:50 +0200)]
s3:libads: Remove unused define

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Pass a talloc context to ads_startup_int()
Samuel Cabrero [Thu, 26 May 2022 12:43:25 +0000 (14:43 +0200)]
s3:net: Pass a talloc context to ads_startup_int()

The ads struct will be allocated under this context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Pass a talloc context to ads_startup()
Samuel Cabrero [Thu, 26 May 2022 12:41:24 +0000 (14:41 +0200)]
s3:net: Pass a talloc context to ads_startup()

The ads struct will be allocated under this context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Exit returning -1 when usage is displayed
Samuel Cabrero [Tue, 21 Jun 2022 11:49:08 +0000 (13:49 +0200)]
s3:net: Exit returning -1 when usage is displayed

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_enctypes_delete(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:51:44 +0000 (13:51 +0200)]
s3:net: Refactor net_ads_enctypes_delete(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_enctypes_set(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:49:18 +0000 (13:49 +0200)]
s3:net: Refactor net_ads_enctypes_set(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_enctypes_list(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:44:17 +0000 (13:44 +0200)]
s3:net: Refactor net_ads_enctypes_list(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_setspn_delete(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:41:43 +0000 (13:41 +0200)]
s3:net: Refactor net_ads_setspn_delete(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_setspn_add(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:37:31 +0000 (13:37 +0200)]
s3:net: Refactor net_ads_setspn_add(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_setspn_list(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:35:11 +0000 (13:35 +0200)]
s3:net: Refactor net_ads_setspn_list(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_keytab_create(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:31:57 +0000 (13:31 +0200)]
s3:net: Refactor net_ads_keytab_create(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_keytab_add(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:29:56 +0000 (13:29 +0200)]
s3:net: Refactor net_ads_keytab_add(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_keytab_flush(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:25:40 +0000 (13:25 +0200)]
s3:net: Refactor net_ads_keytab_flush(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_sid(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:23:30 +0000 (13:23 +0200)]
s3:net: Refactor net_ads_sid(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_dn(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:20:36 +0000 (13:20 +0200)]
s3:net: Refactor net_ads_dn(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_search(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:18:01 +0000 (13:18 +0200)]
s3:net: Refactor net_ads_search(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_changetrustpw(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:14:50 +0000 (13:14 +0200)]
s3:net: Refactor net_ads_changetrustpw(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_password(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 11:08:01 +0000 (13:08 +0200)]
s3:net: Refactor net_ads_password(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_printer_remove(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 10:46:05 +0000 (12:46 +0200)]
s3:net: Refactor net_ads_printer_remove(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_printer_publish(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 10:40:32 +0000 (12:40 +0200)]
s3:net: Refactor net_ads_printer_publish(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_printer_info(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 10:29:14 +0000 (12:29 +0200)]
s3:net: Refactor net_ads_printer_info(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_printer_search(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 10:23:17 +0000 (12:23 +0200)]
s3:net: Refactor net_ads_printer_search(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_dns_unregister(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 10:11:16 +0000 (12:11 +0200)]
s3:net: Refactor net_ads_dns_unregister(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_dns_register(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 10:08:45 +0000 (12:08 +0200)]
s3:net: Refactor net_ads_dns_register(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_join(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 07:37:15 +0000 (09:37 +0200)]
s3:net: Refactor net_ads_join(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_join_ok(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 07:25:34 +0000 (09:25 +0200)]
s3:net: Refactor net_ads_join_ok(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_leave(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 07:18:11 +0000 (09:18 +0200)]
s3:net: Refactor net_ads_leave(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_status(), allocate a talloc context
Samuel Cabrero [Thu, 26 May 2022 07:10:06 +0000 (09:10 +0200)]
s3:net: Refactor net_ads_status(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_group(), allocate a talloc context
Samuel Cabrero [Wed, 25 May 2022 16:06:14 +0000 (18:06 +0200)]
s3:net: Refactor net_ads_group(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Best viewed with "git diff -b".

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor ads_group_delete(), allocate a talloc context
Samuel Cabrero [Wed, 25 May 2022 16:02:11 +0000 (18:02 +0200)]
s3:net: Refactor ads_group_delete(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor ads_group_add(), allocate a talloc context
Samuel Cabrero [Wed, 25 May 2022 15:57:34 +0000 (17:57 +0200)]
s3:net: Refactor ads_group_add(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_user(), allocate a talloc context
Samuel Cabrero [Wed, 25 May 2022 15:41:50 +0000 (17:41 +0200)]
s3:net: Refactor net_ads_user(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Best viewed using "git diff -b".

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor ads_user_delete(), allocate a talloc context
Samuel Cabrero [Wed, 25 May 2022 15:33:02 +0000 (17:33 +0200)]
s3:net: Refactor ads_user_delete(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor ads_user_info(), allocate a talloc context
Samuel Cabrero [Wed, 25 May 2022 15:27:41 +0000 (17:27 +0200)]
s3:net: Refactor ads_user_info(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor ads_user_add(), allocate a talloc context
Samuel Cabrero [Wed, 25 May 2022 15:18:08 +0000 (17:18 +0200)]
s3:net: Refactor ads_user_add(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Pass a memory context to ads_startup_nobind()
Samuel Cabrero [Wed, 25 May 2022 15:09:51 +0000 (17:09 +0200)]
s3:net: Pass a memory context to ads_startup_nobind()

The ads struct will be allocated under this context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_workgroup(), allocate a talloc context
Samuel Cabrero [Wed, 25 May 2022 15:07:42 +0000 (17:07 +0200)]
s3:net: Refactor net_ads_workgroup(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_info(), allocate a talloc context
Samuel Cabrero [Wed, 25 May 2022 15:04:58 +0000 (17:04 +0200)]
s3:net: Refactor net_ads_info(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:net: Refactor net_ads_lookup(), allocate a talloc context
Samuel Cabrero [Wed, 25 May 2022 15:02:14 +0000 (17:02 +0200)]
s3:net: Refactor net_ads_lookup(), allocate a talloc context

ADS_STRUCT will be allocated in the talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Allocate temporary memory context for ads_domain_func_level()
Samuel Cabrero [Tue, 24 May 2022 16:05:38 +0000 (18:05 +0200)]
s3:libads: Allocate temporary memory context for ads_domain_func_level()

Prepare to allocate ADS_STRUCT under talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:libads: Rename talloc context
Samuel Cabrero [Tue, 24 May 2022 16:02:04 +0000 (18:02 +0200)]
s3:libads: Rename talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:winbind: Allocate a temporary memory context for dcip_check_name_ads()
Samuel Cabrero [Tue, 24 May 2022 14:17:42 +0000 (16:17 +0200)]
s3:winbind: Allocate a temporary memory context for dcip_check_name_ads()

Prepare to allocate ADS_STRUCT under a talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:winbind: Early return on error in dcip_check_name_ads()
Samuel Cabrero [Tue, 24 May 2022 14:14:11 +0000 (16:14 +0200)]
s3:winbind: Early return on error in dcip_check_name_ads()

Also use new debug macros and improve debug message.

Best viewed with "git diff -b".

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:winbind: Factor out dcip_check_name_ads()
Samuel Cabrero [Tue, 24 May 2022 14:00:22 +0000 (16:00 +0200)]
s3:winbind: Factor out dcip_check_name_ads()

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:winbind: Create a temporary talloc context for ads_cached_connection_connect()
Samuel Cabrero [Wed, 25 May 2022 14:16:17 +0000 (16:16 +0200)]
s3:winbind: Create a temporary talloc context for ads_cached_connection_connect()

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
22 months agos3:winbind: Pass a memory context to ads_cached_connection_connect()
Samuel Cabrero [Wed, 25 May 2022 14:15:22 +0000 (16:15 +0200)]
s3:winbind: Pass a memory context to ads_cached_connection_connect()

The ads struct will be allocated under this context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>