]> granicus.if.org Git - sudo/commitdiff
added patches from John_Rouillard
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 3 Dec 1993 02:35:16 +0000 (02:35 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 3 Dec 1993 02:35:16 +0000 (02:35 +0000)
directory spec
uses EDITOR

check.c
find_path.c
parse.c
sudo.c

diff --git a/check.c b/check.c
index 16c55bb73e8838d982f31c3be63b8597022f62dc..3751a23020a04c7f149117bab6f4ecc9af19a3c8 100644 (file)
--- a/check.c
+++ b/check.c
@@ -41,7 +41,9 @@ static char rcsid[] = "$Id$";
 
 #include <stdio.h>
 #include <string.h>
+#ifndef STD_HEADERS
 #include <strings.h>
+#endif /* !STD_HEADERS */
 #include <fcntl.h>
 #include <sys/param.h>
 #include <sys/types.h>
index 2a652f48b2066bd6e9ec0c4b48ec4d77bff1ac5d..7711c77ccfc186eff5049ec05ba920de4390a01c 100644 (file)
@@ -51,8 +51,10 @@ static char rcsid[] = "$Id$";
 #include <stdio.h>
 #ifdef STD_HEADERS
 #include <stdlib.h>
-#endif /* STD_HEADERS */
+#else
 #include <strings.h>
+#endif /* STD_HEADERS */
+#include <string.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/param.h>
diff --git a/parse.c b/parse.c
index b100a9373eecaa51ce05e52d767f4b5615603208..4159ceb11cb7175f6bc24ff55ee157bc9e572b8c 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -39,7 +39,7 @@ static char rcsid[] = "$Id$";
 #endif /* lint */
 
 #include <stdio.h>
-#include <strings.h>
+#include <string.h>
 #include <ctype.h>
 #include <sys/param.h>
 #include <sys/types.h>
@@ -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 64e75c1e29ce8eda54e1b27b21d12948dccab87b..d617cdb4d2d9369f8e36f771ad746cfc12355ca1 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -64,7 +64,6 @@ static char rcsid[] = "$Id$";
 #endif /* !NeXT */
 #endif /* STD_HEADERS */
 #include <string.h>
-#include <strings.h>
 #include <pwd.h>
 #include <netdb.h>
 #include <sys/param.h>
@@ -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;