1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-23 00:23:53 +03:00
Commit Graph

5153 Commits

Author SHA1 Message Date
Douglas Bagnall
0ab86dd7ca python:getopt: hack to generate docbook stubs from --help
We have many many samba-tool subcommands that are not documented in
the manpage. Often the --help text is a good place to start, but doing
it entirely manually is VERY tedious.

This automates some of the process.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Rowland Penny <rpenny@samba.org>
2025-03-12 19:57:34 +00:00
Andrea Venturoli
7e083a6b3a python:tdb_util: "samba-tool domain backup offline" hangs
GNU getopt(3) is by default non-POSIX compliant and accepts options after
positional arguments (unless forced with POSIXLY_CORRECT). This is not portable,
e..g., on FreeBSD. Put options first and then positional arguments.

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

Signed-off-by: Andrea Venturoli <ml@netfence.it>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-27 00:02:38 +00:00
Stefan Metzmacher
2dba2a31c2 python:tests/krb5: let create_trust() take {ingress,egress}_claims_tf_rules
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Feb 24 10:28:02 UTC 2025 on atb-devel-224
2025-02-24 10:28:02 +00:00
Stefan Metzmacher
b1348ad288 python:tests/krb5: let create_trust() take forest_info
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-24 09:27:38 +00:00
Stefan Metzmacher
322827f792 python:tests/krb5: let modified_ticket() to take modify_{tkt,enc}_fn
This makes it possible modify the public ticket part well as the enc part.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-24 09:27:38 +00:00
Stefan Metzmacher
fabf0d1565 python:tests/krb5: add remove_pac_buffers()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-24 09:27:38 +00:00
Stefan Metzmacher
bcd1157983 python:tests/krb5: set_pac_claims with claims=[] should be an empty blob
Review with: git show -w

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-24 09:27:38 +00:00
Stefan Metzmacher
b78af64446 python:tests/krb5: let set_pac_sids() replace the requester_sid
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-24 09:27:38 +00:00
Stefan Metzmacher
a7349dd363 python:tests/krb5: add set_pac_names() to modify the names in a pac
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-24 09:27:38 +00:00
Stefan Metzmacher
5ab87a840f python:tests/krb5: give KerberosTicketCreds a basic __str__() function
This makes debugging easier...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-24 09:27:37 +00:00
Stefan Metzmacher
559bcd0c33 python:tests/krb5: let create_ccache[_with_ticket] use the correct crealm
It can be different from the servers realm.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-24 09:27:37 +00:00
Stefan Metzmacher
ab8473dd41 python:tests/krb5: allow get_service_ticket() to fail with expected_status
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-24 09:27:37 +00:00
Stefan Metzmacher
188da46637 python:tests/krb5: add KerberosTicketCreds.set_srealm()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-24 09:27:37 +00:00
Stefan Metzmacher
5fc5f90dee samba-tool/testparm: make it clear that 'client use krb5 netlogon' is experimental
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15815

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-02-24 07:39:38 +00:00
Samuel Cabrero
f79bdd17d6 winbind:varlink: Set the disposition field in user records
Set the disposition field in the user record, otherwise systemd could derive it
from the uid based on its configured ranges.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2025-02-20 08:07:32 +00:00
Samuel Cabrero
0653b4b1c9 pytests/varlink: Add varlink tests
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2025-02-20 08:07:32 +00:00
Stefan Metzmacher
a814f5d90a python:lsa_utils: Fix fallback to OpenPolicy2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15680

Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Feb 17 18:33:15 UTC 2025 on atb-devel-224
2025-02-17 18:33:15 +00:00
Andreas Schneider
f9a3fc19f1 python:lsa_utils: Don't use optional arguments for OpenPolicyFallback()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15680

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-02-17 17:29:37 +00:00
Björn Baumbach
3e1c19c2c3 pytests: test pysmbd with relative path names via samba-tool ntacl
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15806

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Fri Feb 14 16:18:19 UTC 2025 on atb-devel-224
2025-02-14 16:18:19 +00:00
Björn Baumbach
334f621e4b pytests: test pysmbd with non-existent file
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15807

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-02-14 15:20:36 +00:00
Stefan Metzmacher
84b7de6deb python:tests/krb5: only expect compressed claims if the compression reduces the size
I have captures showing that claims compression depends on the payload
itself and how well it compresses, instead of the pure length of the
payload.

E.g. a single string claim with a value of 68 'a'
characters has an unpressed size of 336
and compressed size is 335.
While a single string with random string s1
has an unpressed size of 504 and it's still
uncompressed on the wire.
A different random string s2 also has an unpressed
size of 504, but it is compressed into a size of 502.

So it really depends if the compression makes it actually
smaller than the uncompressed version.

