Changeset 204 for branches/samba-3.2.x/source/smbd
- Timestamp:
- May 20, 2009, 6:46:53 PM (16 years ago)
- Location:
- branches/samba-3.2.x/source/smbd
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/smbd/aio.c
r133 r204 25 25 /* The signal we'll use to signify aio done. */ 26 26 #ifndef RT_SIGNAL_AIO 27 #define RT_SIGNAL_AIO (SIGRTMIN+3) 27 #ifndef SIGRTMIN 28 #define SIGRTMIN NSIG 29 #endif 30 #define RT_SIGNAL_AIO (SIGRTMIN+3) 31 #endif 32 33 #ifndef HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR 34 #ifdef HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR 35 #define sival_int sigval_int 36 #define sival_ptr sigval_ptr 37 #endif 28 38 #endif 29 39 … … 269 279 a->aio_sigevent.sigev_value.sival_int = aio_ex->mid; 270 280 281 become_root(); 271 282 if (SMB_VFS_AIO_READ(fsp,a) == -1) { 272 283 DEBUG(0,("schedule_aio_read_and_X: aio_read failed. " 273 284 "Error %s\n", strerror(errno) )); 274 285 delete_aio_ex(aio_ex); 275 return False; 276 } 286 unbecome_root(); 287 return False; 288 } 289 unbecome_root(); 277 290 278 291 DEBUG(10,("schedule_aio_read_and_X: scheduled aio_read for file %s, " … … 367 380 a->aio_sigevent.sigev_value.sival_int = aio_ex->mid; 368 381 382 become_root(); 369 383 if (SMB_VFS_AIO_WRITE(fsp,a) == -1) { 370 384 DEBUG(3,("schedule_aio_wrote_and_X: aio_write failed. " 371 385 "Error %s\n", strerror(errno) )); 372 386 delete_aio_ex(aio_ex); 373 return False; 374 } 375 387 unbecome_root(); 388 return False; 389 } 390 unbecome_root(); 391 376 392 release_level_2_oplocks_on_change(fsp); 377 393 … … 576 592 int err; 577 593 594 if(!aio_ex) { 595 DEBUG(3, ("handle_aio_completed: Non-existing aio_ex passed\n")); 596 return false; 597 } 598 578 599 /* Ensure the operation has really completed. */ 579 600 if (SMB_VFS_AIO_ERROR(aio_ex->fsp, &aio_ex->acb) == EINPROGRESS) { -
branches/samba-3.2.x/source/smbd/build_options.c
r201 r204 1993 1993 output(screen, " HAVE_STAT_ST_ATIMENSEC\n"); 1994 1994 #endif 1995 #ifdef HAVE_STAT_ST_BIRTHTIME 1996 output(screen, " HAVE_STAT_ST_BIRTHTIME\n"); 1997 #endif 1998 #ifdef HAVE_STAT_ST_BIRTHTIMENSEC 1999 output(screen, " HAVE_STAT_ST_BIRTHTIMENSEC\n"); 2000 #endif 2001 #ifdef HAVE_STAT_ST_BIRTHTIMESPEC 2002 output(screen, " HAVE_STAT_ST_BIRTHTIMESPEC\n"); 2003 #endif 1995 2004 #ifdef HAVE_STAT_ST_BLKSIZE 1996 2005 output(screen, " HAVE_STAT_ST_BLKSIZE\n"); … … 2091 2100 #ifdef HAVE_STRUCT_SECMETHOD_TABLE_METHOD_VERSION 2092 2101 output(screen, " HAVE_STRUCT_SECMETHOD_TABLE_METHOD_VERSION\n"); 2102 #endif 2103 #ifdef HAVE_STRUCT_SIGEVENT 2104 output(screen, " HAVE_STRUCT_SIGEVENT\n"); 2105 #endif 2106 #ifdef HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR 2107 output(screen, " HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR\n"); 2108 #endif 2109 #ifdef HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR 2110 output(screen, " HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR\n"); 2093 2111 #endif 2094 2112 #ifdef HAVE_STRUCT_SOCKADDR -
branches/samba-3.2.x/source/smbd/dosmode.c
r149 r204 632 632 } 633 633 634 /****************************************************************** *635 Change a filetime - possibly allowing DOS semantics.636 *******************************************************************/ 637 638 bool set_write_time_path(connection_struct *conn, const char *fname, 639 struct file_id fileid, const struct timespec mtime,640 bool overwrite)634 /****************************************************************** 635 Force a "sticky" write time on a pathname. This will always be 636 returned on all future write time queries and set on close. 637 ******************************************************************/ 638 639 bool set_sticky_write_time_path(connection_struct *conn, const char *fname, 640 struct file_id fileid, const struct timespec mtime) 641 641 { 642 642 if (null_timespec(mtime)) { … … 644 644 } 645 645 646 if (!set_ write_time(fileid, mtime, overwrite)) {646 if (!set_sticky_write_time(fileid, mtime)) { 647 647 return false; 648 648 } 649 649 650 /* in the overwrite case the caller should trigger the notify */651 if (!overwrite) {652 notify_fname(conn, NOTIFY_ACTION_MODIFIED,653 FILE_NOTIFY_CHANGE_LAST_WRITE, fname);654 }655 656 650 return true; 657 651 } 658 652 659 bool set_write_time_fsp(struct files_struct *fsp, const struct timespec mtime, 660 bool overwrite) 661 { 662 if (overwrite) { 663 fsp->write_time_forced = true; 664 TALLOC_FREE(fsp->update_write_time_event); 665 } 666 667 return set_write_time_path(fsp->conn, fsp->fsp_name, fsp->file_id, 668 mtime, overwrite); 669 } 653 /****************************************************************** 654 Force a "sticky" write time on an fsp. This will always be 655 returned on all future write time queries and set on close. 656 ******************************************************************/ 657 658 bool set_sticky_write_time_fsp(struct files_struct *fsp, const struct timespec mtime) 659 { 660 fsp->write_time_forced = true; 661 TALLOC_FREE(fsp->update_write_time_event); 662 663 return set_sticky_write_time_path(fsp->conn, fsp->fsp_name, 664 fsp->file_id, mtime); 665 } 666 667 /****************************************************************** 668 Update a write time immediately, without the 2 second delay. 669 ******************************************************************/ 670 671 bool update_write_time(struct files_struct *fsp) 672 { 673 if (!set_write_time(fsp->file_id, timespec_current())) { 674 return false; 675 } 676 677 notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED, 678 FILE_NOTIFY_CHANGE_LAST_WRITE, fsp->fsp_name); 679 680 return true; 681 } -
branches/samba-3.2.x/source/smbd/fileio.c
r133 r204 177 177 void *private_data) 178 178 { 179 files_struct *fsp = (files_struct *)private_data; 180 181 /* Remove the timed event handler. */ 182 TALLOC_FREE(fsp->update_write_time_event); 183 DEBUG(5, ("Update write time on %s\n", fsp->fsp_name)); 184 185 /* change the write time if not already changed by someoneelse */ 186 set_write_time_fsp(fsp, timespec_current(), false); 187 } 179 files_struct *fsp = (files_struct *)private_data; 180 181 /* Remove the timed event handler. */ 182 TALLOC_FREE(fsp->update_write_time_event); 183 DEBUG(5, ("Update write time on %s\n", fsp->fsp_name)); 184 185 /* change the write time if not already changed by someone else */ 186 update_write_time(fsp); 187 } 188 189 /********************************************************* 190 Schedule a write time update for WRITE_TIME_UPDATE_USEC_DELAY 191 in the future. 192 *********************************************************/ 188 193 189 194 void trigger_write_time_update(struct files_struct *fsp) … … 192 197 193 198 if (fsp->write_time_forced) { 199 /* No point - "sticky" write times 200 * in effect. 201 */ 194 202 return; 195 203 } 196 204 197 205 if (fsp->update_write_time_triggered) { 206 /* 207 * We only update the write time 208 * on the first write. After that 209 * no other writes affect this. 210 */ 198 211 return; 199 212 } … … 211 224 "update_write_time_handler", 212 225 update_write_time_handler, fsp); 226 } 227 228 void trigger_write_time_update_immediate(struct files_struct *fsp) 229 { 230 if (fsp->write_time_forced) { 231 /* 232 * No point - "sticky" write times 233 * in effect. 234 */ 235 return; 236 } 237 238 TALLOC_FREE(fsp->update_write_time_event); 239 DEBUG(5, ("Update write time immediate on %s\n", fsp->fsp_name)); 240 241 fsp->update_write_time_triggered = true; 242 243 fsp->update_write_time_on_close = false; 244 update_write_time(fsp); 213 245 } 214 246 -
branches/samba-3.2.x/source/smbd/nttrans.c
r136 r204 114 114 + data_alignment_offset); 115 115 116 /* 117 * useable_space can never be more than max_send minus the 118 * alignment offset. 119 */ 120 121 useable_space = MIN(useable_space, 122 max_send - (alignment_offset+data_alignment_offset)); 123 116 if (useable_space < 0) { 117 DEBUG(0, ("send_nt_replies failed sanity useable_space " 118 "= %d!!!", useable_space)); 119 exit_server_cleanly("send_nt_replies: srv_send_smb failed."); 120 } 124 121 125 122 while (params_to_send || data_to_send) { … … 129 126 */ 130 127 131 total_sent_thistime = params_to_send + data_to_send + 132 alignment_offset + data_alignment_offset; 128 total_sent_thistime = params_to_send + data_to_send; 133 129 134 130 /* … … 138 134 total_sent_thistime = MIN(total_sent_thistime, useable_space); 139 135 140 reply_outbuf(req, 18, total_sent_thistime); 136 reply_outbuf(req, 18, 137 total_sent_thistime + alignment_offset 138 + data_alignment_offset); 141 139 142 140 /* … … 265 263 DEBUG(0,("send_nt_replies failed sanity check pts = %d, dts = %d\n!!!", 266 264 params_to_send, data_to_send)); 267 return;265 exit_server_cleanly("send_nt_replies: internal error"); 268 266 } 269 267 } … … 489 487 (unsigned int)root_dir_fid, 490 488 fname)); 489 490 /* 491 * we need to remove ignored bits when they come directly from the client 492 * because we reuse some of them for internal stuff 493 */ 494 create_options &= ~NTCREATEX_OPTIONS_MUST_IGNORE_MASK; 491 495 492 496 /* … … 900 904 #endif 901 905 906 /* 907 * we need to remove ignored bits when they come directly from the client 908 * because we reuse some of them for internal stuff 909 */ 910 create_options &= ~NTCREATEX_OPTIONS_MUST_IGNORE_MASK; 911 902 912 /* Ensure the data_len is correct for the sd and ea values given. */ 903 913 if ((ea_len + sd_len > data_count) -
branches/samba-3.2.x/source/smbd/open.c
r141 r204 1855 1855 /* Handle strange delete on close create semantics. */ 1856 1856 if ((create_options & FILE_DELETE_ON_CLOSE) 1857 && (is_ntfs_stream_name(fname) 1857 && (((conn->fs_capabilities & FILE_NAMED_STREAMS) 1858 && is_ntfs_stream_name(fname)) 1858 1859 || can_set_initial_delete_on_close(lck))) { 1859 1860 status = can_set_delete_on_close(fsp, True, new_dos_attributes); … … 2119 2120 (unsigned int)file_attributes)); 2120 2121 2121 if (!(file_attributes & FILE_FLAG_POSIX_SEMANTICS) && is_ntfs_stream_name(fname)) { 2122 if (!(file_attributes & FILE_FLAG_POSIX_SEMANTICS) && 2123 (conn->fs_capabilities & FILE_NAMED_STREAMS) && 2124 is_ntfs_stream_name(fname)) { 2122 2125 DEBUG(2, ("open_directory: %s is a stream name!\n", fname)); 2123 2126 return NT_STATUS_NOT_A_DIRECTORY; … … 2612 2615 if (create_options & FILE_OPEN_BY_FILE_ID) { 2613 2616 status = NT_STATUS_NOT_SUPPORTED; 2617 goto fail; 2618 } 2619 2620 if (create_options & NTCREATEX_OPTIONS_INVALID_PARAM_MASK) { 2621 status = NT_STATUS_INVALID_PARAMETER; 2614 2622 goto fail; 2615 2623 } … … 2957 2965 */ 2958 2966 2959 if (is_ntfs_stream_name(fname)) { 2967 if ((conn->fs_capabilities & FILE_NAMED_STREAMS) && 2968 is_ntfs_stream_name(fname)) { 2960 2969 status = NT_STATUS_OBJECT_PATH_NOT_FOUND; 2961 2970 goto fail; -
branches/samba-3.2.x/source/smbd/posix_acls.c
r141 r204 3401 3401 } 3402 3402 3403 parent_sd->dacl->aces = new_ace; 3404 parent_sd->dacl->num_aces = i; 3405 3406 *pp_new_sd = parent_sd; 3403 /* This sucks. psd should be const and we should 3404 * be doing a deep-copy here. We're getting away 3405 * with is as we know parent_sd is talloced off 3406 * talloc_tos() as well as psd. JRA. */ 3407 3408 psd->dacl->aces = new_ace; 3409 psd->dacl->num_aces = i; 3410 psd->type &= ~(SE_DESC_DACL_AUTO_INHERITED| 3411 SE_DESC_DACL_AUTO_INHERIT_REQ); 3412 3413 *pp_new_sd = psd; 3407 3414 return status; 3408 3415 } -
branches/samba-3.2.x/source/smbd/process.c
r149 r204 165 165 NTSTATUS status; 166 166 167 memcpy(writeX_header, lenbuf, sizeof(lenbuf));167 memcpy(writeX_header, lenbuf, 4); 168 168 169 169 status = read_socket_with_timeout( -
branches/samba-3.2.x/source/smbd/quotas.c
r133 r204 545 545 *dsize = D.dqb_bsoftlimit; 546 546 547 if (D.dqb_curblocks == D.dqb_curblocks ==1)547 if (D.dqb_curblocks == 1) 548 548 *bsize = 512; 549 549 … … 1105 1105 *dsize = D.dqb_bsoftlimit; 1106 1106 1107 if (D.dqb_curblocks == D.dqb_curblocks ==1)1107 if (D.dqb_curblocks == 1) 1108 1108 *bsize = DEV_BSIZE; 1109 1109 -
branches/samba-3.2.x/source/smbd/reply.c
r149 r204 3169 3169 3170 3170 if ((nread = SMB_VFS_SENDFILE(smbd_server_fd(), fsp, &header, startpos, smb_maxcnt)) == -1) { 3171 /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */ 3172 if (errno == ENOSYS) { 3171 /* Returning ENOSYS or EINVAL means no data at all was sent. 3172 Do this as a normal read. */ 3173 if (errno == ENOSYS || errno == EINVAL) { 3173 3174 goto normal_read; 3174 3175 } … … 3783 3784 return; 3784 3785 } 3785 } else 3786 trigger_write_time_update_immediate(fsp); 3787 } else { 3786 3788 nwritten = write_file(req,fsp,data,startpos,numtowrite); 3787 3789 } 3790 3788 3791 status = sync_file(conn, fsp, False); 3789 3792 if (!NT_STATUS_IS_OK(status)) { … … 7097 7100 int mode; 7098 7101 files_struct *fsp; 7102 struct timespec create_ts; 7099 7103 7100 7104 START_PROFILE(SMBgetattrE); … … 7131 7135 reply_outbuf(req, 11, 0); 7132 7136 7133 srv_put_dos_date2((char *)req->outbuf, smb_vwv0,7134 get_create_time(&sbuf,7135 lp_fake_dir_create_times(SNUM(conn))));7137 create_ts = get_create_timespec(&sbuf, 7138 lp_fake_dir_create_times(SNUM(conn))); 7139 srv_put_dos_date2((char *)req->outbuf, smb_vwv0, create_ts.tv_sec); 7136 7140 srv_put_dos_date2((char *)req->outbuf, smb_vwv2, sbuf.st_atime); 7137 7141 /* Should we check pending modtime here ? JRA */ -
branches/samba-3.2.x/source/smbd/sesssetup.c
r133 r204 1740 1740 } 1741 1741 1742 nt_status = create_local_token(server_info); 1743 if (!NT_STATUS_IS_OK(nt_status)) { 1744 DEBUG(10, ("create_local_token failed: %s\n", 1745 nt_errstr(nt_status))); 1746 data_blob_free(&nt_resp); 1747 data_blob_free(&lm_resp); 1748 data_blob_clear_free(&plaintext_password); 1749 reply_nterror(req, nt_status_squash(nt_status)); 1750 END_PROFILE(SMBsesssetupX); 1751 return; 1742 if (!server_info->ptok) { 1743 nt_status = create_local_token(server_info); 1744 1745 if (!NT_STATUS_IS_OK(nt_status)) { 1746 DEBUG(10, ("create_local_token failed: %s\n", 1747 nt_errstr(nt_status))); 1748 data_blob_free(&nt_resp); 1749 data_blob_free(&lm_resp); 1750 data_blob_clear_free(&plaintext_password); 1751 reply_nterror(req, nt_status_squash(nt_status)); 1752 END_PROFILE(SMBsesssetupX); 1753 return; 1754 } 1752 1755 } 1753 1756 -
branches/samba-3.2.x/source/smbd/trans2.c
r154 r204 749 749 + data_alignment_offset); 750 750 751 /* useable_space can never be more than max_send minus the alignment offset. */ 752 753 useable_space = MIN(useable_space, max_send - (alignment_offset+data_alignment_offset)); 751 if (useable_space < 0) { 752 DEBUG(0, ("send_trans2_replies failed sanity useable_space " 753 "= %d!!!", useable_space)); 754 exit_server_cleanly("send_trans2_replies: Not enough space"); 755 } 754 756 755 757 while (params_to_send || data_to_send) { 756 758 /* Calculate whether we will totally or partially fill this packet */ 757 759 758 total_sent_thistime = params_to_send + data_to_send + alignment_offset + data_alignment_offset;760 total_sent_thistime = params_to_send + data_to_send; 759 761 760 762 /* We can never send more than useable_space */ … … 766 768 */ 767 769 768 total_sent_thistime = MIN(total_sent_thistime, useable_space+ alignment_offset + data_alignment_offset); 769 770 reply_outbuf(req, 10, total_sent_thistime); 770 total_sent_thistime = MIN(total_sent_thistime, useable_space); 771 772 reply_outbuf(req, 10, total_sent_thistime + alignment_offset 773 + data_alignment_offset); 771 774 772 775 /* Set total params and data to be sent */ … … 1947 1950 case SMB_FIND_FILE_UNIX: 1948 1951 case SMB_FIND_FILE_UNIX_INFO2: 1952 /* Always use filesystem for UNIX mtime query. */ 1953 ask_sharemode = false; 1949 1954 if (!lp_unix_extensions()) { 1950 1955 reply_nterror(req, NT_STATUS_INVALID_LEVEL); … … 2304 2309 case SMB_FIND_FILE_UNIX: 2305 2310 case SMB_FIND_FILE_UNIX_INFO2: 2311 /* Always use filesystem for UNIX mtime query. */ 2312 ask_sharemode = false; 2306 2313 if (!lp_unix_extensions()) { 2307 2314 reply_nterror(req, NT_STATUS_INVALID_LEVEL); … … 4141 4148 } 4142 4149 4143 if (!null_timespec(write_time_ts) ) {4150 if (!null_timespec(write_time_ts) && !INFO_LEVEL_IS_UNIX(info_level)) { 4144 4151 mtime_ts = write_time_ts; 4145 4152 } … … 4896 4903 4897 4904 if (fsp != NULL) { 4898 set_ write_time_fsp(fsp, ts[1], true);4905 set_sticky_write_time_fsp(fsp, ts[1]); 4899 4906 } else { 4900 set_ write_time_path(conn, fname,4907 set_sticky_write_time_path(conn, fname, 4901 4908 vfs_file_id_from_sbuf(conn, psbuf), 4902 ts[1] , true);4909 ts[1]); 4903 4910 } 4904 4911 } … … 4992 4999 return map_nt_error_from_unix(errno); 4993 5000 } 5001 trigger_write_time_update_immediate(fsp); 4994 5002 return NT_STATUS_OK; 4995 5003 } … … 5015 5023 } 5016 5024 5025 trigger_write_time_update_immediate(new_fsp); 5017 5026 close_file(new_fsp,NORMAL_CLOSE); 5018 5027 return NT_STATUS_OK; … … 5740 5749 * if there are no pending writes. 5741 5750 */ 5742 trigger_write_time_update (fsp);5751 trigger_write_time_update_immediate(fsp); 5743 5752 return NT_STATUS_OK; 5744 5753 } … … 5774 5783 * if there are no pending writes. 5775 5784 */ 5776 trigger_write_time_update (new_fsp);5785 trigger_write_time_update_immediate(new_fsp); 5777 5786 5778 5787 close_file(new_fsp,NORMAL_CLOSE);
Note:
See TracChangeset
for help on using the changeset viewer.