amitay/samba.git
4 years agolibrpc: add clusapi_GroupSetControlCode enum
Günther Deschner [Thu, 16 Jan 2020 13:53:19 +0000 (14:53 +0100)]
librpc: add clusapi_GroupSetControlCode enum

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jan 16 21:34:27 UTC 2020 on sn-devel-184

4 years agos4-torture: increase various bufsizes to better deal with Windows 2019 clusters
Günther Deschner [Thu, 16 Jan 2020 13:38:56 +0000 (14:38 +0100)]
s4-torture: increase various bufsizes to better deal with Windows 2019 clusters

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4-torture: fix copy/paste error in clusapi group test
Günther Deschner [Thu, 16 Jan 2020 10:19:52 +0000 (11:19 +0100)]
s4-torture: fix copy/paste error in clusapi group test

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4-torture: add clusapi GroupSet tests
Günther Deschner [Mon, 13 Jan 2020 13:37:40 +0000 (14:37 +0100)]
s4-torture: add clusapi GroupSet tests

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4-torture: fix asserts in clusapi_NodeControl tests
Günther Deschner [Mon, 13 Jan 2020 17:30:14 +0000 (18:30 +0100)]
s4-torture: fix asserts in clusapi_NodeControl tests

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4-torture: save cluster version in clusapi test context
Günther Deschner [Mon, 13 Jan 2020 15:11:26 +0000 (16:11 +0100)]
s4-torture: save cluster version in clusapi test context

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibrpc: add various new clusapi functions and types
Günther Deschner [Fri, 10 Jan 2020 15:44:39 +0000 (16:44 +0100)]
librpc: add various new clusapi functions and types

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosamba-tool gpo: improve UNC parsing
Douglas Bagnall [Thu, 16 Jan 2020 01:12:02 +0000 (14:12 +1300)]
samba-tool gpo: improve UNC parsing

The "UNC doesn't start with \\\\ or //" message was unreachable due to
a logic error, and an UNC starting with \\ would have been split on
/ if there were enough /s in the string.

The unreachable exception was first noticed by Gerhard Lausser in a
github pull request (https://github.com/samba-team/samba/pull/123),
but that patch no longer applies with this more thorough rewrite.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture: Test smbcontrol close-denied-share
Volker Lendecke [Tue, 14 Jan 2020 12:13:17 +0000 (13:13 +0100)]
torture: Test smbcontrol close-denied-share

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): Wed Jan 15 22:51:14 UTC 2020 on sn-devel-184

4 years agosmbd: Add close-denied-share message
Volker Lendecke [Mon, 13 Jan 2020 14:19:58 +0000 (15:19 +0100)]
smbd: Add close-denied-share message

This is like close-share, but kicks out only active users where share
access controls are changed such that now access would be denied

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Move sharename check of conn_force_tdis() into a callback
Volker Lendecke [Mon, 13 Jan 2020 14:37:25 +0000 (15:37 +0100)]
smbd: Move sharename check of conn_force_tdis() into a callback

Next commit will have an additional check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotexpect: Avoid duplicate sys_write()
Volker Lendecke [Wed, 15 Jan 2020 11:40:38 +0000 (12:40 +0100)]
texpect: Avoid duplicate sys_write()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotexpect: Reformat long line
Volker Lendecke [Wed, 15 Jan 2020 11:37:59 +0000 (12:37 +0100)]
texpect: Reformat long line

There will be more deps soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotexpect: Use lib/replace's closefrom()
Volker Lendecke [Wed, 15 Jan 2020 11:37:22 +0000 (12:37 +0100)]
texpect: Use lib/replace's closefrom()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:libsmb: Fix querying all names registered within broadcast area
Samuel Cabrero [Tue, 14 Jan 2020 16:12:33 +0000 (17:12 +0100)]
s3:libsmb: Fix querying all names registered within broadcast area

