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

124599 Commits

Author SHA1 Message Date
Stefan Metzmacher
1e47149402 Makefile: add support for 'make testonly'
That skips any attempt to recompile before running the tests.
Some times that's useful for debugging and we'll
use it to split the build and test stages in autobuild and gitlab-ci
later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2021-01-27 09:56:29 +00:00
David Mulder
709a6d6491 samba-tool: Add a gpo command for removing VGP Symbolic Link Group Policy
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan 27 07:32:03 UTC 2021 on sn-devel-184
2021-01-27 07:32:03 +00:00
David Mulder
5794c670ff samba-tool: Test gpo manage symlink remove command
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-27 06:30:31 +00:00
David Mulder
3fc89829a9 samba-tool: Add a gpo command for adding VGP Symbolic Link Group Policy
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-27 06:30:31 +00:00
David Mulder
7b2ecefd55 samba-tool: Test gpo manage symlink add command
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-27 06:30:31 +00:00
David Mulder
7e70d72d97 samba-tool: Add a gpo command for listing VGP Symbolic Link Group Policy
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-27 06:30:31 +00:00
David Mulder
b9cba18528 samba-tool: Test gpo manage symlink list command
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-27 06:30:31 +00:00
David Mulder
7ac29c8eeb gpo: Apply Group Policy Symlink Policy from VGP
This adds a Group Policy extension which applies
symlink policies set by Vintela Group Policy in the
SYSVOL.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-27 06:30:31 +00:00
David Mulder
33d2071b99 gpo: Test Group Policy VGP Symlink Policy
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-27 06:30:31 +00:00
Ralph Boehme
7114150f43 vfs_aixacl: fix regression from f4c2f867f0
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14620

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Jan 26 20:05:39 UTC 2021 on sn-devel-184
2021-01-26 20:05:39 +00:00
Ralph Boehme
e06f86bbd9 smbd: use fsp->conn->session_info for the initial delete-on-close token
There's a correctly set up session_info at fsp->conn->session_info, we can just
use that.

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

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 Jan 26 04:04:14 UTC 2021 on sn-devel-184
2021-01-26 04:04:14 +00:00
Ralph Boehme
aa1f09cda0 selftest: add a test that verifies unlink works when "force user" is set
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14617

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 02:55:28 +00:00
Ralph Boehme
f3f8fdfbf1 selftest: add force_user_error_inject share in maptoguest env
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14617

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 02:55:28 +00:00
Ralph Boehme
c44dad3ac2 vfs_error_inject: add unlinkat hook
Note that a failure is only injected if the owner of the parent directory is not
the same as the current user.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 02:55:28 +00:00
Volker Lendecke
17a8fa6d24 rpc_server: Add CLOEXEC to the listening sockets
We don't want to leak them into exec'ed processes.

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 Jan 26 01:13:53 UTC 2021 on sn-devel-184
2021-01-26 01:13:53 +00:00
Volker Lendecke
585b093ce8 lib: Provide a meaningful errno if FD_CLOEXEC is missing
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
d4e46cae4c rpc_server: Consolidate transport-specific socket creation
We had the transport switch in two places, put them together into
dcesrv_create_binding_sockets(). This makes the transport-specific
socket creation functions static to rpc_sock_helper.c.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
125c605ea5 rpc_server: Move socket creation to rpc_sock_helper.[ch]
dcesrv_create_ncacn_ip_tcp_sockets() already was there, move the rest
as well. This makes dcesrv_create_ncacn_np_socket() static to
rpc_sock_helper.c.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
27987e313f rpc_server: Factor out e->ep_description in dcesrv_create_endpoint_sockets()
e->ep_description is used a lot in this function.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
1c889f4475 rpc_server: Pass dcerpc_binding to dcesrv_create_ncacn_np_socket()
It does not need a dcesrv_endpoint.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
e74d520855 rpc_server: Pass dcerpc_binding to dcesrv_create_ncacn_ip_tcp_sockets()
It does not need a dcesrv_endpoint.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
cc456ac882 rpc_server: Pass dcerpc_binding to dcesrv_create_ncalrpc_socket()
It does not need a dcesrv_endpoint.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
f0aa39017b rpc_server: Remove an unused function parameter
dcesrv_create_endpoint_sockets() doesn't need dce_ctx.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-26 00:10:31 +00:00
Volker Lendecke
da3b00f551 vfs: Fix the FreeBSD build
fd_handle is private now

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jan 25 12:16:11 UTC 2021 on sn-devel-184
2021-01-25 12:16:11 +00:00
Volker Lendecke
d0260cb834 vfs: Remove an unused variable from zfs_get_nt_acl_common()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-01-25 11:09:30 +00:00
Martin Schwenke
29503c5b99 lib: Fix the build on FreeBSD
Commit 7d0981f5e7 broke the build on
FreeBSD:

