1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3: get_pipe_name_from_iface -> get_pipe_name_from_syntax

This commit is contained in:
Volker Lendecke 2009-10-31 19:28:16 +01:00
parent bd2ffb1c7a
commit 2aa0af9867
9 changed files with 88 additions and 57 deletions

View File

@ -5703,7 +5703,8 @@ bool prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
/* The following definitions come from rpc_parse/parse_rpc.c */
const char *get_pipe_name_from_iface(const struct ndr_syntax_id *interface);
const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
const struct ndr_syntax_id *interface);
void init_rpc_hdr(RPC_HDR *hdr, enum dcerpc_pkt_type pkt_type, uint8 flags,
uint32 call_id, int data_len, int auth_len);
bool smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth);

View File

@ -199,7 +199,7 @@ WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
status = pipe_cm_open(ctx, cli, interface, &result);
if (!NT_STATUS_IS_OK(status)) {
libnetapi_set_error_string(ctx, "failed to open PIPE %s: %s",
get_pipe_name_from_iface(interface),
get_pipe_name_from_syntax(talloc_tos(), interface),
get_friendly_nt_error_msg(status));
return WERR_DEST_NOT_FOUND;
}

View File

@ -86,7 +86,8 @@ static const struct pipe_id_info {
Return the pipe name from the interface.
****************************************************************************/
const char *get_pipe_name_from_iface(const struct ndr_syntax_id *interface)
const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
const struct ndr_syntax_id *interface)
{
char *guid_str;
const char *result;
@ -107,7 +108,7 @@ const char *get_pipe_name_from_iface(const struct ndr_syntax_id *interface)
if (guid_str == NULL) {
return NULL;
}
result = talloc_asprintf(talloc_tos(), "Interface %s.%d", guid_str,
result = talloc_asprintf(mem_ctx, "Interface %s.%d", guid_str,
(int)interface->if_version);
TALLOC_FREE(guid_str);
@ -3683,7 +3684,7 @@ NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
}
DEBUG(lvl, ("cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe "
"%s failed with error %s\n",
get_pipe_name_from_iface(interface),
get_pipe_name_from_syntax(talloc_tos(), interface),
nt_errstr(status) ));
TALLOC_FREE(result);
return status;
@ -3691,7 +3692,8 @@ NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
DEBUG(10,("cli_rpc_pipe_open_noauth: opened pipe %s to machine "
"%s and bound anonymously.\n",
get_pipe_name_from_iface(interface), cli->desthost));
get_pipe_name_from_syntax(talloc_tos(), interface),
cli->desthost));
*presult = result;
return NT_STATUS_OK;
@ -3749,8 +3751,8 @@ static NTSTATUS cli_rpc_pipe_open_ntlmssp_internal(struct cli_state *cli,
DEBUG(10,("cli_rpc_pipe_open_ntlmssp_internal: opened pipe %s to "
"machine %s and bound NTLMSSP as user %s\\%s.\n",
get_pipe_name_from_iface(interface), cli->desthost, domain,
username ));
get_pipe_name_from_syntax(talloc_tos(), interface),
cli->desthost, domain, username ));
*presult = result;
return NT_STATUS_OK;
@ -3943,7 +3945,7 @@ NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
DEBUG(10,("cli_rpc_pipe_open_schannel_with_key: opened pipe %s to machine %s "
"for domain %s and bound using schannel.\n",
get_pipe_name_from_iface(interface),
get_pipe_name_from_syntax(talloc_tos(), interface),
cli->desthost, domain ));
*presult = result;

View File

