+Sun Feb 22 19:22:18 1998 Tom Yu <tlyu@mit.edu>
+
+ * configure.in: Add checks for set{re,e,res}gid().
+
+ * seteuid.c: Include k5-util.h rather than k5-int.h. Add
+ krb5_setegid().
+
Wed Feb 18 16:26:00 1998 Tom Yu <tlyu@mit.edu>
* Makefile.in: Remove trailing slash from thisconfigdir. Fix up
AC_INIT(configure.in)
CONFIG_RULES
AC_CHECK_HEADERS(unistd.h stdlib.h sys/types.h)
-AC_CHECK_FUNCS(seteuid setresuid setreuid)
+AC_CHECK_FUNCS(seteuid setresuid setreuid setegid setresgid setregid)
dnl AppendRule([all:: all-$(WHAT)])
KRB5_BUILD_LIBRARY_STATIC
KRB5_BUILD_LIBOBJS
#include <sys/types.h>
#endif
-#include <k5-int.h>
+#include <k5-util.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#include <errno.h>
-int krb5_seteuid( euid_in)
+int krb5_seteuid(euid_in)
int euid_in;
{
uid_t euid = (uid_t) euid_in;
#if defined(HAVE_SETEUID)
- return (seteuid(euid)) ;
+ return (seteuid(euid));
#else
#if defined(HAVE_SETRESUID)
- return (setresuid(getuid(), euid, geteuid())) ;
+ return (setresuid(getuid(), euid, geteuid()));
#else
#if defined(HAVE_SETREUID)
return setreuid(geteuid(), euid);
/* You need to add a case to deal with this operating system.*/
errno = EPERM;
return -1;
-
#endif /* HAVE_SETREUID */
#endif /* HAVE_SETRESUID */
#endif /* HAVE_SETEUID */
}
+
+int krb5_setegid(egid_in)
+ int egid_in;
+{
+ gid_t egid = (gid_t) egid_in;
+
+#ifdef HAVE_SETEGID
+ return (seteuid(egid));
+#else
+#ifdef HAVE_SETRESGID
+ return (setresgid(getgid(), egid, getegid()));
+#else
+#ifdef HAVE_SETREGID
+ return (setregid(getegid(), egid));
+#else /* HAVE_SETREGID */
+ /* You need to add a case to deal with this operating system.*/
+ errno = EPERM;
+ return -1;
+#endif /* HAVE_SETREGID */
+#endif /* HAVE_SETRESGID */
+#endif /* HAVE_SETEGID */
+}