aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilles Chehade <gilles@poolp.org>2019-11-17 20:51:56 +0100
committerGilles Chehade <gilles@poolp.org>2019-11-17 20:51:56 +0100
commit566e49fd48a6bc7a41908cc152798a100d7fdb8d (patch)
tree1e596871637cfca7e4e26cee4d8d0d0ae417354e
parentconditionally build nanosec() and usleep() (diff)
downloadOpenSMTPD-566e49fd48a6bc7a41908cc152798a100d7fdb8d.tar.xz
OpenSMTPD-566e49fd48a6bc7a41908cc152798a100d7fdb8d.zip
conditionally build seteuid and setegid
-rw-r--r--configure.ac4
-rw-r--r--openbsd-compat/Makefile.am8
-rw-r--r--openbsd-compat/bsd-misc.c14
3 files changed, 12 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac
index ab415578..e429e12e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -568,6 +568,8 @@ AC_CHECK_FUNCS([ \
recallocarray \
res_hnok \
setenv \
+ seteuid \
+ setegid \
setproctitle \
setregid \
setreuid \
@@ -2035,6 +2037,8 @@ AM_CONDITIONAL([NEED_PIDFILE], [test "x$ac_cv_func_pidfile" != "xyes"])
AM_CONDITIONAL([NEED_REALLOCARRAY], [test "x$ac_cv_func_reallocarray" != "xyes"])
AM_CONDITIONAL([NEED_RECALLOCARRAY], [test "x$ac_cv_func_recallocarray" != "xyes"])
AM_CONDITIONAL([NEED_SETPROCTITLE], [test "x$ac_cv_func_setproctitle" != "xyes"])
+AM_CONDITIONAL([NEED_SETEGID], [test "x$ac_cv_func_setegid" != "xyes"])
+AM_CONDITIONAL([NEED_SETEUID], [test "x$ac_cv_func_seteuid" != "xyes"])
AM_CONDITIONAL([NEED_SETRESGID], [test "x$ac_cv_func_setresgid" != "xyes"])
AM_CONDITIONAL([NEED_SETRESUID], [test "x$ac_cv_func_setresuid" != "xyes"])
AM_CONDITIONAL([NEED_SIGNAL], [test "x$ac_cv_func_signal" != "xyes"])
diff --git a/openbsd-compat/Makefile.am b/openbsd-compat/Makefile.am
index 2df97bed..0c4b900f 100644
--- a/openbsd-compat/Makefile.am
+++ b/openbsd-compat/Makefile.am
@@ -114,6 +114,14 @@ if NEED_SETRESUID
libopenbsd_compat_a_SOURCES += setresuid.c
endif
+if NEED_SETEGID
+libopenbsd_compat_a_SOURCES += setegid.c
+endif
+
+if NEED_SETEUID
+libopenbsd_compat_a_SOURCES += seteuid.c
+endif
+
if NEED_SIGNAL
libopenbsd_compat_a_SOURCES += signal.c
endif
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index ccbcfa77..67a45351 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -64,17 +64,3 @@ char *ssh_get_progname(char *argv0)
#endif
return retp;
}
-
-#if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID)
-int seteuid(uid_t euid)
-{
- return (setreuid(-1, euid));
-}
-#endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */
-
-#if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID)
-int setegid(uid_t egid)
-{
- return(setresgid(-1, egid, -1));
-}
-#endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */