]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
6 months agosmbd: Prepare to return the reparse tag from fsctl_get_reparse_point
Volker Lendecke [Sat, 4 May 2024 09:19:14 +0000 (11:19 +0200)] 
smbd: Prepare to return the reparse tag from fsctl_get_reparse_point

We'll need this in many places, for example when listing directories

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Change the output of fsctl_get_reparse_point to uint8
Volker Lendecke [Sat, 4 May 2024 17:32:03 +0000 (19:32 +0200)] 
smbd: Change the output of fsctl_get_reparse_point to uint8

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agoreparse: Tighten reparse point length check
Volker Lendecke [Sat, 4 May 2024 08:54:27 +0000 (10:54 +0200)] 
reparse: Tighten reparse point length check

test_create_reparse shows that the length checks need to be precise,
not just checking for overflow.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Return FILE_ATTRIBUTE_REPARSE_POINT from "user.DOSATTRIB"
Volker Lendecke [Fri, 2 Dec 2022 14:02:18 +0000 (15:02 +0100)] 
smbd: Return FILE_ATTRIBUTE_REPARSE_POINT from "user.DOSATTRIB"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agos4:dsdb: Fix stack use after scope in gkdi_create_root_key()
Andreas Schneider [Tue, 30 Apr 2024 07:16:40 +0000 (09:16 +0200)] 
s4:dsdb: Fix stack use after scope in gkdi_create_root_key()

==20978==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7f4f91ff51a0 at pc 0x7f4f94cf93d6 bp 0x7ffdb90fc510 sp 0x7ffdb90fbcd0
READ of size 64 at 0x7f4f91ff51a0 thread T0
    #0 0x7f4f94cf93d5 in memcpy ../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115
    #1 0x7f4f933bdb67 in ldb_val_dup ../../lib/ldb/common/ldb_msg.c:325
    #2 0x7f4f933c11d1 in ldb_msg_copy ../../lib/ldb/common/ldb_msg.c:1182
    #3 0x7f4f933c13d2 in ldb_msg_normalize ../../lib/ldb/common/ldb_msg.c:1235
    #4 0x7f4f933ab556 in ldb_request ../../lib/ldb/common/ldb.c:1196
    #5 0x7f4f8e82b1d4 in dsdb_autotransaction_request ../../source4/dsdb/common/util.c:1220
    #6 0x7f4f8e831c8a in dsdb_add ../../source4/dsdb/common/util.c:5354
    #7 0x7f4f8e853a01 in gkdi_create_root_key ../../source4/dsdb/gmsa/gkdi.c:493
    #8 0x7f4f8e853a01 in gkdi_new_root_key ../../source4/dsdb/gmsa/gkdi.c:551
    #9 0x7f4f8cd4ca52 in py_dsdb_create_gkdi_root_key ../../source4/dsdb/pydsdb.c:1388
    #10 0x7f4f947ce01c  (/lib64/libpython3.11.so.1.0+0x1ce01c) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #11 0x7f4f947de4c0 in _PyObject_Call (/lib64/libpython3.11.so.1.0+0x1de4c0) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #12 0x7f4f947be6ca in _PyEval_EvalFrameDefault (/lib64/libpython3.11.so.1.0+0x1be6ca) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #13 0x7f4f947b6e79  (/lib64/libpython3.11.so.1.0+0x1b6e79) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #14 0x7f4f947de5d8  (/lib64/libpython3.11.so.1.0+0x1de5d8) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #15 0x7f4f947be6ca in _PyEval_EvalFrameDefault (/lib64/libpython3.11.so.1.0+0x1be6ca) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #16 0x7f4f947b6e79  (/lib64/libpython3.11.so.1.0+0x1b6e79) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #17 0x7f4f947edabb  (/lib64/libpython3.11.so.1.0+0x1edabb) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #18 0x7f4f947de5d8  (/lib64/libpython3.11.so.1.0+0x1de5d8) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #19 0x7f4f947be6ca in _PyEval_EvalFrameDefault (/lib64/libpython3.11.so.1.0+0x1be6ca) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #20 0x7f4f947b6e79  (/lib64/libpython3.11.so.1.0+0x1b6e79) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #21 0x7f4f947ed9fb  (/lib64/libpython3.11.so.1.0+0x1ed9fb) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #22 0x7f4f947be6ca in _PyEval_EvalFrameDefault (/lib64/libpython3.11.so.1.0+0x1be6ca) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #23 0x7f4f947b6e79  (/lib64/libpython3.11.so.1.0+0x1b6e79) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #24 0x7f4f947be6ca in _PyEval_EvalFrameDefault (/lib64/libpython3.11.so.1.0+0x1be6ca) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #25 0x7f4f947b6e79  (/lib64/libpython3.11.so.1.0+0x1b6e79) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #26 0x7f4f94839997 in PyEval_EvalCode (/lib64/libpython3.11.so.1.0+0x239997) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #27 0x7f4f94856862  (/lib64/libpython3.11.so.1.0+0x256862) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #28 0x7f4f94852e59  (/lib64/libpython3.11.so.1.0+0x252e59) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #29 0x7f4f94868fb1  (/lib64/libpython3.11.so.1.0+0x268fb1) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #30 0x7f4f948687a3 in _PyRun_SimpleFileObject (/lib64/libpython3.11.so.1.0+0x2687a3) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #31 0x7f4f94868453 in _PyRun_AnyFileObject (/lib64/libpython3.11.so.1.0+0x268453) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #32 0x7f4f94861c53 in Py_RunMain (/lib64/libpython3.11.so.1.0+0x261c53) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #33 0x7f4f94829996 in Py_BytesMain (/lib64/libpython3.11.so.1.0+0x229996) (BuildId: 170cbf941d17f6c2ac4f784129b31ebaa10c44a7)
    #34 0x7f4f9422a1ef in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #35 0x7f4f9422a2b8 in __libc_start_main_impl ../csu/libc-start.c:360
    #36 0x5604497e3084 in _start (/usr/bin/python3.11+0x1084) (BuildId: f5d6e3bdbf9098a6ddde0b7f2e07ffc9ad1b1dc3)

