]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 years agos4:param: let lpcfg_smbcli_options() fill smb3_capabilities.ciphers
Stefan Metzmacher [Thu, 11 Mar 2021 13:39:32 +0000 (14:39 +0100)] 
s4:param: let lpcfg_smbcli_options() fill smb3_capabilities.ciphers

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:libsmb: fill in smb3_capabilities.ciphers
Stefan Metzmacher [Thu, 11 Mar 2021 13:38:33 +0000 (14:38 +0100)] 
s3:libsmb: fill in smb3_capabilities.ciphers

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: introduce struct smb3_encryption_capabilities
Stefan Metzmacher [Tue, 9 Mar 2021 22:38:51 +0000 (23:38 +0100)] 
libcli/smb: introduce struct smb3_encryption_capabilities

This will allow us to control the offered ciphers from the callers
later.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: pass smb3_capabilities to smbXcli_conn_create()
Stefan Metzmacher [Tue, 9 Mar 2021 22:49:19 +0000 (23:49 +0100)] 
libcli/smb: pass smb3_capabilities to smbXcli_conn_create()

Passing NULL means use none.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:libcli/raw: add smb3_capabilities to struct smbcli_options
Stefan Metzmacher [Tue, 9 Mar 2021 22:40:40 +0000 (23:40 +0100)] 
s4:libcli/raw: add smb3_capabilities to struct smbcli_options

Currently this will be zeroed in lpcfg_smbcli_options(),
but will later allow advanced callers to pass values to
smbXcli_conn_create().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: introduce struct struct smb311_capabilities
Stefan Metzmacher [Tue, 9 Mar 2021 22:38:51 +0000 (23:38 +0100)] 
libcli/smb: introduce struct struct smb311_capabilities

This will be filled later with supported ciphers and other
things that can be negotiated in SMB >= 3.1.1.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: don't copy the key to a stack variable in smb2_signing_{encrypt,decrypt...
Stefan Metzmacher [Wed, 10 Mar 2021 15:12:12 +0000 (16:12 +0100)] 
libcli/smb: don't copy the key to a stack variable in smb2_signing_{encrypt,decrypt}_pdu()

The key size should always match now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: no longer pass protocol to smb2_signing_{encrypt,decrypt}_pdu()
Stefan Metzmacher [Wed, 10 Mar 2021 13:03:50 +0000 (14:03 +0100)] 
libcli/smb: no longer pass protocol to smb2_signing_{encrypt,decrypt}_pdu()

The cipher algorithm is already passed via
smb2_signing_key->chipher_algo_id.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: no longer pass protocol to smb2_signing_{sign,check}_pdu()
Stefan Metzmacher [Wed, 11 Nov 2020 12:18:24 +0000 (13:18 +0100)] 
libcli/smb: no longer pass protocol to smb2_signing_{sign,check}_pdu()

The signing algorithm is already passed via
smb2_signing_key->sign_algo_id.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: make smb2_signing_key_destructor static
Stefan Metzmacher [Fri, 5 Mar 2021 17:01:01 +0000 (18:01 +0100)] 
libcli/smb: make smb2_signing_key_destructor static

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmb2_server: use struct smb2_signing_key for first_enc_key and last_sign_key
Stefan Metzmacher [Fri, 5 Mar 2021 22:14:21 +0000 (23:14 +0100)] 
smb2_server: use struct smb2_signing_key for first_enc_key and last_sign_key

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: make use of smb2_signing_key_{copy,sign_create,cipher_create}() helpers
Stefan Metzmacher [Fri, 5 Mar 2021 21:40:43 +0000 (22:40 +0100)] 
smbd: make use of smb2_signing_key_{copy,sign_create,cipher_create}() helpers

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: make use of smb2_signing_key_{copy,sign_create,cipher_create}() in smbXcl...
Stefan Metzmacher [Fri, 5 Mar 2021 15:43:29 +0000 (16:43 +0100)] 
libcli/smb: make use of smb2_signing_key_{copy,sign_create,cipher_create}() in smbXcli_base.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: add smb2_signing_key_{copy,sign_create,cipher_create}() helpers
Stefan Metzmacher [Fri, 5 Mar 2021 15:19:08 +0000 (16:19 +0100)] 
libcli/smb: add smb2_signing_key_{copy,sign_create,cipher_create}() helpers

