Ignore:
Timestamp:
May 24, 2009, 7:17:10 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.3 to 3.3.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/modules/nfs4_acls.c

    r206 r221  
    4545} SMB_ACL4_INT_T;
    4646
    47 static SMB_ACL4_INT_T *get_validated_aclint(SMB4ACL_T *acl)
    48 {
    49         SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)acl;
    50         if (acl==NULL)
     47static SMB_ACL4_INT_T *get_validated_aclint(SMB4ACL_T *theacl)
     48{
     49        SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)theacl;
     50        if (theacl==NULL)
    5151        {
    5252                DEBUG(2, ("acl is NULL\n"));
     
    8484{
    8585        TALLOC_CTX *mem_ctx = talloc_tos();
    86         SMB_ACL4_INT_T  *acl = (SMB_ACL4_INT_T *)TALLOC_ZERO_SIZE(mem_ctx, sizeof(SMB_ACL4_INT_T));
    87         if (acl==NULL)
     86        SMB_ACL4_INT_T  *theacl = (SMB_ACL4_INT_T *)TALLOC_ZERO_SIZE(mem_ctx, sizeof(SMB_ACL4_INT_T));
     87        if (theacl==NULL)
    8888        {
    8989                DEBUG(0, ("TALLOC_SIZE failed\n"));
     
    9191                return NULL;
    9292        }
    93         acl->magic = SMB_ACL4_INT_MAGIC;
    94         /* acl->first, last = NULL not needed */
    95         return (SMB4ACL_T *)acl;
    96 }
    97 
    98 SMB4ACE_T *smb_add_ace4(SMB4ACL_T *acl, SMB_ACE4PROP_T *prop)
    99 {
    100         SMB_ACL4_INT_T *aclint = get_validated_aclint(acl);
     93        theacl->magic = SMB_ACL4_INT_MAGIC;
     94        /* theacl->first, last = NULL not needed */
     95        return (SMB4ACL_T *)theacl;
     96}
     97
     98SMB4ACE_T *smb_add_ace4(SMB4ACL_T *theacl, SMB_ACE4PROP_T *prop)
     99{
     100        SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl);
    101101        TALLOC_CTX *mem_ctx = talloc_tos();
    102102        SMB_ACE4_INT_T *ace;
     
    144144}
    145145
    146 SMB4ACE_T *smb_first_ace4(SMB4ACL_T *acl)
    147 {
    148         SMB_ACL4_INT_T *aclint = get_validated_aclint(acl);
     146SMB4ACE_T *smb_first_ace4(SMB4ACL_T *theacl)
     147{
     148        SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl);
    149149        if (aclint==NULL)
    150150                return NULL;
     
    153153}
    154154
    155 uint32 smb_get_naces(SMB4ACL_T *acl)
    156 {
    157         SMB_ACL4_INT_T *aclint = get_validated_aclint(acl);
     155uint32 smb_get_naces(SMB4ACL_T *theacl)
     156{
     157        SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl);
    158158        if (aclint==NULL)
    159159                return 0;
     
    196196}
    197197
    198 static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */
     198static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *theacl, /* in */
    199199        DOM_SID *psid_owner, /* in */
    200200        DOM_SID *psid_group, /* in */
     201        bool is_directory, /* in */
    201202        SEC_ACE **ppnt_ace_list, /* out */
    202203        int *pgood_aces /* out */
    203204)
    204205{
    205         SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)acl;
     206        SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)theacl;
    206207        SMB_ACE4_INT_T *aceint;
    207208        SEC_ACE *nt_ace_list = NULL;
     
    210211        DEBUG(10, ("smbacl_nfs42win entered"));
    211212
    212         aclint = get_validated_aclint(acl);
    213         /* We do not check for naces being 0 or acl being NULL here because it is done upstream */
     213        aclint = get_validated_aclint(theacl);
     214        /* We do not check for naces being 0 or theacl being NULL here because it is done upstream */
    214215        /* in smb_get_nt_acl_nfs4(). */
    215216        nt_ace_list = (SEC_ACE *)TALLOC_ZERO_SIZE(mem_ctx, aclint->naces * sizeof(SEC_ACE));
     
    257258                           sid_string_dbg(&sid)));
    258259
     260                if (is_directory && (ace->aceMask & SMB_ACE4_ADD_FILE)) {
     261                        ace->aceMask |= SMB_ACE4_DELETE_CHILD;
     262                }
     263
    259264                mask = ace->aceMask;
    260265                init_sec_ace(&nt_ace_list[good_aces++], &sid,
     
    271276static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf,
    272277        uint32 security_info,
    273         SEC_DESC **ppdesc, SMB4ACL_T *acl)
     278        SEC_DESC **ppdesc, SMB4ACL_T *theacl)
    274279{
    275280        int     good_aces = 0;
     
    280285        TALLOC_CTX *mem_ctx = talloc_tos();
    281286
    282         if (acl==NULL || smb_get_naces(acl)==0)
     287        if (theacl==NULL || smb_get_naces(theacl)==0)
    283288                return NT_STATUS_ACCESS_DENIED; /* special because we
    284289                                                 * shouldn't alloc 0 for
     
    288293        gid_to_sid(&sid_group, sbuf->st_gid);
    289294
    290         if (smbacl4_nfs42win(mem_ctx, acl, &sid_owner, &sid_group, &nt_ace_list, &good_aces)==False) {
     295        if (smbacl4_nfs42win(mem_ctx, theacl, &sid_owner, &sid_group, S_ISDIR(sbuf->st_mode),
     296                                &nt_ace_list, &good_aces)==False) {
    291297                DEBUG(8,("smbacl4_nfs42win failed\n"));
    292298                return map_nt_error_from_unix(errno);
     
    317323NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
    318324                               uint32 security_info,
    319                                SEC_DESC **ppdesc, SMB4ACL_T *acl)
     325                               SEC_DESC **ppdesc, SMB4ACL_T *theacl)
    320326{
    321327        SMB_STRUCT_STAT sbuf;
     
    327333        }
    328334
    329         return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, acl);
     335        return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, theacl);
    330336}
    331337
     
    333339                              const char *name,
    334340                              uint32 security_info,
    335                               SEC_DESC **ppdesc, SMB4ACL_T *acl)
     341                              SEC_DESC **ppdesc, SMB4ACL_T *theacl)
    336342{
    337343        SMB_STRUCT_STAT sbuf;
     
    343349        }
    344350
    345         return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, acl);
     351        return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, theacl);
    346352}
    347353
     
    394400}
    395401
    396 static void smbacl4_dump_nfs4acl(int level, SMB4ACL_T *acl)
    397 {
    398         SMB_ACL4_INT_T *aclint = get_validated_aclint(acl);
     402static void smbacl4_dump_nfs4acl(int level, SMB4ACL_T *theacl)
     403{
     404        SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl);
    399405        SMB_ACE4_INT_T *aceint;
    400406
     
    418424 */
    419425static SMB_ACE4PROP_T *smbacl4_find_equal_special(
    420         SMB4ACL_T *acl,
     426        SMB4ACL_T *theacl,
    421427        SMB_ACE4PROP_T *aceNew)
    422428{
    423         SMB_ACL4_INT_T *aclint = get_validated_aclint(acl);
     429        SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl);
    424430        SMB_ACE4_INT_T *aceint;
    425431
     
    613619static int smbacl4_MergeIgnoreReject(
    614620        enum smbacl4_acedup_enum acedup,
    615         SMB4ACL_T *acl, /* may modify it */
     621        SMB4ACL_T *theacl, /* may modify it */
    616622        SMB_ACE4PROP_T *ace, /* the "new" ACE */
    617623        bool    *paddNewACE,
     
    620626{
    621627        int     result = 0;
    622         SMB_ACE4PROP_T *ace4found = smbacl4_find_equal_special(acl, ace);
     628        SMB_ACE4PROP_T *ace4found = smbacl4_find_equal_special(theacl, ace);
    623629        if (ace4found)
    624630        {
     
    653659)
    654660{
    655         SMB4ACL_T *acl;
     661        SMB4ACL_T *theacl;
    656662        uint32  i;
    657663        TALLOC_CTX *mem_ctx = talloc_tos();
     
    659665        DEBUG(10, ("smbacl4_win2nfs4 invoked\n"));
    660666
    661         acl = smb_create_smb4acl();
    662         if (acl==NULL)
     667        theacl = smb_create_smb4acl();
     668        if (theacl==NULL)
    663669                return NULL;
    664670
     
    677683
    678684                if (pparams->acedup!=e_dontcare) {
    679                         if (smbacl4_MergeIgnoreReject(pparams->acedup, acl,
     685                        if (smbacl4_MergeIgnoreReject(pparams->acedup, theacl,
    680686                                &ace_v4, &addNewACE, i))
    681687                                return NULL;
     
    683689
    684690                if (addNewACE)
    685                         smb_add_ace4(acl, &ace_v4);
    686         }
    687 
    688         return acl;
     691                        smb_add_ace4(theacl, &ace_v4);
     692        }
     693
     694        return theacl;
    689695}
    690696
     
    695701{
    696702        smbacl4_vfs_params params;
    697         SMB4ACL_T *acl = NULL;
     703        SMB4ACL_T *theacl = NULL;
    698704        bool    result;
    699705
     
    754760        }
    755761
    756         acl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, &params, sbuf.st_uid, sbuf.st_gid);
    757         if (!acl)
     762        theacl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, &params, sbuf.st_uid, sbuf.st_gid);
     763        if (!theacl)
    758764                return map_nt_error_from_unix(errno);
    759765
    760         smbacl4_dump_nfs4acl(10, acl);
     766        smbacl4_dump_nfs4acl(10, theacl);
    761767
    762768        if (set_acl_as_root) {
    763769                become_root();
    764770        }
    765         result = set_nfs4_native(fsp, acl);
     771        result = set_nfs4_native(fsp, theacl);
    766772        saved_errno = errno;
    767773        if (set_acl_as_root) {
Note: See TracChangeset for help on using the changeset viewer.