[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Fri Sep 17 07:44:59 MDT 2010


The branch, master has been updated
       via  78b6265 s3:rpc_client: remove unused rpc_pipe_set_hnd_state()
       via  fde3412 s3:rpc_client: use rpc_api_pipe_send() for auth3
       via  6ecf8d1 s3:rpc_client: rpc_pipe_bind_step_one_done() doesn't need reply_pdu
       via  de6254d s3:rpc_client: allow DCERPC_PKT_AUTH3 via rpc_api_pipe_send/recv
      from  1a22b1b lib/util: usec_time_diff takes arguments the other way round than TvalDiff did

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 78b6265ac2a79cdf0051b895ecebeb77ac3a372c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 7 21:24:07 2010 +0200

    s3:rpc_client: remove unused rpc_pipe_set_hnd_state()
    
    metze

commit fde3412ccb176448f6d3ee4538c7b8838f2fe214
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 7 20:52:58 2010 +0200

    s3:rpc_client: use rpc_api_pipe_send() for auth3
    
    metze

commit 6ecf8d16bc9f8da8acb6d24e5d224d6161a5497c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 7 20:51:38 2010 +0200

    s3:rpc_client: rpc_pipe_bind_step_one_done() doesn't need reply_pdu
    
    metze

commit de6254d3d6ffdd2a562ec9224a8390810c28c0dd
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 7 20:39:20 2010 +0200

    s3:rpc_client: allow DCERPC_PKT_AUTH3 via rpc_api_pipe_send/recv
    
    metze

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

Summary of changes:
 source3/rpc_client/cli_pipe.c |  109 +++++++++++++++--------------------------
 1 files changed, 40 insertions(+), 69 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 1975d73..d8bed84 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -704,6 +704,7 @@ struct rpc_api_pipe_state {
 
 static void rpc_api_pipe_trans_done(struct tevent_req *subreq);
 static void rpc_api_pipe_got_pdu(struct tevent_req *subreq);
+static void rpc_api_pipe_auth3_done(struct tevent_req *subreq);
 
 static struct tevent_req *rpc_api_pipe_send(TALLOC_CTX *mem_ctx,
 					    struct event_context *ev,
@@ -738,6 +739,16 @@ static struct tevent_req *rpc_api_pipe_send(TALLOC_CTX *mem_ctx,
 
 	DEBUG(5,("rpc_api_pipe: %s\n", rpccli_pipe_txt(talloc_tos(), cli)));
 
+	if (state->expected_pkt_type == DCERPC_PKT_AUTH3) {
+		subreq = rpc_write_send(state, ev, cli->transport,
+					data->data, data->length);
+		if (subreq == NULL) {
+			goto fail;
+		}
+		tevent_req_set_callback(subreq, rpc_api_pipe_auth3_done, req);
+		return req;
+	}
+
 	/* get the header first, then fetch the rest once we have
 	 * the frag_length available */
 	max_recv_frag = RPC_HEADER_LEN;
@@ -758,6 +769,23 @@ static struct tevent_req *rpc_api_pipe_send(TALLOC_CTX *mem_ctx,
 	return NULL;
 }
 
+static void rpc_api_pipe_auth3_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req =
+		tevent_req_callback_data(subreq,
+		struct tevent_req);
+	NTSTATUS status;
+
+	status = rpc_write_recv(subreq);
+	TALLOC_FREE(subreq);
+	if (!NT_STATUS_IS_OK(status)) {
+		tevent_req_nterror(req, status);
+		return;
+	}
+
+	tevent_req_done(req);
+}
+
 static void rpc_api_pipe_trans_done(struct tevent_req *subreq)
 {
 	struct tevent_req *req = tevent_req_callback_data(
@@ -1446,53 +1474,6 @@ NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
 	return NT_STATUS_OK;
 }
 
-#if 0
-/****************************************************************************
- Set the handle state.
-****************************************************************************/
-
-static bool rpc_pipe_set_hnd_state(struct rpc_pipe_client *cli,
-				   const char *pipe_name, uint16 device_state)
-{
-	bool state_set = False;
-	char param[2];
-	uint16 setup[2]; /* only need 2 uint16 setup parameters */
-	char *rparam = NULL;
-	char *rdata = NULL;
-	uint32 rparam_len, rdata_len;
-
-	if (pipe_name == NULL)
-		return False;
-
-	DEBUG(5,("Set Handle state Pipe[%x]: %s - device state:%x\n",
-		 cli->fnum, pipe_name, device_state));
-
-	/* create parameters: device state */
-	SSVAL(param, 0, device_state);
-
-	/* create setup parameters. */
-	setup[0] = 0x0001; 
-	setup[1] = cli->fnum; /* pipe file handle.  got this from an SMBOpenX. */
-
-	/* send the data on \PIPE\ */
-	if (cli_api_pipe(cli->cli, "\\PIPE\\",
-	            setup, 2, 0,                /* setup, length, max */
-	            param, 2, 0,                /* param, length, max */
-	            NULL, 0, 1024,              /* data, length, max */
-	            &rparam, &rparam_len,        /* return param, length */
-	            &rdata, &rdata_len))         /* return data, length */
-	{
-		DEBUG(5, ("Set Handle state: return OK\n"));
-		state_set = True;
-	}
-
-	SAFE_FREE(rparam);
-	SAFE_FREE(rdata);
-
-	return state_set;
-}
-#endif
-
 /****************************************************************************
  Check the rpc bind acknowledge response.
 ****************************************************************************/
@@ -1623,11 +1604,11 @@ struct rpc_pipe_bind_state {
 	struct event_context *ev;
 	struct rpc_pipe_client *cli;
 	DATA_BLOB rpc_out;
+	bool auth3;
 	uint32_t rpc_call_id;
 };
 
 static void rpc_pipe_bind_step_one_done(struct tevent_req *subreq);
-static void rpc_bind_auth3_write_done(struct tevent_req *subreq);
 static NTSTATUS rpc_bind_next_send(struct tevent_req *req,
 				   struct rpc_pipe_bind_state *state,
 				   DATA_BLOB *credentials);
@@ -1658,7 +1639,6 @@ struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
 	state->ev = ev;
 	state->cli = cli;
 	state->rpc_call_id = get_rpc_call_id();
-	state->rpc_out = data_blob_null;
 
 	cli->auth = talloc_move(cli, &auth);
 
@@ -1697,13 +1677,12 @@ static void rpc_pipe_bind_step_one_done(struct tevent_req *subreq)
 	struct rpc_pipe_bind_state *state = tevent_req_data(
 		req, struct rpc_pipe_bind_state);
 	struct pipe_auth_data *pauth = state->cli->auth;
-	DATA_BLOB reply_pdu;
 	struct ncacn_packet *pkt;
 	struct dcerpc_auth auth;
 	DATA_BLOB auth_token = data_blob_null;
 	NTSTATUS status;
 
-	status = rpc_api_pipe_recv(subreq, talloc_tos(), &pkt, &reply_pdu);
+	status = rpc_api_pipe_recv(subreq, talloc_tos(), &pkt, NULL);
 	TALLOC_FREE(subreq);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(3, ("rpc_pipe_bind: %s bind request returned %s\n",
@@ -1713,6 +1692,11 @@ static void rpc_pipe_bind_step_one_done(struct tevent_req *subreq)
 		return;
 	}
 
+	if (state->auth3) {
+		tevent_req_done(req);
+		return;
+	}
+
 	if (!check_bind_response(&pkt->u.bind_ack, &state->cli->transfer_syntax)) {
 		DEBUG(2, ("rpc_pipe_bind: check_bind_response failed.\n"));
 		tevent_req_nterror(req, NT_STATUS_BUFFER_TOO_SMALL);
@@ -1835,21 +1819,6 @@ err_out:
 	tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
 }
 
-static void rpc_bind_auth3_write_done(struct tevent_req *subreq)
-{
-	struct tevent_req *req = tevent_req_callback_data(
-		subreq, struct tevent_req);
-	NTSTATUS status;
-
-	status = rpc_write_recv(subreq);
-	TALLOC_FREE(subreq);
-	if (!NT_STATUS_IS_OK(status)) {
-		tevent_req_nterror(req, status);
-		return;
-	}
-	tevent_req_done(req);
-}
-
 static NTSTATUS rpc_bind_next_send(struct tevent_req *req,
 				   struct rpc_pipe_bind_state *state,
 				   DATA_BLOB *auth_token)
@@ -1890,6 +1859,8 @@ static NTSTATUS rpc_bind_finish_send(struct tevent_req *req,
 	struct tevent_req *subreq;
 	NTSTATUS status;
 
+	state->auth3 = true;
+
 	/* Now prepare the auth3 context pdu. */
 	data_blob_free(&state->rpc_out);
 
@@ -1903,12 +1874,12 @@ static NTSTATUS rpc_bind_finish_send(struct tevent_req *req,
 		return status;
 	}
 
-	subreq = rpc_write_send(state, state->ev, state->cli->transport,
-				state->rpc_out.data, state->rpc_out.length);
+	subreq = rpc_api_pipe_send(state, state->ev, state->cli,
+				   &state->rpc_out, DCERPC_PKT_AUTH3);
 	if (subreq == NULL) {
 		return NT_STATUS_NO_MEMORY;
 	}
-	tevent_req_set_callback(subreq, rpc_bind_auth3_write_done, req);
+	tevent_req_set_callback(subreq, rpc_pipe_bind_step_one_done, req);
 	return NT_STATUS_OK;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list