@ -301,8 +301,8 @@ struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
}
state->transport->priv = state->transport_np;
state->transport_np->pipe_name = get_pipe_name_from_iface(
abstract_syntax);
state->transport_np->pipe_name = get_pipe_name_from_syntax(
state->transport_np, abstract_syntax);
state->transport_np->cli = cli;
subreq = cli_ntcreate_send(

View File

@ -110,7 +110,8 @@ bool init_pipe_handle_list(pipes_struct *p, const struct ndr_syntax_id *syntax)
ZERO_STRUCTP(hl);
DEBUG(10,("init_pipe_handles: created handle list for "
"pipe %s\n", get_pipe_name_from_iface(syntax)));
"pipe %s\n",
get_pipe_name_from_syntax(talloc_tos(), syntax)));
}
/*
@ -127,7 +128,7 @@ bool init_pipe_handle_list(pipes_struct *p, const struct ndr_syntax_id *syntax)
DEBUG(10,("init_pipe_handles: pipe_handles ref count = %lu for pipe %s\n",
(unsigned long)p->pipe_handles->pipe_ref_count,
get_pipe_name_from_iface(syntax)));
get_pipe_name_from_syntax(talloc_tos(), syntax)));
return True;
}
@ -285,7 +286,8 @@ void close_policy_by_pipe(pipes_struct *p)
SAFE_FREE(p->pipe_handles);
DEBUG(10,("close_policy_by_pipe: deleted handle list for "
"pipe %s\n", get_pipe_name_from_iface(&p->syntax)));
"pipe %s\n",
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
}
}
@ -327,7 +329,7 @@ void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd,
if (p->pipe_handles->count > MAX_OPEN_POLS) {
DEBUG(0, ("policy_handle_create: ERROR: too many handles (%d) "
"on pipe %s.\n", (int)p->pipe_handles->count,
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
*pstatus = NT_STATUS_INSUFFICIENT_RESOURCES;
return NULL;
}

View File

@ -647,7 +647,7 @@ static bool pipe_ntlmssp_verify_final(pipes_struct *p, DATA_BLOB *p_resp_blob)
bool ret;
DEBUG(5,("pipe_ntlmssp_verify_final: pipe %s checking user details\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
ZERO_STRUCT(reply);
@ -671,7 +671,8 @@ static bool pipe_ntlmssp_verify_final(pipes_struct *p, DATA_BLOB *p_resp_blob)
if (!(a->ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_SIGN)) {
DEBUG(0,("pipe_ntlmssp_verify_final: pipe %s : packet integrity requested "
"but client declined signing.\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax)));
return False;
}
}
@ -679,7 +680,8 @@ static bool pipe_ntlmssp_verify_final(pipes_struct *p, DATA_BLOB *p_resp_blob)
if (!(a->ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_SEAL)) {
DEBUG(0,("pipe_ntlmssp_verify_final: pipe %s : packet privacy requested "
"but client declined sealing.\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax)));
return False;
}
}
@ -995,7 +997,7 @@ static bool check_bind_req(struct pipes_struct *p,
struct pipe_rpc_fns *context_fns;
DEBUG(3,("check_bind_req for %s\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
/* we have to check all now since win2k introduced a new UUID on the lsaprpc pipe */
@ -1607,7 +1609,8 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
/* No rebinds on a bound pipe - use alter context. */
if (p->pipe_bound) {
DEBUG(2,("api_pipe_bind_req: rejecting bind request on bound "
"pipe %s.\n", get_pipe_name_from_iface(&p->syntax)));
"pipe %s.\n",
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
return setup_bind_nak(p);
}
@ -1672,12 +1675,15 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
NTSTATUS status;
status = smb_probe_module(
"rpc", get_pipe_name_from_iface(
"rpc", get_pipe_name_from_syntax(
talloc_tos(),
&hdr_rb.rpc_context[0].abstract));
if (NT_STATUS_IS_ERR(status)) {
DEBUG(3,("api_pipe_bind_req: Unknown pipe name %s in bind request.\n",
get_pipe_name_from_iface(&hdr_rb.rpc_context[0].abstract)));
get_pipe_name_from_syntax(
talloc_tos(),
&hdr_rb.rpc_context[0].abstract)));
prs_mem_free(&p->out_data.frag);
prs_mem_free(&out_hdr_ba);
prs_mem_free(&out_auth);
@ -1687,7 +1693,8 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
for (i = 0; i < rpc_lookup_size; i++) {
if (strequal(rpc_lookup[i].pipe.clnt,
get_pipe_name_from_iface(&p->syntax))) {
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax))) {
DEBUG(3, ("api_pipe_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n",
rpc_lookup[i].pipe.clnt, rpc_lookup[i].pipe.srv));
break;
@ -1697,8 +1704,10 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
if (i == rpc_lookup_size) {
DEBUG(0, ("module %s doesn't provide functions for "
"pipe %s!\n",
get_pipe_name_from_iface(&p->syntax),
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax),
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax)));
goto err_exit;
}
}
@ -2356,7 +2365,7 @@ bool api_pipe_request(pipes_struct *p)
}
DEBUG(5, ("Requested \\PIPE\\%s\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
/* get the set of RPC functions for this context */
@ -2370,7 +2379,7 @@ bool api_pipe_request(pipes_struct *p)
else {
DEBUG(0,("api_pipe_request: No rpc function table associated with context [%d] on pipe [%s]\n",
p->hdr_req.context_id,
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
}
if (changed_user) {
@ -2392,12 +2401,13 @@ static bool api_rpcTNP(pipes_struct *p,
/* interpret the command */
DEBUG(4,("api_rpcTNP: %s op 0x%x - ",
get_pipe_name_from_iface(&p->syntax), p->hdr_req.opnum));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax),
p->hdr_req.opnum));
if (DEBUGLEVEL >= 50) {
fstring name;
slprintf(name, sizeof(name)-1, "in_%s",
get_pipe_name_from_iface(&p->syntax));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax));
prs_dump(name, p->hdr_req.opnum, &p->in_data.data);
}
@ -2426,7 +2436,7 @@ static bool api_rpcTNP(pipes_struct *p,
/* do the actual command */
if(!api_rpc_cmds[fn_num].fn(p)) {
DEBUG(0,("api_rpcTNP: %s: %s failed.\n",
get_pipe_name_from_iface(&p->syntax),
get_pipe_name_from_syntax(talloc_tos(), &p->syntax),
api_rpc_cmds[fn_num].name));
prs_mem_free(&p->out_data.rdata);
return False;
@ -2451,13 +2461,13 @@ static bool api_rpcTNP(pipes_struct *p,
if (DEBUGLEVEL >= 50) {
fstring name;
slprintf(name, sizeof(name)-1, "out_%s",
get_pipe_name_from_iface(&p->syntax));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax));
prs_dump(name, p->hdr_req.opnum, &p->out_data.rdata);
}
prs_set_offset(&p->out_data.rdata, offset2);
DEBUG(5,("api_rpcTNP: called %s successfully\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
/* Check for buffer underflow in rpc parsing */

View File

@ -96,7 +96,7 @@ static struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
pipes_struct *p;
DEBUG(4,("Create pipe requested %s\n",
get_pipe_name_from_iface(syntax)));
get_pipe_name_from_syntax(talloc_tos(), syntax)));
p = TALLOC_ZERO_P(mem_ctx, struct pipes_struct);
@ -105,9 +105,10 @@ static struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
return NULL;
}
if ((p->mem_ctx = talloc_init("pipe %s %p",
get_pipe_name_from_iface(syntax),
p)) == NULL) {
p->mem_ctx = talloc_init("pipe %s %p",
get_pipe_name_from_syntax(talloc_tos(),
syntax), p);
if (p->mem_ctx == NULL) {
DEBUG(0,("open_rpc_pipe_p: talloc_init failed.\n"));
TALLOC_FREE(p);
return NULL;
@ -158,7 +159,7 @@ static struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
p->syntax = *syntax;
DEBUG(4,("Created internal pipe %s (pipes_open=%d)\n",
get_pipe_name_from_iface(syntax), pipes_open));
get_pipe_name_from_syntax(talloc_tos(), syntax), pipes_open));
talloc_set_destructor(p, close_internal_rpc_pipe_hnd);
@ -176,7 +177,7 @@ static void set_incoming_fault(pipes_struct *p)
p->in_data.pdu_received_len = 0;
p->fault_state = True;
DEBUG(10, ("set_incoming_fault: Setting fault state on pipe %s\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
}
/****************************************************************************
@ -344,7 +345,9 @@ static void free_pipe_context(pipes_struct *p)
talloc_free_children(p->mem_ctx);
} else {
p->mem_ctx = talloc_init(
"pipe %s %p", get_pipe_name_from_iface(&p->syntax), p);
"pipe %s %p", get_pipe_name_from_syntax(talloc_tos(),
&p->syntax),
p);
if (p->mem_ctx == NULL) {
p->fault_state = True;
}
@ -512,7 +515,7 @@ static void process_complete_pdu(pipes_struct *p)
if(p->fault_state) {
DEBUG(10,("process_complete_pdu: pipe %s in fault state.\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
set_incoming_fault(p);
setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR));
return;
@ -541,12 +544,14 @@ static void process_complete_pdu(pipes_struct *p)
case DCERPC_PKT_PING: /* CL request - ignore... */
DEBUG(0,("process_complete_pdu: Error. Connectionless packet type %u received on pipe %s.\n",
(unsigned int)p->hdr.pkt_type,
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax)));
break;
case DCERPC_PKT_RESPONSE: /* No responses here. */
DEBUG(0,("process_complete_pdu: Error. DCERPC_PKT_RESPONSE received from client on pipe %s.\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax)));
break;
case DCERPC_PKT_FAULT:
@ -559,7 +564,8 @@ static void process_complete_pdu(pipes_struct *p)
case DCERPC_PKT_CANCEL_ACK:
DEBUG(0,("process_complete_pdu: Error. Connectionless packet type %u received on pipe %s.\n",
(unsigned int)p->hdr.pkt_type,
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax)));
break;
case DCERPC_PKT_BIND:
@ -575,7 +581,8 @@ static void process_complete_pdu(pipes_struct *p)
case DCERPC_PKT_BIND_NAK:
DEBUG(0,("process_complete_pdu: Error. DCERPC_PKT_BINDACK/DCERPC_PKT_BINDNACK packet type %u received on pipe %s.\n",
(unsigned int)p->hdr.pkt_type,
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax)));
break;
@ -590,7 +597,8 @@ static void process_complete_pdu(pipes_struct *p)
case DCERPC_PKT_ALTER_RESP:
DEBUG(0,("process_complete_pdu: Error. DCERPC_PKT_ALTER_RESP on pipe %s: Should only be server -> client.\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax)));
break;
case DCERPC_PKT_AUTH3:
@ -604,7 +612,8 @@ static void process_complete_pdu(pipes_struct *p)
case DCERPC_PKT_SHUTDOWN:
DEBUG(0,("process_complete_pdu: Error. DCERPC_PKT_SHUTDOWN on pipe %s: Should only be server -> client.\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(),
&p->syntax)));
break;
case DCERPC_PKT_CO_CANCEL:
@ -643,7 +652,8 @@ static void process_complete_pdu(pipes_struct *p)
if (!reply) {
DEBUG(3,("process_complete_pdu: DCE/RPC fault sent on "
"pipe %s\n", get_pipe_name_from_iface(&p->syntax)));
"pipe %s\n", get_pipe_name_from_syntax(talloc_tos(),
&p->syntax)));
set_incoming_fault(p);
setup_fault_pdu(p, NT_STATUS(DCERPC_FAULT_OP_RNG_ERROR));
prs_mem_free(&rpc_in);
@ -798,7 +808,8 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_
return -1;
}
DEBUG(6,(" name: %s len: %u\n", get_pipe_name_from_iface(&p->syntax),
DEBUG(6,(" name: %s len: %u\n",
get_pipe_name_from_syntax(talloc_tos(), &p->syntax),
(unsigned int)n));
/*
@ -815,7 +826,8 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_
if(n > RPC_MAX_PDU_FRAG_LEN) {
DEBUG(5,("read_from_pipe: too large read (%u) requested on "
"pipe %s. We can only service %d sized reads.\n",
(unsigned int)n, get_pipe_name_from_iface(&p->syntax),
(unsigned int)n,
get_pipe_name_from_syntax(talloc_tos(), &p->syntax),
RPC_MAX_PDU_FRAG_LEN ));
n = RPC_MAX_PDU_FRAG_LEN;
}
@ -836,7 +848,7 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_
DEBUG(10,("read_from_pipe: %s: current_pdu_len = %u, "
"current_pdu_sent = %u returning %d bytes.\n",
get_pipe_name_from_iface(&p->syntax),
get_pipe_name_from_syntax(talloc_tos(), &p->syntax),
(unsigned int)prs_offset(&p->out_data.frag),
(unsigned int)p->out_data.current_pdu_sent,
(int)data_returned));
@ -857,7 +869,8 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_
DEBUG(10,("read_from_pipe: %s: fault_state = %d : data_sent_length "
"= %u, prs_offset(&p->out_data.rdata) = %u.\n",
get_pipe_name_from_iface(&p->syntax), (int)p->fault_state,
get_pipe_name_from_syntax(talloc_tos(), &p->syntax),
(int)p->fault_state,
(unsigned int)p->out_data.data_sent_length,
(unsigned int)prs_offset(&p->out_data.rdata) ));
@ -878,7 +891,7 @@ static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_
if(!create_next_pdu(p)) {
DEBUG(0,("read_from_pipe: %s: create_next_pdu failed.\n",
get_pipe_name_from_iface(&p->syntax)));
get_pipe_name_from_syntax(talloc_tos(), &p->syntax)));
return -1;
}

View File

@ -678,15 +678,16 @@ static NTSTATUS do_cmd(struct cli_state *cli,
default:
DEBUG(0, ("Could not initialise %s. Invalid "
"auth type %u\n",
get_pipe_name_from_iface(
get_pipe_name_from_syntax(
talloc_tos(),
cmd_entry->interface),
pipe_default_auth_type ));
return NT_STATUS_UNSUCCESSFUL;
}
if (!NT_STATUS_IS_OK(ntresult)) {
DEBUG(0, ("Could not initialise %s. Error was %s\n",
get_pipe_name_from_iface(
cmd_entry->interface),
get_pipe_name_from_syntax(
talloc_tos(), cmd_entry->interface),
nt_errstr(ntresult) ));
return ntresult;
}
@ -716,7 +717,8 @@ static NTSTATUS do_cmd(struct cli_state *cli,
if (!NT_STATUS_IS_OK(ntresult)) {
DEBUG(0, ("Could not initialise credentials for %s.\n",
get_pipe_name_from_iface(
get_pipe_name_from_syntax(
talloc_tos(),
cmd_entry->interface)));
return ntresult;
}

View File

@ -182,7 +182,8 @@ int run_rpc_command(struct net_context *c,
}
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("Could not initialise pipe %s. Error was %s\n",
get_pipe_name_from_iface(interface),
get_pipe_name_from_syntax(
talloc_tos(), interface),
nt_errstr(nt_status) ));
goto fail;
}