summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-02-01 00:30:04 +0100
committerVolker Lendecke <vl@samba.org>2009-02-01 14:34:22 +0100
commit57de60a83f3f88566d356547eb20a6f0569f76ec (patch)
treeacdc73ad43f6a115ef07c767f87ace3f60551cd8 /source3/rpc_client
parentdba6624dca024d144b0adb1016d17d176d38b735 (diff)
downloadsamba-57de60a83f3f88566d356547eb20a6f0569f76ec.tar.gz
samba-57de60a83f3f88566d356547eb20a6f0569f76ec.tar.bz2
samba-57de60a83f3f88566d356547eb20a6f0569f76ec.zip
cli_get_pipe_name_from_interface does not really need a talloc_ctx
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_pipe.c30
-rw-r--r--source3/rpc_client/rpc_transport_np.c13
2 files changed, 22 insertions, 21 deletions
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index a741dec706..cee5d1cfc8 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -81,9 +81,10 @@ static const struct pipe_id_info {
Return the pipe name from the interface.
****************************************************************************/
-const char *cli_get_pipe_name_from_iface(TALLOC_CTX *mem_ctx,
- const struct ndr_syntax_id *interface)
+const char *get_pipe_name_from_iface(const struct ndr_syntax_id *interface)
{
+ char *guid_str;
+ const char *result;
int i;
for (i = 0; pipe_names[i].client_pipe; i++) {
if (ndr_syntax_id_equal(pipe_names[i].abstr_syntax,
@@ -97,7 +98,18 @@ const char *cli_get_pipe_name_from_iface(TALLOC_CTX *mem_ctx,
* interested in the known pipes mentioned in pipe_names[]
*/
- return NULL;
+ guid_str = GUID_string(talloc_tos(), &interface->uuid);
+ if (guid_str == NULL) {
+ return NULL;
+ }
+ result = talloc_asprintf(talloc_tos(), "Interface %s.%d", guid_str,
+ (int)interface->if_version);
+ TALLOC_FREE(guid_str);
+
+ if (result == NULL) {
+ return "PIPE";
+ }
+ return result;
}
/********************************************************************
@@ -3649,8 +3661,7 @@ NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
}
DEBUG(lvl, ("cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe "
"%s failed with error %s\n",
- cli_get_pipe_name_from_iface(debug_ctx(),
- interface),
+ get_pipe_name_from_iface(interface),
nt_errstr(status) ));
TALLOC_FREE(result);
return status;
@@ -3658,8 +3669,7 @@ NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
DEBUG(10,("cli_rpc_pipe_open_noauth: opened pipe %s to machine "
"%s and bound anonymously.\n",
- cli_get_pipe_name_from_iface(debug_ctx(), interface),
- cli->desthost ));
+ get_pipe_name_from_iface(interface), cli->desthost));
*presult = result;
return NT_STATUS_OK;
@@ -3705,8 +3715,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",
- cli_get_pipe_name_from_iface(debug_ctx(), interface),
- cli->desthost, domain, username ));
+ get_pipe_name_from_iface(interface), cli->desthost, domain,
+ username ));
*presult = result;
return NT_STATUS_OK;
@@ -3897,7 +3907,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",
- cli_get_pipe_name_from_iface(debug_ctx(), interface),
+ get_pipe_name_from_iface(interface),
cli->desthost, domain ));
*presult = result;
diff --git a/source3/rpc_client/rpc_transport_np.c b/source3/rpc_client/rpc_transport_np.c
index 68aae6a0cc..a11e0e0f22 100644
--- a/source3/rpc_client/rpc_transport_np.c
+++ b/source3/rpc_client/rpc_transport_np.c
@@ -286,7 +286,6 @@ struct async_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
{
struct async_req *result, *subreq;
struct rpc_transport_np_init_state *state;
- NTSTATUS status;
if (!async_req_setup(mem_ctx, &result, &state,
struct rpc_transport_np_init_state)) {
@@ -304,12 +303,8 @@ struct async_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
}
state->transport->priv = state->transport_np;
- state->transport_np->pipe_name = cli_get_pipe_name_from_iface(
- state, abstract_syntax);
- if (state->transport_np->pipe_name == NULL) {
- status = NT_STATUS_PIPE_NOT_AVAILABLE;
- goto post_status;
- }
+ state->transport_np->pipe_name = get_pipe_name_from_iface(
+ abstract_syntax);
state->transport_np->cli = cli;
subreq = cli_ntcreate_send(
@@ -323,10 +318,6 @@ struct async_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
subreq->async.priv = result;
return result;
- post_status:
- if (async_post_status(result, ev, status)) {
- return result;
- }
fail:
TALLOC_FREE(result);
return NULL;