s4:rpc_server: only pass context to op_bind() hooks
authorStefan Metzmacher <metze@samba.org>
Wed, 21 Nov 2018 19:06:21 +0000 (20:06 +0100)
committerJeremy Allison <jra@samba.org>
Sat, 12 Jan 2019 02:13:39 +0000 (03:13 +0100)
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>
15 files changed:
pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
source4/rpc_server/backupkey/dcesrv_backupkey.c
source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c
source4/rpc_server/dcerpc_server.c
source4/rpc_server/dcerpc_server.h
source4/rpc_server/dcesrv_mgmt.c
source4/rpc_server/dnsserver/dcerpc_dnsserver.c
source4/rpc_server/drsuapi/dcesrv_drsuapi.c
source4/rpc_server/echo/rpc_echo.c
source4/rpc_server/epmapper/rpc_epmapper.c
source4/rpc_server/lsa/dcesrv_lsa.c
source4/rpc_server/netlogon/dcerpc_netlogon.c
source4/rpc_server/remote/dcesrv_remote.c
source4/rpc_server/samr/dcesrv_samr.c
source4/torture/rpc/spoolss_notify.c

index ad36f000077c6486cc94e8ac66e9589f3ad5e937..e228a762591348101c4153de9f078b704f1560f7 100644 (file)
@@ -81,10 +81,10 @@ sub Boilerplate_Iface($)
        my $if_version = $interface->{VERSION};
 
        pidl "
