]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
rpc_server backupkey: pass remote connection data
authorGary Lockyer <gary@catalyst.net.nz>
Wed, 30 May 2018 02:45:03 +0000 (14:45 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 31 May 2018 10:35:15 +0000 (12:35 +0200)
Ensure that the requesting session data is passed to the audit logging
module for BackupKey requests.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu May 31 12:35:15 CEST 2018 on sn-devel-144

source4/rpc_server/backupkey/dcesrv_backupkey.c
source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c
source4/rpc_server/wscript_build

index d2c3f2a854532c6d9dde301b4ed33a16c0f7b9ee..fd9c101eb8bbd05c9e063f664121c5083423e0e6 100644 (file)
@@ -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);
index d2fc4802b086f10726c868868a92ca162f08eb8a..198a4088ef4b327765e51238fbee6288e7e61629 100644 (file)
@@ -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;
index 31a5696e27068e84c54fa9ce7360a849af123445..8e05eb8a0c3bbe4266debd053e5664b6ba36e208 100644 (file)
@@ -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',
                )