Changeset 745 for trunk/server/source3/modules/onefs_open.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/modules/onefs_open.c
r596 r745 34 34 35 35 #include "includes.h" 36 #include "smbd/smbd.h" 36 37 #include "onefs.h" 37 38 #include "onefs_config.h" … … 55 56 uint32_t oplock_request, 56 57 uint64_t allocation_size, 58 uint32_t private_flags, 57 59 struct security_descriptor *sd, 58 60 struct ea_list *ea_list, … … 313 315 True : False; 314 316 } 315 fsp->print_file = False;317 fsp->print_file = NULL; 316 318 fsp->modified = False; 317 319 fsp->sent_oplock_break = NO_BREAK_SENT; … … 326 328 327 329 DEBUG(2,("%s opened file %s read=%s write=%s (numopen=%d)\n", 328 conn->se rver_info->unix_name,330 conn->session_info->unix_name, 329 331 smb_fname_str_dbg(smb_fname), 330 332 BOOLSTR(fsp->can_read), BOOLSTR(fsp->can_write), … … 358 360 if (procid_is_me(&e->pid) && (e->op_mid == req->mid)) { 359 361 DEBUG(0, ("Trying to defer an already deferred " 360 "request: mid=%d, exiting\n", req->mid)); 362 "request: mid=%llu, exiting\n", 363 (unsigned long long)req->mid)); 361 364 exit_server("attempt to defer a deferred request"); 362 365 } … … 366 369 367 370 DEBUG(10,("defer_open_sharing_error: time [%u.%06u] adding deferred " 368 "open entry for mid % u\n",371 "open entry for mid %llu\n", 369 372 (unsigned int)request_time.tv_sec, 370 373 (unsigned int)request_time.tv_usec, 371 (unsigned int)req->mid));372 373 if (!push_deferred_ smb_message(req, request_time, timeout,374 (char *)state, sizeof(*state))) {375 exit_server("push_deferred_ smb_messagefailed");374 (unsigned long long)req->mid)); 375 376 if (!push_deferred_open_message_smb(req, request_time, timeout, 377 state->id, (char *)state, sizeof(*state))) { 378 exit_server("push_deferred_open_message_smb failed"); 376 379 } 377 380 add_deferred_open(lck, req->mid, request_time, state->id); … … 439 442 uint32 new_dos_attributes, 440 443 int oplock_request, 444 uint32_t private_flags, 441 445 struct security_descriptor *sd, 442 446 files_struct *fsp, … … 456 460 int info; 457 461 uint32 existing_dos_attributes = 0; 458 struct pending_message_list *pml = NULL;459 462 struct timeval request_time = timeval_zero(); 460 463 struct share_mode_lock *lck = NULL; … … 482 485 smb_fname_str_dbg(smb_fname))); 483 486 484 return print_ fsp_open(req, conn, smb_fname->base_name,485 req->vuid, fsp);487 return print_spool_open(fsp, smb_fname->base_name, 488 req->vuid); 486 489 } 487 490 … … 496 499 new_dos_attributes = 0; 497 500 } else { 498 /* We add aARCHto this as this mode is only used if the file is501 /* We add FILE_ATTRIBUTE_ARCHIVE to this as this mode is only used if the file is 499 502 * created new. */ 500 unx_mode = unix_mode(conn, new_dos_attributes | aARCH,503 unx_mode = unix_mode(conn, new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE, 501 504 smb_fname, parent_dir); 502 505 } … … 541 544 */ 542 545 543 if ((req != NULL) 544 && ((pml = get_open_deferred_message(req->mid)) != NULL)) { 545 struct deferred_open_record *state = 546 (struct deferred_open_record *)pml->private_data.data; 547 548 /* Remember the absolute time of the original 549 request with this mid. We'll use it later to 550 see if this has timed out. */ 551 552 request_time = pml->request_time; 553 554 /* Remove the deferred open entry under lock. */ 555 lck = get_share_mode_lock(talloc_tos(), state->id, NULL, NULL, 556 NULL); 557 if (lck == NULL) { 558 DEBUG(0, ("could not get share mode lock\n")); 559 } else { 560 del_deferred_open_entry(lck, req->mid); 561 TALLOC_FREE(lck); 562 } 563 564 /* Ensure we don't reprocess this message. */ 565 remove_deferred_open_smb_message(req->mid); 566 567 /* 568 * When receiving a semlock_async_failure message, the 569 * deferred open will be marked as "failed". Returning 570 * INTERNAL_ERROR. 571 */ 572 if (state->failed) { 573 DEBUG(0, ("onefs_open_file_ntcreate: " 574 "semlock_async_failure detected!\n")); 575 return NT_STATUS_INTERNAL_ERROR; 546 if (req) { 547 void *ptr; 548 if (get_deferred_open_message_state(req, 549 &request_time, 550 &ptr)) { 551 struct deferred_open_record *state = (struct deferred_open_record *)ptr; 552 553 /* Remember the absolute time of the original 554 request with this mid. We'll use it later to 555 see if this has timed out. */ 556 557 /* Remove the deferred open entry under lock. */ 558 remove_deferred_open_entry(state->id, req->mid); 559 560 /* Ensure we don't reprocess this message. */ 561 remove_deferred_open_message_smb(req->mid); 562 563 /* 564 * When receiving a semlock_async_failure message, the 565 * deferred open will be marked as "failed". Returning 566 * INTERNAL_ERROR. 567 */ 568 if (state->failed) { 569 DEBUG(0, ("onefs_open_file_ntcreate: " 570 "semlock_async_failure detected!\n")); 571 return NT_STATUS_INTERNAL_ERROR; 572 } 576 573 } 577 574 } … … 591 588 /* Setup dos_attributes to be set by ifs_createfile */ 592 589 if (lp_store_dos_attributes(SNUM(conn))) { 593 createfile_attributes = (new_dos_attributes | aARCH) &590 createfile_attributes = (new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE) & 594 591 ~(FILE_ATTRIBUTE_NONINDEXED | FILE_ATTRIBUTE_COMPRESSED); 595 592 } 596 593 597 594 /* Ignore oplock requests if oplocks are disabled. */ 598 if (!lp_oplocks(SNUM(conn)) || global_client_failed_oplock_break ||595 if (!lp_oplocks(SNUM(conn)) || 599 596 IS_VETO_OPLOCK_PATH(conn, smb_fname->base_name)) { 600 597 /* Mask off everything except the private Samba bits. */ … … 819 816 820 817 fsp->share_access = share_access; 821 fsp->fh->private_options = create_options;818 fsp->fh->private_options = private_flags; 822 819 fsp->access_mask = open_access_mask; /* We change this to the 823 820 * requested access_mask after … … 993 990 994 991 /* Try to find dup fsp if possible. */ 995 if ( create_options &992 if (private_flags & 996 993 (NTCREATEX_OPTIONS_PRIVATE_DENY_DOS| 997 994 NTCREATEX_OPTIONS_PRIVATE_DENY_FCB)) { … … 1262 1259 */ 1263 1260 1264 /* Record the options we were opened with. */1265 fsp->share_access = share_access;1266 fsp->fh->private_options = create_options;1267 1261 /* 1268 1262 * According to Samba4, SEC_FILE_READ_ATTRIBUTE is always granted, … … 1317 1311 } 1318 1312 1319 set_share_mode(lck, fsp, conn->server_info->utok.uid, 0, 1313 set_share_mode(lck, fsp, get_current_uid(conn), 1314 req ? req->mid : 0, 1320 1315 fsp->oplock_type); 1321 1316 … … 1489 1484 file_attributes = 0; 1490 1485 } else { 1491 mode = unix_mode(conn, aDIR, smb_dname, parent_dir);1486 mode = unix_mode(conn, FILE_ATTRIBUTE_DIRECTORY, smb_dname, parent_dir); 1492 1487 } 1493 1488 … … 1630 1625 1631 1626 fsp->share_access = share_access; 1632 fsp->fh->private_options = create_options;1627 fsp->fh->private_options = 0; 1633 1628 /* 1634 1629 * According to Samba4, SEC_FILE_READ_ATTRIBUTE is always granted, 1635 1630 */ 1636 1631 fsp->access_mask = access_mask | FILE_READ_ATTRIBUTES; 1637 fsp->print_file = False;1632 fsp->print_file = NULL; 1638 1633 fsp->modified = False; 1639 1634 fsp->oplock_type = NO_OPLOCK; … … 1673 1668 } 1674 1669 1675 set_share_mode(lck, fsp, conn->server_info->utok.uid, 0, NO_OPLOCK); 1670 set_share_mode(lck, fsp, get_current_uid(conn), 1671 req ? req->mid : 0, NO_OPLOCK); 1676 1672 1677 1673 /* … … 1719 1715 uint32_t oplock_request, 1720 1716 uint64_t allocation_size, 1717 uint32_t private_flags, 1721 1718 struct security_descriptor *sd, 1722 1719 struct ea_list *ea_list, … … 1733 1730 "file_attributes = 0x%x, share_access = 0x%x, " 1734 1731 "create_disposition = 0x%x create_options = 0x%x " 1735 "oplock_request = 0x%x ea_list = 0x%p, sd = 0x%p, " 1732 "oplock_request = 0x%x private_flags = 0x%x " 1733 "ea_list = 0x%p, sd = 0x%p, " 1736 1734 "fname = %s\n", 1737 1735 (unsigned int)access_mask, … … 1741 1739 (unsigned int)create_options, 1742 1740 (unsigned int)oplock_request, 1741 (unsigned int)private_flags, 1743 1742 ea_list, sd, smb_fname_str_dbg(smb_fname))); 1744 1743 … … 1824 1823 NO_OPLOCK, /* oplock_request */ 1825 1824 0, /* allocation_size */ 1825 0, /* private_flags */ 1826 1826 NULL, /* sd */ 1827 1827 NULL, /* ea_list */ … … 2067 2067 uint32_t oplock_request, 2068 2068 uint64_t allocation_size, 2069 uint32_t private_flags, 2069 2070 struct security_descriptor *sd, 2070 2071 struct ea_list *ea_list, … … 2081 2082 "file_attributes = 0x%x, share_access = 0x%x, " 2082 2083 "create_disposition = 0x%x create_options = 0x%x " 2083 "oplock_request = 0x%x "2084 "oplock_request = 0x%x private_flags = 0x%x" 2084 2085 "root_dir_fid = 0x%x, ea_list = 0x%p, sd = 0x%p, " 2085 2086 "fname = %s\n", … … 2090 2091 (unsigned int)create_options, 2091 2092 (unsigned int)oplock_request, 2093 (unsigned int)private_flags, 2092 2094 (unsigned int)root_dir_fid, 2093 2095 ea_list, sd, smb_fname_str_dbg(smb_fname))); … … 2108 2110 if (!NT_STATUS_IS_OK(status)) { 2109 2111 goto fail; 2112 } 2113 2114 if (is_ntfs_stream_smb_fname(smb_fname)) { 2115 if (!(conn->fs_capabilities & FILE_NAMED_STREAMS)) { 2116 status = NT_STATUS_OBJECT_NAME_NOT_FOUND; 2117 goto fail; 2118 } 2119 2120 if (is_ntfs_default_stream_smb_fname(smb_fname)) { 2121 int ret; 2122 smb_fname->stream_name = NULL; 2123 /* We have to handle this error here. */ 2124 if (create_options & FILE_DIRECTORY_FILE) { 2125 status = NT_STATUS_NOT_A_DIRECTORY; 2126 goto fail; 2127 } 2128 if (lp_posix_pathnames()) { 2129 ret = SMB_VFS_LSTAT(conn, smb_fname); 2130 } else { 2131 ret = SMB_VFS_STAT(conn, smb_fname); 2132 } 2133 2134 if (ret == 0 && VALID_STAT_OF_DIR(smb_fname->st)) { 2135 status = NT_STATUS_FILE_IS_A_DIRECTORY; 2136 goto fail; 2137 } 2138 } 2110 2139 } 2111 2140 … … 2121 2150 oplock_request, /* oplock_request */ 2122 2151 allocation_size, /* allocation_size */ 2152 private_flags, 2123 2153 sd, /* sd */ 2124 2154 ea_list, /* ea_list */
Note:
See TracChangeset
for help on using the changeset viewer.