svn commit: samba r2118 - in branches/SAMBA_4_0/source/librpc/rpc: .

tridge at samba.org tridge at samba.org
Tue Aug 31 01:16:51 GMT 2004


Author: tridge
Date: 2004-08-31 01:16:50 +0000 (Tue, 31 Aug 2004)
New Revision: 2118

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/librpc/rpc&rev=2118&nolog=1

Log:
fixed the receipt of bigendian rpc packets with the new async code.

The fix uses the new talloc_increase_ref_count() function in an
interesting way. I suspect this sort of technique will become quite
common.

Modified:
   branches/SAMBA_4_0/source/librpc/rpc/dcerpc.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/rpc/dcerpc.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/rpc/dcerpc.c	2004-08-30 22:25:39 UTC (rev 2117)
+++ branches/SAMBA_4_0/source/librpc/rpc/dcerpc.c	2004-08-31 01:16:50 UTC (rev 2118)
@@ -694,7 +694,7 @@
 
 
 /*
-  perform a full request/response pair on a dcerpc pipe
+  perform the send size of a async dcerpc request
 */
 struct rpc_request *dcerpc_request_send(struct dcerpc_pipe *p, 
 					uint16_t opnum,
@@ -805,7 +805,7 @@
 
 
 /*
-  perform a full request/response pair on a dcerpc pipe
+  perform the receive side of a async dcerpc request
 */
 NTSTATUS dcerpc_request_recv(struct rpc_request *req,
 			     TALLOC_CTX *mem_ctx,
@@ -1071,13 +1071,20 @@
 	DATA_BLOB response;
 	struct ndr_pull *pull;
 	struct rpc_request_ndr ndr = req->ndr;
-	uint_t flags = req->flags;
+	uint_t flags;
 
+	/* make sure the recv code doesn't free the request, as we
+	   need to grab the flags element before it is freed */
+	talloc_increase_ref_count(req);
+
 	status = dcerpc_request_recv(req, ndr.mem_ctx, &response);
 	if (!NT_STATUS_IS_OK(status)) {
 		return status;
 	}
 
+	flags = req->flags;
+	talloc_free(req);
+
 	/* prepare for ndr_pull_* */
 	pull = ndr_pull_init_blob(&response, ndr.mem_ctx);
 	if (!pull) {



More information about the samba-cvs mailing list