]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
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>
4 years agos3/modules: ensure catia_set_dos_attributes passes on pathref
Noel Power [Wed, 17 Feb 2021 09:34:40 +0000 (09:34 +0000)] 
s3/modules: ensure catia_set_dos_attributes passes on pathref

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3/smbd: posix_acls SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Noel Power [Tue, 16 Feb 2021 20:25:31 +0000 (20:25 +0000)] 
s3/smbd: posix_acls 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: posixacl convert from SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
Noel Power [Tue, 16 Feb 2021 19:55:23 +0000 (19:55 +0000)] 
s3/modules: posixacl convert from 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/lib: adouble SMB_VFS_SETXATTR => SMB_VFS_FSETXATTR
Noel Power [Tue, 16 Feb 2021 19:25:59 +0000 (19:25 +0000)] 
s3/lib: adouble 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_ea SMB_VFS_FSETXATTR => SMB_VFS_FSETXATTR
Noel Power [Tue, 16 Feb 2021 18:49:19 +0000 (18:49 +0000)] 
s3/smbd: set_ea SMB_VFS_FSETXATTR => SMB_VFS_FSETXATTR

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoidmap_nss: Do not return SID from unixids_to_sids on type mismatch
Christof Schmitt [Fri, 5 Mar 2021 23:07:54 +0000 (16:07 -0700)] 
idmap_nss: Do not return SID from unixids_to_sids on type mismatch

The call to winbind_lookup_name already wrote the result in the id_map
array. The later check for the type detected a mismatch, but that did
not remove the SID from the result struct.

Change this by first assigning the SID to a temporary variable and only
write it to the id_map array after the type checks.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Mar 11 08:38:41 UTC 2021 on sn-devel-184

4 years agoidmap_rfc2307: Do not return SID from unixids_to_sids on type mismatch
Christof Schmitt [Fri, 5 Mar 2021 23:01:13 +0000 (16:01 -0700)] 
idmap_rfc2307: Do not return SID from unixids_to_sids on type mismatch

The call to winbind_lookup_name already wrote the result in the id_map
array. The later check for the type detected a mismatch, but that did
not remove the SID from the result struct.

Change this by first assigning the SID to a temporary variable and only
write it to the id_map array after the type checks.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
4 years agowinbind: Only use unixid2sid mapping when module reports ID_MAPPED
Christof Schmitt [Fri, 5 Mar 2021 22:48:29 +0000 (15:48 -0700)] 
winbind: Only use unixid2sid mapping when module reports ID_MAPPED

Only consider a mapping to be valid when the idmap module reports
ID_MAPPED. Otherwise return the null SID.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agosmbd: Ensure errno is preserved across fsp destructor
Sachin Prabhu [Wed, 10 Mar 2021 12:22:07 +0000 (12:22 +0000)] 
smbd: Ensure errno is preserved across fsp destructor

The errno can be overwritten by the calls made by the fsp destructor.
This can cause problems if the original errno was required by subsequent
calls.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar 10 22:55:17 UTC 2021 on sn-devel-184

4 years agopython: Disable calls to _dsdb_garbage_collect_tombstones without addc
David Mulder [Thu, 3 Dec 2020 17:32:09 +0000 (17:32 +0000)] 
python: Disable calls to _dsdb_garbage_collect_tombstones without addc

dsdb._dsdb_garbage_collect_tombstones isn't
built without the addc, so ignore calls to it
in samdb.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool: Enable pydns without ad dc
David Mulder [Thu, 17 Sep 2020 19:27:41 +0000 (13:27 -0600)] 
samba-tool: Enable pydns without ad dc

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool: Enable pydsdb without ad dc
David Mulder [Thu, 17 Sep 2020 19:27:14 +0000 (13:27 -0600)] 
samba-tool: Enable pydsdb without ad dc

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agopython: Test samdb import
David Mulder [Mon, 7 Dec 2020 14:39:00 +0000 (07:39 -0700)] 
python: Test samdb import

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb: dn tests use cmocka print functions
Douglas Bagnall [Fri, 5 Mar 2021 02:49:56 +0000 (15:49 +1300)] 
ldb: dn tests use cmocka print functions

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar 10 09:51:25 UTC 2021 on sn-devel-184

4 years agoldb_match: remove redundant check
Douglas Bagnall [Wed, 3 Mar 2021 06:54:37 +0000 (19:54 +1300)] 
ldb_match: remove redundant check

We already ensure the no-trailing-asterisk case ends at the end of the
string.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb: add tests for ldb_wildcard_compare
Douglas Bagnall [Fri, 5 Mar 2021 02:47:56 +0000 (15:47 +1300)] 
ldb: add tests for ldb_wildcard_compare

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoldb_match: trailing chunk must match end of string
Douglas Bagnall [Wed, 3 Mar 2021 06:17:36 +0000 (19:17 +1300)] 
ldb_match: trailing chunk must match end of string

