Make "inbuf" a talloc child of "smb_request" for normal smb requests
authorVolker Lendecke <vl@samba.org>
Mon, 3 Nov 2008 20:55:05 +0000 (21:55 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 4 Nov 2008 19:52:06 +0000 (20:52 +0100)
This is necessary if we want to keep the whole smb_request for deferred ops.
The explicit settings of req->inbuf will be removed once all those deferring
operations are converted to store the whole request and not just the inbuf.

source3/smbd/blocking.c
source3/smbd/notify.c
source3/smbd/process.c

index 78a63dcbb21a7e4e63a98bb52e44f23a3893b2a1..f4e2b69d6b724adcdd677df13b58accfbb662bb6 100644 (file)
@@ -263,6 +263,7 @@ static void reply_lockingX_success(blocking_lock_record *blr)
        }
 
        init_smb_request(req, (uint8 *)blr->inbuf, 0, blr->encrypted);
+       req->inbuf = (uint8_t *)(blr->inbuf);
        reply_outbuf(req, 2, 0);
 
        /*
@@ -543,6 +544,7 @@ static bool process_trans2(blocking_lock_record *blr)
        }
 
        init_smb_request(req, (uint8 *)blr->inbuf, 0, blr->encrypted);
+       req->inbuf = (uint8_t *)(blr->inbuf);
 
        SCVAL(req->inbuf, smb_com, SMBtrans2);
        SSVAL(params,0,0);
index 139dfe7d5b3dbd59393b30ef1d80bcbd5aeec394..b2d0f20f8936d416bd0617eb8042eec3848b6a3b 100644 (file)
@@ -198,6 +198,7 @@ void change_notify_reply(connection_struct *conn,
        SCVAL(tmp_request, smb_wct, 0);
 
        init_smb_request(req, tmp_request,0, conn->encrypted_tid);
+       req->inbuf = tmp_request;
 
        send_nt_replies(conn, req, NT_STATUS_OK, prs_data_p(&ps),
                        prs_offset(&ps), NULL, 0);
index 1dcfb4b12273e767fde2f6e6060152f6bf64a184..958e8634e9c5ad372fe7878a3e708c894c8b9e67 100644 (file)
@@ -400,7 +400,6 @@ void init_smb_request(struct smb_request *req,
                        (unsigned int)req_size));
                exit_server_cleanly("Invalid SMB request");
        }
-       req->inbuf  = inbuf;
        req->outbuf = NULL;
 }
 
@@ -1497,6 +1496,7 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool enc
                smb_panic("could not allocate smb_request");
        }
        init_smb_request(req, (uint8 *)inbuf, unread_bytes, encrypted);
+       req->inbuf  = (uint8_t *)talloc_move(req, &inbuf);
 
        conn = switch_message(req->cmd, req, size);
 
@@ -1723,6 +1723,7 @@ void chain_reply(struct smb_request *req)
                smb_panic("could not allocate smb_request");
        }
        init_smb_request(req2, (uint8 *)inbuf2,0, req->encrypted);
+       req2->inbuf = (uint8_t *)inbuf2;
        req2->chain_fsp = req->chain_fsp;
 
        /* process the request */
@@ -1931,8 +1932,6 @@ void smbd_process(void)
 
                process_smb(inbuf, inbuf_len, unread_bytes, encrypted);
 
-               TALLOC_FREE(inbuf);
-
                num_smbs++;
 
                /* The timeout_processing function isn't run nearly