|
Packit |
fd8b60 |
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
Packit |
fd8b60 |
/*
|
|
Packit |
fd8b60 |
* Copyright (C) 1989-1998,2002 by the Massachusetts Institute of Technology,
|
|
Packit |
fd8b60 |
* Cambridge, MA, USA. All Rights Reserved.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* This software is being provided to you, the LICENSEE, by the
|
|
Packit |
fd8b60 |
* Massachusetts Institute of Technology (M.I.T.) under the following
|
|
Packit |
fd8b60 |
* license. By obtaining, using and/or copying this software, you agree
|
|
Packit |
fd8b60 |
* that you have read, understood, and will comply with these terms and
|
|
Packit |
fd8b60 |
* conditions:
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* Export of this software from the United States of America may
|
|
Packit |
fd8b60 |
* require a specific license from the United States Government.
|
|
Packit |
fd8b60 |
* It is the responsibility of any person or organization contemplating
|
|
Packit |
fd8b60 |
* export to obtain such a license before exporting.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
|
|
Packit |
fd8b60 |
* this software and its documentation for any purpose and without fee or
|
|
Packit |
fd8b60 |
* royalty is hereby granted, provided that you agree to comply with the
|
|
Packit |
fd8b60 |
* following copyright notice and statements, including the disclaimer, and
|
|
Packit |
fd8b60 |
* that the same appear on ALL copies of the software and documentation,
|
|
Packit |
fd8b60 |
* including modifications that you make for internal use or for
|
|
Packit |
fd8b60 |
* distribution:
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
|
|
Packit |
fd8b60 |
* OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not
|
|
Packit |
fd8b60 |
* limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
|
Packit |
fd8b60 |
* MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
|
|
Packit |
fd8b60 |
* THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
|
|
Packit |
fd8b60 |
* PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* The name of the Massachusetts Institute of Technology or M.I.T. may NOT
|
|
Packit |
fd8b60 |
* be used in advertising or publicity pertaining to distribution of the
|
|
Packit |
fd8b60 |
* software. Title to copyright in this software and any associated
|
|
Packit |
fd8b60 |
* documentation shall at all times remain with M.I.T., and USER agrees to
|
|
Packit |
fd8b60 |
* preserve same.
|
|
Packit |
fd8b60 |
*
|
|
Packit |
fd8b60 |
* Furthermore if you modify this software you must label
|
|
Packit |
fd8b60 |
* your software as modified software and not distribute it in such a
|
|
Packit |
fd8b60 |
* fashion that it might be confused with the original M.I.T. software.
|
|
Packit |
fd8b60 |
*/
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
/*
|
|
Packit |
fd8b60 |
* "internal" utility functions used by various applications.
|
|
Packit |
fd8b60 |
* They live in libkrb5util.
|
|
Packit |
fd8b60 |
*/
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#include "autoconf.h"
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#ifdef HAVE_SYS_TYPES_H
|
|
Packit |
fd8b60 |
#include <sys/types.h>
|
|
Packit |
fd8b60 |
#endif
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#ifdef HAVE_UNISTD_H
|
|
Packit |
fd8b60 |
#include <unistd.h>
|
|
Packit |
fd8b60 |
#endif
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#ifdef HAVE_STDLIB_H
|
|
Packit |
fd8b60 |
#include <stdlib.h>
|
|
Packit |
fd8b60 |
#endif
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#include <errno.h>
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#ifndef krb5_seteuid
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#if defined(HAVE_SETEUID)
|
|
Packit |
fd8b60 |
# define krb5_seteuid(EUID) (seteuid((uid_t)(EUID)))
|
|
Packit |
fd8b60 |
#elif defined(HAVE_SETRESUID)
|
|
Packit |
fd8b60 |
# define krb5_seteuid(EUID) setresuid(getuid(), (uid_t)(EUID), geteuid())
|
|
Packit |
fd8b60 |
#elif defined(HAVE_SETREUID)
|
|
Packit |
fd8b60 |
# define krb5_seteuid(EUID) setreuid(geteuid(), (uid_t)(EUID))
|
|
Packit |
fd8b60 |
#else
|
|
Packit |
fd8b60 |
/* You need to add a case to deal with this operating system.*/
|
|
Packit |
fd8b60 |
# define krb5_seteuid(EUID) (errno = EPERM, -1)
|
|
Packit |
fd8b60 |
#endif
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#ifdef HAVE_SETEGID
|
|
Packit |
fd8b60 |
# define krb5_setegid(EGID) (setegid((gid_t)(EGID)))
|
|
Packit |
fd8b60 |
#elif defined(HAVE_SETRESGID)
|
|
Packit |
fd8b60 |
# define krb5_setegid(EGID) (setresgid(getgid(), (gid_t)(EGID), getegid()))
|
|
Packit |
fd8b60 |
#elif defined(HAVE_SETREGID)
|
|
Packit |
fd8b60 |
# define krb5_setegid(EGID) (setregid(getegid(), (gid_t)(EGID)))
|
|
Packit |
fd8b60 |
#else
|
|
Packit |
fd8b60 |
/* You need to add a case to deal with this operating system.*/
|
|
Packit |
fd8b60 |
# define krb5_setegid(EGID) (errno = EPERM, -1)
|
|
Packit |
fd8b60 |
#endif
|
|
Packit |
fd8b60 |
|
|
Packit |
fd8b60 |
#endif
|