]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
2 years agonetcmd: models: move remove trustee code to the GMSA model
Rob van der Linde [Mon, 26 Feb 2024 03:24:29 +0000 (16:24 +1300)] 
netcmd: models: move remove trustee code to the GMSA model

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: move add trustee code to the GMSA model
Rob van der Linde [Mon, 26 Feb 2024 03:07:55 +0000 (16:07 +1300)] 
netcmd: models: move add trustee code to the GMSA model

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: tests: add tests for service-account commands
Rob van der Linde [Fri, 23 Feb 2024 00:48:02 +0000 (13:48 +1300)] 
netcmd: tests: add tests for service-account commands

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: gmsa: cli commands for managing group msa membership
Rob van der Linde [Fri, 16 Feb 2024 01:47:23 +0000 (14:47 +1300)] 
netcmd: gmsa: cli commands for managing group msa membership

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: gmsa: base cli commands for group managed service accounts
Rob van der Linde [Fri, 16 Feb 2024 01:46:48 +0000 (14:46 +1300)] 
netcmd: gmsa: base cli commands for group managed service accounts

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agopython: models: Computer constructor automatically adds "$" to account name
Rob van der Linde [Fri, 23 Feb 2024 00:45:19 +0000 (13:45 +1300)] 
python: models: Computer constructor automatically adds "$" to account name

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: aces: fix mutable default args in assemble_ace
Rob van der Linde [Thu, 15 Feb 2024 22:33:41 +0000 (11:33 +1300)] 
selftest: aces: fix mutable default args in assemble_ace

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: aces: use constant from samba.security
Rob van der Linde [Thu, 15 Feb 2024 22:33:01 +0000 (11:33 +1300)] 
selftest: aces: use constant from samba.security

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agopython: sd_utils: pep8 import sorting
Rob van der Linde [Thu, 15 Feb 2024 19:24:08 +0000 (08:24 +1300)] 
python: sd_utils: pep8 import sorting

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agopython: sd_utils: remove redundant brackets around simple assert statements
Rob van der Linde [Thu, 15 Feb 2024 19:03:37 +0000 (08:03 +1300)] 
python: sd_utils: remove redundant brackets around simple assert statements

Ideally these should be exceptions not asserts

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agopython: sd_utils: pep8 fix spacing around
Rob van der Linde [Thu, 15 Feb 2024 19:01:46 +0000 (08:01 +1300)] 
python: sd_utils: pep8 fix spacing around

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: properly show command name in show help
Rob van der Linde [Wed, 14 Feb 2024 04:18:26 +0000 (17:18 +1300)] 
netcmd: properly show command name in show help

This comes up if a user ends up typing something wrong, and it incorrectly showed only part of the command under Usage:

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: add newline before epilog so there is a space between
Rob van der Linde [Wed, 14 Feb 2024 04:15:02 +0000 (17:15 +1300)] 
netcmd: add newline before epilog so there is a space between

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: model __json__ method should call as_dict instead
Rob van der Linde [Mon, 26 Feb 2024 00:45:54 +0000 (13:45 +1300)] 
netcmd: models: model __json__ method should call as_dict instead

The comment about RelatedField is not really relevant so removed that part, RelatedField isn't used at this point.

The idea with RelatedField is that it fetches the object (vs DnField which just returns a Dn).

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: setting kwarg to None should use field default
Rob van der Linde [Fri, 23 Feb 2024 06:06:38 +0000 (19:06 +1300)] 
netcmd: models: setting kwarg to None should use field default

This comes up when trying to create a GroupManagedServiceAccount and setting the value of managed_password_interval to None.

We still want it to pick up the field default of 30 in this case.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: Model.query adds optional polymorphic flag for returning specific...
Rob van der Linde [Tue, 20 Feb 2024 03:45:45 +0000 (16:45 +1300)] 
netcmd: models: Model.query adds optional polymorphic flag for returning specific class types

This defaults to False, query the User class returns only User instances.

    User.query(samdb)

When set to True, query the User class can return User, Computer, ManagedServiceAccount instances.

    User.query(samdb, polymorphic=True)

