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

Volker Lendecke vlendec at samba.org
Fri Apr 25 14:31:34 GMT 2008


The branch, v3-2-test has been updated
       via  ec46de7e0550ea94ade60af29734de8891804c87 (commit)
       via  72b279a630d41f217095b373e07633e7cf92567e (commit)
       via  3c58d39a1e17478cfd7c29ede02f80d35e9855bb (commit)
       via  40f908f6d518aeea512b4ebe35d08eca5a532b73 (commit)
       via  ba7ebc81caff56701dda76f1a008334607a53f56 (commit)
       via  0a0ef2dd451a5715739e86414a47752dc8c86143 (commit)
       via  5bc7abf8bb9a91177f3a72943d0a6a030054fd83 (commit)
       via  614652ad8f540b5875600ac263c66d691a2b3642 (commit)
       via  707de9f4edc42440fdd573c397272ef82841e045 (commit)
      from  192ffa3835c407d5603f47c1633a075869daae01 (commit)

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


- Log -----------------------------------------------------------------
commit ec46de7e0550ea94ade60af29734de8891804c87
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 25 16:31:31 2008 +0200

    Revert "Refactoring: Make cli_pipe_auth_data a pointer off rpc_pipe_client"
    
    This reverts commit f665afaaa3eff9ef54112e08ed034a6e1bb30edc.

commit 72b279a630d41f217095b373e07633e7cf92567e
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 25 16:31:25 2008 +0200

    Revert "Move user/domain from rpc_pipe_client to cli_pipe_auth_data"
    
    This reverts commit 42de50d2cd43e760d776694f7b5f003ba51d7f84.

commit 3c58d39a1e17478cfd7c29ede02f80d35e9855bb
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 25 16:31:14 2008 +0200

    Revert "Create rpccli_xxx_bind_data functions"
    
    This reverts commit 630b9c241cb6db758f8290420a38af452569e903.

commit 40f908f6d518aeea512b4ebe35d08eca5a532b73
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 25 16:31:08 2008 +0200

    Revert "Make use of rpccli_xxx_bind_data"
    
    This reverts commit f9bc336affd2ce21a3c62880ecea2622f35653d1.

commit ba7ebc81caff56701dda76f1a008334607a53f56
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 25 16:31:00 2008 +0200

    Revert "cli_rpc_pipe_open_noauth must take the user/domain from the smb session"
    
    This reverts commit 6f08128cf2722618e74b603e180e7e2a83d7d07a.

commit 0a0ef2dd451a5715739e86414a47752dc8c86143
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 25 16:30:55 2008 +0200

    Revert "Introduce rpccli_pipe_txt(), describing a pipe for debug messages"
    
    This reverts commit 83892d51de0dcdaeae18bc34d03eefefc95ff601.

commit 5bc7abf8bb9a91177f3a72943d0a6a030054fd83
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 25 16:30:50 2008 +0200

    Revert "Introduce a redirection for ncacn_np and ncacn_ip_tcp in rpc_pipe_client"
    
    This reverts commit 3433f430b0c1f7d350a40eac783385a2d30d905c.

commit 614652ad8f540b5875600ac263c66d691a2b3642
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 25 16:30:45 2008 +0200

    Revert "Add basic ncacn_ip_tcp client infrastructure"
    
    This reverts commit 11072ccc7aeb6e087e78cea83959a2f6e0b2f837.

commit 707de9f4edc42440fdd573c397272ef82841e045
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 25 16:30:39 2008 +0200

    Revert "Attempt to fix the non-krb build"
    
    This reverts commit 31d80a476701c89bf236997f2ab68bd2765579bd.

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

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    | 1017 ++++++++++++++-------------------------
 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, 401 insertions(+), 702 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/client.h b/source/include/client.h
index 7d76b8e..9cbfa51 100644
--- a/source/include/client.h
+++ b/source/include/client.h
@@ -49,32 +49,21 @@ 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;
 
-	enum dcerpc_transport_t transport_type;
+	struct cli_state *cli;
 
-	union {
-		struct {
-			struct cli_state *cli;
-			const char *pipe_name;
-			uint16 fnum;
-		} np;
-		struct {
-			int sock;
-		} tcp;
-	} trans ;
+	const char *pipe_name;
+	uint16 fnum;
 
 	const struct ndr_syntax_id *abstract_syntax;
 	const struct ndr_syntax_id *transfer_syntax;
@@ -82,10 +71,13 @@ 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 41f23b0..6682ec2 100644
--- a/source/libads/ldap_printer.c
+++ b/source/libads/ldap_printer.c
@@ -296,8 +296,7 @@ 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->auth->user_name,
-					     &pol);
+					     servername, cli->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 6b3bbaf..20ac014 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 7e381f2..828307c 100644
--- a/source/rpc_client/cli_pipe.c
+++ b/source/rpc_client/cli_pipe.c
@@ -58,20 +58,6 @@ 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.
  ********************************************************************/
 
