=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sudo/Attic/compat.h,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.8.1 diff -c -r1.1.1.1 -r1.1.1.1.8.1 *** src/usr.bin/sudo/Attic/compat.h 1999/11/18 16:29:01 1.1.1.1 --- src/usr.bin/sudo/Attic/compat.h 2002/01/18 16:14:44 1.1.1.1.8.1 *************** *** 1,5 **** /* ! * Copyright (c) 1996, 1998, 1999 Todd C. Miller * All rights reserved. * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* ! * Copyright (c) 1996, 1998-2002 Todd C. Miller * All rights reserved. * * Redistribution and use in source and binary forms, with or without *************** *** 31,37 **** * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ! * $Sudo: compat.h,v 1.54 1999/10/08 01:12:49 millert Exp $ */ #ifndef _SUDO_COMPAT_H --- 31,37 ---- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ! * $Sudo: compat.h,v 1.62 2002/01/08 15:00:18 millert Exp $ */ #ifndef _SUDO_COMPAT_H *************** *** 145,152 **** #endif /* ! * Emulate seteuid() for HP-UX via setresuid(2) and seteuid(2) for others. */ #ifndef HAVE_SETEUID # ifdef __hpux # define seteuid(_EUID) (setresuid((uid_t) -1, _EUID, (uid_t) -1)) --- 145,175 ---- #endif /* ! * Simple isblank() macro for systems without it. */ + #ifndef HAVE_ISBLANK + # define isblank(_x) ((_x) == ' ' || (_x) == '\t') + #endif + + /* + * Old BSD systems lack strchr(), strrchr(), memset() and memcpy() + */ + #if !defined(HAVE_STRCHR) && !defined(strchr) + # define strchr(_s, _c) index(_s, _c) + #endif + #if !defined(HAVE_STRRCHR) && !defined(strrchr) + # define strrchr(_s, _c) rindex(_s, _c) + #endif + #if !defined(HAVE_MEMCPY) && !defined(memcpy) + # define memcpy(_d, _s, _n) (bcopy(_s, _d, _n)) + #endif + #if !defined(HAVE_MEMSET) && !defined(memset) + # define memset(_s, _x, _n) (bzero(_s, _n)) + #endif + + /* + * Emulate sete[ug]id() via setres[ug]id(2) or setre[ug]id(2) + */ #ifndef HAVE_SETEUID # ifdef __hpux # define seteuid(_EUID) (setresuid((uid_t) -1, _EUID, (uid_t) -1)) *************** *** 154,165 **** --- 177,248 ---- # define seteuid(_EUID) (setreuid((uid_t) -1, _EUID)) # endif /* __hpux */ #endif /* HAVE_SETEUID */ + #ifndef HAVE_SETEGID + # ifdef __hpux + # define setegid(_EGID) (setresgid((gid_t) -1, _EGID, (gid_t) -1)) + # else + # define setegid(_EGID) (setregid((gid_t) -1, _EGID)) + # endif /* __hpux */ + #endif /* HAVE_SETEGID */ /* + * Emulate setreuid() for HP-UX via setresuid(2) + */ + #if !defined(HAVE_SETREUID) && defined(__hpux) + # define setreuid(_RUID, _EUID) (setresuid(_RUID, _EUID, (uid_t) -1)) + # define HAVE_SETREUID + #endif /* !HAVE_SETEUID && __hpux */ + + /* + * NCR's SVr4 has _innetgr(3) instead of innetgr(3) for some reason. + */ + #ifdef HAVE__INNETGR + # define innetgr(n, h, u, d) (_innetgr(n, h, u, d)) + # define HAVE_INNETGR 1 + #endif /* HAVE__INNETGR */ + + /* * On POSIX systems, O_NOCTTY is the default so some OS's may lack this define. */ #ifndef O_NOCTTY # define O_NOCTTY 0 #endif /* O_NOCTTY */ + + /* + * Emulate POSIX signals via sigvec(2) + */ + #ifndef HAVE_SIGACTION + # define SA_ONSTACK SV_ONSTACK + # define SA_RESTART SV_INTERRUPT /* opposite effect */ + # define SA_RESETHAND SV_RESETHAND + # define sa_handler sv_handler + # define sa_mask sv_mask + # define sa_flags sv_flags + typedef struct sigvec sigaction_t; + typedef int sigset_t; + int sigaction __P((int sig, const sigaction_t *act, sigaction_t *oact)); + int sigemptyset __P((sigset_t *)); + int sigfillset __P((sigset_t *)); + int sigaddset __P((sigset_t *, int)); + int sigdelset __P((sigset_t *, int)); + int sigismember __P((sigset_t *, int)); + int sigprocmask __P((int, const sigset_t *, sigset_t *)); + #endif + + /* + * Extra sugar for POSIX signals to deal with the above emulation + * as well as the fact that SunOS has a SA_INTERRUPT flag. + */ + #ifdef HAVE_SIGACTION + # ifndef HAVE_SIGACTION_T + typedef struct sigaction sigaction_t; + # endif + # ifndef SA_INTERRUPT + # define SA_INTERRUPT 0 + # endif + # ifndef SA_RESTART + # define SA_RESTART 0 + # endif + #endif #endif /* _SUDO_COMPAT_H */