changeset 2705:20dcf58cc05c HEAD

Add seteuid() wrapper for HP-UX
author Timo Sirainen <tss@iki.fi>
date Fri, 08 Oct 2004 16:33:03 +0300
parents 7209877f49a0
children 21bb4bb2ca39
files configure.in src/lib/compat.c src/lib/compat.h
diffstat 3 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Fri Oct 08 15:01:41 2004 +0300
+++ b/configure.in	Fri Oct 08 16:33:03 2004 +0300
@@ -1,7 +1,7 @@
 AC_INIT(src)
 
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(dovecot, 1.0-test40)
+AM_INIT_AUTOMAKE(dovecot, 1.0-test46)
 
 AM_MAINTAINER_MODE
 
@@ -266,7 +266,7 @@
 dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
 AC_CHECK_FUNCS(fcntl flock lockf inet_aton sigaction getpagesize madvise \
                strcasecmp stricmp vsnprintf vsyslog writev pread \
-	       setrlimit setproctitle)
+	       setrlimit setproctitle seteuid setreuid)
 
 dnl * I/O loop function
 have_ioloop=no
--- a/src/lib/compat.c	Fri Oct 08 15:01:41 2004 +0300
+++ b/src/lib/compat.c	Fri Oct 08 16:33:03 2004 +0300
@@ -160,3 +160,15 @@
 	return pwrite(fd, buf, count, offset);
 }
 #endif
+
+#ifndef HAVE_SETEUID
+int my_seteuid(uid_t euid)
+{
+#ifdef HAVE_SETREUID
+	/* HP-UX at least doesn't have seteuid() but has setreuid() */
+	return setreuid(-1, euid);
+#else
+#  error Missing seteuid functionality
+#endif
+}
+#endif
--- a/src/lib/compat.h	Fri Oct 08 15:01:41 2004 +0300
+++ b/src/lib/compat.h	Fri Oct 08 16:33:03 2004 +0300
@@ -108,6 +108,10 @@
 ssize_t my_pwrite(int fd, const void *buf, size_t count, off_t offset);
 #endif
 
+#ifndef HAVE_SETEUID
+int my_seteuid(uid_t euid);
+#endif
+
 /* ctype.h isn't safe with signed chars,
    use our own instead if really needed */
 #define i_toupper(x) ((char) toupper((int) (unsigned char) (x)))