Wait for additional replies until timeout when '*' is given to nmblookup
as name.

Introduced by 8da8c36b53cc115f0d446b666fc24fc9423d808e.

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

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agofuzz: add nmblib/parse_packet target
Douglas Bagnall [Fri, 10 Jan 2020 02:44:27 +0000 (15:44 +1300)]
fuzz: add nmblib/parse_packet target

We want to ensure that parse_packet() can parse a packet without
crashing, and that that parsed packet won't cause trouble further down
the line.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Wed Jan 15 21:24:31 UTC 2020 on sn-devel-184

4 years agofuzz: ldb binary decode/enode
Douglas Bagnall [Fri, 10 Jan 2020 04:33:03 +0000 (17:33 +1300)]
fuzz: ldb binary decode/enode

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agofuzz: add ldb ldif fuzzer
Douglas Bagnall [Thu, 9 Jan 2020 23:35:54 +0000 (12:35 +1300)]
fuzz: add ldb ldif fuzzer

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agofuzz: ldb_dn parsing
Douglas Bagnall [Thu, 9 Jan 2020 23:35:30 +0000 (12:35 +1300)]
fuzz: ldb_dn parsing

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agolib ldb common: Fix memory leak
Gary Lockyer [Tue, 14 Jan 2020 01:42:26 +0000 (14:42 +1300)]
lib ldb common: Fix memory leak

TALLOC_FREE the ldb_control allocated in ldb_parse_control_from_string
when none of the cases match.

Credit to OSS-Fuzz

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: David Disseldorp <ddiss@samba.org>
4 years agotests: Test samba-tool user setprimarygroup command
Björn Baumbach [Tue, 14 Jan 2020 14:19:40 +0000 (15:19 +0100)]
tests: Test samba-tool user setprimarygroup command

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Jan 15 13:30:53 UTC 2020 on sn-devel-184

4 years agotests: Test samba-tool user getgroups command
Björn Baumbach [Tue, 14 Jan 2020 14:10:09 +0000 (15:10 +0100)]
tests: Test samba-tool user getgroups command

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoselftest: create working directory for blackbox test
Björn Baumbach [Wed, 18 Dec 2019 10:56:03 +0000 (11:56 +0100)]
selftest: create working directory for blackbox test

Required to run test separately.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agosamba-tool: implement user getgroups command
Stefan Metzmacher [Wed, 16 May 2018 11:00:16 +0000 (13:00 +0200)]
samba-tool: implement user getgroups command

samba-tool user getgroups command to list a users group memberships.

Pair-programmed-with: Björn Baumbach <bb@sernet.de>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agosamba-tool: implement user setprimary group command (set primaryGroupID)
Björn Baumbach [Wed, 16 May 2018 08:19:16 +0000 (10:19 +0200)]
samba-tool: implement user setprimary group command (set primaryGroupID)

Introduce an option to set the primaryGroupID attribute of a user account.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoclitar: use modern DBG macros
Björn Jacke [Mon, 13 Jan 2020 15:43:21 +0000 (16:43 +0100)]
clitar: use modern DBG macros

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan 14 20:42:10 UTC 2020 on sn-devel-184

4 years agosmbtar: adopt for new tar verbose option
Björn Jacke [Tue, 7 Jan 2020 11:04:49 +0000 (12:04 +0100)]
smbtar: adopt for new tar verbose option

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbclient/tar: add verbose mode
Björn Jacke [Sat, 4 Jan 2020 20:47:59 +0000 (21:47 +0100)]
smbclient/tar: add verbose mode

A verbose mode got lost with the introduction of libarchive support.

The verbose mode is optional, default is quiet mode.

