Changeset 746 for vendor/current/source3/modules
- Timestamp:
- Nov 27, 2012, 4:56:06 PM (13 years ago)
- Location:
- vendor/current/source3/modules
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/modules/gpfs.c
r740 r746 19 19 20 20 #include "includes.h" 21 #include "system/filesys.h" 21 22 #include "smbd/smbd.h" 22 23 -
vendor/current/source3/modules/nfs4_acls.c
r740 r746 336 336 ace->aceFlags, win_ace_flags)); 337 337 338 mask = ace->aceMask; 338 339 /* Windows clients expect SYNC on acls to 339 340 correctly allow rename. See bug #7909. */ 340 mask = ace->aceMask | SMB_ACE4_SYNCHRONIZE; 341 /* But not on DENY ace entries. See 342 bug #8442. */ 343 if(ace->aceType == SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE) { 344 mask = ace->aceMask | SMB_ACE4_SYNCHRONIZE; 345 } 341 346 init_sec_ace(&nt_ace_list[good_aces++], &sid, 342 347 ace->aceType, mask, -
vendor/current/source3/modules/onefs_streams.c
r740 r746 737 737 } 738 738 739 state.streams = NULL;740 state.num_streams = 0;739 state.streams = *pstreams; 740 state.num_streams = *pnum_streams; 741 741 742 742 if (lp_parm_bool(SNUM(handle->conn), PARM_ONEFS_TYPE, … … 745 745 } 746 746 747 /* Add the default stream. */748 if (S_ISREG(sbuf.st_ex_mode)) {749 if (!add_one_stream(mem_ctx,750 &state.num_streams, &state.streams,751 "", sbuf.st_ex_size,752 SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp,753 &sbuf))) {754 return NT_STATUS_NO_MEMORY;755 }756 }757 758 747 state.mem_ctx = mem_ctx; 759 748 state.handle = handle; … … 779 768 *num_streams = state.num_streams; 780 769 *streams = state.streams; 781 return NT_STATUS_OK;782 } 770 return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams); 771 } -
vendor/current/source3/modules/vfs_acl_common.c
r740 r746 167 167 *******************************************************************/ 168 168 169 static voidadd_directory_inheritable_components(vfs_handle_struct *handle,169 static NTSTATUS add_directory_inheritable_components(vfs_handle_struct *handle, 170 170 const char *name, 171 171 SMB_STRUCT_STAT *psbuf, … … 185 185 186 186 if (new_ace_list == NULL) { 187 return ;187 return NT_STATUS_NO_MEMORY; 188 188 } 189 189 … … 237 237 SEC_ACE_FLAG_OBJECT_INHERIT| 238 238 SEC_ACE_FLAG_INHERIT_ONLY); 239 psd->dacl->aces = new_ace_list; 240 psd->dacl->num_aces += 3; 239 if (psd->dacl) { 240 psd->dacl->aces = new_ace_list; 241 psd->dacl->num_aces += 3; 242 } else { 243 psd->dacl = make_sec_acl(talloc_tos(), 244 NT4_ACL_REVISION, 245 3, 246 new_ace_list); 247 if (psd->dacl == NULL) { 248 return NT_STATUS_NO_MEMORY; 249 } 250 } 251 return NT_STATUS_OK; 241 252 } 242 253 … … 253 264 struct security_descriptor **ppdesc) 254 265 { 255 DATA_BLOB blob ;266 DATA_BLOB blob = data_blob_null; 256 267 NTSTATUS status; 257 268 uint16_t hash_type = XATTR_SD_HASH_TYPE_NONE; … … 379 390 } 380 391 } 381 is_directory = S_ISDIR( sbuf.st_ex_mode);392 is_directory = S_ISDIR(psbuf->st_ex_mode); 382 393 383 394 if (ignore_file_system_acl) { … … 394 405 !sd_has_inheritable_components(psd, 395 406 true)) { 396 add_directory_inheritable_components(handle, 407 status = add_directory_inheritable_components( 408 handle, 397 409 name, 398 410 psbuf, 399 411 psd); 412 if (!NT_STATUS_IS_OK(status)) { 413 return status; 414 } 400 415 } 401 416 /* The underlying POSIX module always sets … … 414 429 } 415 430 if (!(security_info & SECINFO_DACL)) { 431 psd->type &= ~SEC_DESC_DACL_PRESENT; 416 432 psd->dacl = NULL; 417 433 } 418 434 if (!(security_info & SECINFO_SACL)) { 435 psd->type &= ~SEC_DESC_SACL_PRESENT; 419 436 psd->sacl = NULL; 420 437 } … … 538 555 (SECINFO_OWNER | 539 556 SECINFO_GROUP | 540 SECINFO_DACL), 557 SECINFO_DACL | 558 SECINFO_SACL), 541 559 pp_parent_desc); 542 560 … … 557 575 struct security_descriptor **pp_parent_desc) 558 576 { 559 char *parent_name = NULL;560 577 struct security_descriptor *parent_desc = NULL; 561 578 uint32_t access_granted = 0; … … 576 593 if(!NT_STATUS_IS_OK(status)) { 577 594 DEBUG(10,("check_parent_acl_common: access check " 578 "on directory %s for"595 "on parent directory of " 579 596 "path %s for mask 0x%x returned %s\n", 580 parent_name,581 597 path, 582 598 access_mask, … … 621 637 (SECINFO_OWNER | 622 638 SECINFO_GROUP | 623 SECINFO_DACL), 639 SECINFO_DACL | 640 SECINFO_SACL), 624 641 &pdesc); 625 642 if (NT_STATUS_IS_OK(status)) { … … 632 649 if (!NT_STATUS_IS_OK(status)) { 633 650 DEBUG(10,("open_acl_xattr: %s open " 651 "for access 0x%x (0x%x) " 634 652 "refused with error %s\n", 635 653 fsp_str_dbg(fsp), 654 (unsigned int)fsp->access_mask, 655 (unsigned int)access_granted, 636 656 nt_errstr(status) )); 637 657 goto err; … … 800 820 CONST_DISCARD(struct security_descriptor *,psd)); 801 821 } 802 create_acl_blob(psd, &blob, XATTR_SD_HASH_TYPE_SHA256, hash); 803 store_acl_blob_fsp(handle, fsp, &blob); 804 805 return NT_STATUS_OK; 822 status = create_acl_blob(psd, &blob, XATTR_SD_HASH_TYPE_SHA256, hash); 823 if (!NT_STATUS_IS_OK(status)) { 824 DEBUG(10, ("fset_nt_acl_xattr: create_acl_blob failed\n")); 825 return status; 826 } 827 828 status = store_acl_blob_fsp(handle, fsp, &blob); 829 830 return status; 806 831 } 807 832 … … 809 834 const char *fname, const char *mask, uint32 attr) 810 835 { 811 NTSTATUS status = check_parent_acl_common(handle, fname, 812 SEC_DIR_LIST, NULL); 813 814 if (!NT_STATUS_IS_OK(status)) { 836 NTSTATUS status; 837 uint32_t access_granted = 0; 838 struct security_descriptor *sd = NULL; 839 840 status = get_nt_acl_internal(handle, 841 NULL, 842 fname, 843 (SECINFO_OWNER | 844 SECINFO_GROUP | 845 SECINFO_DACL | 846 SECINFO_SACL), 847 &sd); 848 if (!NT_STATUS_IS_OK(status)) { 849 DEBUG(10,("opendir_acl_common: " 850 "get_nt_acl_internal for dir %s " 851 "failed with error %s\n", 852 fname, 853 nt_errstr(status) )); 815 854 errno = map_errno_from_nt_status(status); 816 855 return NULL; 817 856 } 857 858 /* See if we can access it. */ 859 status = smb1_file_se_access_check(handle->conn, 860 sd, 861 get_current_nttok(handle->conn), 862 SEC_DIR_LIST, 863 &access_granted); 864 if (!NT_STATUS_IS_OK(status)) { 865 DEBUG(10,("opendir_acl_common: %s open " 866 "for access SEC_DIR_LIST " 867 "refused with error %s\n", 868 fname, 869 nt_errstr(status) )); 870 errno = map_errno_from_nt_status(status); 871 return NULL; 872 } 873 818 874 return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr); 819 875 } … … 831 887 struct smb_filename local_fname; 832 888 int saved_errno = 0; 889 char *saved_dir = NULL; 890 891 saved_dir = vfs_GetWd(talloc_tos(),conn); 892 if (!saved_dir) { 893 saved_errno = errno; 894 goto out; 895 } 833 896 834 897 if (!parent_dirname(talloc_tos(), path, … … 843 906 844 907 /* cd into the parent dir to pin it. */ 845 ret = SMB_VFS_CHDIR(conn, parent_dir);908 ret = vfs_ChDir(conn, parent_dir); 846 909 if (ret == -1) { 847 910 saved_errno = errno; … … 862 925 id = vfs_file_id_from_sbuf(conn, &local_fname.st); 863 926 for (fsp = file_find_di_first(conn->sconn, id); fsp; 864 927 fsp = file_find_di_next(fsp)) { 865 928 if (fsp->access_mask & DELETE_ACCESS && 866 929 fsp->delete_on_close) { … … 897 960 TALLOC_FREE(parent_dir); 898 961 899 vfs_ChDir(conn, conn->connectpath); 962 if (saved_dir) { 963 vfs_ChDir(conn, saved_dir); 964 } 900 965 if (saved_errno) { 901 966 errno = saved_errno; … … 909 974 int ret; 910 975 976 /* Try the normal rmdir first. */ 911 977 ret = SMB_VFS_NEXT_RMDIR(handle, path); 912 if (!(ret == -1 && (errno == EACCES || errno == EPERM))) { 913 DEBUG(10,("rmdir_acl_common: unlink of %s failed %s\n", 914 path, 915 strerror(errno) )); 916 return ret; 917 } 918 919 return acl_common_remove_object(handle, 920 path, 921 true); 978 if (ret == 0) { 979 return 0; 980 } 981 if (errno == EACCES || errno == EPERM) { 982 /* Failed due to access denied, 983 see if we need to root override. */ 984 return acl_common_remove_object(handle, 985 path, 986 true); 987 } 988 989 DEBUG(10,("rmdir_acl_common: unlink of %s failed %s\n", 990 path, 991 strerror(errno) )); 992 return -1; 922 993 } 923 994 … … 1039 1110 int ret; 1040 1111 1112 /* Try the normal unlink first. */ 1041 1113 ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname); 1042 if ( !(ret == -1 && (errno == EACCES || errno == EPERM))) {1043 DEBUG(10,("unlink_acl_common: unlink of %s failed %s\n",1044 smb_fname->base_name,1045 strerror(errno) ));1046 return ret;1047 }1048 /* Don't do anything fancy for streams. */ 1049 if (smb_fname->stream_name) {1050 return ret;1051 }1052 1053 return acl_common_remove_object(handle,1114 if (ret == 0) { 1115 return 0; 1116 } 1117 if (errno == EACCES || errno == EPERM) { 1118 /* Failed due to access denied, 1119 see if we need to root override. */ 1120 1121 /* Don't do anything fancy for streams. */ 1122 if (smb_fname->stream_name) { 1123 return -1; 1124 } 1125 return acl_common_remove_object(handle, 1054 1126 smb_fname->base_name, 1055 1127 false); 1128 } 1129 1130 DEBUG(10,("unlink_acl_common: unlink of %s failed %s\n", 1131 smb_fname->base_name, 1132 strerror(errno) )); 1133 return -1; 1056 1134 } 1057 1135 -
vendor/current/source3/modules/vfs_acl_tdb.c
r740 r746 19 19 */ 20 20 21 /* NOTE: This is an experimental module, not yet finished. JRA. */22 23 21 #include "includes.h" 24 22 #include "smbd/smbd.h" -
vendor/current/source3/modules/vfs_acl_xattr.c
r740 r746 18 18 * along with this program; if not, see <http://www.gnu.org/licenses/>. 19 19 */ 20 21 /* NOTE: This is an experimental module, not yet finished. JRA. */22 20 23 21 #include "includes.h" … … 122 120 unbecome_root(); 123 121 if (ret) { 124 errno = saved_errno;125 122 DEBUG(5, ("store_acl_blob_fsp: setting attr failed for file %s" 126 123 "with error %s\n", 127 124 fsp_str_dbg(fsp), 128 strerror(errno) )); 129 return map_nt_error_from_unix(errno); 125 strerror(saved_errno) )); 126 errno = saved_errno; 127 return map_nt_error_from_unix(saved_errno); 130 128 } 131 129 return NT_STATUS_OK; -
vendor/current/source3/modules/vfs_aio_fork.c
r740 r746 102 102 bool cancelled; 103 103 bool read_cmd; 104 bool called_from_suspend; 105 bool completion_done; 104 106 }; 105 107 … … 433 435 } 434 436 437 if (child->called_from_suspend) { 438 child->completion_done = true; 439 return; 440 } 435 441 aio_ex = (struct aio_extra *)child->aiocb->aio_sigevent.sigev_value.sival_ptr; 436 442 smbd_aio_complete_aio_ex(aio_ex); 443 TALLOC_FREE(aio_ex); 437 444 } 438 445 … … 827 834 828 835 for (child = children->children; child != NULL; child = child->next) { 836 struct tevent_fd *event; 837 829 838 if (child->aiocb == NULL) { 830 839 continue; … … 841 850 } 842 851 843 /* We're never using this event on the 844 * main event context again... */ 845 TALLOC_FREE(child->sock_event); 846 847 child->sock_event = event_add_fd(ev, 848 child, 849 child->sockfd, 850 EVENT_FD_READ, 851 handle_aio_completion, 852 child); 853 854 while (1) { 852 event = event_add_fd(ev, 853 frame, 854 child->sockfd, 855 EVENT_FD_READ, 856 handle_aio_completion, 857 child); 858 859 child->called_from_suspend = true; 860 861 while (!child->completion_done) { 855 862 if (tevent_loop_once(ev) == -1) { 856 863 goto out; … … 860 867 errno = EAGAIN; 861 868 goto out; 862 }863 864 /* We set child->aiocb to NULL in our hooked865 * AIO_RETURN(). */866 if (child->aiocb == NULL) {867 break;868 869 } 869 870 } -
vendor/current/source3/modules/vfs_aixacl2.c
r740 r746 19 19 20 20 #include "includes.h" 21 #include "system/filesys.h" 21 22 #include "smbd/smbd.h" 22 23 #include "nfs4_acls.h" -
vendor/current/source3/modules/vfs_commit.c
r740 r746 236 236 } 237 237 238 return 0;238 return fd; 239 239 } 240 240 -
vendor/current/source3/modules/vfs_default.c
r740 r746 1045 1045 1046 1046 #ifdef HAVE_KERNEL_OPLOCKS_LINUX 1047 /* first set the signal handler */1048 if(linux_set_lease_sighandler(fsp->fh->fd) == -1) {1049 return -1;1050 }1051 1052 1047 result = linux_setlease(fsp->fh->fd, leasetype); 1053 1048 #else … … 1183 1178 { 1184 1179 SMB_STRUCT_STAT sbuf; 1185 unsigned int num_streams = 0; 1186 struct stream_struct *streams = NULL; 1180 struct stream_struct *tmp_streams = NULL; 1187 1181 int ret; 1188 1182 … … 1219 1213 } 1220 1214 1221 streams = talloc(mem_ctx, struct stream_struct);1222 1223 if ( streams == NULL) {1215 tmp_streams = talloc_realloc(mem_ctx, *pstreams, struct stream_struct, 1216 (*pnum_streams) + 1); 1217 if (tmp_streams == NULL) { 1224 1218 return NT_STATUS_NO_MEMORY; 1225 1219 } 1226 1227 streams->size = sbuf.st_ex_size; 1228 streams->alloc_size = SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp, &sbuf); 1229 1230 streams->name = talloc_strdup(streams, "::$DATA"); 1231 if (streams->name == NULL) { 1232 TALLOC_FREE(streams); 1220 tmp_streams[*pnum_streams].name = talloc_strdup(tmp_streams, "::$DATA"); 1221 if (tmp_streams[*pnum_streams].name == NULL) { 1233 1222 return NT_STATUS_NO_MEMORY; 1234 1223 } 1235 1236 num_streams = 1; 1224 tmp_streams[*pnum_streams].size = sbuf.st_ex_size; 1225 tmp_streams[*pnum_streams].alloc_size = SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp, &sbuf); 1226 1227 *pnum_streams += 1; 1228 *pstreams = tmp_streams; 1237 1229 done: 1238 *pnum_streams = num_streams;1239 *pstreams = streams;1240 1230 return NT_STATUS_OK; 1241 1231 } -
vendor/current/source3/modules/vfs_gpfs.c
r740 r746 599 599 600 600 result = gpfs2smb_acl(pacl); 601 if (result == NULL) {602 goto done;601 if (result != NULL) { 602 errno = 0; 603 603 } 604 604 … … 951 951 /* Only handle DOS Attributes */ 952 952 if (strcmp(name,SAMBA_XATTR_DOS_ATTRIB) != 0){ 953 DEBUG( 1, ("gpfs_set_xattr:name is %s\n",name));953 DEBUG(5, ("gpfs_set_xattr:name is %s\n",name)); 954 954 return SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags); 955 955 } … … 1027 1027 /* Only handle DOS Attributes */ 1028 1028 if (strcmp(name,SAMBA_XATTR_DOS_ATTRIB) != 0){ 1029 DEBUG(1, ("gpfs_get_xattr:name is %s\n",name));1029 DEBUG(5, ("gpfs_get_xattr:name is %s\n",name)); 1030 1030 return SMB_VFS_NEXT_GETXATTR(handle,path,name,value,size); 1031 1031 } -
vendor/current/source3/modules/vfs_prealloc.c
r740 r746 19 19 20 20 #include "includes.h" 21 #include "system/filesys.h" 21 22 #include "smbd/smbd.h" 22 23 -
vendor/current/source3/modules/vfs_smb_traffic_analyzer.c
r740 r746 169 169 const char *akey, const char *str, size_t *len) 170 170 { 171 int s1,s2,h ,d;171 int s1,s2,h; 172 172 AES_KEY key; 173 173 unsigned char filler[17]= "................"; 174 174 char *output; 175 unsigned char crypted[18];176 175 if (akey == NULL) return NULL; 177 176 samba_AES_set_encrypt_key((unsigned char *) akey, 128, &key); 178 177 s1 = strlen(str) / 16; 179 178 s2 = strlen(str) % 16; 180 for (h = 0; h < s2; h++) *(filler+h)=*(str+(s1*16)+h);179 memcpy(filler, str + (s1*16), s2); 181 180 DEBUG(10, ("smb_traffic_analyzer_send_data_socket: created %s" 182 181 " as filling block.\n", filler)); 183 output = talloc_array(ctx, char, (s1*16)+17 ); 184 d=0; 182 183 *len = ((s1 + 1)*16); 184 output = talloc_array(ctx, char, *len); 185 185 for (h = 0; h < s1; h++) { 186 samba_AES_encrypt((unsigned char *) str+(16*h), crypted, &key); 187 for (d = 0; d<16; d++) output[d+(16*h)]=crypted[d]; 188 } 189 samba_AES_encrypt( (unsigned char *) str+(16*h), filler, &key ); 190 for (d = 0;d < 16; d++) output[d+(16*h)]=*(filler+d); 186 samba_AES_encrypt((unsigned char *) str+(16*h), output+16*h, 187 &key); 188 } 189 samba_AES_encrypt(filler, (unsigned char *)(output+(16*h)), &key); 191 190 *len = (s1*16)+16; 192 return output; 191 return output; 193 192 } 194 193 -
vendor/current/source3/modules/vfs_streams_depot.c
r740 r746 658 658 } 659 659 660 static int streams_depot_rmdir(vfs_handle_struct *handle, const char *path) 661 { 662 struct smb_filename *smb_fname_base = NULL; 663 NTSTATUS status; 664 int ret = -1; 665 666 DEBUG(10, ("streams_depot_rmdir called for %s\n", path)); 667 668 /* 669 * We potentially need to delete the per-inode streams directory 670 */ 671 672 status = create_synthetic_smb_fname(talloc_tos(), path, 673 NULL, NULL, &smb_fname_base); 674 if (!NT_STATUS_IS_OK(status)) { 675 errno = map_errno_from_nt_status(status); 676 return -1; 677 } 678 679 if (lp_posix_pathnames()) { 680 ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_base); 681 } else { 682 ret = SMB_VFS_NEXT_STAT(handle, smb_fname_base); 683 } 684 685 if (ret == -1) { 686 TALLOC_FREE(smb_fname_base); 687 return -1; 688 } 689 690 if (smb_fname_base->st.st_ex_nlink == 2) { 691 char *dirname = stream_dir(handle, smb_fname_base, 692 &smb_fname_base->st, false); 693 694 if (dirname != NULL) { 695 SMB_VFS_NEXT_RMDIR(handle, dirname); 696 } 697 TALLOC_FREE(dirname); 698 } 699 700 ret = SMB_VFS_NEXT_RMDIR(handle, path); 701 702 TALLOC_FREE(smb_fname_base); 703 return ret; 704 } 705 660 706 static int streams_depot_rename(vfs_handle_struct *handle, 661 707 const struct smb_filename *smb_fname_src, … … 828 874 } 829 875 830 state.streams = NULL; 831 state.num_streams = 0; 832 833 if (!S_ISDIR(smb_fname_base->st.st_ex_mode)) { 834 if (!add_one_stream(mem_ctx, 835 &state.num_streams, &state.streams, 836 "::$DATA", smb_fname_base->st.st_ex_size, 837 SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp, 838 &smb_fname_base->st))) { 839 status = NT_STATUS_NO_MEMORY; 840 goto out; 841 } 842 } 843 876 state.streams = *pstreams; 877 state.num_streams = *pnum_streams; 844 878 state.mem_ctx = mem_ctx; 845 879 state.handle = handle; … … 862 896 *pnum_streams = state.num_streams; 863 897 *pstreams = state.streams; 864 status = NT_STATUS_OK;898 status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams); 865 899 866 900 out: … … 881 915 .lstat = streams_depot_lstat, 882 916 .unlink = streams_depot_unlink, 917 .rmdir = streams_depot_rmdir, 883 918 .rename = streams_depot_rename, 884 919 .streaminfo = streams_depot_streaminfo, -
vendor/current/source3/modules/vfs_streams_xattr.c
r740 r746 40 40 static SMB_INO_T stream_inode(const SMB_STRUCT_STAT *sbuf, const char *sname) 41 41 { 42 struct MD5Contextctx;42 MD5_CTX ctx; 43 43 unsigned char hash[16]; 44 44 SMB_INO_T result; … … 811 811 } 812 812 813 state.streams = NULL; 814 state.num_streams = 0; 815 816 if (!S_ISDIR(sbuf.st_ex_mode)) { 817 if (!add_one_stream(mem_ctx, 818 &state.num_streams, &state.streams, 819 "::$DATA", sbuf.st_ex_size, 820 SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp, 821 &sbuf))) { 822 return NT_STATUS_NO_MEMORY; 823 } 824 } 825 813 state.streams = *pstreams; 814 state.num_streams = *pnum_streams; 826 815 state.mem_ctx = mem_ctx; 827 816 state.handle = handle; … … 843 832 *pnum_streams = state.num_streams; 844 833 *pstreams = state.streams; 845 return NT_STATUS_OK; 834 835 return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams); 846 836 } 847 837
Note:
See TracChangeset
for help on using the changeset viewer.