+2002-06-25 Ken Raeburn <raeburn@mit.edu>
+
+ * configure.in: Check for seteuid, setresuid, setreuid, setegid,
+ setresgid and setregid.
+ * k5-util.h: Include sys/types.h, unistd.h, and stdlib.h if
+ available; include krb5/autoconf.h and errno.h always.
+ (krb5_seteuid, krb5_setegid): Replace function declarations with
+ macro definitions.
+ (krb5_setedid): Delete declaration of non-existent function.
+
2002-06-24 Ken Raeburn <raeburn@mit.edu>
* port-sockets.h (win_socket_initialize): Delete declaration,
AC_PROG_AWK
AC_PROG_LEX
AC_C_CONST
-AC_CHECK_FUNCS(strdup labs setvbuf memmove bcopy inet_ntoa inet_aton gethostbyname_r gethostbyaddr_r getservbyname_r getservbyport_r)
+AC_CHECK_FUNCS(strdup labs setvbuf memmove bcopy inet_ntoa inet_aton gethostbyname_r gethostbyaddr_r getservbyname_r getservbyport_r seteuid setresuid setreuid setegid setresgid setregid)
dnl
dnl Check what the return types for gethostbyname_r and getservbyname_r are.
dnl
/*
- * Copyright (C) 1989-1998 by the Massachusetts Institute of Technology,
+ * Copyright (C) 1989-1998,2002 by the Massachusetts Institute of Technology,
* Cambridge, MA, USA. All Rights Reserved.
*
* This software is being provided to you, the LICENSEE, by the
* They live in libkrb5util.
*/
-int krb5_seteuid(int);
-int krb5_setedid(int);
-int krb5_setegid(int);
+#include "krb5/autoconf.h"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <errno.h>
+
+#ifndef krb5_seteuid
+
+#if defined(HAVE_SETEUID)
+# define krb5_seteuid(EUID) (seteuid((uid_t)(EUID)))
+#elif defined(HAVE_SETRESUID)
+# define krb5_seteuid(EUID) setresuid(getuid(), (uid_t)(EUID), geteuid())
+#elif defined(HAVE_SETREUID)
+# define krb5_seteuid(EUID) setreuid(geteuid(), (uid_t)(EUID))
+#else
+ /* You need to add a case to deal with this operating system.*/
+# define krb5_seteuid(EUID) (errno = EPERM, -1)
+#endif
+
+#ifdef HAVE_SETEGID
+# define krb5_setegid(EGID) (setegid((gid_t)(EGID)))
+#elif defined(HAVE_SETRESGID)
+# define krb5_setegid(EGID) (setresgid(getgid(), (gid_t)(EGID), getegid()))
+#elif defined(HAVE_SETREGID)
+# define krb5_setegid(EGID) (setregid(getegid(), (gid_t)(EGID)))
+#else
+ /* You need to add a case to deal with this operating system.*/
+# define krb5_setegid(EGID) (errno = EPERM, -1)
+#endif
+
+#endif
+
#if defined(KRB_DEFS) && defined(SOCK_DGRAM)
krb5_error_code krb5_compat_recvauth(krb5_context, krb5_auth_context *,
+2002-06-25 Ken Raeburn <raeburn@mit.edu>
+
+ * seteuid.c: Deleted.
+ * Makefile.in (OBJS, STLIBOBJS, SRCS): Remove references.
+
2001-10-05 Ken Raeburn <raeburn@mit.edu>
* compat_recv.c: Drop _MSDOS support.
##DOSBUILDTOP = ..\..
##DOSLIBNAME=krb5util.lib
-OBJS= compat_recv.$(OBJEXT) seteuid.$(OBJEXT)
+OBJS= compat_recv.$(OBJEXT)
-STLIBOBJS=compat_recv.o seteuid.o
+STLIBOBJS=compat_recv.o
-SRCS= $(srcdir)/compat_recv.c $(srcdir)/seteuid.c
+SRCS= $(srcdir)/compat_recv.c
LIB=krb5util
LIBMAJOR=1
$(SRCTOP)/include/socket-utils.h $(SRCTOP)/include/krb5/kdb.h \
$(BUILDTOP)/include/profile.h $(SRCTOP)/include/kerberosIV/krb.h \
$(SRCTOP)/include/kerberosIV/des.h $(SRCTOP)/include/k5-util.h
-seteuid.so seteuid.po $(OUTPRE)seteuid.$(OBJEXT): seteuid.c $(SRCTOP)/include/k5-util.h
+++ /dev/null
-/*
- * krb5_seteuid: Attempt to set the effective user ID of the current process
- * in such a way it can be restored lated.
- *
- * Copyright 1996 by the Massachusetts Institute of Technology.
- *
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation, and that the name of
- * M.I.T. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. Furthermore if you modify this software you must label
- * your software as modified software and not distribute it in such a
- * fashion that it might be confused with the original M.I.T. software.
- * M.I.T. makes no representations about the suitability
- * of this software for any purpose. It is provided "as is" without
- * express or implied warranty.
- *
- */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#include <k5-util.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <errno.h>
-
-int krb5_seteuid(euid_in)
- int euid_in;
-{
- uid_t euid = (uid_t) euid_in;
-#if defined(HAVE_SETEUID)
- return (seteuid(euid));
-#else
-#if defined(HAVE_SETRESUID)
- return (setresuid(getuid(), euid, geteuid()));
-#else
-#if defined(HAVE_SETREUID)
- return setreuid(geteuid(), euid);
-#else /*HAVE_SETREUID*/
- /* 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 (setegid(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 */
-}