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

Volker Lendecke vlendec at samba.org
Sat Apr 19 22:39:30 GMT 2008


The branch, v3-2-test has been updated
       via  3f6c5b99664a75a6f490ee3b6980b89cacf7f579 (commit)
       via  2e4c1ba38963cffe4c3f25ab24bc28975f2fc291 (commit)
       via  a9061e52e1ff8e31aa480f4a30cda64c9d93214e (commit)
       via  1d261e78b38e8080ca7122037d33c8ef913a4558 (commit)
       via  783afab9c891dd7bcb78895b2a639b6f3a0edf5b (commit)
       via  a6d74a5a562b54f0b36934965f545fdeb1e8b34a (commit)
      from  b90062e33cbde7de4961414fd35a3a588760d002 (commit)

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


- Log -----------------------------------------------------------------
commit 3f6c5b99664a75a6f490ee3b6980b89cacf7f579
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Apr 20 00:01:52 2008 +0200

    Use rpc_pipe_client->user_name instead of rpc_pipe_client->cli->user_name
    
    Also make sure that rpc_pipe_client->user_name is always talloced.

commit 2e4c1ba38963cffe4c3f25ab24bc28975f2fc291
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Apr 19 23:27:35 2008 +0200

    Introduce rpccli_set_timeout()
    
    Reduce dependency on "cli" member of rpc_pipe_client struct

commit a9061e52e1ff8e31aa480f4a30cda64c9d93214e
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Apr 19 23:03:16 2008 +0200

    Move srv_name_slash from cli_state to rpc_pipe_client

commit 1d261e78b38e8080ca7122037d33c8ef913a4558
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Apr 19 22:05:13 2008 +0200

    Fix two "ignoring asprintf result" warnings

commit 783afab9c891dd7bcb78895b2a639b6f3a0edf5b
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Apr 19 21:56:43 2008 +0200

    Add "desthost" to rpc_pipe_client
    
    This reduces the dependency on cli_state

commit a6d74a5a562b54f0b36934965f545fdeb1e8b34a
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Apr 19 18:17:13 2008 +0200

    Refactoring: Make struct rpc_pipe_client its own talloc parent

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

Summary of changes:
 source/client/client.c           |    2 +-
 source/include/client.h          |    6 +-
 source/lib/netapi/cm.c           |    2 +-
 source/libads/ldap_printer.c     |    7 +--
 source/libnet/libnet_join.c      |    4 +-
 source/libsmb/cliconnect.c       |    2 -
 source/libsmb/clientgen.c        |    6 +-
 source/libsmb/libsmb_dir.c       |    2 +-
 source/libsmb/passchange.c       |   13 ++---
 source/libsmb/trusts_util.c      |    2 +-
 source/rpc_client/cli_lsarpc.c   |    2 +-
 source/rpc_client/cli_netlogon.c |    8 ++--
 source/rpc_client/cli_pipe.c     |  104 ++++++++++++++++++++++++--------------
 source/rpc_client/cli_samr.c     |   12 ++--
 source/rpc_client/cli_spoolss.c  |   16 +++---
 source/rpcclient/cmd_lsarpc.c    |    2 +-
 source/rpcclient/cmd_netlogon.c  |   40 ++++++++-------
 source/rpcclient/cmd_samr.c      |    5 +-
 source/rpcclient/cmd_spoolss.c   |   76 ++++++++++++---------------
 source/rpcclient/cmd_srvsvc.c    |   30 ++++++------
 source/rpcclient/cmd_wkssvc.c    |   12 ++--
 source/rpcclient/rpcclient.c     |    2 +-
 source/smbd/change_trust_pw.c    |    3 +-
 source/utils/net_rpc.c           |   64 ++++++++++++------------
 source/utils/net_rpc_join.c      |    2 +-
 source/utils/net_rpc_printer.c   |    9 ++--
 source/utils/net_rpc_samsync.c   |    6 +-
 source/utils/net_rpc_service.c   |   12 ++--
 source/utils/net_rpc_sh_acct.c   |    2 +-
 source/utils/smbtree.c           |    2 +-
 source/winbindd/winbindd_ads.c   |    2 +-
 source/winbindd/winbindd_cm.c    |   12 ++--
 source/winbindd/winbindd_misc.c  |    4 +-
 source/winbindd/winbindd_rpc.c   |    4 +-
 34 files changed, 249 insertions(+), 228 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/client.c b/source/client/client.c