If polymorphic is False the same records are still returned but records will always be interpreted as the model that is being queried only, rather than a more specific model that matches that object class.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: ModelMeta needs to also set fields and meta if class is Model
Rob van der Linde [Wed, 21 Feb 2024 01:11:52 +0000 (14:11 +1300)] 
netcmd: models: ModelMeta needs to also set fields and meta if class is Model

This is needed for polymorphic query, if querying from the Base model, which was not previously a feature.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: move object_sid field from User to base Model
Rob van der Linde [Wed, 21 Feb 2024 01:10:11 +0000 (14:10 +1300)] 
netcmd: models: move object_sid field from User to base Model

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: bring Model class forward into module
Rob van der Linde [Wed, 21 Feb 2024 01:07:56 +0000 (14:07 +1300)] 
netcmd: models: bring Model class forward into module

This is important for polymorphic query support

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: ModelMeta no longer needs to inherit from ABCMeta
Rob van der Linde [Wed, 21 Feb 2024 03:04:41 +0000 (16:04 +1300)] 
netcmd: models: ModelMeta no longer needs to inherit from ABCMeta

There are no more abstract methods since the previous commit, so ABCMeta is no longer needed.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: Model.get_object_class returns top instead of None
Rob van der Linde [Wed, 21 Feb 2024 01:00:21 +0000 (14:00 +1300)] 
netcmd: models: Model.get_object_class returns top instead of None

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: Query.first and Query.last should use count from instance
Rob van der Linde [Tue, 20 Feb 2024 02:37:21 +0000 (15:37 +1300)] 
netcmd: models: Query.first and Query.last should use count from instance

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: set the default for managed password interval on the model
Rob van der Linde [Fri, 23 Feb 2024 05:43:38 +0000 (18:43 +1300)] 
netcmd: models: set the default for managed password interval on the model

This is to avoid having to provide a default in multiple places

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: move group msa membership default to constants
Rob van der Linde [Fri, 23 Feb 2024 05:02:56 +0000 (18:02 +1300)] 
netcmd: models: move group msa membership default to constants

This means the constant can be imported and used by the tests

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: shell: show Models subheading
Rob van der Linde [Tue, 20 Feb 2024 02:25:37 +0000 (15:25 +1300)] 
netcmd: shell: show Models subheading

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: make MODELS constant keyed by object class instead
Rob van der Linde [Tue, 20 Feb 2024 02:24:48 +0000 (15:24 +1300)] 
netcmd: models: make MODELS constant keyed by object class instead

This helps with polymorphic querying, mapping object class name to model class.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: move MODELS constant to constants.py to avoid import loop
Rob van der Linde [Tue, 20 Feb 2024 02:19:12 +0000 (15:19 +1300)] 
netcmd: models: move MODELS constant to constants.py to avoid import loop

query.py and models.py otherwise cause an import loop, query.py needs to import MODELS

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: update docstring of Computer.find method
Rob van der Linde [Thu, 22 Feb 2024 03:04:14 +0000 (16:04 +1300)] 
netcmd: models: update docstring of Computer.find method

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: gmsa move find method to Computer model
Rob van der Linde [Thu, 22 Feb 2024 03:03:38 +0000 (16:03 +1300)] 
netcmd: models: gmsa move find method to Computer model

The find method is the same as the find method from the User model, with the exception of adding "$".

This means it is actually logic that belongs in the parent class of GroupManagedServiceAccount, which is Computer.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: gmsa GroupManagedServiceAccount inherits from Computer
Rob van der Linde [Thu, 22 Feb 2024 02:49:33 +0000 (15:49 +1300)] 
netcmd: models: gmsa GroupManagedServiceAccount inherits from Computer

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: gmsa move GroupManagedServiceAccount model to gmsa.py
Rob van der Linde [Thu, 22 Feb 2024 02:47:30 +0000 (15:47 +1300)] 
netcmd: models: gmsa move GroupManagedServiceAccount model to gmsa.py

It needs to inherit from the Computer model, the Computer model also inherits from User.