These will simplify the callers a lot.
In important part is to also remember the sign and cipher algo ids.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmb2_negotiate: maintain xconn->smb2.server.sign_algo
Stefan Metzmacher [Wed, 11 Nov 2020 12:18:24 +0000 (13:18 +0100)] 
smb2_negotiate: maintain xconn->smb2.server.sign_algo

This prepares the negotiation of signing algorithms in future.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: maintain smbXcli_conn.smb2.server.sign_algo
Stefan Metzmacher [Wed, 11 Nov 2020 12:18:24 +0000 (13:18 +0100)] 
libcli/smb: maintain smbXcli_conn.smb2.server.sign_algo

This prepares the negotiation of signing algorithms in future.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbXsrv_session: let smbXsrv_session_global_verify_record() use talloc_keep_secret...
Stefan Metzmacher [Fri, 5 Mar 2021 16:50:47 +0000 (17:50 +0100)] 
smbXsrv_session: let smbXsrv_session_global_verify_record() use talloc_keep_secret() for keys

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmb2_sesssetup: use smb2_signing_derivations_fill_const_stack()
Stefan Metzmacher [Fri, 5 Mar 2021 17:24:27 +0000 (18:24 +0100)] 
smb2_sesssetup: use smb2_signing_derivations_fill_const_stack()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: make use of smb2_signing_derivations_fill_const_stack() smb2cli_session_s...
Stefan Metzmacher [Fri, 5 Mar 2021 15:14:35 +0000 (16:14 +0100)] 
libcli/smb: make use of smb2_signing_derivations_fill_const_stack() smb2cli_session_set_session_key()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: add smb2_signing_derivations_fill_const_stack()
Stefan Metzmacher [Fri, 5 Mar 2021 15:10:07 +0000 (16:10 +0100)] 
libcli/smb: add smb2_signing_derivations_fill_const_stack()

This will allow us to have the logic in one place only
in future.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: make use of smb2_signing_calc_signature() in smb2_signing_sign_pdu()
Stefan Metzmacher [Wed, 11 Nov 2020 12:05:27 +0000 (13:05 +0100)] 
libcli/smb: make use of smb2_signing_calc_signature() in smb2_signing_sign_pdu()

We only need to logic to calculate the signature once...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: assert that smb2_signing_{sign,check}_pdu() gets 2-4 iovec elements
Stefan Metzmacher [Tue, 9 Mar 2021 08:35:53 +0000 (09:35 +0100)] 
libcli/smb: assert that smb2_signing_{sign,check}_pdu() gets 2-4 iovec elements

We expect the following:

* SMB2 HDR
* SMB2 BODY FIXED
* (optional) SMB2 BODY DYN
* (optional) PADDING

Everything else is a bug.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: split out smb2_signing_calc_signature() from smb2_signing_check_pdu()
Stefan Metzmacher [Wed, 11 Nov 2020 12:00:34 +0000 (13:00 +0100)] 
libcli/smb: split out smb2_signing_calc_signature() from smb2_signing_check_pdu()

We only need one function to calculate the signature of an SMB2 packet.
And that only need the logic based on a gnutls_mac_algorithm_t once.

The next step will convert smb2_signing_sign_pdu() to also use
smb2_signing_calc_signature(). Doing that in a separate commit
should make sure we don't introduce a symetric bug.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: pass the length of the resulting key to smb2_key_derivation()
Stefan Metzmacher [Mon, 9 Nov 2020 13:22:24 +0000 (14:22 +0100)] 
libcli/smb: pass the length of the resulting key to smb2_key_derivation()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli/smb: prepare smb2_key_derivation() for keys larger than 16-bytes
Stefan Metzmacher [Mon, 9 Nov 2020 13:10:27 +0000 (14:10 +0100)] 
libcli/smb: prepare smb2_key_derivation() for keys larger than 16-bytes

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: fix cleanup of test_printing_var_exp.sh
Ralph Boehme [Tue, 16 Mar 2021 13:12:23 +0000 (14:12 +0100)] 
selftest: fix cleanup of test_printing_var_exp.sh

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar 16 22:08:10 UTC 2021 on sn-devel-184

