diff options
author | 2019-02-21 22:13:43 +0000 | |
---|---|---|
committer | 2019-02-21 22:13:43 +0000 | |
commit | 4cdf811f8ba1cf356022cdc47cf56b599c03ce6d (patch) | |
tree | 7549fa936e65e621e4c3a2255f640ede0cd9c9b9 | |
parent | kristaps 7721288a1d170f4d789bf7a7b822f14f91f7bcb9 (diff) | |
download | wireguard-openbsd-4cdf811f8ba1cf356022cdc47cf56b599c03ce6d.tar.xz wireguard-openbsd-4cdf811f8ba1cf356022cdc47cf56b599c03ce6d.zip |
kristaps cbe83cd64f40e634dbc22d3f2918c41977a6514d
If we don't get a uid/gid map, such as with an rsync:// address, we
might not be able to map. So fall back on numeric ids.
-rw-r--r-- | usr.bin/rsync/ids.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/rsync/ids.c b/usr.bin/rsync/ids.c index b1a1a07b5c4..4ef97186a58 100644 --- a/usr.bin/rsync/ids.c +++ b/usr.bin/rsync/ids.c @@ -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 <kristaps@bsd.lv> * @@ -45,6 +45,8 @@ idents_free(struct ident *p, size_t sz) * 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 @@ idents_assign_gid(struct sess *sess, struct flist *fl, size_t flsz, 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 @@ idents_assign_uid(struct sess *sess, struct flist *fl, size_t flsz, 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; } } |