index 276ffb9..1c9c21e 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -3650,7 +3650,7 @@ static bool browse_host_rpc(bool sort)
 	info_ctr.ctr.ctr1 = &ctr1;
 
 	status = rpccli_srvsvc_NetShareEnumAll(pipe_hnd, frame,
-					      pipe_hnd->cli->desthost,
+					      pipe_hnd->desthost,
 					      &info_ctr,
 					      0xffffffff,
 					      &total_entries,
diff --git a/source/include/client.h b/source/include/client.h
index 0e73745..af03e2b 100644
--- a/source/include/client.h
+++ b/source/include/client.h
@@ -60,14 +60,15 @@ struct cli_pipe_auth_data {
 struct rpc_pipe_client {
 	struct rpc_pipe_client *prev, *next;
 
-	TALLOC_CTX *mem_ctx;
-
 	struct cli_state *cli;
 
 	int pipe_idx;
 	const char *pipe_name;
 	uint16 fnum;
 
+	const char *desthost;
+	const char *srv_name_slash;
+
 	const char *domain;
 	const char *user_name;
 	struct pwd_info pwd;
@@ -123,7 +124,6 @@ struct cli_state {
 	int privileges;
 
 	fstring desthost;
-	fstring srv_name_slash;
 
 	/* The credentials used to open the cli_state connection. */
 	fstring domain;
diff --git a/source/lib/netapi/cm.c b/source/lib/netapi/cm.c
index 071ebfd..5464237 100644
--- a/source/lib/netapi/cm.c
+++ b/source/lib/netapi/cm.c
@@ -104,7 +104,7 @@ static struct rpc_pipe_client *pipe_cm_find(struct cli_state *cli,
 			return NULL;
 		}
 
-		if (strequal(cli->desthost, p->pipe->cli->desthost) &&
+		if (strequal(cli->desthost, p->pipe->desthost) &&
 		    pipe_idx == p->pipe->pipe_idx) {
 			*status = NT_STATUS_OK;
 			return p->pipe;
diff --git a/source/libads/ldap_printer.c b/source/libads/ldap_printer.c
index 05fbc07..6682ec2 100644
--- a/source/libads/ldap_printer.c
+++ b/source/libads/ldap_printer.c
@@ -288,16 +288,15 @@ WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
 	uint32 i;
 	POLICY_HND pol;
 
-	asprintf(&servername, "\\\\%s", cli->cli->desthost);
-	asprintf(&printername, "%s\\%s", servername, printer);
-	if (!servername || !printername) {
+	if ((asprintf(&servername, "\\\\%s", cli->desthost) == -1)
+	    || (asprintf(&printername, "%s\\%s", servername, printer) == -1)) {
 		DEBUG(3, ("Insufficient memory\n"));
 		return WERR_NOMEM;
 	}
 	
 	result = rpccli_spoolss_open_printer_ex(cli, mem_ctx, printername, 
 					     "", MAXIMUM_ALLOWED_ACCESS, 
-					     servername, cli->cli->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/libnet/libnet_join.c b/source/libnet/libnet_join.c
index 16a7ea4..207a3ac 100644
--- a/source/libnet/libnet_join.c
+++ b/source/libnet/libnet_join.c
@@ -755,7 +755,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
 	}
 
 	status = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
-				      pipe_hnd->cli->desthost,
+				      pipe_hnd->desthost,
 				      SEC_RIGHTS_MAXIMUM_ALLOWED,
 				      &sam_pol);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -1137,7 +1137,7 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
 	}
 
 	status = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
-				      pipe_hnd->cli->desthost,
+				      pipe_hnd->desthost,
 				      SEC_RIGHTS_MAXIMUM_ALLOWED,
 				      &sam_pol);
 	if (!NT_STATUS_IS_OK(status)) {
diff --git a/source/libsmb/cliconnect.c b/source/libsmb/cliconnect.c
index 949bca7..7d3d246 100644
--- a/source/libsmb/cliconnect.c
+++ b/source/libsmb/cliconnect.c
@@ -1492,8 +1492,6 @@ NTSTATUS cli_connect(struct cli_state *cli,
 	}
 
 	fstrcpy(cli->desthost, host);
-	fstr_sprintf(cli->srv_name_slash, "\\\\%s", cli->desthost);
-	strupper_m(cli->srv_name_slash);
 
 	/* allow hostnames of the form NAME#xx and do a netbios lookup */
 	if ((p = strchr(cli->desthost, '#'))) {
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index 6419123..ef2c263 100644
--- a/source/libsmb/clientgen.c
+++ b/source/libsmb/clientgen.c
@@ -638,7 +638,7 @@ bool cli_rpc_pipe_close(struct rpc_pipe_client *cli)
                          "to machine %s.  Error was %s\n",
                          cli->pipe_name,
                          (int) cli->fnum,
-                         cli->cli->desthost,
+                         cli->desthost,
                          cli_errstr(cli->cli)));
 	}
 
@@ -647,10 +647,10 @@ bool cli_rpc_pipe_close(struct rpc_pipe_client *cli)
 	}
 
 	DEBUG(10,("cli_rpc_pipe_close: closed pipe %s to machine %s\n",
-		cli->pipe_name, cli->cli->desthost ));
+		cli->pipe_name, cli->desthost ));
 
 	DLIST_REMOVE(cli->cli->pipe_list, cli);
