]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] add OS details to rndc status
authorEvan Hunt <each@isc.org>
Fri, 4 Mar 2016 06:02:52 +0000 (22:02 -0800)
committerEvan Hunt <each@isc.org>
Fri, 4 Mar 2016 06:02:52 +0000 (22:02 -0800)
4325. [func] Add a line to "rndc status" indicating the
hostname and operating system details. [RT #41610]

CHANGES
bin/named/server.c
bin/tests/system/rndc/tests.sh

diff --git a/CHANGES b/CHANGES
index 17d1535ae8497139ac0e0f3d56ec1e8ba1107237..34a3c3326846095f6907b27c68231f8376af61f7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4325.  [func]          Add a line to "rndc status" indicating the
+                       hostname and operating system details. [RT #41610]
+
 4324.  [bug]           When deleting records from a zone database, interior
                        nodes could be left empty but not deleted, damaging
                        search performance afterward. [RT #40997]
index 5a1a5ca983d55f565a31407f41a525dac9ea7e58..aec9712637b92472650e9a905afa892e84de54be 100644 (file)
@@ -8924,7 +8924,7 @@ ns_server_status(ns_server_t *server, isc_buffer_t **text) {
        const char *ob = "", *cb = "", *alt = "";
        char boottime[ISC_FORMATHTTPTIMESTAMP_SIZE];
        char configtime[ISC_FORMATHTTPTIMESTAMP_SIZE];
-       char line[1024];
+       char line[1024], hostname[256];
 
        if (ns_g_server->version_set) {
                ob = " (";
@@ -8955,6 +8955,13 @@ ns_server_status(ns_server_t *server, isc_buffer_t **text) {
                 ns_g_description, ns_g_srcid, ob, alt, cb);
        CHECK(putstr(text, line));
 
+       result = ns_os_gethostname(hostname, sizeof(hostname));
+       if (result != ISC_R_SUCCESS)
+               strlcpy(hostname, "localhost", sizeof(hostname));
+       snprintf(line, sizeof(line), "running on %s: %s\n",
+                hostname, ns_os_uname());
+       CHECK(putstr(text, line));
+
        snprintf(line, sizeof(line), "boot time: %s\n", boottime);
        CHECK(putstr(text, line));
 
index c001ec4dd6836da6888e9f1894ae096383600ac0..21209885a230dc212d0d294955312c1ab0c9d380 100644 (file)
@@ -441,4 +441,11 @@ $RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf reconfig > /dev/null 2>&1 && r
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
+echo "I:test rndc status shows running on"
+ret=0
+$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf status > rndc.output /dev/null 2>&1 || ret=1
+grep "^running on " rndc.output > /dev/null || ret=1
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
 exit $status