]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2292. [bug] Log if the working directory is not writable.
authorMark Andrews <marka@isc.org>
Wed, 9 Jan 2008 04:48:33 +0000 (04:48 +0000)
committerMark Andrews <marka@isc.org>
Wed, 9 Jan 2008 04:48:33 +0000 (04:48 +0000)
                        [RT #17312]

2291.   [bug]           PR_SET_DUMPABLE may be set too late.  Also report
                        failure to set PR_SET_DUMPABLE. [RT #17312]

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

diff --git a/CHANGES b/CHANGES
index 6cabbd86d74abfdb74e222f30d663f8ff2ee9960..6701087549e8a86e080f4fedb3621a6b05f8a43d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+2292.  [bug]           Log if the working directory is not writable.
+                       [RT #17312]
+
+2291.   [bug]           PR_SET_DUMPABLE may be set too late.  Also report
+                       failure to set PR_SET_DUMPABLE. [RT #17312]
+
 2290.  [bug]           Let AD in the query signal that the client wants AD
                        set in the response. [RT #17301]
 
index 09496eacf38c093b2d8163101ad8682e85365cbf..86f7529881fedcb988322bfe759cd4e9cb1bd532 100644 (file)
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: server.c,v 1.495 2007/12/14 04:01:20 marka Exp $ */
+/* $Id: server.c,v 1.496 2008/01/09 04:48:33 marka Exp $ */
 
 /*! \file */
 
 #include <config.h>
 
 #include <stdlib.h>
+#include <unistd.h>
 
 #include <isc/app.h>
 #include <isc/base64.h>
@@ -2934,6 +2935,15 @@ load_configuration(const char *filename, ns_server_t *server,
        }
        CHECK(result);
 
+       /*
+        * Check that the working directory is writable.
+        */
+       if (access(".", W_OK) != 0) {
+               isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
+                             NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+                             "the working directory is not writable");
+       }
+
        /*
         * Check the validity of the configuration.
         */
index 206deba44f4b9a22dd68b741c82b35694248ad93..38652e12108434b88f632e1561d6afb65cb54428 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: os.c,v 1.79 2007/06/19 23:46:59 tbox Exp $ */
+/* $Id: os.c,v 1.80 2008/01/09 04:48:33 marka Exp $ */
 
 /*! \file */
 
@@ -496,15 +496,19 @@ ns_os_changeuser(void) {
                ns_main_earlyfatal("setuid(): %s", strbuf);
        }
 
-#if defined(HAVE_LINUX_CAPABILITY_H) && !defined(HAVE_LINUXTHREADS)
-       linux_minprivs();
-#endif
 #if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_DUMPABLE)
        /*
         * Restore the ability of named to drop core after the setuid()
         * call has disabled it.
         */
-       prctl(PR_SET_DUMPABLE,1,0,0,0);
+       if (prctl(PR_SET_DUMPABLE,1,0,0,0) < 0) {
+               isc__strerror(errno, strbuf, sizeof(strbuf));
+               ns_main_earlywarning("prctl(PR_SET_DUMPABLE) failed: %s",
+                                    strbuf);
+       }
+#endif
+#if defined(HAVE_LINUX_CAPABILITY_H) && !defined(HAVE_LINUXTHREADS)
+       linux_minprivs();
 #endif
 }