diff options
author | Ken Raeburn <raeburn@mit.edu> | 2002-06-25 20:56:17 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2002-06-25 20:56:17 +0000 |
commit | 99c69a712b10152a895bf9f9897d0306fafca8e6 (patch) | |
tree | d394e3859991bba13f78413348a52c04bbfd95a1 /src/include | |
parent | 4c22d46592fc34600f718920e10118caba70973c (diff) | |
download | krb5-99c69a712b10152a895bf9f9897d0306fafca8e6.tar.gz krb5-99c69a712b10152a895bf9f9897d0306fafca8e6.tar.xz krb5-99c69a712b10152a895bf9f9897d0306fafca8e6.zip |
move krb5_sete[ug]id from libkrb5util (fn) to k5-util.h (macro)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14569 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ChangeLog | 10 | ||||
-rw-r--r-- | src/include/configure.in | 2 | ||||
-rw-r--r-- | src/include/k5-util.h | 47 |
3 files changed, 54 insertions, 5 deletions
diff --git a/src/include/ChangeLog b/src/include/ChangeLog index c6aebe9d5..0d0e2514e 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,13 @@ +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, diff --git a/src/include/configure.in b/src/include/configure.in index a702a2acc..16117afe7 100644 --- a/src/include/configure.in +++ b/src/include/configure.in @@ -5,7 +5,7 @@ AC_PROG_INSTALL 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 diff --git a/src/include/k5-util.h b/src/include/k5-util.h index e4d49d96e..4f0c6f73f 100644 --- a/src/include/k5-util.h +++ b/src/include/k5-util.h @@ -1,5 +1,5 @@ /* - * 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 @@ -44,9 +44,48 @@ * 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 *, |