Ignore:
Timestamp:
Jul 2, 2011, 3:35:33 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba 3.5: Update trunk to 3.5.8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/smbd/nttrans.c

    r583 r596  
    834834        NTSTATUS status;
    835835
    836         if (sd_len == 0 || !lp_nt_acl_support(SNUM(fsp->conn))) {
     836        if (sd_len == 0) {
     837                return NT_STATUS_INVALID_PARAMETER;
     838        }
     839
     840        if (!CAN_WRITE(fsp->conn)) {
     841                return NT_STATUS_ACCESS_DENIED;
     842        }
     843
     844        if (!lp_nt_acl_support(SNUM(fsp->conn))) {
    837845                return NT_STATUS_OK;
    838846        }
     
    851859        }
    852860
    853         /* Convert all the generic bits. */
    854         security_acl_map_generic(psd->dacl, &file_generic_mapping);
    855         security_acl_map_generic(psd->sacl, &file_generic_mapping);
     861        /* Ensure we have at least one thing set. */
     862        if ((security_info_sent & (SECINFO_OWNER|SECINFO_GROUP|SECINFO_DACL|SECINFO_SACL)) == 0) {
     863                return NT_STATUS_INVALID_PARAMETER;
     864        }
     865
     866        /* Ensure we have the rights to do this. */
     867        if (security_info_sent & SECINFO_OWNER) {
     868                if (!(fsp->access_mask & SEC_STD_WRITE_OWNER)) {
     869                        return NT_STATUS_ACCESS_DENIED;
     870                }
     871        }
     872
     873        if (security_info_sent & SECINFO_GROUP) {
     874                if (!(fsp->access_mask & SEC_STD_WRITE_OWNER)) {
     875                        return NT_STATUS_ACCESS_DENIED;
     876                }
     877        }
     878
     879        if (security_info_sent & SECINFO_DACL) {
     880                if (!(fsp->access_mask & SEC_STD_WRITE_DAC)) {
     881                        return NT_STATUS_ACCESS_DENIED;
     882                }
     883                /* Convert all the generic bits. */
     884                if (psd->dacl) {
     885                        security_acl_map_generic(psd->dacl, &file_generic_mapping);
     886                }
     887        }
     888
     889        if (security_info_sent & SECINFO_SACL) {
     890                if (!(fsp->access_mask & SEC_FLAG_SYSTEM_SECURITY)) {
     891                        return NT_STATUS_ACCESS_DENIED;
     892                }
     893                /* Convert all the generic bits. */
     894                if (psd->sacl) {
     895                        security_acl_map_generic(psd->sacl, &file_generic_mapping);
     896                }
     897        }
    856898
    857899        if (DEBUGLEVEL >= 10) {
     
    17961838         */
    17971839
     1840        if ((security_info_wanted & SECINFO_SACL) &&
     1841                        !(fsp->access_mask & SEC_FLAG_SYSTEM_SECURITY)) {
     1842                reply_nterror(req,  NT_STATUS_ACCESS_DENIED);
     1843                return;
     1844        }
     1845
     1846        if ((security_info_wanted & (SECINFO_DACL|SECINFO_OWNER|SECINFO_GROUP)) &&
     1847                        !(fsp->access_mask & SEC_STD_READ_CONTROL)) {
     1848                reply_nterror(req, NT_STATUS_ACCESS_DENIED);
     1849                return;
     1850        }
     1851
    17981852        if (!lp_nt_acl_support(SNUM(conn))) {
    17991853                status = get_null_nt_acl(talloc_tos(), &psd);
     
    18051859                reply_nterror(req, status);
    18061860                return;
     1861        }
     1862
     1863        if (!(security_info_wanted & SECINFO_OWNER)) {
     1864                psd->owner_sid = NULL;
     1865        }
     1866        if (!(security_info_wanted & SECINFO_GROUP)) {
     1867                psd->group_sid = NULL;
     1868        }
     1869        if (!(security_info_wanted & SECINFO_DACL)) {
     1870                psd->dacl = NULL;
     1871        }
     1872        if (!(security_info_wanted & SECINFO_SACL)) {
     1873                psd->sacl = NULL;
    18071874        }
    18081875
Note: See TracChangeset for help on using the changeset viewer.