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

120764 Commits

Author SHA1 Message Date
Ralph Boehme
1d797a839d smbd: don't use vuser in make_connection()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:36 +00:00
Ralph Boehme
758c42ec5d smbd: remove unused vuser arg from make_connection_smb2()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:36 +00:00
Ralph Boehme
893aba4d65 smbd: remove unused vuser arg from make_connection_smb1()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:36 +00:00
Ralph Boehme
9ef30c75b0 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>
2020-01-13 19:41:36 +00:00
Ralph Boehme
8be0ca8e19 smbd: remove use of user_struct from reply_ulogoffX()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:36 +00:00
Ralph Boehme
4b89100dc8 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>
2020-01-13 19:41:36 +00:00
Ralph Boehme
18b43aeb57 smbd: add smbXsrv_session_local_traverse()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:36 +00:00
Ralph Boehme
d2b5f85d22 smbd: remove enum server_allocated_state magic from get_valid_user_struct()
This has been obsoleted a long time ago by
a129e271b5.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:36 +00:00
Ralph Boehme
c3d2201867 smbd: use get_valid_smbXsrv_session() in invalidate_vuid()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:36 +00:00
Ralph Boehme
dd9735b1da 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>
2020-01-13 19:41:35 +00:00
Ralph Boehme
a22b503819 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>
2020-01-13 19:41:35 +00:00
Ralph Boehme
54d626cc77 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>
2020-01-13 19:41:35 +00:00
Ralph Boehme
25524c8e78 smbd: use smbXsrv_session_info_lookup() in api_reply()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:35 +00:00
Ralph Boehme
c3f890fb1e smbd: use smbXsrv_session_info_lookup() in api_WWkstaUserLogon()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:35 +00:00
Ralph Boehme
46f51912ae 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>
2020-01-13 19:41:35 +00:00
Ralph Boehme
57d4689273 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>
2020-01-13 19:41:35 +00:00
Ralph Boehme
e80aca0427 smbd: introduce smbXsrv_session_info_lookup()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:35 +00:00
Ralph Boehme
96fd0ddd02 smbd: remove vuser arg from make_connection_snum()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:35 +00:00
Ralph Boehme
c1d0a70d19 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>
2020-01-13 19:41:34 +00:00
Ralph Boehme
61fa0f9976 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>
2020-01-13 19:41:34 +00:00
Ralph Boehme
bcadd7d798 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>
2020-01-13 19:41:34 +00:00
Ralph Boehme
5992f8fa93 smbd: pass smbXsrv_session to make_connection_snum()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:34 +00:00
Ralph Boehme
8aae1ef5c0 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>
2020-01-13 19:41:34 +00:00
Ralph Boehme
aa27bceff1 smbd: add session to struct smb_request
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-13 19:41:34 +00:00
Jeremy Allison
15ee379ef1 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>
2020-01-13 19:41:34 +00:00
Jeremy Allison
36ea1e188d 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>
2020-01-13 19:41:34 +00:00
Alexander Bokovoy
c6d880a115 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(1284200000, 1284200000), 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(1284200000, 1284200000), 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
2020-01-13 15:05:28 +00:00
Douglas Bagnall
beb386b584 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
2020-01-12 21:21:30 +00:00
Douglas Bagnall
16ca385013 ldb controls: fix typo in bypassoperational message
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-01-12 19:50:37 +00:00
Douglas Bagnall
1d35962128 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>
2020-01-12 19:50:37 +00:00
Douglas Bagnall
e1c6e7d18b 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>
2020-01-12 19:50:37 +00:00
David Disseldorp
e61ddeef4c 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
2020-01-11 14:59:36 +00:00
David Disseldorp
888002f99e 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>
2020-01-11 13:34:30 +00:00
Jeremy Allison
748379c66b 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
2020-01-10 21:05:25 +00:00
Jeremy Allison
54f9da4435 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>
2020-01-10 19:38:42 +00:00
Jeremy Allison
23df92810b 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>
2020-01-10 19:38:42 +00:00
Jeremy Allison
51fd875661 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>
2020-01-10 19:38:42 +00:00
Jeremy Allison
6a46c5f207 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>
2020-01-10 19:38:42 +00:00
Jeremy Allison
235e59481d 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>
2020-01-10 19:38:42 +00:00
Jeremy Allison
421d26a890 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>
2020-01-10 19:38:42 +00:00
Jeremy Allison
b0b9dd2f86 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>
2020-01-10 19:38:42 +00:00
Gary Lockyer
86a31defbf 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
2020-01-09 21:49:00 +00:00
David Disseldorp
60b72f589e 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
2020-01-09 20:20:05 +00:00
Volker Lendecke
4b95ea37cb 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>
2020-01-09 18:55:36 +00:00
Volker Lendecke
91f069cc16 ntlm_auth: Add a NULL check
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-09 18:55:36 +00:00
Volker Lendecke
d78b4a841e 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>
2020-01-09 18:55:36 +00:00
Volker Lendecke
1cd20731ab printing: Align integer types
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-09 18:55:36 +00:00
Günther Deschner
17e692a9fa 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
2020-01-09 01:15:34 +00:00
Günther Deschner
c9077f1628 s3-rpcclient: add clusapi_pause_node command.
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-01-08 23:51:31 +00:00
Günther Deschner
94157af261 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>
2020-01-08 23:51:31 +00:00