diff options
author | Samuel Cabrero <scabrero@suse.de> | 2019-02-26 17:37:52 +0100 |
---|---|---|
committer | Samuel Cabrero <scabrero@sn-devel-184> | 2020-03-20 15:36:32 +0000 |
commit | 7eab9f88509c4bb49a9c9c149491536190d1d979 (patch) | |
tree | bd5c13941e1d8a96f2999d8116328afa72d59c42 /pidl | |
parent | f89ae36306cfb4dd0e205d27b6e2a4121d4761c8 (diff) | |
download | samba-7eab9f88509c4bb49a9c9c149491536190d1d979.tar.gz |
pidl:NDR/ServerCompat: Register and unregister legacy api_struct cmds
Next commits will initialize the registered enpoint servers in S3 RPC
server, removing the rpc_{interface}_init calls. The legacy api_struct
registration will be registered by the enpoint server initialization
code generated by PIDL.
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'pidl')
-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>"); |