samba.git
5 years agoselftest:Samba4: run the raw_protocol test with a limit of 8 auth contexts
Stefan Metzmacher [Fri, 14 Dec 2018 12:51:27 +0000 (13:51 +0100)]
selftest:Samba4: run the raw_protocol test with a limit of 8 auth contexts

This is much faster than exploring the limit of 2049 during autobuild.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: implement security context multiplexing
Stefan Metzmacher [Thu, 8 Nov 2018 13:59:58 +0000 (14:59 +0100)]
s4:rpc_server: implement security context multiplexing

There're some systems like Cisco ISE use security multiplexing
without checking (via bind time feature negotiation)
the server supports it.

Others like VMWare View, fallback to NT4 style netlogon
connections without using netlogon secure channel,
which then triggers an error, with "server schannel = yes",
see https://bugzilla.samba.org/show_bug.cgi?id=13464.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: add tests to demonstrate how security context multiplexing...
Stefan Metzmacher [Wed, 21 Nov 2018 10:01:55 +0000 (11:01 +0100)]
py:dcerpc/raw_protocol: add tests to demonstrate how security context multiplexing works

Important things are this:
- It's not required to use the bind time feature negotiation in order
  to use it, it's only a hint for the client, but nothing is really
  negotiated, unlike the request multiplexing with the
  DCERPC_PFC_FLAG_CONC_MPX.
- There's special handling related to AUTH_LEVEL_CONNECT
  and requests without auth trailer
- An security context is identified by the unique
  tuple of auth_type, auth_level and auth_context_id (all together!),
  not just the auth_context_id.
- There's a limit of 2049 explicit authentication contexts.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: add assertEqualsStrLower()
Stefan Metzmacher [Mon, 26 Nov 2018 10:49:22 +0000 (11:49 +0100)]
py:dcerpc/raw_testcase: add assertEqualsStrLower()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopidl/Python: use py_dcerpc_ndr_pointer_wrap/deref if multiple pointer levels are...
Stefan Metzmacher [Thu, 29 Nov 2018 12:25:21 +0000 (13:25 +0100)]
pidl/Python: use py_dcerpc_ndr_pointer_wrap/deref if multiple pointer levels are used

This will help the raw_protocol test to explore lsa_GetUserName.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:pyrpc: add py_dcerpc_ndr_pointer_deref/wrap() infrastructure
Stefan Metzmacher [Thu, 29 Nov 2018 11:41:34 +0000 (12:41 +0100)]
s4:pyrpc: add py_dcerpc_ndr_pointer_deref/wrap() infrastructure

Some idl files use more than one layer of unique pointers. e.g.

    NTSTATUS lsa_GetUserName(
            [in,unique] [string,charset(UTF16)] uint16 *system_name,
            [in,out,ref] lsa_String **account_name,
            [in,out,unique] lsa_String **authority_name
            );

In order to specify *io.in.authority_name = NULL,
we need to wrap the pointer value (lsa_String or None)
into an base.ndr_pointer() object.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:pyrpc: make use of pytalloc_get_type() in py_dcerpc_syntax_init_helper()
Stefan Metzmacher [Thu, 29 Nov 2018 15:47:15 +0000 (16:47 +0100)]
s4:pyrpc: make use of pytalloc_get_type() in py_dcerpc_syntax_init_helper()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/lsa: specify \\pipe\lsass as ncacn_np_secondary_endpoint
Stefan Metzmacher [Wed, 12 Dec 2018 21:41:56 +0000 (22:41 +0100)]
s4:rpc_server/lsa: specify \\pipe\lsass as ncacn_np_secondary_endpoint

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: make it possible to specify ncacn_np_secondary_endpoint
Stefan Metzmacher [Wed, 12 Dec 2018 21:41:56 +0000 (22:41 +0100)]
s4:rpc_server: make it possible to specify ncacn_np_secondary_endpoint

