Changeset 751 for trunk/server/source3/smbd/smb2_lock.c
- Timestamp:
- Nov 29, 2012, 1:59:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/smbd/smb2_lock.c
r745 r751 47 47 struct tevent_context *ev, 48 48 struct smbd_smb2_request *smb2req, 49 struct files_struct *in_fsp, 49 50 uint32_t in_smbpid, 50 uint64_t in_file_id_volatile,51 51 uint16_t in_lock_count, 52 52 struct smbd_smb2_lock_element *in_locks); … … 59 59 const uint8_t *inbody; 60 60 const int i = req->current_idx; 61 size_t expected_body_size = 0x30;62 size_t body_size;63 61 uint32_t in_smbpid; 64 62 uint16_t in_lock_count; 65 63 uint64_t in_file_id_persistent; 66 64 uint64_t in_file_id_volatile; 65 struct files_struct *in_fsp; 67 66 struct smbd_smb2_lock_element *in_locks; 68 67 struct tevent_req *subreq; 69 68 const uint8_t *lock_buffer; 70 69 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 } 72 76 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 77 77 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 }83 78 84 79 in_smbpid = IVAL(inhdr, SMB2_HDR_PID); … … 95 90 if (((in_lock_count - 1) * 0x18) > req->in.vector[i+2].iov_len) { 96 91 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);103 92 } 104 93 … … 128 117 } 129 118 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, 133 126 in_smbpid, 134 in_file_id_volatile,135 127 in_lock_count, 136 128 in_locks); … … 214 206 struct tevent_context *ev, 215 207 struct smbd_smb2_request *smb2req, 208 struct files_struct *fsp, 216 209 uint32_t in_smbpid, 217 uint64_t in_file_id_volatile,218 210 uint16_t in_lock_count, 219 211 struct smbd_smb2_lock_element *in_locks) … … 222 214 struct smbd_smb2_lock_state *state; 223 215 struct smb_request *smb1req; 224 connection_struct *conn = smb2req->tcon->compat_conn;225 files_struct *fsp;226 216 int32_t timeout = -1; 227 217 bool isunlock = false; … … 245 235 state->smb1req = smb1req; 246 236 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)); 263 239 264 240 locks = talloc_array(state, struct smbd_lock_element, in_lock_count); … … 342 318 } 343 319 344 locks[i].smblctx = in_file_id_volatile;320 locks[i].smblctx = fsp->fnum; 345 321 locks[i].offset = in_locks[i].offset; 346 322 locks[i].count = in_locks[i].length; … … 873 849 files_struct *fsp_curr = NULL; 874 850 int i = smb2req->current_idx; 875 uint64_t in_file_id_volatile;876 851 struct blocking_lock_record *blr = NULL; 877 852 const uint8_t *inhdr; 878 const uint8_t *inbody;879 853 880 854 nextreq = smb2req->next; … … 894 868 continue; 895 869 } 896 897 inbody = (const uint8_t *)smb2req->in.vector[i+1].iov_base;898 in_file_id_volatile = BVAL(inbody, 0x10);899 870 900 871 state = tevent_req_data(smb2req->subreq, … … 905 876 } 906 877 907 fsp_curr = file_fsp(state->smb1req, (uint16_t)in_file_id_volatile);878 fsp_curr = smb2req->compat_chain_fsp; 908 879 if (fsp_curr == NULL) { 909 880 /* Strange - is this even possible ? */
Note:
See TracChangeset
for help on using the changeset viewer.