[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-1015-ga30a26d

Volker Lendecke vlendec at samba.org
Sun Apr 20 12:42:24 GMT 2008


The branch, v3-2-test has been updated
       via  a30a26d471a572167ee13bf10be1a275a6592851 (commit)
       via  c56e1c08cef107ff33a34346ceeca3475a102b19 (commit)
       via  7331c4c2781bf7904942c119f1a8de8eda00ae7e (commit)
       via  99fc3283c4ecc791f5a242bd1983b4352ce3e6cf (commit)
       via  45be749ed69f8c1ad3ebe8ea1f35c806db2ed5d0 (commit)
       via  4840febcd481563c3d9b2fabc1fe1b2ae5a76cf6 (commit)
       via  d8a04b798c44c26a91a37fa7090dd071a1909166 (commit)
      from  3f6c5b99664a75a6f490ee3b6980b89cacf7f579 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit a30a26d471a572167ee13bf10be1a275a6592851
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Apr 20 14:07:38 2008 +0200

    Make convert_samr_dispinfo_to_NET_DISPLAY() static

commit c56e1c08cef107ff33a34346ceeca3475a102b19
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Apr 20 14:05:25 2008 +0200

    Introduce rpc_pipe_np_smb_conn()
    
    This abstracts away all references to rpc_pipe_client->cli, the only reference
    is now in cli_pipe.c.

commit 7331c4c2781bf7904942c119f1a8de8eda00ae7e
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Apr 20 14:02:21 2008 +0200

    Remove a redundant reference to rpc_pipe_state->cli from srv_spoolss
    
    This assignment is done in cli_rpc_pipe_open called from
    cli_rpc_pipe_open_noauth already.

commit 99fc3283c4ecc791f5a242bd1983b4352ce3e6cf
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Apr 20 13:51:46 2008 +0200

    Replace cli_rpc_pipe_close by a talloc destructor on rpc_pipe_struct

commit 45be749ed69f8c1ad3ebe8ea1f35c806db2ed5d0
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Apr 20 12:19:27 2008 +0200

    Refactoring: Move stuff around for creating a pipe

commit 4840febcd481563c3d9b2fabc1fe1b2ae5a76cf6
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Apr 20 11:45:41 2008 +0200

    Remove the pipe_idx variable from rpc_pipe_client

commit d8a04b798c44c26a91a37fa7090dd071a1909166
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Apr 20 11:27:24 2008 +0200

    Remove some unused code referencing pipe_names[]

-----------------------------------------------------------------------

Summary of changes:
 source/client/client.c             |    4 +-
 source/include/client.h            |   12 ++-
 source/include/rpc_client.h        |    2 +-
 source/lib/netapi/cm.c             |    4 +-
 source/lib/netapi/user.c           |   10 +-
 source/libnet/libnet_join.c        |    6 +-
 source/libsmb/clientgen.c          |   48 +--------
 source/libsmb/libsmb_dir.c         |    2 +-
 source/libsmb/libsmb_xattr.c       |    2 +-
 source/libsmb/passchange.c         |    2 +-
 source/rpc_client/cli_netlogon.c   |    2 +-
 source/rpc_client/cli_pipe.c       |  210 ++++++++++++++++++------------------
 source/rpc_client/ndr.c            |    2 +-
 source/rpc_parse/parse_rpc.c       |    3 +-
 source/rpc_server/srv_spoolss_nt.c |    6 +-
 source/rpcclient/cmd_spoolss.c     |    2 +-
 source/rpcclient/cmd_test.c        |   10 +-
 source/rpcclient/rpcclient.c       |    6 +-
 source/utils/net_rpc.c             |   39 ++++----
 source/utils/net_rpc_join.c        |    8 +-
 source/utils/net_rpc_shell.c       |    2 +-
 source/utils/net_util.c            |    2 +-
 source/utils/smbcacls.c            |    8 +-
 source/utils/smbtree.c             |    4 +-
 source/winbindd/winbindd_cm.c      |   52 ++++-----
 25 files changed, 200 insertions(+), 248 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/client.c b/source/client/client.c
index 1c9c21e..b4e1985 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -3658,7 +3658,7 @@ static bool browse_host_rpc(bool sort)
 					      &werr);
 
 	if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(werr)) {
-		cli_rpc_pipe_close(pipe_hnd);
+		TALLOC_FREE(pipe_hnd);
 		TALLOC_FREE(frame);
 		return false;
 	}