The output format is close to the verbose output format of POSIX tar
implementations and should be good parsable.

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Protect against non-string "close-share" sharenames
Volker Lendecke [Mon, 13 Jan 2020 14:23:45 +0000 (15:23 +0100)]
smbd: Protect against non-string "close-share" sharenames

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotest3: Fix usage check for test_sharesec.sh
Volker Lendecke [Tue, 14 Jan 2020 12:10:05 +0000 (13:10 +0100)]
test3: Fix usage check for test_sharesec.sh

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Avoid an unnecessary include
Volker Lendecke [Tue, 14 Jan 2020 12:05:00 +0000 (13:05 +0100)]
lib: Avoid an unnecessary include

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Remove "msg_ctx" from server_id_watch_send()
Volker Lendecke [Tue, 14 Jan 2020 12:03:45 +0000 (13:03 +0100)]
lib: Remove "msg_ctx" from server_id_watch_send()

Not needed

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Use tevent version of timeval_current_ofs()
Volker Lendecke [Tue, 14 Jan 2020 12:02:27 +0000 (13:02 +0100)]
lib: Use tevent version of timeval_current_ofs()

We have tevent available anyway, use that infrastructure

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agonfs4acl: Align integer types
Volker Lendecke [Tue, 14 Jan 2020 10:21:01 +0000 (11:21 +0100)]
nfs4acl: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agodocs-xml: 'mangled names = illegal' is the new default
Andreas Schneider [Tue, 14 Jan 2020 13:36:52 +0000 (14:36 +0100)]
docs-xml: 'mangled names = illegal' is the new default

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jan 14 15:18:02 UTC 2020 on sn-devel-184

4 years agotests/DNS: add MX/SRV record tests with multiple spaces
Björn Jacke [Mon, 13 Jan 2020 12:02:29 +0000 (13:02 +0100)]
tests/DNS: add MX/SRV record tests with multiple spaces

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Björn Baumbach <bb@samba.org>
Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Tue Jan 14 11:58:20 UTC 2020 on sn-devel-184

4 years agosamba-tool: fix adding of dns SRV/MX/SOA records
Björn Jacke [Sun, 12 Jan 2020 23:21:41 +0000 (00:21 +0100)]
samba-tool: fix adding of dns SRV/MX/SOA records

Thanks to Denis Cardon for finding

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Björn Baumbach <bb@samba.org>
4 years agotests/DNS: \n.COM shouldn't be a valid DNS record
Björn Jacke [Mon, 13 Jan 2020 11:49:42 +0000 (12:49 +0100)]
tests/DNS: \n.COM shouldn't be a valid DNS record

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

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Björn Baumbach <bb@samba.org>
4 years agonet_ads_gpo: remove old '#if 0' blocks
Douglas Bagnall [Fri, 10 Jan 2020 03:06:33 +0000 (16:06 +1300)]
net_ads_gpo: remove old '#if 0' blocks

I think the dump_gpo() calls do enough, and this code has done nothing
for a decade.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Mon Jan 13 23:52:26 UTC 2020 on sn-devel-184

4 years agolibgpo: parse_gp_ext: do not crash upon no ext_strings
Douglas Bagnall [Fri, 10 Jan 2020 02:45:45 +0000 (15:45 +1300)]
libgpo: parse_gp_ext: do not crash upon no ext_strings

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agosmbd: RIP user_struct
Ralph Boehme [Mon, 6 Jan 2020 09:14:11 +0000 (10:14 +0100)]
smbd: RIP user_struct

At last, the nail in the coffin. :)

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): Mon Jan 13 21:09:01 UTC 2020 on sn-devel-184

