summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-02 18:13:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:10 -0500
commitd526657d5f8f269782eb92228d5d0390c7d37efa (patch)
tree0df74c31dadfbd9014c088e7c46df775694a98a0 /source3/smbd
parentb62bd05b93e2317f78a4aea089295cf1162d23e2 (diff)
downloadsamba-d526657d5f8f269782eb92228d5d0390c7d37efa.tar.gz
samba-d526657d5f8f269782eb92228d5d0390c7d37efa.tar.bz2
samba-d526657d5f8f269782eb92228d5d0390c7d37efa.zip
r24134: 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 (This used to be commit d9eef977dc80d6ee71898efc1ff736afb75eba0c)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/trans2.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 8b4b36a7fa..3a1a1ca816 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -6882,11 +6882,22 @@ int reply_trans2(connection_struct *conn, char *inbuf,char *outbuf,
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 reply_transs2(connection_struct *conn,
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 @@ int reply_transs2(connection_struct *conn,
*/
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);