CVE-2021-3738 s4:rpc_server/common: provide assoc_group aware dcesrv_samdb_connect_as...
commit897c0e8fc6fe9a9323f3ff657dc4245a7249c6fd
authorStefan Metzmacher <metze@samba.org>
Thu, 5 Aug 2021 12:22:32 +0000 (5 14:22 +0200)
committerJule Anger <janger@samba.org>
Tue, 9 Nov 2021 19:45:34 +0000 (9 19:45 +0000)
tree41d5139354fafba660c0396ffce2ce9681311c94
parentb173ac586a688c2c3c6e75b02952e939fd0d4698
CVE-2021-3738 s4:rpc_server/common: provide assoc_group aware dcesrv_samdb_connect_as_{system,user}() helpers

We already had dcesrv_samdb_connect_as_system(), but it uses the per
connection memory of auth_session_info and remote_address.

But in order to use the samdb connection on a per association group
context/policy handle, we need to make copies, which last for the
whole lifetime of the 'samdb' context.

We need the same logic also for all cases we make use of
the almost same logic where we want to create a samdb context
on behalf of the authenticated user (without allowing system access),
so we introduce dcesrv_samdb_connect_as_user().

In the end we need to replace all direct callers to samdb_connect()
from source4/rpc_server.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/rpc_server/common/server_info.c