From: Todd C. Miller Date: Fri, 3 Dec 1993 02:35:16 +0000 (+0000) Subject: added patches from John_Rouillard X-Git-Tag: SUDO_1_3_0~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62ea70cb3a2283d5adbaa8f080735ddbb4505352;p=sudo added patches from John_Rouillard directory spec uses EDITOR --- diff --git a/check.c b/check.c index 16c55bb73..3751a2302 100644 --- a/check.c +++ b/check.c @@ -41,7 +41,9 @@ static char rcsid[] = "$Id$"; #include #include +#ifndef STD_HEADERS #include +#endif /* !STD_HEADERS */ #include #include #include diff --git a/find_path.c b/find_path.c index 2a652f48b..7711c77cc 100644 --- a/find_path.c +++ b/find_path.c @@ -51,8 +51,10 @@ static char rcsid[] = "$Id$"; #include #ifdef STD_HEADERS #include -#endif /* STD_HEADERS */ +#else #include +#endif /* STD_HEADERS */ +#include #include #include #include diff --git a/parse.c b/parse.c index b100a9373..4159ceb11 100644 --- a/parse.c +++ b/parse.c @@ -39,7 +39,7 @@ static char rcsid[] = "$Id$"; #endif /* lint */ #include -#include +#include #include #include #include @@ -297,6 +297,20 @@ int cmnd_type_ok() * of commands in something like: * user machine=ALL,!/bin/rm,!/etc/named ... */ + + /* + * Check to see if a directory is being permitted + */ + if (list_ptr[USER_LIST]->data[strlen(list_ptr[USER_LIST]->data)-1] + == '/') { + /* we have a directory spec */ + if (strncmp(list_ptr[USER_LIST]->data, cmnd, + strlen(list_ptr[USER_LIST]->data)) == 0) + return(MATCH); + else + return(NO_MATCH); + } + if (strcmp(list_ptr[USER_LIST] -> data, cmnd) == 0) { if (list_ptr[USER_LIST] -> op == '!') { return (QUIT_NOW); @@ -320,6 +334,19 @@ int cmnd_type_ok() tmp_ptr = list_ptr[CMND_LIST]; list_ptr[CMND_LIST] = tmp_ptr -> next; while (next_type == TYPE3) { + /* + * Check to see if a directory is being permitted + */ + if (list_ptr[CMND_LIST]-> + data[strlen(list_ptr[CMND_LIST]->data)-1] == '/' ) { + /* we have a directory spec */ + if (strncmp(list_ptr[CMND_LIST]->data, cmnd, + strlen(list_ptr[CMND_LIST]->data)) == 0) + return(MATCH); + else + return(NO_MATCH); + } + if (strcmp(list_ptr[CMND_LIST] -> data, cmnd) == 0) { if (list_ptr[USER_LIST] -> op == '!') { list_ptr[CMND_LIST] = save_ptr; diff --git a/sudo.c b/sudo.c index 64e75c1e2..d617cdb4d 100644 --- a/sudo.c +++ b/sudo.c @@ -64,7 +64,6 @@ static char rcsid[] = "$Id$"; #endif /* !NeXT */ #endif /* STD_HEADERS */ #include -#include #include #include #include @@ -89,6 +88,8 @@ uid_t uid; #endif +static void usage(); + /******************************************************************** * @@ -102,7 +103,6 @@ main(argc, argv, envp) char **argv; char **envp; { - static void usage(); int rtn; Argv = argv;