pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


backup 20240702
Posted by Anonymous on Tue 2nd Jul 2024 17:15
raw | new post

  1. diff --git a/daemon/acl.c b/daemon/acl.c
  2. index 937cb36..becfeef 100644
  3. --- a/daemon/acl.c
  4. +++ b/daemon/acl.c
  5. @@ -980,11 +980,67 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  6.               * SIDs
  7.               */
  8.              case ERROR_NONE_MAPPED:
  9. +#ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
  10. +                /* fixme: This should be a function argument */
  11. +                extern nfs41_daemon_globals nfs41_dg;
  12. +
  13. +                uid_t unixuser_uid = ~0U;
  14. +                gid_t unixgroup_gid = ~0U;
  15. +
  16. +                if (unixuser_sid2uid(sid, &unixuser_uid)) {
  17. +                    if (!nfs41_idmap_uid_to_name(nfs41_dg.idmapper,
  18. +                        unixuser_uid, who_out, UNLEN)) {
  19. +                        who_size = (DWORD)strlen(who_out);
  20. +                        sid_type = SidTypeUser;
  21. +                        status = ERROR_SUCCESS;
  22. +
  23. +                        DPRINTF(0, ("map_nfs4ace_who: "
  24. +                            "Unix_User+%d SID "
  25. +                            "mapped to user '%s'\n",
  26. +                            unixuser_uid, who_out));
  27. +                        goto add_domain;
  28. +                    }
  29. +
  30. +                    eprintf("map_nfs4ace_who: "
  31. +                        "unixuser_sid2uid(sid='%s',unixuser_uid=%d) "
  32. +                        "returned no mapping.\n",
  33. +                        sidstr, (int)unixuser_uid);
  34. +                }
  35. +
  36. +                if (unixgroup_sid2gid(sid, &unixgroup_gid)) {
  37. +                    if (!nfs41_idmap_gid_to_group(nfs41_dg.idmapper,
  38. +                        unixgroup_gid, who_out, GNLEN)) {
  39. +                        who_size = (DWORD)strlen(who_out);
  40. +                        sid_type = SidTypeGroup;
  41. +                        status = ERROR_SUCCESS;
  42. +
  43. +                        DPRINTF(0, ("map_nfs4ace_who: "
  44. +                            "Unix_Group+%d SID "
  45. +                            "mapped to user '%s'\n",
  46. +                            unixgroup_gid, who_out));
  47. +                        goto add_domain;
  48. +                    }
  49. +
  50. +                    eprintf("map_nfs4ace_who: "
  51. +                        "unixgroup_sid2gid(sid='%s',unixgroup_gid=%d) "
  52. +                        "returned no mapping.\n",
  53. +                        sidstr, (int)unixgroup_gid);
  54. +                }
  55. +
  56. +                DPRINTF(0, ("map_nfs4ace_who: LookupAccountSidA() "
  57. +                    "returned ERROR_NONE_MAPPED+no "
  58. +                    "Unix_@(User|Group)+ mapping for sidstr='%s'\n",
  59. +                    sidstr));
  60. +                status = ERROR_NONE_MAPPED;
  61. +
  62. +#else
  63.                  DPRINTF(ACLLVL2, ("map_nfs4ace_who: LookupAccountSidA() "
  64.                      "returned ERROR_NONE_MAPPED for sidstr='%s'\n",
  65.                      sidstr));
  66.                  status = lasterr;
  67.                  goto out;
  68. +#endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  69. +
  70.              /* Catch other cases */
  71.              case ERROR_NO_SUCH_USER:
  72.              case ERROR_NO_SUCH_GROUP:
  73. diff --git a/daemon/sid.c b/daemon/sid.c
  74. index 2a63763..bb4880a 100644
  75. --- a/daemon/sid.c
  76. +++ b/daemon/sid.c
  77. @@ -528,7 +528,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  78.                  user_uid = map_uid;
  79.              }
  80.              else {
  81. -                DPRINTF(1,
  82. +                DPRINTF(0,
  83.                      ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  84.                      "nfs41_idmap_name_to_uid() failed\n",
  85.                      query, nfsname));
  86. @@ -546,7 +546,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  87.                  group_gid = map_gid;
  88.              }
  89.              else {
  90. -                DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,nfsname='%s'): nfs41_idmap_group_to_gid() failed\n",
  91. +                DPRINTF(0, ("map_nfs4servername_2_sid(query=%x,nfsname='%s'): nfs41_idmap_group_to_gid() failed\n",
  92.                      query, nfsname));
  93.                  /* fixme: try harder here, "1234" should to to |atol()| */
  94.              }
  95. diff --git a/daemon/sid.h b/daemon/sid.h
  96. index d310d88..57edfc7 100644
  97. --- a/daemon/sid.h
  98. +++ b/daemon/sid.h
  99. @@ -52,6 +52,10 @@ extern sidcache group_sidcache;
  100.  
  101.  /* prototypes */
  102.  int create_unknownsid(WELL_KNOWN_SID_TYPE type, PSID *sid, DWORD *sid_len);
  103. +#ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
  104. +bool unixuser_sid2uid(PSID psid, uid_t *puid);
  105. +bool unixgroup_sid2gid(PSID psid, gid_t *pgid);
  106. +#endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  107.  void sidcache_init(void);
  108.  void sidcache_add(sidcache *cache, const char* win32name, PSID value);
  109.  PSID *sidcache_getcached_byname(sidcache *cache, const char *win32name);

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