#include "../lib/util/tevent_ntstatus.h"
#include "rpc_contexts.h"
#include "rpc_server/rpc_config.h"
+#include "librpc/ndr/ndr_table.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
struct pipe_rpc_fns *context_fns;
const char *pipe_name;
int ret;
+ const struct ndr_interface_table *table;
- pipe_name = get_pipe_name_from_syntax(talloc_tos(), syntax);
+ table = ndr_table_by_uuid(&syntax->uuid);
+ if (table == NULL) {
+ DEBUG(0,("unknown interface\n"));
+ return NULL;
+ }
+
+ pipe_name = dcerpc_default_transport_endpoint(mem_ctx, NCACN_NP, table);
DEBUG(4,("Create pipe requested %s\n", pipe_name));
GLOBAL_SECTION_SNUM, "external_rpc_pipe", "socket_dir",
lp_ncalrpc_dir());
if (socket_dir == NULL) {
- DEBUG(0, ("externan_rpc_pipe:socket_dir not set\n"));
+ DEBUG(0, ("external_rpc_pipe:socket_dir not set\n"));
goto fail;
}
socket_np_dir = talloc_asprintf(talloc_tos(), "%s/np", socket_dir);
&result->allocation_size);
TALLOC_FREE(subreq);
if (ret != 0) {
- DEBUG(0, ("tstream_npa_connect_recv to %s for pipe %s and "
+ int l = 1;
+ if (errno == ENOENT) {
+ l = 2;
+ }
+ DEBUG(l, ("tstream_npa_connect_recv to %s for pipe %s and "
"user %s\\%s failed: %s\n",
socket_np_dir, pipe_name, session_info_t->session_info->info->domain_name,
session_info_t->session_info->info->account_name,
static NTSTATUS rpc_pipe_open_external(TALLOC_CTX *mem_ctx,
const char *pipe_name,
- const struct ndr_syntax_id *abstract_syntax,
+ const struct ndr_interface_table *table,
const struct auth_session_info *session_info,
struct rpc_pipe_client **_result)
{
goto done;
}
- result->abstract_syntax = *abstract_syntax;
+ result->abstract_syntax = table->syntax_id;
result->transfer_syntax = ndr_transfer_syntax_ndr;
result->desthost = get_myname(result);
goto done;
}
- result->binding_handle = rpccli_bh_create(result);
+ result->binding_handle = rpccli_bh_create(result, NULL, table);
if (result->binding_handle == NULL) {
status = NT_STATUS_NO_MEMORY;
DEBUG(0, ("Failed to create binding handle.\n"));
*/
NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
- const struct ndr_syntax_id *syntax,
+ const struct ndr_interface_table *table,
const struct auth_session_info *session_info,
const struct tsocket_address *remote_address,
struct messaging_context *msg_ctx,
NTSTATUS status;
TALLOC_CTX *tmp_ctx;
- if (cli_pipe && rpccli_is_connected(*cli_pipe)) {
- return NT_STATUS_OK;
- } else {
- TALLOC_FREE(*cli_pipe);
+ if (cli_pipe != NULL) {
+ if (rpccli_is_connected(*cli_pipe)) {
+ return NT_STATUS_OK;
+ } else {
+ TALLOC_FREE(*cli_pipe);
+ }
}
tmp_ctx = talloc_stackframe();
return NT_STATUS_NO_MEMORY;
}
- pipe_name = get_pipe_name_from_syntax(tmp_ctx, syntax);
+ pipe_name = dcerpc_default_transport_endpoint(mem_ctx, NCACN_NP, table);
if (pipe_name == NULL) {
status = NT_STATUS_INVALID_PARAMETER;
goto done;
switch (pipe_mode) {
case RPC_SERVICE_MODE_EMBEDDED:
status = rpc_pipe_open_internal(tmp_ctx,
- syntax, session_info,
+ &table->syntax_id, session_info,
remote_address, msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
* to spoolssd. */
status = rpc_pipe_open_external(tmp_ctx,
- pipe_name, syntax,
+ pipe_name, table,
session_info,
&cli);
if (!NT_STATUS_IS_OK(status)) {
status = NT_STATUS_OK;
done:
- if (NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_IS_OK(status) && cli_pipe != NULL) {
*cli_pipe = talloc_move(mem_ctx, &cli);
}
TALLOC_FREE(tmp_ctx);