4 years agosmbd: use smbXsrv_session_info_lookup() in become_user_without_service()
Ralph Boehme [Thu, 2 Jan 2020 16:24:47 +0000 (17:24 +0100)]
smbd: use smbXsrv_session_info_lookup() in become_user_without_service()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove using vuser from smbd_smb2_tree_connect()
Ralph Boehme [Thu, 2 Jan 2020 16:21:06 +0000 (17:21 +0100)]
smbd: remove using vuser from smbd_smb2_tree_connect()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: don't use vuser in make_connection()
Ralph Boehme [Thu, 2 Jan 2020 16:16:38 +0000 (17:16 +0100)]
smbd: don't use vuser in make_connection()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove unused vuser arg from make_connection_smb2()
Ralph Boehme [Thu, 2 Jan 2020 16:09:26 +0000 (17:09 +0100)]
smbd: remove unused vuser arg from make_connection_smb2()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove unused vuser arg from make_connection_smb1()
Ralph Boehme [Thu, 2 Jan 2020 16:07:23 +0000 (17:07 +0100)]
smbd: remove unused vuser arg from make_connection_smb1()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use req->session instead of vuser->session in make_connection_smb1()
Ralph Boehme [Thu, 2 Jan 2020 16:06:23 +0000 (17:06 +0100)]
smbd: use req->session instead of vuser->session in make_connection_smb1()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove use of user_struct from reply_ulogoffX()
Ralph Boehme [Thu, 2 Jan 2020 15:26:03 +0000 (16:26 +0100)]
smbd: remove use of user_struct from reply_ulogoffX()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use smbXsrv_session_local_traverse() in id_in_use()
Ralph Boehme [Thu, 2 Jan 2020 13:47:51 +0000 (14:47 +0100)]
smbd: use smbXsrv_session_local_traverse() in id_in_use()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add smbXsrv_session_local_traverse()
Ralph Boehme [Thu, 2 Jan 2020 10:42:05 +0000 (11:42 +0100)]
smbd: add smbXsrv_session_local_traverse()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove enum server_allocated_state magic from get_valid_user_struct()
Ralph Boehme [Mon, 6 Jan 2020 09:12:32 +0000 (10:12 +0100)]
smbd: remove enum server_allocated_state magic from get_valid_user_struct()

This has been obsoleted a long time ago by
a129e271b5385853fb39a8e54b56b508b00a3e41.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use get_valid_smbXsrv_session() in invalidate_vuid()
Ralph Boehme [Mon, 6 Jan 2020 07:20:14 +0000 (08:20 +0100)]
smbd: use get_valid_smbXsrv_session() in invalidate_vuid()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add get_valid_smbXsrv_session()
Ralph Boehme [Mon, 6 Jan 2020 07:19:18 +0000 (08:19 +0100)]
smbd: add get_valid_smbXsrv_session()

In memory of get_valid_user_struct() and functionally equivalent it only returns
the session if session setup was successfully completed and
session->global->auth_session_info is valid.

This function is similar to smbXsrv_session_local_lookup() and it's wrappers,
but it doesn't implement the state checks of those. get_valid_smbXsrv_session()
is NOT meant to be called to validate the session wire-id of incoming SMB
requests, it MUST only be used in later internal processing where the session
wire-id has already been validated.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use session->global->auth_session_info in switch_message()
Ralph Boehme [Thu, 2 Jan 2020 07:07:31 +0000 (08:07 +0100)]
smbd: use session->global->auth_session_info in switch_message()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove dependency on session->compat in smbXsrv_session_logoff()
Ralph Boehme [Wed, 1 Jan 2020 17:38:59 +0000 (18:38 +0100)]
smbd: remove dependency on session->compat in smbXsrv_session_logoff()

This is not needed anymore because a previous commit changes this to use
session->global->session_wire_id insteaf of session->compat->vuid, so we're not
depending on session->compat anymore.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use smbXsrv_session_info_lookup() in api_reply()
Ralph Boehme [Wed, 1 Jan 2020 14:20:05 +0000 (15:20 +0100)]
smbd: use smbXsrv_session_info_lookup() in api_reply()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use smbXsrv_session_info_lookup() in api_WWkstaUserLogon()
Ralph Boehme [Wed, 1 Jan 2020 11:15:29 +0000 (12:15 +0100)]
smbd: use smbXsrv_session_info_lookup() in api_WWkstaUserLogon()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: share level security is long gone...
Ralph Boehme [Wed, 1 Jan 2020 08:47:38 +0000 (09:47 +0100)]
smbd: share level security is long gone...

