- static struct idlist *add_to_list(struct idlist **root, int id, char *name,
- int id2)
-@@ -158,14 +160,41 @@ static int is_in_group(gid_t gid)
- /* Add a uid to the list of uids. Only called on receiving side. */
- static uid_t recv_add_uid(uid_t id, char *name)
+ static struct idlist *add_to_list(struct idlist **root, id_t id, const char *name,
+ id_t id2, uint16 flags)
+@@ -84,22 +90,6 @@ static const char *gid_to_name(gid_t gid)
+ return NULL;
+ }
+
+-static uid_t map_uid(uid_t id, const char *name)
+-{
+- uid_t uid;
+- if (id != 0 && name_to_uid(name, &uid))
+- return uid;
+- return id;
+-}
+-
+-static gid_t map_gid(gid_t id, const char *name)
+-{
+- gid_t gid;
+- if (id != 0 && name_to_gid(name, &gid))
+- return gid;
+- return id;
+-}
+-
+ static int is_in_group(gid_t gid)
+ {
+ #ifdef HAVE_GETGROUPS
+@@ -159,34 +149,49 @@ static int is_in_group(gid_t gid)
+ #endif
+ }
+
+-/* Add a uid to the list of uids. Only called on receiving side. */
+-static struct idlist *recv_add_uid(uid_t id, const char *name)
++/* Add a uid/gid to its list of ids. Only called on receiving side. */
++static struct idlist *recv_add_id(struct idlist **idmap_ptr, id_t id, const char *name)