Even a connect to \\pipe\lsarpc should return a secondary_address
of '\\pipe\\lsass'. But that will be implemented in a following commit.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: demonstrate that \\pipe\lsarpc returns \\pipe\lsass as second...
Stefan Metzmacher [Thu, 13 Dec 2018 09:13:03 +0000 (10:13 +0100)]
py:dcerpc/raw_protocol: demonstrate that \\pipe\lsarpc returns \\pipe\lsass as secondary_address

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: only share assoc group ids on the same transport
Stefan Metzmacher [Wed, 12 Dec 2018 12:49:35 +0000 (13:49 +0100)]
s4:rpc_server: only share assoc group ids on the same transport

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: add test_assoc_group_fail3()
Stefan Metzmacher [Wed, 12 Dec 2018 12:43:45 +0000 (13:43 +0100)]
py:dcerpc/raw_protocol: add test_assoc_group_fail3()

This demonstrates that assoc groups are only shared on the
same transport (endpoint).

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: don't replace '\\pipe\\' with '\\PIPE\\'
Stefan Metzmacher [Wed, 12 Dec 2018 12:48:05 +0000 (13:48 +0100)]
s4:rpc_server: don't replace '\\pipe\\' with '\\PIPE\\'

This is not what Windows returns (at least for \\pipe\lsass).

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: add test_assoc_group_ok2 to check assoc groups over ncacn_np
Stefan Metzmacher [Wed, 12 Dec 2018 11:35:09 +0000 (12:35 +0100)]
py:dcerpc/raw_protocol: add test_assoc_group_ok2 to check assoc groups over ncacn_np

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agoselftest:Samba4: allow dcerpc auth level connect:lsarpc = yes in chgdcpass
Stefan Metzmacher [Thu, 22 Nov 2018 23:23:23 +0000 (00:23 +0100)]
selftest:Samba4: allow dcerpc auth level connect:lsarpc = yes in chgdcpass

This is required to explore the details of security context multiplexing
using lsa_GetUserName().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: enable tests with the DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN bit
Stefan Metzmacher [Wed, 21 Nov 2018 08:38:46 +0000 (09:38 +0100)]
py:dcerpc/raw_protocol: enable tests with the DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN bit

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: fix DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN negotiation to match Windows
Stefan Metzmacher [Wed, 21 Nov 2018 08:39:36 +0000 (09:39 +0100)]
s4:rpc_server: fix DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN negotiation to match Windows

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: consistently call self.recv_pdu(timeout=0.01) after auth3
Stefan Metzmacher [Wed, 21 Nov 2018 10:49:40 +0000 (11:49 +0100)]
py:dcerpc/raw_protocol: consistently call self.recv_pdu(timeout=0.01) after auth3

When we don't expect a FAULT, we should wait a little bit to check
there's no response to auth3 request. This reduces the raw_procol
test from 45s down to 35s total runtime against Windows.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: add tests for delayed header signing activation
Stefan Metzmacher [Wed, 21 Nov 2018 10:49:40 +0000 (11:49 +0100)]
py:dcerpc/raw_protocol: add tests for delayed header signing activation

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: add pfc_flags_2nd and use_auth3 options to do_generic_bind()
Stefan Metzmacher [Wed, 21 Nov 2018 10:49:40 +0000 (11:49 +0100)]
py:dcerpc/raw_testcase: add pfc_flags_2nd and use_auth3 options to do_generic_bind()

This makes it more flexible and allows to write complex tests in an
easier fashion.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: SMB_ASSERT(auth->auth_finished); in order to get auth details
Stefan Metzmacher [Fri, 23 Nov 2018 12:24:05 +0000 (13:24 +0100)]
s4:rpc_server: SMB_ASSERT(auth->auth_finished); in order to get auth details

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: only pass context to op_bind() hooks
Stefan Metzmacher [Wed, 21 Nov 2018 19:06:21 +0000 (20:06 +0100)]
s4:rpc_server: only pass context to op_bind() hooks

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: only use context within op_bind() hooks and dcesrv_interface_bind_...
Stefan Metzmacher [Wed, 21 Nov 2018 19:06:21 +0000 (20:06 +0100)]
s4:rpc_server: only use context within op_bind() hooks and dcesrv_interface_bind_*() functions

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: remove unused dcesrv_connection_context->private_date
Stefan Metzmacher [Mon, 10 Dec 2018 22:51:09 +0000 (23:51 +0100)]
s4:rpc_server: remove unused dcesrv_connection_context->private_date