vuid will always be valid as will be vuser.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use smbXsrv_session_info_lookup() in change_to_user_and_service()
Ralph Boehme [Wed, 1 Jan 2020 00:06:45 +0000 (01:06 +0100)]
smbd: use smbXsrv_session_info_lookup() in change_to_user_and_service()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: introduce smbXsrv_session_info_lookup()
Ralph Boehme [Wed, 1 Jan 2020 00:06:24 +0000 (01:06 +0100)]
smbd: introduce smbXsrv_session_info_lookup()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove vuser arg from make_connection_snum()
Ralph Boehme [Mon, 30 Dec 2019 09:28:25 +0000 (10:28 +0100)]
smbd: remove vuser arg from make_connection_snum()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use session->global->auth_session_info in make_connection_snum()
Ralph Boehme [Mon, 30 Dec 2019 09:26:26 +0000 (10:26 +0100)]
smbd: use session->global->auth_session_info in make_connection_snum()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: remove vuid from struct user_struct
Ralph Boehme [Sun, 29 Dec 2019 13:33:00 +0000 (14:33 +0100)]
smbd: remove vuid from struct user_struct

The previous commit removed all users of struct user_struct.vuid.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use session->global->session_wire_id instead of session->compat->vuid
Ralph Boehme [Sun, 29 Dec 2019 13:33:00 +0000 (14:33 +0100)]
smbd: use session->global->session_wire_id instead of session->compat->vuid

session->compat->vuid is set to session->global->session_wire_id after a
successful session setup, so both variables will always carry the same value. Cf
the next commit which removes vuid from user_struct.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: pass smbXsrv_session to make_connection_snum()
Ralph Boehme [Sun, 29 Dec 2019 13:34:42 +0000 (14:34 +0100)]
smbd: pass smbXsrv_session to make_connection_snum()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: move homes_snum from struct user_struct to struct smbXsrv_session
Ralph Boehme [Sun, 29 Dec 2019 07:31:45 +0000 (08:31 +0100)]
smbd: move homes_snum from struct user_struct to struct smbXsrv_session

No change in behaviour. A first step in removing user_struct.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add session to struct smb_request
Ralph Boehme [Sun, 29 Dec 2019 07:30:22 +0000 (08:30 +0100)]
smbd: add session to struct smb_request

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: lib: dbwrap. Cleanup. Add a couple of missing 'return NULL' statements on talloc...
Jeremy Allison [Fri, 10 Jan 2020 23:55:29 +0000 (15:55 -0800)]
s3: lib: dbwrap. Cleanup. Add a couple of missing 'return NULL' statements on talloc fail.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: lib: dbwrap_ctdb: Ensure value_valid is set true if we find the record in the...
Jeremy Allison [Fri, 10 Jan 2020 23:52:31 +0000 (15:52 -0800)]
s3: lib: dbwrap_ctdb: Ensure value_valid is set true if we find the record in the marshall buffer.

Found by "Christopher O Cowan - Christopher.O.Cowan@ibm.com" <Christopher.O.Cowan@ibm.com>

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3-rpcserver: fix security level check for DsRGetForestTrustInformation
Alexander Bokovoy [Tue, 7 Jan 2020 17:25:53 +0000 (19:25 +0200)]
s3-rpcserver: fix security level check for DsRGetForestTrustInformation

Harmonize _netr_DsRGetForestTrustInformation with source4/ logic which
didn't change since DCE RPC channel refactoring.

With the current code we return RPC faul as can be seen in the logs:

