]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2631. [bug] Handle "//", "/./" and "/../" in mkdirpath().
authorMark Andrews <marka@isc.org>
Wed, 15 Jul 2009 00:36:37 +0000 (00:36 +0000)
committerMark Andrews <marka@isc.org>
Wed, 15 Jul 2009 00:36:37 +0000 (00:36 +0000)
                        [RT #19926 ]

CHANGES
bin/named/unix/os.c

diff --git a/CHANGES b/CHANGES
index 5371341d7b02155598965a976f229410ced57195..c0909acebb368bfff0f722f70d5fd37f17da6c21 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2631.  [bug]           Handle "//", "/./" and "/../" in mkdirpath().
+                       [RT #19926 ]
+
 2630.  [func]          Improved syntax for DDNS autoconfiguration:  use
                        "update-policy local;" to switch on local DDNS in a
                        zone.  [RT #19875]
index ec0dec3645002cad769707faa4cd9e1169c8a6a3..6b02e2640e547e305c9c7f38acaebb6bb6abb43f 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: os.c,v 1.98 2009/07/14 23:47:54 tbox Exp $ */
+/* $Id: os.c,v 1.99 2009/07/15 00:36:37 marka Exp $ */
 
 /*! \file */
 
@@ -692,6 +692,15 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
                        }
                        if (mkdirpath(filename, report) == -1)
                                goto error;
+                       /*
+                        * Handle "//", "/./" and "/../" in path.
+                        */
+                       if (!strcmp(slash + 1, "") ||
+                           !strcmp(slash + 1, ".") ||
+                           !strcmp(slash + 1, "..")) {
+                               *slash = '/';
+                               return (0);
+                       }
                        mode = S_IRUSR | S_IWUSR | S_IXUSR;     /* u=rwx */
                        mode |= S_IRGRP | S_IXGRP;              /* g=rx */
                        mode |= S_IROTH | S_IXOTH;              /* o=rx */