dcesrv_iface_state_{create,find}_{assoc,conn}() should be used instead.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: remove unused dcesrv_assoc_group->proxied_id
Stefan Metzmacher [Wed, 21 Nov 2018 22:38:25 +0000 (23:38 +0100)]
s4:rpc_server: remove unused dcesrv_assoc_group->proxied_id

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/winreg: don't cache an ldb connection per presentation context
Stefan Metzmacher [Wed, 21 Nov 2018 19:05:01 +0000 (20:05 +0100)]
s4:rpc_server/winreg: don't cache an ldb connection per presentation context

We should do this per context handle, as these are available on all
connections of the association group.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/remote: make use dcesrv_iface_state_{store,find}_{assoc,conn}() helpers
Stefan Metzmacher [Wed, 21 Nov 2018 18:28:30 +0000 (19:28 +0100)]
s4:rpc_server/remote: make use dcesrv_iface_state_{store,find}_{assoc,conn}() helpers

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/remote: introduce struct dcesrv_remote_call
Stefan Metzmacher [Fri, 23 Nov 2018 13:28:56 +0000 (14:28 +0100)]
s4:rpc_server/remote: introduce struct dcesrv_remote_call

This holds the state for async requests.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/remote: defer the connect to the first client request
Stefan Metzmacher [Wed, 21 Nov 2018 18:19:15 +0000 (19:19 +0100)]
s4:rpc_server/remote: defer the connect to the first client request

This means we have a chance to use delegated credentials from the client
if available, as the authentication is already completed.

Before we only ever used the transport inherited credentials
via SMB or anonymous.

Note: most times we still fallback to anonymous...

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/remote: fail the connection if the remote server don't support MPX
Stefan Metzmacher [Fri, 23 Nov 2018 13:21:45 +0000 (14:21 +0100)]
s4:rpc_server/remote: fail the connection if the remote server don't support MPX

If we already negotiated with our client to support concurent multiplexing (MPX),
we need a remote connection that also supports it.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agoselftest: use "dcerpc_remote:allow_anonymous_fallback = yes" for rpc_proxy
Stefan Metzmacher [Fri, 23 Nov 2018 12:15:10 +0000 (13:15 +0100)]
selftest: use "dcerpc_remote:allow_anonymous_fallback = yes" for rpc_proxy

This already uses anonymous credentials as the remote connection is done
during the bind before the realm authentication has started.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/remote: add dcerpc_remote:allow_anonymous_fallback option
Stefan Metzmacher [Fri, 23 Nov 2018 12:13:53 +0000 (13:13 +0100)]
s4:rpc_server/remote: add dcerpc_remote:allow_anonymous_fallback option

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/remote: reformat code to get "dcerpc_remote:use_machine_account"
Stefan Metzmacher [Wed, 21 Nov 2018 18:14:59 +0000 (19:14 +0100)]
s4:rpc_server/remote: reformat code to get "dcerpc_remote:use_machine_account"

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/remote: reformat code to get "dcerpc_remote:binding"
Stefan Metzmacher [Wed, 21 Nov 2018 18:13:50 +0000 (19:13 +0100)]
s4:rpc_server/remote: reformat code to get "dcerpc_remote:binding"

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/remote: remote_op_bind already has the table available
Stefan Metzmacher [Wed, 21 Nov 2018 18:08:59 +0000 (19:08 +0100)]
s4:rpc_server/remote: remote_op_bind already has the table available

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/remote: introduce remote_get_private()
Stefan Metzmacher [Wed, 21 Nov 2018 17:00:29 +0000 (18:00 +0100)]
s4:rpc_server/remote: introduce remote_get_private()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/dnsserver: make use of dcesrv_iface_state_{create,find}_conn()
Stefan Metzmacher [Mon, 10 Dec 2018 21:42:51 +0000 (22:42 +0100)]
s4:rpc_server/dnsserver: make use of dcesrv_iface_state_{create,find}_conn()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/netlogon: make use of dcesrv_iface_state_{create,find}_conn()
Stefan Metzmacher [Mon, 10 Dec 2018 21:42:51 +0000 (22:42 +0100)]
s4:rpc_server/netlogon: make use of dcesrv_iface_state_{create,find}_conn()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: add dcesrv_iface_state_{store,find}_{assoc,conn}() helpers
Stefan Metzmacher [Mon, 10 Dec 2018 21:41:31 +0000 (22:41 +0100)]
s4:rpc_server: add dcesrv_iface_state_{store,find}_{assoc,conn}() helpers

