summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2019-02-21 22:13:44 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2019-02-21 22:13:44 +0000
commitbeb69ffb819bc60d1c04fbefab3f745ebb74704e (patch)
tree98c5644ce55fcaf42afcf293bef97b0ffdb4b41d /usr.bin
parentc3e3fd656db89f094e32b0690d7ae02ade1336a1 (diff)
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.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rsync/ids.c12
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;
}
}