From: Gary Lockyer Date: Wed, 30 May 2018 02:45:03 +0000 (+1200) Subject: rpc_server backupkey: pass remote connection data X-Git-Tag: tevent-0.9.37~443 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=02991b4df91605bf1cb4841238b33a64d42eed43;p=thirdparty%2Fsamba.git rpc_server backupkey: pass remote connection data Ensure that the requesting session data is passed to the audit logging module for BackupKey requests. Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Thu May 31 12:35:15 CEST 2018 on sn-devel-144 --- diff --git a/source4/rpc_server/backupkey/dcesrv_backupkey.c b/source4/rpc_server/backupkey/dcesrv_backupkey.c index d2c3f2a8545..fd9c101eb8b 100644 --- a/source4/rpc_server/backupkey/dcesrv_backupkey.c +++ b/source4/rpc_server/backupkey/dcesrv_backupkey.c @@ -22,6 +22,7 @@ #include "includes.h" #include "rpc_server/dcerpc_server.h" +#include "rpc_server/common/common.h" #include "librpc/gen_ndr/ndr_backupkey.h" #include "dsdb/common/util.h" #include "dsdb/samdb/samdb.h" @@ -1774,12 +1775,12 @@ static WERROR dcesrv_bkrp_BackupKey(struct dcesrv_call_state *dce_call, return WERR_NOT_SUPPORTED; } - ldb_ctx = 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); + /* + * Save the current remote session details so they can used by the + * audit logging module. This allows the audit logging to report the + * remote users details, rather than the system users details. + */ + ldb_ctx = dcesrv_samdb_connect_as_system(mem_ctx, dce_call); if (samdb_rodc(ldb_ctx, &is_rodc) != LDB_SUCCESS) { talloc_unlink(mem_ctx, ldb_ctx); diff --git a/source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c b/source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c index d2fc4802b08..198a4088ef4 100644 --- a/source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c +++ b/source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c @@ -21,6 +21,7 @@ #include "includes.h" #include "rpc_server/dcerpc_server.h" +#include "rpc_server/common/common.h" #include "librpc/gen_ndr/ndr_backupkey.h" #include "dsdb/common/util.h" #include "dsdb/samdb/samdb.h" @@ -1814,13 +1815,12 @@ static WERROR dcesrv_bkrp_BackupKey(struct dcesrv_call_state *dce_call, return WERR_NOT_SUPPORTED; } - ldb_ctx = 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); - + /* + * Save the current remote session details so they can used by the + * audit logging module. This allows the audit logging to report the + * remote users details, rather than the system users details. + */ + ldb_ctx = dcesrv_samdb_connect_as_system(mem_ctx, dce_call); if (samdb_rodc(ldb_ctx, &is_rodc) != LDB_SUCCESS) { talloc_unlink(mem_ctx, ldb_ctx); return WERR_INVALID_PARAMETER; diff --git a/source4/rpc_server/wscript_build b/source4/rpc_server/wscript_build index 31a5696e270..8e05eb8a0c3 100644 --- a/source4/rpc_server/wscript_build +++ b/source4/rpc_server/wscript_build @@ -133,7 +133,7 @@ else: autoproto='backupkey/proto.h', subsystem='dcerpc_server', init_function='dcerpc_server_backupkey_init', - deps='samdb DCERPC_COMMON NDR_BACKUPKEY RPC_NDR_BACKUPKEY krb5 hx509 hcrypto gnutls gcrypt', + deps='samdb DCERPC_COMMON NDR_BACKUPKEY RPC_NDR_BACKUPKEY krb5 hx509 hcrypto gnutls gcrypt DCERPC_COMMON', )