Changeset 751 for trunk/server/source3/smbd/smb2_read.c
- Timestamp:
- Nov 29, 2012, 1:59:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/smbd/smb2_read.c
r745 r751 31 31 struct tevent_context *ev, 32 32 struct smbd_smb2_request *smb2req, 33 struct files_struct *in_fsp, 33 34 uint32_t in_smbpid, 34 uint64_t in_file_id_volatile,35 35 uint32_t in_length, 36 36 uint64_t in_offset, … … 45 45 NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req) 46 46 { 47 NTSTATUS status; 47 48 const uint8_t *inhdr; 48 49 const uint8_t *inbody; 49 50 int i = req->current_idx; 50 size_t expected_body_size = 0x31;51 size_t body_size;52 51 uint32_t in_smbpid; 53 52 uint32_t in_length; … … 55 54 uint64_t in_file_id_persistent; 56 55 uint64_t in_file_id_volatile; 56 struct files_struct *in_fsp; 57 57 uint32_t in_minimum_count; 58 58 uint32_t in_remaining_bytes; 59 59 struct tevent_req *subreq; 60 60 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 } 61 65 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 66 66 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 }72 67 73 68 in_smbpid = IVAL(inhdr, SMB2_HDR_PID); … … 81 76 82 77 /* check the max read size */ 83 if (in_length > lp_smb2_max_read()) {78 if (in_length > req->sconn->smb2.max_read) { 84 79 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)); 86 81 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); 87 82 } 88 83 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) { 92 86 return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED); 93 87 } 94 88 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, 98 91 in_smbpid, 99 in_file_id_volatile,100 92 in_length, 101 93 in_offset, … … 177 169 struct smbd_smb2_request *smb2req; 178 170 files_struct *fsp; 179 uint64_t in_file_id_volatile;180 171 uint32_t in_length; 181 172 uint64_t in_offset; … … 259 250 260 251 init_strict_lock_struct(fsp, 261 state->in_file_id_volatile,252 fsp->fnum, 262 253 in_offset, 263 254 in_length, … … 374 365 struct tevent_context *ev, 375 366 struct smbd_smb2_request *smb2req, 367 struct files_struct *fsp, 376 368 uint32_t in_smbpid, 377 uint64_t in_file_id_volatile,378 369 uint32_t in_length, 379 370 uint64_t in_offset, … … 386 377 struct smb_request *smbreq = NULL; 387 378 connection_struct *conn = smb2req->tcon->compat_conn; 388 files_struct *fsp = NULL;389 379 ssize_t nread = -1; 390 380 struct lock_struct lock; … … 403 393 state->out_remaining = 0; 404 394 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)); 407 397 408 398 smbreq = smbd_smb2_fake_smb_request(smb2req); … … 411 401 } 412 402 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 }426 403 if (fsp->is_directory) { 427 404 tevent_req_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST); … … 430 407 431 408 state->fsp = fsp; 432 state->in_file_id_volatile = in_file_id_volatile;433 409 434 410 if (IS_IPC(smbreq->conn)) { … … 493 469 494 470 init_strict_lock_struct(fsp, 495 in_file_id_volatile,471 fsp->fnum, 496 472 in_offset, 497 473 in_length, … … 533 509 SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); 534 510 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 " 536 512 "len=%llu returned %lld\n", 537 513 fsp_str_dbg(fsp), 538 (unsigned long long)in_file_id_volatile,514 fsp->fnum, 539 515 (unsigned long long)in_offset, 540 516 (unsigned long long)in_length,
Note:
See TracChangeset
for help on using the changeset viewer.