@@ -3668,7 +3668,7 @@ static bool browse_host_rpc(bool sort)
 		browse_fn(info.name, info.type, info.comment, NULL);
 	}
 
-	cli_rpc_pipe_close(pipe_hnd);
+	TALLOC_FREE(pipe_hnd);
 	TALLOC_FREE(frame);
 	return true;
 }
diff --git a/source/include/client.h b/source/include/client.h
index af03e2b..5cfc9a6 100644
--- a/source/include/client.h
+++ b/source/include/client.h
@@ -62,15 +62,17 @@ struct rpc_pipe_client {
 
 	struct cli_state *cli;
 
-	int pipe_idx;
 	const char *pipe_name;
 	uint16 fnum;
 
-	const char *desthost;
-	const char *srv_name_slash;
+	const struct ndr_syntax_id *abstract_syntax;
+	const struct ndr_syntax_id *transfer_syntax;
 
-	const char *domain;
-	const char *user_name;
+	char *desthost;
+	char *srv_name_slash;
+
+	char *domain;
+	char *user_name;
 	struct pwd_info pwd;
 
 	uint16 max_xmit_frag;
diff --git a/source/include/rpc_client.h b/source/include/rpc_client.h
index c552271..ce0c932 100644
--- a/source/include/rpc_client.h
+++ b/source/include/rpc_client.h
@@ -91,7 +91,7 @@
 #define CLI_DO_RPC_WERR( pcli, ctx, p_idx, opnum, q_in, r_out, \
                              q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \
 {\
-	SMB_ASSERT(pcli->pipe_idx == p_idx); \
+	SMB_ASSERT(rpccli_is_pipe_idx(pcli, p_idx)); \
 	if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \
 		return WERR_NOMEM;\
 	}\
diff --git a/source/lib/netapi/cm.c b/source/lib/netapi/cm.c
index 5464237..ae1091c 100644
--- a/source/lib/netapi/cm.c
+++ b/source/lib/netapi/cm.c
@@ -99,13 +99,13 @@ static struct rpc_pipe_client *pipe_cm_find(struct cli_state *cli,
 
 	for (p = pipe_connections; p; p = p->next) {
 
-		if (!p->pipe->cli) {
+		if (!rpc_pipe_np_smb_conn(p->pipe)) {
 			*status = NT_STATUS_PIPE_EMPTY;
 			return NULL;
 		}
 
 		if (strequal(cli->desthost, p->pipe->desthost) &&
-		    pipe_idx == p->pipe->pipe_idx) {
+		    rpccli_is_pipe_idx(p->pipe, pipe_idx)) {
 			*status = NT_STATUS_OK;
 			return p->pipe;
 		}
diff --git a/source/lib/netapi/user.c b/source/lib/netapi/user.c
index 05a0510..f2dc785 100644
--- a/source/lib/netapi/user.c
+++ b/source/lib/netapi/user.c
@@ -845,11 +845,11 @@ static WERROR convert_samr_dispinfo_to_NET_DISPLAY_GROUP(TALLOC_CTX *mem_ctx,
 /****************************************************************
 ****************************************************************/
 
-WERROR convert_samr_dispinfo_to_NET_DISPLAY(TALLOC_CTX *mem_ctx,
-					    union samr_DispInfo *info,
-					    uint32_t level,
-					    uint32_t *entries_read,
-					    void **buffer)
+static WERROR convert_samr_dispinfo_to_NET_DISPLAY(TALLOC_CTX *mem_ctx,
+						   union samr_DispInfo *info,
+						   uint32_t level,
+						   uint32_t *entries_read,
+						   void **buffer)
 {
 	switch (level) {
 		case 1:
diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c
index 207a3ac..d22fbc2 100644
--- a/source/libnet/libnet_join.c
+++ b/source/libnet/libnet_join.c
@@ -706,7 +706,7 @@ static NTSTATUS libnet_join_lookup_dc_rpc(TALLOC_CTX *mem_ctx,
 	}
 
 	rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol);
-	cli_rpc_pipe_close(pipe_hnd);
+	TALLOC_FREE(pipe_hnd);
 
  done:
 	return status;
@@ -951,7 +951,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
 	if (is_valid_policy_hnd(&user_pol)) {
 		rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
 	}
-	cli_rpc_pipe_close(pipe_hnd);
+	TALLOC_FREE(pipe_hnd);
 
 	return status;
 }
@@ -1217,7 +1217,7 @@ done:
 	if (pipe_hnd) {
 		rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
 		rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);
-		cli_rpc_pipe_close(pipe_hnd);
+		TALLOC_FREE(pipe_hnd);
 	}
 
 	if (cli) {
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index ef2c263..e64b6fa 100644
--- a/source/libsmb/clientgen.c
+++ b/source/libsmb/clientgen.c
@@ -617,54 +617,16 @@ struct cli_state *cli_initialise(void)
 }
 
 /****************************************************************************
- External interface.
- Close an open named pipe over SMB. Free any authentication data.
- Returns false if the cli_close call failed.
- ****************************************************************************/
-
-bool cli_rpc_pipe_close(struct rpc_pipe_client *cli)
-{
-	bool ret;
-
-	if (!cli) {
-		return false;
-	}
-
-	ret = cli_close(cli->cli, cli->fnum);
-
-	if (!ret) {
-		DEBUG(1,("cli_rpc_pipe_close: cli_close failed on pipe %s, "
-                         "fnum 0x%x "
-                         "to machine %s.  Error was %s\n",
-                         cli->pipe_name,
-                         (int) cli->fnum,
-                         cli->desthost,
-                         cli_errstr(cli->cli)));
-	}
-
-	if (cli->auth.cli_auth_data_free_func) {
-		(*cli->auth.cli_auth_data_free_func)(&cli->auth);
-	}
-
-	DEBUG(10,("cli_rpc_pipe_close: closed pipe %s to machine %s\n",
-		cli->pipe_name, cli->desthost ));
-
-	DLIST_REMOVE(cli->cli->pipe_list, cli);
-	talloc_destroy(cli);
-	return ret;
-}
-
-/****************************************************************************
  Close all pipes open on this session.
 ****************************************************************************/
 
 void cli_nt_pipes_close(struct cli_state *cli)
 {
-	struct rpc_pipe_client *cp, *next;
-
-	for (cp = cli->pipe_list; cp; cp = next) {
-		next = cp->next;
-		cli_rpc_pipe_close(cp);
+	while (cli->pipe_list != NULL) {
+		/*
+		 * No TALLOC_FREE here!
+		 */
+		talloc_free(cli->pipe_list);
 	}
 }
 
diff --git a/source/libsmb/libsmb_dir.c b/source/libsmb/libsmb_dir.c
index 612a877..aea4f10 100644
--- a/source/libsmb/libsmb_dir.c
+++ b/source/libsmb/libsmb_dir.c
@@ -319,7 +319,7 @@ net_share_enum_rpc(struct cli_state *cli,
 
 done:
         /* Close the server service pipe */
-        cli_rpc_pipe_close(pipe_hnd);
+        TALLOC_FREE(pipe_hnd);
 
         /* Tell 'em if it worked */
         return W_ERROR_IS_OK(result) ? 0 : -1;
diff --git a/source/libsmb/libsmb_xattr.c b/source/libsmb/libsmb_xattr.c
index e17146e..8763205 100644
--- a/source/libsmb/libsmb_xattr.c
+++ b/source/libsmb/libsmb_xattr.c
@@ -39,7 +39,7 @@ find_lsa_pipe_hnd(struct cli_state *ipc_cli)
              pipe_hnd;
              pipe_hnd = pipe_hnd->next) {
                 
-		if (pipe_hnd->pipe_idx == PI_LSARPC) {
+		if (rpccli_is_pipe_idx(pipe_hnd, PI_LSARPC)) {
 			return pipe_hnd;
 		}
 	}
diff --git a/source/libsmb/passchange.c b/source/libsmb/passchange.c
index 2f9a87d..8f7cbf2 100644
--- a/source/libsmb/passchange.c
+++ b/source/libsmb/passchange.c
@@ -196,7 +196,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
 	}
 
 	/* OK, that failed, so try again... */
-	cli_rpc_pipe_close(pipe_hnd);
+	TALLOC_FREE(pipe_hnd);
 	
 	/* Try anonymous NTLMSSP... */
 	cli_init_creds(cli, "", "", NULL);
diff --git a/source/rpc_client/cli_netlogon.c b/source/rpc_client/cli_netlogon.c
index bf1e161..cb1d93e 100644
--- a/source/rpc_client/cli_netlogon.c
+++ b/source/rpc_client/cli_netlogon.c
@@ -134,7 +134,7 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
 	struct dcinfo *dc;
 	bool retried = false;
 
-	SMB_ASSERT(cli->pipe_idx == PI_NETLOGON);
+	SMB_ASSERT(rpccli_is_pipe_idx(cli, PI_NETLOGON));
 
 	dc = cli->dc;
 	if (!dc) {
diff --git a/source/rpc_client/cli_pipe.c b/source/rpc_client/cli_pipe.c
index bc9a426..1ea01c9 100644
--- a/source/rpc_client/cli_pipe.c
+++ b/source/rpc_client/cli_pipe.c
@@ -1066,7 +1066,10 @@ static NTSTATUS create_schannel_auth_rpc_bind_req( struct rpc_pipe_client *cli,
 	/* Use lp_workgroup() if domain not specified */
 
 	if (!cli->domain || !cli->domain[0]) {
-		cli->domain = lp_workgroup();
+		cli->domain = talloc_strdup(cli, lp_workgroup());
+		if (cli->domain == NULL) {
+			return NT_STATUS_NO_MEMORY;
+		}
 	}
 
 	init_rpc_auth_schannel_neg(&schannel_neg, cli->domain, global_myname());
@@ -1092,8 +1095,8 @@ static NTSTATUS create_schannel_auth_rpc_bind_req( struct rpc_pipe_client *cli,
 static NTSTATUS create_bind_or_alt_ctx_internal(enum RPC_PKT_TYPE pkt_type,
 						prs_struct *rpc_out, 
 						uint32 rpc_call_id,
-						RPC_IFACE *abstract,
-						RPC_IFACE *transfer,
+						const RPC_IFACE *abstract,
+						const RPC_IFACE *transfer,
 						RPC_HDR_AUTH *phdr_auth,
 						prs_struct *pauth_info)
 {
@@ -1174,7 +1177,8 @@ static NTSTATUS create_bind_or_alt_ctx_internal(enum RPC_PKT_TYPE pkt_type,
 static NTSTATUS create_rpc_bind_req(struct rpc_pipe_client *cli,
 				prs_struct *rpc_out, 
 				uint32 rpc_call_id,
-				RPC_IFACE *abstract, RPC_IFACE *transfer,
+				const RPC_IFACE *abstract,
+				const RPC_IFACE *transfer,
 				enum pipe_auth_type auth_type,
 				enum pipe_auth_level auth_level)
 {
@@ -1639,56 +1643,12 @@ static bool rpc_pipe_set_hnd_state(struct rpc_pipe_client *cli,
  Check the rpc bind acknowledge response.
 ****************************************************************************/
 
-static bool valid_pipe_name(const int pipe_idx, RPC_IFACE *abstract, RPC_IFACE *transfer)
-{
-	if ( pipe_idx >= PI_MAX_PIPES ) {
-		DEBUG(0,("valid_pipe_name: Programmer error!  Invalid pipe index [%d]\n",
-			pipe_idx));
-		return False;
-	}
-
-	DEBUG(5,("Bind Abstract Syntax: "));	
-	dump_data(5, (uint8 *)&pipe_names[pipe_idx].abstr_syntax, 
-	          sizeof(pipe_names[pipe_idx].abstr_syntax));
-	DEBUG(5,("Bind Transfer Syntax: "));
-	dump_data(5, (uint8 *)&pipe_names[pipe_idx].trans_syntax,
-	          sizeof(pipe_names[pipe_idx].trans_syntax));
-
-	/* copy the required syntaxes out so we can do the right bind */
-	
-	*transfer = *pipe_names[pipe_idx].trans_syntax;
-	*abstract = *pipe_names[pipe_idx].abstr_syntax;
-
-	return True;
-}
-
-/****************************************************************************
- Check the rpc bind acknowledge response.
-****************************************************************************/
-
-static bool check_bind_response(RPC_HDR_BA *hdr_ba, const int pipe_idx, RPC_IFACE *transfer)
+static bool check_bind_response(RPC_HDR_BA *hdr_ba, const RPC_IFACE *transfer)
 {
 	if ( hdr_ba->addr.len == 0) {
 		DEBUG(4,("Ignoring length check -- ASU bug (server didn't fill in the pipe name correctly)"));
 	}
 
-# if 0	/* JERRY -- apparently ASU forgets to fill in the server pipe name sometimes */
-	if ( !strequal(hdr_ba->addr.str, pipe_names[pipe_idx].client_pipe) &&
-	     !strequal(hdr_ba->addr.str, pipe_names[pipe_idx].server_pipe) )
-	{
-		DEBUG(4,("bind_rpc_pipe: pipe_name %s != expected pipe %s.  oh well!\n",
-		         pipe_names[i].server_pipe ,hdr_ba->addr.str));
-		return False;
-	}
-	
-	DEBUG(5,("bind_rpc_pipe: server pipe_name found: %s\n", pipe_names[i].server_pipe ));
-
-	if (pipe_names[pipe_idx].server_pipe == NULL) {
-		DEBUG(2,("bind_rpc_pipe: pipe name %s unsupported\n", hdr_ba->addr.str));
-		return False;
-	}
-#endif 	/* JERRY */
-
 	/* check the transfer syntax */
 	if ((hdr_ba->transfer.if_version != transfer->if_version) ||
 	     (memcmp(&hdr_ba->transfer.uuid, &transfer->uuid, sizeof(transfer->uuid)) !=0)) {
@@ -1856,8 +1816,8 @@ static NTSTATUS rpc_finish_auth3_bind(struct rpc_pipe_client *cli,
  ********************************************************************/
 
 static NTSTATUS create_rpc_alter_context(uint32 rpc_call_id,
-					RPC_IFACE *abstract,
-					RPC_IFACE *transfer,
+					const RPC_IFACE *abstract,
+					const RPC_IFACE *transfer,
 					enum pipe_auth_level auth_level,
 					const DATA_BLOB *pauth_blob, /* spnego auth blob already created. */
 					prs_struct *rpc_out)
@@ -1900,8 +1860,8 @@ static NTSTATUS rpc_finish_spnego_ntlmssp_bind(struct rpc_pipe_client *cli,
                                 RPC_HDR *phdr,
                                 prs_struct *rbuf,
                                 uint32 rpc_call_id,
-				RPC_IFACE *abstract,
-				RPC_IFACE *transfer,
+				const RPC_IFACE *abstract,
+				const RPC_IFACE *transfer,
                                 enum pipe_auth_type auth_type,
                                 enum pipe_auth_level auth_level)
 {
@@ -2035,8 +1995,6 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
 {
 	RPC_HDR hdr;
 	RPC_HDR_BA hdr_ba;
-	RPC_IFACE abstract;
-	RPC_IFACE transfer;
 	prs_struct rpc_out;
 	prs_struct rbuf;
 	uint32 rpc_call_id;
@@ -2048,17 +2006,14 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
 		(unsigned int)auth_type,
 		(unsigned int)auth_level ));
 
-	if (!valid_pipe_name(cli->pipe_idx, &abstract, &transfer)) {
-		return NT_STATUS_INVALID_PARAMETER;
-	}
-
 	prs_init_empty(&rpc_out, talloc_tos(), MARSHALL);
 
 	rpc_call_id = get_rpc_call_id();
 
 	/* Marshall the outgoing data. */
 	status = create_rpc_bind_req(cli, &rpc_out, rpc_call_id,
-				&abstract, &transfer,
+				cli->abstract_syntax,
+				cli->transfer_syntax,
 				auth_type,
 				auth_level);
 
@@ -2098,7 +2053,7 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
 		return NT_STATUS_BUFFER_TOO_SMALL;
 	}
 
-	if(!check_bind_response(&hdr_ba, cli->pipe_idx, &transfer)) {
+	if(!check_bind_response(&hdr_ba, cli->transfer_syntax)) {
 		DEBUG(2,("rpc_pipe_bind: check_bind_response failed.\n"));
 		prs_mem_free(&rbuf);
 		return NT_STATUS_BUFFER_TOO_SMALL;
@@ -2128,7 +2083,8 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
 		case PIPE_AUTH_TYPE_SPNEGO_NTLMSSP:
 			/* Need to send alter context request and reply. */
 			status = rpc_finish_spnego_ntlmssp_bind(cli, &hdr, &rbuf, rpc_call_id,
-						&abstract, &transfer,
+						cli->abstract_syntax,
+						cli->transfer_syntax,
 						auth_type, auth_level);
 			if (!NT_STATUS_IS_OK(status)) {
 				prs_mem_free(&rbuf);
@@ -2179,6 +2135,40 @@ unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
 	return cli_set_timeout(cli->cli, timeout);
 }
 
+bool rpccli_is_pipe_idx(struct rpc_pipe_client *cli, int pipe_idx)
+{
+	return (cli->abstract_syntax == pipe_names[pipe_idx].abstr_syntax);
+}
+
+struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p)
+{
+	return p->cli;
+}
+
+static int rpc_pipe_destructor(struct rpc_pipe_client *p)
+{
+	bool ret;
+
+	ret = cli_close(p->cli, p->fnum);
+	if (!ret) {
+		DEBUG(1, ("rpc_pipe_destructor: cli_close failed on pipe %s, "
+			  "fnum 0x%x to machine %s.  Error was %s\n",
+			  p->pipe_name, (int) p->fnum,
+			  p->desthost, cli_errstr(p->cli)));
+	}
+
+	if (p->auth.cli_auth_data_free_func) {
+		(*p->auth.cli_auth_data_free_func)(&p->auth);
+	}
+
+	DEBUG(10, ("rpc_pipe_destructor: closed pipe %s to machine %s\n",
+		   p->pipe_name, p->desthost ));
+
+	DLIST_REMOVE(p->cli->pipe_list, p);
+
+	return ret ? -1 : 0;
+}
+
 /****************************************************************************
  Open a named pipe over SMB to a remote server.
  *
@@ -2211,38 +2201,29 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe
 
 	result = TALLOC_ZERO_P(NULL, struct rpc_pipe_client);
 	if (result == NULL) {
+		*perr = NT_STATUS_NO_MEMORY;
 		return NULL;
 	}
 
 	result->pipe_name = cli_get_pipe_name(pipe_idx);
 
-	fnum = cli_nt_create(cli, result->pipe_name, DESIRED_ACCESS_PIPE);
-
-	if (fnum == -1) {
-		DEBUG(1,("cli_rpc_pipe_open: cli_nt_create failed on pipe %s "
-			 "to machine %s.  Error was %s\n",
-			 result->pipe_name, cli->desthost,
-			 cli_errstr(cli)));
-		*perr = cli_get_nt_error(cli);
-		talloc_destroy(result);
-		return NULL;
-	}
-
-	result->fnum = fnum;
 	result->cli = cli;
-	result->pipe_idx = pipe_idx;
+	result->abstract_syntax = pipe_names[pipe_idx].abstr_syntax;
+	result->transfer_syntax = pipe_names[pipe_idx].trans_syntax;
 	result->auth.auth_type = PIPE_AUTH_TYPE_NONE;
 	result->auth.auth_level = PIPE_AUTH_LEVEL_NONE;
 
+	result->domain = talloc_strdup(result, cli->domain);
+	result->user_name = talloc_strdup(result, cli->user_name);
 	result->desthost = talloc_strdup(result, cli->desthost);
-	if (result->desthost == NULL) {
-		TALLOC_FREE(result);
-		return NULL;
-	}
-
 	result->srv_name_slash = talloc_asprintf_strupper_m(
 		result, "\\\\%s", result->desthost);
-	if (result->srv_name_slash == NULL) {
+
+	if ((result->domain == NULL)
+	    || (result->user_name == NULL)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list