Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/modules/onefs_acl.c

    r414 r745  
    2121
    2222#include "includes.h"
     23#include "smbd/smbd.h"
    2324#include "onefs.h"
    2425#include "onefs_config.h"
     
    3940 */
    4041static bool
    41 onefs_sid_to_identity(const DOM_SID *sid, struct ifs_identity *id,
     42onefs_sid_to_identity(const struct dom_sid *sid, struct ifs_identity *id,
    4243    bool is_group)
    4344{
     
    8182 */
    8283static bool
    83 onefs_identity_to_sid(struct ifs_identity *id, DOM_SID *sid)
     84onefs_identity_to_sid(struct ifs_identity *id, struct dom_sid *sid)
    8485{
    8586        if (!id || !sid)
     
    117118
    118119static bool
    119 onefs_og_to_identity(DOM_SID *sid, struct ifs_identity * ident,
     120onefs_og_to_identity(struct dom_sid *sid, struct ifs_identity * ident,
    120121    bool is_group, int snum)
    121122{
    122         const DOM_SID *b_admin_sid = &global_sid_Builtin_Administrators;
     123        const struct dom_sid *b_admin_sid = &global_sid_Builtin_Administrators;
    123124
    124125        if (!onefs_sid_to_identity(sid, ident, is_group)) {
     
    141142
    142143static bool
    143 sid_in_ignore_list(DOM_SID * sid, int snum)
     144sid_in_ignore_list(struct dom_sid * sid, int snum)
    144145{
    145146        const char ** sid_list = NULL;
    146         DOM_SID match;
     147        struct dom_sid match;
    147148
    148149        sid_list = lp_parm_string_list(snum, PARM_ONEFS_TYPE,
     
    168169 */
    169170static bool
    170 onefs_samba_ace_to_ace(SEC_ACE * samba_ace, struct ifs_ace * ace,
     171onefs_samba_ace_to_ace(struct security_ace * samba_ace, struct ifs_ace * ace,
    171172    bool *mapped, int snum)
    172173{
     
    233234
    234235/**
    235  * Convert a SEC_ACL to a struct ifs_security_acl
     236 * Convert a struct security_acl to a struct ifs_security_acl
    236237 */
    237238static bool
    238 onefs_samba_acl_to_acl(SEC_ACL *samba_acl, struct ifs_security_acl **acl,
     239onefs_samba_acl_to_acl(struct security_acl *samba_acl, struct ifs_security_acl **acl,
    239240    bool * ignore_aces, int snum)
    240241{
    241242        int num_aces = 0;
    242243        struct ifs_ace *aces = NULL;
    243         SEC_ACE *samba_aces;
     244        struct security_ace *samba_aces;
    244245        bool mapped;
    245246        int i, j;
     
    288289
    289290/**
    290  * Convert a struct ifs_security_acl to a SEC_ACL
     291 * Convert a struct ifs_security_acl to a struct security_acl
    291292 */
    292293static bool
    293 onefs_acl_to_samba_acl(struct ifs_security_acl *acl, SEC_ACL **samba_acl)
    294 {
    295         SEC_ACE *samba_aces = NULL;
    296         SEC_ACL *tmp_samba_acl = NULL;
     294onefs_acl_to_samba_acl(struct ifs_security_acl *acl, struct security_acl **samba_acl)
     295{
     296        struct security_ace *samba_aces = NULL;
     297        struct security_acl *tmp_samba_acl = NULL;
    297298        int i, num_aces = 0;
    298299
     
    314315        /* Allocate the ace list. */
    315316        if (num_aces > 0) {
    316                 if ((samba_aces = SMB_MALLOC_ARRAY(SEC_ACE, num_aces)) == NULL)
     317                if ((samba_aces = SMB_MALLOC_ARRAY(struct security_ace, num_aces)) == NULL)
    317318                {
    318319                        DEBUG(0, ("Unable to malloc space for %d aces.\n",
     
    320321                        return false;
    321322                }
    322                 memset(samba_aces, '\0', (num_aces) * sizeof(SEC_ACE));
     323                memset(samba_aces, '\0', (num_aces) * sizeof(struct security_ace));
    323324        }
    324325
    325326        for (i = 0; i < num_aces; i++) {
    326                 DOM_SID sid;
     327                struct dom_sid sid;
    327328
    328329                if (!onefs_identity_to_sid(&acl->aces[i].trustee, &sid))
     
    554555                /* Use existing samba logic to derive the mode bits. */
    555556                file_mode = unix_mode(fsp->conn, 0, fsp->fsp_name, NULL);
    556                 dir_mode = unix_mode(fsp->conn, aDIR, fsp->fsp_name, NULL);
     557                dir_mode = unix_mode(fsp->conn, FILE_ATTRIBUTE_DIRECTORY, fsp->fsp_name, NULL);
    557558
    558559                /* Initialize ACEs. */
     
    605606NTSTATUS
    606607onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
    607                   uint32 security_info, SEC_DESC **ppdesc)
     608                  uint32 security_info, struct security_descriptor **ppdesc)
    608609{
    609610        int error;
     
    611612        size_t size = 0;
    612613        struct ifs_security_descriptor *sd = NULL;
    613         DOM_SID owner_sid, group_sid;
    614         DOM_SID *ownerp, *groupp;
    615         SEC_ACL *dacl, *sacl;
    616         SEC_DESC *pdesc;
     614        struct dom_sid owner_sid, group_sid;
     615        struct dom_sid *ownerp, *groupp;
     616        struct security_acl *dacl, *sacl;
     617        struct security_descriptor *pdesc;
    617618        bool alloced = false;
    618619        bool new_aces_alloced = false;
     
    630631                PARM_IGNORE_SACLS, PARM_IGNORE_SACLS_DEFAULT)) {
    631632                DEBUG(5, ("Ignoring SACL on %s.\n", fsp_str_dbg(fsp)));
    632                 security_info &= ~SACL_SECURITY_INFORMATION;
     633                security_info &= ~SECINFO_SACL;
    633634        }
    634635
     
    706707
    707708        /* Copy owner into ppdesc */
    708         if (security_info & OWNER_SECURITY_INFORMATION) {
     709        if (security_info & SECINFO_OWNER) {
    709710                if (!onefs_identity_to_sid(sd->owner, &owner_sid)) {
    710711                        status = NT_STATUS_INVALID_PARAMETER;
     
    716717
    717718        /* Copy group into ppdesc */
    718         if (security_info & GROUP_SECURITY_INFORMATION) {
     719        if (security_info & SECINFO_GROUP) {
    719720                if (!onefs_identity_to_sid(sd->group, &group_sid)) {
    720721                        status = NT_STATUS_INVALID_PARAMETER;
     
    726727
    727728        /* Copy DACL into ppdesc */
    728         if (security_info & DACL_SECURITY_INFORMATION) {
     729        if (security_info & SECINFO_DACL) {
    729730                if (!onefs_acl_to_samba_acl(sd->dacl, &dacl)) {
    730731                        status = NT_STATUS_INVALID_PARAMETER;
     
    734735
    735736        /* Copy SACL into ppdesc */
    736         if (security_info & SACL_SECURITY_INFORMATION) {
     737        if (security_info & SECINFO_SACL) {
    737738                if (!onefs_acl_to_samba_acl(sd->sacl, &sacl)) {
    738739                        status = NT_STATUS_INVALID_PARAMETER;
     
    791792NTSTATUS
    792793onefs_get_nt_acl(vfs_handle_struct *handle, const char* name,
    793                  uint32 security_info, SEC_DESC **ppdesc)
     794                 uint32 security_info, struct security_descriptor **ppdesc)
    794795{
    795796        files_struct finfo;
     
    818819/**
    819820 * Isilon-specific function for setting up an ifs_security_descriptor, given a
    820  * samba SEC_DESC.
     821 * samba struct security_descriptor
    821822 *
    822823 * @param[out] sd ifs_security_descriptor to fill in
     
    824825 * @return NTSTATUS_OK if successful
    825826 */
    826 NTSTATUS onefs_samba_sd_to_sd(uint32_t security_info_sent, const SEC_DESC *psd,
     827NTSTATUS onefs_samba_sd_to_sd(uint32_t security_info_sent,
     828                              const struct security_descriptor *psd,
    827829                              struct ifs_security_descriptor *sd, int snum,
    828830                              uint32_t *security_info_effective)
     
    840842
    841843        /* Setup owner */
    842         if (security_info_sent & OWNER_SECURITY_INFORMATION) {
     844        if (security_info_sent & SECINFO_OWNER) {
    843845                if (!onefs_og_to_identity(psd->owner_sid, &owner, false, snum))
    844846                        return NT_STATUS_ACCESS_DENIED;
     
    850852
    851853        /* Setup group */
    852         if (security_info_sent & GROUP_SECURITY_INFORMATION) {
     854        if (security_info_sent & SECINFO_GROUP) {
    853855                if (!onefs_og_to_identity(psd->group_sid, &group, true, snum))
    854856                        return NT_STATUS_ACCESS_DENIED;
     
    860862
    861863        /* Setup DACL */
    862         if ((security_info_sent & DACL_SECURITY_INFORMATION) && (psd->dacl)) {
     864        if ((security_info_sent & SECINFO_DACL) && (psd->dacl)) {
    863865                if (!onefs_samba_acl_to_acl(psd->dacl, &daclp, &ignore_aces,
    864866                        snum))
     
    866868
    867869                if (ignore_aces == true)
    868                         *security_info_effective &= ~DACL_SECURITY_INFORMATION;
     870                        *security_info_effective &= ~SECINFO_DACL;
    869871        }
    870872
    871873        /* Setup SACL */
    872         if (security_info_sent & SACL_SECURITY_INFORMATION) {
     874        if (security_info_sent & SECINFO_SACL) {
    873875
    874876                if (lp_parm_bool(snum, PARM_ONEFS_TYPE,
    875877                            PARM_IGNORE_SACLS, PARM_IGNORE_SACLS_DEFAULT)) {
    876878                        DEBUG(5, ("Ignoring SACL.\n"));
    877                         *security_info_effective &= ~SACL_SECURITY_INFORMATION;
     879                        *security_info_effective &= ~SECINFO_SACL;
    878880                } else {
    879881                        if (psd->sacl) {
     
    884886                                if (ignore_aces == true) {
    885887                                        *security_info_effective &=
    886                                             ~SACL_SECURITY_INFORMATION;
     888                                            ~SECINFO_SACL;
    887889                                }
    888890                        }
     
    910912NTSTATUS
    911913onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
    912                   uint32_t sec_info_sent, const SEC_DESC *psd)
     914                  uint32_t sec_info_sent, const struct security_descriptor *psd)
    913915{
    914916        struct ifs_security_descriptor sd = {};
Note: See TracChangeset for help on using the changeset viewer.