1 /* 2 * Copyright (C) 1989-1998,2002 by the Massachusetts Institute of Technology, 3 * Cambridge, MA, USA. All Rights Reserved. 4 * 5 * This software is being provided to you, the LICENSEE, by the 6 * Massachusetts Institute of Technology (M.I.T.) under the following 7 * license. By obtaining, using and/or copying this software, you agree 8 * that you have read, understood, and will comply with these terms and 9 * conditions: 10 * 11 * Export of this software from the United States of America may 12 * require a specific license from the United States Government. 13 * It is the responsibility of any person or organization contemplating 14 * export to obtain such a license before exporting. 15 * 16 * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute 17 * this software and its documentation for any purpose and without fee or 18 * royalty is hereby granted, provided that you agree to comply with the 19 * following copyright notice and statements, including the disclaimer, and 20 * that the same appear on ALL copies of the software and documentation, 21 * including modifications that you make for internal use or for 22 * distribution: 23 * 24 * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS 25 * OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not 26 * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF 27 * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF 28 * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY 29 * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. 30 * 31 * The name of the Massachusetts Institute of Technology or M.I.T. may NOT 32 * be used in advertising or publicity pertaining to distribution of the 33 * software. Title to copyright in this software and any associated 34 * documentation shall at all times remain with M.I.T., and USER agrees to 35 * preserve same. 36 * 37 * Furthermore if you modify this software you must label 38 * your software as modified software and not distribute it in such a 39 * fashion that it might be confused with the original M.I.T. software. 40 */ 41 42 /* 43 * "internal" utility functions used by various applications. 44 * They live in libkrb5util. 45 */ 46 47 #include "autoconf.h" 48 49 #ifdef HAVE_SYS_TYPES_H 50 #include <sys/types.h> 51 #endif 52 53 #ifdef HAVE_UNISTD_H 54 #include <unistd.h> 55 #endif 56 57 #ifdef HAVE_STDLIB_H 58 #include <stdlib.h> 59 #endif 60 61 #include <errno.h> 62 63 #ifndef krb5_seteuid 64 65 #if defined(HAVE_SETEUID) 66 # define krb5_seteuid(EUID) (seteuid((uid_t)(EUID))) 67 #elif defined(HAVE_SETRESUID) 68 # define krb5_seteuid(EUID) setresuid(getuid(), (uid_t)(EUID), geteuid()) 69 #elif defined(HAVE_SETREUID) 70 # define krb5_seteuid(EUID) setreuid(geteuid(), (uid_t)(EUID)) 71 #else 72 # error "You need to add a case to deal with this operating system." 73 # define krb5_seteuid(EUID) (errno = EPERM, -1) 74 #endif 75 76 #endif 77