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

Volker Lendecke vlendec at samba.org
Fri Apr 25 09:43:20 GMT 2008


The branch, v3-2-test has been updated
       via  11072ccc7aeb6e087e78cea83959a2f6e0b2f837 (commit)
       via  3433f430b0c1f7d350a40eac783385a2d30d905c (commit)
       via  83892d51de0dcdaeae18bc34d03eefefc95ff601 (commit)
       via  6f08128cf2722618e74b603e180e7e2a83d7d07a (commit)
       via  f9bc336affd2ce21a3c62880ecea2622f35653d1 (commit)
       via  630b9c241cb6db758f8290420a38af452569e903 (commit)
       via  42de50d2cd43e760d776694f7b5f003ba51d7f84 (commit)
       via  f665afaaa3eff9ef54112e08ed034a6e1bb30edc (commit)
      from  205c352caeb32693a02fcfaeb3f18515719ac373 (commit)

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


- Log -----------------------------------------------------------------
commit 11072ccc7aeb6e087e78cea83959a2f6e0b2f837
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Apr 24 22:24:20 2008 +0200

    Add basic ncacn_ip_tcp client infrastructure

commit 3433f430b0c1f7d350a40eac783385a2d30d905c
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Apr 24 20:42:32 2008 +0200

    Introduce a redirection for ncacn_np and ncacn_ip_tcp in rpc_pipe_client
    
    Should be no functional change, just a change in the data structure

commit 83892d51de0dcdaeae18bc34d03eefefc95ff601
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Apr 24 20:24:37 2008 +0200

    Introduce rpccli_pipe_txt(), describing a pipe for debug messages

commit 6f08128cf2722618e74b603e180e7e2a83d7d07a
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 22 18:17:01 2008 +0200

    cli_rpc_pipe_open_noauth must take the user/domain from the smb session

commit f9bc336affd2ce21a3c62880ecea2622f35653d1
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 22 14:31:35 2008 +0200

    Make use of rpccli_xxx_bind_data

commit 630b9c241cb6db758f8290420a38af452569e903
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 22 13:03:06 2008 +0200

    Create rpccli_xxx_bind_data functions
    
    These functions create the auth data for the later bind

commit 42de50d2cd43e760d776694f7b5f003ba51d7f84
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Apr 21 22:27:29 2008 +0200

    Move user/domain from rpc_pipe_client to cli_pipe_auth_data

commit f665afaaa3eff9ef54112e08ed034a6e1bb30edc
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Apr 21 10:39:37 2008 +0200

    Refactoring: Make cli_pipe_auth_data a pointer off rpc_pipe_client

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

Summary of changes:
 source/include/client.h         |   24 +-
 source/libads/ldap_printer.c    |    3 +-
 source/libsmb/trusts_util.c     |    2 +-
 source/rpc_client/cli_pipe.c    | 1013 +++++++++++++++++++++++++--------------
 source/rpc_client/cli_spoolss.c |    2 +-
 source/rpcclient/cmd_spoolss.c  |   39 +-
 source/rpcclient/rpcclient.c    |    6 +-
 source/utils/net_rpc_printer.c  |   10 +-
 8 files changed, 698 insertions(+), 401 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/client.h b/source/include/client.h