-	talloc_destroy(cli->mem_ctx);
+	talloc_destroy(cli);
 	return ret;
 }
 
diff --git a/source/libsmb/libsmb_dir.c b/source/libsmb/libsmb_dir.c
index f836989..612a877 100644
--- a/source/libsmb/libsmb_dir.c
+++ b/source/libsmb/libsmb_dir.c
@@ -287,7 +287,7 @@ net_share_enum_rpc(struct cli_state *cli,
 
         /* Issue the NetShareEnum RPC call and retrieve the response */
 	nt_status = rpccli_srvsvc_NetShareEnumAll(pipe_hnd, talloc_tos(),
-						  pipe_hnd->cli->desthost,
+						  pipe_hnd->desthost,
 						  &info_ctr,
 						  preferred_len,
 						  &total_entries,
diff --git a/source/libsmb/passchange.c b/source/libsmb/passchange.c
index 468750f..2f9a87d 100644
--- a/source/libsmb/passchange.c
+++ b/source/libsmb/passchange.c
@@ -177,8 +177,9 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
 		}
 	}
 
-	if (NT_STATUS_IS_OK(result = rpccli_samr_chgpasswd_user(pipe_hnd, pipe_hnd->mem_ctx, user_name, 
-							     new_passwd, old_passwd))) {
+	result = rpccli_samr_chgpasswd_user(pipe_hnd, talloc_tos(),
+					    user_name, new_passwd, old_passwd);
+	if (NT_STATUS_IS_OK(result)) {
 		/* Great - it all worked! */
 		cli_shutdown(cli);
 		return NT_STATUS_OK;
@@ -206,11 +207,9 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
 	pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &result);
 
 	if ( pipe_hnd &&
-		(NT_STATUS_IS_OK(result = rpccli_samr_chgpasswd_user(pipe_hnd,
-						pipe_hnd->mem_ctx,
-						user_name, 
-						new_passwd,
-						old_passwd)))) {
+		(NT_STATUS_IS_OK(result = rpccli_samr_chgpasswd_user(
+					 pipe_hnd, talloc_tos(), user_name,
+					 new_passwd, old_passwd)))) {
 		/* Great - it all worked! */
 		cli_shutdown(cli);
 		return NT_STATUS_OK;
diff --git a/source/libsmb/trusts_util.c b/source/libsmb/trusts_util.c
index c3f5f25..20ac014 100644
--- a/source/libsmb/trusts_util.c
+++ b/source/libsmb/trusts_util.c
@@ -43,7 +43,7 @@ static NTSTATUS just_change_the_password(struct rpc_pipe_client *cli, TALLOC_CTX
 		uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
 
 		result = rpccli_netlogon_setup_creds(cli, 
-					cli->cli->desthost, /* server name */
+					cli->desthost, /* server name */
 					lp_workgroup(), /* domain */
 					global_myname(), /* client name */
 					global_myname(), /* machine account name */
diff --git a/source/rpc_client/cli_lsarpc.c b/source/rpc_client/cli_lsarpc.c
index 37387a0..a799f92 100644
--- a/source/rpc_client/cli_lsarpc.c
+++ b/source/rpc_client/cli_lsarpc.c
@@ -108,7 +108,7 @@ NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
 	}
 
 	return rpccli_lsa_OpenPolicy2(cli, mem_ctx,
-				      cli->cli->srv_name_slash,
+				      cli->srv_name_slash,
 				      &attr,
 				      des_access,
 				      pol);
diff --git a/source/rpc_client/cli_netlogon.c b/source/rpc_client/cli_netlogon.c
index 851a4a8..bf1e161 100644
--- a/source/rpc_client/cli_netlogon.c
+++ b/source/rpc_client/cli_netlogon.c
@@ -159,7 +159,7 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
 	generate_random_buffer(clnt_chal_send.data, 8);
 
 	/* Get the server challenge. */
-	result = rpccli_netr_ServerReqChallenge(cli, cli->mem_ctx,
+	result = rpccli_netr_ServerReqChallenge(cli, talloc_tos(),
 						dc->remote_machine,
 						clnt_name,
 						&clnt_chal_send,
@@ -180,7 +180,7 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
 	 * Send client auth-2 challenge and receive server repy.
 	 */
 
-	result = rpccli_netr_ServerAuthenticate2(cli, cli->mem_ctx,
+	result = rpccli_netr_ServerAuthenticate2(cli, talloc_tos(),
 						 dc->remote_machine,
 						 dc->mach_acct,
 						 sec_chan_type,
@@ -212,13 +212,13 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
 		 */
 		DEBUG(0,("rpccli_netlogon_setup_creds: server %s "
 			"replied with bad credential\n",
-			cli->cli->desthost ));
+			cli->desthost ));
 		return NT_STATUS_ACCESS_DENIED;
 	}
 
 	DEBUG(5,("rpccli_netlogon_setup_creds: server %s credential "
 		"chain established.\n",
-		cli->cli->desthost ));
+		cli->desthost ));
 
 	return NT_STATUS_OK;
 }
diff --git a/source/rpc_client/cli_pipe.c b/source/rpc_client/cli_pipe.c
index bc49e24..bc9a426 100644
--- a/source/rpc_client/cli_pipe.c
+++ b/source/rpc_client/cli_pipe.c
@@ -279,7 +279,7 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr
 				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->cli->desthost,
+					cli->desthost,
 					cli->pipe_name,
 					(unsigned int)cli->fnum,
 					nt_errstr(status) ));