[1589/3917] Compiling lib/util/util_runcmd.c
../../lib/util/util_runcmd.c:310:7: warning: implicit declaration of function 'WIFEXITED' is invalid in C99 [-Wimplicit-function-declaration]
                if (WIFEXITED(status)) {
                    ^
../../lib/util/util_runcmd.c:311:13: warning: implicit declaration of function 'WEXITSTATUS' is invalid in C99 [-Wimplicit-function-declaration]
                        status = WEXITSTATUS(status);
                                 ^
../../lib/util/util_runcmd.c:312:14: warning: implicit declaration of function 'WIFSIGNALED' is invalid in C99 [-Wimplicit-function-declaration]
                } else if (WIFSIGNALED(status)) {
                           ^
../../lib/util/util_runcmd.c:313:13: warning: implicit declaration of function 'WTERMSIG' is invalid in C99 [-Wimplicit-function-declaration]
                        status = WTERMSIG(status);
                                 ^
4 warnings generated.

[1590/3917] Linking bin/default/source4/dsdb/libsamdb-common-samba4.so
ld: error: undefined symbol: WIFEXITED
>>> referenced by util_runcmd.c
>>>               lib/util/util_runcmd.c.94.o:(samba_runcmd_io_handler)

ld: error: undefined symbol: WEXITSTATUS
>>> referenced by util_runcmd.c
>>>               lib/util/util_runcmd.c.94.o:(samba_runcmd_io_handler)

ld: error: undefined symbol: WIFSIGNALED
>>> referenced by util_runcmd.c
>>>               lib/util/util_runcmd.c.94.o:(samba_runcmd_io_handler)

ld: error: undefined symbol: WTERMSIG
>>> referenced by util_runcmd.c
>>>               lib/util/util_runcmd.c.94.o:(samba_runcmd_io_handler)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jan 25 09:48:09 UTC 2021 on sn-devel-184
2021-01-25 09:48:09 +00:00
Volker Lendecke
b9f6e25fad torture: Fix a gcc qualifier ordering warning
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): Fri Jan 22 21:07:57 UTC 2021 on sn-devel-184
2021-01-22 21:07:57 +00:00
Volker Lendecke
e593f96960 lib: Make accept_recv() return the listening socket
This is helpful if you are in a listening loop with the same receiver
for many sockets doing the same thing.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
f055d3f7db rpc_server: Fix a "bool==true" condition
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
10d3a1c068 rpc_server: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
181eb5728f torture: Align integer types
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
fa9d4570b8 lib: Align integer types
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
b4077f7911 librpc: Fix a small memleak in epm_floor_string()
Use GUID_buf_string(), don't leak the output of GUID_string()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
c3ea181e76 smbd: Simplify sendfile_short_send()
Allocate 1024 bytes on the stack instead of using calloc

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
791b477ca5 sharesec: Simplify add_ace()
Use ADD_TO_ARRAY

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
90ea83b754 libcli: make_sec_acl() copies the ace_list, make that const
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
f8f58301a1 smbcacls: Simplify add_ace_with_ctx()
Use ADD_TO_ARRAY()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
d4bbaee890 libsmb: Simplify add_ace()
Use ADD_TO_ARRAY()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
3fa00ac31a libsmb: Simplify sec_desc_parse()
Avoid CALLOC for just one struct dom_sids

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
5a018c70e2 smbcacls: Simplify sec_desc_parse()
Don't use SMB_CALLOC_ARRAY for just one element.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
40e4958953 lib: Make accept_recv() return struct samba_sockaddr
Avoid casting problems by using the samba_sockaddr union

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:38 +00:00
Volker Lendecke
b417fd1967 rpc_server: Slightly simplify dcesrv_bind()
Factor out dereferencing conn->dce_ctx

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:37 +00:00
Volker Lendecke
ec4850d520 rpc_server: Slightly simplify dcesrv_bind()
We have already dereferenced call->conn in a variable, use that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:37 +00:00
Volker Lendecke
d6d49638cc vfs: Simplify vfs_gluster_getwd()
Avoid a malloc, we allocate PATH_MAX chars on the stack elsewhere too

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:37 +00:00
Volker Lendecke
c5c9406b60 lib: Use hex_byte() in strhex_to_str()
I had completely missed that one in the last round...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:37 +00:00
Volker Lendecke
7d0981f5e7 lib: Avoid an "includes.h"
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:37 +00:00
Volker Lendecke
d6c3faa188 rpc_server: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-22 19:54:37 +00:00
Stefan Metzmacher
d8339056ee s3:idmap_hash: reliable return ID_TYPE_BOTH
idmap_hash used to bounce back the requested type,
which was ID_TYPE_UID, ID_TYPE_GID or ID_TYPE_NOT_SPECIFIED
before as the winbindd parent always used a lookupsids.
When the lookupsids failed because of an unknown domain,
the idmap child weren't requested at all and the caller
sees ID_TYPE_NOT_SPECIFIED.

