2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-03 15:55:40 +00:00

added patches from John_Rouillard

directory spec
	uses EDITOR
This commit is contained in:
Todd C. Miller
1993-12-03 02:35:16 +00:00
parent da4e410e9e
commit 62ea70cb3a
4 changed files with 35 additions and 4 deletions

View File

@@ -41,7 +41,9 @@ static char rcsid[] = "$Id$";
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef STD_HEADERS
#include <strings.h> #include <strings.h>
#endif /* !STD_HEADERS */
#include <fcntl.h> #include <fcntl.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>

View File

@@ -51,8 +51,10 @@ static char rcsid[] = "$Id$";
#include <stdio.h> #include <stdio.h>
#ifdef STD_HEADERS #ifdef STD_HEADERS
#include <stdlib.h> #include <stdlib.h>
#endif /* STD_HEADERS */ #else
#include <strings.h> #include <strings.h>
#endif /* STD_HEADERS */
#include <string.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>

29
parse.c
View File

@@ -39,7 +39,7 @@ static char rcsid[] = "$Id$";
#endif /* lint */ #endif /* lint */
#include <stdio.h> #include <stdio.h>
#include <strings.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
@@ -297,6 +297,20 @@ int cmnd_type_ok()
* of commands in something like: * of commands in something like:
* user machine=ALL,!/bin/rm,!/etc/named ... * 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 (strcmp(list_ptr[USER_LIST] -> data, cmnd) == 0) {
if (list_ptr[USER_LIST] -> op == '!') { if (list_ptr[USER_LIST] -> op == '!') {
return (QUIT_NOW); return (QUIT_NOW);
@@ -320,6 +334,19 @@ int cmnd_type_ok()
tmp_ptr = list_ptr[CMND_LIST]; tmp_ptr = list_ptr[CMND_LIST];
list_ptr[CMND_LIST] = tmp_ptr -> next; list_ptr[CMND_LIST] = tmp_ptr -> next;
while (next_type == TYPE3) { 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 (strcmp(list_ptr[CMND_LIST] -> data, cmnd) == 0) {
if (list_ptr[USER_LIST] -> op == '!') { if (list_ptr[USER_LIST] -> op == '!') {
list_ptr[CMND_LIST] = save_ptr; list_ptr[CMND_LIST] = save_ptr;

4
sudo.c
View File

@@ -64,7 +64,6 @@ static char rcsid[] = "$Id$";
#endif /* !NeXT */ #endif /* !NeXT */
#endif /* STD_HEADERS */ #endif /* STD_HEADERS */
#include <string.h> #include <string.h>
#include <strings.h>
#include <pwd.h> #include <pwd.h>
#include <netdb.h> #include <netdb.h>
#include <sys/param.h> #include <sys/param.h>
@@ -89,6 +88,8 @@ uid_t uid;
#endif #endif
static void usage();
/******************************************************************** /********************************************************************
* *
@@ -102,7 +103,6 @@ main(argc, argv, envp)
char **argv; char **argv;
char **envp; char **envp;
{ {
static void usage();
int rtn; int rtn;
Argv = argv; Argv = argv;