2019/12/11 17:12:55.463081,  1, pid=20939, effective(12842000001284200000), real(1284200000, 0), class=rpc_parse] ../librpc/ndr/ndr.c:471(ndr_print_function_debug)
       netr_DsRGetForestTrustInformation: struct netr_DsRGetForestTrustInformation
          in: struct netr_DsRGetForestTrustInformation
              server_name              : *
                  server_name              : '\\some-dc.example.com'
              trusted_domain_name      : NULL
              flags                    : 0x00000000 (0)
[2019/12/11 17:12:55.463122,  4, pid=20939, effective(12842000001284200000), real(1284200000, 0), class=rpc_srv] ../source3/rpc_server/srv_pipe.c:1561(api_rpcTNP)
  api_rpcTNP: fault(5) return.

This is due to this check in processing a request:
        if (!(p->pipe_bound && (p->auth.auth_type != DCERPC_AUTH_TYPE_NONE)
                       && (p->auth.auth_level != DCERPC_AUTH_LEVEL_NONE))) {
                p->fault_state = DCERPC_FAULT_ACCESS_DENIED;
                return WERR_ACCESS_DENIED;
        }

and since we get AuthZ response,

  Successful AuthZ: [netlogon,ncacn_np] user [EXAMPLE]\[admin] [S-1-5-21-1234567-890123456-500] at [Wed, 11 Dec 2019 17:12:55.461164 UTC]
  Remote host [ipv4:Y.Y.Y.Y:59017] local host [ipv4:X.X.X.X:445]
[2019/12/11 17:12:55.461584,  4, pid=20939, effective(0, 0), real(0, 0)] ../lib/audit_logging/audit_logging.c:141(audit_log_json)
  JSON Authorization: {"timestamp": "2019-12-11T17:12:55.461491+0000",
   "type": "Authorization", "Authorization": {"version": {"major": 1, "minor": 1},
   "localAddress": "ipv4:X.X.X.X:445", "remoteAddress": "ipv4:Y.Y.Y.Y:59017",
   "serviceDescription": "netlogon", "authType": "ncacn_np",
   "domain": "EXAMPLE", "account": "admin", "sid": "S-1-5-21-1234567-890123456-500",
   "sessionId": "c5a2386f-f2cc-4241-9a9e-d104cf5859d5", "logonServer": "SOME-DC",
   "transportProtection": "SMB", "accountFlags": "0x00000010"}}

this means we are actually getting anonymous DCE/RPC access to netlogon
on top of authenticated SMB connection. In such case we have exactly
auth_type set to DCERPC_AUTH_TYPE_NONE and auth_level set to
DCERPC_AUTH_LEVEL_NONE in the pipe->auth. Thus, returning an error.

Update the code to follow the same security level check as in s4 variant
of the call.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Mon Jan 13 15:05:28 UTC 2020 on sn-devel-184

4 years agofuzz: add a fuzzer for parsing ldb controls
Douglas Bagnall [Thu, 9 Jan 2020 04:40:02 +0000 (17:40 +1300)]
fuzz: add a fuzzer for parsing ldb controls

We have had issues here in the past.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sun Jan 12 21:21:30 UTC 2020 on sn-devel-184

4 years agoldb controls: fix typo in bypassoperational message
Douglas Bagnall [Thu, 9 Jan 2020 06:19:56 +0000 (19:19 +1300)]
ldb controls: fix typo in bypassoperational message

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agofuzz_ldap_decode: do not print to stdout
Douglas Bagnall [Thu, 9 Jan 2020 04:01:22 +0000 (17:01 +1300)]
fuzz_ldap_decode: do not print to stdout

The fuzzer doesn't care and it slows things down

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodecode_ndr_X_crash: always find pipe in honggfuzz file
Douglas Bagnall [Thu, 12 Dec 2019 23:08:47 +0000 (12:08 +1300)]
decode_ndr_X_crash: always find pipe in honggfuzz file

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agovfs_ceph: drop support for pre-hammer libcephfs versions
David Disseldorp [Thu, 9 Jan 2020 15:01:22 +0000 (16:01 +0100)]
vfs_ceph: drop support for pre-hammer libcephfs versions

