[BACK]Return to sudo_noexec.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / sudo

Annotation of src/usr.bin/sudo/sudo_noexec.c, Revision 1.5

1.1       millert     1: /*
1.2       millert     2:  * Copyright (c) 2004-2005 Todd C. Miller <Todd.Miller@courtesan.com>
1.1       millert     3:  *
                      4:  * Permission to use, copy, modify, and distribute this software for any
                      5:  * purpose with or without fee is hereby granted, provided that the above
                      6:  * copyright notice and this permission notice appear in all copies.
                      7:  *
                      8:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                      9:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     10:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     11:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     12:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     13:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     14:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     15:  */
                     16:
1.3       millert    17: #include <config.h>
1.1       millert    18:
                     19: #include <errno.h>
1.3       millert    20: #ifndef HAVE_TIMESPEC
                     21: # include <time.h>
                     22: #endif
1.2       millert    23: #ifdef __STDC__
                     24: # include <stdarg.h>
                     25: #else
                     26: # include <varargs.h>
                     27: #endif
1.1       millert    28:
1.3       millert    29: #include <compat.h>
                     30:
1.1       millert    31: /*
                     32:  * Dummy versions of the execve() family of syscalls.  We don't need
                     33:  * to stub out all of them, just the ones that correspond to actual
                     34:  * system calls (which varies by OS).  Note that it is still possible
                     35:  * to access the real syscalls via the syscall() interface but very
                     36:  * few programs actually do that.
                     37:  */
                     38:
                     39: #ifndef errno
                     40: extern int errno;
                     41: #endif
                     42:
1.2       millert    43: #define DUMMY_BODY                             \
                     44: {                                              \
                     45:     errno = EACCES;                            \
                     46:     return(-1);                                        \
1.1       millert    47: }
                     48:
1.2       millert    49: #ifdef __STDC__
                     50:
                     51: #define DUMMY2(fn, t1, t2)                     \
                     52: int                                            \
                     53: fn(t1 a1, t2 a2)                               \
                     54: DUMMY_BODY
                     55:
                     56: #define DUMMY3(fn, t1, t2, t3)                 \
                     57: int                                            \
                     58: fn(t1 a1, t2 a2, t3 a3)                                \
                     59: DUMMY_BODY
                     60:
                     61: #define DUMMY_VA(fn, t1, t2)                   \
                     62: int                                            \
                     63: fn(t1 a1, t2 a2, ...)                          \
                     64: DUMMY_BODY
                     65:
                     66: #else /* !__STDC__ */
                     67:
                     68: #define DUMMY2(fn, t1, t2)                     \
                     69: int                                            \
                     70: fn(a1, a2)                                     \
                     71: t1 a1; t2 a2;                                  \
                     72: DUMMY_BODY
                     73:
                     74: #define DUMMY3(fn, t1, t2, t3)                 \
                     75: int                                            \
                     76: fn(a1, a2, a3)                                 \
                     77: t1 a1; t2 a2; t3 a3;                           \
                     78: DUMMY_BODY
                     79:
                     80: #define DUMMY_VA(fn, t1, t2)                   \
                     81: int                                            \
                     82: fn(a1, a2, va_alist)                           \
                     83: t1 a1; t2 a2; va_dcl                           \
                     84: DUMMY_BODY
                     85:
                     86: #endif /* !__STDC__ */
                     87:
                     88: DUMMY_VA(execl, const char *, const char *)
                     89: DUMMY_VA(_execl, const char *, const char *)
                     90: DUMMY_VA(__execl, const char *, const char *)
                     91: DUMMY_VA(execle, const char *, const char *)
                     92: DUMMY_VA(_execle, const char *, const char *)
                     93: DUMMY_VA(__execle, const char *, const char *)
                     94: DUMMY_VA(execlp, const char *, const char *)
                     95: DUMMY_VA(_execlp, const char *, const char *)
                     96: DUMMY_VA(__execlp, const char *, const char *)
                     97: DUMMY2(execv, const char *, char * const *)
                     98: DUMMY2(_execv, const char *, char * const *)
                     99: DUMMY2(__execv, const char *, char * const *)
                    100: DUMMY2(execvp, const char *, char * const *)
                    101: DUMMY2(_execvp, const char *, char * const *)
                    102: DUMMY2(__execvp, const char *, char * const *)
                    103: DUMMY3(execvP, const char *, const char *, char * const *)
                    104: DUMMY3(_execvP, const char *, const char *, char * const *)
                    105: DUMMY3(__execvP, const char *, const char *, char * const *)
                    106: DUMMY3(execve, const char *, char * const *, char * const *)
                    107: DUMMY3(_execve, const char *, char * const *, char * const *)
                    108: DUMMY3(__execve, const char *, char * const *, char * const *)
                    109: DUMMY3(fexecve, int , char * const *, char * const *)
                    110: DUMMY3(_fexecve, int , char * const *, char * const *)
                    111: DUMMY3(__fexecve, int , char * const *, char * const *)