Address 0x7f4f91ff51a0 is located in stack of thread T0 at offset 416 in frame
    #0 0x7f4f8e852b37 in gkdi_new_root_key ../../source4/dsdb/gmsa/gkdi.c:537

  This frame has 12 object(s):
    [32, 40) 'root_key_dn' (line 539)
    [64, 72) 'res' (line 540)
    [96, 104) 'server_config_res' (line 118)
    [128, 136) 'kdf_algorithm' (line 128)
    [160, 168) 'domain_dn' (line 388)
    [192, 208) 'kdf_parameters_blob' (line 129)
    [224, 240) 'root_key_data_blob' (line 353)
    [256, 272) 'guid_blob' (line 467)
    [288, 312) 'kdf_parameters' (line 226)
    [352, 368) 'root_key_id' (line 116)
    [384, 400) 'guid_buf' (line 466)
    [416, 480) 'root_key_data' (line 352) <== Memory access at offset 416 is inside this variable

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <jsutton@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri May  3 12:20:55 UTC 2024 on atb-devel-224

6 months agosmbd: Remove unused [push_pull]_file_id_24
Volker Lendecke [Tue, 30 Apr 2024 09:43:58 +0000 (11:43 +0200)] 
smbd: Remove unused [push_pull]_file_id_24

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 30 23:48:21 UTC 2024 on atb-devel-224

6 months agosmbd: Use struct oplock_break_message for MSG_SMB_KERNEL_BREAK
Volker Lendecke [Tue, 30 Apr 2024 09:41:50 +0000 (11:41 +0200)] 
smbd: Use struct oplock_break_message for MSG_SMB_KERNEL_BREAK

Signed-off-by: Volker Lendecke <vl@samba.org>
6 months agosmbd: Remove message_to_share_mode_entry and vice versa
Volker Lendecke [Tue, 30 Apr 2024 08:37:06 +0000 (10:37 +0200)] 
smbd: Remove message_to_share_mode_entry and vice versa

Used only for closing files from rpc srvsvc these days

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Use struct oplock_break_message for MSG_CLOSE_FILE
Volker Lendecke [Tue, 30 Apr 2024 08:35:06 +0000 (10:35 +0200)] 
smbd: Use struct oplock_break_message for MSG_CLOSE_FILE

We only need to transmit the file_id and share_file_id. Next patch
will show why :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Fix a typo
Volker Lendecke [Tue, 30 Apr 2024 08:31:37 +0000 (10:31 +0200)] 
smbd: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Simplify sending oplock_break_message
Volker Lendecke [Mon, 29 Apr 2024 09:38:18 +0000 (11:38 +0200)] 
smbd: Simplify sending oplock_break_message

This is fixed length of 33 bytes, no need to talloc

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agolib: Convert push_file_id_16 to take uint8_t instead of char
Volker Lendecke [Sun, 28 Apr 2024 17:51:25 +0000 (19:51 +0200)] 
lib: Convert push_file_id_16 to take uint8_t instead of char

All callers had a cast from uint8_t to char, avoid those.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agovfs: Convert return_data from char * to uint8_t
Volker Lendecke [Sun, 28 Apr 2024 17:43:36 +0000 (19:43 +0200)] 
vfs: Convert return_data from char * to uint8_t

Prepares for a small simplification in the next patch

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agopassdb: Use getline(3) to read our old machine sid
Volker Lendecke [Wed, 10 Apr 2024 12:45:56 +0000 (14:45 +0200)] 
passdb: Use getline(3) to read our old machine sid

Don't read the whole file.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agopylibsmb: Avoid talloc()
Volker Lendecke [Sun, 28 Apr 2024 14:29:23 +0000 (16:29 +0200)] 
pylibsmb: Avoid talloc()

dom_sid_string() does an implicit talloc_strdup() which is not
necessary here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agopylibsmb: clang-format for the calls to Py_BuildValue()
Volker Lendecke [Sun, 28 Apr 2024 14:24:31 +0000 (16:24 +0200)] 
pylibsmb: clang-format for the calls to Py_BuildValue()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agopylibsmb: Return reparse_tag from directory listing
Volker Lendecke [Sun, 28 Apr 2024 14:21:44 +0000 (16:21 +0200)] 
pylibsmb: Return reparse_tag from directory listing

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agolibsmb: Slightly simplify py_cli_list()
Volker Lendecke [Sun, 28 Apr 2024 14:07:44 +0000 (16:07 +0200)] 
libsmb: Slightly simplify py_cli_list()

