Annotation of embedaddon/sudo/src/sudo_noexec.c, revision 1.1.1.4

1.1       misho       1: /*
1.1.1.4 ! misho       2:  * Copyright (c) 2004-2005, 2010-2012 Todd C. Miller <Todd.Miller@courtesan.com>
1.1       misho       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: 
                     17: #include <config.h>
                     18: 
                     19: #include <sys/types.h>
                     20: 
                     21: #include <errno.h>
                     22: #include <stdarg.h>
1.1.1.2   misho      23: #ifdef HAVE_SPAWN_H
                     24: #include <spawn.h>
                     25: #endif
1.1       misho      26: 
                     27: #include "missing.h"
                     28: 
                     29: /*
                     30:  * Dummy versions of the execve() family of syscalls.  We don't need
                     31:  * to stub out all of them, just the ones that correspond to actual
                     32:  * system calls (which varies by OS).  Note that it is still possible
                     33:  * to access the real syscalls via the syscall() interface but very
                     34:  * few programs actually do that.
                     35:  */
                     36: 
                     37: #define DUMMY_BODY                             \
                     38: {                                              \
                     39:     errno = EACCES;                            \
                     40:     return -1;                                 \
                     41: }
                     42: 
                     43: #define DUMMY2(fn, t1, t2)                     \
1.1.1.3   misho      44: __dso_public int                               \
1.1       misho      45: fn(t1 a1, t2 a2)                               \
                     46: DUMMY_BODY
                     47: 
                     48: #define DUMMY3(fn, t1, t2, t3)                 \
1.1.1.3   misho      49: __dso_public int                               \
1.1       misho      50: fn(t1 a1, t2 a2, t3 a3)                                \
                     51: DUMMY_BODY
                     52: 
1.1.1.2   misho      53: #define DUMMY6(fn, t1, t2, t3, t4, t5, t6)     \
1.1.1.3   misho      54: __dso_public int                               \
1.1.1.2   misho      55: fn(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6)   \
                     56: DUMMY_BODY
                     57: 
1.1       misho      58: #define DUMMY_VA(fn, t1, t2)                   \
1.1.1.3   misho      59: __dso_public int                               \
1.1       misho      60: fn(t1 a1, t2 a2, ...)                          \
                     61: DUMMY_BODY
                     62: 
                     63: DUMMY_VA(execl, const char *, const char *)
                     64: DUMMY_VA(_execl, const char *, const char *)
                     65: DUMMY_VA(__execl, const char *, const char *)
                     66: DUMMY_VA(execle, const char *, const char *)
                     67: DUMMY_VA(_execle, const char *, const char *)
                     68: DUMMY_VA(__execle, const char *, const char *)
                     69: DUMMY_VA(execlp, const char *, const char *)
                     70: DUMMY_VA(_execlp, const char *, const char *)
                     71: DUMMY_VA(__execlp, const char *, const char *)
1.1.1.2   misho      72: DUMMY3(exect, const char *, char * const *, char * const *)
                     73: DUMMY3(_exect, const char *, char * const *, char * const *)
                     74: DUMMY3(__exect, const char *, char * const *, char * const *)
1.1       misho      75: DUMMY2(execv, const char *, char * const *)
                     76: DUMMY2(_execv, const char *, char * const *)
                     77: DUMMY2(__execv, const char *, char * const *)
                     78: DUMMY2(execvp, const char *, char * const *)
                     79: DUMMY2(_execvp, const char *, char * const *)
                     80: DUMMY2(__execvp, const char *, char * const *)
                     81: DUMMY3(execvP, const char *, const char *, char * const *)
                     82: DUMMY3(_execvP, const char *, const char *, char * const *)
                     83: DUMMY3(__execvP, const char *, const char *, char * const *)
                     84: DUMMY3(execve, const char *, char * const *, char * const *)
                     85: DUMMY3(_execve, const char *, char * const *, char * const *)
                     86: DUMMY3(__execve, const char *, char * const *, char * const *)
1.1.1.2   misho      87: DUMMY3(execvpe, const char *, char * const *, char * const *)
                     88: DUMMY3(_execvpe, const char *, char * const *, char * const *)
                     89: DUMMY3(__execvpe, const char *, char * const *, char * const *)
1.1       misho      90: DUMMY3(fexecve, int , char * const *, char * const *)
                     91: DUMMY3(_fexecve, int , char * const *, char * const *)
                     92: DUMMY3(__fexecve, int , char * const *, char * const *)
1.1.1.2   misho      93: #ifdef HAVE_SPAWN_H
                     94: DUMMY6(posix_spawn, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
                     95: DUMMY6(_posix_spawn, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
                     96: DUMMY6(__posix_spawn, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
                     97: DUMMY6(posix_spawnp, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
                     98: DUMMY6(_posix_spawnp, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
                     99: DUMMY6(__posix_spawnp, pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *)
                    100: #endif /* HAVE_SPAWN_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>