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

    r745 r751  
    2929                                                      struct tevent_context *ev,
    3030                                                      struct smbd_smb2_request *smb2req,
    31                                                       uint8_t in_oplock_level,
    32                                                       uint64_t in_file_id_volatile);
     31                                                      struct files_struct *in_fsp,
     32                                                      uint8_t in_oplock_level);
    3333static NTSTATUS smbd_smb2_oplock_break_recv(struct tevent_req *req,
    3434                                            uint8_t *out_oplock_level);
     
    3737NTSTATUS smbd_smb2_request_process_break(struct smbd_smb2_request *req)
    3838{
    39         const uint8_t *inhdr;
     39        NTSTATUS status;
    4040        const uint8_t *inbody;
    4141        int i = req->current_idx;
    42         size_t expected_body_size = 0x18;
    43         size_t body_size;
    4442        uint8_t in_oplock_level;
    4543        uint64_t in_file_id_persistent;
    4644        uint64_t in_file_id_volatile;
     45        struct files_struct *in_fsp;
    4746        struct tevent_req *subreq;
    4847
    49         inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
    50         if (req->in.vector[i+1].iov_len != (expected_body_size & 0xFFFFFFFE)) {
    51                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    52         }
    53 
     48        status = smbd_smb2_request_verify_sizes(req, 0x18);
     49        if (!NT_STATUS_IS_OK(status)) {
     50                return smbd_smb2_request_error(req, status);
     51        }
    5452        inbody = (const uint8_t *)req->in.vector[i+1].iov_base;
    55 
    56         body_size = SVAL(inbody, 0x00);
    57         if (body_size != expected_body_size) {
    58                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    59         }
    6053
    6154        in_oplock_level         = CVAL(inbody, 0x02);
     
    7164        in_file_id_volatile             = BVAL(inbody, 0x10);
    7265
    73         if (req->compat_chain_fsp) {
    74                 /* skip check */
    75         } else if (in_file_id_persistent != in_file_id_volatile) {
     66        in_fsp = file_fsp_smb2(req, in_file_id_persistent, in_file_id_volatile);
     67        if (in_fsp == NULL) {
    7668                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
    7769        }
    7870
    79         subreq = smbd_smb2_oplock_break_send(req,
    80                                              req->sconn->smb2.event_ctx,
    81                                              req,
    82                                              in_oplock_level,
    83                                              in_file_id_volatile);
     71        subreq = smbd_smb2_oplock_break_send(req, req->sconn->smb2.event_ctx,
     72                                             req, in_fsp, in_oplock_level);
    8473        if (subreq == NULL) {
    8574                return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
     
    157146                                                      struct tevent_context *ev,
    158147                                                      struct smbd_smb2_request *smb2req,
    159                                                       uint8_t in_oplock_level,
    160                                                       uint64_t in_file_id_volatile)
     148                                                      struct files_struct *fsp,
     149                                                      uint8_t in_oplock_level)
    161150{
    162151        struct tevent_req *req;
    163152        struct smbd_smb2_oplock_break_state *state;
    164153        struct smb_request *smbreq;
    165         connection_struct *conn = smb2req->tcon->compat_conn;
    166         files_struct *fsp = NULL;
    167154        int oplocklevel = map_smb2_oplock_levels_to_samba(in_oplock_level);
    168155        bool break_to_none = (oplocklevel == NO_OPLOCK);
     
    177164        state->out_oplock_level = SMB2_OPLOCK_LEVEL_NONE;
    178165
    179         DEBUG(10,("smbd_smb2_oplock_break_send: file_id[0x%016llX] "
    180                 "samba level %d\n",
    181                 (unsigned long long)in_file_id_volatile,
    182                 oplocklevel));
     166        DEBUG(10,("smbd_smb2_oplock_break_send: %s - fnum[%d] "
     167                  "samba level %d\n",
     168                  fsp_str_dbg(fsp), fsp->fnum,
     169                  oplocklevel));
    183170
    184171        smbreq = smbd_smb2_fake_smb_request(smb2req);
    185172        if (tevent_req_nomem(smbreq, req)) {
    186                 return tevent_req_post(req, ev);
    187         }
    188 
    189         fsp = file_fsp(smbreq, (uint16_t)in_file_id_volatile);
    190         if (fsp == NULL) {
    191                 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
    192                 return tevent_req_post(req, ev);
    193         }
    194         if (conn != fsp->conn) {
    195                 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
    196                 return tevent_req_post(req, ev);
    197         }
    198         if (smb2req->session->vuid != fsp->vuid) {
    199                 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
    200173                return tevent_req_post(req, ev);
    201174        }
     
    265238                                SMB2_OPLOCK_LEVEL_NONE;
    266239        NTSTATUS status;
     240        uint64_t fsp_persistent = fsp_persistent_id(fsp);
    267241
    268242        DEBUG(10,("send_break_message_smb2: sending oplock break "
     
    273247
    274248        status = smbd_smb2_send_oplock_break(fsp->conn->sconn,
    275                                         (uint64_t)fsp->fnum,
     249                                        fsp_persistent,
    276250                                        (uint64_t)fsp->fnum,
    277251                                        smb2_oplock_level);
Note: See TracChangeset for help on using the changeset viewer.