=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rsync/ids.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- src/usr.bin/rsync/ids.c 2019/02/21 22:07:45 1.7 +++ src/usr.bin/rsync/ids.c 2019/02/21 22:13:43 1.8 @@ -1,4 +1,4 @@ -/* $Id: ids.c,v 1.7 2019/02/21 22:07:45 benno Exp $ */ +/* $Id: ids.c,v 1.8 2019/02/21 22:13:43 benno Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -45,6 +45,8 @@ * Given a list of files with the identifiers as set by the sender, * re-assign the identifiers from the list of remapped ones. * Don't ever remap wheel/root. + * If we can't find the gid in the list (when, e.g., being sent by the + * daemon), don't try to map it. */ void idents_assign_gid(struct sess *sess, struct flist *fl, size_t flsz, @@ -60,8 +62,8 @@ for (j = 0; j < idsz; j++) if ((int32_t)fl[i].st.gid == ids[j].id) break; - assert(j < idsz); - fl[i].st.gid = ids[j].mapped; + if (j < idsz) + fl[i].st.gid = ids[j].mapped; } } @@ -82,8 +84,8 @@ for (j = 0; j < idsz; j++) if ((int32_t)fl[i].st.uid == ids[j].id) break; - assert(j < idsz); - fl[i].st.uid = ids[j].mapped; + if (j < idsz) + fl[i].st.uid = ids[j].mapped; } }