This makes the tests more reliable against Windows DCs
with existing claims defined.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-14 10:58:40 +00:00
Stefan Metzmacher
23aa5e897c python:tests: add ClaimsTransformationTests to security.py
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-14 10:58:40 +00:00
Douglas Bagnall
455a0558c8 pytest: add ndr packing tests for security descriptors
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-02-13 14:13:37 +00:00
Stefan Metzmacher
dba0cdad5b security.idl: change ORGANISATION into ORGANIZATION
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 18:48:35 +00:00
Stefan Metzmacher
04208c04ff python:tests: let lsa_utils.py use valid netbios names
createtrustrelax has 16 characters, but only 15 are allowed
and they are typically uppercase.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-08 15:26:38 +00:00
Douglas Bagnall
2f93c9322b samba-tool contact: remove useless versionopts references
These are now redundant as all samba-tool sub-commands handle
-V/--version automatically.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
6f7bc5cb12 py:get_opts:VersionOptions prints version in --help
Because it might as well. Like this:

  Version Options:
    -V, --version       Display version number (4.22.2)

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
a61e192f25 samba-tool: --version shortcircuits option evaluation
This means in

   bin/samba-tool spn -h -V

the -V takes precedence over the -h, as with the 'net' tool.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
8aec198306 samba-tool: all subcommands know --version
Before `samba-tool -V` would give you the version,
but `samba-tool spn -V` would complain.

An ad-hoc selection of sub-commands already supported --version,
depending on whether VersionOptions was manually added to the
takes_options dict. The .run() methods of these subcommands all take a
'versionopts' keyword argument, but never use it. If it was set (i.e.,
argv contained "--version"), the process never gets to .run(), so the
value of versionopts.version is always None in run(). After this
commit we can remove VersionOptions/versionopts from sub-commands.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
3a408f06ae samba-tool: do not complain of no sub-command with '-V'
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15770

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
fd59b316b8 pytest: samba-tool --version tests
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15770

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
e705dbbc67 provision: always use a large transaction index cache
A larger cache costs more per transaction, but makes a large number
of operations within a transaction faster. We expect to be dealing
with the latter case here, regardless of the batch_mode parameter
and the database size. 200000 is chosen because it is also used in
join and schemaupgrade, and should be sufficient in most cases.

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

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

Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Tue Feb  4 22:47:35 UTC 2025 on atb-devel-224
2025-02-04 22:47:35 +00:00
Andréas Leroux
5092d7f46b netcmd: Increase the transaction_index_cache_size to 200k for schemaupgrade
Increasing this value greatly improve the performances of schema
upgrade for large domains (>200k entries).

The value 200000 is chosen because it is already used in join.py, and
should be sufficient for known domains.

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

Signed-off-by: Andréas Leroux <aleroux@tranquil.it>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2025-02-04 21:48:40 +00:00
Stefan Metzmacher
abba3495d2 python:tests/dcerpc/lsa: add tests for invalid LookupSids2 combinations
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-29 01:14:40 +00:00
Ralph Boehme
b53ac980e1 s3/mdssvc: add option "elasticsearch:force_substring_search = yes | no" (default: no)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jan 24 10:52:33 UTC 2025 on atb-devel-224
2025-01-24 10:52:33 +00:00
Björn Baumbach
21a88df032 samba-tool user disable: add new --remove-supplemental-groups option
Removes all supplemental groups from a user, what is commonly
wanted when a user is disabled.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jule Anger <janger@samba.org>

Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Thu Jan 23 19:51:05 UTC 2025 on atb-devel-224
2025-01-23 19:51:05 +00:00
Björn Baumbach
f924724e46 samba-tool user disable: make sure that filter matches only one user
toggle_userAccountFlags() can only handle one user.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
b19445a8f0 samba-tool user disable: rename filter variable to search_filter
filter() is a Python built-in function to filter iterables.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
462d0d667c samba-tool user disable: set proper --filter option description
Seems to be copied from samba-tool user setpassword command.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
dd0892a1be samba-tool group removemembers: avoid python backtrace on error
Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
300e14674c python/samdb: no need to set member_base_dn multiple times
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
c9d8e96d2b python/samdb: fix group member removal by SID
Otherwise the removal of groupmembers by SID fails silently, because the
DN does not match the the DN in group member list.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
a74bc62779 python/samdb: fix check which checks if user is already member of group
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
190a635b38 python/samdb: rename filter variable to search_filter
filter() is a Python built-in function to filter iterables.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
a4f84ba897 python/samdb: add missing function parameter description
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
bba6bb164e python/samdb: fix attribute name in parameter description
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Stefan Metzmacher
9bab6426b9 python:tests/krb5: let netlogon.py check for NETLOGON_NTLMV2_ENABLED
It's there for network_samlogon and interactive_samlogon,
but not in ticket_samlogon.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2025-01-15 13:03:34 +00:00
Stefan Metzmacher
9a4c2280e9 python:tests: let s3_net_join.py avoid kerberos_state=DONT_USE_KERBEROS
We may use ServerAuthenticateKerberos in future and that needed to
use kerberos.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-13 23:40:30 +00:00
Stefan Metzmacher
0ca38918f6 python:tests: let auth_log.py also test --option=clientusekrb5netlogon=yes
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-13 23:40:30 +00:00
Stefan Metzmacher
b84aa14c99 python:tests: let auth_log.py explicitly use --option=clientusekrb5netlogon=no
It also add some additional checks to make sure netlogon with AES was
used.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-13 23:40:30 +00:00