aboutsummaryrefslogtreecommitdiffstats
path: root/ntpq
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2017-03-23 05:19:00 +0000
committerXin LI <delphij@FreeBSD.org>2017-03-23 05:19:00 +0000
commit07ac48c3644021279e113d530764a231e27490a7 (patch)
tree0cbc5ca54b66605faf74bfd0773111623cfe3d9b /ntpq
parent01b922f62c559f5778a983c365d390371956a214 (diff)
downloadsrc-07ac48c3644021279e113d530764a231e27490a7.tar.gz
src-07ac48c3644021279e113d530764a231e27490a7.zip
Vendor import of ntp-4.2.8p10.vendor/ntp/4.2.8p10
Notes
Notes: svn path=/vendor/ntp/dist/; revision=315791 svn path=/vendor/ntp/4.2.8p10/; revision=315792; tag=vendor/ntp/4.2.8p10
Diffstat (limited to 'ntpq')
-rw-r--r--ntpq/Makefile.am5
-rw-r--r--ntpq/Makefile.in17
-rw-r--r--ntpq/invoke-ntpq.texi4
-rw-r--r--ntpq/libntpq.c67
-rw-r--r--ntpq/ntpq-opts.c234
-rw-r--r--ntpq/ntpq-opts.h8
-rw-r--r--ntpq/ntpq-subs.c6
-rw-r--r--ntpq/ntpq.1ntpqman8
-rw-r--r--ntpq/ntpq.1ntpqmdoc6
-rw-r--r--ntpq/ntpq.c76
-rw-r--r--ntpq/ntpq.html4
-rw-r--r--ntpq/ntpq.man.in8
-rw-r--r--ntpq/ntpq.mdoc.in6
13 files changed, 237 insertions, 212 deletions
diff --git a/ntpq/Makefile.am b/ntpq/Makefile.am
index 50c072a0fd93..06018fc63aaa 100644
--- a/ntpq/Makefile.am
+++ b/ntpq/Makefile.am
@@ -6,12 +6,15 @@ libexec_PROGRAMS= $(NTPQ_DL)
sbin_PROGRAMS= $(NTPQ_DS)
AM_CFLAGS = $(CFLAGS_NTP)
+AM_CFLAGS += $(NTP_HARD_CFLAGS)
AM_CPPFLAGS = $(NTP_INCS)
AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
AM_CPPFLAGS += $(CPPFLAGS_NTP)
+AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
-AM_LDFLAGS = $(LDFLAGS_NTP)
+AM_LDFLAGS = $(LDFLAGS_NTP)
+AM_LDFLAGS += $(NTP_HARD_LDFLAGS)
# LDADD might need RESLIB and ADJLIB
ntpq_LDADD = version.o $(LIBOPTS_LDADD)
diff --git a/ntpq/Makefile.in b/ntpq/Makefile.in
index c93c677bbc9d..2bddc00d2dcb 100644
--- a/ntpq/Makefile.in
+++ b/ntpq/Makefile.in
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
$(top_srcdir)/sntp/m4/ntp_dir_sep.m4 \
$(top_srcdir)/sntp/m4/ntp_facilitynames.m4 \
$(top_srcdir)/sntp/m4/ntp_googletest.m4 \
+ $(top_srcdir)/sntp/m4/ntp_harden.m4 \
$(top_srcdir)/sntp/m4/ntp_ipv6.m4 \
$(top_srcdir)/sntp/m4/ntp_lib_m.m4 \
$(top_srcdir)/sntp/m4/ntp_libevent.m4 \
@@ -295,10 +296,6 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
CPPFLAGS_NTP = @CPPFLAGS_NTP@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DCFD = @DCFD@
DEFS = @DEFS@
@@ -351,6 +348,7 @@ LN_S = @LN_S@
LSCF = @LSCF@
LTHREAD_LIBS = @LTHREAD_LIBS@
LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MAKE_ADJTIMED = @MAKE_ADJTIMED@
MAKE_CHECK_LAYOUT = @MAKE_CHECK_LAYOUT@
@@ -414,6 +412,9 @@ NTPTRACE_DL = @NTPTRACE_DL@
NTPTRACE_DS = @NTPTRACE_DS@
NTPTRACE_MS = @NTPTRACE_MS@
NTPTRACE_NI = @NTPTRACE_NI@
+NTP_HARD_CFLAGS = @NTP_HARD_CFLAGS@
+NTP_HARD_CPPFLAGS = @NTP_HARD_CPPFLAGS@
+NTP_HARD_LDFLAGS = @NTP_HARD_LDFLAGS@
NTP_KEYGEN_DB = @NTP_KEYGEN_DB@
NTP_KEYGEN_DL = @NTP_KEYGEN_DL@
NTP_KEYGEN_DS = @NTP_KEYGEN_DS@
@@ -487,7 +488,6 @@ abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
@@ -539,9 +539,10 @@ NULL =
bin_PROGRAMS = $(NTPQ_DB)
libexec_PROGRAMS = $(NTPQ_DL)
sbin_PROGRAMS = $(NTPQ_DS)
-AM_CFLAGS = $(CFLAGS_NTP)
-AM_CPPFLAGS = $(NTP_INCS) $(LIBOPTS_CFLAGS) $(CPPFLAGS_NTP)
-AM_LDFLAGS = $(LDFLAGS_NTP)
+AM_CFLAGS = $(CFLAGS_NTP) $(NTP_HARD_CFLAGS)
+AM_CPPFLAGS = $(NTP_INCS) $(LIBOPTS_CFLAGS) $(CPPFLAGS_NTP) \
+ $(NTP_HARD_CPPFLAGS)
+AM_LDFLAGS = $(LDFLAGS_NTP) $(NTP_HARD_LDFLAGS)
# LDADD might need RESLIB and ADJLIB
ntpq_LDADD = version.o $(LIBOPTS_LDADD) ../libntp/libntp.a \
diff --git a/ntpq/invoke-ntpq.texi b/ntpq/invoke-ntpq.texi
index 4e37ff052611..3cee8683b9d5 100644
--- a/ntpq/invoke-ntpq.texi
+++ b/ntpq/invoke-ntpq.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpq.texi)
#
-# It has been AutoGen-ed November 21, 2016 at 08:03:06 AM by AutoGen 5.18.5
+# It has been AutoGen-ed March 21, 2017 at 10:45:28 AM by AutoGen 5.18.5
# From the definitions ntpq-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -848,7 +848,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpq - standard NTP query program - Ver. 4.2.8p9
+ntpq - standard NTP query program - Ver. 4.2.8p10-beta
Usage: ntpq [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/ntpq/libntpq.c b/ntpq/libntpq.c
index 3070e47b53c7..e7f02668a9ca 100644
--- a/ntpq/libntpq.c
+++ b/ntpq/libntpq.c
@@ -57,41 +57,44 @@ struct ntpq_varlist ntpq_varlist[MAXLIST];
int ntpq_stripquotes ( char *resultbuf, char *srcbuf, int datalen, int maxlen )
{
- char* tmpbuf = srcbuf;
-
- while ( *tmpbuf != 0 )
- {
- if ( *tmpbuf == '\"' )
- {
- tmpbuf++;
- continue;
- }
-
- if ( *tmpbuf == '\\' )
- {
- tmpbuf++;
- switch ( *tmpbuf )
- {
- /* ignore if end of string */
- case 0:
- continue;
+ char* dst = resultbuf;
+ char* dep = resultbuf + maxlen - 1;
+ char* src = srcbuf;
+ char* sep = srcbuf + (datalen >= 0 ? datalen : 0);
+ int esc = 0;
+ int ch;
+
+ if (maxlen <= 0)
+ return 0;
+
+ while ((dst != dep) && (src != sep) && (ch = (u_char)*src++) != 0) {
+ if (esc) {
+ esc = 0;
+ switch (ch) {
/* skip and do not copy */
- case '\"': /* quotes */
- case 'n': /*newline*/
- case 'r': /*carriage return*/
- case 'g': /*bell*/
- case 't': /*tab*/
- tmpbuf++;
- continue;
+ /* case '"':*/ /* quotes */
+ case 'n': /*newline*/
+ case 'r': /*carriage return*/
+ case 'g': /*bell*/
+ case 't': /*tab*/
+ continue;
+ default:
+ break;
}
- }
-
- *resultbuf++ = *tmpbuf++;
-
+ } else {
+ switch (ch) {
+ case '\\':
+ esc = 1;
+ case '"':
+ continue;
+ default:
+ break;
+ }
+ }
+ *dst++ = (char)ch;
}
-
- *resultbuf = 0;
- return strlen(resultbuf);
+ *dst = '\0';
+ return (int)(dst - resultbuf);
}
diff --git a/ntpq/ntpq-opts.c b/ntpq/ntpq-opts.c
index f63f81f735ce..b2f9431a5506 100644
--- a/ntpq/ntpq-opts.c
+++ b/ntpq/ntpq-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpq-opts.c)
*
- * It has been AutoGen-ed November 21, 2016 at 08:02:38 AM by AutoGen 5.18.5
+ * It has been AutoGen-ed March 21, 2017 at 10:45:05 AM by AutoGen 5.18.5
* From the definitions ntpq-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntpq program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.
+ * Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the NTP License, copies of which
* can be seen at:
@@ -50,7 +50,7 @@ extern "C" {
#endif
extern FILE * option_usage_fp;
#define zCopyright (ntpq_opt_strs+0)
-#define zLicenseDescrip (ntpq_opt_strs+340)
+#define zLicenseDescrip (ntpq_opt_strs+341)
/*
* global included definitions
@@ -68,15 +68,15 @@ extern FILE * option_usage_fp;
/**
* static const strings for ntpq options
*/
-static char const ntpq_opt_strs[1982] =
-/* 0 */ "ntpq 4.2.8p9\n"
- "Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n"
+static char const ntpq_opt_strs[1985] =
+/* 0 */ "ntpq 4.2.8p10\n"
+ "Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
"can be seen at:\n"
" <http://ntp.org/license>\n"
" <http://opensource.org/licenses/ntp-license.php>\n\0"
-/* 340 */ "Permission to use, copy, modify, and distribute this software and its\n"
+/* 341 */ "Permission to use, copy, modify, and distribute this software and its\n"
"documentation for any purpose with or without fee is hereby granted,\n"
"provided that the above copyright notice appears in all copies and that\n"
"both the copyright notice and this permission notice appear in supporting\n"
@@ -86,71 +86,71 @@ static char const ntpq_opt_strs[1982] =
"Time Foundation makes no representations about the suitability this\n"
"software for any purpose. It is provided \"as is\" without express or\n"
"implied warranty.\n\0"
-/* 1008 */ "Force IPv4 DNS name resolution\0"
-/* 1039 */ "IPV4\0"
-/* 1044 */ "ipv4\0"
-/* 1049 */ "Force IPv6 DNS name resolution\0"
-/* 1080 */ "IPV6\0"
-/* 1085 */ "ipv6\0"
-/* 1090 */ "run a command and exit\0"
-/* 1113 */ "COMMAND\0"
-/* 1121 */ "command\0"
-/* 1129 */ "Increase debug verbosity level\0"
-/* 1160 */ "DEBUG_LEVEL\0"
-/* 1172 */ "debug-level\0"
-/* 1184 */ "Set the debug verbosity level\0"
-/* 1214 */ "SET_DEBUG_LEVEL\0"
-/* 1230 */ "set-debug-level\0"
-/* 1246 */ "Force ntpq to operate in interactive mode\0"
-/* 1288 */ "INTERACTIVE\0"
-/* 1300 */ "interactive\0"
-/* 1312 */ "numeric host addresses\0"
-/* 1335 */ "NUMERIC\0"
-/* 1343 */ "numeric\0"
-/* 1351 */ "Always output status line with readvar\0"
-/* 1390 */ "OLD_RV\0"
-/* 1397 */ "old-rv\0"
-/* 1404 */ "Print a list of the peers\0"
-/* 1430 */ "PEERS\0"
-/* 1436 */ "peers\0"
-/* 1442 */ "Set default display type for S2+ refids\0"
-/* 1482 */ "REFID\0"
-/* 1488 */ "refid\0"
-/* 1494 */ "Display the full 'remote' value\0"
-/* 1526 */ "WIDE\0"
-/* 1531 */ "wide\0"
-/* 1536 */ "display extended usage information and exit\0"
-/* 1580 */ "help\0"
-/* 1585 */ "extended usage information passed thru pager\0"
-/* 1630 */ "more-help\0"
-/* 1640 */ "output version information and exit\0"
-/* 1676 */ "version\0"
-/* 1684 */ "save the option state to a config file\0"
-/* 1723 */ "save-opts\0"
-/* 1733 */ "load options from a config file\0"
-/* 1765 */ "LOAD_OPTS\0"
-/* 1775 */ "no-load-opts\0"
-/* 1788 */ "no\0"
-/* 1791 */ "NTPQ\0"
-/* 1796 */ "ntpq - standard NTP query program - Ver. 4.2.8p9\n"
+/* 1009 */ "Force IPv4 DNS name resolution\0"
+/* 1040 */ "IPV4\0"
+/* 1045 */ "ipv4\0"
+/* 1050 */ "Force IPv6 DNS name resolution\0"
+/* 1081 */ "IPV6\0"
+/* 1086 */ "ipv6\0"
+/* 1091 */ "run a command and exit\0"
+/* 1114 */ "COMMAND\0"
+/* 1122 */ "command\0"
+/* 1130 */ "Increase debug verbosity level\0"
+/* 1161 */ "DEBUG_LEVEL\0"
+/* 1173 */ "debug-level\0"
+/* 1185 */ "Set the debug verbosity level\0"
+/* 1215 */ "SET_DEBUG_LEVEL\0"
+/* 1231 */ "set-debug-level\0"
+/* 1247 */ "Force ntpq to operate in interactive mode\0"
+/* 1289 */ "INTERACTIVE\0"
+/* 1301 */ "interactive\0"
+/* 1313 */ "numeric host addresses\0"
+/* 1336 */ "NUMERIC\0"
+/* 1344 */ "numeric\0"
+/* 1352 */ "Always output status line with readvar\0"
+/* 1391 */ "OLD_RV\0"
+/* 1398 */ "old-rv\0"
+/* 1405 */ "Print a list of the peers\0"
+/* 1431 */ "PEERS\0"
+/* 1437 */ "peers\0"
+/* 1443 */ "Set default display type for S2+ refids\0"
+/* 1483 */ "REFID\0"
+/* 1489 */ "refid\0"
+/* 1495 */ "Display the full 'remote' value\0"
+/* 1527 */ "WIDE\0"
+/* 1532 */ "wide\0"
+/* 1537 */ "display extended usage information and exit\0"
+/* 1581 */ "help\0"
+/* 1586 */ "extended usage information passed thru pager\0"
+/* 1631 */ "more-help\0"
+/* 1641 */ "output version information and exit\0"
+/* 1677 */ "version\0"
+/* 1685 */ "save the option state to a config file\0"
+/* 1724 */ "save-opts\0"
+/* 1734 */ "load options from a config file\0"
+/* 1766 */ "LOAD_OPTS\0"
+/* 1776 */ "no-load-opts\0"
+/* 1789 */ "no\0"
+/* 1792 */ "NTPQ\0"
+/* 1797 */ "ntpq - standard NTP query program - Ver. 4.2.8p10\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
-/* 1915 */ "$HOME\0"
-/* 1921 */ ".\0"
-/* 1923 */ ".ntprc\0"
-/* 1930 */ "http://bugs.ntp.org, bugs@ntp.org\0"
-/* 1964 */ "ntpq 4.2.8p9\0"
-/* 1977 */ "hash";
+/* 1917 */ "$HOME\0"
+/* 1923 */ ".\0"
+/* 1925 */ ".ntprc\0"
+/* 1932 */ "http://bugs.ntp.org, bugs@ntp.org\0"
+/* 1966 */ "ntpq 4.2.8p10\0"
+/* 1980 */ "hash";
/**
* ipv4 option description with
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the ipv4 option */
-#define IPV4_DESC (ntpq_opt_strs+1008)
+#define IPV4_DESC (ntpq_opt_strs+1009)
/** Upper-cased name for the ipv4 option */
-#define IPV4_NAME (ntpq_opt_strs+1039)
+#define IPV4_NAME (ntpq_opt_strs+1040)
/** Name string for the ipv4 option */
-#define IPV4_name (ntpq_opt_strs+1044)
+#define IPV4_name (ntpq_opt_strs+1045)
/** Other options that appear in conjunction with the ipv4 option */
static int const aIpv4CantList[] = {
INDEX_OPT_IPV6, NO_EQUIVALENT };
@@ -162,11 +162,11 @@ static int const aIpv4CantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the ipv6 option */
-#define IPV6_DESC (ntpq_opt_strs+1049)
+#define IPV6_DESC (ntpq_opt_strs+1050)
/** Upper-cased name for the ipv6 option */
-#define IPV6_NAME (ntpq_opt_strs+1080)
+#define IPV6_NAME (ntpq_opt_strs+1081)
/** Name string for the ipv6 option */
-#define IPV6_name (ntpq_opt_strs+1085)
+#define IPV6_name (ntpq_opt_strs+1086)
/** Other options that appear in conjunction with the ipv6 option */
static int const aIpv6CantList[] = {
INDEX_OPT_IPV4, NO_EQUIVALENT };
@@ -177,11 +177,11 @@ static int const aIpv6CantList[] = {
* command option description:
*/
/** Descriptive text for the command option */
-#define COMMAND_DESC (ntpq_opt_strs+1090)
+#define COMMAND_DESC (ntpq_opt_strs+1091)
/** Upper-cased name for the command option */
-#define COMMAND_NAME (ntpq_opt_strs+1113)
+#define COMMAND_NAME (ntpq_opt_strs+1114)
/** Name string for the command option */
-#define COMMAND_name (ntpq_opt_strs+1121)
+#define COMMAND_name (ntpq_opt_strs+1122)
/** Compiled in flag settings for the command option */
#define COMMAND_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
@@ -190,11 +190,11 @@ static int const aIpv6CantList[] = {
* debug-level option description:
*/
/** Descriptive text for the debug-level option */
-#define DEBUG_LEVEL_DESC (ntpq_opt_strs+1129)
+#define DEBUG_LEVEL_DESC (ntpq_opt_strs+1130)
/** Upper-cased name for the debug-level option */
-#define DEBUG_LEVEL_NAME (ntpq_opt_strs+1160)
+#define DEBUG_LEVEL_NAME (ntpq_opt_strs+1161)
/** Name string for the debug-level option */
-#define DEBUG_LEVEL_name (ntpq_opt_strs+1172)
+#define DEBUG_LEVEL_name (ntpq_opt_strs+1173)
/** Compiled in flag settings for the debug-level option */
#define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
@@ -202,11 +202,11 @@ static int const aIpv6CantList[] = {
* set-debug-level option description:
*/
/** Descriptive text for the set-debug-level option */
-#define SET_DEBUG_LEVEL_DESC (ntpq_opt_strs+1184)
+#define SET_DEBUG_LEVEL_DESC (ntpq_opt_strs+1185)
/** Upper-cased name for the set-debug-level option */
-#define SET_DEBUG_LEVEL_NAME (ntpq_opt_strs+1214)
+#define SET_DEBUG_LEVEL_NAME (ntpq_opt_strs+1215)
/** Name string for the set-debug-level option */
-#define SET_DEBUG_LEVEL_name (ntpq_opt_strs+1230)
+#define SET_DEBUG_LEVEL_name (ntpq_opt_strs+1231)
/** Compiled in flag settings for the set-debug-level option */
#define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
| OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
@@ -216,11 +216,11 @@ static int const aIpv6CantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the interactive option */
-#define INTERACTIVE_DESC (ntpq_opt_strs+1246)
+#define INTERACTIVE_DESC (ntpq_opt_strs+1247)
/** Upper-cased name for the interactive option */
-#define INTERACTIVE_NAME (ntpq_opt_strs+1288)
+#define INTERACTIVE_NAME (ntpq_opt_strs+1289)
/** Name string for the interactive option */
-#define INTERACTIVE_name (ntpq_opt_strs+1300)
+#define INTERACTIVE_name (ntpq_opt_strs+1301)
/** Other options that appear in conjunction with the interactive option */
static int const aInteractiveCantList[] = {
INDEX_OPT_COMMAND,
@@ -232,11 +232,11 @@ static int const aInteractiveCantList[] = {
* numeric option description:
*/
/** Descriptive text for the numeric option */
-#define NUMERIC_DESC (ntpq_opt_strs+1312)
+#define NUMERIC_DESC (ntpq_opt_strs+1313)
/** Upper-cased name for the numeric option */
-#define NUMERIC_NAME (ntpq_opt_strs+1335)
+#define NUMERIC_NAME (ntpq_opt_strs+1336)
/** Name string for the numeric option */
-#define NUMERIC_name (ntpq_opt_strs+1343)
+#define NUMERIC_name (ntpq_opt_strs+1344)
/** Compiled in flag settings for the numeric option */
#define NUMERIC_FLAGS (OPTST_DISABLED)
@@ -244,11 +244,11 @@ static int const aInteractiveCantList[] = {
* old-rv option description:
*/
/** Descriptive text for the old-rv option */
-#define OLD_RV_DESC (ntpq_opt_strs+1351)
+#define OLD_RV_DESC (ntpq_opt_strs+1352)
/** Upper-cased name for the old-rv option */
-#define OLD_RV_NAME (ntpq_opt_strs+1390)
+#define OLD_RV_NAME (ntpq_opt_strs+1391)
/** Name string for the old-rv option */
-#define OLD_RV_name (ntpq_opt_strs+1397)
+#define OLD_RV_name (ntpq_opt_strs+1398)
/** Compiled in flag settings for the old-rv option */
#define OLD_RV_FLAGS (OPTST_DISABLED)
@@ -257,11 +257,11 @@ static int const aInteractiveCantList[] = {
* "Must also have options" and "Incompatible options":
*/
/** Descriptive text for the peers option */
-#define PEERS_DESC (ntpq_opt_strs+1404)
+#define PEERS_DESC (ntpq_opt_strs+1405)
/** Upper-cased name for the peers option */
-#define PEERS_NAME (ntpq_opt_strs+1430)
+#define PEERS_NAME (ntpq_opt_strs+1431)
/** Name string for the peers option */
-#define PEERS_name (ntpq_opt_strs+1436)
+#define PEERS_name (ntpq_opt_strs+1437)
/** Other options that appear in conjunction with the peers option */
static int const aPeersCantList[] = {
INDEX_OPT_INTERACTIVE, NO_EQUIVALENT };
@@ -272,11 +272,11 @@ static int const aPeersCantList[] = {
* refid option description:
*/
/** Descriptive text for the refid option */
-#define REFID_DESC (ntpq_opt_strs+1442)
+#define REFID_DESC (ntpq_opt_strs+1443)
/** Upper-cased name for the refid option */
-#define REFID_NAME (ntpq_opt_strs+1482)
+#define REFID_NAME (ntpq_opt_strs+1483)
/** Name string for the refid option */
-#define REFID_name (ntpq_opt_strs+1488)
+#define REFID_name (ntpq_opt_strs+1489)
/** The compiled in default value for the refid option argument */
#define REFID_DFT_ARG ((char const*)REFID_IPV4)
/** Compiled in flag settings for the refid option */
@@ -287,22 +287,22 @@ static int const aPeersCantList[] = {
* wide option description:
*/
/** Descriptive text for the wide option */
-#define WIDE_DESC (ntpq_opt_strs+1494)
+#define WIDE_DESC (ntpq_opt_strs+1495)
/** Upper-cased name for the wide option */
-#define WIDE_NAME (ntpq_opt_strs+1526)
+#define WIDE_NAME (ntpq_opt_strs+1527)
/** Name string for the wide option */
-#define WIDE_name (ntpq_opt_strs+1531)
+#define WIDE_name (ntpq_opt_strs+1532)
/** Compiled in flag settings for the wide option */
#define WIDE_FLAGS (OPTST_DISABLED)
/*
* Help/More_Help/Version option descriptions:
*/
-#define HELP_DESC (ntpq_opt_strs+1536)
-#define HELP_name (ntpq_opt_strs+1580)
+#define HELP_DESC (ntpq_opt_strs+1537)
+#define HELP_name (ntpq_opt_strs+1581)
#ifdef HAVE_WORKING_FORK
-#define MORE_HELP_DESC (ntpq_opt_strs+1585)
-#define MORE_HELP_name (ntpq_opt_strs+1630)
+#define MORE_HELP_DESC (ntpq_opt_strs+1586)
+#define MORE_HELP_name (ntpq_opt_strs+1631)
#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
#else
#define MORE_HELP_DESC HELP_DESC
@@ -315,14 +315,14 @@ static int const aPeersCantList[] = {
# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
#endif
-#define VER_DESC (ntpq_opt_strs+1640)
-#define VER_name (ntpq_opt_strs+1676)
-#define SAVE_OPTS_DESC (ntpq_opt_strs+1684)
-#define SAVE_OPTS_name (ntpq_opt_strs+1723)
-#define LOAD_OPTS_DESC (ntpq_opt_strs+1733)
-#define LOAD_OPTS_NAME (ntpq_opt_strs+1765)
-#define NO_LOAD_OPTS_name (ntpq_opt_strs+1775)
-#define LOAD_OPTS_pfx (ntpq_opt_strs+1788)
+#define VER_DESC (ntpq_opt_strs+1641)
+#define VER_name (ntpq_opt_strs+1677)
+#define SAVE_OPTS_DESC (ntpq_opt_strs+1685)
+#define SAVE_OPTS_name (ntpq_opt_strs+1724)
+#define LOAD_OPTS_DESC (ntpq_opt_strs+1734)
+#define LOAD_OPTS_NAME (ntpq_opt_strs+1766)
+#define NO_LOAD_OPTS_name (ntpq_opt_strs+1776)
+#define LOAD_OPTS_pfx (ntpq_opt_strs+1789)
#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)
/**
* Declare option callback procedures
@@ -543,24 +543,24 @@ static tOptDesc optDesc[OPTION_CT] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** Reference to the upper cased version of ntpq. */
-#define zPROGNAME (ntpq_opt_strs+1791)
+#define zPROGNAME (ntpq_opt_strs+1792)
/** Reference to the title line for ntpq usage. */
-#define zUsageTitle (ntpq_opt_strs+1796)
+#define zUsageTitle (ntpq_opt_strs+1797)
/** ntpq configuration file name. */
-#define zRcName (ntpq_opt_strs+1923)
+#define zRcName (ntpq_opt_strs+1925)
/** Directories to search for ntpq config files. */
static char const * const apzHomeList[3] = {
- ntpq_opt_strs+1915,
- ntpq_opt_strs+1921,
+ ntpq_opt_strs+1917,
+ ntpq_opt_strs+1923,
NULL };
/** The ntpq program bug email address. */
-#define zBugsAddr (ntpq_opt_strs+1930)
+#define zBugsAddr (ntpq_opt_strs+1932)
/** Clarification/explanation of what ntpq does. */
#define zExplain (NULL)
/** Extra detail explaining what ntpq does. */
#define zDetail (NULL)
/** The full version string for ntpq. */
-#define zFullVersion (ntpq_opt_strs+1964)
+#define zFullVersion (ntpq_opt_strs+1966)
/* extracted from optcode.tlib near line 364 */
#if defined(ENABLE_NLS)
@@ -633,7 +633,7 @@ doOptRefid(tOptions* pOptions, tOptDesc* pOptDesc)
/* extracted from optmain.tlib near line 945 */
static char const * const names[2] = {
- ntpq_opt_strs+1977, ntpq_opt_strs+1044 };
+ ntpq_opt_strs+1980, ntpq_opt_strs+1045 };
if (pOptions <= OPTPROC_EMIT_LIMIT) {
(void) optionEnumerationVal(pOptions, pOptDesc, names, 2);
@@ -841,8 +841,8 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpqOptions.pzCopyright */
- puts(_("ntpq 4.2.8p9\n\
-Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n\
+ puts(_("ntpq 4.2.8p10\n\
+Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
can be seen at:\n"));
@@ -910,11 +910,11 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpqOptions.pzUsageTitle */
- puts(_("ntpq - standard NTP query program - Ver. 4.2.8p9\n\
+ puts(_("ntpq - standard NTP query program - Ver. 4.2.8p10\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
/* referenced via ntpqOptions.pzFullVersion */
- puts(_("ntpq 4.2.8p9"));
+ puts(_("ntpq 4.2.8p10"));
/* referenced via ntpqOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/ntpq/ntpq-opts.h b/ntpq/ntpq-opts.h
index 1f2896fdfd23..60c4c2007632 100644
--- a/ntpq/ntpq-opts.h
+++ b/ntpq/ntpq-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpq-opts.h)
*
- * It has been AutoGen-ed November 21, 2016 at 08:02:38 AM by AutoGen 5.18.5
+ * It has been AutoGen-ed March 21, 2017 at 10:45:04 AM by AutoGen 5.18.5
* From the definitions ntpq-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntpq program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.
+ * Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the NTP License, copies of which
* can be seen at:
@@ -84,9 +84,9 @@ typedef enum {
/** count of all options for ntpq */
#define OPTION_CT 16
/** ntpq version */
-#define NTPQ_VERSION "4.2.8p9"
+#define NTPQ_VERSION "4.2.8p10"
/** Full ntpq version text */
-#define NTPQ_FULL_VERSION "ntpq 4.2.8p9"
+#define NTPQ_FULL_VERSION "ntpq 4.2.8p10"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/ntpq/ntpq-subs.c b/ntpq/ntpq-subs.c
index 35caee223281..08f9d426a4a4 100644
--- a/ntpq/ntpq-subs.c
+++ b/ntpq/ntpq-subs.c
@@ -3614,11 +3614,13 @@ reslist(
if (NULL == val) {
row.flagstr[0] = '\0';
comprende = TRUE;
- } else {
- len = strlen(val);
+ } else if ((len = strlen(val)) < sizeof(row.flagstr)) {
memcpy(row.flagstr, val, len);
row.flagstr[len] = '\0';
comprende = TRUE;
+ } else {
+ /* no flags, and still !comprende */
+ row.flagstr[0] = '\0';
}
}
break;
diff --git a/ntpq/ntpq.1ntpqman b/ntpq/ntpq.1ntpqman
index 22f14884fe42..05c801bc3b0e 100644
--- a/ntpq/ntpq.1ntpqman
+++ b/ntpq/ntpq.1ntpqman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpq 1ntpqman "21 Nov 2016" "4.2.8p9" "User Commands"
+.TH ntpq 1ntpqman "21 Mar 2017" "4.2.8p10" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-nWaWmk/ag-AWaOlk)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-P4aWgw/ag-p5aWew)
.\"
-.\" It has been AutoGen-ed November 21, 2016 at 08:03:02 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed March 21, 2017 at 10:45:26 AM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -1433,7 +1433,7 @@ it to autogen-users@lists.sourceforge.net. Thank you.
.SH "AUTHORS"
The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, <http://ntp.org/license>.
.SH "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpq/ntpq.1ntpqmdoc b/ntpq/ntpq.1ntpqmdoc
index 3039beaecaca..6badce05a8d9 100644
--- a/ntpq/ntpq.1ntpqmdoc
+++ b/ntpq/ntpq.1ntpqmdoc
@@ -1,9 +1,9 @@
-.Dd November 21 2016
+.Dd March 21 2017
.Dt NTPQ 1ntpqmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
.\"
-.\" It has been AutoGen-ed November 21, 2016 at 08:03:08 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed March 21, 2017 at 10:45:31 AM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -975,7 +975,7 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Sh "AUTHORS"
The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1992\-2016 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992\-2017 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, <http://ntp.org/license>.
.Sh "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c
index 91364de4ba8b..547f3cc5d22b 100644
--- a/ntpq/ntpq.c
+++ b/ntpq/ntpq.c
@@ -374,7 +374,7 @@ u_int numassoc; /* number of cached associations */
/*
* For commands typed on the command line (with the -c option)
*/
-int numcmds = 0;
+size_t numcmds = 0;
const char *ccmds[MAXCMDS];
#define ADDCMD(cp) if (numcmds < MAXCMDS) ccmds[numcmds++] = (cp)
@@ -458,7 +458,7 @@ ntpqmain(
)
{
u_int ihost;
- int icmd;
+ size_t icmd;
#ifdef SYS_VXWORKS
@@ -776,31 +776,42 @@ dump_hex_printable(
size_t len
)
{
- const char * cdata;
- const char * rowstart;
- size_t idx;
- size_t rowlen;
- u_char uch;
-
- cdata = data;
- while (len > 0) {
- rowstart = cdata;
- rowlen = min(16, len);
- for (idx = 0; idx < rowlen; idx++) {
- uch = *(cdata++);
- printf("%02x ", uch);
- }
- for ( ; idx < 16 ; idx++)
- printf(" ");
- cdata = rowstart;
- for (idx = 0; idx < rowlen; idx++) {
- uch = *(cdata++);
- printf("%c", (isprint(uch))
- ? uch
- : '.');
- }
- printf("\n");
+ /* every line shows at most 16 bytes, so we need a buffer of
+ * 4 * 16 (2 xdigits, 1 char, one sep for xdigits)
+ * + 2 * 1 (block separators)
+ * + <LF> + <NUL>
+ *---------------
+ * 68 bytes
+ */
+ static const char s_xdig[16] = "0123456789ABCDEF";
+
+ char lbuf[68];
+ int ch, rowlen;
+ const u_char * cdata = data;
+ char *xptr, *pptr;
+
+ while (len) {
+ memset(lbuf, ' ', sizeof(lbuf));
+ xptr = lbuf;
+ pptr = lbuf + 3*16 + 2;
+
+ rowlen = (len > 16) ? 16 : (int)len;
len -= rowlen;
+
+ do {
+ ch = *cdata++;
+
+ *xptr++ = s_xdig[ch >> 4 ];
+ *xptr++ = s_xdig[ch & 0x0F];
+ if (++xptr == lbuf + 3*8)
+ ++xptr;
+
+ *pptr++ = isprint(ch) ? (char)ch : '.';
+ } while (--rowlen);
+
+ *pptr++ = '\n';
+ *pptr = '\0';
+ fputs(lbuf, stdout);
}
}
@@ -862,6 +873,9 @@ getresponse(
uint32_t tospan; /* timeout span (max delay) */
uint32_t todiff; /* current delay */
+ memset(offsets, 0, sizeof(offsets));
+ memset(counts , 0, sizeof(counts ));
+
/*
* This is pretty tricky. We may get between 1 and MAXFRAG packets
* back in response to the request. We peel the data out of
@@ -922,10 +936,12 @@ getresponse(
todiff = (((uint32_t)time(NULL)) - tobase) & 0x7FFFFFFFu;
if ((n > 0) && (todiff > tospan)) {
n = recv(sockfd, (char *)&rpkt, sizeof(rpkt), 0);
- n = 0; /* faked timeout return from 'select()'*/
+ n -= n; /* faked timeout return from 'select()',
+ * execute RMW cycle on 'n'
+ */
}
- if (n == 0) {
+ if (n <= 0) {
/*
* Timed out. Return what we have
*/
@@ -960,7 +976,7 @@ getresponse(
}
n = recv(sockfd, (char *)&rpkt, sizeof(rpkt), 0);
- if (n == -1) {
+ if (n < 0) {
warning("read");
return -1;
}
@@ -3595,7 +3611,7 @@ static void list_md_fn(const EVP_MD *m, const char *from, const char *to, void *
/* Lowercase names aren't accepted by keytype_from_text in ssl_init.c */
for( cp = name; *cp; cp++ ) {
- if( islower(*cp) )
+ if( islower((unsigned char)*cp) )
return;
}
len = (cp - name) + 1;
diff --git a/ntpq/ntpq.html b/ntpq/ntpq.html
index 26d608b9964d..d8f6dd6b3696 100644
--- a/ntpq/ntpq.html
+++ b/ntpq/ntpq.html
@@ -44,7 +44,7 @@ monitor the operational status
and determine the performance of
<code>ntpd</code>, the NTP daemon.
- <p>This document applies to version 4.2.8p9 of <code>ntpq</code>.
+ <p>This document applies to version 4.2.8p10 of <code>ntpq</code>.
<ul class="menu">
<li><a accesskey="1" href="#ntpq-Description">ntpq Description</a>
@@ -770,7 +770,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntpq - standard NTP query program - Ver. 4.2.8p9-RC
+<pre class="example">ntpq - standard NTP query program - Ver. 4.2.8p10-beta
Usage: ntpq [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/ntpq/ntpq.man.in b/ntpq/ntpq.man.in
index f6f889b05142..60c62a74173d 100644
--- a/ntpq/ntpq.man.in
+++ b/ntpq/ntpq.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpq @NTPQ_MS@ "21 Nov 2016" "4.2.8p9" "User Commands"
+.TH ntpq @NTPQ_MS@ "21 Mar 2017" "4.2.8p10" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-nWaWmk/ag-AWaOlk)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-P4aWgw/ag-p5aWew)
.\"
-.\" It has been AutoGen-ed November 21, 2016 at 08:03:02 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed March 21, 2017 at 10:45:26 AM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -1433,7 +1433,7 @@ it to autogen-users@lists.sourceforge.net. Thank you.
.SH "AUTHORS"
The University of Delaware and Network Time Foundation
.SH "COPYRIGHT"
-Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, <http://ntp.org/license>.
.SH "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
diff --git a/ntpq/ntpq.mdoc.in b/ntpq/ntpq.mdoc.in
index 7471abc1cd8b..4ad00f812395 100644
--- a/ntpq/ntpq.mdoc.in
+++ b/ntpq/ntpq.mdoc.in
@@ -1,9 +1,9 @@
-.Dd November 21 2016
+.Dd March 21 2017
.Dt NTPQ @NTPQ_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
.\"
-.\" It has been AutoGen-ed November 21, 2016 at 08:03:08 AM by AutoGen 5.18.5
+.\" It has been AutoGen-ed March 21, 2017 at 10:45:31 AM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -975,7 +975,7 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Sh "AUTHORS"
The University of Delaware and Network Time Foundation
.Sh "COPYRIGHT"
-Copyright (C) 1992\-2016 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992\-2017 The University of Delaware and Network Time Foundation all rights reserved.
This program is released under the terms of the NTP license, <http://ntp.org/license>.
.Sh "BUGS"
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org