They can be used instead of
dcesrv_connection_context->private_data and
dcesrv_assoc_group->proxied_id.

This is the first step to hide internal details of
the core dcerpc server from the interface implementations.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: move bind_time_features to dcesrv_assoc_group
Stefan Metzmacher [Wed, 21 Nov 2018 22:39:11 +0000 (23:39 +0100)]
s4:rpc_server: move bind_time_features to dcesrv_assoc_group

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: add a min_auth_level to context handles
Stefan Metzmacher [Wed, 21 Nov 2018 22:27:50 +0000 (23:27 +0100)]
s4:rpc_server: add a min_auth_level to context handles

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: replace dce_conn->allow_request with auth->auth_finished
Stefan Metzmacher [Thu, 22 Nov 2018 09:30:47 +0000 (10:30 +0100)]
s4:rpc_server: replace dce_conn->allow_request with auth->auth_finished

They both had the same lifetime and the disconnect case is now
caught by auth->auth_invalid = true.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: replace dce_conn->allow_auth3 with auth->auth_started
Stefan Metzmacher [Thu, 22 Nov 2018 09:30:47 +0000 (10:30 +0100)]
s4:rpc_server: replace dce_conn->allow_auth3 with auth->auth_started

auth3 is allowed if auth_started is true and auth_finished is false.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: set auth_invalid = true on disconnect
Stefan Metzmacher [Thu, 6 Dec 2018 16:03:25 +0000 (17:03 +0100)]
s4:rpc_server: set auth_invalid = true on disconnect

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: split out log_successful_dcesrv_authz_event()
Stefan Metzmacher [Thu, 22 Nov 2018 12:26:21 +0000 (13:26 +0100)]
s4:rpc_server: split out log_successful_dcesrv_authz_event()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: add some protection checks to dcesrv_auth_prepare_gensec()
Stefan Metzmacher [Thu, 8 Nov 2018 15:36:52 +0000 (16:36 +0100)]
s4:rpc_server: add some protection checks to dcesrv_auth_prepare_gensec()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: split out dcesrv_auth_prepare_gensec()
Stefan Metzmacher [Thu, 8 Nov 2018 15:36:13 +0000 (16:36 +0100)]
s4:rpc_server: split out dcesrv_auth_prepare_gensec()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: allocate struct dcesrv_auth with talloc
Stefan Metzmacher [Thu, 8 Nov 2018 12:28:07 +0000 (13:28 +0100)]
s4:rpc_server: allocate struct dcesrv_auth with talloc

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: make use of dcesrv_call_state->auth_state in dcerpc_server.c
Stefan Metzmacher [Wed, 31 Oct 2018 13:44:33 +0000 (14:44 +0100)]
s4:rpc_server: make use of dcesrv_call_state->auth_state in dcerpc_server.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: make use of dcesrv_call_state->auth_state in common/reply.c
Stefan Metzmacher [Wed, 31 Oct 2018 13:44:33 +0000 (14:44 +0100)]
s4:rpc_server: make use of dcesrv_call_state->auth_state in common/reply.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: make use of dcesrv_call_state->auth_state in dcesrv_auth.c
Stefan Metzmacher [Wed, 31 Oct 2018 13:44:33 +0000 (14:44 +0100)]
s4:rpc_server: make use of dcesrv_call_state->auth_state in dcesrv_auth.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: introduce dcesrv_call_state->auth_state
Stefan Metzmacher [Wed, 31 Oct 2018 13:44:33 +0000 (14:44 +0100)]
s4:rpc_server: introduce dcesrv_call_state->auth_state

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: use helper variables to access 'struct dcesrv_auth' in dcerpc_server.c
Stefan Metzmacher [Wed, 31 Oct 2018 16:12:02 +0000 (17:12 +0100)]
s4:rpc_server: use helper variables to access 'struct dcesrv_auth' in dcerpc_server.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: use helper variables to access 'struct dcesrv_auth' in common/reply.c
Stefan Metzmacher [Wed, 31 Oct 2018 16:12:02 +0000 (17:12 +0100)]
s4:rpc_server: use helper variables to access 'struct dcesrv_auth' in common/reply.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: use helper variables to access 'struct dcesrv_auth' in dcesrv_auth.c
Stefan Metzmacher [Wed, 31 Oct 2018 16:12:02 +0000 (17:12 +0100)]
s4:rpc_server: use helper variables to access 'struct dcesrv_auth' in dcesrv_auth.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/remote: make use of dcesrv_call_credentials()
Stefan Metzmacher [Thu, 8 Nov 2018 12:08:19 +0000 (13:08 +0100)]
s4:rpc_server/remote: make use of dcesrv_call_credentials()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/netlogon: make use of dcesrv_call_auth_info()
Stefan Metzmacher [Thu, 8 Nov 2018 11:44:30 +0000 (12:44 +0100)]
s4:rpc_server/netlogon: make use of dcesrv_call_auth_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/netlogon: simplify logic of dcesrv_netr_creds_server_step_check()
Stefan Metzmacher [Thu, 8 Nov 2018 12:05:25 +0000 (13:05 +0100)]
s4:rpc_server/netlogon: simplify logic of dcesrv_netr_creds_server_step_check()