The last Ceph Hammer release (0.94.10) came in Feb 2017, as is no longer
supported upstream. Drop support for building Samba vfs_ceph against
version prior to 0.94.0.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Sat Jan 11 14:59:36 UTC 2020 on sn-devel-184

4 years agovfs_ceph: drop support for building without statx
David Disseldorp [Thu, 9 Jan 2020 16:11:39 +0000 (17:11 +0100)]
vfs_ceph: drop support for building without statx

libcephfs statx became available with the Kraken (11.2.0) release of
Ceph in Jan 2017. Versions prior to this are no longer supported
upstream, so we can drop support within Samba vfs_ceph.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
4 years agos3: smbd: msdfs: Change create_msdfs_link() to call SMB_VFS_CREATE_DFS_PATHAT().
Jeremy Allison [Thu, 9 Jan 2020 22:21:46 +0000 (14:21 -0800)]
s3: smbd: msdfs: Change create_msdfs_link() to call SMB_VFS_CREATE_DFS_PATHAT().

No change in the (rather strange) logic.

First step in abstracting MSDFS storage from direct symlink calls.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 10 21:05:25 UTC 2020 on sn-devel-184

4 years agos3: VFS: Implement create_dfs_pathat() in time_audit.
Jeremy Allison [Thu, 9 Jan 2020 21:36:08 +0000 (13:36 -0800)]
s3: VFS: Implement create_dfs_pathat() in time_audit.

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: Implement create_dfs_pathat() in full_audit.
Jeremy Allison [Thu, 9 Jan 2020 21:33:23 +0000 (13:33 -0800)]
s3: VFS: Implement create_dfs_pathat() in full_audit.

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: Implement create_dfs_pathat() in snapper.
Jeremy Allison [Thu, 9 Jan 2020 21:13:29 +0000 (13:13 -0800)]
s3: VFS: Implement create_dfs_pathat() in snapper.

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: Implement create_dfs_pathat() in shadow_copy2.
Jeremy Allison [Thu, 9 Jan 2020 21:06:36 +0000 (13:06 -0800)]
s3: VFS: Implement create_dfs_pathat() in shadow_copy2.

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: Implement create_dfs_pathat() in gluster.
Jeremy Allison [Thu, 9 Jan 2020 22:48:33 +0000 (14:48 -0800)]
s3: VFS: Implement create_dfs_pathat() in gluster.

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: Implement create_dfs_pathat() in ceph.
Jeremy Allison [Thu, 9 Jan 2020 22:39:43 +0000 (14:39 -0800)]
s3: VFS: Implement create_dfs_pathat() in ceph.

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: VFS: Add SMB_VFS_CREATE_DFS_PATHAT().
Jeremy Allison [Thu, 9 Jan 2020 18:13:14 +0000 (10:13 -0800)]
s3: VFS: Add SMB_VFS_CREATE_DFS_PATHAT().

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agondr basic: Check ndr_token_store return code
Gary Lockyer [Tue, 7 Jan 2020 20:39:30 +0000 (09:39 +1300)]
ndr basic: Check ndr_token_store return code

Fix for

*** CID 1457529:  Error handling issues  (CHECKED_RETURN)
/librpc/ndr/ndr_basic.c: 786 in ndr_push_full_ptr()
...
ID 1457529:  Error handling issues  (CHECKED_RETURN)
    Calling "ndr_token_store" without checking return value (as is done
    elsewhere 14 out of 17 times).

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Thu Jan  9 21:49:00 UTC 2020 on sn-devel-184

4 years agovfs_ceph: assert renameat() fsps match cwd
David Disseldorp [Thu, 9 Jan 2020 17:20:39 +0000 (18:20 +0100)]
vfs_ceph: assert renameat() fsps match cwd