First, moving it to its own file from user.py to gmsa.py

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: gmsa trustees update docstring and incorrect return type
Rob van der Linde [Thu, 22 Feb 2024 02:22:45 +0000 (15:22 +1300)] 
netcmd: models: gmsa trustees update docstring and incorrect return type

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: gmsa trustees property only looks at allowed aces
Rob van der Linde [Mon, 19 Feb 2024 03:09:38 +0000 (16:09 +1300)] 
netcmd: models: gmsa trustees property only looks at allowed aces

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: make GroupManagedServiceAccount.trustees a property
Rob van der Linde [Mon, 19 Feb 2024 02:23:47 +0000 (15:23 +1300)] 
netcmd: models: make GroupManagedServiceAccount.trustees a property

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: avoid fetching each user in trustees method
Rob van der Linde [Mon, 19 Feb 2024 01:49:43 +0000 (14:49 +1300)] 
netcmd: models: avoid fetching each user in trustees method

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: Remove unused groups_sddl method from User model
Rob van der Linde [Thu, 22 Feb 2024 05:12:04 +0000 (18:12 +1300)] 
netcmd: models: Remove unused groups_sddl method from User model

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agonetcmd: models: add default SDDL to group_msa_membership
Rob van der Linde [Mon, 19 Feb 2024 01:47:57 +0000 (14:47 +1300)] 
netcmd: models: add default SDDL to group_msa_membership

LA can be used for the administrator and Windows will expand that on save, making the group_sddl method redundant.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoWHATSNEW: Add information on LDB no longer available standalone
Andrew Bartlett [Sun, 18 Feb 2024 22:01:30 +0000 (11:01 +1300)] 
WHATSNEW: Add information on LDB no longer available standalone

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Mar  1 03:45:21 UTC 2024 on atb-devel-224

2 years agobuild: Allow --with-ldbmodulesdir to override location of LDB modules
Andrew Bartlett [Tue, 13 Feb 2024 22:54:54 +0000 (11:54 +1300)] 
build: Allow --with-ldbmodulesdir to override location of LDB modules

This will allow some packagers to set this to a directory that does
not mention Samba, or to put a version string in to avoid loading
old modules.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoldb: Unconditionally set LDB_PACKAGE_VERSION
Andrew Bartlett [Mon, 12 Feb 2024 02:00:30 +0000 (15:00 +1300)] 
ldb: Unconditionally set LDB_PACKAGE_VERSION

This is only parsed once now and there is no confusion with the main build, so we can set it without checking.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoldb: Remove "private_library" variable with just one user
Andrew Bartlett [Mon, 12 Feb 2024 02:26:14 +0000 (15:26 +1300)] 
ldb: Remove "private_library" variable with just one user

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoldb: Rename VERSION to LDB_VERSION to avoid confusion
Andrew Bartlett [Mon, 12 Feb 2024 01:06:12 +0000 (14:06 +1300)] 
ldb: Rename VERSION to LDB_VERSION to avoid confusion

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/ldb: Remove duplicate aspects of build system
Andrew Bartlett [Sun, 11 Feb 2024 22:16:28 +0000 (11:16 +1300)] 
lib/ldb: Remove duplicate aspects of build system

We no longer need aspects of our build that made sense for the standalone
operation of LDB now that ldb is only provided as part of Samba.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoldb: Remove remaining components of independent ldb build system
Andrew Bartlett [Mon, 12 Feb 2024 01:05:17 +0000 (14:05 +1300)] 
ldb: Remove remaining components of independent ldb build system

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/ldb: Remove references to conf.env.standalone_ldb
Andrew Bartlett [Sun, 11 Feb 2024 23:41:02 +0000 (12:41 +1300)] 
lib/ldb: Remove references to conf.env.standalone_ldb

