]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2558. [func] Set the ownership of missing directories created
authorMark Andrews <marka@isc.org>
Mon, 16 Feb 2009 05:08:43 +0000 (05:08 +0000)
committerMark Andrews <marka@isc.org>
Mon, 16 Feb 2009 05:08:43 +0000 (05:08 +0000)
                        for pid-file if -u has been specified on the command
                        line. [RT #19328]

CHANGES
bin/named/server.c
bin/named/unix/os.c

diff --git a/CHANGES b/CHANGES
index c88747b02fc8489ca9167adc57971fd3dbc9cde9..64c178049f2930700d04f7642efcf9ea17228c52 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+2558.  [func]          Set the ownership of missing directories created
+                       for pid-file if -u has been specified on the command
+                       line. [RT #19328]
+
 2557.  [cleanup]       PCI compliance:
                        * new libisc log module file
                        * isc_dir_chroot() now also changes the working
index 2b3cf81dc86023fdbb3ef94b157a78439502019b..2abf165cba8a71fc986fa5c79a8d0ed985131fdd 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: server.c,v 1.527 2009/01/30 03:48:54 marka Exp $ */
+/* $Id: server.c,v 1.528 2009/02/16 05:08:43 marka Exp $ */
 
 /*! \file */
 
@@ -3589,6 +3589,17 @@ load_configuration(const char *filename, ns_server_t *server,
                }
        }
 
+       obj = NULL;
+       if (ns_config_get(maps, "pid-file", &obj) == ISC_R_SUCCESS)
+               if (cfg_obj_isvoid(obj))
+                       ns_os_writepidfile(NULL, first_time);
+               else
+                       ns_os_writepidfile(cfg_obj_asstring(obj), first_time);
+       else if (ns_g_lwresdonly)
+               ns_os_writepidfile(lwresd_g_defaultpidfile, first_time);
+       else
+               ns_os_writepidfile(ns_g_defaultpidfile, first_time);
+
        /*
         * Relinquish root privileges.
         */
@@ -3687,16 +3698,6 @@ load_configuration(const char *filename, ns_server_t *server,
                }
        }
 
-       obj = NULL;
-       if (ns_config_get(maps, "pid-file", &obj) == ISC_R_SUCCESS)
-               if (cfg_obj_isvoid(obj))
-                       ns_os_writepidfile(NULL, first_time);
-               else
-                       ns_os_writepidfile(cfg_obj_asstring(obj), first_time);
-       else if (ns_g_lwresdonly)
-               ns_os_writepidfile(lwresd_g_defaultpidfile, first_time);
-       else
-               ns_os_writepidfile(ns_g_defaultpidfile, first_time);
 
        obj = NULL;
        if (options != NULL &&
index 8619c71a5dc1b14bf164f32ce3036c5a90efc50b..bfb8340f26b9a5d6723983872cf59864bb46c245 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: os.c,v 1.92 2009/02/16 02:01:15 marka Exp $ */
+/* $Id: os.c,v 1.93 2009/02/16 05:08:43 marka Exp $ */
 
 /*! \file */
 
@@ -693,6 +693,13 @@ mkdirpath(char *filename, void (*report)(const char *, ...)) {
                                          strbuf);
                                goto error;
                        }
+                       if (runas_pw != NULL &&
+                           chown(filename, runas_pw->pw_uid,
+                                 runas_pw->pw_gid) == -1) {
+                               isc__strerror(errno, strbuf, sizeof(strbuf));
+                               (*report)("couldn't chown '%s': %s", filename,
+                                         strbuf);
+                       }
                }
                *slash = '/';
        }