We don't need an & to take a function pointer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Fix a copy&paste error in smbXsrv_client_remove()
Volker Lendecke [Fri, 9 Feb 2024 17:23:35 +0000 (18:23 +0100)] 
smbd: Fix a copy&paste error in smbXsrv_client_remove()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Use direct struct initialization in smbXsrv_client
Volker Lendecke [Fri, 9 Feb 2024 17:21:14 +0000 (18:21 +0100)] 
smbd: Use direct struct initialization in smbXsrv_client

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Save a few lines in smbXsrv_client_global_init()
Volker Lendecke [Fri, 9 Feb 2024 17:16:26 +0000 (18:16 +0100)] 
smbd: Save a few lines in smbXsrv_client_global_init()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Do an early TALLOC_FREE in smbXsrv_client_global_init()
Volker Lendecke [Fri, 9 Feb 2024 17:16:09 +0000 (18:16 +0100)] 
smbd: Do an early TALLOC_FREE in smbXsrv_client_global_init()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Simplify smbXsrv_open_clear_replay_cache()
Volker Lendecke [Fri, 9 Feb 2024 12:05:28 +0000 (13:05 +0100)] 
smbd: Simplify smbXsrv_open_clear_replay_cache()

GUID_buf_string() is designed to never fail

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Simplify smbXsrv_open_purge_replay_cache()
Volker Lendecke [Fri, 9 Feb 2024 12:02:25 +0000 (13:02 +0100)] 
smbd: Simplify smbXsrv_open_purge_replay_cache()

GUID_buf_string is supposed to never fail except if the guid passed in
is NULL. Our only current caller already checks
that. dbwrap_purge_bystring() could actually fail, so put the result
into a variable for the debugger.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Simplify an if-condition
Volker Lendecke [Fri, 9 Feb 2024 11:37:53 +0000 (12:37 +0100)] 
smbd: Simplify an if-condition

(state->current_sid == NULL) is true if and only if we could not
assign state->current_sid because num_sids was too small. Make that
more explicit.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Some README.Coding in smbXsrv_session
Volker Lendecke [Fri, 9 Feb 2024 11:34:06 +0000 (12:34 +0100)] 
smbd: Some README.Coding in smbXsrv_session

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agolib: Fix whitespace
Volker Lendecke [Wed, 17 Apr 2024 11:45:08 +0000 (13:45 +0200)] 
lib: Fix whitespace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agolibsmb: Remove unused setup_stat_from_stat_ex()
Volker Lendecke [Thu, 18 Jan 2024 09:30:21 +0000 (10:30 +0100)] 
libsmb: Remove unused setup_stat_from_stat_ex()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agosmbd: Save a few bytes of .text
Volker Lendecke [Wed, 17 Apr 2024 09:24:25 +0000 (11:24 +0200)] 
smbd: Save a few bytes of .text

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 months agolib:ldb: Use correct integer types for sizes
Andreas Schneider [Tue, 30 Apr 2024 12:33:51 +0000 (14:33 +0200)] 
lib:ldb: Use correct integer types for sizes