It's enough to check the auth_type for DCERPC_AUTH_TYPE_SCHANNEL,
there's no need to also check the auth_level for integrity or privacy.

The gensec layer already required at least DCERPC_AUTH_LEVEL_INTEGRITY,
see schannel_update_internal().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/lsa: make use of dcesrv_call_auth_info()
Stefan Metzmacher [Thu, 8 Nov 2018 11:44:30 +0000 (12:44 +0100)]
s4:rpc_server/lsa: make use of dcesrv_call_auth_info()

It's enough to check the auth_type for DCERPC_AUTH_TYPE_SCHANNEL,
there's no need to also check the auth_level for integrity or privacy.

The gensec layer already required at least DCERPC_AUTH_LEVEL_INTEGRITY,
see schannel_update_internal().

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/samr: make use of dcesrv_call_auth_info()
Stefan Metzmacher [Thu, 8 Nov 2018 11:44:30 +0000 (12:44 +0100)]
s4:rpc_server/samr: make use of dcesrv_call_auth_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: add dcesrv_call_auth_info()
Stefan Metzmacher [Thu, 8 Nov 2018 11:44:30 +0000 (12:44 +0100)]
s4:rpc_server: add dcesrv_call_auth_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/handles: make use dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)]
s4:rpc_server/handles: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: remove the old dcesrv_handle_{new,fetch}() api
Stefan Metzmacher [Thu, 8 Nov 2018 11:20:44 +0000 (12:20 +0100)]
s4:rpc_server: remove the old dcesrv_handle_{new,fetch}() api

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: only use the new dcesrv_handle_{create,lookup}() api
Stefan Metzmacher [Thu, 8 Nov 2018 11:20:44 +0000 (12:20 +0100)]
s4:rpc_server: only use the new dcesrv_handle_{create,lookup}() api

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/winreg: make use of dcesrv_handle_create()
Stefan Metzmacher [Thu, 8 Nov 2018 11:20:44 +0000 (12:20 +0100)]
s4:rpc_server/winreg: make use of dcesrv_handle_create()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/samr: make use of dcesrv_handle_create()
Stefan Metzmacher [Thu, 8 Nov 2018 11:20:44 +0000 (12:20 +0100)]
s4:rpc_server/samr: make use of dcesrv_handle_create()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/lsa: make use of dcesrv_handle_create()
Stefan Metzmacher [Thu, 8 Nov 2018 11:20:44 +0000 (12:20 +0100)]
s4:rpc_server/lsa: make use of dcesrv_handle_create()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/eventlog: make use of dcesrv_handle_create()
Stefan Metzmacher [Thu, 8 Nov 2018 11:20:44 +0000 (12:20 +0100)]
s4:rpc_server/eventlog: make use of dcesrv_handle_create()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/drsuapi: make use of dcesrv_handle_create()
Stefan Metzmacher [Thu, 8 Nov 2018 11:20:44 +0000 (12:20 +0100)]
s4:rpc_server/drsuapi: make use of dcesrv_handle_create()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: add dcesrv_handle_{create,lookup}() functions
Stefan Metzmacher [Thu, 8 Nov 2018 10:48:46 +0000 (11:48 +0100)]
s4:rpc_server: add dcesrv_handle_{create,lookup}() functions