@@ -82,58 +68,6 @@ 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.
  ********************************************************************/
@@ -167,35 +101,49 @@ 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;
 		}
 
-		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);
+		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);
 			}
-			if (num_read == 0) {
-				status = NT_STATUS_END_OF_FILE;
+		}
+
+        	/*
+	         * 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);
 			}
-			break;
-		default:
-			DEBUG(0, ("unknown transport type %d\n",
-				  cli->transport_type));
-			return NT_STATUS_INTERNAL_ERROR;
+		}
+
+		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);
 		}
 
 		data_to_read -= num_read;
@@ -267,7 +215,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;
@@ -275,8 +223,7 @@ 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;
 	}
 
@@ -320,7 +267,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,
@@ -330,8 +277,11 @@ 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 %s. Error was %s.\n",
-					rpccli_pipe_txt(debug_ctx(), cli),
+					"packet from remote machine %s on pipe %s "
+					"fnum 0x%x. Error was %s.\n",
+					cli->desthost,
+					cli->pipe_name,
+					(unsigned int)cli->fnum,
 					nt_errstr(status) ));
 				return status;
 			}
@@ -345,15 +295,18 @@ 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 %s. Error was %s.\n",
-					rpccli_pipe_txt(debug_ctx(), cli),
+					"packet from remote machine %s on pipe %s "
+					"fnum 0x%x. Error was %s.\n",
+					cli->desthost,
+					cli->pipe_name,
+					(unsigned int)cli->fnum,
 					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;
 	}
 
@@ -389,12 +342,10 @@ 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;
 	}
 
@@ -441,14 +392,17 @@ 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 %s.\n",
-				rpccli_pipe_txt(debug_ctx(), cli)));
+				"Connection to remote machine %s "
+				"pipe %s fnum 0x%x.\n",
+				cli->desthost,
+				cli->pipe_name,
+				(unsigned int)cli->fnum ));
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
@@ -502,13 +456,14 @@ 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 %s - got non-zero "
-					  "auth len %u.\n",
-					rpccli_pipe_txt(debug_ctx(), cli),
+				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,
 					(unsigned int)prhdr->auth_len ));
 				return NT_STATUS_INVALID_PARAMETER;
 			}
@@ -532,10 +487,12 @@ 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 %s - unknown internal auth type %u.\n",
-				  rpccli_pipe_txt(debug_ctx(), cli),
-				  cli->auth->auth_type ));
+			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 ));
 			return NT_STATUS_INVALID_INFO_CLASS;
 	}
 
@@ -636,9 +593,11 @@ 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 %s!\n",
-				  rpccli_pipe_txt(debug_ctx(), cli)));
+			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));
 			/* Use this for now... */
 			return NT_STATUS_NETWORK_ACCESS_DENIED;
 
@@ -657,10 +616,12 @@ 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 %s!\n",
+			DEBUG(1, ("cli_pipe_validate_current_pdu: RPC fault code %s received from remote machine %s "
+				"pipe %s fnum 0x%x!\n",
 				dcerpc_errstr(NT_STATUS_V(fault_resp.status)),
-				rpccli_pipe_txt(debug_ctx(), cli)));
+				cli->desthost,
+				cli->pipe_name,
+				(unsigned int)cli->fnum));
 			if (NT_STATUS_IS_OK(fault_resp.status)) {
 				return NT_STATUS_UNSUCCESSFUL;
 			} else {
@@ -670,16 +631,21 @@ 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 %s!\n",
+				"from remote machine %s pipe %s fnum 0x%x!\n",
 				(unsigned int)prhdr->pkt_type,
-				rpccli_pipe_txt(debug_ctx(), cli)));
+				cli->desthost,
+				cli->pipe_name,
+				(unsigned int)cli->fnum));
 			return NT_STATUS_INVALID_INFO_CLASS;
 	}
 
 	if (prhdr->pkt_type != expected_pkt_type) {
-		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),
+		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,
 			prhdr->pkt_type,
 			expected_pkt_type));
 		return NT_STATUS_INVALID_INFO_CLASS;
@@ -775,6 +741,7 @@ 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;
@@ -791,71 +758,38 @@ 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);
 
-	DEBUG(5,("rpc_api_pipe: %s\n", rpccli_pipe_txt(debug_ctx(), cli)));
+	/* Create setup parameters - must be in native byte order. */
+	setup[0] = TRANSACT_DCERPCCMD; 
+	setup[1] = cli->fnum; /* Pipe file handle. */
 
-	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. */
+	DEBUG(5,("rpc_api_pipe: Remote machine %s pipe %s fnum 0x%x\n",
+		cli->desthost,
+		cli->pipe_name,
+		(unsigned int)cli->fnum ));
 
-		/*
-		 * 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->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;
-	}
-	case NCACN_IP_TCP:
+	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 */


-- 
Samba Shared Repository


More information about the samba-cvs mailing list