summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2018-05-30 14:43:25 +1200
committerAndrew Bartlett <abartlet@samba.org>2018-05-31 09:54:18 +0200
commitd48b5d5320807ef394d1d31c3f9e92b4955a4aea (patch)
tree8e0184f6d4b1866d4dc93f58ddbbe98757be42fa /source4
parentd06ebf646c2a89d2b445f8d4ce85f9151886caa5 (diff)
downloadsamba-d48b5d5320807ef394d1d31c3f9e92b4955a4aea.tar.gz
rpc_server: common routine to open ldb in system session
Add a function to open an ldb connection under the system session and save the remote users session details in a ldb_opaque. This will allow the audit logging to log the original session for operations performed in the system session. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/rpc_server/common/server_info.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/rpc_server/common/server_info.c b/source4/rpc_server/common/server_info.c
index 0aabcdaebe7..7229457b54f 100644
--- a/source4/rpc_server/common/server_info.c
+++ b/source4/rpc_server/common/server_info.c
@@ -186,3 +186,29 @@ bool dcesrv_common_validate_share_name(TALLOC_CTX *mem_ctx, const char *share_na
return true;
}
+
+/*
+ * Open an ldb connection under the system session and save the remote users
+ * session details in a ldb_opaque. This will allow the audit logging to
+ * log the original session for operations performed in the system session.
+ */
+struct ldb_context *dcesrv_samdb_connect_as_system(
+ TALLOC_CTX *mem_ctx,
+ struct dcesrv_call_state *dce_call)
+{
+ struct ldb_context *samdb = NULL;
+ samdb = samdb_connect(
+ mem_ctx,
+ dce_call->event_ctx,
+ dce_call->conn->dce_ctx->lp_ctx,
+ system_session(dce_call->conn->dce_ctx->lp_ctx),
+ dce_call->conn->remote_address,
+ 0);
+ if (samdb) {
+ ldb_set_opaque(
+ samdb,
+ "networkSessionInfo",
+ dce_call->conn->auth_state.session_info);
+ }
+ return samdb;
+}