- diff --git a/daemon/acl.c b/daemon/acl.c
- index 937cb36..becfeef 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -980,11 +980,67 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- * SIDs
- */
- case ERROR_NONE_MAPPED:
- +#ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
- + /* fixme: This should be a function argument */
- + extern nfs41_daemon_globals nfs41_dg;
- +
- + uid_t unixuser_uid = ~0U;
- + gid_t unixgroup_gid = ~0U;
- +
- + if (unixuser_sid2uid(sid, &unixuser_uid)) {
- + if (!nfs41_idmap_uid_to_name(nfs41_dg.idmapper,
- + unixuser_uid, who_out, UNLEN)) {
- + who_size = (DWORD)strlen(who_out);
- + sid_type = SidTypeUser;
- + status = ERROR_SUCCESS;
- +
- + DPRINTF(0, ("map_nfs4ace_who: "
- + "Unix_User+%d SID "
- + "mapped to user '%s'\n",
- + unixuser_uid, who_out));
- + goto add_domain;
- + }
- +
- + eprintf("map_nfs4ace_who: "
- + "unixuser_sid2uid(sid='%s',unixuser_uid=%d) "
- + "returned no mapping.\n",
- + sidstr, (int)unixuser_uid);
- + }
- +
- + if (unixgroup_sid2gid(sid, &unixgroup_gid)) {
- + if (!nfs41_idmap_gid_to_group(nfs41_dg.idmapper,
- + unixgroup_gid, who_out, GNLEN)) {
- + who_size = (DWORD)strlen(who_out);
- + sid_type = SidTypeGroup;
- + status = ERROR_SUCCESS;
- +
- + DPRINTF(0, ("map_nfs4ace_who: "
- + "Unix_Group+%d SID "
- + "mapped to user '%s'\n",
- + unixgroup_gid, who_out));
- + goto add_domain;
- + }
- +
- + eprintf("map_nfs4ace_who: "
- + "unixgroup_sid2gid(sid='%s',unixgroup_gid=%d) "
- + "returned no mapping.\n",
- + sidstr, (int)unixgroup_gid);
- + }
- +
- + DPRINTF(0, ("map_nfs4ace_who: LookupAccountSidA() "
- + "returned ERROR_NONE_MAPPED+no "
- + "Unix_@(User|Group)+ mapping for sidstr='%s'\n",
- + sidstr));
- + status = ERROR_NONE_MAPPED;
- +
- +#else
- DPRINTF(ACLLVL2, ("map_nfs4ace_who: LookupAccountSidA() "
- "returned ERROR_NONE_MAPPED for sidstr='%s'\n",
- sidstr));
- status = lasterr;
- goto out;
- +#endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
- +
- /* Catch other cases */
- case ERROR_NO_SUCH_USER:
- case ERROR_NO_SUCH_GROUP:
- diff --git a/daemon/sid.c b/daemon/sid.c
- index 2a63763..bb4880a 100644
- --- a/daemon/sid.c
- +++ b/daemon/sid.c
- @@ -528,7 +528,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- user_uid = map_uid;
- }
- else {
- - DPRINTF(1,
- + DPRINTF(0,
- ("map_nfs4servername_2_sid(query=%x,name='%s'): "
- "nfs41_idmap_name_to_uid() failed\n",
- query, nfsname));
- @@ -546,7 +546,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- group_gid = map_gid;
- }
- else {
- - DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,nfsname='%s'): nfs41_idmap_group_to_gid() failed\n",
- + DPRINTF(0, ("map_nfs4servername_2_sid(query=%x,nfsname='%s'): nfs41_idmap_group_to_gid() failed\n",
- query, nfsname));
- /* fixme: try harder here, "1234" should to to |atol()| */
- }
- diff --git a/daemon/sid.h b/daemon/sid.h
- index d310d88..57edfc7 100644
- --- a/daemon/sid.h
- +++ b/daemon/sid.h
- @@ -52,6 +52,10 @@ extern sidcache group_sidcache;
- /* prototypes */
- int create_unknownsid(WELL_KNOWN_SID_TYPE type, PSID *sid, DWORD *sid_len);
- +#ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
- +bool unixuser_sid2uid(PSID psid, uid_t *puid);
- +bool unixgroup_sid2gid(PSID psid, gid_t *pgid);
- +#endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
- void sidcache_init(void);
- void sidcache_add(sidcache *cache, const char* win32name, PSID value);
- PSID *sidcache_getcached_byname(sidcache *cache, const char *win32name);
backup 20240702
Posted by Anonymous on Tue 2nd Jul 2024 17:15
raw | new post
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.