-static NTSTATUS $name\__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
+static NTSTATUS $name\__op_bind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
 {
 #ifdef DCESRV_INTERFACE_$uname\_BIND
-       return DCESRV_INTERFACE_$uname\_BIND(dce_call,iface);
+       return DCESRV_INTERFACE_$uname\_BIND(context,iface);
 #else
        return NT_STATUS_OK;
 #endif
index 307a7f09b74e8a8391c5bd51fef883d417edc6a8..a826ae083f439777cc4946ecfa93b7a488a20d20 100644 (file)
 #include <gnutls/crypto.h>
 #include <gnutls/abstract.h>
 
-#define DCESRV_INTERFACE_BACKUPKEY_BIND(call, iface) \
-       dcesrv_interface_backupkey_bind(call, iface)
-static NTSTATUS dcesrv_interface_backupkey_bind(struct dcesrv_call_state *dce_call,
+#define DCESRV_INTERFACE_BACKUPKEY_BIND(context, iface) \
+       dcesrv_interface_backupkey_bind(context, iface)
+static NTSTATUS dcesrv_interface_backupkey_bind(struct dcesrv_connection_context *context,
                                                const struct dcesrv_interface *iface)
 {
-       struct dcesrv_connection_context *context = dce_call->context;
        return dcesrv_interface_bind_require_privacy(context, iface);
 }
 
index 05113a9cc74faf2f61bc042d7383816bbdb6775e..60d082378d75af5cd1b4bded51070a792a613250 100644 (file)
 #include <gcrypt.h>
 #endif
 
-#define DCESRV_INTERFACE_BACKUPKEY_BIND(call, iface) \
-       dcesrv_interface_backupkey_bind(call, iface)
-static NTSTATUS dcesrv_interface_backupkey_bind(struct dcesrv_call_state *dce_call,
+#define DCESRV_INTERFACE_BACKUPKEY_BIND(context, iface) \
+       dcesrv_interface_backupkey_bind(context, iface)
+static NTSTATUS dcesrv_interface_backupkey_bind(struct dcesrv_connection_context *context,
                                                const struct dcesrv_interface *iface)
 {
-       struct dcesrv_connection_context *context = dce_call->context;
        return dcesrv_interface_bind_require_privacy(context, iface);
 }
 
index 9717a24d6378fbae92c1b88478ed899e0dba1e0e..d9ed390a49894f9e609161ac3ed45ef772545fdf 100644 (file)
@@ -1510,7 +1510,7 @@ static NTSTATUS dcesrv_check_or_create_context(struct dcesrv_call_state *call,
         */
        call->state_flags |= DCESRV_CALL_STATE_FLAG_MULTIPLEXED;
 
-       status = iface->bind(call, iface, if_version);
+       status = iface->bind(context, iface);
        call->context = NULL;
        if (!NT_STATUS_IS_OK(status)) {
                /* we don't want to trigger the iface->unbind() hook */
index dfe48883353d37952a1cf3f593de5a65c6fb5dc8..8e404c0591c1c7657ee82fc8f343e00281b51e26 100644 (file)
@@ -45,7 +45,7 @@ struct dcesrv_interface {
        struct ndr_syntax_id syntax_id;
 
        /* this function is called when the client binds to this interface  */
-       NTSTATUS (*bind)(struct dcesrv_call_state *, const struct dcesrv_interface *, uint32_t if_version);
+       NTSTATUS (*bind)(struct dcesrv_connection_context *, const struct dcesrv_interface *);
 
        /* this function is called when the client disconnects the endpoint */
        void (*unbind)(struct dcesrv_connection_context *, const struct dcesrv_interface *);
index 210a86de6ee0b0708fe2d3364eb5be4ebbbe49c4..e520a34f0bd54cdb8e21488123e4614bf018478e 100644 (file)
@@ -24,8 +24,8 @@
 #include "rpc_server/dcerpc_server_proto.h"
 #include "librpc/gen_ndr/ndr_mgmt.h"
 
-#define DCESRV_INTERFACE_MGMT_BIND(call, iface) \
-       dcesrv_interface_mgmt_bind(call, iface)
+#define DCESRV_INTERFACE_MGMT_BIND(context, iface) \
+       dcesrv_interface_mgmt_bind(context, iface)
 /*
  * This #define allows the mgmt interface to accept invalid
  * association groups, because association groups are to coordinate
 
 #define DCESRV_INTERFACE_MGMT_FLAGS DCESRV_INTERFACE_FLAGS_HANDLES_NOT_USED
 
-static NTSTATUS dcesrv_interface_mgmt_bind(struct dcesrv_call_state *dce_call,
+static NTSTATUS dcesrv_interface_mgmt_bind(struct dcesrv_connection_context *context,
                                             const struct dcesrv_interface *iface)
 {
-       struct dcesrv_connection_context *context = dce_call->context;
        return dcesrv_interface_bind_allow_connect(context, iface);
 }
 
index 7c2ca8e4d5283553506a8db69a4934d3b827f0fb..841557814a0290d4fbc39ee41a950285f3f679d3 100644 (file)
 #include "dns_server/dnsserver_common.h"
 #include "dnsserver.h"
 
-#define DCESRV_INTERFACE_DNSSERVER_BIND(call, iface) \
-       dcesrv_interface_dnsserver_bind(call, iface)
-static NTSTATUS dcesrv_interface_dnsserver_bind(struct dcesrv_call_state *dce_call,
+#define DCESRV_INTERFACE_DNSSERVER_BIND(context, iface) \
+       dcesrv_interface_dnsserver_bind(context, iface)
+static NTSTATUS dcesrv_interface_dnsserver_bind(struct dcesrv_connection_context *context,
                                                const struct dcesrv_interface *iface)
 {
-       struct dcesrv_connection_context *context = dce_call->context;
        return dcesrv_interface_bind_require_integrity(context, iface);
 }
 
index 347823ebca321c405a93ec4817807af7791496ba..7e2b6174d2fdd29bd7333260e77744bb6345842f 100644 (file)
        DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); \
 } while (0)
 
-#define DCESRV_INTERFACE_DRSUAPI_BIND(call, iface) \
-       dcesrv_interface_drsuapi_bind(call, iface)
-static NTSTATUS dcesrv_interface_drsuapi_bind(struct dcesrv_call_state *dce_call,
+#define DCESRV_INTERFACE_DRSUAPI_BIND(context, iface) \
+       dcesrv_interface_drsuapi_bind(context, iface)
+static NTSTATUS dcesrv_interface_drsuapi_bind(struct dcesrv_connection_context *context,
                                              const struct dcesrv_interface *iface)
 {
-       struct dcesrv_connection_context *context = dce_call->context;
        return dcesrv_interface_bind_require_privacy(context, iface);
 }
 
index e00eaecbd456cc4072623d7bbc003a09ae4c90d7..b0baf82d7d0bbc3232c1e75be118f673c887b154 100644 (file)
 #include "librpc/gen_ndr/ndr_echo.h"
 #include "lib/events/events.h"
 
-#define DCESRV_INTERFACE_RPCECHO_BIND(call, iface) \
-       dcesrv_interface_rpcecho_bind(call, iface)
-static NTSTATUS dcesrv_interface_rpcecho_bind(struct dcesrv_call_state *dce_call,
+#define DCESRV_INTERFACE_RPCECHO_BIND(context, iface) \
+       dcesrv_interface_rpcecho_bind(context, iface)
+static NTSTATUS dcesrv_interface_rpcecho_bind(struct dcesrv_connection_context *context,
                                              const struct dcesrv_interface *iface)
 {
-       struct dcesrv_connection_context *context = dce_call->context;
        return dcesrv_interface_bind_allow_connect(context, iface);
 }
 
index 7e9c2614f298a6e28f9087ba3e652f62b30b2401..793070d470e7df13696678aa5b10589f0ff25c9a 100644 (file)
 #include "librpc/gen_ndr/ndr_epmapper.h"
 #include "rpc_server/dcerpc_server.h"
 
-#define DCESRV_INTERFACE_EPMAPPER_BIND(call, iface) \
-       dcesrv_interface_epmapper_bind(call, iface)
-static NTSTATUS dcesrv_interface_epmapper_bind(struct dcesrv_call_state *dce_call,
+#define DCESRV_INTERFACE_EPMAPPER_BIND(context, iface) \
+       dcesrv_interface_epmapper_bind(context, iface)
+static NTSTATUS dcesrv_interface_epmapper_bind(struct dcesrv_connection_context *context,
                                             const struct dcesrv_interface *iface)
 {
-       struct dcesrv_connection_context *context = dce_call->context;
        return dcesrv_interface_bind_allow_connect(context, iface);
 }
 
index 4a1bf60ac64e60fa20b91bb6dc669d022ef1948f..ec3be02bf876e307579ba3fa635233e5878704b8 100644 (file)
 #include "lib/messaging/irpc.h"
 #include "libds/common/roles.h"
 
-#define DCESRV_INTERFACE_LSARPC_BIND(call, iface) \
-       dcesrv_interface_lsarpc_bind(call, iface)
-static NTSTATUS dcesrv_interface_lsarpc_bind(struct dcesrv_call_state *dce_call,
+#define DCESRV_INTERFACE_LSARPC_BIND(context, iface) \
+       dcesrv_interface_lsarpc_bind(context, iface)
+static NTSTATUS dcesrv_interface_lsarpc_bind(struct dcesrv_connection_context *context,
                                             const struct dcesrv_interface *iface)
 {
-       struct dcesrv_connection_context *context = dce_call->context;
        return dcesrv_interface_bind_reject_connect(context, iface);
 }
 
index ca3dba374b9614b2e825280ddaf81c7e02f5f08f..530350d442acc67575fa29b7d14f6dec7a3f5f93 100644 (file)
@@ -45,8 +45,8 @@
 #include "rpc_server/common/sid_helper.h"
 #include "lib/util/util_str_escape.h"
 
-#define DCESRV_INTERFACE_NETLOGON_BIND(call, iface) \
-       dcesrv_interface_netlogon_bind(call, iface)
+#define DCESRV_INTERFACE_NETLOGON_BIND(context, iface) \
+       dcesrv_interface_netlogon_bind(context, iface)
 
 /*
  * This #define allows the netlogon interface to accept invalid
  */
 #define DCESRV_INTERFACE_NETLOGON_FLAGS DCESRV_INTERFACE_FLAGS_HANDLES_NOT_USED
 
-static NTSTATUS dcesrv_interface_netlogon_bind(struct dcesrv_call_state *dce_call,
+static NTSTATUS dcesrv_interface_netlogon_bind(struct dcesrv_connection_context *context,
                                               const struct dcesrv_interface *iface)
 {
-       struct dcesrv_connection_context *context = dce_call->context;
        return dcesrv_interface_bind_reject_connect(context, iface);
 }
 
index a4abb4bc2cd3498878e07ab13a31fcc4d62dbf63..0d3b123bcd243e3e3b93954dc4b514a4f76aa931 100644 (file)
@@ -45,7 +45,8 @@ static NTSTATUS remote_op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *
        return NT_STATUS_OK;
 }
 
-static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
+static NTSTATUS remote_op_bind(struct dcesrv_connection_context *context,
+                              const struct dcesrv_interface *iface)
 {
        return NT_STATUS_OK;
 }
index 0ddbaae835d4230b147314c7c000248712950eea..51fed4da62b3edfe703509c77025ada433080ac0 100644 (file)
 #include "lib/util/tsort.h"
 #include "libds/common/flag_mapping.h"
 
-#define DCESRV_INTERFACE_SAMR_BIND(call, iface) \
-       dcesrv_interface_samr_bind(call, iface)
-static NTSTATUS dcesrv_interface_samr_bind(struct dcesrv_call_state *dce_call,
+#define DCESRV_INTERFACE_SAMR_BIND(context, iface) \
+       dcesrv_interface_samr_bind(context, iface)
+static NTSTATUS dcesrv_interface_samr_bind(struct dcesrv_connection_context *context,
                                             const struct dcesrv_interface *iface)
 {
-       struct dcesrv_connection_context *context = dce_call->context;
        return dcesrv_interface_bind_reject_connect(context, iface);
 }
 
index 718ae703bc92a423650a8b3c15143c4fb7b6f333..2dd12994e8da47a33f5d34014e34abbd6787e262 100644 (file)
@@ -33,9 +33,8 @@
 #include "ntvfs/ntvfs.h"
 #include "param/param.h"
 
-static NTSTATUS spoolss__op_bind(struct dcesrv_call_state *dce_call,
-                                const struct dcesrv_interface *iface,
-                                uint32_t if_version)
+static NTSTATUS spoolss__op_bind(struct dcesrv_connection_context *context,
+                                const struct dcesrv_interface *iface)
 {
        return NT_STATUS_OK;
 }