A wildcard search is divided into chunks by the asterisks. While most
chunks match the first suitable string, the last chunk matches the
last possible string (unless there is a trailing asterisk, in which
case this distinction is moot).

We always knew this in our hearts, but we tried to do it in a funny
complicated way that stepped through the string, comparing here and
there, leading to CVE-2019-3824 and missed matches (bug 14044).

With this patch, we just jump to the end of the string and compare it.
As well as being correct, this should also improve performance, as the
previous algorithm involved a quadratic loop of erroneous memmem()s.

See https://tools.ietf.org/html/rfc4517

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib/util: Replace buggy string_sub_talloc() with talloc_string_sub() in lib/util
Andrew Bartlett [Wed, 10 Mar 2021 03:16:42 +0000 (16:16 +1300)] 
lib/util: Replace buggy string_sub_talloc() with talloc_string_sub() in lib/util

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Mar 10 08:06:25 UTC 2021 on sn-devel-184

4 years agolib/param: Remove lpcfg_volume_label() and only caller in NTVFS file server
Andrew Bartlett [Wed, 10 Mar 2021 02:59:10 +0000 (15:59 +1300)] 
lib/param: Remove lpcfg_volume_label() and only caller in NTVFS file server

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agolib/param: Remove unused functions in lib/param/loadparm.c
Andrew Bartlett [Wed, 10 Mar 2021 02:31:05 +0000 (15:31 +1300)] 
lib/param: Remove unused functions in lib/param/loadparm.c

The lib/param code does not service smbd, no home directories nor printers are handled
in this codebase and these functions are uncalled.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agowinbindd: Apply some const to normalize_name_map()
Volker Lendecke [Tue, 23 Feb 2021 15:27:44 +0000 (16:27 +0100)] 
winbindd: Apply some const to normalize_name_map()

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 Mar  9 23:45:51 UTC 2021 on sn-devel-184

4 years agosmbd: Fix a DEBUG message
Volker Lendecke [Fri, 5 Mar 2021 10:36:20 +0000 (11:36 +0100)] 
smbd: Fix a DEBUG message

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosrvsrvc: Reload conf after changing a share
Volker Lendecke [Tue, 9 Mar 2021 07:50:26 +0000 (08:50 +0100)] 
srvsrvc: Reload conf after changing a share

The call to messaging_send_all() skips ourselves. This is tested in
source3/script/tests/test_rpcclientsrvsvc.sh, which right now we only
survive because the rpcclient call spawns a new smbd, which reloads
smb.conf. Once you start running srvsvcd in a long-running daemon,
this fails.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Fix file_ploadv_send/recv cleanup
Volker Lendecke [Sat, 13 Feb 2021 10:40:34 +0000 (11:40 +0100)] 
lib: Fix file_ploadv_send/recv cleanup

We have to first TALLOC_FREE() the waiting event before closing the
pipe. Otherwise EPOLL_CTL_DEL is unhappy and might remove an unrelated
file descriptor.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agog_lock: Add extensive debug information
Volker Lendecke [Thu, 4 Feb 2021 17:46:59 +0000 (18:46 +0100)] 
g_lock: Add extensive debug information

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibrpc: Simplify struct dcesrv_handle
Volker Lendecke [Wed, 27 Jan 2021 13:59:16 +0000 (14:59 +0100)] 
librpc: Simplify struct dcesrv_handle

This saves a tiny bit of memory: dom_sid_dup() allocates a full struct
dom_sid, although it might not have to. Save the additional talloc
object and the pointer, be more cache-friendly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli: Simplify tstream_npa_connect_readv_done()
Volker Lendecke [Tue, 16 Feb 2021 16:21:57 +0000 (17:21 +0100)] 
libcli: Simplify tstream_npa_connect_readv_done()

tevent_req_error takes care of the ==0 case

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli: Add a NULL check to tstream_npa
Volker Lendecke [Tue, 16 Feb 2021 16:21:33 +0000 (17:21 +0100)] 
libcli: Add a NULL check to tstream_npa

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Fix samba_sockaddr_[get|set]_port
Volker Lendecke [Sat, 13 Feb 2021 10:16:17 +0000 (11:16 +0100)] 
lib: Fix samba_sockaddr_[get|set]_port

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Protect "messaging_dgm_init()" from NULL dirs
Volker Lendecke [Sat, 6 Mar 2021 14:49:46 +0000 (15:49 +0100)] 
lib: Protect "messaging_dgm_init()" from NULL dirs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Use any_nt_status_not_ok() in srv_netlog_nt.c
Volker Lendecke [Wed, 24 Feb 2021 15:01:27 +0000 (16:01 +0100)] 
rpc_server: Use any_nt_status_not_ok() in srv_netlog_nt.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server: Use direct struct initialization instead of ZERO_STRUCT
Volker Lendecke [Wed, 24 Feb 2021 14:49:49 +0000 (15:49 +0100)] 
rpc_server: Use direct struct initialization instead of ZERO_STRUCT

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>