index 9cbfa51..7d76b8e 100644
--- a/source/include/client.h
+++ b/source/include/client.h
@@ -49,21 +49,32 @@ struct print_job_info {
 struct cli_pipe_auth_data {
 	enum pipe_auth_type auth_type; /* switch for the union below. Defined in ntdomain.h */
 	enum pipe_auth_level auth_level; /* defined in ntdomain.h */
+
+	char *domain;
+	char *user_name;
+
 	union {
 		struct schannel_auth_struct *schannel_auth;
 		NTLMSSP_STATE *ntlmssp_state;
 		struct kerberos_auth_struct *kerberos_auth;
 	} a_u;
-	void (*cli_auth_data_free_func)(struct cli_pipe_auth_data *);
 };
 
 struct rpc_pipe_client {
 	struct rpc_pipe_client *prev, *next;
 
-	struct cli_state *cli;
+	enum dcerpc_transport_t transport_type;
 
-	const char *pipe_name;
-	uint16 fnum;
+	union {
+		struct {
+			struct cli_state *cli;
+			const char *pipe_name;
+			uint16 fnum;
+		} np;
+		struct {
+			int sock;
+		} tcp;
+	} trans ;
 
 	const struct ndr_syntax_id *abstract_syntax;
 	const struct ndr_syntax_id *transfer_syntax;
@@ -71,13 +82,10 @@ struct rpc_pipe_client {
 	char *desthost;
 	char *srv_name_slash;
 
-	char *domain;
-	char *user_name;
-
 	uint16 max_xmit_frag;
 	uint16 max_recv_frag;
 
-	struct cli_pipe_auth_data auth;
+	struct cli_pipe_auth_data *auth;
 
 	/* The following is only non-null on a netlogon pipe. */
 	struct dcinfo *dc;
diff --git a/source/libads/ldap_printer.c b/source/libads/ldap_printer.c
index 6682ec2..41f23b0 100644
--- a/source/libads/ldap_printer.c
+++ b/source/libads/ldap_printer.c
@@ -296,7 +296,8 @@ WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
 	
 	result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, 
 					     "", MAXIMUM_ALLOWED_ACCESS, 
-					     servername, cli->user_name, &pol);
+					     servername, cli->auth->user_name,
+					     &pol);
 	if (!W_ERROR_IS_OK(result)) {
 		DEBUG(3, ("Unable to open printer %s, error is %s.\n",
 			  printername, dos_errstr(result)));
diff --git a/source/libsmb/trusts_util.c b/source/libsmb/trusts_util.c
index 20ac014..6b3bbaf 100644
--- a/source/libsmb/trusts_util.c
+++ b/source/libsmb/trusts_util.c
@@ -39,7 +39,7 @@ static NTSTATUS just_change_the_password(struct rpc_pipe_client *cli, TALLOC_CTX
 	/* Check if the netlogon pipe is open using schannel. If so we
 	   already have valid creds. If not we must set them up. */
 
-	if (cli->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
+	if (cli->auth->auth_type != PIPE_AUTH_TYPE_SCHANNEL) {
 		uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
 
 		result = rpccli_netlogon_setup_creds(cli, 
diff --git a/source/rpc_client/cli_pipe.c b/source/rpc_client/cli_pipe.c
index 828307c..a3ad774 100644
--- a/source/rpc_client/cli_pipe.c
+++ b/source/rpc_client/cli_pipe.c
@@ -58,6 +58,20 @@ static int map_pipe_auth_type_to_rpc_auth_type(enum pipe_auth_type auth_type)
 }
 
 /********************************************************************
+ Pipe description for a DEBUG
+ ********************************************************************/
+static char *rpccli_pipe_txt(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli)
+{
+	char *result;
+	result = talloc_asprintf(mem_ctx, "host %s, pipe %s, fnum 0x%x",
+				 cli->desthost,
+				 cli->trans.np.pipe_name,
+				 (unsigned int)(cli->trans.np.fnum));
+	SMB_ASSERT(result != NULL);
+	return result;
+}
+
+/********************************************************************
  Rpc pipe call id.
  ********************************************************************/
 
@@ -68,6 +82,58 @@ static uint32 get_rpc_call_id(void)
 }
 
 /*******************************************************************
+ Read from a RPC named pipe
+ ********************************************************************/
+static NTSTATUS rpc_read_np(struct cli_state *cli, const char *pipe_name,
+			    int fnum, char *buf, off_t offset, size_t size,
+			    ssize_t *pnum_read)
+{
+       ssize_t num_read;
+
+       num_read = cli_read(cli, fnum, buf, offset, size);
+
+       DEBUG(5,("rpc_read_np: num_read = %d, read offset: %u, to read: %u\n",
+		(int)num_read, (unsigned int)offset, (unsigned int)size));
+
+       /*
+	* A dos error of ERRDOS/ERRmoredata is not an error.
+	*/
+       if (cli_is_dos_error(cli)) {
+	       uint32 ecode;
+	       uint8 eclass;
+	       cli_dos_error(cli, &eclass, &ecode);
+	       if (eclass != ERRDOS && ecode != ERRmoredata) {
+		       DEBUG(0,("rpc_read: DOS Error %d/%u (%s) in cli_read "
+				"on fnum 0x%x\n", eclass, (unsigned int)ecode,
+				cli_errstr(cli), fnum));
+		       return dos_to_ntstatus(eclass, ecode);
+	       }
+       }
+
+       /*
+	* Likewise for NT_STATUS_BUFFER_TOO_SMALL
+	*/
+       if (cli_is_nt_error(cli)) {
+	       if (!NT_STATUS_EQUAL(cli_nt_error(cli),
+				    NT_STATUS_BUFFER_TOO_SMALL)) {
+		       DEBUG(0,("rpc_read: Error (%s) in cli_read on fnum "
+				"0x%x\n", nt_errstr(cli_nt_error(cli)), fnum));
+		       return cli_nt_error(cli);
+	       }
+       }
+
+       if (num_read == -1) {
+	       DEBUG(0,("rpc_read: Error - cli_read on fnum 0x%x returned "
+			"-1\n", fnum));
+	       return cli_get_nt_error(cli);
+       }
+
+       *pnum_read = num_read;
+       return NT_STATUS_OK;
+}
+
+
+/*******************************************************************
  Use SMBreadX to get rest of one fragment's worth of rpc data.
  Will expand the current_pdu struct to the correct size.
  ********************************************************************/
@@ -101,49 +167,35 @@ static NTSTATUS rpc_read(struct rpc_pipe_client *cli,
 	pdata = prs_data_p(current_pdu) + *current_pdu_offset;
 
 	do {
+		NTSTATUS status;
+
 		/* read data using SMBreadX */
 		if (size > (size_t)data_to_read) {
 			size = (size_t)data_to_read;
 		}
 
-		num_read = cli_read(cli->cli, cli->fnum, pdata,
-					 (off_t)stream_offset, size);
-
-		DEBUG(5,("rpc_read: num_read = %d, read offset: %u, to read: %u\n",
-			(int)num_read, (unsigned int)stream_offset, (unsigned int)data_to_read));
-
-        	/*
-	         * A dos error of ERRDOS/ERRmoredata is not an error.
-		 */
-		if (cli_is_dos_error(cli->cli)) {
-			uint32 ecode;
-			uint8 eclass;
-			cli_dos_error(cli->cli, &eclass, &ecode);
-			if (eclass != ERRDOS && ecode != ERRmoredata) {
-				DEBUG(0,("rpc_read: DOS Error %d/%u (%s) in cli_read on pipe %s\n",
-					eclass, (unsigned int)ecode,
-					cli_errstr(cli->cli),
-					cli->pipe_name ));
-				return dos_to_ntstatus(eclass, ecode);
+		switch (cli->transport_type) {
+		case NCACN_NP:
+			status = rpc_read_np(cli->trans.np.cli,
+					     cli->trans.np.pipe_name,
+					     cli->trans.np.fnum, pdata,
+					     (off_t)stream_offset, size,
+					     &num_read);
+			break;
+		case NCACN_IP_TCP:
+			status = NT_STATUS_OK;
+			num_read = sys_read(cli->trans.tcp.sock, pdata, size);
+			if (num_read == -1) {
+				status = map_nt_error_from_unix(errno);
 			}
-		}
-
-        	/*
-	         * Likewise for NT_STATUS_BUFFER_TOO_SMALL
-		 */
-		if (cli_is_nt_error(cli->cli)) {
-			if (!NT_STATUS_EQUAL(cli_nt_error(cli->cli), NT_STATUS_BUFFER_TOO_SMALL)) {
-				DEBUG(0,("rpc_read: Error (%s) in cli_read on pipe %s\n",
-					nt_errstr(cli_nt_error(cli->cli)),
-					cli->pipe_name ));
-				return cli_nt_error(cli->cli);
+			if (num_read == 0) {
+				status = NT_STATUS_END_OF_FILE;
 			}
-		}
-
-		if (num_read == -1) {
-			DEBUG(0,("rpc_read: Error - cli_read on pipe %s returned -1\n",
-				cli->pipe_name ));
-			return cli_get_nt_error(cli->cli);
+			break;
+		default:
+			DEBUG(0, ("unknown transport type %d\n",
+				  cli->transport_type));
+			return NT_STATUS_INTERNAL_ERROR;
 		}
 
 		data_to_read -= num_read;
@@ -215,7 +267,7 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr
 	RPC_HDR_AUTH auth_info;
 	uint32 save_offset = prs_offset(current_pdu);
 	uint32 auth_len = prhdr->auth_len;
-	NTLMSSP_STATE *ntlmssp_state = cli->auth.a_u.ntlmssp_state;
+	NTLMSSP_STATE *ntlmssp_state = cli->auth->a_u.ntlmssp_state;
 	unsigned char *data = NULL;
 	size_t data_len;
 	unsigned char *full_packet_data = NULL;
@@ -223,7 +275,8 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr
 	DATA_BLOB auth_blob;
 	NTSTATUS status;
 
-	if (cli->auth.auth_level == PIPE_AUTH_LEVEL_NONE || cli->auth.auth_level == PIPE_AUTH_LEVEL_CONNECT) {
+	if (cli->auth->auth_level == PIPE_AUTH_LEVEL_NONE
+	    || cli->auth->auth_level == PIPE_AUTH_LEVEL_CONNECT) {
 		return NT_STATUS_OK;
 	}
 
@@ -267,7 +320,7 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr
 	auth_blob.data = (unsigned char *)prs_data_p(current_pdu) + prs_offset(current_pdu);
 	auth_blob.length = auth_len;
 
-	switch (cli->auth.auth_level) {
+	switch (cli->auth->auth_level) {
 		case PIPE_AUTH_LEVEL_PRIVACY:
 			/* Data is encrypted. */
 			status = ntlmssp_unseal_packet(ntlmssp_state,
@@ -277,11 +330,8 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr
 							&auth_blob);
 			if (!NT_STATUS_IS_OK(status)) {
 				DEBUG(0,("cli_pipe_verify_ntlmssp: failed to unseal "
-					"packet from remote machine %s on pipe %s "
-					"fnum 0x%x. Error was %s.\n",
-					cli->desthost,
-					cli->pipe_name,
-					(unsigned int)cli->fnum,
+					"packet from %s. Error was %s.\n",
+					rpccli_pipe_txt(debug_ctx(), cli),
 					nt_errstr(status) ));
 				return status;
 			}
@@ -295,18 +345,15 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr
 							&auth_blob);
 			if (!NT_STATUS_IS_OK(status)) {
 				DEBUG(0,("cli_pipe_verify_ntlmssp: check signing failed on "
-					"packet from remote machine %s on pipe %s "
-					"fnum 0x%x. Error was %s.\n",
-					cli->desthost,
-					cli->pipe_name,
-					(unsigned int)cli->fnum,
+					"packet from %s. Error was %s.\n",
+					rpccli_pipe_txt(debug_ctx(), cli),
 					nt_errstr(status) ));
 				return status;
 			}
 			break;
 		default:
-			DEBUG(0,("cli_pipe_verify_ntlmssp: unknown internal auth level %d\n",
-				cli->auth.auth_level ));
+			DEBUG(0, ("cli_pipe_verify_ntlmssp: unknown internal "
+				  "auth level %d\n", cli->auth->auth_level));
 			return NT_STATUS_INVALID_INFO_CLASS;
 	}
 
@@ -342,10 +389,12 @@ static NTSTATUS cli_pipe_verify_schannel(struct rpc_pipe_client *cli, RPC_HDR *p
 	RPC_AUTH_SCHANNEL_CHK schannel_chk;
 	uint32 auth_len = prhdr->auth_len;
 	uint32 save_offset = prs_offset(current_pdu);
-	struct schannel_auth_struct *schannel_auth = cli->auth.a_u.schannel_auth;
+	struct schannel_auth_struct *schannel_auth =
+		cli->auth->a_u.schannel_auth;
 	uint32 data_len;
 
-	if (cli->auth.auth_level == PIPE_AUTH_LEVEL_NONE || cli->auth.auth_level == PIPE_AUTH_LEVEL_CONNECT) {
+	if (cli->auth->auth_level == PIPE_AUTH_LEVEL_NONE
+	    || cli->auth->auth_level == PIPE_AUTH_LEVEL_CONNECT) {
 		return NT_STATUS_OK;
 	}
 
@@ -392,17 +441,14 @@ static NTSTATUS cli_pipe_verify_schannel(struct rpc_pipe_client *cli, RPC_HDR *p
 	}
 
 	if (!schannel_decode(schannel_auth,
-			cli->auth.auth_level,
+			cli->auth->auth_level,
 			SENDER_IS_ACCEPTOR,
 			&schannel_chk,
 			prs_data_p(current_pdu)+RPC_HEADER_LEN+RPC_HDR_RESP_LEN,
 			data_len)) {
 		DEBUG(3,("cli_pipe_verify_schannel: failed to decode PDU "
-				"Connection to remote machine %s "
-				"pipe %s fnum 0x%x.\n",
-				cli->desthost,
-				cli->pipe_name,
-				(unsigned int)cli->fnum ));
+				"Connection to %s.\n",
+				rpccli_pipe_txt(debug_ctx(), cli)));
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
@@ -456,14 +502,13 @@ static NTSTATUS cli_pipe_validate_rpc_response(struct rpc_pipe_client *cli, RPC_
 	 * Now we have a complete RPC request PDU fragment, try and verify any auth data.
 	 */
 
-	switch(cli->auth.auth_type) {
+	switch(cli->auth->auth_type) {
 		case PIPE_AUTH_TYPE_NONE:
 			if (prhdr->auth_len) {
-				DEBUG(3, ("cli_pipe_validate_rpc_response: Connection to remote machine %s "
-					"pipe %s fnum 0x%x - got non-zero auth len %u.\n",
-					cli->desthost,
-					cli->pipe_name,
-					(unsigned int)cli->fnum,
+				DEBUG(3, ("cli_pipe_validate_rpc_response: "
+					  "Connection to %s - got non-zero "
+					  "auth len %u.\n",
+					rpccli_pipe_txt(debug_ctx(), cli),
 					(unsigned int)prhdr->auth_len ));
 				return NT_STATUS_INVALID_PARAMETER;
 			}
@@ -487,12 +532,10 @@ static NTSTATUS cli_pipe_validate_rpc_response(struct rpc_pipe_client *cli, RPC_
 		case PIPE_AUTH_TYPE_KRB5:
 		case PIPE_AUTH_TYPE_SPNEGO_KRB5:
 		default:
-			DEBUG(3, ("cli_pipe_validate_rpc_response: Connection to remote machine %s "
-				"pipe %s fnum %x - unknown internal auth type %u.\n",
-				cli->desthost,
-				cli->pipe_name,
-				(unsigned int)cli->fnum,
-				cli->auth.auth_type ));
+			DEBUG(3, ("cli_pipe_validate_rpc_response: Connection "
+				  "to %s - unknown internal auth type %u.\n",
+				  rpccli_pipe_txt(debug_ctx(), cli),
+				  cli->auth->auth_type ));
 			return NT_STATUS_INVALID_INFO_CLASS;
 	}
 
@@ -593,11 +636,9 @@ static NTSTATUS cli_pipe_validate_current_pdu(struct rpc_pipe_client *cli, RPC_H
 		}
 
 		case RPC_BINDNACK:
-			DEBUG(1, ("cli_pipe_validate_current_pdu: Bind NACK received from remote machine %s "
-				"pipe %s fnum 0x%x!\n",
-				cli->desthost,
-				cli->pipe_name,
-				(unsigned int)cli->fnum));
+			DEBUG(1, ("cli_pipe_validate_current_pdu: Bind NACK "
+				  "received from %s!\n",
+				  rpccli_pipe_txt(debug_ctx(), cli)));
 			/* Use this for now... */
 			return NT_STATUS_NETWORK_ACCESS_DENIED;
 
@@ -616,12 +657,10 @@ static NTSTATUS cli_pipe_validate_current_pdu(struct rpc_pipe_client *cli, RPC_H
 				return NT_STATUS_BUFFER_TOO_SMALL;
 			}
 
-			DEBUG(1, ("cli_pipe_validate_current_pdu: RPC fault code %s received from remote machine %s "
-				"pipe %s fnum 0x%x!\n",
+			DEBUG(1, ("cli_pipe_validate_current_pdu: RPC fault "
+				  "code %s received from %s!\n",
 				dcerpc_errstr(NT_STATUS_V(fault_resp.status)),
-				cli->desthost,
-				cli->pipe_name,
-				(unsigned int)cli->fnum));
+				rpccli_pipe_txt(debug_ctx(), cli)));
 			if (NT_STATUS_IS_OK(fault_resp.status)) {
 				return NT_STATUS_UNSUCCESSFUL;
 			} else {
@@ -631,21 +670,16 @@ static NTSTATUS cli_pipe_validate_current_pdu(struct rpc_pipe_client *cli, RPC_H
 
 		default:
 			DEBUG(0, ("cli_pipe_validate_current_pdu: unknown packet type %u received "
-				"from remote machine %s pipe %s fnum 0x%x!\n",
+				"from %s!\n",
 				(unsigned int)prhdr->pkt_type,
-				cli->desthost,
-				cli->pipe_name,
-				(unsigned int)cli->fnum));
+				rpccli_pipe_txt(debug_ctx(), cli)));
 			return NT_STATUS_INVALID_INFO_CLASS;
 	}
 
 	if (prhdr->pkt_type != expected_pkt_type) {
-		DEBUG(3, ("cli_pipe_validate_current_pdu: Connection to remote machine %s "
-			"pipe %s fnum %x got an unexpected RPC packet "
-			"type - %u, not %u\n",
-			cli->desthost,
-			cli->pipe_name,
-			(unsigned int)cli->fnum,
+		DEBUG(3, ("cli_pipe_validate_current_pdu: Connection to %s "
+			  "got an unexpected RPC packet type - %u, not %u\n",
+			rpccli_pipe_txt(debug_ctx(), cli),
 			prhdr->pkt_type,
 			expected_pkt_type));
 		return NT_STATUS_INVALID_INFO_CLASS;
@@ -741,7 +775,6 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli,
 	NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
 	char *rparam = NULL;
 	uint32 rparam_len = 0;
-	uint16 setup[2];
 	char *pdata = prs_data_p(data);
 	uint32 data_len = prs_offset(data);
 	char *prdata = NULL;
@@ -758,38 +791,71 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli,
 	/* Set up the current pdu parse struct. */
 	prs_init_empty(&current_pdu, prs_get_mem_context(rbuf), UNMARSHALL);
 
-	/* Create setup parameters - must be in native byte order. */
-	setup[0] = TRANSACT_DCERPCCMD; 
-	setup[1] = cli->fnum; /* Pipe file handle. */
+	DEBUG(5,("rpc_api_pipe: %s\n", rpccli_pipe_txt(debug_ctx(), cli)));
 
-	DEBUG(5,("rpc_api_pipe: Remote machine %s pipe %s fnum 0x%x\n",
-		cli->desthost,
-		cli->pipe_name,
-		(unsigned int)cli->fnum ));
+	switch (cli->transport_type) {
+	case NCACN_NP: {
+		uint16 setup[2];
+		/* Create setup parameters - must be in native byte order. */
+		setup[0] = TRANSACT_DCERPCCMD;
+		setup[1] = cli->trans.np.fnum; /* Pipe file handle. */
 
-	/*
-	 * Send the last (or only) fragment of an RPC request. For small
-	 * amounts of data (about 1024 bytes or so) the RPC request and response
-	 * appears in a SMBtrans request and response.
-	 */
+		/*
+		 * Send the last (or only) fragment of an RPC request. For
+		 * small amounts of data (about 1024 bytes or so) the RPC
+		 * request and response appears in a SMBtrans request and
+		 * response.
+		 */
 
-	if (!cli_api_pipe(cli->cli, "\\PIPE\\",
-	          setup, 2, 0,                     /* Setup, length, max */
-	          NULL, 0, 0,                      /* Params, length, max */
-	          pdata, data_len, max_data,   	   /* data, length, max */
-	          &rparam, &rparam_len,            /* return params, len */
-	          &prdata, &rdata_len))            /* return data, len */
+		if (!cli_api_pipe(cli->trans.np.cli, "\\PIPE\\",
+				  setup, 2, 0,     /* Setup, length, max */
+				  NULL, 0, 0,      /* Params, length, max */
+				  pdata, data_len, max_data, /* data, length,
+							      * max */
+				  &rparam, &rparam_len, /* return params,
+							 * len */
+				  &prdata, &rdata_len)) /* return data, len */
+		{
+			DEBUG(0, ("rpc_api_pipe: %s returned critical error. "
+				  "Error was %s\n",
+				  rpccli_pipe_txt(debug_ctx(), cli),
+				  cli_errstr(cli->trans.np.cli)));
+			ret = cli_get_nt_error(cli->trans.np.cli);
+			SAFE_FREE(rparam);
+			SAFE_FREE(prdata);
+			goto err;
+		}
+		break;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list