summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpdc
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2016-01-22 07:32:39 +0000
committerdelphij <delphij@FreeBSD.org>2016-01-22 07:32:39 +0000
commit51765b7c6f50b7a90576344f7623019de4f88d5d (patch)
tree99811aace67dff7ddd2c157e5659a28d88a3405b /contrib/ntp/ntpdc
parent3e83d3a20344f0535767a5d9cb110d3e9571c049 (diff)
parenta835b8ff526b5ef2c37fdb4f48180c215f58bb53 (diff)
downloadFreeBSD-src-51765b7c6f50b7a90576344f7623019de4f88d5d.zip
FreeBSD-src-51765b7c6f50b7a90576344f7623019de4f88d5d.tar.gz
MFV r294491: ntp 4.2.8p6.
Security: CVE-2015-7973, CVE-2015-7974, CVE-2015-7975 Security: CVE-2015-7976, CVE-2015-7977, CVE-2015-7978 Security: CVE-2015-7979, CVE-2015-8138, CVE-2015-8139 Security: CVE-2015-8140, CVE-2015-8158 With hat: so
Diffstat (limited to 'contrib/ntp/ntpdc')
-rw-r--r--contrib/ntp/ntpdc/invoke-ntpdc.texi4
-rw-r--r--contrib/ntp/ntpdc/ntpdc-opts.c20
-rw-r--r--contrib/ntp/ntpdc/ntpdc-opts.h8
-rw-r--r--contrib/ntp/ntpdc/ntpdc.1ntpdcman8
-rw-r--r--contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc6
-rw-r--r--contrib/ntp/ntpdc/ntpdc.c23
-rw-r--r--contrib/ntp/ntpdc/ntpdc.html4
-rw-r--r--contrib/ntp/ntpdc/ntpdc.man.in8
-rw-r--r--contrib/ntp/ntpdc/ntpdc.mdoc.in6
9 files changed, 53 insertions, 34 deletions
diff --git a/contrib/ntp/ntpdc/invoke-ntpdc.texi b/contrib/ntp/ntpdc/invoke-ntpdc.texi
index f8283de..a2f440a 100644
--- a/contrib/ntp/ntpdc/invoke-ntpdc.texi
+++ b/contrib/ntp/ntpdc/invoke-ntpdc.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpdc.texi)
#
-# It has been AutoGen-ed January 7, 2016 at 11:31:26 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 20, 2016 at 04:18:37 AM by AutoGen 5.18.5
# From the definitions ntpdc-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -76,7 +76,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p5
+ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p6
Usage: ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.c b/contrib/ntp/ntpdc/ntpdc-opts.c
index da89ee2..568a97a 100644
--- a/contrib/ntp/ntpdc/ntpdc-opts.c
+++ b/contrib/ntp/ntpdc/ntpdc-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.c)
*
- * It has been AutoGen-ed January 7, 2016 at 11:31:12 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 20, 2016 at 04:18:22 AM by AutoGen 5.18.5
* From the definitions ntpdc-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntpdc program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
+ * Copyright (C) 1992-2016 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:
@@ -69,8 +69,8 @@ extern FILE * option_usage_fp;
* static const strings for ntpdc options
*/
static char const ntpdc_opt_strs[1911] =
-/* 0 */ "ntpdc 4.2.8p5\n"
- "Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n"
+/* 0 */ "ntpdc 4.2.8p6\n"
+ "Copyright (C) 1992-2016 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"
@@ -128,14 +128,14 @@ static char const ntpdc_opt_strs[1911] =
/* 1694 */ "no-load-opts\0"
/* 1707 */ "no\0"
/* 1710 */ "NTPDC\0"
-/* 1716 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p5\n"
+/* 1716 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p6\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
/* 1846 */ "$HOME\0"
/* 1852 */ ".\0"
/* 1854 */ ".ntprc\0"
/* 1861 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 1895 */ "\n\0"
-/* 1897 */ "ntpdc 4.2.8p5";
+/* 1897 */ "ntpdc 4.2.8p6";
/**
* ipv4 option description with
@@ -796,8 +796,8 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpdcOptions.pzCopyright */
- puts(_("ntpdc 4.2.8p5\n\
-Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n\
+ puts(_("ntpdc 4.2.8p6\n\
+Copyright (C) 1992-2016 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"));
@@ -862,14 +862,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpdcOptions.pzUsageTitle */
- puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p5\n\
+ puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p6\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
/* referenced via ntpdcOptions.pzExplain */
puts(_("\n"));
/* referenced via ntpdcOptions.pzFullVersion */
- puts(_("ntpdc 4.2.8p5"));
+ puts(_("ntpdc 4.2.8p6"));
/* referenced via ntpdcOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.h b/contrib/ntp/ntpdc/ntpdc-opts.h
index d3326a7..a022a72 100644
--- a/contrib/ntp/ntpdc/ntpdc-opts.h
+++ b/contrib/ntp/ntpdc/ntpdc-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.h)
*
- * It has been AutoGen-ed January 7, 2016 at 11:31:11 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 20, 2016 at 04:18:21 AM by AutoGen 5.18.5
* From the definitions ntpdc-opts.def
* and the template file options
*
@@ -18,7 +18,7 @@
* The ntpdc program is copyrighted and licensed
* under the following terms:
*
- * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
+ * Copyright (C) 1992-2016 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:
@@ -83,9 +83,9 @@ typedef enum {
/** count of all options for ntpdc */
#define OPTION_CT 15
/** ntpdc version */
-#define NTPDC_VERSION "4.2.8p5"
+#define NTPDC_VERSION "4.2.8p6"
/** Full ntpdc version text */
-#define NTPDC_FULL_VERSION "ntpdc 4.2.8p5"
+#define NTPDC_FULL_VERSION "ntpdc 4.2.8p6"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/ntpdc/ntpdc.1ntpdcman b/contrib/ntp/ntpdc/ntpdc.1ntpdcman
index 3e78896..e764a11 100644
--- a/contrib/ntp/ntpdc/ntpdc.1ntpdcman
+++ b/contrib/ntp/ntpdc/ntpdc.1ntpdcman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpdc 1ntpdcman "07 Jan 2016" "4.2.8p5" "User Commands"
+.TH ntpdc 1ntpdcman "20 Jan 2016" "4.2.8p6" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-EXaGzs/ag-QXayys)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-n4aaHU/ag-A4a4FU)
.\"
-.\" It has been AutoGen-ed January 7, 2016 at 11:31:22 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 20, 2016 at 04:18:33 AM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -848,7 +848,7 @@ RFC1305
.SH AUTHORS
The formatting directives in this document came from FreeBSD.
.SH "COPYRIGHT"
-Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992-2016 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
The
diff --git a/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc b/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
index df53d89..b3e5895 100644
--- a/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
+++ b/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
@@ -1,9 +1,9 @@
-.Dd January 7 2016
+.Dd January 20 2016
.Dt NTPDC 1ntpdcmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
.\"
-.\" It has been AutoGen-ed January 7, 2016 at 11:31:29 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 20, 2016 at 04:18:39 AM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -787,7 +787,7 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Sh AUTHORS
The formatting directives in this document came from FreeBSD.
.Sh "COPYRIGHT"
-Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992\-2016 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
The
diff --git a/contrib/ntp/ntpdc/ntpdc.c b/contrib/ntp/ntpdc/ntpdc.c
index bef9ca3..8a79d0b 100644
--- a/contrib/ntp/ntpdc/ntpdc.c
+++ b/contrib/ntp/ntpdc/ntpdc.c
@@ -605,7 +605,11 @@ getresponse(
int seq;
fd_set fds;
ssize_t n;
- size_t pad;
+ int pad;
+ /* absolute timeout checks. Not 'time_t' by intention! */
+ uint32_t tobase; /* base value for timeout */
+ uint32_t tospan; /* timeout span (max delay) */
+ uint32_t todiff; /* current delay */
/*
* This is pretty tricky. We may get between 1 and many packets
@@ -622,12 +626,14 @@ getresponse(
lastseq = 999; /* too big to be a sequence number */
ZERO(haveseq);
FD_ZERO(&fds);
+ tobase = (uint32_t)time(NULL);
again:
if (firstpkt)
tvo = tvout;
else
tvo = tvsout;
+ tospan = (uint32_t)tvo.tv_sec + (tvo.tv_usec != 0);
FD_SET(sockfd, &fds);
n = select(sockfd+1, &fds, NULL, NULL, &tvo);
@@ -635,6 +641,17 @@ getresponse(
warning("select fails");
return -1;
}
+
+ /*
+ * Check if this is already too late. Trash the data and fake a
+ * timeout if this is so.
+ */
+ 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()'*/
+ }
+
if (n == 0) {
/*
* Timed out. Return what we have
@@ -780,8 +797,10 @@ getresponse(
}
/*
- * So far, so good. Copy this data into the output array.
+ * So far, so good. Copy this data into the output array. Bump
+ * the timeout base, in case we expect more data.
*/
+ tobase = (uint32_t)time(NULL);
if ((datap + datasize + (pad * items)) > (pktdata + pktdatasize)) {
size_t offset = datap - pktdata;
growpktdata();
diff --git a/contrib/ntp/ntpdc/ntpdc.html b/contrib/ntp/ntpdc/ntpdc.html
index 107af9b..ce73039 100644
--- a/contrib/ntp/ntpdc/ntpdc.html
+++ b/contrib/ntp/ntpdc/ntpdc.html
@@ -36,7 +36,7 @@ display the time offset of the system clock relative to the server
clock. Run as root, it can correct the system clock to this offset as
well. It can be run as an interactive command or from a cron job.
- <p>This document applies to version 4.2.8p5 of <code>ntpdc</code>.
+ <p>This document applies to version 4.2.8p6 of <code>ntpdc</code>.
<p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
IETF specification.
@@ -152,7 +152,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">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p5
+<pre class="example">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p6
Usage: ntpdc [ -&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/contrib/ntp/ntpdc/ntpdc.man.in b/contrib/ntp/ntpdc/ntpdc.man.in
index 6662438..d7e25fa 100644
--- a/contrib/ntp/ntpdc/ntpdc.man.in
+++ b/contrib/ntp/ntpdc/ntpdc.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpdc @NTPDC_MS@ "07 Jan 2016" "4.2.8p5" "User Commands"
+.TH ntpdc @NTPDC_MS@ "20 Jan 2016" "4.2.8p6" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-EXaGzs/ag-QXayys)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-n4aaHU/ag-A4a4FU)
.\"
-.\" It has been AutoGen-ed January 7, 2016 at 11:31:22 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 20, 2016 at 04:18:33 AM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -848,7 +848,7 @@ RFC1305
.SH AUTHORS
The formatting directives in this document came from FreeBSD.
.SH "COPYRIGHT"
-Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992-2016 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
The
diff --git a/contrib/ntp/ntpdc/ntpdc.mdoc.in b/contrib/ntp/ntpdc/ntpdc.mdoc.in
index 2e2fd31..4dd9e15 100644
--- a/contrib/ntp/ntpdc/ntpdc.mdoc.in
+++ b/contrib/ntp/ntpdc/ntpdc.mdoc.in
@@ -1,9 +1,9 @@
-.Dd January 7 2016
+.Dd January 20 2016
.Dt NTPDC @NTPDC_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
.\"
-.\" It has been AutoGen-ed January 7, 2016 at 11:31:29 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 20, 2016 at 04:18:39 AM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -787,7 +787,7 @@ it to autogen\-users@lists.sourceforge.net. Thank you.
.Sh AUTHORS
The formatting directives in this document came from FreeBSD.
.Sh "COPYRIGHT"
-Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
+Copyright (C) 1992\-2016 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
The
OpenPOWER on IntegriCloud