This is not a simple replacement as we are merging the standalone build features with
the main Samba build features.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/ldb: bld.CONFIG_SET(USING_SYSTEM_LDB) is now never set
Andrew Bartlett [Mon, 12 Feb 2024 20:52:44 +0000 (09:52 +1300)] 
lib/ldb: bld.CONFIG_SET(USING_SYSTEM_LDB) is now never set

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/ldb: Adapt pkg-config files to being build from the main build.
Andrew Bartlett [Fri, 9 Feb 2024 09:32:16 +0000 (22:32 +1300)] 
lib/ldb: Adapt pkg-config files to being build from the main build.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/ldb: Always build standalone
Andrew Bartlett [Fri, 9 Feb 2024 09:33:22 +0000 (22:33 +1300)] 
lib/ldb: Always build standalone

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agobuild: Move --with-ldap/--without-ldap from source3 build to top level
Andrew Bartlett [Tue, 13 Feb 2024 00:52:41 +0000 (13:52 +1300)] 
build: Move --with-ldap/--without-ldap from source3 build to top level

This code impacts on LDB, which is now built from the main build
so we need to combined this with the check that was in lib/ldb
or else we get conflicts.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoldb: Remove the ability for Samba to compile against a system LDB
Andrew Bartlett [Fri, 9 Feb 2024 09:24:38 +0000 (22:24 +1300)] 
ldb: Remove the ability for Samba to compile against a system LDB

Samba will either provide the LDB to the system, or use a
private ldb, we will not use any other LDB from the system.

This is essentially equilvilant to the patch Debian has used
for Samba 4.17 and later, named "Force-LDB-as-standalone.patch"

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agobuild: Remove duplicated check for -Wl,-no-undefined on OpenBSD
Andrew Bartlett [Mon, 5 Feb 2024 08:21:45 +0000 (21:21 +1300)] 
build: Remove duplicated check for -Wl,-no-undefined on OpenBSD

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agobuild: Call conf.CHECK_XSLTPROC_MANPAGES() directly in wscript
Andrew Bartlett [Mon, 5 Feb 2024 07:25:59 +0000 (20:25 +1300)] 
build: Call conf.CHECK_XSLTPROC_MANPAGES() directly in wscript

This avoids relying on the indirect call via wscript in lib/{talloc,tdb,ldb}

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoautobuild: Move autobuild to expecting ldb to build as part of Samba
Andrew Bartlett [Wed, 14 Feb 2024 02:38:28 +0000 (15:38 +1300)] 
autobuild: Move autobuild to expecting ldb to build as part of Samba

We retain a test to confirm we can build ldb as a public lib in the samba-libs
target.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoldb: Honour --private-library=!ldb as meaning build as a public library
Andrew Bartlett [Fri, 9 Feb 2024 09:15:30 +0000 (22:15 +1300)] 
ldb: Honour --private-library=!ldb as meaning build as a public library

Likewise, let the SAMBA_LIBRARY code handle being a private library
rather than in the library declaration.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agobuild: Allow --private-libraries to include a default
Andrew Bartlett [Fri, 9 Feb 2024 06:47:11 +0000 (19:47 +1300)] 
build: Allow --private-libraries to include a default

This will in the future allow ldb to be declared public in the
build system, and so have all the attributes set for that, but
be actually built as a private Samba library by default.

No change in behavour currently.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agobuild: Ensure that a forced-private library has no public headers
Andrew Bartlett [Fri, 9 Feb 2024 09:10:10 +0000 (22:10 +1300)] 
build: Ensure that a forced-private library has no public headers

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoldb: Make pyldb-util always a private library
Andrew Bartlett [Mon, 12 Feb 2024 04:11:53 +0000 (17:11 +1300)] 
ldb: Make pyldb-util always a private library

Only Samba has ever used these utility functions, other applications can
still use our ldb python bindings, they just can not provide ldb
C bindings.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Bring ldb test defintions into one place in selftest/tests.py
Andrew Bartlett [Mon, 5 Feb 2024 04:18:10 +0000 (17:18 +1300)] 
selftest: Bring ldb test defintions into one place in selftest/tests.py

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Always and only run ldb test-tdb test in Samba selftest
Andrew Bartlett [Mon, 5 Feb 2024 04:01:54 +0000 (17:01 +1300)] 
selftest: Always and only run ldb test-tdb test in Samba selftest