They take struct dcesrv_call_state as argument and will replace
dcesrv_handle_{new,fetch}() which take dcesrv_connection_context
as argument.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: add some const to dcesrv_handle_fetch()
Stefan Metzmacher [Thu, 8 Nov 2018 11:14:05 +0000 (12:14 +0100)]
s4:rpc_server: add some const to dcesrv_handle_fetch()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: merge dcesrv_fetch_session_key() into dcesrv_transport_session_key()
Stefan Metzmacher [Thu, 8 Nov 2018 10:52:29 +0000 (11:52 +0100)]
s4:rpc_server: merge dcesrv_fetch_session_key() into dcesrv_transport_session_key()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: remove unused dcesrv_inherited_session_key()
Stefan Metzmacher [Thu, 8 Nov 2018 10:52:29 +0000 (11:52 +0100)]
s4:rpc_server: remove unused dcesrv_inherited_session_key()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: only pass dcesrv_auth to auth_state.session_key_fn()
Stefan Metzmacher [Thu, 8 Nov 2018 10:14:41 +0000 (11:14 +0100)]
s4:rpc_server: only pass dcesrv_auth to auth_state.session_key_fn()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: only setup the auth_state.session_key fn in dcesrv_endpoint_connect()
Stefan Metzmacher [Thu, 8 Nov 2018 10:14:41 +0000 (11:14 +0100)]
s4:rpc_server: only setup the auth_state.session_key fn in dcesrv_endpoint_connect()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: make dcesrv_endpoint_connect() static
Stefan Metzmacher [Thu, 8 Nov 2018 10:14:41 +0000 (11:14 +0100)]
s4:rpc_server: make dcesrv_endpoint_connect() static

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: only AUTH_TYPE_NONE should get a transport session key
Stefan Metzmacher [Thu, 8 Nov 2018 08:45:15 +0000 (09:45 +0100)]
s4:rpc_server: only AUTH_TYPE_NONE should get a transport session key

There's only a logic change for NCALRPC and NCACN_UNIX_STREAM.
dcesrv_generic_session_key() already returned
NT_STATUS_NO_USER_SESSION_KEY for all other cases.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: split out a dcesrv_session_info_session_key() helper function
Stefan Metzmacher [Thu, 8 Nov 2018 08:45:15 +0000 (09:45 +0100)]
s4:rpc_server: split out a dcesrv_session_info_session_key() helper function

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: allow a NULL function pointer in dcesrv_fetch_session_key()
Stefan Metzmacher [Thu, 8 Nov 2018 08:45:15 +0000 (09:45 +0100)]
s4:rpc_server: allow a NULL function pointer in dcesrv_fetch_session_key()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/drsuapi: make use of dcesrv_auth_session_key()
Stefan Metzmacher [Thu, 8 Nov 2018 10:52:29 +0000 (11:52 +0100)]
s4:rpc_server/drsuapi: make use of dcesrv_auth_session_key()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/samr: make use of dcesrv_transport_session_key()
Stefan Metzmacher [Thu, 8 Nov 2018 10:52:29 +0000 (11:52 +0100)]
s4:rpc_server/samr: make use of dcesrv_transport_session_key()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/lsa: make use of dcesrv_transport_session_key()
Stefan Metzmacher [Thu, 8 Nov 2018 10:52:29 +0000 (11:52 +0100)]
s4:rpc_server/lsa: make use of dcesrv_transport_session_key()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: add dcesrv_{auth,transport}_session_key() functions
Stefan Metzmacher [Thu, 8 Nov 2018 10:48:46 +0000 (11:48 +0100)]
s4:rpc_server: add dcesrv_{auth,transport}_session_key() functions