This module should have supported ID_TYPE_BOTH since
samba-4.1.0, similar to idmap_rid and idmap_autorid.

Now that the winbindd parent will pass ID_TYPE_BOTH in order to
indicate that the domain exists, it's better to always return
ID_TYPE_BOTH instead of a random mix of ID_TYPE_UID, ID_TYPE_GID
or ID_TYPE_BOTH. In order to request a type_hint it will return
ID_REQUIRE_TYPE for ID_TYPE_NOT_SPECIFIED, which means that
the parent at least assures that the domain sid exists.
And the caller still gets ID_TYPE_NOT_SPECIFIED if the
domain doesn't exist.

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

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

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jan 22 11:32:46 UTC 2021 on sn-devel-184
2021-01-22 11:32:46 +00:00
Ralph Boehme
73528f26ee winbind: remove legacy flags fallback
Some very old NT4 DCs might have not returned the account flags filled in. This
shouldn't be a problem anymore. Additionally, on a typical domain member server,
this request is (and can only be) send to the primary domain, so this will not
work with accounts from trusted domains.

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): Thu Jan 21 22:56:20 UTC 2021 on sn-devel-184
2021-01-21 22:56:20 +00:00
Ralph Boehme
df5fe2d835 s3/auth: implement "winbind:ignore domains"
Under the following conditions a user from an ignored domain might be able to
authenticate:

- using Kerberos

- successfully previous authentication so the idmap and name caches are filled

- winbind not running (fwiw, winbindd is mandatory on a domain member)

- nscd running with a cached getpwnam for the ignored user (otherwise auth fails
  because getpwnam fails)

- lookup_name() function being modified to look into the name cache before
  contacting winbindd. Currently it talks directly to winbindd and that will
  check the cache.

Currently, authentication will only fail because creating the local token for
the user fails because an LSA lookupname RPC call fails (because winbindd is not
running).

All of this makes a successfull authentication unlikelly, but that is more by
accident then by design.

To ensures that if winbindd is not running and as such winbindd itself can not
enforce the restriction, also implement the ignored domains check in the auth
system as a last line of defense.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14602
RN: "winbind:ignore domains" doesn't prevent user login from trusted domain

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-01-21 21:48:30 +00:00