This is the last test left in the independent ldb testsuite,
removing this from there allows the test target to be removed.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoselftest: Move LDB cmocka based unit tests to Samba testsuite
Andrew Bartlett [Mon, 5 Feb 2024 02:29:51 +0000 (15:29 +1300)] 
selftest: Move LDB cmocka based unit tests to Samba testsuite

This allows skip and knownfail entries to be honoured, as well
as enabling the removal of the standalone LDB build system.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoldb: Prepare ldb tests for subunit output
Andrew Bartlett [Mon, 5 Feb 2024 02:28:50 +0000 (15:28 +1300)] 
ldb: Prepare ldb tests for subunit output

These tests now print subunit rather than the default output
as this is what the Samba selftest system needs.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agosefltest: Remove duplicate run of ldb.python.crash and ldb.python.repack
Andrew Bartlett [Mon, 5 Feb 2024 00:08:02 +0000 (13:08 +1300)] 
sefltest: Remove duplicate run of ldb.python.crash and ldb.python.repack

These tests are not impacted by the dot-less i issue.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoldb: Move tests to selftest/tests.py and out of standlone build
Andrew Bartlett [Sun, 4 Feb 2024 23:34:42 +0000 (12:34 +1300)] 
ldb: Move tests to selftest/tests.py and out of standlone build

Tests that are declared in the tests.py files in the main Samba build
are able to use the common knownfail, flapping and skip systems.

This will also allow the independent ldb build to be removed without
loss of the tests.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agopytests: samba-tool domain kds root_key
Douglas Bagnall [Fri, 16 Feb 2024 03:36:06 +0000 (16:36 +1300)] 
pytests: samba-tool domain kds root_key

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Mar  1 01:27:30 UTC 2024 on atb-devel-224

2 years agosamba-tool: add `samba-tool domain kds root_key delete`
Douglas Bagnall [Wed, 28 Feb 2024 04:55:54 +0000 (17:55 +1300)] 
samba-tool: add `samba-tool domain kds root_key delete`

For deleting root keys.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool: add `samba-tool domain kds root_key create`
Douglas Bagnall [Wed, 28 Feb 2024 04:55:16 +0000 (17:55 +1300)] 
samba-tool: add `samba-tool domain kds root_key create`

For making new root keys.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool: add `samba-tool domain kds root_key view`
Douglas Bagnall [Wed, 28 Feb 2024 04:54:24 +0000 (17:54 +1300)] 
samba-tool: add `samba-tool domain kds root_key view`

This is for looking at one root key. There isn't much to know.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool: add `samba-tool domain kds root_key list`
Douglas Bagnall [Wed, 28 Feb 2024 04:34:25 +0000 (17:34 +1300)] 
samba-tool: add `samba-tool domain kds root_key list`

This lists root keys, in descending chronological order according to the
use_start_toime attribute. That's becuase you usually only care about
the newest one.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool: don't error if there are no sub-commands
Douglas Bagnall [Thu, 29 Feb 2024 03:29:30 +0000 (16:29 +1300)] 
samba-tool: don't error if there are no sub-commands

This is useful when you commit samba-tool tests before you commit the
samba-tool code, and you want the tests to fail rather than error.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoprovision: add a default root key
Douglas Bagnall [Wed, 28 Feb 2024 02:28:22 +0000 (15:28 +1300)] 
provision: add a default root key

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopytest:dsdb: check that there is a gkdi root key
Douglas Bagnall [Wed, 28 Feb 2024 02:32:41 +0000 (15:32 +1300)] 
pytest:dsdb: check that there is a gkdi root key

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopytest:gkdi: shift create_root_key into a function
Douglas Bagnall [Thu, 22 Feb 2024 03:17:37 +0000 (16:17 +1300)] 
pytest:gkdi: shift create_root_key into a function

