version 1.8, 2002/04/25 15:49:03 |
version 1.9, 2003/03/15 21:23:54 |
|
|
/* |
/* |
* Copyright (c) 1996, 1998-2002 Todd C. Miller <Todd.Miller@courtesan.com> |
* Copyright (c) 1996, 1998-2003 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. |
|
|
#endif /* HAVE_FNMATCH */ |
#endif /* HAVE_FNMATCH */ |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: parse.c,v 1.137 2002/03/16 00:44:47 millert Exp $"; |
static const char rcsid[] = "$Sudo: parse.c,v 1.140 2003/03/15 20:31:02 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
/* |
/* |
|
|
int nopass; |
int nopass; |
|
|
/* Become sudoers file owner */ |
/* Become sudoers file owner */ |
set_perms(PERM_SUDOERS, 0); |
set_perms(PERM_SUDOERS); |
|
|
/* We opened _PATH_SUDOERS in check_sudoers() so just rewind it. */ |
/* We opened _PATH_SUDOERS in check_sudoers() so just rewind it. */ |
rewind(sudoers_fp); |
rewind(sudoers_fp); |
|
|
keepall = TRUE; |
keepall = TRUE; |
|
|
/* Need to be root while stat'ing things in the parser. */ |
/* Need to be root while stat'ing things in the parser. */ |
set_perms(PERM_ROOT, 0); |
set_perms(PERM_ROOT); |
error = yyparse(); |
error = yyparse(); |
|
|
/* Close the sudoers file now that we are done with it. */ |
/* Close the sudoers file now that we are done with it. */ |
|
|
|
|
while ((dent = readdir(dirp)) != NULL) { |
while ((dent = readdir(dirp)) != NULL) { |
/* ignore paths > MAXPATHLEN (XXX - log) */ |
/* ignore paths > MAXPATHLEN (XXX - log) */ |
if (plen + NAMLEN(dent) >= sizeof(buf)) |
if (strlcpy(buf, path, sizeof(buf)) >= sizeof(buf) || |
|
strlcat(buf, dent->d_name, sizeof(buf)) >= sizeof(buf)) |
continue; |
continue; |
strcpy(buf, path); |
|
strcat(buf, dent->d_name); |
|
|
|
/* only stat if basenames are the same */ |
/* only stat if basenames are the same */ |
if (strcmp(cmnd_base, dent->d_name) != 0 || stat(buf, &pst) == -1) |
if (strcmp(cmnd_base, dent->d_name) != 0 || stat(buf, &pst) == -1) |