Changeset 232 for branches/samba-3.2.x/source/modules
- Timestamp:
- May 27, 2009, 9:09:42 AM (16 years ago)
- Location:
- branches/samba-3.2.x/source/modules
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/modules/nfs4_acls.c
r204 r232 704 704 705 705 SMB_STRUCT_STAT sbuf; 706 bool need_chown = False;706 bool set_acl_as_root = false; 707 707 uid_t newUID = (uid_t)-1; 708 708 gid_t newGID = (gid_t)-1; 709 int saved_errno; 709 710 710 711 DEBUG(10, ("smb_set_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name)); … … 734 735 if (((newUID != (uid_t)-1) && (sbuf.st_uid != newUID)) || 735 736 ((newGID != (gid_t)-1) && (sbuf.st_gid != newGID))) { 736 need_chown = True; 737 } 738 if (need_chown) { 739 if ((newUID == (uid_t)-1 || newUID == current_user.ut.uid)) { 740 if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) { 741 DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n", 742 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID, 743 strerror(errno))); 744 return map_nt_error_from_unix(errno); 745 } 746 747 DEBUG(10,("chown %s, %u, %u succeeded.\n", 748 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); 749 if (smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, &sbuf)) 750 return map_nt_error_from_unix(errno); 751 need_chown = False; 752 } else { /* chown is needed, but _after_ changing acl */ 753 sbuf.st_uid = newUID; /* OWNER@ in case of e_special */ 754 sbuf.st_gid = newGID; /* GROUP@ in case of e_special */ 755 } 756 } 757 } 758 759 if ((security_info_sent & DACL_SECURITY_INFORMATION)!=0 && psd->dacl!=NULL) 760 { 761 acl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, ¶ms, sbuf.st_uid, sbuf.st_gid); 762 if (!acl) 763 return map_nt_error_from_unix(errno); 764 765 smbacl4_dump_nfs4acl(10, acl); 766 767 result = set_nfs4_native(fsp, acl); 768 if (result!=True) 769 { 770 DEBUG(10, ("set_nfs4_native failed with %s\n", strerror(errno))); 771 return map_nt_error_from_unix(errno); 772 } 773 } else 737 if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) { 738 DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n", 739 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID, 740 strerror(errno))); 741 return map_nt_error_from_unix(errno); 742 } 743 744 DEBUG(10,("chown %s, %u, %u succeeded.\n", 745 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); 746 if (smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, &sbuf)) 747 return map_nt_error_from_unix(errno); 748 /* If we successfully chowned, we know we must 749 * be able to set the acl, so do it as root. 750 */ 751 set_acl_as_root = true; 752 } 753 } 754 755 if (!(security_info_sent & DACL_SECURITY_INFORMATION) || psd->dacl ==NULL) { 774 756 DEBUG(10, ("no dacl found; security_info_sent = 0x%x\n", security_info_sent)); 775 776 /* Any chown pending? */ 777 if (need_chown) { 778 DEBUG(3,("chown#2 %s. uid = %u, gid = %u.\n", 779 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); 780 if (try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) { 781 DEBUG(2,("chown#2 %s, %u, %u failed. Error = %s.\n", 782 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID, 783 strerror(errno))); 784 return map_nt_error_from_unix(errno); 785 } 786 DEBUG(10,("chown#2 %s, %u, %u succeeded.\n", 787 fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); 757 return NT_STATUS_OK; 758 } 759 760 acl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, ¶ms, sbuf.st_uid, sbuf.st_gid); 761 if (!acl) 762 return map_nt_error_from_unix(errno); 763 764 smbacl4_dump_nfs4acl(10, acl); 765 766 if (set_acl_as_root) { 767 become_root(); 768 } 769 result = set_nfs4_native(fsp, acl); 770 saved_errno = errno; 771 if (set_acl_as_root) { 772 unbecome_root(); 773 } 774 if (result!=True) { 775 errno = saved_errno; 776 DEBUG(10, ("set_nfs4_native failed with %s\n", strerror(errno))); 777 return map_nt_error_from_unix(errno); 788 778 } 789 779 -
branches/samba-3.2.x/source/modules/vfs_default.c
r141 r232 715 715 return sys_ftruncate(fsp->fh->fd, len); 716 716 717 /* available disk space is enough or not? */ 718 if (lp_strict_allocate(SNUM(fsp->conn))){ 719 SMB_BIG_UINT space_avail; 720 SMB_BIG_UINT bsize,dfree,dsize; 721 722 space_avail = get_dfree_info(fsp->conn,fsp->fsp_name,false,&bsize,&dfree,&dsize); 723 /* space_avail is 1k blocks */ 724 if (space_avail == (SMB_BIG_UINT)-1 || 725 ((SMB_BIG_UINT)space_to_write/1024 > space_avail) ) { 726 errno = ENOSPC; 727 return -1; 728 } 729 } 730 717 731 /* Write out the real space on disk. */ 718 732 if (SMB_VFS_LSEEK(fsp, st.st_size, SEEK_SET) != st.st_size) -
branches/samba-3.2.x/source/modules/vfs_fileid.c
r133 r232 189 189 } 190 190 191 data->device_mapping_fn = fileid_device_mapping_fsid; 191 /* 192 * "fileid:mapping" is only here as fallback for old setups 193 * "fileid:algorithm" is the option new setups should use 194 */ 195 algorithm = lp_parm_const_string(SNUM(handle->conn), 196 "fileid", "mapping", 197 "fsname"); 192 198 algorithm = lp_parm_const_string(SNUM(handle->conn), 193 199 "fileid", "algorithm", 194 "fsname");200 algorithm); 195 201 if (strcmp("fsname", algorithm) == 0) { 196 202 data->device_mapping_fn = fileid_device_mapping_fsname; -
branches/samba-3.2.x/source/modules/vfs_full_audit.c
r149 r232 702 702 { 703 703 char *prefix = NULL; 704 char *result; 704 705 705 706 prefix = talloc_strdup(ctx, … … 709 710 return NULL; 710 711 } 711 re turntalloc_sub_advanced(ctx,712 result = talloc_sub_advanced(ctx, 712 713 lp_servicename(SNUM(conn)), conn->user, 713 714 conn->connectpath, conn->gid, … … 715 716 current_user_info.domain, 716 717 prefix); 718 TALLOC_FREE(prefix); 719 return result; 717 720 } 718 721 -
branches/samba-3.2.x/source/modules/vfs_streams_depot.c
r228 r232 526 526 char *ostream_fname = NULL; 527 527 char *nstream_fname = NULL; 528 char *newname_full = NULL; 528 529 529 530 DEBUG(10, ("streams_depot_rename called for %s => %s\n", … … 537 538 } 538 539 539 if (!(old_is_stream && new_is_stream)) {540 errno = ENOSYS;541 return -1;542 }543 544 540 frame = talloc_stackframe(); 545 541 … … 550 546 } 551 547 552 if (!NT_STATUS_IS_OK(split_ntfs_stream_name(talloc_tos(), oldname,548 if (!NT_STATUS_IS_OK(split_ntfs_stream_name(talloc_tos(), newname, 553 549 &nbase, &nsname))) { 554 550 errno = ENOMEM; … … 562 558 } 563 559 564 if (StrCaseCmp(obase, nbase) != 0) {565 errno = ENOSYS;566 goto done;567 }568 569 560 ostream_fname = stream_name(handle, oldname, false); 570 561 if (ostream_fname == NULL) { … … 572 563 } 573 564 574 nstream_fname = stream_name(handle, newname, false); 565 /* 566 * Handle passing in a stream name without the base file. This is 567 * exercised by the NTRENAME streams rename path. 568 */ 569 if (StrCaseCmp(nbase, "./") == 0) { 570 newname_full = talloc_asprintf(talloc_tos(), "%s:%s", obase, 571 nsname); 572 if (newname_full == NULL) { 573 errno = ENOMEM; 574 goto done; 575 } 576 } 577 578 nstream_fname = stream_name(handle, 579 newname_full ? newname_full : newname, 580 false); 575 581 if (nstream_fname == NULL) { 576 582 return -1; -
branches/samba-3.2.x/source/modules/vfs_streams_xattr.c
r228 r232 512 512 } 513 513 514 if (!(o_is_stream && n_is_stream)) {515 errno = ENOSYS;516 goto fail;517 }518 519 514 frame = talloc_stackframe(); 520 515 if (!frame) { … … 541 536 542 537 if (nstream == NULL) { 543 errno = ENOSYS;544 goto fail;545 }546 547 /* the new base should be empty */548 if (StrCaseCmp(obase, nbase) != 0) {549 538 errno = ENOSYS; 550 539 goto fail;
Note:
See TracChangeset
for help on using the changeset viewer.