1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
Commit Graph

129310 Commits

Author SHA1 Message Date
Volker Lendecke
fb36f23a20 lib: Remove an unneeded includes.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
5f2ef356b2 lib: Remove an unneeded includes.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
8a3e3a0d60 lib: Remove an unneeded includes.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
aa27b6626d lib: Remove an unneeded includes.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
d2f3ac2fb7 lib: Remove an unused includes.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
ce0f483a29 passdb: Introduce helper variables in make_pdb_method_name()
Easier debugging

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
9ab0f91b34 passdb: Split lines in make_pdb_method_name()
Looks nicer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
894a1c1936 ldb: Introduce "colon" variable in ldb_module_connect_backend()
Easier debugging, avoid a second call to strchr()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
41a9d958a6 ldb: Save a few lines with TALLOC_FREE()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
ef846e660a ldb: Avoid "==true/false" in a boolean expression
That's what we have boolean variables and expressions for

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
4ef1b0963c ldap_server: Fix typos
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
22032eefdb passdb: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
cdef977031 dsdb: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Volker Lendecke
830b561cc9 vfs: Remove unused last_lock_failure from files_struct
Save 72 bytes per open file handle

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 21:41:29 +00:00
Andreas Schneider
28fc44f285 s3:passdb: Also allow to handle UPNs in lookup_name_smbconf()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15054

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 26 20:16:33 UTC 2022 on sn-devel-184
2022-04-26 20:16:33 +00:00
Andreas Schneider
2690310743 s3:passdb: Refactor lookup_name_smbconf()
This will be changed to support UPNs too in the next patch.

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

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 19:22:30 +00:00
Andreas Schneider
ed8e466854 s3:passdb: Use already defined pointer in lookup_name_smbconf()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 19:22:29 +00:00
Andreas Schneider
2a03fb91c1 s3:passdb: Add support to handle UPNs in lookup_name()
This address an issue if sssd is running and handling nsswitch. If we look up
a user with getpwnam("DOMAIN\user") it will return user@REALM in the passwd
structure. We need to be able to deal with that.

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

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 19:22:29 +00:00
Andreas Schneider
756cd0eed3 s3:passdb: Remove trailing spaces in lookup_sid.c
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15054

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-04-26 19:22:29 +00:00
Anoop C S
e2392729f3 libsmbconf: Avoid initial declaration inside 'for' loop
Building Samba on CentOS 7 with GCC version 4.8.5 results in the
following error:

