cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] ccvs/src ChangeLog parseinfo.c


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src ChangeLog parseinfo.c
Date: Tue, 04 Aug 2009 11:03:29 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     09/08/04 11:03:29

Modified files:
        src            : ChangeLog parseinfo.c 

Log message:
        * parseinfo.c (parse_config): Find alternate config files correctly.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&r1=1.3641&r2=1.3642
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/parseinfo.c?cvsroot=cvs&r1=1.97&r2=1.98

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.3641
retrieving revision 1.3642
diff -u -b -r1.3641 -r1.3642
--- ChangeLog   19 Jul 2009 04:07:30 -0000      1.3641
+++ ChangeLog   4 Aug 2009 11:03:28 -0000       1.3642
@@ -1,3 +1,7 @@
+2009-08-03  Derek R. Price  <address@hidden>
+
+       * parseinfo.c (parse_config): Find alternate config files correctly.
+
 2009-07-18  Derek R. Price  <address@hidden>
 
        * subr.c (sleep_past): Don't assume that time() called after

Index: parseinfo.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/parseinfo.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- parseinfo.c 2 Dec 2008 19:34:00 -0000       1.97
+++ parseinfo.c 4 Aug 2009 11:03:28 -0000       1.98
@@ -19,6 +19,9 @@
 /* Verify interface.  */
 #include "parseinfo.h"
 
+/* GNULIB includes.  */
+#include "quote.h"
+
 /* CVS includes.  */
 #include "history.h"
 #include "logmsg.h"
@@ -441,13 +444,33 @@
        {
            char *nprefix;
 
+           /* Allowed prefix == "/" is a special case.  */
+           if (STREQ (*prefix, "/")) {
+               approved = true;
+               break;
+           }
+
            if (!isreadable (*prefix)) continue;
            nprefix = xcanonicalize_file_name (*prefix);
-           if (STRNEQ (nprefix, npath, strlen (nprefix))
-               && (((*prefix)[strlen (*prefix)] != '/'
-                    && strlen (npath) == strlen (nprefix))
-                   || ((*prefix)[strlen (*prefix)] == '/'
-                       && npath[strlen (nprefix)] == '/')))
+           if (/* Strings equal to length of allowed prefix.  */
+               STRNEQ (nprefix, npath, strlen (nprefix))
+               && (   /* The allowed prefix specifies a file (it does not have
+                       * a trailing slash).
+                       */
+                      (*prefix)[strlen (*prefix) - 1] != '/'
+                      /* ...and has the same length as the user specified file
+                       * (which means it is an exact match since it matched to
+                       * the length of nprefix, above).
+                       */
+                      && strlen (npath) == strlen (nprefix)
+                   || /* The allowed prefix specifies a directory (it has a
+                       * trailing slash).
+                       */
+                      (*prefix)[strlen (*prefix) - 1] == '/'
+                      /* ...and the user specified path is under the tree
+                       * specified by prefix.
+                       */
+                      && npath[strlen (nprefix)] == '/'))
                approved = true;
            free (nprefix);
            if (approved) break;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]