This is so the samba-tool domain kds root_key tests can use it as a
function.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopytest:samba-tool: add a flag to print more in runcmd
Douglas Bagnall [Fri, 23 Feb 2024 03:24:11 +0000 (16:24 +1300)] 
pytest:samba-tool: add a flag to print more in runcmd

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool user delete: use account type constant
Douglas Bagnall [Fri, 16 Feb 2024 02:35:06 +0000 (15:35 +1300)] 
samba-tool user delete: use account type constant

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool domain: add LDB Result to json encoders
Douglas Bagnall [Thu, 22 Feb 2024 03:16:17 +0000 (16:16 +1300)] 
samba-tool domain: add LDB Result to json encoders

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoldb:pyldb exposes Result type
Douglas Bagnall [Thu, 15 Feb 2024 04:07:34 +0000 (04:07 +0000)] 
ldb:pyldb exposes Result type

You perhaps never want to manually create results (as in `x = Result()`)
-- except maybe in tests -- and that would be why we never added it in
the first place (or rather, we never noticed that it ws missing).

But we do want to sometimes go `isinstance(x, ldb.Result)`, and that
is how we noticed it was missing now.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:samdb: wrapper for _dsdb_create_gkdi_root_key()
Douglas Bagnall [Wed, 28 Feb 2024 04:15:44 +0000 (17:15 +1300)] 
python:samdb: wrapper for _dsdb_create_gkdi_root_key()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:pydsdb: python bindings for gkdi_new_root_key()
Douglas Bagnall [Wed, 28 Feb 2024 04:15:09 +0000 (17:15 +1300)] 
s4:pydsdb: python bindings for gkdi_new_root_key()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool domain kds root_key
Douglas Bagnall [Thu, 22 Feb 2024 03:51:42 +0000 (16:51 +1300)] 
samba-tool domain kds root_key

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool domain kds: add root key sub-command
Douglas Bagnall [Wed, 28 Feb 2024 04:29:40 +0000 (17:29 +1300)] 
samba-tool domain kds: add root key sub-command

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool domain: add kds sub-branch
Douglas Bagnall [Thu, 22 Feb 2024 03:51:56 +0000 (16:51 +1300)] 
samba-tool domain: add kds sub-branch

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:dsdb: Add functions for GKDI root key creation
Jo Sutton [Tue, 13 Feb 2024 03:09:57 +0000 (16:09 +1300)] 
s4:dsdb: Add functions for GKDI root key creation

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:crypto: Check for overflow in GKDI rollover interval calculation
Jo Sutton [Sun, 18 Feb 2024 21:34:02 +0000 (10:34 +1300)] 
lib:crypto: Check for overflow in GKDI rollover interval calculation

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:crypto: Correct GKDI interval start time calculation
Jo Sutton [Sun, 18 Feb 2024 21:33:41 +0000 (10:33 +1300)] 
lib:crypto: Correct GKDI interval start time calculation

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agolib:crypto: Add error checking to GKDI key start time calculation
Jo Sutton [Tue, 13 Feb 2024 00:04:48 +0000 (13:04 +1300)] 
lib:crypto: Add error checking to GKDI key start time calculation

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Ignore msKds-DomainID in ldapcmp_restoredc.sh and samba.tests.domain_backup...
Andrew Bartlett [Thu, 29 Feb 2024 23:14:58 +0000 (12:14 +1300)] 
selftest: Ignore msKds-DomainID in ldapcmp_restoredc.sh and samba.tests.domain_backup_offline

Like serverReferenceBL etc, this will point to a DC that created the object, and
as part of the backup and restore, this DC will be deleted.  It is just for
tracking the object creation, so this is fine.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agoctdb-tests: Limit red-black tree test to 5s of random inserts
Martin Schwenke [Thu, 29 Feb 2024 02:30:04 +0000 (13:30 +1100)] 
ctdb-tests: Limit red-black tree test to 5s of random inserts

rb_test_001.sh runs for 60s even though rb_tree.c is almost never
modified.  This generally extends test time by an unreasonable amount
of time.

Add an optional timeout (in seconds) argument to rb_test, defaulting
to 60, and pass 5 from rb_test_001.sh.  If anyone ever significantly
updates rb_tree.c then they can run rb_test directly with its default
60s timeout... or for as long as they like.

