mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
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>
This commit is contained in:
parent
f89ae36306
commit
7eab9f8850
@ -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>");
|
||||
|
Loading…
x
Reference in New Issue
Block a user