pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


Fix ACLs with inheritance when ACL user==current_user
Posted by Anonymous on Thu 20th Jun 2024 16:11
raw | new post

  1. diff --git a/daemon/acl.c b/daemon/acl.c
  2. index 7ebc8ab..b8777fd 100644
  3. --- a/daemon/acl.c
  4. +++ b/daemon/acl.c
  5. @@ -768,16 +768,18 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  6.  
  7.      DPRINTF(ACLLVL, ("--> map_nfs4ace_who(sid=0x%p,owner_sid=0x%p, group_sid=0x%p)\n"));
  8.  
  9. +    if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  10. +        print_sid("sid", sid);
  11. +        print_sid("owner_sid", owner_sid);
  12. +        print_sid("group_sid", group_sid);
  13. +    }
  14. +
  15.      /* for ace mapping, we want to map owner's sid into "owner@"
  16.       * but for set_owner attribute we want to map owner into a user name
  17.       * same applies to group
  18.       */
  19.      status = 0;
  20.      if (owner_sid) {
  21. -        if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  22. -            print_sid("owner_sid", owner_sid);
  23. -        }
  24. -
  25.          if (EqualSid(sid, owner_sid)) {
  26.              DPRINTF(ACLLVL, ("map_nfs4ace_who: this is owner's sid\n"));
  27.              memcpy(who_out, ACE4_OWNER, strlen(ACE4_OWNER)+1);
  28. @@ -787,10 +789,6 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  29.          }
  30.      }
  31.      if (group_sid) {
  32. -        if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  33. -            print_sid("group_sid", group_sid);
  34. -        }
  35. -
  36.          if (EqualSid(sid, group_sid)) {
  37.              DPRINTF(ACLLVL, ("map_nfs4ace_who: this is group's sid\n"));
  38.              memcpy(who_out, ACE4_GROUP, strlen(ACE4_GROUP)+1);
  39. @@ -961,8 +959,22 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
  40.  
  41.              tmp_pointer += sizeof(ACCESS_MASK) + sizeof(ACE_HEADER);
  42.  
  43. -            status = map_nfs4ace_who(tmp_pointer, sid, gsid, nfs4_acl->aces[i].who,
  44. -                                     domain, &who_sid_type);
  45. +            PSID acl_sid = tmp_pointer;
  46. +
  47. +            /*
  48. +             * Only use NFSv4 special ACE names (e.g. "OWNER@",
  49. +             * "GROUP@") if |ace->AceFlags| does not use any
  50. +             * inheritance flags
  51. +             */
  52. +            if (ace->AceFlags) {
  53. +                status = map_nfs4ace_who(acl_sid, NULL, NULL,
  54. +                    nfs4_acl->aces[i].who, domain, &who_sid_type);
  55. +            }
  56. +            else {
  57. +                status = map_nfs4ace_who(acl_sid, sid, gsid,
  58. +                    nfs4_acl->aces[i].who, domain, &who_sid_type);
  59. +            }
  60. +
  61.              if (status)
  62.                  goto out_free;

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at