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_read.c

    r745 r751  
    3131                                              struct tevent_context *ev,
    3232                                              struct smbd_smb2_request *smb2req,
     33                                              struct files_struct *in_fsp,
    3334                                              uint32_t in_smbpid,
    34                                               uint64_t in_file_id_volatile,
    3535                                              uint32_t in_length,
    3636                                              uint64_t in_offset,
     
    4545NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req)
    4646{
     47        NTSTATUS status;
    4748        const uint8_t *inhdr;
    4849        const uint8_t *inbody;
    4950        int i = req->current_idx;
    50         size_t expected_body_size = 0x31;
    51         size_t body_size;
    5251        uint32_t in_smbpid;
    5352        uint32_t in_length;
     
    5554        uint64_t in_file_id_persistent;
    5655        uint64_t in_file_id_volatile;
     56        struct files_struct *in_fsp;
    5757        uint32_t in_minimum_count;
    5858        uint32_t in_remaining_bytes;
    5959        struct tevent_req *subreq;
    6060
     61        status = smbd_smb2_request_verify_sizes(req, 0x31);
     62        if (!NT_STATUS_IS_OK(status)) {
     63                return smbd_smb2_request_error(req, status);
     64        }
    6165        inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
    62         if (req->in.vector[i+1].iov_len != (expected_body_size & 0xFFFFFFFE)) {
    63                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    64         }
    65 
    6666        inbody = (const uint8_t *)req->in.vector[i+1].iov_base;
    67 
    68         body_size = SVAL(inbody, 0x00);
    69         if (body_size != expected_body_size) {
    70                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    71         }
    7267
    7368        in_smbpid = IVAL(inhdr, SMB2_HDR_PID);
     
    8176
    8277        /* check the max read size */
    83         if (in_length > lp_smb2_max_read()) {
     78        if (in_length > req->sconn->smb2.max_read) {
    8479                DEBUG(0,("here:%s: 0x%08X: 0x%08X\n",
    85                         __location__, in_length, lp_smb2_max_read()));
     80                        __location__, in_length, req->sconn->smb2.max_read));
    8681                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    8782        }
    8883
    89         if (req->compat_chain_fsp) {
    90                 /* skip check */
    91         } else if (in_file_id_persistent != in_file_id_volatile) {
     84        in_fsp = file_fsp_smb2(req, in_file_id_persistent, in_file_id_volatile);
     85        if (in_fsp == NULL) {
    9286                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
    9387        }
    9488
    95         subreq = smbd_smb2_read_send(req,
    96                                      req->sconn->smb2.event_ctx,
    97                                      req,
     89        subreq = smbd_smb2_read_send(req, req->sconn->smb2.event_ctx,
     90                                     req, in_fsp,
    9891                                     in_smbpid,
    99                                      in_file_id_volatile,
    10092                                     in_length,
    10193                                     in_offset,
     
    177169        struct smbd_smb2_request *smb2req;
    178170        files_struct *fsp;
    179         uint64_t in_file_id_volatile;
    180171        uint32_t in_length;
    181172        uint64_t in_offset;
     
    259250
    260251        init_strict_lock_struct(fsp,
    261                                 state->in_file_id_volatile,
     252                                fsp->fnum,
    262253                                in_offset,
    263254                                in_length,
     
    374365                                              struct tevent_context *ev,
    375366                                              struct smbd_smb2_request *smb2req,
     367                                              struct files_struct *fsp,
    376368                                              uint32_t in_smbpid,
    377                                               uint64_t in_file_id_volatile,
    378369                                              uint32_t in_length,
    379370                                              uint64_t in_offset,
     
    386377        struct smb_request *smbreq = NULL;
    387378        connection_struct *conn = smb2req->tcon->compat_conn;
    388         files_struct *fsp = NULL;
    389379        ssize_t nread = -1;
    390380        struct lock_struct lock;
     
    403393        state->out_remaining = 0;
    404394
    405         DEBUG(10,("smbd_smb2_read: file_id[0x%016llX]\n",
    406                   (unsigned long long)in_file_id_volatile));
     395        DEBUG(10,("smbd_smb2_read: %s - fnum[%d]\n",
     396                  fsp_str_dbg(fsp), fsp->fnum));
    407397
    408398        smbreq = smbd_smb2_fake_smb_request(smb2req);
     
    411401        }
    412402
    413         fsp = file_fsp(smbreq, (uint16_t)in_file_id_volatile);
    414         if (fsp == NULL) {
    415                 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
    416                 return tevent_req_post(req, ev);
    417         }
    418         if (conn != fsp->conn) {
    419                 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
    420                 return tevent_req_post(req, ev);
    421         }
    422         if (smb2req->session->vuid != fsp->vuid) {
    423                 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
    424                 return tevent_req_post(req, ev);
    425         }
    426403        if (fsp->is_directory) {
    427404                tevent_req_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST);
     
    430407
    431408        state->fsp = fsp;
    432         state->in_file_id_volatile = in_file_id_volatile;
    433409
    434410        if (IS_IPC(smbreq->conn)) {
     
    493469
    494470        init_strict_lock_struct(fsp,
    495                                 in_file_id_volatile,
     471                                fsp->fnum,
    496472                                in_offset,
    497473                                in_length,
     
    533509        SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
    534510
    535         DEBUG(10,("smbd_smb2_read: file %s handle [0x%016llX] offset=%llu "
     511        DEBUG(10,("smbd_smb2_read: file %s fnum[%d] offset=%llu "
    536512                "len=%llu returned %lld\n",
    537513                fsp_str_dbg(fsp),
    538                 (unsigned long long)in_file_id_volatile,
     514                fsp->fnum,
    539515                (unsigned long long)in_offset,
    540516                (unsigned long long)in_length,
Note: See TracChangeset for help on using the changeset viewer.