=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rsync/ids.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- src/usr.bin/rsync/ids.c 2019/02/14 18:26:52 1.5 +++ src/usr.bin/rsync/ids.c 2019/02/21 22:06:26 1.6 @@ -1,4 +1,4 @@ -/* $Id: ids.c,v 1.5 2019/02/14 18:26:52 florian Exp $ */ +/* $Id: ids.c,v 1.6 2019/02/21 22:06:26 benno Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -86,14 +86,10 @@ /* * Given a list of identifiers from the remote host, fill in our local * identifiers of the same names. - * Use the remote numeric identifier if we can't find the identifier OR - * the identifier is zero (wheel/root). - * FIXME: what happens if we don't find the local identifier (we should - * really warn about this), but the remote identifier maps into a - * different name for us? - * These are pretty unexpected things for rsync to do. - * Another FIXME because we shouldn't let that happen even though the - * reference rsync does. + * Use the remote numeric identifier if we can't find the identifier OR the + * identifier is zero (wheel/root). + * FIXME: we should at least warn when we can't find an identifier, use + * the numeric id, and that numeric id is assigned to a different user. */ void idents_remap(struct sess *sess, int isgid, struct ident *ids, size_t idsz) @@ -102,6 +98,15 @@ struct group *grp; struct passwd *usr; int32_t id; + + if (sess->opts->numeric_ids) { + for (i = 0; i < idsz; i++) { + assert(ids[i].id != 0); + ids[i].mapped = ids[i].id; + } + LOG4(sess, "did not remap identifiers"); + return; + } for (i = 0; i < idsz; i++) { assert(ids[i].id != 0);