Error: INTEGER_OVERFLOW (CWE-190):
ldb-2.9.0/common/ldb_ldif.c:84: tainted_data_return: Called function "read(f, buf, size)", and a possible return value may be less than zero.
ldb-2.9.0/common/ldb_ldif.c:84: cast_overflow: An assign that casts to a different type, which might trigger an overflow.
ldb-2.9.0/common/ldb_ldif.c:92: overflow: The expression "size" is considered to have possibly overflowed.
ldb-2.9.0/common/ldb_ldif.c:84: overflow_sink: "size", which might be negative, is passed to "read(f, buf, size)". [Note: The source code implementation of the function has been overridden by a builtin model.]
    82|           buf = (char *)value->data;
    83|           while (count < statbuf.st_size) {
    84|->                 bytes = read(f, buf, size);
    85|                   if (bytes == -1) {
    86|                           talloc_free(value->data);

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Apr 30 15:33:32 UTC 2024 on atb-devel-224

6 months agolib:ldb: Add missing overflow check in ldb_msg_normalize()
Andreas Schneider [Tue, 30 Apr 2024 12:27:54 +0000 (14:27 +0200)] 
lib:ldb: Add missing overflow check in ldb_msg_normalize()

Error: INTEGER_OVERFLOW (CWE-190):
ldb-2.9.0/common/ldb_msg.c:1235: tainted_data_argument: The check "i < msg2->num_elements" contains the tainted expression "i" which causes "msg2->num_elements" to be considered tainted.
ldb-2.9.0/common/ldb_msg.c:1253: overflow: The expression "msg2->num_elements - (i + 1U)" is deemed underflowed because at least one of its arguments has underflowed.
ldb-2.9.0/common/ldb_msg.c:1253: overflow: The expression "32UL * (msg2->num_elements - (i + 1U))" is deemed underflowed because at least one of its arguments has underflowed.
ldb-2.9.0/common/ldb_msg.c:1253: overflow_sink: "32UL * (msg2->num_elements - (i + 1U))", which might have underflowed, is passed to "memmove(el2, el2 + 1, 32UL * (msg2->num_elements - (i + 1U)))". [Note: The source code implementation of the function has been overridden by a builtin model.]
  1251|                           talloc_free(discard_const_p(char, el2->name));
  1252|                           if ((i+1) < msg2->num_elements) {
  1253|->                                 memmove(el2, el2+1, sizeof(struct ldb_message_element) *
  1254|                                           (msg2->num_elements - (i+1)));
  1255|                           }

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agolib:tdb: Add missing overflow check for num_values in pytdb.c
Andreas Schneider [Tue, 30 Apr 2024 12:16:33 +0000 (14:16 +0200)] 
lib:tdb: Add missing overflow check for num_values in pytdb.c

Error: INTEGER_OVERFLOW (CWE-190):
tdb-1.4.10/pytdb.c:401: cast_overflow: Truncation due to cast operation on "num_values" from 64 to 32 bits.
tdb-1.4.10/pytdb.c:401: overflow_sink: "num_values", which might have overflowed, is passed to "tdb_storev(self->ctx, key, values, num_values, flag)".
  399|           }
  400|
  401|->         ret = tdb_storev(self->ctx, key, values, num_values, flag);
  402|           free(values);
  403|           PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agolib:tdb: Remove trailing spaces from pytdb.c
Andreas Schneider [Tue, 30 Apr 2024 12:16:15 +0000 (14:16 +0200)] 
lib:tdb: Remove trailing spaces from pytdb.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agos3:utils: Fix Inherit-Only flag being automatically propagated to children
Anna Popova [Fri, 12 Apr 2024 14:32:37 +0000 (17:32 +0300)] 
s3:utils: Fix Inherit-Only flag being automatically propagated to children

Inherit-only flag applies only to the container it was set to and it
shouldn't be automatically propagated to children.

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

Signed-off-by: Anna Popova <popova.anna235@gmail.com>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Apr 29 10:56:48 UTC 2024 on atb-devel-224

6 months agopython/samba/tests/blackbox: Add tests for Inherit-only flag propagation
yuzu367 [Thu, 11 Apr 2024 08:31:07 +0000 (11:31 +0300)] 
python/samba/tests/blackbox: Add tests for Inherit-only flag propagation

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

Signed-off-by: Anna Popova <popova.anna235@gmail.com>
Reviewed-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 months agos3:libsmb: Pass a memory context to get_ipc_connect()
Andreas Schneider [Thu, 23 Nov 2023 14:53:29 +0000 (15:53 +0100)] 
s3:libsmb: Pass a memory context to get_ipc_connect()

Indirect leak of 792 byte(s) in 1 object(s) allocated from:                                                                                                                              #0 0x7f261b8dc03f in malloc (/lib64/libasan.so.8+0xdc03f) (BuildId: 3e1694ad218c99a8b1b69231666a27df63cf19d0)
    #1 0x7f261b2c2bc2 in __talloc_with_prefix ../../lib/talloc/talloc.c:783                                                                                                              #2 0x7f261b2c473d in __talloc ../../lib/talloc/talloc.c:825
    #3 0x7f261b2c473d in _talloc_named_const ../../lib/talloc/talloc.c:982
    #4 0x7f261b2c473d in _talloc_zero ../../lib/talloc/talloc.c:2421                                                                                                                     #5 0x7f2618cb42bc in smbXcli_conn_create ../../libcli/smb/smbXcli_base.c:350
    #6 0x7f261a74acd3 in cli_state_create ../../source3/libsmb/clientgen.c:196                                                                                                           #7 0x7f261a751f0d in cli_connect_nb_done ../../source3/libsmb/cliconnect.c:2715
    #8 0x7f261a69bacf in _tevent_req_notify_callback ../../lib/tevent/tevent_req.c:177                                                                                                   #9 0x7f261a69bd06 in tevent_req_finish ../../lib/tevent/tevent_req.c:234
    #10 0x7f261a69bd6e in _tevent_req_done ../../lib/tevent/tevent_req.c:240                                                                                                             #11 0x7f261a752dde in cli_connect_sock_done ../../source3/libsmb/cliconnect.c:2624
    #12 0x7f261a69bacf in _tevent_req_notify_callback ../../lib/tevent/tevent_req.c:177
    #13 0x7f261a69bd06 in tevent_req_finish ../../lib/tevent/tevent_req.c:234
    #14 0x7f261a69bd6e in _tevent_req_done ../../lib/tevent/tevent_req.c:240
    #15 0x7f261a7ba2c4 in smbsock_any_connect_connected ../../source3/libsmb/smbsock_connect.c:788
    #16 0x7f261a69bacf in _tevent_req_notify_callback ../../lib/tevent/tevent_req.c:177
    #17 0x7f261a69bd06 in tevent_req_finish ../../lib/tevent/tevent_req.c:234
    #18 0x7f261a69bd6e in _tevent_req_done ../../lib/tevent/tevent_req.c:240
    #19 0x7f261a7b75ad in smbsock_connect_connected ../../source3/libsmb/smbsock_connect.c:524
    #20 0x7f261a69bacf in _tevent_req_notify_callback ../../lib/tevent/tevent_req.c:177
    #21 0x7f261a69bd06 in tevent_req_finish ../../lib/tevent/tevent_req.c:234
    #22 0x7f261a69bd6e in _tevent_req_done ../../lib/tevent/tevent_req.c:240
    #23 0x7f261b4b400a in open_socket_out_connected ../../source3/lib/util_sock.c:484
    #24 0x7f261a69bacf in _tevent_req_notify_callback ../../lib/tevent/tevent_req.c:177
    #25 0x7f261a69bd06 in tevent_req_finish ../../lib/tevent/tevent_req.c:234
    #26 0x7f261a69be3e in tevent_req_trigger ../../lib/tevent/tevent_req.c:291
    #27 0x7f261a699df4 in tevent_common_invoke_immediate_handler ../../lib/tevent/tevent_immediate.c:190
    #28 0x7f261a699e31 in tevent_common_loop_immediate ../../lib/tevent/tevent_immediate.c:236
    #29 0x7f261a6ad3ec in epoll_event_loop_once ../../lib/tevent/tevent_epoll.c:905
    #30 0x7f261a6a679e in std_event_loop_once ../../lib/tevent/tevent_standard.c:110
    #31 0x7f261a696538 in _tevent_loop_once ../../lib/tevent/tevent.c:820

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Apr 29 09:48:47 UTC 2024 on atb-devel-224

6 months agos3:libsmb: Make get_ipc_connect() static
Andreas Schneider [Thu, 23 Nov 2023 14:52:05 +0000 (15:52 +0100)] 
s3:libsmb: Make get_ipc_connect() static

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agos3:libnet: Fix memory leak in libnet_join_connect_dc_ipc()
Andreas Schneider [Thu, 23 Nov 2023 14:21:49 +0000 (15:21 +0100)] 
s3:libnet: Fix memory leak in libnet_join_connect_dc_ipc()

Direct leak of 885 byte(s) in 1 object(s) allocated from:
    #0 0x7f261b8dc03f in malloc (/lib64/libasan.so.8+0xdc03f) (BuildId: 3e1694ad218c99a8b1b69231666a27df63cf19d0)
    #1 0x7f261b2c2bc2 in __talloc_with_prefix ../../lib/talloc/talloc.c:783
    #2 0x7f261b2c543c in _talloc_pool ../../lib/talloc/talloc.c:838
    #3 0x7f261b2c543c in _talloc_pooled_object ../../lib/talloc/talloc.c:906
    #4 0x7f261a69cac9 in __tevent_req_create ../../lib/tevent/tevent_req.c:98
    #5 0x7f261a75bf55 in cli_full_connection_creds_send ../../source3/libsmb/cliconnect.c:3455
    #6 0x7f261a75c4b7 in cli_full_connection_creds ../../source3/libsmb/cliconnect.c:3818
    #7 0x7f261b70d39f in libnet_join_connect_dc_ipc ../../source3/libnet/libnet_join.c:1146
    #8 0x7f261b715794 in libnet_join_lookup_dc_rpc ../../source3/libnet/libnet_join.c:1188
    #9 0x7f261b715794 in libnet_DomainJoin ../../source3/libnet/libnet_join.c:2812
    #10 0x7f261b715794 in libnet_Join ../../source3/libnet/libnet_join.c:3040
    #11 0x555bd93671ea in net_ads_join ../../source3/utils/net_ads.c:1855
    #12 0x555bd9415ca9 in net_join ../../source3/utils/net_join.c:45
    #13 0x555bd940b972 in net_run_function ../../source3/utils/net_util.c:464
    #14 0x555bd9363129 in main ../../source3/utils/net.c:1372
    #15 0x7f2616a281af in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agos3:libsmb: Pass memory context to cli_full_connection_creds()
Andreas Schneider [Thu, 23 Nov 2023 14:07:53 +0000 (15:07 +0100)] 
s3:libsmb: Pass memory context to cli_full_connection_creds()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agos3:libsmb: Pass memory context to cli_full_connection_creds_recv()
Andreas Schneider [Thu, 23 Nov 2023 13:57:42 +0000 (14:57 +0100)] 
s3:libsmb: Pass memory context to cli_full_connection_creds_recv()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agos3:libsmb: Pass a memory context to cli_start_connection()
Andreas Schneider [Thu, 23 Nov 2023 13:51:48 +0000 (14:51 +0100)] 
s3:libsmb: Pass a memory context to cli_start_connection()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agos3:libsmb: Pass a memory context to cli_start_connection_recv()
Andreas Schneider [Tue, 31 Oct 2023 14:05:35 +0000 (15:05 +0100)] 
s3:libsmb: Pass a memory context to cli_start_connection_recv()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agos3:libsmb: Pass memory context to cli_connect_nb()
Andreas Schneider [Tue, 31 Oct 2023 14:13:04 +0000 (15:13 +0100)] 
s3:libsmb: Pass memory context to cli_connect_nb()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agos3:torture: Remove trailing spaces in torture.c
Andreas Schneider [Thu, 25 Apr 2024 09:55:17 +0000 (11:55 +0200)] 
s3:torture: Remove trailing spaces in torture.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agos3:nmbd: Remove trailing spaces in nmbd_synclists.c
Andreas Schneider [Thu, 25 Apr 2024 09:49:31 +0000 (11:49 +0200)] 
s3:nmbd: Remove trailing spaces in nmbd_synclists.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agos3:libsmb: Pass a memory context to cli_connect_nb_recv()
Andreas Schneider [Tue, 31 Oct 2023 13:58:49 +0000 (14:58 +0100)] 
s3:libsmb: Pass a memory context to cli_connect_nb_recv()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
6 months agopython:tests: Store keys as bytes rather than as lists of ints
Jo Sutton [Wed, 24 Apr 2024 01:34:27 +0000 (13:34 +1200)] 
python:tests: Store keys as bytes rather than as lists of ints

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Apr 24 06:20:58 UTC 2024 on atb-devel-224

6 months agopython:tests: Rewrite condition of while loop
Jo Sutton [Wed, 24 Apr 2024 01:37:40 +0000 (13:37 +1200)] 
python:tests: Rewrite condition of while loop

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agopython:tests: Store keys as bytes rather than as tuples
Jo Sutton [Wed, 24 Apr 2024 01:36:28 +0000 (13:36 +1200)] 
python:tests: Store keys as bytes rather than as tuples

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agopython:gkdi: Add helper methods returning previous and next GKIDs
Jo Sutton [Wed, 24 Apr 2024 00:42:40 +0000 (12:42 +1200)] 
python:gkdi: Add helper methods returning previous and next GKIDs

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:kdc: Add helper variable indicating whether we think we are performing a keytab...
Jo Sutton [Mon, 15 Apr 2024 02:45:51 +0000 (14:45 +1200)] 
s4:kdc: Add helper variable indicating whether we think we are performing a keytab export

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:kdc: Pass ldb context into samba_kdc_message2entry_keys()
Jo Sutton [Mon, 15 Apr 2024 02:39:45 +0000 (14:39 +1200)] 
s4:kdc: Pass ldb context into samba_kdc_message2entry_keys()

This ldb context can be used to query the current gMSA time.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agopython: Move get_admin_sid() to SamDB
Jo Sutton [Mon, 15 Apr 2024 01:23:15 +0000 (13:23 +1200)] 
python: Move get_admin_sid() to SamDB

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:auth: Export AES128 gMSA keys along with AES256 keys by default
Jo Sutton [Tue, 23 Apr 2024 01:13:20 +0000 (13:13 +1200)] 
s4:auth: Export AES128 gMSA keys along with AES256 keys by default

This is what an existing test expects.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agotests/krb5: Check that updated NT hashes of gMSAs have the values we expect
Jo Sutton [Sun, 21 Apr 2024 22:53:30 +0000 (10:53 +1200)] 
tests/krb5: Check that updated NT hashes of gMSAs have the values we expect

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agoldb: Remove unnecessary declaration
Jo Sutton [Wed, 24 Apr 2024 00:31:36 +0000 (12:31 +1200)] 
ldb: Remove unnecessary declaration

This declaration is a hold‐over from the Python 2 module initialization
pattern.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agolib:crypto: Fix Coverity build
Jo Sutton [Sun, 21 Apr 2024 23:10:00 +0000 (11:10 +1200)] 
lib:crypto: Fix Coverity build

The Coverity build is failing with the following errors:

[1936/5164] Compiling lib/crypto/gkdi.c
In file included from /usr/lib64/gcc/x86_64-suse-linux/7/include/stdint.h:9:0,
                 from /usr/include/inttypes.h:27,
                 from ../../lib/crypto/../replace/replace.h:64,
                 from ../../source4/include/includes.h:23,
                 from ../../lib/crypto/gkdi.c:21:
../../lib/crypto/gkdi.c: In function ‘gkdi_get_key_start_time’:
../../lib/crypto/gkdi.c:197:4: error: initializer element is not constant
    UINT64_MAX /
    ^
../../lib/crypto/gkdi.c:197:4: note: (near initialization for ‘max_gkid.l0_idx’)
../../lib/crypto/gkdi.c:200:4: error: initializer element is not constant
    UINT64_MAX /
    ^
../../lib/crypto/gkdi.c:200:4: note: (near initialization for ‘max_gkid.l1_idx’)
../../lib/crypto/gkdi.c:204:4: error: initializer element is not constant
    UINT64_MAX / gkdi_key_cycle_duration %
    ^
../../lib/crypto/gkdi.c:204:4: note: (near initialization for ‘max_gkid.l2_idx’)

Fix the build by removing the ‘static’ specifier on this constant.

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agoctdb: Report errors from getline()
Jo Sutton [Wed, 24 Apr 2024 02:26:20 +0000 (14:26 +1200)] 
ctdb: Report errors from getline()

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 months agoctdb: Ensure ‘ret’ is always initialized
Jo Sutton [Wed, 24 Apr 2024 02:26:35 +0000 (14:26 +1200)] 
ctdb: Ensure ‘ret’ is always initialized

This avoids a compilation error:

../../ctdb/protocol/protocol_util.c: In function ‘ctdb_connection_list_read’:
../../ctdb/protocol/protocol_util.c:787:9: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  787 |  return ret;
      |         ^~~

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 months agoWHATSNEW: document ldaps/tls related option changes
Stefan Metzmacher [Mon, 4 Mar 2024 18:34:22 +0000 (19:34 +0100)] 
WHATSNEW: document ldaps/tls related option changes

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Apr 24 00:59:53 UTC 2024 on atb-devel-224

6 months agosmbdotconf: finally remove unused "client use spnego principal" option
Stefan Metzmacher [Mon, 4 Mar 2024 18:33:52 +0000 (19:33 +0100)] 
smbdotconf: finally remove unused "client use spnego principal" option

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:selftest: remove useless 'client use spnego principal' tests
Stefan Metzmacher [Tue, 5 Mar 2024 07:54:02 +0000 (08:54 +0100)] 
s4:selftest: remove useless 'client use spnego principal' tests

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agoauth/gensec: remove useless client_use_spnego_principal usage
Stefan Metzmacher [Mon, 4 Mar 2024 18:31:33 +0000 (19:31 +0100)] 
auth/gensec: remove useless client_use_spnego_principal usage

It's off by default and all sane servers use
not_defined_in_RFC4178@please_ignore anyway.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:selftest/tests.py: run TLDAP tests with sasl-sign,sasl-seal,ldaps,starttls
Stefan Metzmacher [Mon, 4 Mar 2024 14:54:36 +0000 (15:54 +0100)] 
s3:selftest/tests.py: run TLDAP tests with sasl-sign,sasl-seal,ldaps,starttls

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:torture: add ldaps/starttls support to run_tldap()
Stefan Metzmacher [Tue, 13 Feb 2024 21:53:29 +0000 (22:53 +0100)] 
s3:torture: add ldaps/starttls support to run_tldap()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:torture: add '-T 'option=value' this is similar to '--option='=value'
Stefan Metzmacher [Mon, 4 Mar 2024 14:27:24 +0000 (15:27 +0100)] 
s3:torture: add '-T 'option=value' this is similar to '--option='=value'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agoblackbox/test_net_ads_search_server: also test ldaps/starttls
Stefan Metzmacher [Mon, 4 Mar 2024 14:08:17 +0000 (15:08 +0100)] 
blackbox/test_net_ads_search_server: also test ldaps/starttls

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:selftest: also test samba4.ldb.simple.ldap with starttls and SASL-BIND
Stefan Metzmacher [Tue, 13 Feb 2024 15:04:57 +0000 (16:04 +0100)] 
s4:selftest: also test samba4.ldb.simple.ldap with starttls and SASL-BIND

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:libcli/ldap: add support for ADS_AUTH_SASL_{STARTTLS,LDAPS}
Stefan Metzmacher [Wed, 24 Jan 2024 09:43:42 +0000 (10:43 +0100)] 
s4:libcli/ldap: add support for ADS_AUTH_SASL_{STARTTLS,LDAPS}

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:idmap_ad: add support for ADS_AUTH_SASL_{STARTTLS,LDAPS}
Stefan Metzmacher [Fri, 26 Jan 2024 08:18:33 +0000 (09:18 +0100)] 
s3:idmap_ad: add support for ADS_AUTH_SASL_{STARTTLS,LDAPS}

Review with: git show --patience

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: add support for ADS_AUTH_SASL_{STARTTLS,LDAPS}
Stefan Metzmacher [Tue, 30 Jan 2024 09:27:58 +0000 (10:27 +0100)] 
s3:libads: add support for ADS_AUTH_SASL_{STARTTLS,LDAPS}

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agosmbdotconf: add client ldap sasl wrapping = {starttls,ldaps}
Stefan Metzmacher [Fri, 9 Feb 2024 14:40:00 +0000 (15:40 +0100)] 
smbdotconf: add client ldap sasl wrapping = {starttls,ldaps}

In order to use SASL authentitation within a TLS connection
we now provide "client ldap sasl wrapping = starttls" or
"client ldap sasl wrapping = ldaps".

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: call gensec_set_channel_bindings() for tls connections
Stefan Metzmacher [Tue, 6 Feb 2024 11:35:39 +0000 (12:35 +0100)] 
s3:libads: call gensec_set_channel_bindings() for tls connections

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: call ldap_set_option(LDAP_OPT_PROTOCOL_VERSION) as soon as possible
Stefan Metzmacher [Tue, 30 Jan 2024 09:27:58 +0000 (10:27 +0100)] 
s3:libads: call ldap_set_option(LDAP_OPT_PROTOCOL_VERSION) as soon as possible

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: add tls_wrapping into openldap
Stefan Metzmacher [Tue, 30 Jan 2024 09:27:58 +0000 (10:27 +0100)] 
s3:libads: add tls_wrapping into openldap

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:lib/tls: add tstream_tls_sync_setup()
Stefan Metzmacher [Tue, 6 Feb 2024 10:48:41 +0000 (11:48 +0100)] 
s4:lib/tls: add tstream_tls_sync_setup()

This operates in a non-async fashion and may block
in the push and pull function.

It will be used to plug into openldap transport
layer, this is needed in order to have access
to the channel bindings. And also use the same
configuration for all our gnutls based tls code.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: always require ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF
Stefan Metzmacher [Fri, 5 Apr 2024 15:23:54 +0000 (17:23 +0200)] 
s3:libads: always require ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF

There's no point in trying to support --with-ads, but only use
plaintext ldap without sign/seal.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: use the correct struct sockbuf_io_desc type for 'sbiod' pointer
Stefan Metzmacher [Fri, 2 Feb 2024 16:50:03 +0000 (17:50 +0100)] 
s3:libads: use the correct struct sockbuf_io_desc type for 'sbiod' pointer

Using 'Sockbuf_IO_Desc' in idl implicitly means pidl will use
'struct Sockbuf_IO_Desc', which doesn't exist!

Using 'struct sockbuf_io_desc' which is used in OpenLDAP to
typedef Sockbuf_IO_Desc, we won't need to cast the assign the
'sbiod' pointer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: no longer pass "GSS-SPNEGO" to ads_sasl_spnego_gensec_bind()
Stefan Metzmacher [Fri, 9 Feb 2024 09:50:13 +0000 (10:50 +0100)] 
s3:libads: no longer pass "GSS-SPNEGO" to ads_sasl_spnego_gensec_bind()

That's the only thing we use...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: remove dead code in ads_sasl_spnego_{gensec}_bind()
Stefan Metzmacher [Fri, 2 Feb 2024 11:35:05 +0000 (12:35 +0100)] 
s3:libads: remove dead code in ads_sasl_spnego_{gensec}_bind()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: directly use kerberos without asking the server
Stefan Metzmacher [Fri, 26 Jan 2024 17:09:39 +0000 (18:09 +0100)] 
s3:libads: directly use kerberos without asking the server

Every AD DC supports kerberos so we can just use it without
asking the server (in an untrusted way) if kerberos is supported.
So remove another useless roundtrip.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: use GSS-SPNEGO directly without asking for supportedSASLMechanisms
Stefan Metzmacher [Fri, 26 Jan 2024 17:08:55 +0000 (18:08 +0100)] 
s3:libads: use GSS-SPNEGO directly without asking for supportedSASLMechanisms

Every AD DC supports 'GSS-SPNEGO' and that's the only one we use anyway,
so remove an unused roundtrip.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:tldap: add support for [START]TLS
Stefan Metzmacher [Tue, 23 Jan 2024 16:21:35 +0000 (17:21 +0100)] 
s3:tldap: add support for [START]TLS

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:tldap: make tldap_gensec_bind_send/recv public
Stefan Metzmacher [Tue, 23 Jan 2024 23:32:51 +0000 (00:32 +0100)] 
s3:tldap: make tldap_gensec_bind_send/recv public

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:tldap: add tldap_extended*
Stefan Metzmacher [Tue, 23 Jan 2024 19:38:21 +0000 (20:38 +0100)] 
s3:tldap: add tldap_extended*

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:tldap: store plain and gensec tstream
Stefan Metzmacher [Tue, 23 Jan 2024 15:00:11 +0000 (16:00 +0100)] 
s3:tldap: store plain and gensec tstream

Also allow resetting to plain.

We now have ld->active as the currently active
tstream, which will allow us to add tls support
soon.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:tldap: let tldap_gensec_bind_send/recv use gensec_update_send/recv
Stefan Metzmacher [Tue, 23 Jan 2024 14:41:23 +0000 (15:41 +0100)] 
s3:tldap: let tldap_gensec_bind_send/recv use gensec_update_send/recv

We should not use the sync gensec_update() in async code!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:tldap: don't use 'supportedSASLMechanisms' and force 'GSS-SPNEGO' instead
Stefan Metzmacher [Tue, 23 Jan 2024 14:30:05 +0000 (15:30 +0100)] 
s3:tldap: don't use 'supportedSASLMechanisms' and force 'GSS-SPNEGO' instead

All active directory dcs support 'GSS-SPNEGO'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:tldap: simplify tldap_gensec_bind.h
Stefan Metzmacher [Tue, 23 Jan 2024 15:45:07 +0000 (16:45 +0100)] 
s3:tldap: simplify tldap_gensec_bind.h

We don't need any includes...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:tldap: simplify read_ldap_more() by using asn1_peek_full_tag()
Stefan Metzmacher [Fri, 26 Jan 2024 13:19:12 +0000 (14:19 +0100)] 
s3:tldap: simplify read_ldap_more() by using asn1_peek_full_tag()

An LDAP pdu is at least 7 bytes long, so we read at least 7 bytes,
then it's easy to use asn1_peek_full_tag() in order to find out the
whole length of the pdu on one go.

As a side effect it's now possible that wireshark can reassemble
the fragments in a socket_wrapper generated pcap file.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:lib/tls: add support for gnutls_certificate_set_x509_{system_trust,trust_dir}()
Stefan Metzmacher [Fri, 9 Feb 2024 10:31:30 +0000 (11:31 +0100)] 
s4:lib/tls: add support for gnutls_certificate_set_x509_{system_trust,trust_dir}()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agodocs-xml: add 'tls trust system cas' and 'tls ca directories' options
Stefan Metzmacher [Tue, 13 Feb 2024 16:42:41 +0000 (17:42 +0100)] 
docs-xml: add 'tls trust system cas' and 'tls ca directories' options

This will make it easier to support trusting more than one CA.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:ldap_server: remove unused include of gensec_internal.h
Stefan Metzmacher [Tue, 27 Feb 2024 15:49:24 +0000 (16:49 +0100)] 
s4:ldap_server: remove unused include of gensec_internal.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: remove unused ADS_AUTH_SIMPLE_BIND code
Stefan Metzmacher [Mon, 25 Apr 2022 12:49:33 +0000 (14:49 +0200)] 
s3:libads: remove unused ADS_AUTH_SIMPLE_BIND code

We have other code to test simple binds.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libads: remove unused include of gensec_internal.h
Stefan Metzmacher [Tue, 27 Feb 2024 15:49:24 +0000 (16:49 +0100)] 
s3:libads: remove unused include of gensec_internal.h

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos3:libsmb: libcli/auth/spnego.h is not needed in cliconnect.c
Stefan Metzmacher [Fri, 26 Jan 2024 17:09:59 +0000 (18:09 +0100)] 
s3:libsmb: libcli/auth/spnego.h is not needed in cliconnect.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agoWHATSNEW: document ldap_server ldaps/tls channel binding support
Stefan Metzmacher [Mon, 4 Mar 2024 18:34:22 +0000 (19:34 +0100)] 
WHATSNEW: document ldap_server ldaps/tls channel binding support

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:selftest: also test samba4.ldb.simple.ldap*SASL-BIND with ldap_testing:{channel_bo...
Stefan Metzmacher [Tue, 13 Feb 2024 14:50:14 +0000 (15:50 +0100)] 
s4:selftest: also test samba4.ldb.simple.ldap*SASL-BIND with ldap_testing:{channel_bound,tls_channel_bindings,forced_channel_binding}

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agoselftest: split out selftest/expectedfail.d/samba4.ldb.simple.ldap-tls
Stefan Metzmacher [Tue, 13 Feb 2024 14:50:14 +0000 (15:50 +0100)] 
selftest: split out selftest/expectedfail.d/samba4.ldb.simple.ldap-tls

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 months agos4:libcli/ldap: add tls channel binding support for ldap_bind_sasl()
Stefan Metzmacher [Thu, 28 Sep 2023 15:11:03 +0000 (17:11 +0200)] 
s4:libcli/ldap: add tls channel binding support for ldap_bind_sasl()

We still allow 'ldap_testing:tls_channel_bindings = no' and
'ldap_testing:channel_bound = no' for testing
the old behavior in order to have expected failures in our tests.

And we have 'ldap_testing:forced_channel_binding = somestring'
in order to force invalid bindings.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>