pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


msnfs41client: Remove Linux ACL workaround
Posted by Anonymous on Thu 16th Apr 2026 17:04
raw | new post

  1. diff --git a/daemon/acl.c b/daemon/acl.c
  2. index 8afa9b0..9e5a68f 100644
  3. --- a/daemon/acl.c
  4. +++ b/daemon/acl.c
  5. @@ -284,8 +284,8 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
  6.      nfs41_file_info info = { 0 };
  7.      stateid_arg stateid;
  8.      nfsacl41 nfs4_acl = { 0 };
  9. -    PSID sid = NULL, gsid = NULL;
  10. -    BOOL sid_default, gsid_default;
  11. +    PSID sid = NULL;
  12. +    BOOL sid_default;
  13.      char ownerbuf[NFS4_FATTR4_OWNER_LIMIT+1];
  14.      char groupbuf[NFS4_FATTR4_OWNER_LIMIT+1];
  15.  
  16. @@ -307,7 +307,7 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
  17.              goto out;
  18.          }
  19.  
  20. -        status = map_sid2nfs4ace_who(sid, NULL, NULL, ownerbuf,
  21. +        status = map_sid2nfs4ace_who(sid, ownerbuf,
  22.              nfs41dg->localdomain_name, NULL);
  23.          if (status)
  24.              goto out;
  25. @@ -329,7 +329,7 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
  26.              goto out;
  27.          }
  28.  
  29. -        status = map_sid2nfs4ace_who(sid, NULL, NULL, groupbuf,
  30. +        status = map_sid2nfs4ace_who(sid, groupbuf,
  31.              nfs41dg->localdomain_name, NULL);
  32.          if (status)
  33.              goto out;
  34. @@ -353,20 +353,7 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
  35.              eprintf("GetSecurityDescriptorDacl failed with %d\n", status);
  36.              goto out;
  37.          }
  38. -        status = GetSecurityDescriptorOwner(args->sec_desc, &sid, &sid_default);
  39. -        if (!status) {
  40. -            status = GetLastError();
  41. -            eprintf("GetSecurityDescriptorOwner failed with %d\n", status);
  42. -            goto out;
  43. -        }
  44. -        status = GetSecurityDescriptorGroup(args->sec_desc, &gsid, &gsid_default);
  45. -        if (!status) {
  46. -            status = GetLastError();
  47. -            eprintf("GetSecurityDescriptorOwner failed with %d\n", status);
  48. -            goto out;
  49. -        }
  50. -        status = map_dacl_2_nfs4acl(acl, sid, gsid, &nfs4_acl,
  51. -             state->type,
  52. +        status = map_dacl_2_nfs4acl(acl, &nfs4_acl, state->type,
  53.               state->file.fh.superblock->nfs_namedattr_support?true:false,
  54.              nfs41dg->localdomain_name);
  55.          if (status)
  56. diff --git a/daemon/aclutil.c b/daemon/aclutil.c
  57. index 6e93ba1..4c82148 100644
  58. --- a/daemon/aclutil.c
  59. +++ b/daemon/aclutil.c
  60. @@ -827,8 +827,11 @@ void map_nfs4acemask2winaccessmask(uint32_t nfs4_mask,
  61.  #endif
  62.  }
  63.  
  64. -int map_sid2nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid,
  65. -    char *who_out, const char *domain, SID_NAME_USE *sid_type_out)
  66. +int map_sid2nfs4ace_who(
  67. +    PSID sid,
  68. +    char *who_out,
  69. +    const char *domain,
  70. +    SID_NAME_USE *sid_type_out)
  71.  {
  72.      int status;
  73.      BOOL success;
  74. @@ -841,39 +844,16 @@ int map_sid2nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid,
  75.      /* fixme: This should be a function argument */
  76.      extern nfs41_daemon_globals nfs41_dg;
  77.  
  78. -    DPRINTF(ACLLVL2, ("--> map_sid2nfs4ace_who("
  79. -        "sid=0x%p,owner_sid=0x%p, group_sid=0x%p)\n",
  80. -        sid, owner_sid, group_sid));
  81. +    DPRINTF(ACLLVL2,
  82. +        ("--> map_sid2nfs4ace_who(sid=0x%p)\n",
  83. +        sid));
  84.  
  85.      if (DPRINTF_LEVEL_ENABLED(ACLLVL2)) {
  86.          print_sid("sid", sid);
  87. -        print_sid("owner_sid", owner_sid);
  88. -        print_sid("group_sid", group_sid);
  89.      }
  90.  
  91. -    /* for ace mapping, we want to map owner's sid into "owner@"
  92. -     * but for set_owner attribute we want to map owner into a user name
  93. -     * same applies to group
  94. -     */
  95.      status = ERROR_SUCCESS;
  96. -    if (owner_sid) {
  97. -        if (EqualSid(sid, owner_sid)) {
  98. -            DPRINTF(ACLLVL2, ("this is owner's sid\n"));
  99. -            (void)memcpy(who_out, ACE4_OWNER, ACE4_OWNER_LEN+1);
  100. -            sid_type = SidTypeUser;
  101. -            status = ERROR_SUCCESS;
  102. -            goto out;
  103. -        }
  104. -    }
  105. -    if (group_sid) {
  106. -        if (EqualSid(sid, group_sid)) {
  107. -            DPRINTF(ACLLVL2, ("this is group's sid\n"));
  108. -            memcpy(who_out, ACE4_GROUP, ACE4_GROUP_LEN+1);
  109. -            sid_type = SidTypeGroup;
  110. -            status = ERROR_SUCCESS;
  111. -            goto out;
  112. -        }
  113. -    }
  114. +
  115.      success = is_well_known_sid(sid, who_out, &sid_type);
  116.      if (success) {
  117.          if (!strncmp(who_out, ACE4_NOBODY, ACE4_NOBODY_LEN)) {
  118. @@ -1149,7 +1129,7 @@ out:
  119.      return status;
  120.  }
  121.  
  122. -int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
  123. +int map_dacl_2_nfs4acl(PACL acl, nfsacl41 *nfs4_acl,
  124.      int file_type, bool nfs_namedattr_support, const char *domain)
  125.  {
  126.      int status;
  127. @@ -1267,7 +1247,7 @@ int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
  128.              }
  129.  #endif /* NFS41_DRIVER_ACLS_SETACL_SKIP_WINNULLSID_ACES */
  130.  
  131. -            status = map_sid2nfs4ace_who(ace_sid, sid, gsid,
  132. +            status = map_sid2nfs4ace_who(ace_sid,
  133.                  curr_nfsace->who, domain, &who_sid_type);
  134.              if (status != ERROR_SUCCESS)
  135.                  goto out_free;
  136. diff --git a/daemon/aclutil.h b/daemon/aclutil.h
  137. index 2c2c74f..a973d4d 100644
  138. --- a/daemon/aclutil.h
  139. +++ b/daemon/aclutil.h
  140. @@ -36,12 +36,15 @@ void free_sids(PSID *sids, int count);
  141.  #ifdef NFS41_DRIVER_WS2022_HACKS
  142.  char *build_well_known_localised_nfs_grouplist(struct idmap_context *context);
  143.  #endif /* NFS41_DRIVER_WS2022_HACKS */
  144. -int map_sid2nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid,
  145. -    char *who_out, const char *domain, SID_NAME_USE *sid_type_out);
  146. +int map_sid2nfs4ace_who(
  147. +    PSID sid,
  148. +    char *who_out,
  149. +    const char *domain,
  150. +    SID_NAME_USE *sid_type_out);
  151.  int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
  152.      nfsacl41 *acl, int file_type, PACL *dacl_out, PSID **sids_out,
  153.      bool named_attr_support);
  154. -int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
  155. +int map_dacl_2_nfs4acl(PACL acl, nfsacl41 *nfs4_acl,
  156.      int file_type, bool named_attr_support, const char *domain);
  157.  
  158.  #endif /* !__NFS41_DAEMON_ACLUTIL_H__ */
  159. diff --git a/daemon/open.c b/daemon/open.c
  160. index 0d18b31..09388fd 100644
  161. --- a/daemon/open.c
  162. +++ b/daemon/open.c
  163. @@ -979,41 +979,22 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  164.  
  165.  #ifdef NFS41_DRIVER_ALLOW_CREATEFILE_ACLS
  166.      if (args->sec_desc_len) {
  167. -        PSID sid = NULL, gsid = NULL;
  168. -        BOOL sid_default, gsid_default;
  169. +        BOOL success;
  170.          BOOL dacl_present, dacl_default;
  171. -        PACL acl;
  172. +        PACL acl = NULL;
  173.          DPRINTF(0,
  174.              ("handle_open: args->sec_desc=0x%p args->sec_desc_len=%ld\n",
  175.              args->sec_desc, (long)args->sec_desc_len));
  176. -        status = GetSecurityDescriptorDacl(args->sec_desc, &dacl_present,
  177. +        success = GetSecurityDescriptorDacl(args->sec_desc, &dacl_present,
  178.              &acl, &dacl_default);
  179. -        if (!status) {
  180. +        if (!success) {
  181.              status = GetLastError();
  182.              eprintf("handle_open: "
  183.                  "GetSecurityDescriptorDacl() failed, lasterr=%d\n",
  184.                  status);
  185.              goto out_free_state;
  186.          }
  187. -        status = GetSecurityDescriptorOwner(args->sec_desc,
  188. -            &sid, &sid_default);
  189. -        if (!status) {
  190. -            status = GetLastError();
  191. -            eprintf("handle_open: "
  192. -                "GetSecurityDescriptorOwner() failed, lasterr=%d\n",
  193. -                status);
  194. -            goto out_free_state;
  195. -        }
  196. -        status = GetSecurityDescriptorGroup(args->sec_desc,
  197. -            &gsid, &gsid_default);
  198. -        if (!status) {
  199. -            status = GetLastError();
  200. -            eprintf("handle_open: "
  201. -                "GetSecurityDescriptorOwner() failed, lasterr=%d\n",
  202. -                status);
  203. -            goto out_free_state;
  204. -        }
  205. -        status = map_dacl_2_nfs4acl(acl, sid, gsid, &create_nfs4_acl,
  206. +        status = map_dacl_2_nfs4acl(acl, &create_nfs4_acl,
  207.              state->type,
  208.              false /* FIXME!! */,
  209.              nfs41dg->localdomain_name);

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