Reported-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Feb 29 13:20:40 UTC 2024 on atb-devel-224

2 years agosamba-tool user getpassword: Clarify success wording
Andrew Bartlett [Thu, 29 Feb 2024 01:57:40 +0000 (14:57 +1300)] 
samba-tool user getpassword: Clarify success wording

It may be the case that there was no password, or read access to the
password was not permitted.  The structure of the code and the pattern
in LDIF that missing information is simply returned as missing
attributes makes it hard to detect and communicate a clear
error here, particularly as an error may not be wanted if
(say) pwdLastSet is queried on a gMSA that we can not read.

So we just make the string to indicate, as I think it was meant,
that the tool ran to compleation.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Feb 29 05:07:45 UTC 2024 on atb-devel-224

2 years agopython/nt_time: have a go at using 1_000_000 number separators.
Douglas Bagnall [Fri, 23 Feb 2024 03:23:03 +0000 (16:23 +1300)] 
python/nt_time: have a go at using 1_000_000 number separators.

I noticed these are available in Python 3.6+, which is what we support,
and they're arguably nicer than using exponentiation.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:nt_time: add a nt_now() function
Douglas Bagnall [Wed, 28 Feb 2024 03:52:12 +0000 (16:52 +1300)] 
python:nt_time: add a nt_now() function

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopython:nt_time: add string_from_nt_time
Douglas Bagnall [Wed, 28 Feb 2024 03:51:41 +0000 (16:51 +1300)] 
python:nt_time: add string_from_nt_time

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopy:nt_time: add nt_time_from_string()
Douglas Bagnall [Wed, 14 Feb 2024 01:31:35 +0000 (14:31 +1300)] 
py:nt_time: add nt_time_from_string()

This is for samba-tool, which could do with a common understanding of
time strings across various sub-tools.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopyldb: try to turn ldb_string_to_time() errors into exceptions
Douglas Bagnall [Wed, 14 Feb 2024 01:22:53 +0000 (14:22 +1300)] 
pyldb: try to turn ldb_string_to_time() errors into exceptions

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoldb: ldb_string_to_time reports more errors
Douglas Bagnall [Wed, 14 Feb 2024 01:20:28 +0000 (14:20 +1300)] 
ldb: ldb_string_to_time reports more errors

The underlying function should return -1 and set errno when given invalid
strings, but we were not looking and have decided on 0 for error.

It would be a pain to change this function to return -1. Apart from the
API fuss, it is sometimes used unchecked to set an unsigned number and
an unchecked 0 is better than UINT*_MAX in those contexts.

It is probably not easy to get an -1 from a timegm() -- most
implementations will happily convert overflows for you, so e.g. the
15th month would be March of the next year. But EOVERFLOW is mentioned
in the manpages.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos4:pydsdb: add not-implemented raising functions to when appropriate
Douglas Bagnall [Wed, 21 Feb 2024 10:13:51 +0000 (23:13 +1300)] 
s4:pydsdb: add not-implemented raising functions to when appropriate

It will be less confusing, I hope.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopyldb: catch some talloc failures
Douglas Bagnall [Wed, 28 Feb 2024 03:30:29 +0000 (16:30 +1300)] 
pyldb: catch some talloc failures

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopyldb: free some finished requests
Douglas Bagnall [Wed, 28 Feb 2024 03:27:59 +0000 (16:27 +1300)] 
pyldb: free some finished requests

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopyldb: free things more often on error
Douglas Bagnall [Wed, 21 Feb 2024 23:57:19 +0000 (12:57 +1300)] 
pyldb: free things more often on error

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopyldb: add a macro to free when raising exceptions
Douglas Bagnall [Wed, 21 Feb 2024 22:19:30 +0000 (11:19 +1300)] 
pyldb: add a macro to free when raising exceptions

We often forget.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopytest:audit_log_base: use string_is_guid()
Douglas Bagnall [Wed, 28 Feb 2024 03:19:59 +0000 (16:19 +1300)] 
pytest:audit_log_base: use string_is_guid()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>