[2725/3398] Compiling libcli/echo/tests/echo.c
../../lib/smbconf/pysmbconf.c: In function 'py_from_smbconf_service':
../../lib/smbconf/pysmbconf.c:72:2: error: 'for' loop initial
                               declarations are only allowed in C99 mode
  for (uint32_t i = 0; i < svc->num_params; i++) {
  ^
../../lib/smbconf/pysmbconf.c:72:2: note: use option -std=c99 or
                                         -std=gnu99 to compile your code
../../lib/smbconf/pysmbconf.c: In function 'obj_share_names':
../../lib/smbconf/pysmbconf.c:181:2: error: 'for' loop initial
                               declarations are only allowed in C99 mode
  for (uint32_t i = 0; i < num_shares; i++) {
  ^
../../lib/smbconf/pysmbconf.c: In function 'obj_get_config':
../../lib/smbconf/pysmbconf.c:267:2: error: 'for' loop initial
                               declarations are only allowed in C99 mode
  for (uint32_t i = 0; i < num_shares; i++) {
  ^

Therefore declare variables right at the start aligning to default C90
standard available with GCC version on CentOS 7.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Apr 25 13:23:18 UTC 2022 on sn-devel-184
2022-04-25 13:23:18 +00:00
John Mulligan
84480a1e21 python/samba/tests: add SMBConfTests suite
Add an initial suite of tests for the smbconf python bindings.
Currently only simple read-only methods are available.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Apr 21 15:33:38 UTC 2022 on sn-devel-184
2022-04-21 15:33:38 +00:00
John Mulligan
d948cb1c6d lib/smbconf: add an initial set of python bindings
The smbconf library provides a generic interface for Samba configuration
backends. In order to access these backends, including the read-write
registry backend, we add a new python binding for smbconf - the general
interface library.

This initial set of bindings covers some basic read-only calls.  This
includes function calls for listing shares (config sections) and getting
the parameters of the shares. The `init_txt` construction function must
be used to get a new SMBConf object.  This is done so that other
backends, specifically the registry backend from source3 can be used in
the future. Those will provide their own construction funcs.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
2022-04-21 14:41:32 +00:00
Christian Ambach
c285bcfbda lib/cmdline: fix a typo
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Apr 21 06:59:12 UTC 2022 on sn-devel-184
2022-04-21 06:59:12 +00:00
Christian Ambach
9332606a17 s3:utils:smbcacls fix a typo
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2022-04-21 06:03:38 +00:00
Andreas Schneider
9ad03f51a3 s4:kdc: Add asserted identity SID to identify whether S4U2Self has occurred
Because the KDC does not limit protocol transition (S4U2Self), two new
well-known SIDs are available to give this control to the resource
administrator. These SIDs identify whether protocol transition (S4U2Self) has
occurred, and can be used with standard access control lists to grant or limit
access as needed.

See
https://docs.microsoft.com/en-us/windows-server/security/kerberos/kerberos-constrained-delegation-overview

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

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

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Apr 13 13:54:27 UTC 2022 on sn-devel-184
2022-04-13 13:54:27 +00:00
Andreas Schneider
9b03e31fba s4:dsdb:tests: Also pass tests if asserted identity is present
We should make sure that we use NTLMSSP or Kerberos consistently
for the tests and don't mix them.

We're also much stricter and symmetric_difference() to
check if the sets are actually the same.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
a14acd0c07 s4:selftest: Do not print the env twice
This makes it easier to write knownfail rules

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
e6a2c3c38f s4:torture: let remote_pac test for asserted identity sids
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
5902e87ed3 python:tests: Add krb5 tests for asserted identity
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Stefan Metzmacher
d6b6702e84 python:tests: Reorder variables
Those will be needed earlier in the next commit.

Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
e03665fb8c python:tests: Add support for unexpected groups in krb5 tests
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
61b2231915 python:tests: Add support for expected groups in krb5 tests
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Stefan Metzmacher
fc8a29435e python:tests: Allow to print krb5 encryption keys as string
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Stefan Metzmacher
4b684c325b python:tests: Add support to print krb5 keys as string
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
887f0cf243 s4:kdc: Fix S4U2Proxy in RODC case to return an error
Tested also against Windows Server 2022.

Details:
https://lists.samba.org/archive/cifs-protocol/2022-April/003673.html

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
461dc44e74 s4:kdc: pass down SAMBA_KDC_FLAG_PROTOCOL_TRANSITION to samba_kdc_update_pac()
This gives samba_kdc_update_pac() a chance to detect S4U2Self.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
2a79a5eef8 s4:mit-samba: Pass flags to mit_samba_get_pac()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
c29d5fcbea s4:mit-samba: Pass flags to ks_get_pac()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
a5c8077a85 python:tests: Check code error code in test_s4u2self_rodc_revealed
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Stefan Metzmacher
f8c3b68fe5 python:tests: Fix standalone run of kdc_tgs_tests
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Andreas Schneider
dbbb5ca169 s4:kdc: Set debug class for pac-glue
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-04-13 12:59:30 +00:00
Stefan Metzmacher
21d1a9509a librpc:idl: Add comments to assert identity string in security.idl
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Samuel Cabrero
685006c830 selftest: Use selftest's TMPDIR to store the krb5 ccache in pam_winbind_setcred test
Using /tmp directly can lead to errors if multiple autobuilds are
running at the same time. Using tempfile.gettempdir() will look for
$TMPDIR environment variable.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Samuel Cabrero
db7e296f9c selftest: Use selftest's TMPDIR to store the krb5 ccache in pam_winbind tests
Using /tmp directly can lead to errors if multiple autobuilds are
running at the same time. Using tempfile.gettempdir() will look for
$TMPDIR environment variable.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Samuel Cabrero
a6d6ae3cfc s3:winbind: Remove no longer used domain's private_data pointer
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15046

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Samuel Cabrero
3cb256439e s3:winbind: Do not use domain's private data to store the ADS_STRUCT
The ADS_STRUCT is not allocated using talloc and there are many places
casting this pointer directly so use a typed pointer.

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

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Samuel Cabrero
91395e660a s3:winbind: Simplify open_cached_internal_pipe_conn()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15046

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Samuel Cabrero
e1f29b0970 s3:winbind: Do not use domain's private data to store the SAMR pipes
The domain's private_data pointer is also used to store a ADS_STRUCT,
which is not allocated using talloc and there are many places casting
this pointer directly.

The recently added samba.tests.pam_winbind_setcred was randomly failing
and after debugging it the problem was that kerberos authentication was
failing because the time_offset passed to kerberos_return_pac() was
wrong. This time_offset was retrieved from ads->auth.time_offset, where
the ads pointer was directly casted from domain->private_data but
private_data was pointing to a winbind_internal_pipes struct.

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

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2022-04-13 12:59:30 +00:00
Samuel Cabrero
7880537674 s3:winbind: Fix uninitialized validation_level variable
Found by oss-fuzz:

../../source3/winbindd/winbindd_pam.c:2879:7: error: variable 'validation_level' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                 if (!(state->request->flags & WBFLAG_BIG_NTLMV2_BLOB) ||
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ../../source3/winbindd/winbindd_pam.c:3003:6: note: uninitialized use occurs here
             validation_level,
             ^~~~~~~~~~~~~~~~
 ../../source3/winbindd/winbindd_pam.c:2879:3: note: remove the 'if' if its condition is always false
                 if (!(state->request->flags & WBFLAG_BIG_NTLMV2_BLOB) ||
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ../../source3/winbindd/winbindd_pam.c:2879:7: error: variable 'validation_level' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
                 if (!(state->request->flags & WBFLAG_BIG_NTLMV2_BLOB) ||
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ../../source3/winbindd/winbindd_pam.c:3003:6: note: uninitialized use occurs here
             validation_level,
             ^~~~~~~~~~~~~~~~
 ../../source3/winbindd/winbindd_pam.c:2879:7: note: remove the '||' if its condition is always false
                 if (!(state->request->flags & WBFLAG_BIG_NTLMV2_BLOB) ||
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ../../source3/winbindd/winbindd_pam.c:2853:27: note: initialize the variable 'validation_level' to silence this warning
         uint16_t validation_level;
                                  ^
                                   = 0
 1 warning and 2 errors generated.

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

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

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 12 18:54:50 UTC 2022 on sn-devel-184
2022-04-12 18:54:50 +00:00
Pavel Filipenský
a20d41accd tevent:tests: Test queue entry tags
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Apr 11 17:51:08 UTC 2022 on sn-devel-184
2022-04-11 17:51:08 +00:00