Changeset 221 for branches/samba-3.3.x/source/modules/nfs4_acls.c
- Timestamp:
- May 24, 2009, 7:17:10 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/modules/nfs4_acls.c
r206 r221 45 45 } SMB_ACL4_INT_T; 46 46 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)47 static 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) 51 51 { 52 52 DEBUG(2, ("acl is NULL\n")); … … 84 84 { 85 85 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) 88 88 { 89 89 DEBUG(0, ("TALLOC_SIZE failed\n")); … … 91 91 return NULL; 92 92 } 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 98 SMB4ACE_T *smb_add_ace4(SMB4ACL_T *theacl, SMB_ACE4PROP_T *prop) 99 { 100 SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl); 101 101 TALLOC_CTX *mem_ctx = talloc_tos(); 102 102 SMB_ACE4_INT_T *ace; … … 144 144 } 145 145 146 SMB4ACE_T *smb_first_ace4(SMB4ACL_T * acl)147 { 148 SMB_ACL4_INT_T *aclint = get_validated_aclint( acl);146 SMB4ACE_T *smb_first_ace4(SMB4ACL_T *theacl) 147 { 148 SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl); 149 149 if (aclint==NULL) 150 150 return NULL; … … 153 153 } 154 154 155 uint32 smb_get_naces(SMB4ACL_T * acl)156 { 157 SMB_ACL4_INT_T *aclint = get_validated_aclint( acl);155 uint32 smb_get_naces(SMB4ACL_T *theacl) 156 { 157 SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl); 158 158 if (aclint==NULL) 159 159 return 0; … … 196 196 } 197 197 198 static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T * acl, /* in */198 static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *theacl, /* in */ 199 199 DOM_SID *psid_owner, /* in */ 200 200 DOM_SID *psid_group, /* in */ 201 bool is_directory, /* in */ 201 202 SEC_ACE **ppnt_ace_list, /* out */ 202 203 int *pgood_aces /* out */ 203 204 ) 204 205 { 205 SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *) acl;206 SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)theacl; 206 207 SMB_ACE4_INT_T *aceint; 207 208 SEC_ACE *nt_ace_list = NULL; … … 210 211 DEBUG(10, ("smbacl_nfs42win entered")); 211 212 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 */ 214 215 /* in smb_get_nt_acl_nfs4(). */ 215 216 nt_ace_list = (SEC_ACE *)TALLOC_ZERO_SIZE(mem_ctx, aclint->naces * sizeof(SEC_ACE)); … … 257 258 sid_string_dbg(&sid))); 258 259 260 if (is_directory && (ace->aceMask & SMB_ACE4_ADD_FILE)) { 261 ace->aceMask |= SMB_ACE4_DELETE_CHILD; 262 } 263 259 264 mask = ace->aceMask; 260 265 init_sec_ace(&nt_ace_list[good_aces++], &sid, … … 271 276 static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf, 272 277 uint32 security_info, 273 SEC_DESC **ppdesc, SMB4ACL_T * acl)278 SEC_DESC **ppdesc, SMB4ACL_T *theacl) 274 279 { 275 280 int good_aces = 0; … … 280 285 TALLOC_CTX *mem_ctx = talloc_tos(); 281 286 282 if ( acl==NULL || smb_get_naces(acl)==0)287 if (theacl==NULL || smb_get_naces(theacl)==0) 283 288 return NT_STATUS_ACCESS_DENIED; /* special because we 284 289 * shouldn't alloc 0 for … … 288 293 gid_to_sid(&sid_group, sbuf->st_gid); 289 294 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) { 291 297 DEBUG(8,("smbacl4_nfs42win failed\n")); 292 298 return map_nt_error_from_unix(errno); … … 317 323 NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp, 318 324 uint32 security_info, 319 SEC_DESC **ppdesc, SMB4ACL_T * acl)325 SEC_DESC **ppdesc, SMB4ACL_T *theacl) 320 326 { 321 327 SMB_STRUCT_STAT sbuf; … … 327 333 } 328 334 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); 330 336 } 331 337 … … 333 339 const char *name, 334 340 uint32 security_info, 335 SEC_DESC **ppdesc, SMB4ACL_T * acl)341 SEC_DESC **ppdesc, SMB4ACL_T *theacl) 336 342 { 337 343 SMB_STRUCT_STAT sbuf; … … 343 349 } 344 350 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); 346 352 } 347 353 … … 394 400 } 395 401 396 static void smbacl4_dump_nfs4acl(int level, SMB4ACL_T * acl)397 { 398 SMB_ACL4_INT_T *aclint = get_validated_aclint( acl);402 static void smbacl4_dump_nfs4acl(int level, SMB4ACL_T *theacl) 403 { 404 SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl); 399 405 SMB_ACE4_INT_T *aceint; 400 406 … … 418 424 */ 419 425 static SMB_ACE4PROP_T *smbacl4_find_equal_special( 420 SMB4ACL_T * acl,426 SMB4ACL_T *theacl, 421 427 SMB_ACE4PROP_T *aceNew) 422 428 { 423 SMB_ACL4_INT_T *aclint = get_validated_aclint( acl);429 SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl); 424 430 SMB_ACE4_INT_T *aceint; 425 431 … … 613 619 static int smbacl4_MergeIgnoreReject( 614 620 enum smbacl4_acedup_enum acedup, 615 SMB4ACL_T * acl, /* may modify it */621 SMB4ACL_T *theacl, /* may modify it */ 616 622 SMB_ACE4PROP_T *ace, /* the "new" ACE */ 617 623 bool *paddNewACE, … … 620 626 { 621 627 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); 623 629 if (ace4found) 624 630 { … … 653 659 ) 654 660 { 655 SMB4ACL_T * acl;661 SMB4ACL_T *theacl; 656 662 uint32 i; 657 663 TALLOC_CTX *mem_ctx = talloc_tos(); … … 659 665 DEBUG(10, ("smbacl4_win2nfs4 invoked\n")); 660 666 661 acl = smb_create_smb4acl();662 if ( acl==NULL)667 theacl = smb_create_smb4acl(); 668 if (theacl==NULL) 663 669 return NULL; 664 670 … … 677 683 678 684 if (pparams->acedup!=e_dontcare) { 679 if (smbacl4_MergeIgnoreReject(pparams->acedup, acl,685 if (smbacl4_MergeIgnoreReject(pparams->acedup, theacl, 680 686 &ace_v4, &addNewACE, i)) 681 687 return NULL; … … 683 689 684 690 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; 689 695 } 690 696 … … 695 701 { 696 702 smbacl4_vfs_params params; 697 SMB4ACL_T * acl = NULL;703 SMB4ACL_T *theacl = NULL; 698 704 bool result; 699 705 … … 754 760 } 755 761 756 acl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, ¶ms, sbuf.st_uid, sbuf.st_gid);757 if (! acl)762 theacl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, ¶ms, sbuf.st_uid, sbuf.st_gid); 763 if (!theacl) 758 764 return map_nt_error_from_unix(errno); 759 765 760 smbacl4_dump_nfs4acl(10, acl);766 smbacl4_dump_nfs4acl(10, theacl); 761 767 762 768 if (set_acl_as_root) { 763 769 become_root(); 764 770 } 765 result = set_nfs4_native(fsp, acl);771 result = set_nfs4_native(fsp, theacl); 766 772 saved_errno = errno; 767 773 if (set_acl_as_root) {
Note:
See TracChangeset
for help on using the changeset viewer.