Changeset 860 for vendor/current/source3/modules
- Timestamp:
- May 12, 2014, 8:58:38 PM (11 years ago)
- Location:
- vendor/current/source3/modules
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/modules/vfs_acl_common.c
r746 r860 647 647 fsp->access_mask, 648 648 &access_granted); 649 if (!NT_STATUS_IS_OK(status)) { 649 /* 650 * Check if we need to override ACCESS_DENIED for DELETE_ACCESS. 651 * Do this if we only failed open on DELETE_ACCESS, and 652 * we have permission to delete from the parent directory. 653 */ 654 if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) && 655 (fsp->access_mask & DELETE_ACCESS) && 656 (access_granted == DELETE_ACCESS) && 657 can_delete_file_in_directory(handle->conn, smb_fname)) { 658 DEBUG(10,("open_acl_xattr: " 659 "overrode " 660 "DELETE_ACCESS on " 661 "file %s\n", 662 smb_fname_str_dbg(smb_fname))); 663 status = NT_STATUS_OK; 664 } else if (!NT_STATUS_IS_OK(status)) { 650 665 DEBUG(10,("open_acl_xattr: %s open " 651 666 "for access 0x%x (0x%x) " -
vendor/current/source3/modules/vfs_aio_pthread.c
r748 r860 75 75 int ret = 0; 76 76 int num_threads; 77 int fd; 77 78 78 79 if (pool) { … … 86 87 return false; 87 88 } 89 90 fd = pthreadpool_signal_fd(pool); 91 92 set_blocking(fd, false); 93 88 94 sock_event = tevent_add_fd(server_event_context(), 89 95 NULL, 90 pthreadpool_signal_fd(pool),96 fd, 91 97 TEVENT_FD_READ, 92 98 aio_pthread_handle_completion, … … 291 297 } 292 298 293 ret = pthreadpool_finished_job(pool, &jobid); 294 if (ret) { 295 smb_panic("aio_pthread_handle_completion"); 296 return; 297 } 298 299 pd = find_private_data_by_jobid(jobid); 300 if (pd == NULL) { 301 DEBUG(1, ("aio_pthread_handle_completion cannot find jobid %d\n", 302 jobid)); 303 return; 304 } 305 306 aio_ex = (struct aio_extra *)pd->aiocb->aio_sigevent.sigev_value.sival_ptr; 307 smbd_aio_complete_aio_ex(aio_ex); 308 309 DEBUG(10,("aio_pthread_handle_completion: jobid %d completed\n", 310 jobid )); 311 TALLOC_FREE(aio_ex); 299 while (true) { 300 ret = pthreadpool_finished_job(pool, &jobid); 301 302 if (ret == EINTR || ret == EAGAIN) { 303 return; 304 } 305 #ifdef EWOULDBLOCK 306 if (ret == EWOULDBLOCK) { 307 return; 308 } 309 #endif 310 311 if (ret == ECANCELED) { 312 return; 313 } 314 315 if (ret) { 316 smb_panic("aio_pthread_handle_completion"); 317 return; 318 } 319 320 pd = find_private_data_by_jobid(jobid); 321 if (pd == NULL) { 322 DEBUG(1, ("aio_pthread_handle_completion cannot find " 323 "jobid %d\n", jobid)); 324 return; 325 } 326 327 aio_ex = (struct aio_extra *) 328 pd->aiocb->aio_sigevent.sigev_value.sival_ptr; 329 330 smbd_aio_complete_aio_ex(aio_ex); 331 332 DEBUG(10,("aio_pthread_handle_completion: jobid %d " 333 "completed\n", jobid )); 334 TALLOC_FREE(aio_ex); 335 } 312 336 } 313 337 -
vendor/current/source3/modules/vfs_catia.c
r740 r860 11 11 * Copyright (C) Volker Lendecke, 2005 12 12 * Copyright (C) Aravind Srinivasan, 2009 13 * Copyright (C) Guenter Kukkukk, 2013 13 14 * 14 15 * This program is free software; you can redistribute it and/or modify … … 29 30 #include "includes.h" 30 31 #include "smbd/smbd.h" 32 33 static int vfs_catia_debug_level = DBGC_VFS; 34 35 #undef DBGC_CLASS 36 #define DBGC_CLASS vfs_catia_debug_level 31 37 32 38 #define GLOBAL_SNUM 0xFFFFFFF … … 296 302 char *name = NULL; 297 303 char *mapped_name; 298 NTSTATUS ret;304 NTSTATUS status, ret; 299 305 300 306 /* … … 309 315 return NT_STATUS_NO_MEMORY; 310 316 } 311 ret= catia_string_replace_allocate(handle->conn, name,317 status = catia_string_replace_allocate(handle->conn, name, 312 318 &mapped_name, direction); 313 319 314 320 TALLOC_FREE(name); 315 if (!NT_STATUS_IS_OK( ret)) {316 return ret;321 if (!NT_STATUS_IS_OK(status)) { 322 return status; 317 323 } 318 324 … … 322 328 if (NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED)) { 323 329 *pmapped_name = talloc_move(mem_ctx, &mapped_name); 330 /* we need to return the former translation result here */ 331 ret = status; 324 332 } else { 325 333 TALLOC_FREE(mapped_name); … … 1021 1029 NTSTATUS vfs_catia_init(void) 1022 1030 { 1023 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "catia", 1031 NTSTATUS ret; 1032 1033 ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "catia", 1024 1034 &vfs_catia_fns); 1025 } 1035 if (!NT_STATUS_IS_OK(ret)) 1036 return ret; 1037 1038 vfs_catia_debug_level = debug_add_class("catia"); 1039 if (vfs_catia_debug_level == -1) { 1040 vfs_catia_debug_level = DBGC_VFS; 1041 DEBUG(0, ("vfs_catia: Couldn't register custom debugging " 1042 "class!\n")); 1043 } else { 1044 DEBUG(10, ("vfs_catia: Debug class number of " 1045 "'catia': %d\n", vfs_catia_debug_level)); 1046 } 1047 1048 return ret; 1049 1050 } -
vendor/current/source3/modules/vfs_dirsort.c
r740 r860 31 31 long pos; 32 32 SMB_STRUCT_DIRENT *directory_list; 33 longnumber_of_entries;34 time_tmtime;33 unsigned int number_of_entries; 34 struct timespec mtime; 35 35 SMB_STRUCT_DIR *source_directory; 36 int fd; 36 files_struct *fsp; /* If open via FDOPENDIR. */ 37 struct smb_filename *smb_fname; /* If open via OPENDIR */ 37 38 }; 38 39 39 40 static void free_dirsort_privates(void **datap) { 40 struct dirsort_privates *data = (struct dirsort_privates *) *datap; 41 SAFE_FREE(data->directory_list); 42 SAFE_FREE(data); 43 *datap = NULL; 44 45 return; 46 } 47 48 static bool open_and_sort_dir (vfs_handle_struct *handle) 49 { 50 SMB_STRUCT_DIRENT *dp; 51 struct stat dir_stat; 52 long current_pos; 53 struct dirsort_privates *data = NULL; 54 55 SMB_VFS_HANDLE_GET_DATA(handle, data, struct dirsort_privates, 56 return false); 41 TALLOC_FREE(*datap); 42 } 43 44 static bool get_sorted_dir_mtime(vfs_handle_struct *handle, 45 struct dirsort_privates *data, 46 struct timespec *ret_mtime) 47 { 48 int ret; 49 struct timespec mtime; 50 51 if (data->fsp) { 52 ret = fsp_stat(data->fsp); 53 mtime = data->fsp->fsp_name->st.st_ex_mtime; 54 } else { 55 ret = SMB_VFS_STAT(handle->conn, data->smb_fname); 56 mtime = data->smb_fname->st.st_ex_mtime; 57 } 58 59 if (ret == -1) { 60 return false; 61 } 62 63 *ret_mtime = mtime; 64 65 return true; 66 } 67 68 static bool open_and_sort_dir(vfs_handle_struct *handle, 69 struct dirsort_privates *data) 70 { 71 unsigned int i = 0; 72 unsigned int total_count = 0; 57 73 58 74 data->number_of_entries = 0; 59 75 60 if ( fstat(data->fd, &dir_stat) == 0) {61 data->mtime = dir_stat.st_mtime;76 if (get_sorted_dir_mtime(handle, data, &data->mtime) == false) { 77 return false; 62 78 } 63 79 64 80 while (SMB_VFS_NEXT_READDIR(handle, data->source_directory, NULL) 65 81 != NULL) { 66 data->number_of_entries++; 82 total_count++; 83 } 84 85 if (total_count == 0) { 86 return false; 67 87 } 68 88 … … 72 92 73 93 /* Set up an array and read the directory entries into it */ 74 SAFE_FREE(data->directory_list); /* destroy previous cache if needed */ 75 data->directory_list = (SMB_STRUCT_DIRENT *)SMB_MALLOC( 76 data->number_of_entries * sizeof(SMB_STRUCT_DIRENT)); 94 TALLOC_FREE(data->directory_list); /* destroy previous cache if needed */ 95 data->directory_list = talloc_zero_array(data, 96 SMB_STRUCT_DIRENT, 97 total_count); 77 98 if (!data->directory_list) { 78 99 return false; 79 100 } 80 current_pos = data->pos; 81 data->pos = 0; 82 while ((dp = SMB_VFS_NEXT_READDIR(handle, data->source_directory, 83 NULL)) != NULL) { 84 data->directory_list[data->pos++] = *dp; 85 } 101 for (i = 0; i < total_count; i++) { 102 SMB_STRUCT_DIRENT *dp = SMB_VFS_NEXT_READDIR(handle, 103 data->source_directory, 104 NULL); 105 if (dp == NULL) { 106 break; 107 } 108 data->directory_list[i] = *dp; 109 } 110 111 data->number_of_entries = i; 86 112 87 113 /* Sort the directory entries by name */ 88 data->pos = current_pos;89 114 TYPESAFE_QSORT(data->directory_list, data->number_of_entries, compare_dirent); 90 115 return true; … … 95 120 uint32 attr) 96 121 { 122 NTSTATUS status; 97 123 struct dirsort_privates *data = NULL; 98 124 99 125 /* set up our private data about this directory */ 100 data = (struct dirsort_privates *)SMB_MALLOC( 101 sizeof(struct dirsort_privates)); 102 126 data = talloc_zero(handle->conn, struct dirsort_privates); 103 127 if (!data) { 104 128 return NULL; 105 129 } 106 130 107 data->directory_list = NULL; 108 data->pos = 0; 131 status = create_synthetic_smb_fname(data, 132 fname, 133 NULL, 134 NULL, 135 &data->smb_fname); 136 if (!NT_STATUS_IS_OK(status)) { 137 TALLOC_FREE(data); 138 return NULL; 139 } 109 140 110 141 /* Open the underlying directory and count the number of entries */ … … 112 143 attr); 113 144 114 data->fd = dirfd(data->source_directory); 145 if (data->source_directory == NULL) { 146 TALLOC_FREE(data); 147 return NULL; 148 } 149 150 if (!open_and_sort_dir(handle, data)) { 151 SMB_VFS_NEXT_CLOSEDIR(handle,data->source_directory); 152 TALLOC_FREE(data); 153 return NULL; 154 } 115 155 116 156 SMB_VFS_HANDLE_SET_DATA(handle, data, free_dirsort_privates, 117 157 struct dirsort_privates, return NULL); 118 119 if (!open_and_sort_dir(handle)) {120 SMB_VFS_NEXT_CLOSEDIR(handle,data->source_directory);121 return NULL;122 }123 158 124 159 return data->source_directory; … … 133 168 134 169 /* set up our private data about this directory */ 135 data = (struct dirsort_privates *)SMB_MALLOC( 136 sizeof(struct dirsort_privates)); 137 170 data = talloc_zero(handle->conn, struct dirsort_privates); 138 171 if (!data) { 139 172 return NULL; 140 173 } 141 174 142 data->directory_list = NULL; 143 data->pos = 0; 175 data->fsp = fsp; 144 176 145 177 /* Open the underlying directory and count the number of entries */ … … 148 180 149 181 if (data->source_directory == NULL) { 150 SAFE_FREE(data); 151 return NULL; 152 } 153 154 data->fd = dirfd(data->source_directory); 182 TALLOC_FREE(data); 183 return NULL; 184 } 185 186 if (!open_and_sort_dir(handle, data)) { 187 SMB_VFS_NEXT_CLOSEDIR(handle,data->source_directory); 188 TALLOC_FREE(data); 189 /* fd is now closed. */ 190 fsp->fh->fd = -1; 191 return NULL; 192 } 155 193 156 194 SMB_VFS_HANDLE_SET_DATA(handle, data, free_dirsort_privates, 157 195 struct dirsort_privates, return NULL); 158 159 if (!open_and_sort_dir(handle)) {160 SMB_VFS_NEXT_CLOSEDIR(handle,data->source_directory);161 /* fd is now closed. */162 fsp->fh->fd = -1;163 return NULL;164 }165 196 166 197 return data->source_directory; … … 172 203 { 173 204 struct dirsort_privates *data = NULL; 174 time_t current_mtime; 175 struct stat dir_stat; 205 struct timespec current_mtime; 176 206 177 207 SMB_VFS_HANDLE_GET_DATA(handle, data, struct dirsort_privates, 178 208 return NULL); 179 209 180 if (fstat(data->fd, &dir_stat) == -1) { 181 return NULL; 182 } 183 184 current_mtime = dir_stat.st_mtime; 210 if (get_sorted_dir_mtime(handle, data, ¤t_mtime) == false) { 211 return NULL; 212 } 185 213 186 214 /* throw away cache and re-read the directory if we've changed */ 187 if ( current_mtime > data->mtime) {188 open_and_sort_dir(handle );215 if (timespec_compare(¤t_mtime, &data->mtime) > 1) { 216 open_and_sort_dir(handle, data); 189 217 } 190 218 -
vendor/current/source3/modules/vfs_fake_perms.c
r740 r860 30 30 #define DBGC_CLASS DBGC_VFS 31 31 32 extern struct current_user current_user; 33 32 34 static int fake_perms_stat(vfs_handle_struct *handle, 33 35 struct smb_filename *smb_fname) … … 42 44 smb_fname->st.st_ex_mode = S_IRWXU; 43 45 } 44 smb_fname->st.st_ex_uid = handle->conn->session_info->utok.uid; 45 smb_fname->st.st_ex_gid = handle->conn->session_info->utok.gid; 46 if (handle->conn->session_info != NULL) { 47 smb_fname->st.st_ex_uid = 48 handle->conn->session_info->utok.uid; 49 smb_fname->st.st_ex_gid = 50 handle->conn->session_info->utok.gid; 51 } else { 52 /* 53 * Sucks, but current_user is the best we can do here. 54 */ 55 smb_fname->st.st_ex_uid = current_user.ut.uid; 56 smb_fname->st.st_ex_gid = current_user.ut.gid; 57 } 46 58 } 47 59 … … 60 72 sbuf->st_ex_mode = S_IRWXU; 61 73 } 62 sbuf->st_ex_uid = handle->conn->session_info->utok.uid; 63 sbuf->st_ex_gid = handle->conn->session_info->utok.gid; 74 if (handle->conn->session_info != NULL) { 75 sbuf->st_ex_uid = 76 handle->conn->session_info->utok.uid; 77 sbuf->st_ex_gid = 78 handle->conn->session_info->utok.gid; 79 } else { 80 /* 81 * Sucks, but current_user is the best we can do here. 82 */ 83 sbuf->st_ex_uid = current_user.ut.uid; 84 sbuf->st_ex_gid = current_user.ut.gid; 85 } 64 86 } 65 87 return ret; -
vendor/current/source3/modules/vfs_gpfs.c
r746 r860 98 98 99 99 if (config->leases) { 100 /* 101 * Ensure the lease owner is root to allow 102 * correct delivery of lease-break signals. 103 */ 104 become_root(); 100 105 ret = set_gpfs_lease(fsp->fh->fd,leasetype); 106 unbecome_root(); 101 107 } 102 108
Note:
See TracChangeset
for help on using the changeset viewer.