They take struct dcesrv_call_state as argument and will replace
dcesrv_{inherited,fetch}_session_key() which take dcesrv_connection
as argument.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/common: make use dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)]
s4:rpc_server/common: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/winreq: make use dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)]
s4:rpc_server/winreq: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/srvsvc: make use dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)]
s4:rpc_server/srvsvc: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/samr: make use dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)]
s4:rpc_server/samr: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/netlogon: make use dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)]
s4:rpc_server/netlogon: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/lsa: make use dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)]
s4:rpc_server/lsa: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/drsuapi: make use dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)]
s4:rpc_server/drsuapi: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/dnsserver: make use dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)]
s4:rpc_server/dnsserver: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/backupkey: make use dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:19:51 +0000 (01:19 +0100)]
s4:rpc_server/backupkey: make use dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: add dcesrv_call_session_info()
Stefan Metzmacher [Sat, 3 Nov 2018 00:18:59 +0000 (01:18 +0100)]
s4:rpc_server: add dcesrv_call_session_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: remove unused dcesrv_connection->transport_session_key
Stefan Metzmacher [Wed, 21 Nov 2018 08:41:51 +0000 (09:41 +0100)]
s4:rpc_server: remove unused dcesrv_connection->transport_session_key

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: move dcesrv_auth.c and common/reply.c to dcerpc_server
Stefan Metzmacher [Tue, 13 Nov 2018 08:42:17 +0000 (09:42 +0100)]
s4:rpc_server: move dcesrv_auth.c and common/reply.c to dcerpc_server

They belong to the core dcerpc server.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: let test_rpc_dns_server_dnsutils depend on dcerpc_server
Stefan Metzmacher [Thu, 29 Nov 2018 15:48:42 +0000 (16:48 +0100)]
s4:rpc_server: let test_rpc_dns_server_dnsutils depend on dcerpc_server

The core dcerpc server is required here, which also implies
DCERPC_COMMON.

This is required to move common/reply.c dcesrv_auth.c from
DCERPC_COMMON to dcerpc_server in the next commit.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server: remove dcerpc_remote dependency from dcerpc_server
Stefan Metzmacher [Thu, 29 Nov 2018 15:47:58 +0000 (16:47 +0100)]
s4:rpc_server: remove dcerpc_remote dependency from dcerpc_server

dcerpc_remote is just an implementation and does not belong to the
core dcerpc server.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:rpc_server/samr: Fix the O3 developer build
Stefan Metzmacher [Fri, 16 Nov 2018 15:11:50 +0000 (16:11 +0100)]
s4:rpc_server/samr: Fix the O3 developer build

Different gcc versions complain at different places.

I recently got these:

../source4/rpc_server/samr/dcesrv_samr.c: In function
‘dcesrv_samr_QueryDisplayInfo2’:
../source4/rpc_server/samr/dcesrv_samr.c:4117:2: error: ‘q.out.result.v’
may be used uninitialized in this function [-Werror=maybe-uninitialized]
  return result;
  ^
../source4/rpc_server/samr/dcesrv_samr.c: In function
‘dcesrv_samr_QueryDisplayInfo3’:
../source4/rpc_server/samr/dcesrv_samr.c:4151:2: error: ‘q.out.result.v’
may be used uninitialized in this function [-Werror=maybe-uninitialized]
  return result;
  ^
cc1: all warnings being treated as errors

../source4/rpc_server/samr/dcesrv_samr.c: In function
‘dcesrv_samr_QueryDisplayInfo3’:
../source4/rpc_server/samr/dcesrv_samr.c:4151:2: error: ‘q.out.result.v’
may be used uninitialized in this function [-Werror=maybe-uninitialized]
  return result;
  ^
In file included from ../source4/rpc_server/samr/dcesrv_samr.c:4447:0:
default/librpc/gen_ndr/ndr_samr_s.c: In function ‘samr__op_dispatch’:
default/librpc/gen_ndr/ndr_samr_s.c:597:18: error: ‘q.out.result.v’ may
be used uninitialized in this function [-Werror=maybe-uninitialized]
   r2->out.result = dcesrv_samr_QueryDisplayInfo2(dce_call, mem_ctx,
r2);
                  ^
cc1: all warnings being treated as errors

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:torture: make test_GetUserName() more strict
Stefan Metzmacher [Mon, 26 Nov 2018 10:06:44 +0000 (11:06 +0100)]
s4:torture: make test_GetUserName() more strict

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolibrpc: add SMB_ASSERT(blob->length >= DCERPC_NCACN_PAYLOAD_OFFSET) protection
Stefan Metzmacher [Mon, 24 Dec 2018 10:21:38 +0000 (11:21 +0100)]
librpc: add SMB_ASSERT(blob->length >= DCERPC_NCACN_PAYLOAD_OFFSET) protection

A lot of functions rely on having the 16 bytes dcerpc header to operate
on. This makes it more obvious and makes sure they can't be misused in
future.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>