version 1.4, 2000/03/27 03:44:39 |
version 1.5, 2002/01/03 03:49:16 |
|
|
/* |
/* |
* Copyright (c) 1996, 1998-2000 Todd C. Miller <Todd.Miller@courtesan.com> |
* Copyright (c) 1996, 1998-2001 Todd C. Miller <Todd.Miller@courtesan.com> |
* All rights reserved. |
* All rights reserved. |
* |
* |
* This code is derived from software contributed by Chris Jepeway |
* This code is derived from software contributed by Chris Jepeway |
|
|
|
|
#include "config.h" |
#include "config.h" |
|
|
|
#include <sys/param.h> |
|
#include <sys/types.h> |
|
#include <sys/stat.h> |
|
#include <sys/socket.h> |
#include <stdio.h> |
#include <stdio.h> |
#ifdef STDC_HEADERS |
#ifdef STDC_HEADERS |
# include <stdlib.h> |
# include <stdlib.h> |
|
# include <stddef.h> |
|
#else |
|
# ifdef HAVE_STDLIB_H |
|
# include <stdlib.h> |
|
# endif |
#endif /* STDC_HEADERS */ |
#endif /* STDC_HEADERS */ |
#ifdef HAVE_UNISTD_H |
|
# include <unistd.h> |
|
#endif /* HAVE_UNISTD_H */ |
|
#ifdef HAVE_STRING_H |
#ifdef HAVE_STRING_H |
# include <string.h> |
# include <string.h> |
|
#else |
|
# ifdef HAVE_STRINGS_H |
|
# include <strings.h> |
|
# endif |
#endif /* HAVE_STRING_H */ |
#endif /* HAVE_STRING_H */ |
#ifdef HAVE_STRINGS_H |
#ifdef HAVE_UNISTD_H |
# include <strings.h> |
# include <unistd.h> |
#endif /* HAVE_STRINGS_H */ |
#endif /* HAVE_UNISTD_H */ |
#ifdef HAVE_FNMATCH |
#ifdef HAVE_FNMATCH |
# include <fnmatch.h> |
# include <fnmatch.h> |
#endif /* HAVE_FNMATCH_H */ |
#endif /* HAVE_FNMATCH_H */ |
|
|
#include <ctype.h> |
#include <ctype.h> |
#include <pwd.h> |
#include <pwd.h> |
#include <grp.h> |
#include <grp.h> |
#include <sys/param.h> |
|
#include <sys/types.h> |
|
#include <sys/socket.h> |
|
#include <netinet/in.h> |
#include <netinet/in.h> |
#include <arpa/inet.h> |
#include <arpa/inet.h> |
#include <netdb.h> |
#include <netdb.h> |
#include <sys/stat.h> |
|
#include <dirent.h> |
#include <dirent.h> |
|
|
#include "sudo.h" |
#include "sudo.h" |
|
|
#endif /* HAVE_FNMATCH */ |
#endif /* HAVE_FNMATCH */ |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: testsudoers.c,v 1.71 2000/03/23 04:38:22 millert Exp $"; |
static const char rcsid[] = "$Sudo: testsudoers.c,v 1.75 2001/12/15 02:27:17 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
|
|
/* |
/* |
|
* Prototypes |
|
*/ |
|
void init_parser __P((void)); |
|
void dumpaliases __P((void)); |
|
void set_perms_dummy __P((int, int)); |
|
|
|
/* |
* Globals |
* Globals |
*/ |
*/ |
char **Argv, **NewArgv; |
char **Argv, **NewArgv; |
|
|
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, int)) = set_perms_dummy; |
extern int clearaliases; |
extern int clearaliases; |
extern int pedantic; |
extern int pedantic; |
|
|
/* |
/* |
* Prototypes for external functions |
|
*/ |
|
void init_parser __P((void)); |
|
void dumpaliases __P((void)); |
|
|
|
/* |
|
* Returns TRUE if "s" has shell meta characters in it, |
* Returns TRUE if "s" has shell meta characters in it, |
* else returns FALSE. |
* else returns FALSE. |
*/ |
*/ |
|
|
addr.s_addr = inet_addr(n); |
addr.s_addr = inet_addr(n); |
if (strchr(m, '.')) |
if (strchr(m, '.')) |
mask.s_addr = inet_addr(m); |
mask.s_addr = inet_addr(m); |
else |
else { |
mask.s_addr = (1 << atoi(m)) - 1; /* XXX - better way? */ |
i = 32 - atoi(m); |
|
mask.s_addr = 0xffffffff; |
|
mask.s_addr >>= i; |
|
mask.s_addr <<= i; |
|
mask.s_addr = htonl(mask.s_addr); |
|
} |
*(m - 1) = '/'; |
*(m - 1) = '/'; |
|
|
for (i = 0; i < num_interfaces; i++) |
for (i = 0; i < num_interfaces; i++) |
|
|
} |
} |
|
|
void |
void |
set_perms(i, j) |
set_perms_dummy(i, j) |
int i, j; |
int i, j; |
{ |
{ |
return; |
return; |
|
|
|
|
void |
void |
set_fqdn() |
set_fqdn() |
|
{ |
|
return; |
|
} |
|
|
|
void |
|
init_envtables() |
{ |
{ |
return; |
return; |
} |
} |