4 years agoBug 9931: change pytalloc source to LGPL
David Disseldorp [Wed, 5 Jun 2013 13:48:24 +0000 (15:48 +0200)] 
Bug 9931: change pytalloc source to LGPL

pytalloc is currently GPL, while the rest of talloc is LGPL.

This situation arose because pytalloc was originally developed under
source4/scripting/python/, and moved into talloc proper with commit
0f043c197c473c801fc32c727194b5a2d6ae232f ("Move pytalloc to talloc
directory.", October 2008).

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

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar 16 18:17:43 UTC 2021 on sn-devel-184

4 years agofuzz:afl main: run the initialisation function
Douglas Bagnall [Thu, 28 Jan 2021 04:31:28 +0000 (17:31 +1300)] 
fuzz:afl main: run the initialisation function

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agofuzz: add a LLVMFuzzerInitialize() to all fuzzers
Douglas Bagnall [Fri, 29 Jan 2021 01:11:46 +0000 (14:11 +1300)] 
fuzz: add a LLVMFuzzerInitialize() to all fuzzers

To compile the AFL binaries, we need every fuzzer to have a consistent
set of functions. Some fuzzers require the initialize function, so all
the rest must have an empty one.

AFL binaires are handy for testing the fuzz results in a less magical
environment than libfuzzer/honggfuzz give you.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agofuzz:afl main: add a diagnostic message
Douglas Bagnall [Thu, 28 Jan 2021 04:33:22 +0000 (17:33 +1300)] 
fuzz:afl main: add a diagnostic message

LLVMFuzzerTestOneInput() NEVER returns non-zero, but if it does, we might as well
know what made it do so

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agofuzz/afl main: don't treat fuzzer as fuzzee
Douglas Bagnall [Thu, 28 Jan 2021 04:24:47 +0000 (17:24 +1300)] 
fuzz/afl main: don't treat fuzzer as fuzzee

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoautobuild: fuzz: correctly spell AFL build option
Douglas Bagnall [Thu, 28 Jan 2021 04:06:28 +0000 (17:06 +1300)] 
autobuild: fuzz: correctly spell AFL build option

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Fix a -Werror=format-truncation error
Volker Lendecke [Tue, 9 Feb 2021 11:26:20 +0000 (12:26 +0100)] 
rpc_server: Fix a -Werror=format-truncation error

gcc gets this wrong, it believes %u can write up to
"2147483647" (2^31-1). Silence this with an easy patch.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpcclient: Fix a DBG msg: This is not dcerpc_winreg_int_openkey()
Volker Lendecke [Tue, 2 Feb 2021 14:12:55 +0000 (15:12 +0100)] 
rpcclient: Fix a DBG msg: This is not dcerpc_winreg_int_openkey()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agowinbindd: Improve a DEBUG message in sam_name_to_sid()
Volker Lendecke [Tue, 23 Feb 2021 07:16:04 +0000 (08:16 +0100)] 
winbindd: Improve a DEBUG message in sam_name_to_sid()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpcclient: Factor out cmd_set_auth()
Volker Lendecke [Sun, 7 Feb 2021 13:38:34 +0000 (14:38 +0100)] 
rpcclient: Factor out cmd_set_auth()

sign, seal and packet did exactly the same wrt authentication

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpcclient: Convert binding-related commands to RPC_RTYPE_BINDING
Volker Lendecke [Sat, 6 Feb 2021 21:21:01 +0000 (22:21 +0100)] 
rpcclient: Convert binding-related commands to RPC_RTYPE_BINDING

Purely cosmetic at this point, will become useful soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpcclient: Add RPC_RTYPE_BINDING
Volker Lendecke [Sat, 6 Feb 2021 20:33:41 +0000 (21:33 +0100)] 
rpcclient: Add RPC_RTYPE_BINDING

Purely transport-related commands don't need the cli_state.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpcclient: Simplify do_cmd
Volker Lendecke [Sat, 6 Feb 2021 21:18:27 +0000 (22:18 +0100)] 
rpcclient: Simplify do_cmd

Reduce indentation by an early "continue;", simplify if-expression

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpcclient: Avoid a few implicit NULL assignments
Volker Lendecke [Sat, 6 Feb 2021 20:35:56 +0000 (21:35 +0100)] 
rpcclient: Avoid a few implicit NULL assignments

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Initialize variables in get_md4pw()
Volker Lendecke [Sun, 14 Mar 2021 09:18:12 +0000 (10:18 +0100)] 
rpc_server: Initialize variables in get_md4pw()

My gcc complained at one point about uninitialized vars

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Save roundtrips into samr for machine pwd changes
Volker Lendecke [Sun, 14 Mar 2021 09:05:33 +0000 (10:05 +0100)] 
rpc_server: Save roundtrips into samr for machine pwd changes

We already have the machine SID, no need to look it up again.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoauth3: Make it a bit easier to #include "source3/include/auth.h"
Volker Lendecke [Fri, 5 Feb 2021 14:00:00 +0000 (15:00 +0100)] 
auth3: Make it a bit easier to #include "source3/include/auth.h"

Avoid using "uchar" in source3/auth/proto.h, this is #defined in includes.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoauth3: Align integer types
Volker Lendecke [Thu, 4 Mar 2021 10:42:25 +0000 (11:42 +0100)] 
auth3: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Remove init_names()
Volker Lendecke [Sat, 13 Mar 2021 21:07:53 +0000 (22:07 +0100)] 
lib: Remove init_names()

is_myname() looks at lp_* directly, nmbd maintains its own list: We don't
need the baroque loadparm handler anymore.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agonmbd: Move my_netbios_names() to nmbd
Volker Lendecke [Sat, 13 Mar 2021 20:56:53 +0000 (21:56 +0100)] 
nmbd: Move my_netbios_names() to nmbd

nmbd is the heaviest user of this. The only other user was
is_myname(), which is used in quite a few places in source3.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Unfold calls to my_netbios_names() in util_names.c
Volker Lendecke [Sat, 13 Mar 2021 20:41:57 +0000 (21:41 +0100)] 
lib: Unfold calls to my_netbios_names() in util_names.c

This will all go away in a few patches, this is an intermediate step.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Decouple is_myname() from init_names()
Volker Lendecke [Wed, 3 Feb 2021 09:15:00 +0000 (10:15 +0100)] 
lib: Decouple is_myname() from init_names()

In a new binary I forgot "init_names()" in main and it crashed in
auth3. We should not have to call init_names() everywhere I guess.

The my_netbios_names() array is free of duplicates, but as we don't
expect more than a handful of netbios aliases this does not matter for
just checking existence of a name. And moreover, a properly configured
smb.conf doesn't have tons of dups in "netbios aliases" anyway.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Make pidfile_path_create() return the existing PID on conflict
Volker Lendecke [Mon, 15 Feb 2021 10:38:18 +0000 (11:38 +0100)] 
lib: Make pidfile_path_create() return the existing PID on conflict

Use F_GETLK to get the lock holder PID, this is more accurate than
reading the file contents: A conflicting process might not have
written its PID yet. Also, F_GETLK easily allows to do a retry if the
lock holder just died.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibrpc: Make "dcesrv_context->callbacks" a pointer
Volker Lendecke [Tue, 2 Feb 2021 14:07:35 +0000 (15:07 +0100)] 
librpc: Make "dcesrv_context->callbacks" a pointer

This structure just grew from 3 to 6 pointers, avoid making a copy of
this. All callers of dcesrv_init_context() have this as a static
struct in the C object, so a pointer to that won't change.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture: Make srv_cb static
Volker Lendecke [Sat, 13 Mar 2021 15:34:23 +0000 (16:34 +0100)] 
torture: Make srv_cb static

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server4: Make "srv_callbacks" static
Volker Lendecke [Sat, 13 Mar 2021 15:33:21 +0000 (16:33 +0100)] 
rpc_server4: Make "srv_callbacks" static

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibrpc: Add "private_data" to struct dcesrv_context_callbacks
Volker Lendecke [Fri, 29 Jan 2021 17:16:08 +0000 (18:16 +0100)] 
librpc: Add "private_data" to struct dcesrv_context_callbacks

Not used right now, but we should never have callbacks without a
"private_data" pointer. Some of the callbacks could even today benefit
from this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoprinting: Move rap2jobid functions to their own file
Volker Lendecke [Thu, 11 Mar 2021 17:02:44 +0000 (18:02 +0100)] 
printing: Move rap2jobid functions to their own file

This will make it easier to split out the spoolss functions later

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoprinting: Introduce printer_list_printername_exists()
Volker Lendecke [Sat, 13 Mar 2021 13:34:35 +0000 (14:34 +0100)] 
printing: Introduce printer_list_printername_exists()

Replace pcap_printername_ok(). Slightly different semantics: If the
printer list db has a corrupted record, this is not detected.

Why this patch? pcap_printername_ok() is a simple wrapper around the
tdb accessing function, and this reduces a dependency on pcap.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoprinting: Remove simple wrapper function pcap_printer_read_fn()
Volker Lendecke [Sat, 13 Mar 2021 13:19:23 +0000 (14:19 +0100)] 
printing: Remove simple wrapper function pcap_printer_read_fn()

There's only one caller that was trivial to convert

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Use FIONREAD in wait_for_read_send/recv
Volker Lendecke [Tue, 9 Mar 2021 11:54:49 +0000 (12:54 +0100)] 
lib: Use FIONREAD in wait_for_read_send/recv

ENOTSOCK looks ugly in straces...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotests: Fix a typo
Volker Lendecke [Tue, 9 Mar 2021 16:34:26 +0000 (17:34 +0100)] 
tests: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoprinting: Fix a typo
Volker Lendecke [Sat, 13 Mar 2021 13:10:33 +0000 (14:10 +0100)] 
printing: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agowinbind: Simplify winbindd_samr.c
Volker Lendecke [Tue, 23 Feb 2021 21:09:24 +0000 (22:09 +0100)] 
winbind: Simplify winbindd_samr.c

talloc_stackframe() panics on failure

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: VFS: Remove vfs_tru64acl.[c|h]
Jeremy Allison [Fri, 12 Mar 2021 20:10:49 +0000 (12:10 -0800)] 
s3: VFS: Remove vfs_tru64acl.[c|h]

Support was discontinued for the entire Tru64 OS on 31 December 2012.

Signed-off-by: Jeremy Allison <jra@samba.org>
4 years agoVFS: glusterfs: Ensure vfs_gluster_fsetxattr() only uses an io fd for a handle based...
Jeremy Allison [Fri, 12 Mar 2021 07:06:37 +0000 (23:06 -0800)] 
VFS: glusterfs: Ensure vfs_gluster_fsetxattr() only uses an io fd for a handle based call.

Otherwise fall back to pathname based. This is the same as the
fallback used in vfs_default.c

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 12 20:38:03 UTC 2021 on sn-devel-184

4 years agoVFS: glusterfs: Ensure vfs_gluster_flistxattr() only uses an io fd for a handle based...
Jeremy Allison [Fri, 12 Mar 2021 07:03:19 +0000 (23:03 -0800)] 
VFS: glusterfs: Ensure vfs_gluster_flistxattr() only uses an io fd for a handle based call.

Otherwise fall back to pathname based. This is the same as the
fallback used in vfs_default.c

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoVFS: ceph: Ensure cephwrap_fsetxattr() only uses an io fd for a handle based call.
Jeremy Allison [Fri, 12 Mar 2021 07:00:14 +0000 (23:00 -0800)] 
VFS: ceph: Ensure cephwrap_fsetxattr() only uses an io fd for a handle based call.

Otherwise fall back to pathname based. This is the same as the
fallback used in vfs_default.c

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoVFS: ceph: Ensure cephwrap_flistxattr() only uses an io fd for a handle based call.
Jeremy Allison [Fri, 12 Mar 2021 06:55:33 +0000 (22:55 -0800)] 
VFS: ceph: Ensure cephwrap_flistxattr() only uses an io fd for a handle based call.

Otherwise fall back to pathname based. This is the same as the
fallback used in vfs_default.c

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: call set_current_user_info() in smbd_become_authenticated_pipe_user()
Ralph Boehme [Thu, 11 Mar 2021 10:20:52 +0000 (11:20 +0100)] 
smbd: call set_current_user_info() in smbd_become_authenticated_pipe_user()

The current_user_info is updated at the SMB level, but currently not at the RPC
level in the RPC impersonation function smbd_become_authenticated_pipe_user().

For RPC services running embedded this is not an issue as the SMB level
impersonation has already taken care of current_user_info, but for RPC services
running as external daemons, eg spoolssd, the omission of updating
current_user_info results in variable expansion of eg %U (username) to be
broken.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14668
MR: https://gitlab.com/samba-team/samba/-/merge_requests/1834
RN: %U variable expansion not working in spoolsd

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 12 00:54:01 UTC 2021 on sn-devel-184

4 years agoselftest: add a test for %U variable expansion in spoolssd
Ralph Boehme [Thu, 11 Mar 2021 13:46:28 +0000 (14:46 +0100)] 
selftest: add a test for %U variable expansion in spoolssd

This targets the nt4_dc testenv which luckily already runs with spoolssd
enabled.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14668
MR: https://gitlab.com/samba-team/samba/-/merge_requests/1834

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4:libnet_rpc: avoid reusing the assoc_group_id of the lsa connection
Stefan Metzmacher [Thu, 11 Mar 2021 14:27:01 +0000 (15:27 +0100)] 
s4:libnet_rpc: avoid reusing the assoc_group_id of the lsa connection

This was an unexpected side effect introduced in commit
1b17d9a587bf3600d449c2481fe1191793479e32.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 11 22:50:02 UTC 2021 on sn-devel-184

4 years agoldb: correct comments in attrib_handers val_to_int64
Douglas Bagnall [Fri, 5 Mar 2021 20:57:44 +0000 (09:57 +1300)] 
ldb: correct comments in attrib_handers val_to_int64

c.f. the identical static function in lib/ldb-samba/ldif_handlers.c

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoutil:str_sub: talloc_free on error
Douglas Bagnall [Wed, 10 Mar 2021 09:13:48 +0000 (22:13 +1300)] 
util:str_sub: talloc_free on error

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoutil: don't mark impure functions as pure
Douglas Bagnall [Wed, 10 Mar 2021 09:05:37 +0000 (22:05 +1300)] 
util: don't mark impure functions as pure

nothing that allocates memory can be pure, unless it guarantees to
allocate exactly the same pointer very time (which it does not).

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosamba-tool gpo: add missing newline to admxload warning
Björn Baumbach [Tue, 9 Mar 2021 12:11:08 +0000 (13:11 +0100)] 
samba-tool gpo: add missing newline to admxload warning

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: David Mulder <dmulder@suse.com>
Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Thu Mar 11 21:41:04 UTC 2021 on sn-devel-184

4 years agosamba-gpupdate: Check sysvol download paths in case-insensitive way
David Mulder [Tue, 9 Mar 2021 18:13:40 +0000 (11:13 -0700)] 
samba-gpupdate: Check sysvol download paths in case-insensitive way

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

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Björn Baumbach <bb@sernet.de>
4 years agosamba-gpupdate: Test that sysvol paths download in case-insensitive way
David Mulder [Tue, 9 Mar 2021 19:30:14 +0000 (12:30 -0700)] 
samba-gpupdate: Test that sysvol paths download in case-insensitive way

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14665

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Björn Baumbach <bb@sernet.de>
4 years agosamba-gpupdate: Enable the Startup Scripts Extension
David Mulder [Tue, 9 Mar 2021 16:28:15 +0000 (09:28 -0700)] 
samba-gpupdate: Enable the Startup Scripts Extension

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Björn Baumbach <bb@sernet.de>
4 years agosamba-tool: gpo manage sudoers handle missing and dispersed principal names
David Mulder [Tue, 9 Mar 2021 16:16:27 +0000 (09:16 -0700)] 
samba-tool: gpo manage sudoers handle missing and dispersed principal names

If we don't anticipate a missing principal name,
samba-tool crashes. Also, principal names could
be in dispersed listelements.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Björn Baumbach <bb@sernet.de>
4 years agosamba-tool: Ensure that gpo manage sudoers handles missing/dispersed principal names
David Mulder [Tue, 9 Mar 2021 21:14:24 +0000 (14:14 -0700)] 
samba-tool: Ensure that gpo manage sudoers handles missing/dispersed principal names

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Björn Baumbach <bb@sernet.de>
4 years agoUpdate status of SMB_VFS_SETXATTR
Noel Power [Mon, 1 Mar 2021 15:22:32 +0000 (15:22 +0000)] 
Update status of SMB_VFS_SETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 11 18:58:46 UTC 2021 on sn-devel-184

4 years agoVFS: Remove SMB_VFS_SETXATTR, no longer used
Noel Power [Fri, 19 Feb 2021 10:39:49 +0000 (10:39 +0000)] 
VFS: Remove SMB_VFS_SETXATTR, no longer used

                                   ---------------
                                  /               \
                                 /      REST       \
                                /        IN         \
                               /        PEACE        \
                              /                       \
                              |                       |
                              |   SMB_VFS_SETXATTR    |
                              |                       |
                              |                       |
                              |       19 February     |
                              |          2021         |
                              |                       |
                              |                       |
                             *|     *  *  *           | *
                    _________)/\\_//(\/(/\)/\//\/\////|_)_______

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Noel Power <noel.power@suse.com>
4 years agos3/modules: snapper: Add missing fsetxattr_fn impl
Noel Power [Wed, 10 Mar 2021 09:24:04 +0000 (09:24 +0000)] 
s3/modules: snapper: Add missing fsetxattr_fn impl

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/modules: shadow_copy2: Add new fsetxattr_fn implementation
Noel Power [Fri, 19 Feb 2021 15:03:01 +0000 (15:03 +0000)] 
s3/modules: shadow_copy2: Add new fsetxattr_fn implementation

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/modules: ceph_snapshots: Add missing fsetxattr_fn implementation
Noel Power [Fri, 19 Feb 2021 14:51:14 +0000 (14:51 +0000)] 
s3/modules: ceph_snapshots: Add missing fsetxattr_fn implementation

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos2/modules: nfs4acl_smb4acl_set_fn SMB_VFS_NEXT_SETXATTR -> SMB_VFS_NEXT_FFSETXATTR
Noel Power [Fri, 19 Feb 2021 14:47:07 +0000 (14:47 +0000)] 
s2/modules: nfs4acl_smb4acl_set_fn SMB_VFS_NEXT_SETXATTR -> SMB_VFS_NEXT_FFSETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/modules: fake_acls_lchown use SMB_VFS_NEXT_FSET
Noel Power [Fri, 19 Feb 2021 16:21:58 +0000 (16:21 +0000)] 
s3/modules: fake_acls_lchown use SMB_VFS_NEXT_FSET

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/modules: fake_acls: SMB_VFS_NEXT_SETXATTR -> SMB_VFS_NEXT_FSETXATTR
Noel Power [Fri, 19 Feb 2021 13:35:04 +0000 (13:35 +0000)] 
s3/modules: fake_acls: SMB_VFS_NEXT_SETXATTR -> SMB_VFS_NEXT_FSETXATTR

