diff options
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm index 236e6e17031..14e2cc811da 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/ServerCompat.pm @@ -305,6 +305,8 @@ sub boilerplate_ep_server($) $self->pidl("int i;"); $self->pidl("NTSTATUS ret;"); $self->pidl("struct dcerpc_binding *binding;"); + $self->pidl("const struct api_struct *legacy_cmds = NULL;"); + $self->pidl("int n_fns = 0;"); $self->pidl(""); $self->pidlnoindent("#ifdef DCESRV_INTERFACE_$uname\_NCACN_NP_SECONDARY_ENDPOINT"); $self->pidl("const char *ncacn_np_secondary_endpoint = DCESRV_INTERFACE_$uname\_NCACN_NP_SECONDARY_ENDPOINT;"); @@ -316,7 +318,22 @@ sub boilerplate_ep_server($) $self->indent(); $self->pidl("const char *name = ndr_table_$name.endpoints->names[i];"); $self->pidl(""); - $self->pidl("/* TODO Register the interface for local dispatching */"); + $self->pidl("/* Register the interface for local dispatching */"); + $self->pidl("legacy_cmds = $name\_get_pipe_fns(&n_fns);"); + $self->pidl("if (legacy_cmds == NULL) {"); + $self->indent(); + $self->pidl("DBG_ERR(\"Failed to get legacy \'$name\' API cmds\\n\");"); + $self->pidl("return NT_STATUS_UNSUCCESSFUL;"); + $self->deindent(); + $self->pidl("}"); + $self->pidl(""); + $self->pidl("ret = rpc_srv_register(SMB_RPC_INTERFACE_VERSION, \"$name\", \"$name\", &ndr_table_$name, legacy_cmds, n_fns, NULL);"); + $self->pidl("if (!NT_STATUS_IS_OK(ret)) {"); + $self->indent(); + $self->pidl("DBG_ERR(\"Failed to register legacy \'$name\' API cmds\\n\");"); + $self->pidl("return ret;"); + $self->deindent(); + $self->pidl("}"); $self->pidl(""); $self->pidl("ret = dcerpc_parse_binding(dce_ctx, name, &binding);"); $self->pidl("if (NT_STATUS_IS_ERR(ret)) {"); @@ -353,6 +370,17 @@ sub boilerplate_ep_server($) $self->pidl("static NTSTATUS $name\__op_shutdown_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)"); $self->pidl("{"); $self->indent(); + $self->pidl("NTSTATUS status;"); + $self->pidl(""); + $self->pidl("/* Unregister the interface from local dispatching table */"); + $self->pidl("status = rpc_srv_unregister(&ndr_table_$name);"); + $self->pidl("if (!NT_STATUS_IS_OK(status)) {"); + $self->indent(); + $self->pidl("DBG_ERR(\"Failed to unregister legacy \'$name\' API cmds\\n\");"); + $self->pidl("return status;"); + $self->deindent(); + $self->pidl("}"); + $self->pidl(""); $self->pidl("return NT_STATUS_OK;"); $self->deindent(); $self->pidl("}"); @@ -472,6 +500,7 @@ sub Parse($$) $self->pidl("/* s3 compat server functions auto-generated by pidl */"); $self->pidl("#include \"$header\""); $self->pidl("#include \"$h_scompat\""); + $self->pidl("#include <rpc_server/srv_pipe_register.h>"); $self->pidl("#include <librpc/rpc/dcesrv_core.h>"); $self->pidl("#include <rpc_server/rpc_config.h>"); |