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

    r745 r751  
    4040        uint8_t *outhdr;
    4141        DATA_BLOB outbody;
    42         size_t expected_body_size = 0x09;
    43         size_t body_size;
    4442        uint16_t in_path_offset;
    4543        uint16_t in_path_length;
     
    5553        bool ok;
    5654
    57         if (req->in.vector[i+1].iov_len != (expected_body_size & 0xFFFFFFFE)) {
    58                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    59         }
    60 
     55        status = smbd_smb2_request_verify_sizes(req, 0x09);
     56        if (!NT_STATUS_IS_OK(status)) {
     57                return smbd_smb2_request_error(req, status);
     58        }
    6159        inbody = (const uint8_t *)req->in.vector[i+1].iov_base;
    62 
    63         body_size = SVAL(inbody, 0x00);
    64         if (body_size != expected_body_size) {
    65                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    66         }
    6760
    6861        in_path_offset = SVAL(inbody, 0x04);
    6962        in_path_length = SVAL(inbody, 0x06);
    7063
    71         if (in_path_offset != (SMB2_HDR_BODY + (body_size & 0xFFFFFFFE))) {
     64        if (in_path_offset != (SMB2_HDR_BODY + req->in.vector[i+1].iov_len)) {
    7265                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    7366        }
     
    8780        if (!ok) {
    8881                return smbd_smb2_request_error(req, NT_STATUS_ILLEGAL_CHARACTER);
     82        }
     83
     84        if (in_path_buffer.length == 0) {
     85                in_path_string_size = 0;
     86        }
     87
     88        if (strlen(in_path_string) != in_path_string_size) {
     89                return smbd_smb2_request_error(req, NT_STATUS_BAD_NETWORK_NAME);
    8990        }
    9091
     
    228229        talloc_set_destructor(tcon, smbd_smb2_tcon_destructor);
    229230
    230         compat_conn = make_connection_snum(req->sconn,
    231                                         snum, req->session->compat_vuser,
     231        compat_conn = make_connection_smb2(req->sconn,
     232                                        tcon,
     233                                        req->session->compat_vuser,
    232234                                        data_blob_null, "???",
    233235                                        &status);
     
    237239        }
    238240        tcon->compat_conn = talloc_move(tcon, &compat_conn);
    239         tcon->compat_conn->cnum = tcon->tid;
    240241
    241242        if (IS_PRINT(tcon->compat_conn)) {
     
    281282{
    282283        const uint8_t *inhdr;
    283         const uint8_t *outhdr;
    284284        int i = req->current_idx;
     285        uint32_t in_flags;
    285286        uint32_t in_tid;
    286287        void *p;
    287288        struct smbd_smb2_tcon *tcon;
    288         bool chained_fixup = false;
     289
     290        req->tcon = NULL;
    289291
    290292        inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
    291293
     294        in_flags = IVAL(inhdr, SMB2_HDR_FLAGS);
    292295        in_tid = IVAL(inhdr, SMB2_HDR_TID);
    293296
    294         if (in_tid == (0xFFFFFFFF)) {
    295                 if (req->async) {
    296                         /*
    297                          * async request - fill in tid from
    298                          * already setup out.vector[].iov_base.
    299                          */
    300                         outhdr = (const uint8_t *)req->out.vector[i].iov_base;
    301                         in_tid = IVAL(outhdr, SMB2_HDR_TID);
    302                 } else if (i > 2) {
    303                         /*
    304                          * Chained request - fill in tid from
    305                          * the previous request out.vector[].iov_base.
    306                          */
    307                         outhdr = (const uint8_t *)req->out.vector[i-3].iov_base;
    308                         in_tid = IVAL(outhdr, SMB2_HDR_TID);
    309                         chained_fixup = true;
    310                 }
    311         }
     297        if (in_flags & SMB2_HDR_FLAG_CHAINED) {
     298                in_tid = req->last_tid;
     299        }
     300
     301        req->last_tid = UINT32_MAX;
    312302
    313303        /* lookup an existing session */
     
    328318
    329319        req->tcon = tcon;
    330 
    331         if (chained_fixup) {
    332                 /* Fix up our own outhdr. */
    333                 outhdr = (const uint8_t *)req->out.vector[i].iov_base;
    334                 SIVAL(outhdr, SMB2_HDR_TID, in_tid);
    335         }
     320        req->last_tid = in_tid;
    336321
    337322        return NT_STATUS_OK;
     
    340325NTSTATUS smbd_smb2_request_process_tdis(struct smbd_smb2_request *req)
    341326{
    342         const uint8_t *inbody;
    343         int i = req->current_idx;
     327        NTSTATUS status;
    344328        DATA_BLOB outbody;
    345         size_t expected_body_size = 0x04;
    346         size_t body_size;
    347 
    348         if (req->in.vector[i+1].iov_len != (expected_body_size & 0xFFFFFFFE)) {
    349                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
    350         }
    351 
    352         inbody = (const uint8_t *)req->in.vector[i+1].iov_base;
    353 
    354         body_size = SVAL(inbody, 0x00);
    355         if (body_size != expected_body_size) {
    356                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
     329
     330        status = smbd_smb2_request_verify_sizes(req, 0x04);
     331        if (!NT_STATUS_IS_OK(status)) {
     332                return smbd_smb2_request_error(req, status);
    357333        }
    358334
Note: See TracChangeset for help on using the changeset viewer.