aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2022-05-11 11:22:46 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2022-05-11 11:22:46 +0900
commitc190883a0a76cee5ffc951728a539fe7f9d71feb (patch)
treea3879b6bae4e2e0850a7fe1c1679e6e31877a86f
parenteec9882d04661b1114e93b6bf6129453fae6f5a1 (diff)
downloadzsh-c190883a0a76cee5ffc951728a539fe7f9d71feb.tar.gz
zsh-c190883a0a76cee5ffc951728a539fe7f9d71feb.tar.xz
zsh-c190883a0a76cee5ffc951728a539fe7f9d71feb.zip
50192: use set{u,g}id() for dropping privilege on NetBSD
-rw-r--r--ChangeLog5
-rw-r--r--Src/openssh_bsd_setres_id.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c617aec3..f5a8b66bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-05-11 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 50192: Src/openssh_bsd_setres_id.c: use set{u,g}id() instead of
+ setre{u,g}id() for dropping privilege on NetBSD
+
2022-05-08 dana <dana@dana.is>
* 50176 (with xpufx, tweaked): Completion/Linux/Command/_htop:
diff --git a/Src/openssh_bsd_setres_id.c b/Src/openssh_bsd_setres_id.c
index 217a6d074..26c7d3958 100644
--- a/Src/openssh_bsd_setres_id.c
+++ b/Src/openssh_bsd_setres_id.c
@@ -55,6 +55,16 @@
#include <unistd.h>
#include <string.h>
+#ifdef __NetBSD__
+/*
+ * On NetBSD, setreuid() does not reset the saved uid if the real uid
+ * is not modified. Better to use setuid() that resets all of real,
+ * effective and saved uids to the specified value. Same for setregid().
+ */
+#define BROKEN_SETREUID
+#define BROKEN_SETREGID
+#endif
+
#if defined(ZSH_IMPLEMENT_SETRESGID) || defined(BROKEN_SETRESGID)
int
setresgid(gid_t rgid, gid_t egid, gid_t sgid)