version 1.8, 2003/04/01 15:47:51 |
version 1.9, 2003/04/03 19:15:34 |
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
*/ |
|
|
|
#define _SUDO_MAIN |
|
|
#include "config.h" |
#include "config.h" |
|
|
#include <sys/param.h> |
#include <sys/param.h> |
|
|
#endif /* HAVE_UNISTD_H */ |
#endif /* HAVE_UNISTD_H */ |
#ifdef HAVE_FNMATCH |
#ifdef HAVE_FNMATCH |
# include <fnmatch.h> |
# include <fnmatch.h> |
#endif /* HAVE_FNMATCH_H */ |
#endif /* HAVE_FNMATCH */ |
#ifdef HAVE_NETGROUP_H |
#ifdef HAVE_NETGROUP_H |
# include <netgroup.h> |
# include <netgroup.h> |
#endif /* HAVE_NETGROUP_H */ |
#endif /* HAVE_NETGROUP_H */ |
|
#ifdef HAVE_ERR_H |
|
# include <err.h> |
|
#else |
|
# include "emul/err.h" |
|
#endif /* HAVE_ERR_H */ |
#include <ctype.h> |
#include <ctype.h> |
#include <pwd.h> |
#include <pwd.h> |
#include <grp.h> |
#include <grp.h> |
|
|
#endif /* HAVE_FNMATCH */ |
#endif /* HAVE_FNMATCH */ |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: testsudoers.c,v 1.80 2003/04/01 15:02:49 millert Exp $"; |
static const char rcsid[] = "$Sudo: testsudoers.c,v 1.81 2003/04/02 18:25:19 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
|
|
|
|
/* |
/* |
* Globals |
* Globals |
*/ |
*/ |
char **Argv, **NewArgv; |
|
int Argc, NewArgc; |
int Argc, NewArgc; |
|
char **Argv, **NewArgv; |
int parse_error = FALSE; |
int parse_error = FALSE; |
int num_interfaces; |
int num_interfaces; |
struct interface *interfaces; |
struct interface *interfaces; |
struct sudo_user sudo_user; |
struct sudo_user sudo_user; |
void (*set_perms) __P((int)) = set_perms_dummy; |
|
extern int clearaliases; |
extern int clearaliases; |
extern int pedantic; |
extern int pedantic; |
|
void (*set_perms) __P((int)) = set_perms_dummy; |
|
|
/* |
/* |
* Returns TRUE if "s" has shell meta characters in it, |
* Returns TRUE if "s" has shell meta characters in it, |
|
|
NewArgc = Argc - 3; |
NewArgc = Argc - 3; |
} else { |
} else { |
(void) fprintf(stderr, |
(void) fprintf(stderr, |
"usage: %s [-u user] <user> <host> <command> [args]\n", Argv[0]); |
"usage: sudo [-u user] <user> <host> <command> [args]\n"); |
exit(1); |
exit(1); |
} |
} |
|
|
|
|
user_args = (char *) emalloc(size); |
user_args = (char *) emalloc(size); |
for (to = user_args, from = NewArgv + 1; *from; from++) { |
for (to = user_args, from = NewArgv + 1; *from; from++) { |
n = strlcpy(to, *from, size - (to - user_args)); |
n = strlcpy(to, *from, size - (to - user_args)); |
if (n >= size - (to - user_args)) { |
if (n >= size - (to - user_args)) |
(void) fprintf(stderr, |
errx(1, "internal error, init_vars() overflow"); |
"%s: internal error, init_vars() overflow\n", Argv[0]); |
|
exit(1); |
|
} |
|
to += n; |
to += n; |
*to++ = ' '; |
*to++ = ' '; |
} |
} |