svn commit: samba r24134 - in branches/SAMBA_3_2/source/smbd: .

vlendec at samba.org vlendec at samba.org
Thu Aug 2 18:14:00 GMT 2007


Author: vlendec
Date: 2007-08-02 18:13:57 +0000 (Thu, 02 Aug 2007)
New Revision: 24134

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24134

Log:
talloc smb_request for handle_trans2

When starting to convert the individual trans2 subcalls, I need the new
API conventions to be present there. This means that those calls fill in
req->outbuf when there's something to ship

Modified:
   branches/SAMBA_3_2/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/trans2.c	2007-08-02 18:06:45 UTC (rev 24133)
+++ branches/SAMBA_3_2/source/smbd/trans2.c	2007-08-02 18:13:57 UTC (rev 24134)
@@ -6882,11 +6882,22 @@
 	if ((state->received_param == state->total_param) &&
 	    (state->received_data == state->total_data)) {
 
-		struct smb_request req;
-		init_smb_request(&req, (uint8 *)inbuf);
+		struct smb_request *req;
 
-		outsize = handle_trans2(conn, &req, state, inbuf, outbuf,
+		if (!(req = talloc(tmp_talloc_ctx(), struct smb_request))) {
+			END_PROFILE(SMBtrans2);
+			return ERROR_NT(NT_STATUS_NO_MEMORY);
+		}
+
+		init_smb_request(req, (uint8 *)inbuf);
+
+		outsize = handle_trans2(conn, req, state, inbuf, outbuf,
 					size, bufsize);
+		if (req->outbuf != NULL) {
+			outsize = smb_len(req->outbuf) + 4;
+			memcpy(outbuf, req->outbuf, outsize);
+		}
+		TALLOC_FREE(req);
 		SAFE_FREE(state->data);
 		SAFE_FREE(state->param);
 		TALLOC_FREE(state);
@@ -6924,7 +6935,7 @@
 	int outsize = 0;
 	unsigned int pcnt,poff,dcnt,doff,pdisp,ddisp;
 	struct trans_state *state;
-	struct smb_request req;
+	struct smb_request *req;
 
 	START_PROFILE(SMBtranss2);
 
@@ -7010,10 +7021,20 @@
 	 */
 	SCVAL(outbuf,smb_com,SMBtrans2);
 
-	init_smb_request(&req, (uint8 *)inbuf);
+	if (!(req = talloc(tmp_talloc_ctx(), struct smb_request))) {
+		END_PROFILE(SMBtranss2);
+		return ERROR_NT(NT_STATUS_NO_MEMORY);
+	}
 
-	outsize = handle_trans2(conn, &req, state, inbuf, outbuf, size,
+	init_smb_request(req, (uint8 *)inbuf);
+
+	outsize = handle_trans2(conn, req, state, inbuf, outbuf, size,
 				bufsize);
+	if (req->outbuf != NULL) {
+		outsize = smb_len(req->outbuf) + 4;
+		memcpy(outbuf, req->outbuf, outsize);
+	}
+	TALLOC_FREE(req);
 
 	DLIST_REMOVE(conn->pending_trans, state);
 	SAFE_FREE(state->data);



More information about the samba-cvs mailing list