Changeset 751 for trunk/server/source3/smbd/smb2_tcon.c
- Timestamp:
- Nov 29, 2012, 1:59:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/smbd/smb2_tcon.c
r745 r751 40 40 uint8_t *outhdr; 41 41 DATA_BLOB outbody; 42 size_t expected_body_size = 0x09;43 size_t body_size;44 42 uint16_t in_path_offset; 45 43 uint16_t in_path_length; … … 55 53 bool ok; 56 54 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 } 61 59 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 }67 60 68 61 in_path_offset = SVAL(inbody, 0x04); 69 62 in_path_length = SVAL(inbody, 0x06); 70 63 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)) { 72 65 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); 73 66 } … … 87 80 if (!ok) { 88 81 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); 89 90 } 90 91 … … 228 229 talloc_set_destructor(tcon, smbd_smb2_tcon_destructor); 229 230 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, 232 234 data_blob_null, "???", 233 235 &status); … … 237 239 } 238 240 tcon->compat_conn = talloc_move(tcon, &compat_conn); 239 tcon->compat_conn->cnum = tcon->tid;240 241 241 242 if (IS_PRINT(tcon->compat_conn)) { … … 281 282 { 282 283 const uint8_t *inhdr; 283 const uint8_t *outhdr;284 284 int i = req->current_idx; 285 uint32_t in_flags; 285 286 uint32_t in_tid; 286 287 void *p; 287 288 struct smbd_smb2_tcon *tcon; 288 bool chained_fixup = false; 289 290 req->tcon = NULL; 289 291 290 292 inhdr = (const uint8_t *)req->in.vector[i+0].iov_base; 291 293 294 in_flags = IVAL(inhdr, SMB2_HDR_FLAGS); 292 295 in_tid = IVAL(inhdr, SMB2_HDR_TID); 293 296 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; 312 302 313 303 /* lookup an existing session */ … … 328 318 329 319 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; 336 321 337 322 return NT_STATUS_OK; … … 340 325 NTSTATUS smbd_smb2_request_process_tdis(struct smbd_smb2_request *req) 341 326 { 342 const uint8_t *inbody; 343 int i = req->current_idx; 327 NTSTATUS status; 344 328 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); 357 333 } 358 334
Note:
See TracChangeset
for help on using the changeset viewer.