Ensure fake_acls_sys_acl_set_file gets properly setup smb_filename

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/lib: SMB_VFS_NEXT_SETXATTR -> SMB_VFS_NEXT_FSETXATTR
Noel Power [Fri, 19 Feb 2021 12:43:00 +0000 (12:43 +0000)] 
s3/lib: SMB_VFS_NEXT_SETXATTR -> SMB_VFS_NEXT_FSETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/torture: SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Noel Power [Fri, 19 Feb 2021 09:17:57 +0000 (09:17 +0000)] 
s3/torture: SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/modules: stream_dir make sure mark_file_valid is called with fsp
Noel Power [Thu, 18 Feb 2021 21:13:07 +0000 (21:13 +0000)] 
s3/modules: stream_dir make sure mark_file_valid is called with fsp

can we get this further up the call path ???

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/modules: streams_xattr_renameat SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Noel Power [Thu, 18 Feb 2021 20:18:46 +0000 (20:18 +0000)] 
s3/modules: streams_xattr_renameat SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/modules: streams_xattr: Fix fname passed to SETXATTR
Noel Power [Thu, 18 Feb 2021 19:34:15 +0000 (19:34 +0000)] 
s3/modules: streams_xattr: Fix fname passed to SETXATTR

we see to be overwritting the 'old' stream, this change fixes it

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/modules: streams_xattr_ftruncate SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Noel Power [Thu, 18 Feb 2021 18:56:56 +0000 (18:56 +0000)] 
s3/modules: streams_xattr_ftruncate SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/modules: streams_xattr_pwrite SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Noel Power [Thu, 18 Feb 2021 18:14:16 +0000 (18:14 +0000)] 
s3/modules: streams_xattr_pwrite SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agostreams_xattr_openat SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Noel Power [Thu, 18 Feb 2021 17:04:24 +0000 (17:04 +0000)] 
streams_xattr_openat SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/modules: vfs_acl_xattr SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Noel Power [Thu, 18 Feb 2021 14:46:54 +0000 (14:46 +0000)] 
s3/modules: vfs_acl_xattr SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/smbd: Detect and fail attempt to set_ea_dos_attribute on link
Noel Power [Wed, 10 Mar 2021 09:12:37 +0000 (09:12 +0000)] 
s3/smbd: Detect and fail attempt to set_ea_dos_attribute on link

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/smbd: SMB_VFS_SETXATTR => SMB_VFS_FSETXATTR
Noel Power [Wed, 17 Feb 2021 09:27:40 +0000 (09:27 +0000)] 
s3/smbd: SMB_VFS_SETXATTR => SMB_VFS_FSETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/smbd: set_create_timespec_ea should create smb_fname with valid fsp
Noel Power [Thu, 18 Feb 2021 10:54:23 +0000 (10:54 +0000)] 
s3/smbd: set_create_timespec_ea should create smb_fname with valid fsp

we need to call file_set_dosmode (which ends up calling
SMB_VFS_FSETXATTR via set_ea_dos_attribute) has smb_fname set up
with a valid smb_fname->fsp

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/smb3: ensure file_set_dosmode is passed valid smb_fname->fsp
Noel Power [Thu, 18 Feb 2021 11:05:34 +0000 (11:05 +0000)] 
s3/smb3: ensure file_set_dosmode is passed valid smb_fname->fsp

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/smb3: ensure file_set_dosmode is passed valid smb_fname->fsp
Noel Power [Thu, 18 Feb 2021 11:04:55 +0000 (11:04 +0000)] 
s3/smb3: ensure file_set_dosmode is passed valid smb_fname->fsp

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/smb3: ensure file_set_dosmode is passed valid smb_fname->fsp
Noel Power [Thu, 18 Feb 2021 11:01:10 +0000 (11:01 +0000)] 
s3/smb3: ensure file_set_dosmode is passed valid smb_fname->fsp

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>