As discussed with Jeremy in bug 14232, the vfs_ceph.renameat_fn
implementation currently ignores srcfsp and dstfsp. As a result,
relative smb_fname_src/smb_fname_dest paths will be processed as
relative to cwd.
This is currently a valid assumption, as srcfsp and dstfsp should
always match conn->cwd_fsp. Add an assert to clarify this.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jan  9 20:20:05 UTC 2020 on sn-devel-184

4 years agontlm_auth: Add type-safety instead of a simple cast
Volker Lendecke [Sun, 5 Jan 2020 13:11:54 +0000 (14:11 +0100)]
ntlm_auth: Add type-safety instead of a simple cast

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agontlm_auth: Add a NULL check
Volker Lendecke [Sun, 5 Jan 2020 13:11:20 +0000 (14:11 +0100)]
ntlm_auth: Add a NULL check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoprinting: Avoid EBADF from EPOLL_CTL_DEL
Volker Lendecke [Thu, 9 Jan 2020 13:43:02 +0000 (14:43 +0100)]
printing: Avoid EBADF from EPOLL_CTL_DEL

TALLOC_FREE the fde before closing the fd. Otherwise the fde
destructor tries to remove a nonexisting fd from the epoll set.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoprinting: Align integer types
Volker Lendecke [Thu, 9 Jan 2020 13:42:43 +0000 (14:42 +0100)]
printing: Align integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3-rpcclient: add clusapi_resume_node command.
Günther Deschner [Mon, 9 May 2016 10:10:22 +0000 (12:10 +0200)]
s3-rpcclient: add clusapi_resume_node command.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jan  9 01:15:34 UTC 2020 on sn-devel-184

4 years agos3-rpcclient: add clusapi_pause_node command.
Günther Deschner [Mon, 9 May 2016 10:07:47 +0000 (12:07 +0200)]
s3-rpcclient: add clusapi_pause_node command.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3-rpcclient: give slightly better descriptions to clusapi commands
Günther Deschner [Wed, 8 Jan 2020 16:25:13 +0000 (17:25 +0100)]
s3-rpcclient: give slightly better descriptions to clusapi commands

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibrpc: pidlify spoolss_EnumPerMachineConnections
Günther Deschner [Mon, 23 Dec 2019 15:53:37 +0000 (16:53 +0100)]
librpc: pidlify spoolss_EnumPerMachineConnections

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibrpc/ndr: provide infrastructure for NDR_SPOOLSS_{PUSH|PULL}_ENUM macros
Günther Deschner [Tue, 7 Jan 2020 13:58:15 +0000 (14:58 +0100)]
librpc/ndr: provide infrastructure for NDR_SPOOLSS_{PUSH|PULL}_ENUM macros

The new macros allow the same macro convenience for enum functions without
level discriminator.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibrpc: better naming for NDR_SPOOLSS_{PUSH|PULL}_ENUM variants
Günther Deschner [Mon, 23 Dec 2019 15:50:28 +0000 (16:50 +0100)]
librpc: better naming for NDR_SPOOLSS_{PUSH|PULL}_ENUM variants

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4-torture: add test for spoolss_EnumPerMachineConnections
Günther Deschner [Fri, 20 Dec 2019 12:43:25 +0000 (13:43 +0100)]
s4-torture: add test for spoolss_EnumPerMachineConnections

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4-torture: add test for spoolss AddPerMachineConnection
Günther Deschner [Sun, 22 Sep 2019 01:34:56 +0000 (03:34 +0200)]
s4-torture: add test for spoolss AddPerMachineConnection

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3-rpcclient: add delpermachineconnection command
Günther Deschner [Sun, 22 Sep 2019 01:34:27 +0000 (03:34 +0200)]
s3-rpcclient: add delpermachineconnection command

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3-rpcclient: add addpermachineconnection command
Günther Deschner [Mon, 23 Dec 2019 11:42:53 +0000 (12:42 +0100)]
s3-rpcclient: add addpermachineconnection command

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>