@@ -297,7 +297,7 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr
 				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->cli->desthost,
+					cli->desthost,
 					cli->pipe_name,
 					(unsigned int)cli->fnum,
 					nt_errstr(status) ));
@@ -400,7 +400,7 @@ static NTSTATUS cli_pipe_verify_schannel(struct rpc_pipe_client *cli, RPC_HDR *p
 		DEBUG(3,("cli_pipe_verify_schannel: failed to decode PDU "
 				"Connection to remote machine %s "
 				"pipe %s fnum 0x%x.\n",
-				cli->cli->desthost,
+				cli->desthost,
 				cli->pipe_name,
 				(unsigned int)cli->fnum ));
 		return NT_STATUS_INVALID_PARAMETER;
@@ -461,7 +461,7 @@ static NTSTATUS cli_pipe_validate_rpc_response(struct rpc_pipe_client *cli, RPC_
 			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->cli->desthost,
+					cli->desthost,
 					cli->pipe_name,
 					(unsigned int)cli->fnum,
 					(unsigned int)prhdr->auth_len ));
@@ -489,7 +489,7 @@ static NTSTATUS cli_pipe_validate_rpc_response(struct rpc_pipe_client *cli, RPC_
 		default:
 			DEBUG(3, ("cli_pipe_validate_rpc_response: Connection to remote machine %s "
 				"pipe %s fnum %x - unknown internal auth type %u.\n",
-				cli->cli->desthost,
+				cli->desthost,
 				cli->pipe_name,
 				(unsigned int)cli->fnum,
 				cli->auth.auth_type ));
@@ -595,7 +595,7 @@ 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->cli->desthost,
+				cli->desthost,
 				cli->pipe_name,
 				(unsigned int)cli->fnum));
 			/* Use this for now... */
