version 1.1, 2004/09/28 15:10:51 |
version 1.2, 2005/05/31 21:13:43 |
|
|
/* |
/* |
* Copyright (c) 2004 Todd C. Miller <Todd.Miller@courtesan.com> |
* Copyright (c) 2004-2005 Todd C. Miller <Todd.Miller@courtesan.com> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
|
|
#include "config.h" |
#include "config.h" |
|
|
#include <errno.h> |
#include <errno.h> |
|
#ifdef __STDC__ |
|
# include <stdarg.h> |
|
#else |
|
# include <varargs.h> |
|
#endif |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: sudo_noexec.c,v 1.5 2004/02/13 21:36:43 millert Exp $"; |
static const char rcsid[] = "$Sudo: sudo_noexec.c,v 1.11 2005/03/10 15:09:28 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
/* |
/* |
|
|
extern int errno; |
extern int errno; |
#endif |
#endif |
|
|
#define DUMMY(fn, args, atypes) \ |
#define DUMMY_BODY \ |
int \ |
{ \ |
fn args \ |
errno = EACCES; \ |
atypes \ |
return(-1); \ |
{ \ |
|
errno = EACCES; \ |
|
return(-1); \ |
|
} |
} |
|
|
DUMMY(execve, (path, argv, envp), |
#ifdef __STDC__ |
const char *path; char *const argv[]; char *const envp[];) |
|
DUMMY(_execve, (path, argv, envp), |
#define DUMMY2(fn, t1, t2) \ |
const char *path; char *const argv[]; char *const envp[];) |
int \ |
DUMMY(execv, (path, argv, envp), |
fn(t1 a1, t2 a2) \ |
const char *path; char *const argv[];) |
DUMMY_BODY |
DUMMY(_execv, (path, argv, envp), |
|
const char *path; char *const argv[];) |
#define DUMMY3(fn, t1, t2, t3) \ |
DUMMY(fexecve, (fd, argv, envp), |
int \ |
int fd; char *const argv[]; char *const envp[];) |
fn(t1 a1, t2 a2, t3 a3) \ |
DUMMY(_fexecve, (fd, argv, envp), |
DUMMY_BODY |
int fd; char *const argv[]; char *const envp[];) |
|
|
#define DUMMY_VA(fn, t1, t2) \ |
|
int \ |
|
fn(t1 a1, t2 a2, ...) \ |
|
DUMMY_BODY |
|
|
|
#else /* !__STDC__ */ |
|
|
|
#define DUMMY2(fn, t1, t2) \ |
|
int \ |
|
fn(a1, a2) \ |
|
t1 a1; t2 a2; \ |
|
DUMMY_BODY |
|
|
|
#define DUMMY3(fn, t1, t2, t3) \ |
|
int \ |
|
fn(a1, a2, a3) \ |
|
t1 a1; t2 a2; t3 a3; \ |
|
DUMMY_BODY |
|
|
|
#define DUMMY_VA(fn, t1, t2) \ |
|
int \ |
|
fn(a1, a2, va_alist) \ |
|
t1 a1; t2 a2; va_dcl \ |
|
DUMMY_BODY |
|
|
|
#endif /* !__STDC__ */ |
|
|
|
DUMMY_VA(execl, const char *, const char *) |
|
DUMMY_VA(_execl, const char *, const char *) |
|
DUMMY_VA(__execl, const char *, const char *) |
|
DUMMY_VA(execle, const char *, const char *) |
|
DUMMY_VA(_execle, const char *, const char *) |
|
DUMMY_VA(__execle, const char *, const char *) |
|
DUMMY_VA(execlp, const char *, const char *) |
|
DUMMY_VA(_execlp, const char *, const char *) |
|
DUMMY_VA(__execlp, const char *, const char *) |
|
DUMMY2(execv, const char *, char * const *) |
|
DUMMY2(_execv, const char *, char * const *) |
|
DUMMY2(__execv, const char *, char * const *) |
|
DUMMY2(execvp, const char *, char * const *) |
|
DUMMY2(_execvp, const char *, char * const *) |
|
DUMMY2(__execvp, const char *, char * const *) |
|
DUMMY3(execvP, const char *, const char *, char * const *) |
|
DUMMY3(_execvP, const char *, const char *, char * const *) |
|
DUMMY3(__execvP, const char *, const char *, char * const *) |
|
DUMMY3(execve, const char *, char * const *, char * const *) |
|
DUMMY3(_execve, const char *, char * const *, char * const *) |
|
DUMMY3(__execve, const char *, char * const *, char * const *) |
|
DUMMY3(fexecve, int , char * const *, char * const *) |
|
DUMMY3(_fexecve, int , char * const *, char * const *) |
|
DUMMY3(__fexecve, int , char * const *, char * const *) |