summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-04-05 16:06:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:50:40 -0500
commit220ea5b6e6e4d049cb80c1c206ead6021b807283 (patch)
tree4f841156063241b1c686d8d8dece833c045bd2b4
parent2542ed0ac75d545eef3571bfb19fb39a5b71beb3 (diff)
downloadsamba-220ea5b6e6e4d049cb80c1c206ead6021b807283.tar.gz
samba-220ea5b6e6e4d049cb80c1c206ead6021b807283.tar.bz2
samba-220ea5b6e6e4d049cb80c1c206ead6021b807283.zip
r55: if you try to use a custom bind or unbind hook in
a dcesrv module and also use the autogenerated boilerplate you can just use: #define DCESRV_INTERFACE_<UPPERCASE_INTERFACE_NAME>_BIND <interface_name>_bind #define DCESRV_INTERFACE_<UPPERCASE_INTERFACE_NAME>_UNBIND <interface_name>_unbind the prototype for the functions are the same as in struct dcesrv_interface { ... /* this function is called when the client binds to this interface */ NTSTATUS (*bind)(struct dcesrv_call_state *, const struct dcesrv_interface *); /* this function is called when the client disconnects the endpoint */ void (*unbind)(struct dcesrv_connection *, const struct dcesrv_interface *); ... }; e.g. #define DCESRV_INTERFACE_WINREG_BIND winreg_bind #define DCESRV_INTERFACE_WINREG_UNBIND winreg_unbind metze (This used to be commit ae97f5f50b0d00889f29e1903513cee88891545d)
-rw-r--r--source4/build/pidl/server.pm36
1 files changed, 22 insertions, 14 deletions
diff --git a/source4/build/pidl/server.pm b/source4/build/pidl/server.pm
index 297d4e3248..f8016b2923 100644
--- a/source4/build/pidl/server.pm
+++ b/source4/build/pidl/server.pm
@@ -42,17 +42,25 @@ sub Boilerplate_Iface($)
pidl "\tNULL};\n\n";
pidl "
-static NTSTATUS $name\_op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface)
+static NTSTATUS $name\__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface)
{
- return NT_STATUS_OK;
+#ifdef DCESRV_INTERFACE_$uname\_BIND
+ return DCESRV_INTERFACE_$uname\_BIND(dce_call,iface);
+#else
+ return NT_STATUS_OK;
+#endif
}
-static void $name\_op_unbind(struct dcesrv_connection *dce_conn, const struct dcesrv_interface *iface)
+static void $name\__op_unbind(struct dcesrv_connection *dce_conn, const struct dcesrv_interface *iface)
{
- return;
+#ifdef DCESRV_INTERFACE_$uname\_UNBIND
+ DCESRV_INTERFACE_$uname\_UNBIND(dce_conn,iface);
+#else
+ return;
+#endif
}
-static NTSTATUS $name\_op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
+static NTSTATUS $name\__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
{
uint16 opnum = dce_call->pkt.u.request.opnum;
@@ -61,9 +69,9 @@ static NTSTATUS $name\_op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CT
static const struct dcesrv_interface $name\_interface = {
&dcerpc_table_$name,
- $name\_op_bind,
- $name\_op_unbind,
- $name\_op_dispatch
+ $name\__op_bind,
+ $name\__op_unbind,
+ $name\__op_dispatch
};
";
@@ -88,7 +96,7 @@ sub Boilerplate_Ep_Server($)
}
pidl "
-static NTSTATUS $name\_op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
+static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
{
int i;
@@ -106,7 +114,7 @@ static NTSTATUS $name\_op_init_server(struct dcesrv_context *dce_ctx, const stru
return NT_STATUS_OK;
}
-static BOOL $name\_op_interface_by_uuid(struct dcesrv_interface *iface, const char *uuid, uint32 if_version)
+static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const char *uuid, uint32 if_version)
{
if ($name\_interface.ndr->if_version == if_version &&
strcmp($name\_interface.ndr->uuid, uuid)==0) {
@@ -117,7 +125,7 @@ static BOOL $name\_op_interface_by_uuid(struct dcesrv_interface *iface, const ch
return False;
}
-static BOOL $name\_op_interface_by_name(struct dcesrv_interface *iface, const char *name)
+static BOOL $name\__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
{
if (strcmp($name\_interface.ndr->name, name)==0) {
memcpy(iface,&$name\_interface, sizeof(*iface));
@@ -136,10 +144,10 @@ NTSTATUS dcerpc_$name\_init(void)
ep_server.name = \"$name\";
/* fill in all the operations */
- ep_server.init_server = $name\_op_init_server;
+ ep_server.init_server = $name\__op_init_server;
- ep_server.interface_by_uuid = $name\_op_interface_by_uuid;
- ep_server.interface_by_name = $name\_op_interface_by_name;
+ ep_server.interface_by_uuid = $name\__op_interface_by_uuid;
+ ep_server.interface_by_name = $name\__op_interface_by_name;
/* register ourselves with the DCERPC subsystem. */
ret = register_backend(\"dcerpc\", &ep_server);