@@ -619,7 +619,7 @@ static NTSTATUS cli_pipe_validate_current_pdu(struct rpc_pipe_client *cli, RPC_H
 			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)),
-				cli->cli->desthost,
+				cli->desthost,
 				cli->pipe_name,
 				(unsigned int)cli->fnum));
 			if (NT_STATUS_IS_OK(fault_resp.status)) {
@@ -634,7 +634,7 @@ static NTSTATUS cli_pipe_validate_current_pdu(struct rpc_pipe_client *cli, RPC_H
 			DEBUG(0, ("cli_pipe_validate_current_pdu: unknown packet type %u received "
 				"from remote machine %s pipe %s fnum 0x%x!\n",
 				(unsigned int)prhdr->pkt_type,
-				cli->cli->desthost,
+				cli->desthost,
 				cli->pipe_name,
 				(unsigned int)cli->fnum));
 			return NT_STATUS_INVALID_INFO_CLASS;
@@ -644,7 +644,7 @@ static NTSTATUS cli_pipe_validate_current_pdu(struct rpc_pipe_client *cli, RPC_H
 		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->cli->desthost,
+			cli->desthost,
 			cli->pipe_name,
 			(unsigned int)cli->fnum,
 			prhdr->pkt_type,
@@ -764,7 +764,7 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli,
 	setup[1] = cli->fnum; /* Pipe file handle. */
 
 	DEBUG(5,("rpc_api_pipe: Remote machine %s pipe %s fnum 0x%x\n",
-		cli->cli->desthost,
+		cli->desthost,
 		cli->pipe_name,
 		(unsigned int)cli->fnum ));
 
@@ -783,7 +783,7 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli,
 	{
 		DEBUG(0, ("rpc_api_pipe: Remote machine %s pipe %s fnum 0x%x "
 			"returned critical error. Error was %s\n",
-			cli->cli->desthost,
+			cli->desthost,
 			cli->pipe_name,
 			(unsigned int)cli->fnum,
 			cli_errstr(cli->cli)));
@@ -800,7 +800,7 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli,
 	if (prdata == NULL) {
 		DEBUG(3,("rpc_api_pipe: Remote machine %s pipe %s "
 			"fnum 0x%x failed to return data.\n",
-			cli->cli->desthost,
+			cli->desthost,
 			cli->pipe_name,
 			(unsigned int)cli->fnum));
 		/* Yes - some calls can truely return no data... */
@@ -850,7 +850,7 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli,
 				/* Set the data type correctly for big-endian data on the first packet. */
 				DEBUG(10,("rpc_api_pipe: On machine %s pipe %s fnum 0x%x "
 					"PDU data format is big-endian.\n",
-					cli->cli->desthost,
+					cli->desthost,
 					cli->pipe_name,
 					(unsigned int)cli->fnum));
 
@@ -887,7 +887,7 @@ static NTSTATUS rpc_api_pipe(struct rpc_pipe_client *cli,
 	}
 
 	DEBUG(10,("rpc_api_pipe: Remote machine %s pipe %s fnum 0x%x returned %u bytes.\n",
-		cli->cli->desthost,
+		cli->desthost,
 		cli->pipe_name,
 		(unsigned int)cli->fnum,
 		(unsigned int)prs_data_size(rbuf) ));
@@ -1840,7 +1840,7 @@ static NTSTATUS rpc_finish_auth3_bind(struct rpc_pipe_client *cli,
 
 	DEBUG(5,("rpc_send_auth_auth3: Remote machine %s pipe %s "
 		"fnum 0x%x sent auth3 response ok.\n",
-		cli->cli->desthost,
+		cli->desthost,
 		cli->pipe_name,
 		(unsigned int)cli->fnum));
 
@@ -1979,7 +1979,7 @@ static NTSTATUS rpc_finish_spnego_ntlmssp_bind(struct rpc_pipe_client *cli,
 
 	/* Initialize the returning data struct. */
 	prs_mem_free(rbuf);
-	prs_init_empty(rbuf, cli->mem_ctx, UNMARSHALL);
+	prs_init_empty(rbuf, talloc_tos(), UNMARSHALL);
 
 	nt_status = rpc_api_pipe(cli, &rpc_out, rbuf, RPC_ALTCONTRESP);
 	if (!NT_STATUS_IS_OK(nt_status)) {
@@ -2018,7 +2018,7 @@ static NTSTATUS rpc_finish_spnego_ntlmssp_bind(struct rpc_pipe_client *cli,
 
 	DEBUG(5,("rpc_finish_spnego_ntlmssp_bind: alter context request to "
 		"remote machine %s pipe %s fnum 0x%x.\n",
-		cli->cli->desthost,
+		cli->desthost,
 		cli->pipe_name,
 		(unsigned int)cli->fnum));
 
@@ -2052,7 +2052,7 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
-	prs_init_empty(&rpc_out, cli->mem_ctx, MARSHALL);
+	prs_init_empty(&rpc_out, talloc_tos(), MARSHALL);
 
 	rpc_call_id = get_rpc_call_id();
 
@@ -2068,7 +2068,7 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
 	}
 
 	/* Initialize the incoming data struct. */
-	prs_init_empty(&rbuf, cli->mem_ctx, UNMARSHALL);
+	prs_init_empty(&rbuf, talloc_tos(), UNMARSHALL);
 
 	/* send data on \PIPE\.  receive a response */
 	status = rpc_api_pipe(cli, &rpc_out, &rbuf, RPC_BINDACK);
@@ -2081,7 +2081,7 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
 
 	DEBUG(3,("rpc_pipe_bind: Remote machine %s pipe %s "
 		"fnum 0x%x bind request returned ok.\n",
-		cli->cli->desthost,
+		cli->desthost,
 		cli->pipe_name,
 		(unsigned int)cli->fnum));
 
@@ -2173,6 +2173,12 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
 	return NT_STATUS_OK;
 }
 
+unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
+				unsigned int timeout)
+{
+	return cli_set_timeout(cli->cli, timeout);
+}
+
 /****************************************************************************
  Open a named pipe over SMB to a remote server.
  *
@@ -2188,7 +2194,6 @@ static NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
 
 static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe_idx, NTSTATUS *perr)
 {
-	TALLOC_CTX *mem_ctx;
 	struct rpc_pipe_client *result;
 	int fnum;
 
@@ -2204,18 +2209,11 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe
 	/* The pipe name index must fall within our array */
 	SMB_ASSERT((pipe_idx >= 0) && (pipe_idx < PI_MAX_PIPES));
 
-	mem_ctx = talloc_init("struct rpc_pipe_client");
-	if (mem_ctx == NULL) {
-		return NULL;
-	}
-
-	result = TALLOC_ZERO_P(mem_ctx, struct rpc_pipe_client);
+	result = TALLOC_ZERO_P(NULL, struct rpc_pipe_client);
 	if (result == NULL) {
 		return NULL;
 	}
 
-	result->mem_ctx = mem_ctx;
-
 	result->pipe_name = cli_get_pipe_name(pipe_idx);
 
 	fnum = cli_nt_create(cli, result->pipe_name, DESIRED_ACCESS_PIPE);
@@ -2226,7 +2224,7 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe
 			 result->pipe_name, cli->desthost,
 			 cli_errstr(cli)));
 		*perr = cli_get_nt_error(cli);
-		talloc_destroy(result->mem_ctx);
+		talloc_destroy(result);
 		return NULL;
 	}
 
@@ -2236,11 +2234,24 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe
 	result->auth.auth_type = PIPE_AUTH_TYPE_NONE;
 	result->auth.auth_level = PIPE_AUTH_LEVEL_NONE;
 
+	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) {
+		TALLOC_FREE(result);
+		return NULL;
+	}
+


-- 
Samba Shared Repository


More information about the samba-cvs mailing list