]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3450. [bug] Stop logfileconfig system test spam system logs.
authorMark Andrews <marka@isc.org>
Sat, 5 Jan 2013 20:56:10 +0000 (07:56 +1100)
committerMark Andrews <marka@isc.org>
Sat, 5 Jan 2013 20:56:10 +0000 (07:56 +1100)
                        [RT #32315]

Squashed commit of the following:

commit ad40744e2c7dc253b70857bb229def5dd194b418
Author: Mark Andrews <marka@isc.org>
Date:   Fri Jan 4 17:24:45 2013 +1100

    logfileconfig spams the system log files

CHANGES
bin/named/include/named/globals.h
bin/named/log.c
bin/named/logconf.c
bin/named/main.c
bin/tests/system/logfileconfig/tests.sh

diff --git a/CHANGES b/CHANGES
index 608b06d8011bbbde944dede453e1b4eb3a7b938f..e236b4277248870bf6c374d8185cc4e1ce8baf9e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3450.  [bug]           Stop logfileconfig system test spam system logs.
+                       [RT #32315]
+
 3449.  [bug]           gen.c: use the pre-processor to construct format
                        strings so that compiler can perform sanity checks;
                        check the snprintf results. [RT #17576]
index ed94ec60687c27df6369537199b84d812c6d25c9..6894f74cb338d4275be0f0220adb917fe3fc7953 100644 (file)
@@ -122,6 +122,7 @@ EXTERN isc_boolean_t                ns_g_coreok             INIT(ISC_TRUE);
 EXTERN const char *            ns_g_chrootdir          INIT(NULL);
 EXTERN isc_boolean_t           ns_g_foreground         INIT(ISC_FALSE);
 EXTERN isc_boolean_t           ns_g_logstderr          INIT(ISC_FALSE);
+EXTERN isc_boolean_t           ns_g_nosyslog           INIT(ISC_FALSE);
 
 EXTERN const char *            ns_g_defaultsessionkeyfile
                                        INIT(NS_LOCALSTATEDIR "/run/named/"
index 5d19dcb205c6e3569ffd9b9a87cec3594d1879c1..20b01bbe461592ba8c1e9468753f2c96720c60c9 100644 (file)
@@ -201,7 +201,7 @@ isc_result_t
 ns_log_setdefaultcategory(isc_logconfig_t *lcfg) {
        isc_result_t result;
 
-       if (! ns_g_logstderr) {
+       if (! ns_g_logstderr && ! ns_g_nosyslog) {
                result = isc_log_usechannel(lcfg, "default_syslog",
                                            ISC_LOGCATEGORY_DEFAULT, NULL);
                if (result != ISC_R_SUCCESS)
index eb8b2d3371e60d94befa13d250787ef659c6afdc..46d0c993361b5355b6b74d07f3876cffeb413fc9 100644 (file)
@@ -246,14 +246,16 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *lctx) {
                                        isc_result_totext(result));
                        } else
                                (void)isc_stdio_close(fp);
-               } else {
-                       syslog(LOG_ERR, "isc_file_isplainfile '%s' failed: %s",
-                               dest.file.name, isc_result_totext(result));
-                       fprintf(stderr, "isc_file_isplainfile '%s' failed: %s",
-                               dest.file.name, isc_result_totext(result));
+                       goto done;
                }
+               if (!ns_g_nosyslog)
+                       syslog(LOG_ERR, "isc_file_isplainfile '%s' failed: %s",
+                              dest.file.name, isc_result_totext(result));
+               fprintf(stderr, "isc_file_isplainfile '%s' failed: %s",
+                       dest.file.name, isc_result_totext(result));
        }
 
+ done:
        return (result);
 }
 
index 07ac9bc6cc43a2fc949d65eab916cb88e9a6be05..843b1e19427af37c5c8810e1f9385fbf76ce0bfc 100644 (file)
@@ -535,6 +535,8 @@ parse_command_line(int argc, char *argv[]) {
                        else if (!strncmp(isc_commandline_argument,
                                          "delay=", 6))
                                ns_g_delay = atoi(isc_commandline_argument + 6);
+                       else if (!strcmp(isc_commandline_argument, "nosyslog"))
+                               ns_g_nosyslog = ISC_TRUE;
                        else
                                fprintf(stderr, "unknown -T flag '%s\n",
                                        isc_commandline_argument);
index 85c7e845c60376453c9ccc51ab05f476dfbd1ec3..ac940c6f9b75a0ea9bf394d255ac40aef68725b1 100644 (file)
@@ -30,7 +30,7 @@ PIPEFILE="named_pipe"
 SYMFILE="named_sym"
 PIDFILE="${THISDIR}/${CONFDIR}/named.pid"
 myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf"
-myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -d 99 -U 4"
+myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -T nosyslog -d 99 -U 4"
 
 # Stop the server and run through a series of tests with various config
 # files while controlling the stop/start of the server.
@@ -76,7 +76,7 @@ then
        cp $DIRCONF named.conf
        echo > named.run
        $myRNDC reconfig
-       grep "invalid file" named.run > /dev/null 2>&1
+       grep "configuring logging: invalid file" named.run > /dev/null 2>&1
        if [ $? -ne 0 ]
        then
                echo "I: testing directory as file succeeded (UNEXPECTED)"
@@ -98,7 +98,7 @@ then
        cp $PIPECONF named.conf
        echo > named.run
        $myRNDC reconfig
-       grep "invalid file" named.run > /dev/null 2>&1
+       grep "configuring logging: invalid file" named.run  > /dev/null 2>&1
        if [ $? -ne 0 ]
        then
                echo "I: testing pipe file as log file succeeded (UNEXPECTED)"