Ignore:
Timestamp:
Nov 29, 2012, 1:59:04 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/smbd/smb2_lock.c

    r745 r751  
    4747                                                 struct tevent_context *ev,
    4848                                                 struct smbd_smb2_request *smb2req,
     49                                                 struct files_struct *in_fsp,
    4950                                                 uint32_t in_smbpid,
    50                                                  uint64_t in_file_id_volatile,
    5151                                                 uint16_t in_lock_count,
    5252                                                 struct smbd_smb2_lock_element *in_locks);
     
    5959        const uint8_t *inbody;
    6060        const int i = req->current_idx;
    61         size_t expected_body_size = 0x30;
    62         size_t body_size;
    6361        uint32_t in_smbpid;
    6462        uint16_t in_lock_count;
    6563        uint64_t in_file_id_persistent;
    6664        uint64_t in_file_id_volatile;
     65        struct files_struct *in_fsp;
    6766        struct smbd_smb2_lock_element *in_locks;
    6867        struct tevent_req *subreq;
    6968        const uint8_t *lock_buffer;
    7069        uint16_t l;
    71 
     70        NTSTATUS status;
     71
     72        status = smbd_smb2_request_verify_sizes(req, 0x30);
     73        if (!NT_STATUS_IS_OK(status)) {
     74                return smbd_smb2_request_error(req, status);
     75        }
    7276        inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
    73         if (req->in.vector[i+1].iov_len != (expected_body_size & 0xFFFFFFFE)) {
    74                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    75         }
    76 
    7777        inbody = (const uint8_t *)req->in.vector[i+1].iov_base;
    78 
    79         body_size = SVAL(inbody, 0x00);
    80         if (body_size != expected_body_size) {
    81                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    82         }
    8378
    8479        in_smbpid                       = IVAL(inhdr, SMB2_HDR_PID);
     
    9590        if (((in_lock_count - 1) * 0x18) > req->in.vector[i+2].iov_len) {
    9691                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    97         }
    98 
    99         if (req->compat_chain_fsp) {
    100                 /* skip check */
    101         } else if (in_file_id_persistent != in_file_id_volatile) {
    102                 return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
    10392        }
    10493
     
    128117        }
    129118
    130         subreq = smbd_smb2_lock_send(req,
    131                                      req->sconn->smb2.event_ctx,
    132                                      req,
     119        in_fsp = file_fsp_smb2(req, in_file_id_persistent, in_file_id_volatile);
     120        if (in_fsp == NULL) {
     121                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
     122        }
     123
     124        subreq = smbd_smb2_lock_send(req, req->sconn->smb2.event_ctx,
     125                                     req, in_fsp,
    133126                                     in_smbpid,
    134                                      in_file_id_volatile,
    135127                                     in_lock_count,
    136128                                     in_locks);
     
    214206                                                 struct tevent_context *ev,
    215207                                                 struct smbd_smb2_request *smb2req,
     208                                                 struct files_struct *fsp,
    216209                                                 uint32_t in_smbpid,
    217                                                  uint64_t in_file_id_volatile,
    218210                                                 uint16_t in_lock_count,
    219211                                                 struct smbd_smb2_lock_element *in_locks)
     
    222214        struct smbd_smb2_lock_state *state;
    223215        struct smb_request *smb1req;
    224         connection_struct *conn = smb2req->tcon->compat_conn;
    225         files_struct *fsp;
    226216        int32_t timeout = -1;
    227217        bool isunlock = false;
     
    245235        state->smb1req = smb1req;
    246236
    247         DEBUG(10,("smbd_smb2_lock_send: file_id[0x%016llX]\n",
    248                   (unsigned long long)in_file_id_volatile));
    249 
    250         fsp = file_fsp(smb1req, (uint16_t)in_file_id_volatile);
    251         if (fsp == NULL) {
    252                 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
    253                 return tevent_req_post(req, ev);
    254         }
    255         if (conn != fsp->conn) {
    256                 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
    257                 return tevent_req_post(req, ev);
    258         }
    259         if (smb2req->session->vuid != fsp->vuid) {
    260                 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
    261                 return tevent_req_post(req, ev);
    262         }
     237        DEBUG(10,("smbd_smb2_lock_send: %s - fnum[%d]\n",
     238                  fsp_str_dbg(fsp), fsp->fnum));
    263239
    264240        locks = talloc_array(state, struct smbd_lock_element, in_lock_count);
     
    342318                }
    343319
    344                 locks[i].smblctx = in_file_id_volatile;
     320                locks[i].smblctx = fsp->fnum;
    345321                locks[i].offset = in_locks[i].offset;
    346322                locks[i].count  = in_locks[i].length;
     
    873849                files_struct *fsp_curr = NULL;
    874850                int i = smb2req->current_idx;
    875                 uint64_t in_file_id_volatile;
    876851                struct blocking_lock_record *blr = NULL;
    877852                const uint8_t *inhdr;
    878                 const uint8_t *inbody;
    879853
    880854                nextreq = smb2req->next;
     
    894868                        continue;
    895869                }
    896 
    897                 inbody = (const uint8_t *)smb2req->in.vector[i+1].iov_base;
    898                 in_file_id_volatile = BVAL(inbody, 0x10);
    899870
    900871                state = tevent_req_data(smb2req->subreq,
     
    905876                }
    906877
    907                 fsp_curr = file_fsp(state->smb1req, (uint16_t)in_file_id_volatile);
     878                fsp_curr = smb2req->compat_chain_fsp;
    908879                if (fsp_curr == NULL) {
    909880                        /* Strange - is this even possible ? */
Note: See TracChangeset for help on using the changeset viewer.