mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-29 03:45:02 +01:00
Compare commits
94
Commits
stable/10
...
releng/10.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a34883424 | ||
|
|
59570923bc | ||
|
|
69f6fd2161 | ||
|
|
d3d35545b1 | ||
|
|
1b91a79349 | ||
|
|
116b0b2921 | ||
|
|
5b8145031b | ||
|
|
a4dba4499e | ||
|
|
bd13449135 | ||
|
|
914da52d79 | ||
|
|
3ace7cd42a | ||
|
|
fea4cba0ec | ||
|
|
3b6d05264f | ||
|
|
1bbb0c778c | ||
|
|
a6df401345 | ||
|
|
0ffd370a4c | ||
|
|
250ffa2e10 | ||
|
|
c2d5228276 | ||
|
|
e71f5c6f0d | ||
|
|
76061d993c | ||
|
|
a3f8b44f46 | ||
|
|
f0ed9bc7d4 | ||
|
|
35cc83b937 | ||
|
|
7f86e2d395 | ||
|
|
c800785d3a | ||
|
|
4ee85b4f40 | ||
|
|
2df47eea7a | ||
|
|
bfa374472b | ||
|
|
2757faf971 | ||
|
|
5d69881ea0 | ||
|
|
d9b0fbe32d | ||
|
|
45e7cb707a | ||
|
|
657eb59810 | ||
|
|
7be98fc39b | ||
|
|
570ccb4f1e | ||
|
|
c79d446a91 | ||
|
|
01353e2a2c | ||
|
|
b3f0a45570 | ||
|
|
1bffa67872 | ||
|
|
88b2998919 | ||
|
|
13ffe15f87 | ||
|
|
711155282a | ||
|
|
7eee39f5c6 | ||
|
|
88aeaa9419 | ||
|
|
f28c7f02dc | ||
|
|
c1930470fa | ||
|
|
d2cabdbe3f | ||
|
|
dedc865338 | ||
|
|
3529d36108 | ||
|
|
510368b3eb | ||
|
|
c10769881b | ||
|
|
3554c60c1e | ||
|
|
d6976bba8f | ||
|
|
d0d645a964 | ||
|
|
55e9fe578b | ||
|
|
dbbb095574 | ||
|
|
e51fe428c0 | ||
|
|
1b85e15826 | ||
|
|
d949e56827 | ||
|
|
7c43c220cc | ||
|
|
af837691de | ||
|
|
f17781a883 | ||
|
|
8fdb8a30cd | ||
|
|
17154057bb | ||
|
|
48d5f14b84 | ||
|
|
b2350b85d0 | ||
|
|
912427ec2e | ||
|
|
a3997f1fd7 | ||
|
|
ff9ee7fe0f | ||
|
|
b63345c2aa | ||
|
|
210d38d51b | ||
|
|
60c70d52c3 | ||
|
|
9325ec5c9b | ||
|
|
65a38c76e0 | ||
|
|
ffa1526de3 | ||
|
|
39e669c66e | ||
|
|
0e44459f83 | ||
|
|
783f60ceab | ||
|
|
99ad22d517 | ||
|
|
8b144d547a | ||
|
|
f75ffb5474 | ||
|
|
714d9ebd31 | ||
|
|
bb99254900 | ||
|
|
4ee944dac3 | ||
|
|
f7d5d85757 | ||
|
|
b852012527 | ||
|
|
ff16f31ff7 | ||
|
|
80b2dd3094 | ||
|
|
3a56c532eb | ||
|
|
459ffcadd8 | ||
|
|
868a917dd9 | ||
|
|
7fb72ef215 | ||
|
|
dec5f6f9a3 | ||
|
|
6f2265a0d3 |
No files matched your search
+2
-2
@@ -133,8 +133,8 @@ OSRELDATE= 0
|
||||
.endif
|
||||
|
||||
.if !defined(VERSION)
|
||||
REVISION!= make -C ${SRCDIR}/release -V REVISION
|
||||
BRANCH!= make -C ${SRCDIR}/release -V BRANCH
|
||||
REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
|
||||
BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
|
||||
SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
|
||||
${SRCDIR}/sys/sys/param.h
|
||||
VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
|
||||
|
||||
@@ -16,6 +16,208 @@ from older versions of FreeBSD, try WITHOUT_CLANG to bootstrap to the tip of
|
||||
stable/10, and then rebuild without this option. The bootstrap process from
|
||||
older version of current is a bit fragile.
|
||||
|
||||
20161222 p28 FreeBSD-SA-16:39.ntp
|
||||
|
||||
Fix multiple vulnerabilities of ntp.
|
||||
|
||||
20161208 p27 FreeBSD-SA-16:37.libc [revised]
|
||||
|
||||
Fix regressions introduced by SA-16:37.libc.
|
||||
|
||||
20161206 p26 FreeBSD-SA-16:36.telnetd
|
||||
FreeBSD-SA-16:37.libc
|
||||
FreeBSD-SA-16:38.bhyve
|
||||
FreeBSD-EN-16:19.tzcode
|
||||
FreeBSD-EN-16:20.tzdata
|
||||
|
||||
Fix possible login(1) argument injection in telnetd(8). [SA-16:36]
|
||||
Fix link_ntoa(3) buffer overflow in libc. [SA-16:37]
|
||||
Fix possible escape from bhyve(8) virtual machine. [SA-16:38]
|
||||
Fix warnings about valid time zone abbreviations. [EN-16:19]
|
||||
Update timezone database information. [EN-16:20]
|
||||
|
||||
20161102 p25 FreeBSD-SA-16:35.openssl
|
||||
|
||||
Fix OpenSSL remote DoS vulnerability. [SA-16:35]
|
||||
|
||||
20161025 p24 FreeBSD-SA-16:15.sysarch [revised]
|
||||
|
||||
Fix incorrect argument validation in sysarch(2). [SA-16:15]
|
||||
|
||||
20161010 p23 FreeBSD-SA-16:29.bspatch
|
||||
FreeBSD-SA-16:30.portsnap
|
||||
FreeBSD-SA-16:31.libarchive
|
||||
|
||||
Fix bspatch heap overflow vulnerability. [SA-16:29]
|
||||
|
||||
Fix multiple portsnap vulnerabilities. [SA-16:30]
|
||||
|
||||
Fix multiple libarchive vulnerabilities. [SA-16:31]
|
||||
|
||||
20160926 p22 FreeBSD-SA-16:26.openssl [revised]
|
||||
|
||||
Fix OpenSSL regression introduced in SA-16:26.
|
||||
|
||||
20160923 p21 FreeBSD-SA-16:26.openssl
|
||||
|
||||
Fix multiple OpenSSL vulnerabilitites.
|
||||
|
||||
20160725 p20 FreeBSD-SA-16:25.bspatch
|
||||
FreeBSD-EN-16:09.freebsd-update
|
||||
|
||||
Fix bspatch heap overflow vulnerability. [SA-16:25]
|
||||
|
||||
Fix freebsd-update(8) support of FreeBSD 11.0 release
|
||||
distribution. [EN-16:09]
|
||||
|
||||
20160604 p19 FreeBSD-SA-16:24.ntp
|
||||
|
||||
Fix multiple vulnerabilities of ntp.
|
||||
|
||||
20160531 p18 FreeBSD-SA-16:20.linux
|
||||
FreeBSD-SA-16:21.43bsd
|
||||
FreeBSD-SA-16:22.libarchive
|
||||
|
||||
Fix kernel stack disclosure in Linux compatibility layer. [SA-16:20]
|
||||
Fix kernel stack disclosure in 4.3BSD compatibility layer. [SA-16:21]
|
||||
Fix directory traversal in cpio(1). [SA-16:22]
|
||||
|
||||
20160517 p17 FreeBSD-SA-16:18.atkbd
|
||||
FreeBSD-SA-16:19.sendmsg
|
||||
|
||||
Fix buffer overflow in keyboard driver. [SA-16:18]
|
||||
|
||||
Fix incorrect argument handling in sendmsg(2). [SA-16:19]
|
||||
|
||||
20160504 p16 FreeBSD-SA-16:17.openssl
|
||||
FreeBSD-EN-16:07.ipi
|
||||
FreeBSD-EN-16:08.zfs
|
||||
|
||||
Fix multiple OpenSSL vulnerabilitites. [SA-16:17]
|
||||
|
||||
Fix excessive latency in x86 IPI delivery. [EN-16:07]
|
||||
|
||||
Fix memory leak in ZFS. [EN-16:08]
|
||||
|
||||
20160429 p15 FreeBSD-SA-16:16.ntp
|
||||
|
||||
Fix multiple vulnerabilities of ntp.
|
||||
|
||||
20160316 p14 FreeBSD-SA-16:14.openssh-xauth
|
||||
FreeBSD-SA-16:15.sysarch
|
||||
FreeBSD-EN-16:04.hyperv
|
||||
FreeBSD-EN-16:05.hv_netvsc
|
||||
|
||||
Fix OpenSSH xauth(1) command injection. [SA-16:14]
|
||||
Fix incorrect argument validation in sysarch(2). [SA-16:15]
|
||||
Fix Hyper-V KVP (Key-Value Pair) daemon indefinite sleep. [EN-16:04]
|
||||
Fix hv_netvsc(4) incorrect TCP/IP checksums. [EN-16:05]
|
||||
|
||||
20160303 p13 FreeBSD-SA-16:12.openssl
|
||||
|
||||
Fix multiple vulnerabilities of OpenSSL.
|
||||
|
||||
20160130 p12 FreeBSD-SA-16:11.openssl
|
||||
|
||||
Fix OpenSSL SSLv2 ciphersuite downgrade vulnerability. [SA-16:11]
|
||||
|
||||
20160127 p11 FreeBSD-SA-16:09.ntp
|
||||
FreeBSD-SA-16:10.linux
|
||||
|
||||
Fix multiple vulnerabilities of ntp. [SA-16:09]
|
||||
|
||||
Fix Linux compatibility layer issetugid(2) system call
|
||||
vulnerability. [SA-16:10]
|
||||
|
||||
20160114 p10 FreeBSD-SA-16:07.openssh
|
||||
|
||||
Fix OpenSSH client information leak. [SA-16:07]
|
||||
|
||||
20160114 p9 FreeBSD-EN-16:01.filemon
|
||||
FreeBSD-EN-16:02.pf
|
||||
FreeBSD-EN-16:03.yplib
|
||||
FreeBSD-SA-16:01.sctp
|
||||
FreeBSD-SA-16:02.ntp
|
||||
FreeBSD-SA-16:03.linux
|
||||
FreeBSD-SA-16:04.linux
|
||||
FreeBSD-SA-16:05.tcp
|
||||
FreeBSD-SA-16:06.bsnmpd
|
||||
|
||||
Fix multiple stability and locking problems in filemon(4). [EN-16:01]
|
||||
Fix pf(4) generating bad TCP checksums. [EN-16:02]
|
||||
Fix infinite loop in YP/NIS client library. [EN-16:03]
|
||||
Fix remote denial of service in SCTP. [SA-16:01]
|
||||
Update NTP to 4.2.8p5. [SA-16:02]
|
||||
Fix kernel memory diclosure in Linux compatibility layer. [SA-16:03]
|
||||
Fix kernel memory overwrite in Linux compatibility layer. [SA-16:04]
|
||||
Fix crash in TCP MD5 signatures. [SA-16:05]
|
||||
Fix insecure default permissions for snmpd.config. [SA-16:06]
|
||||
|
||||
20151205 p8 FreeBSD-SA-15:26.openssl
|
||||
|
||||
Fix multiple OpenSSL vulnerabilities. [SA-15:26]
|
||||
|
||||
20151104 p7 FreeBSD-SA-15:25.ntp [revised]
|
||||
FreeBSD-EN-15:19.kqueue
|
||||
FreeBSD-EN-15:20.vm
|
||||
|
||||
Fix regression in ntpd(8) lacking support for RAWDCF reference
|
||||
clock in 10.2-RELEASE-p6. [SA-15:25]
|
||||
|
||||
Fix kqueue write events never fired for files greater 2GB. [EN-15:19]
|
||||
|
||||
Fix applications exiting due to segmentation violation on a correct
|
||||
memory address. [EN-15:20.vm]
|
||||
|
||||
20151026: p6 FreeBSD-SA-15:25.ntp
|
||||
|
||||
Fix multiple NTP vulnerabilities. New NTP version is 4.2.8p4.
|
||||
|
||||
20151002: p5 FreeBSD-SA-15:24.rpcbind [revised]
|
||||
Revised patch to address a regression that prevents NIS from working.
|
||||
|
||||
20150929: p4 FreeBSD-SA-15:24.rpcbind
|
||||
|
||||
Fix rpcbind(8) remote denial of service. [SA-15:24]
|
||||
|
||||
20150916: p3 FreeBSD-EN-15:16.pw
|
||||
FreeBSD-EN-15:17.libc
|
||||
FreeBSD-EN-15:18.pkg
|
||||
|
||||
Fix regression in pw(8) when creating numeric users or groups.
|
||||
[EN-15:16]
|
||||
|
||||
Fix libc handling of signals for multi-threaded processes.
|
||||
[EN-15:17]
|
||||
|
||||
Implement pubkey support for pkg(7) bootstrap. [EN-15:18]
|
||||
|
||||
20150825: p2 FreeBSD-SA-15:22.openssh
|
||||
FreeBSD-EN-15:15.pkg
|
||||
Fix OpenSSH multiple vulnerabilities. [SA-15:22]
|
||||
|
||||
Fix insufficient check of unsupported pkg(7) signature methods.
|
||||
[EN-15:15]
|
||||
|
||||
20150818: p1 FreeBSD-SA-15:20.expat
|
||||
FreeBSD-EN-15:11.toolchain
|
||||
FreeBSD-EN-15:12.netstat
|
||||
FreeBSD-EN-15:13.vidcontrol
|
||||
|
||||
Fix multiple integer overflows in expat (libbsdxml) XML parser.
|
||||
[SA-15:20]
|
||||
|
||||
Fix make(1) syntax errors when upgrading from 9.x and earlier.
|
||||
[EN-15:11]
|
||||
|
||||
Fix incorrect netstat(1) data handling on 32-bit systems.
|
||||
[EN-15:12]
|
||||
|
||||
Allow size argument to vidcontrol(1) for syscons(4). [EN-15:13]
|
||||
|
||||
20150813:
|
||||
10.2-RELEASE.
|
||||
|
||||
20150703:
|
||||
The default Unbound configuration now enables remote control
|
||||
using a local socket. Users who have already enabled the
|
||||
|
||||
@@ -1678,6 +1678,12 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
|
||||
void * XMLCALL
|
||||
XML_GetBuffer(XML_Parser parser, int len)
|
||||
{
|
||||
/* BEGIN MOZILLA CHANGE (sanity check len) */
|
||||
if (len < 0) {
|
||||
errorCode = XML_ERROR_NO_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
/* END MOZILLA CHANGE */
|
||||
switch (ps_parsing) {
|
||||
case XML_SUSPENDED:
|
||||
errorCode = XML_ERROR_SUSPENDED;
|
||||
@@ -1689,8 +1695,13 @@ XML_GetBuffer(XML_Parser parser, int len)
|
||||
}
|
||||
|
||||
if (len > bufferLim - bufferEnd) {
|
||||
/* FIXME avoid integer overflow */
|
||||
int neededSize = len + (int)(bufferEnd - bufferPtr);
|
||||
/* BEGIN MOZILLA CHANGE (sanity check neededSize) */
|
||||
if (neededSize < 0) {
|
||||
errorCode = XML_ERROR_NO_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
/* END MOZILLA CHANGE */
|
||||
#ifdef XML_CONTEXT_BYTES
|
||||
int keep = (int)(bufferPtr - buffer);
|
||||
|
||||
@@ -1719,7 +1730,15 @@ XML_GetBuffer(XML_Parser parser, int len)
|
||||
bufferSize = INIT_BUFFER_SIZE;
|
||||
do {
|
||||
bufferSize *= 2;
|
||||
} while (bufferSize < neededSize);
|
||||
/* BEGIN MOZILLA CHANGE (prevent infinite loop on overflow) */
|
||||
} while (bufferSize < neededSize && bufferSize > 0);
|
||||
/* END MOZILLA CHANGE */
|
||||
/* BEGIN MOZILLA CHANGE (sanity check bufferSize) */
|
||||
if (bufferSize <= 0) {
|
||||
errorCode = XML_ERROR_NO_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
/* END MOZILLA CHANGE */
|
||||
newBuf = (char *)MALLOC(bufferSize);
|
||||
if (newBuf == 0) {
|
||||
errorCode = XML_ERROR_NO_MEMORY;
|
||||
|
||||
@@ -156,7 +156,8 @@ See above for description.
|
||||
.It Fl Fl insecure
|
||||
(i and p mode only)
|
||||
Disable security checks during extraction or copying.
|
||||
This allows extraction via symbolic links and path names containing
|
||||
This allows extraction via symbolic links, absolute paths,
|
||||
and path names containing
|
||||
.Sq ..
|
||||
in the name.
|
||||
.It Fl J , Fl Fl xz
|
||||
|
||||
@@ -179,6 +179,7 @@ main(int argc, char *argv[])
|
||||
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
|
||||
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
|
||||
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
|
||||
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
|
||||
cpio->extract_flags |= ARCHIVE_EXTRACT_PERM;
|
||||
cpio->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
|
||||
cpio->extract_flags |= ARCHIVE_EXTRACT_ACL;
|
||||
@@ -264,6 +265,7 @@ main(int argc, char *argv[])
|
||||
case OPTION_INSECURE:
|
||||
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS;
|
||||
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT;
|
||||
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
|
||||
break;
|
||||
case 'L': /* GNU cpio */
|
||||
cpio->option_follow_links = 1;
|
||||
@@ -300,6 +302,7 @@ main(int argc, char *argv[])
|
||||
"Cannot use both -p and -%c", cpio->mode);
|
||||
cpio->mode = opt;
|
||||
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT;
|
||||
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
|
||||
break;
|
||||
case OPTION_PRESERVE_OWNER:
|
||||
cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER;
|
||||
|
||||
@@ -562,6 +562,8 @@ __LA_DECL int archive_read_set_options(struct archive *_a,
|
||||
/* Default: Do not use HFS+ compression if it was not compressed. */
|
||||
/* This has no effect except on Mac OS v10.6 or later. */
|
||||
#define ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED (0x8000)
|
||||
/* Default: Do not reject entries with absolute paths */
|
||||
#define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000)
|
||||
|
||||
__LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,
|
||||
int flags);
|
||||
|
||||
@@ -409,9 +409,7 @@ setup_acls(struct archive_read_disk *a,
|
||||
{
|
||||
const char *accpath;
|
||||
acl_t acl;
|
||||
#if HAVE_ACL_IS_TRIVIAL_NP
|
||||
int r;
|
||||
#endif
|
||||
|
||||
accpath = archive_entry_sourcepath(entry);
|
||||
if (accpath == NULL)
|
||||
@@ -443,9 +441,13 @@ setup_acls(struct archive_read_disk *a,
|
||||
}
|
||||
#endif
|
||||
if (acl != NULL) {
|
||||
translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
|
||||
r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
|
||||
acl_free(acl);
|
||||
return (ARCHIVE_OK);
|
||||
if (r != ARCHIVE_OK) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Couldn't translate NFSv4 ACLs: %s", accpath);
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
/* Retrieve access ACL from file. */
|
||||
@@ -464,18 +466,29 @@ setup_acls(struct archive_read_disk *a,
|
||||
else
|
||||
acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
|
||||
if (acl != NULL) {
|
||||
translate_acl(a, entry, acl,
|
||||
r = translate_acl(a, entry, acl,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
|
||||
acl_free(acl);
|
||||
if (r != ARCHIVE_OK) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Couldn't translate access ACLs: %s", accpath);
|
||||
return (r);
|
||||
}
|
||||
}
|
||||
|
||||
/* Only directories can have default ACLs. */
|
||||
if (S_ISDIR(archive_entry_mode(entry))) {
|
||||
acl = acl_get_file(accpath, ACL_TYPE_DEFAULT);
|
||||
if (acl != NULL) {
|
||||
translate_acl(a, entry, acl,
|
||||
r = translate_acl(a, entry, acl,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
|
||||
acl_free(acl);
|
||||
if (r != ARCHIVE_OK) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Couldn't translate default ACLs: %s",
|
||||
accpath);
|
||||
return (r);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (ARCHIVE_OK);
|
||||
@@ -536,7 +549,11 @@ translate_acl(struct archive_read_disk *a,
|
||||
// FreeBSD "brands" ACLs as POSIX.1e or NFSv4
|
||||
// Make sure the "brand" on this ACL is consistent
|
||||
// with the default_entry_acl_type bits provided.
|
||||
acl_get_brand_np(acl, &brand);
|
||||
if (acl_get_brand_np(acl, &brand) != 0) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Failed to read ACL brand");
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
switch (brand) {
|
||||
case ACL_BRAND_POSIX:
|
||||
switch (default_entry_acl_type) {
|
||||
@@ -544,30 +561,42 @@ translate_acl(struct archive_read_disk *a,
|
||||
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
|
||||
break;
|
||||
default:
|
||||
// XXX set warning message?
|
||||
return ARCHIVE_FAILED;
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"Invalid ACL entry type for POSIX.1e ACL");
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
break;
|
||||
case ACL_BRAND_NFS4:
|
||||
if (default_entry_acl_type & ~ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
|
||||
// XXX set warning message?
|
||||
return ARCHIVE_FAILED;
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"Invalid ACL entry type for NFSv4 ACL");
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// XXX set warning message?
|
||||
return ARCHIVE_FAILED;
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"Unknown ACL brand");
|
||||
return (ARCHIVE_WARN);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
|
||||
if (s == -1) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Failed to get first ACL entry");
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
while (s == 1) {
|
||||
ae_id = -1;
|
||||
ae_name = NULL;
|
||||
ae_perm = 0;
|
||||
|
||||
acl_get_tag_type(acl_entry, &acl_tag);
|
||||
if (acl_get_tag_type(acl_entry, &acl_tag) != 0) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Failed to get ACL tag type");
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
switch (acl_tag) {
|
||||
case ACL_USER:
|
||||
ae_id = (int)*(uid_t *)acl_get_qualifier(acl_entry);
|
||||
@@ -600,12 +629,17 @@ translate_acl(struct archive_read_disk *a,
|
||||
continue;
|
||||
}
|
||||
|
||||
// XXX acl type maps to allow/deny/audit/YYYY bits
|
||||
// XXX acl_get_entry_type_np on FreeBSD returns EINVAL for
|
||||
// non-NFSv4 ACLs
|
||||
// XXX acl_type maps to allow/deny/audit/YYYY bits
|
||||
entry_acl_type = default_entry_acl_type;
|
||||
r = acl_get_entry_type_np(acl_entry, &acl_type);
|
||||
if (r == 0) {
|
||||
if (default_entry_acl_type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
|
||||
/*
|
||||
* acl_get_entry_type_np() falis with non-NFSv4 ACLs
|
||||
*/
|
||||
if (acl_get_entry_type_np(acl_entry, &acl_type) != 0) {
|
||||
archive_set_error(&a->archive, errno, "Failed "
|
||||
"to get ACL type from a NFSv4 ACL entry");
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
switch (acl_type) {
|
||||
case ACL_ENTRY_TYPE_ALLOW:
|
||||
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
|
||||
@@ -619,28 +653,52 @@ translate_acl(struct archive_read_disk *a,
|
||||
case ACL_ENTRY_TYPE_ALARM:
|
||||
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALARM;
|
||||
break;
|
||||
default:
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Invalid NFSv4 ACL entry type");
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Libarchive stores "flag" (NFSv4 inheritance bits)
|
||||
* in the ae_perm bitmap.
|
||||
*
|
||||
* acl_get_flagset_np() fails with non-NFSv4 ACLs
|
||||
*/
|
||||
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Failed to get flagset from a NFSv4 ACL entry");
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
|
||||
r = acl_get_flag_np(acl_flagset,
|
||||
acl_inherit_map[i].platform_inherit);
|
||||
if (r == -1) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Failed to check flag in a NFSv4 "
|
||||
"ACL flagset");
|
||||
return (ARCHIVE_WARN);
|
||||
} else if (r)
|
||||
ae_perm |= acl_inherit_map[i].archive_inherit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Libarchive stores "flag" (NFSv4 inheritance bits)
|
||||
* in the ae_perm bitmap.
|
||||
*/
|
||||
acl_get_flagset_np(acl_entry, &acl_flagset);
|
||||
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
|
||||
if (acl_get_flag_np(acl_flagset,
|
||||
acl_inherit_map[i].platform_inherit))
|
||||
ae_perm |= acl_inherit_map[i].archive_inherit;
|
||||
|
||||
}
|
||||
|
||||
acl_get_permset(acl_entry, &acl_permset);
|
||||
for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
|
||||
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Failed to get ACL permission set");
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
|
||||
/*
|
||||
* acl_get_perm() is spelled differently on different
|
||||
* platforms; see above.
|
||||
*/
|
||||
if (ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm))
|
||||
r = ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm);
|
||||
if (r == -1) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Failed to check permission in an ACL permission set");
|
||||
return (ARCHIVE_WARN);
|
||||
} else if (r)
|
||||
ae_perm |= acl_perm_map[i].archive_perm;
|
||||
}
|
||||
|
||||
@@ -649,6 +707,11 @@ translate_acl(struct archive_read_disk *a,
|
||||
ae_id, ae_name);
|
||||
|
||||
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
|
||||
if (s == -1) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Failed to get next ACL entry");
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
}
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ struct tar {
|
||||
int64_t entry_padding;
|
||||
int64_t entry_bytes_unconsumed;
|
||||
int64_t realsize;
|
||||
int sparse_allowed;
|
||||
struct sparse_block *sparse_list;
|
||||
struct sparse_block *sparse_last;
|
||||
int64_t sparse_offset;
|
||||
@@ -585,13 +586,23 @@ static int
|
||||
archive_read_format_tar_skip(struct archive_read *a)
|
||||
{
|
||||
int64_t bytes_skipped;
|
||||
int64_t request;
|
||||
struct sparse_block *p;
|
||||
struct tar* tar;
|
||||
|
||||
tar = (struct tar *)(a->format->data);
|
||||
|
||||
bytes_skipped = __archive_read_consume(a,
|
||||
tar->entry_bytes_remaining + tar->entry_padding +
|
||||
tar->entry_bytes_unconsumed);
|
||||
/* Do not consume the hole of a sparse file. */
|
||||
request = 0;
|
||||
for (p = tar->sparse_list; p != NULL; p = p->next) {
|
||||
if (!p->hole)
|
||||
request += p->remaining;
|
||||
}
|
||||
if (request > tar->entry_bytes_remaining)
|
||||
request = tar->entry_bytes_remaining;
|
||||
request += tar->entry_padding + tar->entry_bytes_unconsumed;
|
||||
|
||||
bytes_skipped = __archive_read_consume(a, request);
|
||||
if (bytes_skipped < 0)
|
||||
return (ARCHIVE_FATAL);
|
||||
|
||||
@@ -1216,6 +1227,14 @@ header_common(struct archive_read *a, struct tar *tar,
|
||||
* sparse information in the extended area.
|
||||
*/
|
||||
/* FALLTHROUGH */
|
||||
case '0':
|
||||
/*
|
||||
* Enable sparse file "read" support only for regular
|
||||
* files and explicit GNU sparse files. However, we
|
||||
* don't allow non-standard file types to be sparse.
|
||||
*/
|
||||
tar->sparse_allowed = 1;
|
||||
/* FALLTHROUGH */
|
||||
default: /* Regular file and non-standard types */
|
||||
/*
|
||||
* Per POSIX: non-recognized types should always be
|
||||
@@ -1675,6 +1694,14 @@ pax_attribute(struct archive_read *a, struct tar *tar,
|
||||
#endif
|
||||
switch (key[0]) {
|
||||
case 'G':
|
||||
/* Reject GNU.sparse.* headers on non-regular files. */
|
||||
if (strncmp(key, "GNU.sparse", 10) == 0 &&
|
||||
!tar->sparse_allowed) {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"Non-regular file cannot be sparse");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
|
||||
/* GNU "0.0" sparse pax format. */
|
||||
if (strcmp(key, "GNU.sparse.numblocks") == 0) {
|
||||
tar->sparse_offset = -1;
|
||||
|
||||
@@ -177,6 +177,9 @@ The default is to not refuse such paths.
|
||||
Note that paths ending in
|
||||
.Pa ..
|
||||
always cause an error, regardless of this flag.
|
||||
.It Cm ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS
|
||||
Refuse to extract an absolute path.
|
||||
The default is to not refuse such paths.
|
||||
.It Cm ARCHIVE_EXTRACT_SPARSE
|
||||
Scan data for blocks of NUL bytes and try to recreate them with holes.
|
||||
This results in sparse files, independent of whether the archive format
|
||||
|
||||
@@ -131,6 +131,7 @@ set_acl(struct archive *a, int fd, const char *name,
|
||||
acl_entry_t acl_entry;
|
||||
acl_permset_t acl_permset;
|
||||
acl_flagset_t acl_flagset;
|
||||
int r;
|
||||
int ret;
|
||||
int ae_type, ae_permset, ae_tag, ae_id;
|
||||
uid_t ae_uid;
|
||||
@@ -144,9 +145,19 @@ set_acl(struct archive *a, int fd, const char *name,
|
||||
if (entries == 0)
|
||||
return (ARCHIVE_OK);
|
||||
acl = acl_init(entries);
|
||||
if (acl == (acl_t)NULL) {
|
||||
archive_set_error(a, errno,
|
||||
"Failed to initialize ACL working storage");
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
|
||||
&ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
|
||||
acl_create_entry(&acl, &acl_entry);
|
||||
if (acl_create_entry(&acl, &acl_entry) != 0) {
|
||||
archive_set_error(a, errno,
|
||||
"Failed to create a new ACL entry");
|
||||
ret = ARCHIVE_FAILED;
|
||||
goto exit_free;
|
||||
}
|
||||
|
||||
switch (ae_tag) {
|
||||
case ARCHIVE_ENTRY_ACL_USER:
|
||||
@@ -175,47 +186,95 @@ set_acl(struct archive *a, int fd, const char *name,
|
||||
acl_set_tag_type(acl_entry, ACL_EVERYONE);
|
||||
break;
|
||||
default:
|
||||
/* XXX */
|
||||
break;
|
||||
archive_set_error(a, ARCHIVE_ERRNO_MISC,
|
||||
"Unknown ACL tag");
|
||||
ret = ARCHIVE_FAILED;
|
||||
goto exit_free;
|
||||
}
|
||||
|
||||
r = 0;
|
||||
switch (ae_type) {
|
||||
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
|
||||
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW);
|
||||
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW);
|
||||
break;
|
||||
case ARCHIVE_ENTRY_ACL_TYPE_DENY:
|
||||
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY);
|
||||
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY);
|
||||
break;
|
||||
case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
|
||||
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT);
|
||||
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT);
|
||||
break;
|
||||
case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
|
||||
acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM);
|
||||
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM);
|
||||
break;
|
||||
case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
|
||||
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
|
||||
// These don't translate directly into the system ACL.
|
||||
break;
|
||||
default:
|
||||
// XXX error handling here.
|
||||
break;
|
||||
archive_set_error(a, ARCHIVE_ERRNO_MISC,
|
||||
"Unknown ACL entry type");
|
||||
ret = ARCHIVE_FAILED;
|
||||
goto exit_free;
|
||||
}
|
||||
if (r != 0) {
|
||||
archive_set_error(a, errno,
|
||||
"Failed to set ACL entry type");
|
||||
ret = ARCHIVE_FAILED;
|
||||
goto exit_free;
|
||||
}
|
||||
|
||||
acl_get_permset(acl_entry, &acl_permset);
|
||||
acl_clear_perms(acl_permset);
|
||||
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
|
||||
archive_set_error(a, errno,
|
||||
"Failed to get ACL permission set");
|
||||
ret = ARCHIVE_FAILED;
|
||||
goto exit_free;
|
||||
}
|
||||
if (acl_clear_perms(acl_permset) != 0) {
|
||||
archive_set_error(a, errno,
|
||||
"Failed to clear ACL permissions");
|
||||
ret = ARCHIVE_FAILED;
|
||||
goto exit_free;
|
||||
}
|
||||
|
||||
for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
|
||||
if (ae_permset & acl_perm_map[i].archive_perm)
|
||||
acl_add_perm(acl_permset,
|
||||
acl_perm_map[i].platform_perm);
|
||||
if (acl_add_perm(acl_permset,
|
||||
acl_perm_map[i].platform_perm) != 0) {
|
||||
archive_set_error(a, errno,
|
||||
"Failed to add ACL permission");
|
||||
ret = ARCHIVE_FAILED;
|
||||
goto exit_free;
|
||||
}
|
||||
}
|
||||
|
||||
acl_get_flagset_np(acl_entry, &acl_flagset);
|
||||
acl_clear_flags_np(acl_flagset);
|
||||
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
|
||||
if (ae_permset & acl_inherit_map[i].archive_inherit)
|
||||
acl_add_flag_np(acl_flagset,
|
||||
acl_inherit_map[i].platform_inherit);
|
||||
if (acl_type == ACL_TYPE_NFS4) {
|
||||
/*
|
||||
* acl_get_flagset_np() fails with non-NFSv4 ACLs
|
||||
*/
|
||||
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
|
||||
archive_set_error(a, errno,
|
||||
"Failed to get flagset from an NFSv4 ACL entry");
|
||||
ret = ARCHIVE_FAILED;
|
||||
goto exit_free;
|
||||
}
|
||||
if (acl_clear_flags_np(acl_flagset) != 0) {
|
||||
archive_set_error(a, errno,
|
||||
"Failed to clear flags from an NFSv4 ACL flagset");
|
||||
ret = ARCHIVE_FAILED;
|
||||
goto exit_free;
|
||||
}
|
||||
for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
|
||||
if (ae_permset & acl_inherit_map[i].archive_inherit) {
|
||||
if (acl_add_flag_np(acl_flagset,
|
||||
acl_inherit_map[i].platform_inherit) != 0) {
|
||||
archive_set_error(a, errno,
|
||||
"Failed to add flag to NFSv4 ACL flagset");
|
||||
ret = ARCHIVE_FAILED;
|
||||
goto exit_free;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,6 +302,7 @@ set_acl(struct archive *a, int fd, const char *name,
|
||||
ret = ARCHIVE_WARN;
|
||||
}
|
||||
#endif
|
||||
exit_free:
|
||||
acl_free(acl);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,17 @@ __FBSDID("$FreeBSD$");
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
#ifndef O_CLOEXEC
|
||||
#define O_CLOEXEC 0
|
||||
#define O_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
/* Ignore non-int O_NOFOLLOW constant. */
|
||||
/* gnulib's fcntl.h does this on AIX, but it seems practical everywhere */
|
||||
#if defined O_NOFOLLOW && !(INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX)
|
||||
#undef O_NOFOLLOW
|
||||
#endif
|
||||
|
||||
#ifndef O_NOFOLLOW
|
||||
#define O_NOFOLLOW 0
|
||||
#endif
|
||||
|
||||
struct fixup_entry {
|
||||
@@ -326,12 +336,14 @@ struct archive_write_disk {
|
||||
|
||||
#define HFS_BLOCKS(s) ((s) >> 12)
|
||||
|
||||
static int check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags);
|
||||
static int check_symlinks(struct archive_write_disk *);
|
||||
static int create_filesystem_object(struct archive_write_disk *);
|
||||
static struct fixup_entry *current_fixup(struct archive_write_disk *, const char *pathname);
|
||||
#if defined(HAVE_FCHDIR) && defined(PATH_MAX)
|
||||
static void edit_deep_directories(struct archive_write_disk *ad);
|
||||
#endif
|
||||
static int cleanup_pathname_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags);
|
||||
static int cleanup_pathname(struct archive_write_disk *);
|
||||
static int create_dir(struct archive_write_disk *, char *);
|
||||
static int create_parent_dir(struct archive_write_disk *, char *);
|
||||
@@ -1791,7 +1803,7 @@ edit_deep_directories(struct archive_write_disk *a)
|
||||
char *tail = a->name;
|
||||
|
||||
/* If path is short, avoid the open() below. */
|
||||
if (strlen(tail) <= PATH_MAX)
|
||||
if (strlen(tail) < PATH_MAX)
|
||||
return;
|
||||
|
||||
/* Try to record our starting dir. */
|
||||
@@ -1801,7 +1813,7 @@ edit_deep_directories(struct archive_write_disk *a)
|
||||
return;
|
||||
|
||||
/* As long as the path is too long... */
|
||||
while (strlen(tail) > PATH_MAX) {
|
||||
while (strlen(tail) >= PATH_MAX) {
|
||||
/* Locate a dir prefix shorter than PATH_MAX. */
|
||||
tail += PATH_MAX - 8;
|
||||
while (tail > a->name && *tail != '/')
|
||||
@@ -1996,6 +2008,10 @@ create_filesystem_object(struct archive_write_disk *a)
|
||||
const char *linkname;
|
||||
mode_t final_mode, mode;
|
||||
int r;
|
||||
/* these for check_symlinks_fsobj */
|
||||
char *linkname_copy; /* non-const copy of linkname */
|
||||
struct archive_string error_string;
|
||||
int error_number;
|
||||
|
||||
/* We identify hard/symlinks according to the link names. */
|
||||
/* Since link(2) and symlink(2) don't handle modes, we're done here. */
|
||||
@@ -2004,6 +2020,27 @@ create_filesystem_object(struct archive_write_disk *a)
|
||||
#if !HAVE_LINK
|
||||
return (EPERM);
|
||||
#else
|
||||
archive_string_init(&error_string);
|
||||
linkname_copy = strdup(linkname);
|
||||
if (linkname_copy == NULL) {
|
||||
return (EPERM);
|
||||
}
|
||||
/* TODO: consider using the cleaned-up path as the link target? */
|
||||
r = cleanup_pathname_fsobj(linkname_copy, &error_number, &error_string, a->flags);
|
||||
if (r != ARCHIVE_OK) {
|
||||
archive_set_error(&a->archive, error_number, "%s", error_string.s);
|
||||
free(linkname_copy);
|
||||
/* EPERM is more appropriate than error_number for our callers */
|
||||
return (EPERM);
|
||||
}
|
||||
r = check_symlinks_fsobj(linkname_copy, &error_number, &error_string, a->flags);
|
||||
if (r != ARCHIVE_OK) {
|
||||
archive_set_error(&a->archive, error_number, "%s", error_string.s);
|
||||
free(linkname_copy);
|
||||
/* EPERM is more appropriate than error_number for our callers */
|
||||
return (EPERM);
|
||||
}
|
||||
free(linkname_copy);
|
||||
r = link(linkname, a->name) ? errno : 0;
|
||||
/*
|
||||
* New cpio and pax formats allow hardlink entries
|
||||
@@ -2022,7 +2059,7 @@ create_filesystem_object(struct archive_write_disk *a)
|
||||
a->deferred = 0;
|
||||
} else if (r == 0 && a->filesize > 0) {
|
||||
a->fd = open(a->name,
|
||||
O_WRONLY | O_TRUNC | O_BINARY | O_CLOEXEC);
|
||||
O_WRONLY | O_TRUNC | O_BINARY | O_CLOEXEC | O_NOFOLLOW);
|
||||
__archive_ensure_cloexec_flag(a->fd);
|
||||
if (a->fd < 0)
|
||||
r = errno;
|
||||
@@ -2332,110 +2369,233 @@ current_fixup(struct archive_write_disk *a, const char *pathname)
|
||||
return (a->current_fixup);
|
||||
}
|
||||
|
||||
/* TODO: Make this work. */
|
||||
/*
|
||||
* TODO: The deep-directory support bypasses this; disable deep directory
|
||||
* support if we're doing symlink checks.
|
||||
*/
|
||||
/*
|
||||
* TODO: Someday, integrate this with the deep dir support; they both
|
||||
* scan the path and both can be optimized by comparing against other
|
||||
* recent paths.
|
||||
*/
|
||||
/* TODO: Extend this to support symlinks on Windows Vista and later. */
|
||||
|
||||
/*
|
||||
* Checks the given path to see if any elements along it are symlinks. Returns
|
||||
* ARCHIVE_OK if there are none, otherwise puts an error in errmsg.
|
||||
*/
|
||||
static int
|
||||
check_symlinks(struct archive_write_disk *a)
|
||||
check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags)
|
||||
{
|
||||
#if !defined(HAVE_LSTAT)
|
||||
/* Platform doesn't have lstat, so we can't look for symlinks. */
|
||||
(void)a; /* UNUSED */
|
||||
(void)path; /* UNUSED */
|
||||
(void)error_number; /* UNUSED */
|
||||
(void)error_string; /* UNUSED */
|
||||
(void)flags; /* UNUSED */
|
||||
return (ARCHIVE_OK);
|
||||
#else
|
||||
char *pn;
|
||||
int res = ARCHIVE_OK;
|
||||
char *tail;
|
||||
char *head;
|
||||
int last;
|
||||
char c;
|
||||
int r;
|
||||
struct stat st;
|
||||
int restore_pwd;
|
||||
|
||||
/* Nothing to do here if name is empty */
|
||||
if(path[0] == '\0')
|
||||
return (ARCHIVE_OK);
|
||||
|
||||
/*
|
||||
* Guard against symlink tricks. Reject any archive entry whose
|
||||
* destination would be altered by a symlink.
|
||||
*
|
||||
* Walk the filename in chunks separated by '/'. For each segment:
|
||||
* - if it doesn't exist, continue
|
||||
* - if it's symlink, abort or remove it
|
||||
* - if it's a directory and it's not the last chunk, cd into it
|
||||
* As we go:
|
||||
* head points to the current (relative) path
|
||||
* tail points to the temporary \0 terminating the segment we're currently examining
|
||||
* c holds what used to be in *tail
|
||||
* last is 1 if this is the last tail
|
||||
*/
|
||||
/* Whatever we checked last time doesn't need to be re-checked. */
|
||||
pn = a->name;
|
||||
if (archive_strlen(&(a->path_safe)) > 0) {
|
||||
char *p = a->path_safe.s;
|
||||
while ((*pn != '\0') && (*p == *pn))
|
||||
++p, ++pn;
|
||||
}
|
||||
c = pn[0];
|
||||
/* Keep going until we've checked the entire name. */
|
||||
while (pn[0] != '\0' && (pn[0] != '/' || pn[1] != '\0')) {
|
||||
restore_pwd = open(".", O_RDONLY | O_BINARY | O_CLOEXEC);
|
||||
__archive_ensure_cloexec_flag(restore_pwd);
|
||||
if (restore_pwd < 0)
|
||||
return (ARCHIVE_FATAL);
|
||||
head = path;
|
||||
tail = path;
|
||||
last = 0;
|
||||
/* TODO: reintroduce a safe cache here? */
|
||||
/* Skip the root directory if the path is absolute. */
|
||||
if(tail == path && tail[0] == '/')
|
||||
++tail;
|
||||
/* Keep going until we've checked the entire name.
|
||||
* head, tail, path all alias the same string, which is
|
||||
* temporarily zeroed at tail, so be careful restoring the
|
||||
* stashed (c=tail[0]) for error messages.
|
||||
* Exiting the loop with break is okay; continue is not.
|
||||
*/
|
||||
while (!last) {
|
||||
/* Skip the separator we just consumed, plus any adjacent ones */
|
||||
while (*tail == '/')
|
||||
++tail;
|
||||
/* Skip the next path element. */
|
||||
while (*pn != '\0' && *pn != '/')
|
||||
++pn;
|
||||
c = pn[0];
|
||||
pn[0] = '\0';
|
||||
while (*tail != '\0' && *tail != '/')
|
||||
++tail;
|
||||
/* is this the last path component? */
|
||||
last = (tail[0] == '\0') || (tail[0] == '/' && tail[1] == '\0');
|
||||
/* temporarily truncate the string here */
|
||||
c = tail[0];
|
||||
tail[0] = '\0';
|
||||
/* Check that we haven't hit a symlink. */
|
||||
r = lstat(a->name, &st);
|
||||
r = lstat(head, &st);
|
||||
if (r != 0) {
|
||||
tail[0] = c;
|
||||
/* We've hit a dir that doesn't exist; stop now. */
|
||||
if (errno == ENOENT)
|
||||
if (errno == ENOENT) {
|
||||
break;
|
||||
} else {
|
||||
/* Treat any other error as fatal - best to be paranoid here
|
||||
* Note: This effectively disables deep directory
|
||||
* support when security checks are enabled.
|
||||
* Otherwise, very long pathnames that trigger
|
||||
* an error here could evade the sandbox.
|
||||
* TODO: We could do better, but it would probably
|
||||
* require merging the symlink checks with the
|
||||
* deep-directory editing. */
|
||||
if (error_number) *error_number = errno;
|
||||
if (error_string)
|
||||
archive_string_sprintf(error_string,
|
||||
"Could not stat %s",
|
||||
path);
|
||||
res = ARCHIVE_FAILED;
|
||||
break;
|
||||
}
|
||||
} else if (S_ISDIR(st.st_mode)) {
|
||||
if (!last) {
|
||||
if (chdir(head) != 0) {
|
||||
tail[0] = c;
|
||||
if (error_number) *error_number = errno;
|
||||
if (error_string)
|
||||
archive_string_sprintf(error_string,
|
||||
"Could not chdir %s",
|
||||
path);
|
||||
res = (ARCHIVE_FATAL);
|
||||
break;
|
||||
}
|
||||
/* Our view is now from inside this dir: */
|
||||
head = tail + 1;
|
||||
}
|
||||
} else if (S_ISLNK(st.st_mode)) {
|
||||
if (c == '\0') {
|
||||
if (last) {
|
||||
/*
|
||||
* Last element is symlink; remove it
|
||||
* so we can overwrite it with the
|
||||
* item being extracted.
|
||||
*/
|
||||
if (unlink(a->name)) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Could not remove symlink %s",
|
||||
a->name);
|
||||
pn[0] = c;
|
||||
return (ARCHIVE_FAILED);
|
||||
if (unlink(head)) {
|
||||
tail[0] = c;
|
||||
if (error_number) *error_number = errno;
|
||||
if (error_string)
|
||||
archive_string_sprintf(error_string,
|
||||
"Could not remove symlink %s",
|
||||
path);
|
||||
res = ARCHIVE_FAILED;
|
||||
break;
|
||||
}
|
||||
a->pst = NULL;
|
||||
/*
|
||||
* Even if we did remove it, a warning
|
||||
* is in order. The warning is silly,
|
||||
* though, if we're just replacing one
|
||||
* symlink with another symlink.
|
||||
*/
|
||||
if (!S_ISLNK(a->mode)) {
|
||||
archive_set_error(&a->archive, 0,
|
||||
"Removing symlink %s",
|
||||
a->name);
|
||||
tail[0] = c;
|
||||
/* FIXME: not sure how important this is to restore
|
||||
if (!S_ISLNK(path)) {
|
||||
if (error_number) *error_number = 0;
|
||||
if (error_string)
|
||||
archive_string_sprintf(error_string,
|
||||
"Removing symlink %s",
|
||||
path);
|
||||
}
|
||||
*/
|
||||
/* Symlink gone. No more problem! */
|
||||
pn[0] = c;
|
||||
return (0);
|
||||
} else if (a->flags & ARCHIVE_EXTRACT_UNLINK) {
|
||||
res = ARCHIVE_OK;
|
||||
break;
|
||||
} else if (flags & ARCHIVE_EXTRACT_UNLINK) {
|
||||
/* User asked us to remove problems. */
|
||||
if (unlink(a->name) != 0) {
|
||||
archive_set_error(&a->archive, 0,
|
||||
"Cannot remove intervening symlink %s",
|
||||
a->name);
|
||||
pn[0] = c;
|
||||
return (ARCHIVE_FAILED);
|
||||
if (unlink(head) != 0) {
|
||||
tail[0] = c;
|
||||
if (error_number) *error_number = 0;
|
||||
if (error_string)
|
||||
archive_string_sprintf(error_string,
|
||||
"Cannot remove intervening symlink %s",
|
||||
path);
|
||||
res = ARCHIVE_FAILED;
|
||||
break;
|
||||
}
|
||||
a->pst = NULL;
|
||||
tail[0] = c;
|
||||
} else {
|
||||
archive_set_error(&a->archive, 0,
|
||||
"Cannot extract through symlink %s",
|
||||
a->name);
|
||||
pn[0] = c;
|
||||
return (ARCHIVE_FAILED);
|
||||
tail[0] = c;
|
||||
if (error_number) *error_number = 0;
|
||||
if (error_string)
|
||||
archive_string_sprintf(error_string,
|
||||
"Cannot extract through symlink %s",
|
||||
path);
|
||||
res = ARCHIVE_FAILED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* be sure to always maintain this */
|
||||
tail[0] = c;
|
||||
if (tail[0] != '\0')
|
||||
tail++; /* Advance to the next segment. */
|
||||
}
|
||||
pn[0] = c;
|
||||
/* We've checked and/or cleaned the whole path, so remember it. */
|
||||
archive_strcpy(&a->path_safe, a->name);
|
||||
return (ARCHIVE_OK);
|
||||
/* Catches loop exits via break */
|
||||
tail[0] = c;
|
||||
#ifdef HAVE_FCHDIR
|
||||
/* If we changed directory above, restore it here. */
|
||||
if (restore_pwd >= 0) {
|
||||
r = fchdir(restore_pwd);
|
||||
if (r != 0) {
|
||||
if(error_number) *error_number = errno;
|
||||
if(error_string)
|
||||
archive_string_sprintf(error_string,
|
||||
"chdir() failure");
|
||||
}
|
||||
close(restore_pwd);
|
||||
restore_pwd = -1;
|
||||
if (r != 0) {
|
||||
res = (ARCHIVE_FATAL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* TODO: reintroduce a safe cache here? */
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Check a->name for symlinks, returning ARCHIVE_OK if its clean, otherwise
|
||||
* calls archive_set_error and returns ARCHIVE_{FATAL,FAILED}
|
||||
*/
|
||||
static int
|
||||
check_symlinks(struct archive_write_disk *a)
|
||||
{
|
||||
struct archive_string error_string;
|
||||
int error_number;
|
||||
int rc;
|
||||
archive_string_init(&error_string);
|
||||
rc = check_symlinks_fsobj(a->name, &error_number, &error_string, a->flags);
|
||||
if (rc != ARCHIVE_OK) {
|
||||
archive_set_error(&a->archive, error_number, "%s", error_string.s);
|
||||
}
|
||||
archive_string_free(&error_string);
|
||||
a->pst = NULL; /* to be safe */
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
/*
|
||||
* 1. Convert a path separator from '\' to '/' .
|
||||
@@ -2504,19 +2664,22 @@ cleanup_pathname_win(struct archive_write_disk *a)
|
||||
/*
|
||||
* Canonicalize the pathname. In particular, this strips duplicate
|
||||
* '/' characters, '.' elements, and trailing '/'. It also raises an
|
||||
* error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
|
||||
* set) any '..' in the path.
|
||||
* error for an empty path, a trailing '..', (if _SECURE_NODOTDOT is
|
||||
* set) any '..' in the path or (if ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS
|
||||
* is set) if the path is absolute.
|
||||
*/
|
||||
static int
|
||||
cleanup_pathname(struct archive_write_disk *a)
|
||||
cleanup_pathname_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags)
|
||||
{
|
||||
char *dest, *src;
|
||||
char separator = '\0';
|
||||
|
||||
dest = src = a->name;
|
||||
dest = src = path;
|
||||
if (*src == '\0') {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"Invalid empty pathname");
|
||||
if (error_number) *error_number = ARCHIVE_ERRNO_MISC;
|
||||
if (error_string)
|
||||
archive_string_sprintf(error_string,
|
||||
"Invalid empty pathname");
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
@@ -2524,8 +2687,17 @@ cleanup_pathname(struct archive_write_disk *a)
|
||||
cleanup_pathname_win(a);
|
||||
#endif
|
||||
/* Skip leading '/'. */
|
||||
if (*src == '/')
|
||||
if (*src == '/') {
|
||||
if (flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {
|
||||
if (error_number) *error_number = ARCHIVE_ERRNO_MISC;
|
||||
if (error_string)
|
||||
archive_string_sprintf(error_string,
|
||||
"Path is absolute");
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
separator = *src++;
|
||||
}
|
||||
|
||||
/* Scan the pathname one element at a time. */
|
||||
for (;;) {
|
||||
@@ -2547,10 +2719,11 @@ cleanup_pathname(struct archive_write_disk *a)
|
||||
} else if (src[1] == '.') {
|
||||
if (src[2] == '/' || src[2] == '\0') {
|
||||
/* Conditionally warn about '..' */
|
||||
if (a->flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {
|
||||
archive_set_error(&a->archive,
|
||||
ARCHIVE_ERRNO_MISC,
|
||||
"Path contains '..'");
|
||||
if (flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {
|
||||
if (error_number) *error_number = ARCHIVE_ERRNO_MISC;
|
||||
if (error_string)
|
||||
archive_string_sprintf(error_string,
|
||||
"Path contains '..'");
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -2581,7 +2754,7 @@ cleanup_pathname(struct archive_write_disk *a)
|
||||
* We've just copied zero or more path elements, not including the
|
||||
* final '/'.
|
||||
*/
|
||||
if (dest == a->name) {
|
||||
if (dest == path) {
|
||||
/*
|
||||
* Nothing got copied. The path must have been something
|
||||
* like '.' or '/' or './' or '/././././/./'.
|
||||
@@ -2596,6 +2769,21 @@ cleanup_pathname(struct archive_write_disk *a)
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
cleanup_pathname(struct archive_write_disk *a)
|
||||
{
|
||||
struct archive_string error_string;
|
||||
int error_number;
|
||||
int rc;
|
||||
archive_string_init(&error_string);
|
||||
rc = cleanup_pathname_fsobj(a->name, &error_number, &error_string, a->flags);
|
||||
if (rc != ARCHIVE_OK) {
|
||||
archive_set_error(&a->archive, error_number, "%s", error_string.s);
|
||||
}
|
||||
archive_string_free(&error_string);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the parent directory of the specified path, assuming path
|
||||
* is already in mutable storage.
|
||||
|
||||
@@ -1396,6 +1396,31 @@ assertion_file_size(const char *file, int line, const char *pathname, long size)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Verify mode of 'pathname'. */
|
||||
int
|
||||
assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode)
|
||||
{
|
||||
int mode;
|
||||
int r;
|
||||
|
||||
assertion_count(file, line);
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
failure_start(file, line, "assertFileMode not yet implemented for Windows");
|
||||
#else
|
||||
{
|
||||
struct stat st;
|
||||
r = lstat(pathname, &st);
|
||||
mode = (int)(st.st_mode & 0777);
|
||||
}
|
||||
if (r == 0 && mode == expected_mode)
|
||||
return (1);
|
||||
failure_start(file, line, "File %s has mode %o, expected %o",
|
||||
pathname, mode, expected_mode);
|
||||
#endif
|
||||
failure_finish(NULL);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */
|
||||
int
|
||||
assertion_is_dir(const char *file, int line, const char *pathname, int mode)
|
||||
|
||||
@@ -176,6 +176,8 @@
|
||||
assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks)
|
||||
#define assertFileSize(pathname, size) \
|
||||
assertion_file_size(__FILE__, __LINE__, pathname, size)
|
||||
#define assertFileMode(pathname, mode) \
|
||||
assertion_file_mode(__FILE__, __LINE__, pathname, mode)
|
||||
#define assertTextFileContents(text, pathname) \
|
||||
assertion_text_file_contents(__FILE__, __LINE__, text, pathname)
|
||||
#define assertFileContainsLinesAnyOrder(pathname, lines) \
|
||||
@@ -239,6 +241,7 @@ int assertion_file_mtime_recent(const char *, int, const char *);
|
||||
int assertion_file_nlinks(const char *, int, const char *, int);
|
||||
int assertion_file_not_exists(const char *, int, const char *);
|
||||
int assertion_file_size(const char *, int, const char *, long);
|
||||
int assertion_file_mode(const char *, int, const char *, int);
|
||||
int assertion_is_dir(const char *, int, const char *, int);
|
||||
int assertion_is_hardlink(const char *, int, const char *, const char *);
|
||||
int assertion_is_not_hardlink(const char *, int, const char *, const char *);
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
/*-
|
||||
* Copyright (c) 2014 Michihiro NAKAJIMA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "test.h"
|
||||
__FBSDID("$FreeBSD");
|
||||
|
||||
/*
|
||||
* To test skip a sparse file entry, this test does not read file data.
|
||||
*/
|
||||
DEFINE_TEST(test_read_format_gtar_sparse_skip_entry)
|
||||
{
|
||||
#ifndef __FreeBSD__ /* Backport test. */
|
||||
const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z.uu";
|
||||
#else
|
||||
const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z";
|
||||
#endif
|
||||
struct archive *a;
|
||||
struct archive_entry *ae;
|
||||
const void *p;
|
||||
size_t s;
|
||||
int64_t o;
|
||||
|
||||
#ifndef __FreeBSD__ /* Backport test. */
|
||||
copy_reference_file(refname);
|
||||
#else
|
||||
extract_reference_file(refname);
|
||||
#endif
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
|
||||
assertEqualIntA(a, ARCHIVE_OK,
|
||||
archive_read_open_filename(a, refname, 10240));
|
||||
|
||||
/* Verify regular first file. */
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("a", archive_entry_pathname(ae));
|
||||
assertEqualInt(10737418244, archive_entry_size(ae));
|
||||
#ifndef __FreeBSD__ /* Backport test. */
|
||||
assertEqualInt(archive_entry_is_encrypted(ae), 0);
|
||||
assertEqualIntA(a, archive_read_has_encrypted_entries(a),
|
||||
ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
|
||||
#endif
|
||||
|
||||
/* Verify regular second file. */
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("b", archive_entry_pathname(ae));
|
||||
assertEqualInt(4, archive_entry_size(ae));
|
||||
#ifndef __FreeBSD__ /* Backport test. */
|
||||
assertEqualInt(archive_entry_is_encrypted(ae), 0);
|
||||
assertEqualIntA(a, archive_read_has_encrypted_entries(a),
|
||||
ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
|
||||
#endif
|
||||
|
||||
|
||||
/* End of archive. */
|
||||
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
|
||||
|
||||
/* Verify archive format. */
|
||||
assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0));
|
||||
assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE,
|
||||
archive_format(a));
|
||||
|
||||
/* Close the archive. */
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
|
||||
|
||||
/*
|
||||
* Read just one block of a sparse file and skip it.
|
||||
*/
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
|
||||
assertEqualIntA(a, ARCHIVE_OK,
|
||||
archive_read_open_filename(a, refname, 10240));
|
||||
|
||||
/* Verify regular first file. */
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("a", archive_entry_pathname(ae));
|
||||
assertEqualInt(10737418244, archive_entry_size(ae));
|
||||
#ifndef __FreeBSD__ /* Backport test. */
|
||||
assertEqualInt(archive_entry_is_encrypted(ae), 0);
|
||||
assertEqualIntA(a, archive_read_has_encrypted_entries(a),
|
||||
ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
|
||||
#endif
|
||||
assertEqualInt(0, archive_read_data_block(a, &p, &s, &o));
|
||||
assertEqualInt(4096, s);
|
||||
assertEqualInt(0, o);
|
||||
|
||||
|
||||
/* Verify regular second file. */
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("b", archive_entry_pathname(ae));
|
||||
assertEqualInt(4, archive_entry_size(ae));
|
||||
#ifndef __FreeBSD__ /* Backport test. */
|
||||
assertEqualInt(archive_entry_is_encrypted(ae), 0);
|
||||
assertEqualIntA(a, archive_read_has_encrypted_entries(a),
|
||||
ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
|
||||
#endif
|
||||
|
||||
|
||||
/* End of archive. */
|
||||
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
|
||||
|
||||
/* Verify archive format. */
|
||||
assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0));
|
||||
assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE,
|
||||
archive_format(a));
|
||||
|
||||
/* Close the archive. */
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
begin 644 -
|
||||
M'YV04,+@05(F#)DR<EZ$`<"PH<.'$"-*G$BQHL6*,#+:L$$#!(",,6[4@.$1
|
||||
MI$B2'S.JS#A#A@P0,63,L`$C!HP9-VB\K"FCAHT8`$#@N4BTJ-&C2"/6F4,G
|
||||
MC)R48^J424HQZE2J$E=F+*G5(]:O8,.*'3M6!LDY:?24Z6'S!DX:,7#(H$%#
|
||||
MP0R2;>BD:;,V!@T8-6)NE&'#10T<-#;>R(%CAEV28_3R9?LW\(P8-F[`<#%C
|
||||
M)@T<->#6>`PBC.2^E07;J#'#Q>J-F5DJ<`GBB),J+N;`<3JGC(LV8=2\D<-V
|
||||
M]DO;N'7S]MTFC9OA/6#,CE'[=N[=<GJ[<!-F<AB[-:HGQZY=3D$V:-6RA>$V
|
||||
M9]RY=<G*GT^_OOW[^/.#13Z%?!DC:;!1AD+Z%6B12AMUE%)((W'%($I:U603
|
||||
M#!W%-%---^6T4PPM8184#`:&"-9233V5D57SH2A?A%RMY)6(,,8HHPP*2/=7
|
||||
M#C8HT-9;[_VE0'PR!BGDD$06:>212"9YD1EOO*&`DE!&*>645%9IY9589JGE
|
||||
MEEQVZ>678(8IYIADEFGFF6BFJ>::;+;IYIMPQBGGG'36:>>=>.:IYYY\]NGG
|
||||
MGX`&*NB@A!9JJ)YB](D@1PZ>U&B#*468484RT11###7<8!8(&-)4PX=^DN@4
|
||||
B5%*E6.J*746JTHN'2LFDDZW&*NNLM-9JZZVXYJKKKKR&!0``
|
||||
`
|
||||
end
|
||||
@@ -178,6 +178,29 @@ DEFINE_TEST(test_write_disk_secure)
|
||||
assert(S_ISDIR(st.st_mode));
|
||||
archive_entry_free(ae);
|
||||
|
||||
/*
|
||||
* Without security checks, we should be able to
|
||||
* extract an absolute path.
|
||||
*/
|
||||
assert((ae = archive_entry_new()) != NULL);
|
||||
archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp");
|
||||
archive_entry_set_mode(ae, S_IFREG | 0777);
|
||||
assert(0 == archive_write_header(a, ae));
|
||||
assert(0 == archive_write_finish_entry(a));
|
||||
assertFileExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp");
|
||||
assert(0 == unlink("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"));
|
||||
|
||||
/* But with security checks enabled, this should fail. */
|
||||
assert(archive_entry_clear(ae) != NULL);
|
||||
archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp");
|
||||
archive_entry_set_mode(ae, S_IFREG | 0777);
|
||||
archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS);
|
||||
failure("Extracting an absolute path should fail here.");
|
||||
assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae));
|
||||
archive_entry_free(ae);
|
||||
assert(0 == archive_write_finish_entry(a));
|
||||
assertFileNotExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp");
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_write_free(a));
|
||||
|
||||
/* Test the entries on disk. */
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007,2016 Tim Kientzle
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "test.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#define UMASK 022
|
||||
|
||||
/*
|
||||
* Github Issue #744 describes a bug in the sandboxing code that
|
||||
* causes very long pathnames to not get checked for symlinks.
|
||||
*/
|
||||
|
||||
DEFINE_TEST(test_write_disk_secure744)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
skipping("archive_write_disk security checks not supported on Windows");
|
||||
#else
|
||||
struct archive *a;
|
||||
struct archive_entry *ae;
|
||||
size_t buff_size = 8192;
|
||||
char *buff = malloc(buff_size);
|
||||
char *p = buff;
|
||||
int n = 0;
|
||||
int t;
|
||||
|
||||
assert(buff != NULL);
|
||||
|
||||
/* Start with a known umask. */
|
||||
assertUmask(UMASK);
|
||||
|
||||
/* Create an archive_write_disk object. */
|
||||
assert((a = archive_write_disk_new()) != NULL);
|
||||
archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS);
|
||||
|
||||
while (p + 500 < buff + buff_size) {
|
||||
memset(p, 'x', 100);
|
||||
p += 100;
|
||||
p[0] = '\0';
|
||||
|
||||
buff[0] = ((n / 1000) % 10) + '0';
|
||||
buff[1] = ((n / 100) % 10)+ '0';
|
||||
buff[2] = ((n / 10) % 10)+ '0';
|
||||
buff[3] = ((n / 1) % 10)+ '0';
|
||||
buff[4] = '_';
|
||||
++n;
|
||||
|
||||
/* Create a symlink pointing to the testworkdir */
|
||||
assert((ae = archive_entry_new()) != NULL);
|
||||
archive_entry_copy_pathname(ae, buff);
|
||||
archive_entry_set_mode(ae, S_IFREG | 0777);
|
||||
archive_entry_copy_symlink(ae, testworkdir);
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
|
||||
archive_entry_free(ae);
|
||||
|
||||
*p++ = '/';
|
||||
sprintf(p, "target%d", n);
|
||||
|
||||
/* Try to create a file through the symlink, should fail. */
|
||||
assert((ae = archive_entry_new()) != NULL);
|
||||
archive_entry_copy_pathname(ae, buff);
|
||||
archive_entry_set_mode(ae, S_IFDIR | 0777);
|
||||
|
||||
t = archive_write_header(a, ae);
|
||||
archive_entry_free(ae);
|
||||
failure("Attempt to create target%d via %d-character symlink should have failed", n, (int)strlen(buff));
|
||||
if(!assertEqualInt(ARCHIVE_FAILED, t)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
archive_free(a);
|
||||
free(buff);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007,2016 Tim Kientzle
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "test.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#define UMASK 022
|
||||
|
||||
/*
|
||||
* Github Issue #745 describes a bug in the sandboxing code that
|
||||
* allows one to use a symlink to edit the permissions on a file or
|
||||
* directory outside of the sandbox.
|
||||
*/
|
||||
|
||||
DEFINE_TEST(test_write_disk_secure745)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
skipping("archive_write_disk security checks not supported on Windows");
|
||||
#else
|
||||
struct archive *a;
|
||||
struct archive_entry *ae;
|
||||
|
||||
/* Start with a known umask. */
|
||||
assertUmask(UMASK);
|
||||
|
||||
/* Create an archive_write_disk object. */
|
||||
assert((a = archive_write_disk_new()) != NULL);
|
||||
archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS);
|
||||
|
||||
/* The target dir: The one we're going to try to change permission on */
|
||||
assertMakeDir("target", 0700);
|
||||
|
||||
/* The sandbox dir we're going to run inside of. */
|
||||
assertMakeDir("sandbox", 0700);
|
||||
assertChdir("sandbox");
|
||||
|
||||
/* Create a symlink pointing to the target directory */
|
||||
assert((ae = archive_entry_new()) != NULL);
|
||||
archive_entry_copy_pathname(ae, "sym");
|
||||
archive_entry_set_mode(ae, AE_IFLNK | 0777);
|
||||
archive_entry_copy_symlink(ae, "../target");
|
||||
assert(0 == archive_write_header(a, ae));
|
||||
archive_entry_free(ae);
|
||||
|
||||
/* Try to alter the target dir through the symlink; this should fail. */
|
||||
assert((ae = archive_entry_new()) != NULL);
|
||||
archive_entry_copy_pathname(ae, "sym");
|
||||
archive_entry_set_mode(ae, S_IFDIR | 0777);
|
||||
assert(0 == archive_write_header(a, ae));
|
||||
archive_entry_free(ae);
|
||||
|
||||
/* Permission of target dir should not have changed. */
|
||||
assertFileMode("../target", 0700);
|
||||
|
||||
assert(0 == archive_write_close(a));
|
||||
archive_write_free(a);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007,2016 Tim Kientzle
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "test.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#define UMASK 022
|
||||
|
||||
/*
|
||||
* Github Issue #746 describes a problem in which hardlink targets are
|
||||
* not adequately checked and can be used to modify entries outside of
|
||||
* the sandbox.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Verify that ARCHIVE_EXTRACT_SECURE_NODOTDOT disallows '..' in hardlink
|
||||
* targets.
|
||||
*/
|
||||
DEFINE_TEST(test_write_disk_secure746a)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
skipping("archive_write_disk security checks not supported on Windows");
|
||||
#else
|
||||
struct archive *a;
|
||||
struct archive_entry *ae;
|
||||
|
||||
/* Start with a known umask. */
|
||||
assertUmask(UMASK);
|
||||
|
||||
/* The target directory we're going to try to affect. */
|
||||
assertMakeDir("target", 0700);
|
||||
assertMakeFile("target/foo", 0700, "unmodified");
|
||||
|
||||
/* The sandbox dir we're going to work within. */
|
||||
assertMakeDir("sandbox", 0700);
|
||||
assertChdir("sandbox");
|
||||
|
||||
/* Create an archive_write_disk object. */
|
||||
assert((a = archive_write_disk_new()) != NULL);
|
||||
archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NODOTDOT);
|
||||
|
||||
/* Attempt to hardlink to the target directory. */
|
||||
assert((ae = archive_entry_new()) != NULL);
|
||||
archive_entry_copy_pathname(ae, "bar");
|
||||
archive_entry_set_mode(ae, AE_IFREG | 0777);
|
||||
archive_entry_set_size(ae, 8);
|
||||
archive_entry_copy_hardlink(ae, "../target/foo");
|
||||
assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae));
|
||||
assertEqualInt(ARCHIVE_FATAL, archive_write_data(a, "modified", 8));
|
||||
archive_entry_free(ae);
|
||||
|
||||
/* Verify that target file contents are unchanged. */
|
||||
assertTextFileContents("unmodified", "../target/foo");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify that ARCHIVE_EXTRACT_SECURE_NOSYMLINK disallows symlinks in hardlink
|
||||
* targets.
|
||||
*/
|
||||
DEFINE_TEST(test_write_disk_secure746b)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
skipping("archive_write_disk security checks not supported on Windows");
|
||||
#else
|
||||
struct archive *a;
|
||||
struct archive_entry *ae;
|
||||
|
||||
/* Start with a known umask. */
|
||||
assertUmask(UMASK);
|
||||
|
||||
/* The target directory we're going to try to affect. */
|
||||
assertMakeDir("target", 0700);
|
||||
assertMakeFile("target/foo", 0700, "unmodified");
|
||||
|
||||
/* The sandbox dir we're going to work within. */
|
||||
assertMakeDir("sandbox", 0700);
|
||||
assertChdir("sandbox");
|
||||
|
||||
/* Create an archive_write_disk object. */
|
||||
assert((a = archive_write_disk_new()) != NULL);
|
||||
archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS);
|
||||
|
||||
/* Create a symlink to the target directory. */
|
||||
assert((ae = archive_entry_new()) != NULL);
|
||||
archive_entry_copy_pathname(ae, "symlink");
|
||||
archive_entry_set_mode(ae, AE_IFLNK | 0777);
|
||||
archive_entry_copy_symlink(ae, "../target");
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
|
||||
archive_entry_free(ae);
|
||||
|
||||
/* Attempt to hardlink to the target directory via the symlink. */
|
||||
assert((ae = archive_entry_new()) != NULL);
|
||||
archive_entry_copy_pathname(ae, "bar");
|
||||
archive_entry_set_mode(ae, AE_IFREG | 0777);
|
||||
archive_entry_set_size(ae, 8);
|
||||
archive_entry_copy_hardlink(ae, "symlink/foo");
|
||||
assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
|
||||
assertEqualIntA(a, ARCHIVE_FATAL, archive_write_data(a, "modified", 8));
|
||||
archive_entry_free(ae);
|
||||
|
||||
/* Verify that target file contents are unchanged. */
|
||||
assertTextFileContents("unmodified", "../target/foo");
|
||||
|
||||
assertEqualIntA(a, ARCHIVE_FATAL, archive_write_close(a));
|
||||
archive_write_free(a);
|
||||
#endif
|
||||
}
|
||||
@@ -1,4 +1,403 @@
|
||||
---
|
||||
(4.2.8p9) 2016/11/21 Released by Harlan Stenn <[email protected]>
|
||||
(4.2.8p9) 2016/MM/DD Released by Harlan Stenn <[email protected]>
|
||||
|
||||
* [Sec 3119] Trap crash <[email protected]>
|
||||
* [Sec 3118] Mode 6 information disclosure and DDoS vector <[email protected]>
|
||||
- TRAP config via mode 6 packet requires AUTH now.
|
||||
* [Sec 3114] Broadcast Mode Replay Prevention DoS
|
||||
- applied patches by Matthew Van Gundy. <[email protected]>
|
||||
- with bcpollbstep, tweaks and cleanup by [email protected]
|
||||
* [Sec 3113] Broadcast Mode Poll Interval Enforcement DoS <[email protected]>
|
||||
- applied fix as suggested by Matthew Van Gundy
|
||||
* [Sec 3110] Windows: ntpd DoS by oversized UDP packet
|
||||
- fixed error handling for truncated UDP packets. <[email protected]>
|
||||
* [Sec 3102] Zero origin issues. HStenn.
|
||||
* [Sec 3082] null pointer dereference in _IO_str_init_static_internal()
|
||||
- more hardening to read_mru_list(). [email protected]
|
||||
* [Sec 3072] Attack on interface selection <[email protected]>
|
||||
- implemented Miroslav Lichvars <[email protected]> suggestion
|
||||
to skip interface updates based on incoming packets
|
||||
* [Bug 3142] bug in netmask prefix length detection <[email protected]>
|
||||
* [Bug 3138] gpsdjson refclock should honor fudgetime1. [email protected]
|
||||
* [Bug 3129] Unknown hosts can put resolver thread into a hard loop
|
||||
- moved retry decision where it belongs. <[email protected]>
|
||||
* [Bug 3125] NTPD doesn't fully start when ntp.conf entries are out of order
|
||||
using the loopback-ppsapi-provider.dll <[email protected]>
|
||||
* [Bug 3116] unit tests for NTP time stamp expansion. <[email protected]>
|
||||
* [Bug 3100] ntpq can't retrieve daemon_version <[email protected]>
|
||||
- fixed extended sysvar lookup (bug introduced with bug 3008 fix)
|
||||
* [Bug 3095] Compatibility with openssl 1.1 <[email protected]>
|
||||
- applied patches by Kurt Roeckx <[email protected]> to source
|
||||
- added shim layer for SSL API calls with issues (both directions)
|
||||
* [Bug 3089] Serial Parser does not work anymore for hopfser like device
|
||||
- simplified / refactored hex-decoding in driver. <[email protected]>
|
||||
* [Bug 3084] update-leap mis-parses the leapfile name. HStenn.
|
||||
* [Bug 3068] Linker warnings when building on Solaris. [email protected]
|
||||
- applied patch thanks to Andrew Stormont <[email protected]>
|
||||
* [Bug 3067] Root distance calculation needs improvement. HStenn.
|
||||
* [Bug 3066] NMEA clock ignores pps. [email protected]
|
||||
- PPS-HACK works again.
|
||||
* [Bug 3059] Potential buffer overrun from oversized hash <[email protected]>
|
||||
- applied patch by Brian Utterback <[email protected]>
|
||||
* [Bug 3053] ntp_loopfilter.c frequency calc precedence error. Sarah White.
|
||||
* [Bug 3050] Fix for bug #2960 causes [...] spurious error message.
|
||||
<[email protected]>
|
||||
- patches by Reinhard Max <[email protected]> and Havard Eidnes <[email protected]>
|
||||
* [Bug 3047] Fix refclock_jjy C-DEX JST2000. [email protected]
|
||||
- Patch provided by Kuramatsu.
|
||||
* [Bug 3021] unity_fixture.c needs pragma weak <[email protected]>
|
||||
- removed unnecessary & harmful decls of 'setUp()' & 'tearDown()'
|
||||
* [Bug 3019] Windows: ERROR_HOST_UNREACHABLE block packet processing.
|
||||
DMayer and JPerlinger.
|
||||
* [Bug 2998] sntp/tests/packetProcessing.c broken without openssl. JPerlinger
|
||||
* [Bug 2961] sntp/tests/packetProcessing.c assumes AUTOKEY. HStenn.
|
||||
* [Bug 2959] refclock_jupiter: gps week correction <[email protected]>
|
||||
- fixed GPS week expansion to work based on build date. Special thanks
|
||||
to Craig Leres for initial patch and testing.
|
||||
* [Bug 2951] ntpd tests fail: multiple definition of `send_via_ntp_signd'
|
||||
- fixed Makefile.am <[email protected]>
|
||||
* [Bug 2689] ATOM driver processes last PPS pulse at startup,
|
||||
even if it is very old <[email protected]>
|
||||
- make sure PPS source is alive before processing samples
|
||||
- improve stability close to the 500ms phase jump (phase gate)
|
||||
* Fix typos in include/ntp.h.
|
||||
* Shim X509_get_signature_nid() if needed.
|
||||
* git author attribution cleanup
|
||||
* bk ignore file cleanup
|
||||
* remove locks in Windows IO, use rpc-like thread synchronisation instead
|
||||
|
||||
---
|
||||
(4.2.8p8) 2016/06/02 Released by Harlan Stenn <[email protected]>
|
||||
|
||||
* [Sec 3042] Broadcast Interleave. HStenn.
|
||||
* [Sec 3043] Autokey association reset. [email protected], [email protected]
|
||||
- validate origin timestamps on bad MACs, too. [email protected]
|
||||
* [Sec 3044] Spoofed server packets are partially processed. HStenn.
|
||||
* [Sec 3045] Bad authentication demobilizes ephemeral associations. JPerlinger.
|
||||
* [Sec 3046] CRYPTO_NAK crash. [email protected]
|
||||
* [Bug 3038] NTP fails to build in VS2015. [email protected]
|
||||
- provide build environment
|
||||
- 'wint_t' and 'struct timespec' defined by VS2015
|
||||
- fixed print()/scanf() format issues
|
||||
* [Bug 3052] Add a .gitignore file. Edmund Wong.
|
||||
* [Bug 3054] miscopt.html documents the allan intercept in seconds. SWhite.
|
||||
* [Bug 3058] fetch_timestamp() mishandles 64-bit alignment. Brian Utterback,
|
||||
JPerlinger, HStenn.
|
||||
* Update the NEWS file for 4.2.8p8. HStenn.
|
||||
* Fix typo in ntp-wait and plot_summary. HStenn.
|
||||
* Make sure we have an "author" file for git imports. HStenn.
|
||||
* Update the sntp problem tests for MacOS. HStenn.
|
||||
|
||||
---
|
||||
(4.2.8p7) 2016/04/26 Released by Harlan Stenn <[email protected]>
|
||||
|
||||
* [Sec 2901] KoD packets must have non-zero transmit timestamps. HStenn.
|
||||
* [Sec 2936] Skeleton Key: Any system knowing the trusted key can serve
|
||||
time. Include passive servers in this check. HStenn.
|
||||
* [Sec 2945] Additional KoD packet checks. HStenn.
|
||||
* [Sec 2978] Interleave can be partially triggered. HStenn.
|
||||
* [Sec 3007] Validate crypto-NAKs. Danny Mayer.
|
||||
* [Sec 3008] Always check the return value of ctl_getitem().
|
||||
- initial work by HStenn
|
||||
- Additional cleanup of ctl_getitem by [email protected]
|
||||
* [Sec 3009] Crafted addpeer with hmode > 7 causes OOB error. [email protected]
|
||||
- added more stringent checks on packet content
|
||||
* [Sec 3010] remote configuration trustedkey/requestkey values
|
||||
are not properly validated. [email protected]
|
||||
- sidekick: Ignore keys that have an unsupported MAC algorithm
|
||||
but are otherwise well-formed
|
||||
* [Sec 3011] Duplicate IPs on unconfig directives will cause an assertion botch
|
||||
- graciously accept the same IP multiple times. [email protected]
|
||||
* [Sec 3020] Refclock impersonation. HStenn.
|
||||
* [Bug 2831] Segmentation Fault in DNS lookup during startup. [email protected]
|
||||
- fixed yet another race condition in the threaded resolver code.
|
||||
* [Bug 2858] bool support. Use stdbool.h when available. HStenn.
|
||||
* [Bug 2879] Improve NTP security against timing attacks. [email protected]
|
||||
- integrated patches by Loganaden Velvidron <[email protected]>
|
||||
with some modifications & unit tests
|
||||
* [Bug 2952] Symmetric active/passive mode is broken. HStenn.
|
||||
* [Bug 2960] async name resolution fixes for chroot() environments.
|
||||
Reinhard Max.
|
||||
* [Bug 2994] Systems with HAVE_SIGNALED_IO fail to compile. [email protected]
|
||||
* [Bug 2995] Fixes to compile on Windows
|
||||
* [Bug 2999] out-of-bounds access in 'is_safe_filename()'. [email protected]
|
||||
* [Bug 3013] Fix for ssl_init.c SHA1 test. [email protected]
|
||||
- Patch provided by Ch. Weisgerber
|
||||
* [Bug 3015] ntpq: config-from-file: "request contains an unprintable character"
|
||||
- A change related to [Bug 2853] forbids trailing white space in
|
||||
remote config commands. [email protected]
|
||||
* [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE
|
||||
- report and patch from Aleksandr Kostikov.
|
||||
- Overhaul of Windows IO completion port handling. [email protected]
|
||||
* [Bug 3022] authkeys.c should be refactored. [email protected]
|
||||
- fixed memory leak in access list (auth[read]keys.c)
|
||||
- refactored handling of key access lists (auth[read]keys.c)
|
||||
- reduced number of error branches (authreadkeys.c)
|
||||
* [Bug 3023] ntpdate cannot correct dates in the future. [email protected]
|
||||
* [Bug 3030] ntpq needs a general way to specify refid output format. HStenn.
|
||||
* [Bug 3031] ntp broadcastclient unable to synchronize to an server
|
||||
when the time of server changed. [email protected]
|
||||
- Check the initial delay calculation and reject/unpeer the broadcast
|
||||
server if the delay exceeds 50ms. Retry again after the next
|
||||
broadcast packet.
|
||||
* [Bug 3036] autokey trips an INSIST in authistrustedip(). Harlan Stenn.
|
||||
* Document ntp.key's optional IP list in authenetic.html. Harlan Stenn.
|
||||
* Update html/xleave.html documentation. Harlan Stenn.
|
||||
* Update ntp.conf documentation. Harlan Stenn.
|
||||
* Fix some Credit: attributions in the NEWS file. Harlan Stenn.
|
||||
* Fix typo in html/monopt.html. Harlan Stenn.
|
||||
* Add README.pullrequests. Harlan Stenn.
|
||||
* Cleanup to include/ntp.h. Harlan Stenn.
|
||||
|
||||
---
|
||||
(4.2.8p6) 2016/01/20 Released by Harlan Stenn <[email protected]>
|
||||
|
||||
* [Sec 2935] Deja Vu: Replay attack on authenticated broadcast mode. HStenn.
|
||||
* [Sec 2936] Skeleton Key: Any trusted key system can serve time. HStenn.
|
||||
* [Sec 2937] ntpq: nextvar() missing length check. [email protected]
|
||||
* [Sec 2938] ntpq saveconfig command allows dangerous characters
|
||||
in filenames. [email protected]
|
||||
* [Sec 2939] reslist NULL pointer dereference. [email protected]
|
||||
* [Sec 2940] Stack exhaustion in recursive traversal of restriction
|
||||
list. [email protected]
|
||||
* [Sec 2942]: Off-path DoS attack on auth broadcast mode. HStenn.
|
||||
* [Sec 2945] Zero Origin Timestamp Bypass. [email protected]
|
||||
* [Sec 2948] Potential Infinite Loop in ntpq ( and ntpdc) [email protected]
|
||||
* [Bug 2772] adj_systime overflows tv_usec. [email protected]
|
||||
* [Bug 2814] msyslog deadlock when signaled. [email protected]
|
||||
- applied patch by [email protected] with minor adjustments
|
||||
* [Bug 2882] Look at ntp_request.c:list_peers_sum(). [email protected]
|
||||
* [Bug 2891] Deadlock in deferred DNS lookup framework. [email protected]
|
||||
* [Bug 2892] Several test cases assume IPv6 capabilities even when
|
||||
IPv6 is disabled in the build. [email protected]
|
||||
- Found this already fixed, but validation led to cleanup actions.
|
||||
* [Bug 2905] DNS lookups broken. [email protected]
|
||||
- added limits to stack consumption, fixed some return code handling
|
||||
* [Bug 2971] ntpq bails on ^C: select fails: Interrupted system call
|
||||
- changed stacked/nested handling of CTRL-C. [email protected]
|
||||
- make CTRL-C work for retrieval and printing od MRU list. [email protected]
|
||||
* [Bug 2980] reduce number of warnings. [email protected]
|
||||
- integrated several patches from Havard Eidnes ([email protected])
|
||||
* [Bug 2985] bogus calculation in authkeys.c [email protected]
|
||||
- implement 'auth_log2()' using integer bithack instead of float calculation
|
||||
* Make leapsec_query debug messages less verbose. Harlan Stenn.
|
||||
* Disable incomplete t-ntp_signd.c test. Harlan Stenn.
|
||||
|
||||
---
|
||||
(4.2.8p5) 2016/01/07 Released by Harlan Stenn <[email protected]>
|
||||
|
||||
* [Sec 2956] small-step/big-step. Close the panic gate earlier. HStenn.
|
||||
* CID 1339955: Free allocated memory in caljulian test. HStenn.
|
||||
* CID 1339962: Explicitly initialize variable in caljulian test. HStenn.
|
||||
* CID 1341527: Quiet a CHECKED_RETURN in sntp/tests/t-log.c. HStenn.
|
||||
* CID 1341533: Missing assertion in sntp/tests/t-log.c. HStenn.
|
||||
* CID 1341534: Resource leak in tests/ntpd/t-ntp_signd.c. HStenn.
|
||||
* CID 1341535: Resource leak in tests/ntpd/t-ntp_signd.c. HStenn.
|
||||
* CID 1341536: Resource leak in tests/ntpd/t-ntp_signd.c. HStenn.
|
||||
* CID 1341537: Resource leak in tests/ntpd/t-ntp_signd.c. HStenn.
|
||||
* CID 1341538: Memory leak in tests/ntpd/ntp_prio_q.c:262. HStenn.
|
||||
* CID 1341677: Nits in sntp/tests/keyFile.c. HStenn.
|
||||
* CID 1341678: Nits in sntp/tests/keyFile.c. HStenn.
|
||||
* CID 1341679: Nits in sntp/tests/keyFile.c. HStenn.
|
||||
* CID 1341680: Nits in sntp/tests/keyFile.c. HStenn.
|
||||
* CID 1341681: Nits in sntp/tests/keyFile.c. HStenn.
|
||||
* CID 1341682: Nit in libntp/authreadkeys.c. HStenn.
|
||||
* CID 1341684: Nit in tests/ntpd/t-ntp_signd.c. HStenn.
|
||||
* [Bug 2829] Look at pipe_fds in ntpd.c (did so. [email protected])
|
||||
* [Bug 2887] stratum -1 config results as showing value 99
|
||||
- fudge stratum should only accept values [0..16]. [email protected]
|
||||
* [Bug 2932] Update leapsecond file info in miscopt.html. CWoodbury, HStenn.
|
||||
* [Bug 2934] tests/ntpd/t-ntp_scanner.c has a magic constant wired in. HMurray
|
||||
* [Bug 2944] errno is not preserved properly in ntpdate after sendto call.
|
||||
- applied patch by Christos Zoulas. [email protected]
|
||||
* [Bug 2952] Symmetric active/passive mode is broken. HStenn.
|
||||
* [Bug 2954] Version 4.2.8p4 crashes on startup with sig fault
|
||||
- fixed data race conditions in threaded DNS worker. [email protected]
|
||||
- limit threading warm-up to linux; FreeBSD bombs on it. [email protected]
|
||||
* [Bug 2957] 'unsigned int' vs 'size_t' format clash. [email protected]
|
||||
- accept key file only if there are no parsing errors
|
||||
- fixed size_t/u_int format clash
|
||||
- fixed wrong use of 'strlcpy'
|
||||
* [Bug 2958] ntpq: fatal error messages need a final newline. Craig Leres.
|
||||
* [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets. [email protected]
|
||||
- fixed several other warnings (cast-alignment, missing const, missing prototypes)
|
||||
- promote use of 'size_t' for values that express a size
|
||||
- use ptr-to-const for read-only arguments
|
||||
- make sure SOCKET values are not truncated (win32-specific)
|
||||
- format string fixes
|
||||
* [Bug 2965] Local clock didn't work since 4.2.8p4. Martin Burnicki.
|
||||
* [Bug 2967] ntpdate command suffers an assertion failure
|
||||
- fixed ntp_rfc2553.c to return proper address length. [email protected]
|
||||
* [Bug 2969] Seg fault from ntpq/mrulist when looking at server with
|
||||
lots of clients. [email protected]
|
||||
* [Bug 2971] ntpq bails on ^C: select fails: Interrupted system call
|
||||
- changed stacked/nested handling of CTRL-C. [email protected]
|
||||
- make CTRL-C work for retrieval and printing od MRU list. [email protected]
|
||||
* Unity cleanup for FreeBSD-6.4. Harlan Stenn.
|
||||
* Unity test cleanup. Harlan Stenn.
|
||||
* Libevent autoconf pthread fixes for FreeBSD-10. Harlan Stenn.
|
||||
* Header cleanup in tests/sandbox/uglydate.c. Harlan Stenn.
|
||||
* Header cleanup in tests/libntp/sfptostr.c. Harlan Stenn.
|
||||
* Quiet a warning from clang. Harlan Stenn.
|
||||
* Update the NEWS file. Harlan Stenn.
|
||||
* Update scripts/calc_tickadj/Makefile.am. Harlan Stenn.
|
||||
|
||||
---
|
||||
(4.2.8p4) 2015/10/21 Released by Harlan Stenn <[email protected]>
|
||||
|
||||
* [Sec 2899] CVE-2014-9297 [email protected]
|
||||
* [Sec 2901] Drop invalid packet before checking KoD. Check for all KoD's.
|
||||
Danny Mayer. Log incoming packets that fail TEST2. Harlan Stenn.
|
||||
* [Sec 2902] configuration directives "pidfile" and "driftfile"
|
||||
should be local-only. [email protected] (patch by Miroslav Lichvar)
|
||||
* [Sec 2909] added missing call to 'free()' in ntp_crypto.c. [email protected]
|
||||
* [Sec 2913] TALOS-CAN-0052: crash by loop counter underrun. [email protected]
|
||||
* [Sec 2916] TALOS-CAN-0054: memory corruption in password store. JPerlinger
|
||||
* [Sec 2917] TALOS-CAN-0055: Infinite loop if extended logging enabled and
|
||||
the logfile and keyfile are the same. [email protected]
|
||||
* [Sec 1918] TALOS-CAN-0062: prevent directory traversal for VMS, too, when
|
||||
using 'saveconfig' command. [email protected]
|
||||
* [Bug 2919] TALOS-CAN-0063: avoid buffer overrun in ntpq. [email protected]
|
||||
* [Sec 2020] TALOS-CAN-0064: signed/unsiged clash could lead to buffer overun
|
||||
and memory corruption. [email protected]
|
||||
* [Sec 2921] TALOS-CAN-0065: password length memory corruption. JPerlinger.
|
||||
* [Sec 2922] decodenetnum() will ASSERT botch instead of returning FAIL
|
||||
on some bogus values. Harlan Stenn.
|
||||
* [Sec 2941] NAK to the Future: Symmetric association authentication
|
||||
bypass via crypto-NAK. Patch applied. [email protected]
|
||||
* [Bug 2332] (reopened) Exercise thread cancellation once before dropping
|
||||
privileges and limiting resources in NTPD removes the need to link
|
||||
forcefully against 'libgcc_s' which does not always work. J.Perlinger
|
||||
* [Bug 2595] ntpdate man page quirks. Hal Murray, Harlan Stenn.
|
||||
* [Bug 2625] Deprecate flag1 in local refclock. Hal Murray, Harlan Stenn.
|
||||
* [Bug 2817] Stop locking ntpd into memory by default under Linux. H.Stenn.
|
||||
* [Bug 2821] minor build issues: fixed refclock_gpsdjson.c. [email protected]
|
||||
* [Bug 2823] ntpsweep with recursive peers option doesn't work. H.Stenn.
|
||||
* [Bug 2849] Systems with more than one default route may never
|
||||
synchronize. Brian Utterback. Note that this patch might need to
|
||||
be reverted once Bug 2043 has been fixed.
|
||||
* [Bug 2864] 4.2.8p3 fails to compile on Windows. Juergen Perlinger
|
||||
* [Bug 2866] segmentation fault at initgroups(). Harlan Stenn.
|
||||
* [Bug 2867] ntpd with autokey active crashed by 'ntpq -crv'. J.Perlinger
|
||||
* [Bug 2873] libevent should not include .deps/ in the tarball. H.Stenn
|
||||
* [Bug 2874] Don't distribute generated sntp/tests/fileHandlingTest.h. H.Stenn
|
||||
* [Bug 2875] sntp/Makefile.am: Get rid of DIST_SUBDIRS. libevent must
|
||||
be configured for the distribution targets. Harlan Stenn.
|
||||
* [Bug 2883] ntpd crashes on exit with empty driftfile. Miroslav Lichvar.
|
||||
* [Bug 2886] Mis-spelling: "outlyer" should be "outlier". [email protected]
|
||||
* [Bug 2888] streamline calendar functions. [email protected]
|
||||
* [Bug 2889] ntp-dev-4.3.67 does not build on Windows. [email protected]
|
||||
* [Bug 2890] Ignore ENOBUFS on routing netlink socket. Konstantin Khlebnikov.
|
||||
* [Bug 2906] make check needs better support for pthreads. Harlan Stenn.
|
||||
* [Bug 2907] dist* build targets require our libevent/ to be enabled. HStenn.
|
||||
* [Bug 2912] no munlockall() under Windows. David Taylor, Harlan Stenn.
|
||||
* libntp/emalloc.c: Remove explicit include of stdint.h. Harlan Stenn.
|
||||
* Put Unity CPPFLAGS items in unity_config.h. Harlan Stenn.
|
||||
* tests/ntpd/g_leapsec.cpp typo fix. Harlan Stenn.
|
||||
* Phase 1 deprecation of google test in sntp/tests/. Harlan Stenn.
|
||||
* On some versions of HP-UX, inttypes.h does not include stdint.h. H.Stenn.
|
||||
* top_srcdir can change based on ntp v. sntp. Harlan Stenn.
|
||||
* sntp/tests/ function parameter list cleanup. Damir Tomić.
|
||||
* tests/libntp/ function parameter list cleanup. Damir Tomić.
|
||||
* tests/ntpd/ function parameter list cleanup. Damir Tomić.
|
||||
* sntp/unity/unity_config.h: handle stdint.h. Harlan Stenn.
|
||||
* sntp/unity/unity_internals.h: handle *INTPTR_MAX on old Solaris. H.Stenn.
|
||||
* tests/libntp/timevalops.c and timespecops.c fixed error printing. D.Tomić.
|
||||
* tests/libntp/ improvements in code and fixed error printing. Damir Tomić.
|
||||
* tests/libntp: a_md5encrypt.c, authkeys.c, buftvtots.c, calendar.c, caljulian.c,
|
||||
caltontp.c, clocktime.c, humandate.c, hextolfp.c, decodenetnum.c - fixed
|
||||
formatting; first declaration, then code (C90); deleted unnecessary comments;
|
||||
changed from sprintf to snprintf; fixed order of includes. Tomasz Flendrich
|
||||
* tests/libntp/lfpfunc.c remove unnecessary include, remove old comments,
|
||||
fix formatting, cleanup. Tomasz Flendrich
|
||||
* tests/libntp/lfptostr.c remove unnecessary include, add consts, fix formatting.
|
||||
Tomasz Flendrich
|
||||
* tests/libntp/statestr.c remove empty functions, remove unnecessary include,
|
||||
fix formatting. Tomasz Flendrich
|
||||
* tests/libntp/modetoa.c fixed formatting. Tomasz Flendrich
|
||||
* tests/libntp/msyslog.c fixed formatting. Tomasz Flendrich
|
||||
* tests/libntp/numtoa.c deleted unnecessary empty functions, fixed formatting.
|
||||
Tomasz Flendrich
|
||||
* tests/libntp/numtohost.c added const, fixed formatting. Tomasz Flendrich
|
||||
* tests/libntp/refnumtoa.c fixed formatting. Tomasz Flendrich
|
||||
* tests/libntp/ssl_init.c fixed formatting. Tomasz Flendrich
|
||||
* tests/libntp/tvtots.c fixed a bug, fixed formatting. Tomasz Flendrich
|
||||
* tests/libntp/uglydate.c removed an unnecessary include. Tomasz Flendrich
|
||||
* tests/libntp/vi64ops.c removed an unnecessary comment, fixed formatting.
|
||||
* tests/libntp/ymd3yd.c removed an empty function and an unnecessary include,
|
||||
fixed formatting. Tomasz Flendrich
|
||||
* tests/libntp/timespecops.c fixed formatting, fixed the order of includes,
|
||||
removed unnecessary comments, cleanup. Tomasz Flendrich
|
||||
* tests/libntp/timevalops.c fixed the order of includes, deleted unnecessary
|
||||
comments, cleanup. Tomasz Flendrich
|
||||
* tests/libntp/sockaddrtest.h making it agree to NTP's conventions of formatting.
|
||||
Tomasz Flendrich
|
||||
* tests/libntp/lfptest.h cleanup. Tomasz Flendrich
|
||||
* tests/libntp/test-libntp.c fix formatting. Tomasz Flendrich
|
||||
* sntp/tests/crypto.c is now using proper Unity's assertions, fixed formatting.
|
||||
Tomasz Flendrich
|
||||
* sntp/tests/kodDatabase.c added consts, deleted empty function,
|
||||
fixed formatting. Tomasz Flendrich
|
||||
* sntp/tests/kodFile.c cleanup, fixed formatting. Tomasz Flendrich
|
||||
* sntp/tests/packetHandling.c is now using proper Unity's assertions,
|
||||
fixed formatting, deleted unused variable. Tomasz Flendrich
|
||||
* sntp/tests/keyFile.c is now using proper Unity's assertions, fixed formatting.
|
||||
Tomasz Flendrich
|
||||
* sntp/tests/packetProcessing.c changed from sprintf to snprintf,
|
||||
fixed formatting. Tomasz Flendrich
|
||||
* sntp/tests/utilities.c is now using proper Unity's assertions, changed
|
||||
the order of includes, fixed formatting, removed unnecessary comments.
|
||||
Tomasz Flendrich
|
||||
* sntp/tests/sntptest.h fixed formatting. Tomasz Flendrich
|
||||
* sntp/tests/fileHandlingTest.h.in fixed a possible buffer overflow problem,
|
||||
made one function do its job, deleted unnecessary prints, fixed formatting.
|
||||
Tomasz Flendrich
|
||||
* sntp/unity/Makefile.am added a missing header. Tomasz Flendrich
|
||||
* sntp/unity/unity_config.h: Distribute it. Harlan Stenn.
|
||||
* sntp/libevent/evconfig-private.h: remove generated filefrom SCM. H.Stenn.
|
||||
* sntp/unity/Makefile.am: fix some broken paths. Harlan Stenn.
|
||||
* sntp/unity/unity.c: Clean up a printf(). Harlan Stenn.
|
||||
* Phase 1 deprecation of google test in tests/libntp/. Harlan Stenn.
|
||||
* Don't build sntp/libevent/sample/. Harlan Stenn.
|
||||
* tests/libntp/test_caltontp needs -lpthread. Harlan Stenn.
|
||||
* br-flock: --enable-local-libevent. Harlan Stenn.
|
||||
* Wrote tests for ntpd/ntp_prio_q.c. Tomasz Flendrich
|
||||
* scripts/lib/NTP/Util.pm: stratum output is version-dependent. Harlan Stenn.
|
||||
* Get rid of the NTP_ prefix on our assertion macros. Harlan Stenn.
|
||||
* Code cleanup. Harlan Stenn.
|
||||
* libntp/icom.c: Typo fix. Harlan Stenn.
|
||||
* util/ntptime.c: initialization nit. Harlan Stenn.
|
||||
* ntpd/ntp_peer.c:newpeer(): added a DEBUG_REQUIRE(srcadr). Harlan Stenn.
|
||||
* Add std_unity_tests to various Makefile.am files. Harlan Stenn.
|
||||
* ntpd/ntp_restrict.c: added a few assertions, created tests for this file.
|
||||
Tomasz Flendrich
|
||||
* Changed progname to be const in many files - now it's consistent. Tomasz
|
||||
Flendrich
|
||||
* Typo fix for GCC warning suppression. Harlan Stenn.
|
||||
* Added tests/ntpd/ntp_scanner.c test. Damir Tomić.
|
||||
* Added declarations to all Unity tests, and did minor fixes to them.
|
||||
Reduced the number of warnings by half. Damir Tomić.
|
||||
* Updated generate_test_runner.rb and updated the sntp/unity/auto directory
|
||||
with the latest Unity updates from Mark. Damir Tomić.
|
||||
* Retire google test - phase I. Harlan Stenn.
|
||||
* Unity test cleanup: move declaration of 'initializing'. Harlan Stenn.
|
||||
* Update the NEWS file. Harlan Stenn.
|
||||
* Autoconf cleanup. Harlan Stenn.
|
||||
* Unit test dist cleanup. Harlan Stenn.
|
||||
* Cleanup various test Makefile.am files. Harlan Stenn.
|
||||
* Pthread autoconf macro cleanup. Harlan Stenn.
|
||||
* Fix progname definition in unity runner scripts. Harlan Stenn.
|
||||
* Clean trailing whitespace in tests/ntpd/Makefile.am. Harlan Stenn.
|
||||
* Update the patch for bug 2817. Harlan Stenn.
|
||||
* More updates for bug 2817. Harlan Stenn.
|
||||
* Fix bugs in tests/ntpd/ntp_prio_q.c. Harlan Stenn.
|
||||
* gcc on older HPUX may need +allowdups. Harlan Stenn.
|
||||
* Adding missing MCAST protection. Harlan Stenn.
|
||||
* Disable certain test programs on certain platforms. Harlan Stenn.
|
||||
* Implement --enable-problem-tests (on by default). Harlan Stenn.
|
||||
* build system tweaks. Harlan Stenn.
|
||||
---
|
||||
(4.2.8p3) 2015/06/29 Released by Harlan Stenn <[email protected]>
|
||||
|
||||
* [Sec 2853] Crafted remote config packet can crash some versions of
|
||||
|
||||
+11273
-26
File diff suppressed because it is too large.
Load diff
@@ -1,2 +0,0 @@
|
||||
*ports
|
||||
*html/pic
|
||||
@@ -1,55 +0,0 @@
|
||||
# ex:ts=8
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
NTP 4.2.8
|
||||
originals can be found on http://www.ntp.org/downloads.html
|
||||
|
||||
Import
|
||||
------
|
||||
|
||||
For the import of NTP the following files were removed:
|
||||
|
||||
ports/* NT files
|
||||
html/pic/* GIF files
|
||||
html/build/hints/solaris.xtra.4095849 Trigger merge conflict script
|
||||
|
||||
The stripped down version was created using FREEBSD-Xlist during
|
||||
extraction:
|
||||
|
||||
tar -X FREEBSD-Xlist -xvzf ntp-4.2.8.tar.gz
|
||||
mv ntp-4.2.8 4.2.8
|
||||
|
||||
Imported by:
|
||||
See procedure on
|
||||
https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/subversion-primer.html
|
||||
|
||||
Updating usr.sbin/ntp
|
||||
---------------------
|
||||
|
||||
./configure --disable-all-clocks --enable-NMEA --enable-ONCORE
|
||||
--enable-RAWDCF --with-crypto --disable-debugging
|
||||
--enable-LOCAL-CLOCK --with-sntp --with-arlib --prefix=/usr
|
||||
|
||||
config.h was generated by running configure and excluding almost all clock
|
||||
drivers (what is included is DCF77 -- what I use --, NMEA, Motorola OnCORE
|
||||
and local clocks).
|
||||
|
||||
The file is then edited to edit the value of "NO_PARENB_IGNPAR" because we
|
||||
need to set no parity on the serial port (needed for DCF77). All clock
|
||||
drivers are then disabled (some of them are included by default by ntpd).
|
||||
|
||||
Note that there are two #ifdef to support other architectures (WRT to long
|
||||
size and endianness). They'll need to be redone for each upgrade to the
|
||||
vendor branch to keep config.h in sync.
|
||||
|
||||
ntpd/ntp_control.c is now the only file that is different from the vendor
|
||||
branch for unsigned char/int fixes and removal of a DoS.
|
||||
|
||||
Documentation in /usr/share/doc/ntp is generated from the HTML files with
|
||||
lynx (without the GIF files of course).
|
||||
|
||||
A patch to fix IPV6_MULTICAST_LOOP was committed to head as r222444 and
|
||||
filed as http://bugs.ntp.org/show_bug.cgi?id=1936. Check if still needed
|
||||
or re-apply on update.
|
||||
|
||||
@@ -23,7 +23,7 @@ SUBDIRS = \
|
||||
tests \
|
||||
$(NULL)
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = -C --with-sntp
|
||||
DISTCHECK_CONFIGURE_FLAGS = -C --with-sntp --enable-local-libevent $(NTP_DCF)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(srcdir)/COPYRIGHT \
|
||||
@@ -36,6 +36,7 @@ EXTRA_DIST = \
|
||||
README.hackers \
|
||||
README.leapsmear \
|
||||
README.patches \
|
||||
README.pullrequests \
|
||||
README.refclocks \
|
||||
README.versions \
|
||||
TODO \
|
||||
|
||||
@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_locinfo.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_openssl.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_pkg_config.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_problemtests.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_prog_cc.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_rlimit.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
|
||||
@@ -262,6 +263,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_THREAD = @BUILD_THREAD@
|
||||
CALC_TICKADJ_DB = @CALC_TICKADJ_DB@
|
||||
CALC_TICKADJ_DL = @CALC_TICKADJ_DL@
|
||||
CALC_TICKADJ_DS = @CALC_TICKADJ_DS@
|
||||
@@ -270,6 +272,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@
|
||||
CFLAGS_NTP = @CFLAGS_NTP@
|
||||
CHUTEST = @CHUTEST@
|
||||
CONFIG_SHELL = @CONFIG_SHELL@
|
||||
@@ -331,6 +334,7 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LSCF = @LSCF@
|
||||
LTHREAD_LIBS = @LTHREAD_LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAKE_ADJTIMED = @MAKE_ADJTIMED@
|
||||
@@ -539,7 +543,7 @@ SUBDIRS = \
|
||||
tests \
|
||||
$(NULL)
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = -C --with-sntp
|
||||
DISTCHECK_CONFIGURE_FLAGS = -C --with-sntp --enable-local-libevent $(NTP_DCF)
|
||||
EXTRA_DIST = \
|
||||
$(srcdir)/COPYRIGHT \
|
||||
ChangeLog \
|
||||
@@ -551,6 +555,7 @@ EXTRA_DIST = \
|
||||
README.hackers \
|
||||
README.leapsmear \
|
||||
README.patches \
|
||||
README.pullrequests \
|
||||
README.refclocks \
|
||||
README.versions \
|
||||
TODO \
|
||||
|
||||
+1608
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,90 @@
|
||||
See README.hackers for notes on coding styles.
|
||||
|
||||
The NTP project's github repository is at https://github.com/ntp-project/ntp.
|
||||
|
||||
There are two branches, master and stable.
|
||||
|
||||
The stable branch is the current supported production code branch, the
|
||||
ntp-stable code (even 2nd number).
|
||||
|
||||
The master branch is for new development, also known as ntp-dev (which
|
||||
has an odd 2nd number).
|
||||
|
||||
If you have some work you'd like to add, then if there is any interest
|
||||
in seeing that work in the current production release then base your work
|
||||
on the stable branch, and pull your work into a master copy to allow for
|
||||
publishing your changes in the ntp-dev or master branch.
|
||||
|
||||
If there is no expectation that your work will be included in the
|
||||
current stable release (the ntp-stable code) then it's better to do your
|
||||
work on a copy of the master branch.
|
||||
|
||||
Make sure that any changes you make to stable pull cleanly into master.
|
||||
|
||||
It's possible that after pulling your changes from stable to master that
|
||||
some additional cleanup will be required in master. Please do this.
|
||||
|
||||
If you follow this method, then if you submit a pull request for either
|
||||
master or for master+stable, it will be easy for us to evaluate and
|
||||
incorporate your work.
|
||||
|
||||
Please also note that your submissions will be able to be evaluated and
|
||||
handled sooner if the repo that contains your pull requests also includes
|
||||
test cases.
|
||||
|
||||
The general workflow is as follows:
|
||||
|
||||
1) If you haven't, create a fork of ntp-project/ntp with your github account.
|
||||
i) Log on to github.com with your github account.
|
||||
- If you don't have one, create one first. (read: https://help.github.com/articles/signing-up-for-a-new-github-account)
|
||||
- Make sure you also have a SSH key associated with your github account.
|
||||
(read: https://help.github.com/articles/generating-ssh-keys/)
|
||||
ii) Go to https://github.com/ntp-project/ntp
|
||||
iii) On the top right corner, right below the header bar, there is
|
||||
a button labeled "Fork". Click on it. This will fork the current
|
||||
ntp master to your own account. Once done, it will go to your account's
|
||||
version of the ntp repository. (Your fork of ntp source)
|
||||
iv) Clone a local version of your fork.
|
||||
- git clone [email protected]:<your_username>/ntp
|
||||
|
||||
2) Look through the bugs listed in the bug tracker: http://bugs.ntp.org/
|
||||
|
||||
3) Once you've found a bug to work on:
|
||||
|
||||
i) Create a branch off your own master branch of your local fork.
|
||||
(the <branchname> can be any valid short string that will tell you
|
||||
what you're working on)
|
||||
- git checkout -b <branchname>
|
||||
|
||||
ii) Start working on the bug.
|
||||
iii) When you create changes in the source, it would help you to
|
||||
keep track of your changes by committing to your local repo.
|
||||
(This way, every small change is tracked and when you've
|
||||
made a mistake, you can always go back.)
|
||||
- git commit -a -m "description of change"
|
||||
iv) Once you are satisfied, you can push to your github account's
|
||||
repository.
|
||||
- git push origin <branchname>
|
||||
v) (go to step iii).
|
||||
|
||||
4) Once you feel you've fixed the bug (and tested it), you need to
|
||||
create a pull request on your branch on github. (Read up on
|
||||
pull requests @ https://help.github.com/articles/using-pull-requests)
|
||||
|
||||
i) Create your pullrequest by following the instructions @
|
||||
https://help.github.com/articles/creating-a-pull-request/
|
||||
|
||||
5) Your pull request will be reviewed by committers and when it
|
||||
passes review, it will be merged by the reviewer/allowed committer.
|
||||
|
||||
6) You have fixed a bug. Goto step #2.
|
||||
|
||||
If these patches are for a bugzilla issue, mark the issue as Resolved/READY
|
||||
with a comment of "Please pick up the patches from XXX" where XXX is
|
||||
something like:
|
||||
|
||||
hostname:~user/path if it's a machine the reviewers have access to, or
|
||||
github-pull-request-URI
|
||||
|
||||
---
|
||||
|
||||
Vendored
+1
@@ -1355,6 +1355,7 @@ m4_include([sntp/m4/ntp_lineeditlibs.m4])
|
||||
m4_include([sntp/m4/ntp_locinfo.m4])
|
||||
m4_include([sntp/m4/ntp_openssl.m4])
|
||||
m4_include([sntp/m4/ntp_pkg_config.m4])
|
||||
m4_include([sntp/m4/ntp_problemtests.m4])
|
||||
m4_include([sntp/m4/ntp_prog_cc.m4])
|
||||
m4_include([sntp/m4/ntp_rlimit.m4])
|
||||
m4_include([sntp/m4/ntp_sntp.m4])
|
||||
|
||||
@@ -124,6 +124,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_locinfo.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_openssl.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_pkg_config.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_problemtests.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_prog_cc.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_rlimit.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
|
||||
@@ -229,6 +230,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_THREAD = @BUILD_THREAD@
|
||||
CALC_TICKADJ_DB = @CALC_TICKADJ_DB@
|
||||
CALC_TICKADJ_DL = @CALC_TICKADJ_DL@
|
||||
CALC_TICKADJ_DS = @CALC_TICKADJ_DS@
|
||||
@@ -237,6 +239,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@
|
||||
CFLAGS_NTP = @CFLAGS_NTP@
|
||||
CHUTEST = @CHUTEST@
|
||||
CONFIG_SHELL = @CONFIG_SHELL@
|
||||
@@ -298,6 +301,7 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LSCF = @LSCF@
|
||||
LTHREAD_LIBS = @LTHREAD_LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAKE_ADJTIMED = @MAKE_ADJTIMED@
|
||||
|
||||
@@ -58,7 +58,7 @@ void Exit (int);
|
||||
/* emacs cc-mode goes nuts if we split the next line... */
|
||||
#define tvtod(tv) ((double)tv.tv_sec + ((double)tv.tv_usec / (double)MILLION))
|
||||
|
||||
char *progname = NULL;
|
||||
char const *progname = NULL;
|
||||
int verbose = 0;
|
||||
int sysdebug = 0;
|
||||
static int mqid;
|
||||
|
||||
@@ -117,6 +117,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_locinfo.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_openssl.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_pkg_config.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_problemtests.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_prog_cc.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_rlimit.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
|
||||
@@ -224,6 +225,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_THREAD = @BUILD_THREAD@
|
||||
CALC_TICKADJ_DB = @CALC_TICKADJ_DB@
|
||||
CALC_TICKADJ_DL = @CALC_TICKADJ_DL@
|
||||
CALC_TICKADJ_DS = @CALC_TICKADJ_DS@
|
||||
@@ -232,6 +234,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@
|
||||
CFLAGS_NTP = @CFLAGS_NTP@
|
||||
CHUTEST = @CHUTEST@
|
||||
CONFIG_SHELL = @CONFIG_SHELL@
|
||||
@@ -293,6 +296,7 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LSCF = @LSCF@
|
||||
LTHREAD_LIBS = @LTHREAD_LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAKE_ADJTIMED = @MAKE_ADJTIMED@
|
||||
|
||||
@@ -56,7 +56,7 @@ struct chucode {
|
||||
|
||||
#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
|
||||
|
||||
char *progname;
|
||||
char const *progname;
|
||||
|
||||
int dofilter = 0; /* set to 1 when we should run filter algorithm */
|
||||
int showtimes = 0; /* set to 1 when we should show char arrival times */
|
||||
|
||||
@@ -117,7 +117,7 @@ int Cflag = 0;
|
||||
int Gflag = 0;
|
||||
int height;
|
||||
|
||||
char *progname;
|
||||
char const *progname;
|
||||
|
||||
static void doit (double, double, double, double, double, char *);
|
||||
static double latlong (char *, int);
|
||||
|
||||
+13
-1
@@ -302,9 +302,15 @@
|
||||
/* The number of minutes in a DST adjustment */
|
||||
#undef DSTMINUTES
|
||||
|
||||
/* support dynamic interleave? */
|
||||
#undef DYNAMIC_INTERLEAVE
|
||||
|
||||
/* number of args to el_init() */
|
||||
#undef EL_INIT_ARGS
|
||||
|
||||
/* Provide the explicit 127.0.0.0/8 martian filter? */
|
||||
#undef ENABLE_BUG3020_FIX
|
||||
|
||||
/* nls support in libopts */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
@@ -830,7 +836,7 @@
|
||||
/* Define to 1 if you have the <stdatomic.h> header file. */
|
||||
#undef HAVE_STDATOMIC_H
|
||||
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */
|
||||
/* Define to 1 if stdbool.h conforms to C99. */
|
||||
#undef HAVE_STDBOOL_H
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
@@ -1201,6 +1207,9 @@
|
||||
/* define if select implicitly yields */
|
||||
#undef HAVE_YIELDING_SELECT
|
||||
|
||||
/* Define to 1 if the system has the type `_Bool'. */
|
||||
#undef HAVE__BOOL
|
||||
|
||||
/* Define to 1 if you have the `_exit' function. */
|
||||
#undef HAVE__EXIT
|
||||
|
||||
@@ -1347,6 +1356,9 @@
|
||||
initialization. */
|
||||
#undef MISSING_C99_STRUCT_INIT
|
||||
|
||||
/* having to fork the DNS worker early when doing chroot? */
|
||||
#undef NEED_EARLY_FORK
|
||||
|
||||
/* Do we need HPUX adjtime() library support? */
|
||||
#undef NEED_HPUX_ADJTIME
|
||||
|
||||
|
||||
Vendored
+346
-70
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for ntp 4.2.8p3.
|
||||
# Generated by GNU Autoconf 2.69 for ntp 4.2.8p9.
|
||||
#
|
||||
# Report bugs to <http://bugs.ntp.org./>.
|
||||
#
|
||||
@@ -590,8 +590,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='ntp'
|
||||
PACKAGE_TARNAME='ntp'
|
||||
PACKAGE_VERSION='4.2.8p3'
|
||||
PACKAGE_STRING='ntp 4.2.8p3'
|
||||
PACKAGE_VERSION='4.2.8p9'
|
||||
PACKAGE_STRING='ntp 4.2.8p9'
|
||||
PACKAGE_BUGREPORT='http://bugs.ntp.org./'
|
||||
PACKAGE_URL='http://www.ntp.org./'
|
||||
|
||||
@@ -639,6 +639,12 @@ LTLIBOBJS
|
||||
subdirs
|
||||
PERLLIBDIR
|
||||
NTP_KEYSDIR
|
||||
BUILD_TEST_NTP_SIGND_FALSE
|
||||
BUILD_TEST_NTP_SIGND_TRUE
|
||||
BUILD_TEST_NTP_SCANNER_FALSE
|
||||
BUILD_TEST_NTP_SCANNER_TRUE
|
||||
BUILD_TEST_NTP_RESTRICT_FALSE
|
||||
BUILD_TEST_NTP_RESTRICT_TRUE
|
||||
GTEST_AVAILABLE_FALSE
|
||||
GTEST_AVAILABLE_TRUE
|
||||
GTEST_CPPFLAGS
|
||||
@@ -689,6 +695,8 @@ PTHREADS_FALSE
|
||||
PTHREADS_TRUE
|
||||
LIBISC_PTHREADS_NOTHREADS
|
||||
PTHREAD_LIBS
|
||||
LTHREAD_LIBS
|
||||
BUILD_THREAD
|
||||
HAVE_INLINE
|
||||
LDADD_LIBUTIL
|
||||
ALLOCA
|
||||
@@ -701,6 +709,7 @@ BUILD_LIBEVENT_FALSE
|
||||
BUILD_LIBEVENT_TRUE
|
||||
LDADD_LIBEVENT
|
||||
CPPFLAGS_LIBEVENT
|
||||
CFLAGS_LIBEVENT
|
||||
PKG_CONFIG
|
||||
LIBOPTS_DIR
|
||||
LIBOPTS_CFLAGS
|
||||
@@ -1041,6 +1050,7 @@ enable_ntpdate_step
|
||||
enable_hourly_todr_sync
|
||||
enable_kernel_fll_bug
|
||||
enable_bug1243_fix
|
||||
enable_bug3020_fix
|
||||
enable_irig_sawtooth
|
||||
enable_nist
|
||||
enable_ntp_signd
|
||||
@@ -1049,7 +1059,9 @@ with_kame
|
||||
enable_getifaddrs
|
||||
enable_saveconfig
|
||||
enable_leap_smear
|
||||
enable_dynamic_interleave
|
||||
with_gtest
|
||||
enable_problem_tests
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
host_alias
|
||||
@@ -1606,7 +1618,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures ntp 4.2.8p3 to adapt to many kinds of systems.
|
||||
\`configure' configures ntp 4.2.8p9 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1676,7 +1688,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of ntp 4.2.8p3:";;
|
||||
short | recursive ) echo "Configuration of ntp 4.2.8p9:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1724,7 +1736,7 @@ Optional Features and Packages:
|
||||
--enable-libseccomp EXPERIMENTAL: enable support for libseccomp
|
||||
sandboxing (default is no)
|
||||
--with-stack-limit ? =50 (200 for openbsd) 4k pages
|
||||
--with-memlock ? =32 (megabytes)
|
||||
--with-memlock ? =32 (-1 on linux) megabytes
|
||||
--enable-debug-timing - include processing time debugging code (costs
|
||||
performance)
|
||||
--enable-dst-minutes =60 minutes per DST adjustment
|
||||
@@ -1810,6 +1822,7 @@ Optional Features and Packages:
|
||||
s if we should sync TODR hourly
|
||||
--enable-kernel-fll-bug s if we should avoid a kernel FLL bug
|
||||
--enable-bug1243-fix + use unmodified autokey session keys
|
||||
--enable-bug3020-fix + Provide the explicit 127.0.0.0/8 martian filter
|
||||
--enable-irig-sawtooth s if we should enable the IRIG sawtooth filter
|
||||
--enable-nist - if we should enable the NIST lockclock scheme
|
||||
--enable-ntp-signd - Provide support for Samba's signing daemon,
|
||||
@@ -1820,7 +1833,10 @@ Optional Features and Packages:
|
||||
--enable-getifaddrs + Enable the use of getifaddrs() [[yes|no]].
|
||||
--enable-saveconfig + saveconfig mechanism
|
||||
--enable-leap-smear - experimental leap smear code
|
||||
--enable-dynamic-interleave
|
||||
- dynamic interleave support
|
||||
--with-gtest Use the gtest framework (Default: if it's available)
|
||||
--enable-problem-tests + enable tests with undiagnosed problems
|
||||
|
||||
Some influential environment variables:
|
||||
CC C compiler command
|
||||
@@ -1908,7 +1924,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
ntp configure 4.2.8p3
|
||||
ntp configure 4.2.8p9
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
@@ -2738,7 +2754,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by ntp $as_me 4.2.8p3, which was
|
||||
It was created by ntp $as_me 4.2.8p9, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -3117,6 +3133,12 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
|
||||
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
|
||||
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3733,7 +3755,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='ntp'
|
||||
VERSION='4.2.8p3'
|
||||
VERSION='4.2.8p9'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -6768,7 +6790,7 @@ esac
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking additional compiler flags" >&5
|
||||
$as_echo_n "checking additional compiler flags... " >&6; }
|
||||
# allow ntp_os_flags to be preset to skip this stuff
|
||||
# allow ntp_os_cflags to be preset to skip this stuff
|
||||
case "${ntp_os_cflags+set}" in
|
||||
set)
|
||||
;;
|
||||
@@ -6856,7 +6878,7 @@ $as_echo_n "checking additional compiler flags... " >&6; }
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
case "$ntp_os_flags" in
|
||||
case "$ntp_os_cflags" in
|
||||
'')
|
||||
ntp_os_cflags_msg="none needed"
|
||||
;;
|
||||
@@ -6867,6 +6889,38 @@ $as_echo_n "checking additional compiler flags... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_os_cflags_msg" >&5
|
||||
$as_echo "$ntp_os_cflags_msg" >&6; }
|
||||
{ ntp_os_cflags_msg=; unset ntp_os_cflags_msg;}
|
||||
###
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking additional linker flags" >&5
|
||||
$as_echo_n "checking additional linker flags... " >&6; }
|
||||
# HMS: The following might still need tweaking
|
||||
# allow ntp_os_ldflags to be preset to skip this stuff
|
||||
case "${ntp_os_ldflags+set}" in
|
||||
set)
|
||||
;;
|
||||
*)
|
||||
ntp_os_ldflags=
|
||||
case "$host_os" in
|
||||
hpux*)
|
||||
case "$GCC" in
|
||||
yes)
|
||||
ntp_os_ldflags="-Wl,+allowdups"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
case "$ntp_os_ldflags" in
|
||||
'')
|
||||
ntp_os_ldflags_msg="none needed"
|
||||
;;
|
||||
*)
|
||||
ntp_os_ldflags_msg="$ntp_os_ldflags"
|
||||
esac
|
||||
LDFLAGS_NTP="$LDFLAGS_NTP $ntp_os_ldflags"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_os_ldflags_msg" >&5
|
||||
$as_echo "$ntp_os_ldflags_msg" >&6; }
|
||||
{ ntp_os_ldflags_msg=; unset ntp_os_ldflags_msg;}
|
||||
|
||||
|
||||
|
||||
@@ -19945,6 +19999,7 @@ ntp_libevent_tearoff=sntp/libevent
|
||||
|
||||
|
||||
|
||||
|
||||
case "$ntp_use_local_libevent" in
|
||||
yes)
|
||||
;;
|
||||
@@ -19958,6 +20013,7 @@ $as_echo_n "checking if libevent $ntp_libevent_min_version or later is installed
|
||||
ntp_use_local_libevent=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Using the installed libevent" >&5
|
||||
$as_echo "$as_me: Using the installed libevent" >&6;}
|
||||
CFLAGS_LIBEVENT=`$PKG_CONFIG --cflags libevent_pthreads`
|
||||
CPPFLAGS_LIBEVENT=`$PKG_CONFIG --cflags-only-I libevent`
|
||||
# HMS: I hope the following is accurate.
|
||||
# We don't need -levent, we only need -levent_core.
|
||||
@@ -19967,9 +20023,10 @@ $as_echo "$as_me: Using the installed libevent" >&6;}
|
||||
# LDADD_LIBEVENT=`$PKG_CONFIG --libs libevent | sed 's:-levent::'`
|
||||
# So now we dance...
|
||||
LDADD_LIBEVENT=
|
||||
for i in `$PKG_CONFIG --libs libevent`
|
||||
for i in `$PKG_CONFIG --libs libevent` `$PKG_CONFIG --cflags-only-other libevent_pthreads`
|
||||
do
|
||||
case "$i" in
|
||||
-D*) ;;
|
||||
-levent*) ;;
|
||||
*) case "$LDADD_LIBEVENT" in
|
||||
'') LDADD_LIBEVENT="$i" ;;
|
||||
@@ -19987,6 +20044,9 @@ $as_echo "$as_me: Using the installed libevent" >&6;}
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
ntp_use_local_libevent=yes
|
||||
# HMS: do we only need to do this if LIBISC_PTHREADS_NOTHREADS
|
||||
# is "pthreads"?
|
||||
CFLAGS_LIBEVENT=`$PKG_CONFIG --cflags libevent_pthreads`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
@@ -20012,6 +20072,7 @@ $as_echo "$as_me: Using libevent tearoff" >&6;}
|
||||
esac
|
||||
esac
|
||||
|
||||
|
||||
if test "x$ntp_use_local_libevent" = "xyes"; then
|
||||
BUILD_LIBEVENT_TRUE=
|
||||
BUILD_LIBEVENT_FALSE='#'
|
||||
@@ -22062,6 +22123,9 @@ fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
$as_echo "#define NEED_EARLY_FORK 1" >>confdefs.h
|
||||
|
||||
esac
|
||||
|
||||
for ac_header in arpa/nameser.h sys/param.h sys/time.h sys/timers.h
|
||||
@@ -22941,7 +23005,8 @@ fi
|
||||
|
||||
have_pthreads=no
|
||||
case "$enable_thread_support" in
|
||||
yes)
|
||||
no) ;;
|
||||
*)
|
||||
ol_found_pthreads=no
|
||||
|
||||
|
||||
@@ -26358,6 +26423,9 @@ $as_echo "$ol_cv_pthread_lib_lpthreads" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: ol_link_threads: <$ol_link_threads> ol_link_pthreads <$ol_link_pthreads>" >&5
|
||||
$as_echo "$as_me: ol_link_threads: <$ol_link_threads> ol_link_pthreads <$ol_link_pthreads>" >&6;}
|
||||
|
||||
if test $ol_link_threads != no ; then
|
||||
LTHREAD_LIBS="$LTHREAD_LIBS $ol_link_pthreads"
|
||||
|
||||
@@ -27398,6 +27466,10 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case "$ol_found_pthreads" in
|
||||
yes)
|
||||
saved_LIBS="$LIBS"
|
||||
@@ -27423,56 +27495,6 @@ done
|
||||
yes)
|
||||
PTHREAD_LIBS="$LTHREAD_LIBS"
|
||||
have_pthreads=yes
|
||||
# Bug 2332: With GCC we need to force a reference to libgcc_s
|
||||
# (if libgcc_s exists) or the combination of
|
||||
# threads + setuid + mlockall does not work on linux because
|
||||
# thread cancellation fails to load libgcc_s with dlopen().
|
||||
# We have to pass this all as linker options to avoid argument
|
||||
# reordering by libtool.
|
||||
case "$GCC$with_gnu_ld" in
|
||||
yesyes)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -lgcc_s" >&5
|
||||
$as_echo_n "checking for exit in -lgcc_s... " >&6; }
|
||||
if ${ac_cv_lib_gcc_s_exit+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lgcc_s $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char exit ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return exit ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_gcc_s_exit=yes
|
||||
else
|
||||
ac_cv_lib_gcc_s_exit=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcc_s_exit" >&5
|
||||
$as_echo "$ac_cv_lib_gcc_s_exit" >&6; }
|
||||
if test "x$ac_cv_lib_gcc_s_exit" = xyes; then :
|
||||
PTHREAD_LIBS="$LTHREAD_LIBS -Wl,--no-as-needed,-lgcc_s,--as-needed"
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
esac
|
||||
esac
|
||||
@@ -29692,7 +29714,113 @@ fi
|
||||
|
||||
done
|
||||
|
||||
for ac_header in sgtty.h stdatomic.h stdlib.h string.h termio.h
|
||||
for ac_header in sgtty.h stdatomic.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
|
||||
$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
|
||||
if ${ac_cv_header_stdbool_h+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <stdbool.h>
|
||||
#ifndef bool
|
||||
"error: bool is not defined"
|
||||
#endif
|
||||
#ifndef false
|
||||
"error: false is not defined"
|
||||
#endif
|
||||
#if false
|
||||
"error: false is not 0"
|
||||
#endif
|
||||
#ifndef true
|
||||
"error: true is not defined"
|
||||
#endif
|
||||
#if true != 1
|
||||
"error: true is not 1"
|
||||
#endif
|
||||
#ifndef __bool_true_false_are_defined
|
||||
"error: __bool_true_false_are_defined is not defined"
|
||||
#endif
|
||||
|
||||
struct s { _Bool s: 1; _Bool t; } s;
|
||||
|
||||
char a[true == 1 ? 1 : -1];
|
||||
char b[false == 0 ? 1 : -1];
|
||||
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
|
||||
char d[(bool) 0.5 == true ? 1 : -1];
|
||||
/* See body of main program for 'e'. */
|
||||
char f[(_Bool) 0.0 == false ? 1 : -1];
|
||||
char g[true];
|
||||
char h[sizeof (_Bool)];
|
||||
char i[sizeof s.t];
|
||||
enum { j = false, k = true, l = false * true, m = true * 256 };
|
||||
/* The following fails for
|
||||
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
|
||||
_Bool n[m];
|
||||
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
|
||||
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
|
||||
/* Catch a bug in an HP-UX C compiler. See
|
||||
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
|
||||
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
|
||||
*/
|
||||
_Bool q = true;
|
||||
_Bool *pq = &q;
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
bool e = &s;
|
||||
*pq |= q;
|
||||
*pq |= ! q;
|
||||
/* Refer to every declared value, to avoid compiler optimizations. */
|
||||
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
|
||||
+ !m + !n + !o + !p + !q + !pq);
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
ac_cv_header_stdbool_h=yes
|
||||
else
|
||||
ac_cv_header_stdbool_h=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
|
||||
$as_echo "$ac_cv_header_stdbool_h" >&6; }
|
||||
ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
|
||||
if test "x$ac_cv_type__Bool" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE__BOOL 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if test $ac_cv_header_stdbool_h = yes; then
|
||||
|
||||
$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
for ac_header in stdlib.h string.h termio.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||
@@ -31236,10 +31364,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_rlimit_memlock" >&5
|
||||
$as_echo "$ntp_cv_rlimit_memlock" >&6; }
|
||||
case "$host" in
|
||||
*-*-*linux*)
|
||||
ntp_dflt_rlimit_memlock="-1" ;;
|
||||
*) ntp_dflt_rlimit_memlock="32" ;;
|
||||
esac
|
||||
case "$ntp_cv_rlimit_memlock" in
|
||||
yes)
|
||||
|
||||
HAVE_RLIMIT_MEMLOCK=" memlock 32"
|
||||
HAVE_RLIMIT_MEMLOCK=" memlock $ntp_dflt_rlimit_memlock" ;;
|
||||
esac
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RLIMIT_STACK" >&5
|
||||
@@ -31288,8 +31421,6 @@ case "$ntp_cv_rlimit_stack" in
|
||||
HAVE_RLIMIT_STACK=" stacksize 50"
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# HMS: Only if we are doing the MLOCKALL stuff...
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the default number of 4k stack pages" >&5
|
||||
$as_echo_n "checking for the default number of 4k stack pages... " >&6; }
|
||||
@@ -31339,7 +31470,7 @@ fi
|
||||
|
||||
case "$ans" in
|
||||
yes | no)
|
||||
ans=32
|
||||
ans=$ntp_dflt_rlimit_memlock
|
||||
;;
|
||||
[1-9][0-9]*) ;;
|
||||
*) as_fn_error $? "\"--with-memlock requires an integer argument.\"" "$LINENO" 5
|
||||
@@ -31354,6 +31485,7 @@ _ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
# some OSes prefer _exit() in forked children to exit()
|
||||
for ac_func in _exit
|
||||
do :
|
||||
@@ -35814,6 +35946,26 @@ $as_echo "#define DISABLE_BUG1243_FIX 1" >>confdefs.h
|
||||
esac
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we want the explicit 127.0.0.0/8 martian filter" >&5
|
||||
$as_echo_n "checking if we want the explicit 127.0.0.0/8 martian filter... " >&6; }
|
||||
# Check whether --enable-bug3020-fix was given.
|
||||
if test "${enable_bug3020_fix+set}" = set; then :
|
||||
enableval=$enable_bug3020_fix; ans=$enableval
|
||||
else
|
||||
ans=yes
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ans" >&5
|
||||
$as_echo "$ans" >&6; }
|
||||
case "$ans" in
|
||||
yes)
|
||||
|
||||
$as_echo "#define ENABLE_BUG3020_FIX 1" >>confdefs.h
|
||||
|
||||
esac
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we should use the IRIG sawtooth filter" >&5
|
||||
$as_echo_n "checking if we should use the IRIG sawtooth filter... " >&6; }
|
||||
|
||||
@@ -36833,6 +36985,32 @@ esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_ok" >&5
|
||||
$as_echo "$ntp_ok" >&6; }
|
||||
|
||||
###
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we want dynamic interleave support" >&5
|
||||
$as_echo_n "checking if we want dynamic interleave support... " >&6; }
|
||||
# Check whether --enable-dynamic-interleave was given.
|
||||
if test "${enable_dynamic_interleave+set}" = set; then :
|
||||
enableval=$enable_dynamic_interleave; ntp_ok=$enableval
|
||||
else
|
||||
ntp_ok=no
|
||||
|
||||
fi
|
||||
|
||||
ntp_dynamic_interleave=0
|
||||
case "$ntp_ok" in
|
||||
yes)
|
||||
ntp_dynamic_interleave=1
|
||||
;;
|
||||
esac
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define DYNAMIC_INTERLEAVE $ntp_dynamic_interleave
|
||||
_ACEOF
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_ok" >&5
|
||||
$as_echo "$ntp_ok" >&6; }
|
||||
|
||||
|
||||
# We may not need have_unity
|
||||
have_unity=false
|
||||
@@ -36995,6 +37173,85 @@ fi
|
||||
|
||||
|
||||
|
||||
|
||||
case "$build" in
|
||||
$host) cross=0 ;;
|
||||
*) cross=1 ;;
|
||||
esac
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we want to enable tests with undiagnosed problems" >&5
|
||||
$as_echo_n "checking if we want to enable tests with undiagnosed problems... " >&6; }
|
||||
# Check whether --enable-problem-tests was given.
|
||||
if test "${enable_problem_tests+set}" = set; then :
|
||||
enableval=$enable_problem_tests; ntp_ept=$enableval
|
||||
else
|
||||
ntp_ept=yes
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_ept" >&5
|
||||
$as_echo "$ntp_ept" >&6; }
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can run test-ntp_restrict" >&5
|
||||
$as_echo_n "checking if we can run test-ntp_restrict... " >&6; }
|
||||
ntp_test_ntp_restrict="no"
|
||||
case "$ntp_ept:$cross:$host" in
|
||||
no:0:*-*-freebsd6.4) ;;
|
||||
no:0:*-*-hpux11.23*) ;;
|
||||
no:0:*-*-solaris*) ;;
|
||||
*) ntp_test_ntp_restrict="yes" ;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_test_ntp_restrict" >&5
|
||||
$as_echo "$ntp_test_ntp_restrict" >&6; }
|
||||
if test x$ntp_test_ntp_restrict = xyes; then
|
||||
BUILD_TEST_NTP_RESTRICT_TRUE=
|
||||
BUILD_TEST_NTP_RESTRICT_FALSE='#'
|
||||
else
|
||||
BUILD_TEST_NTP_RESTRICT_TRUE='#'
|
||||
BUILD_TEST_NTP_RESTRICT_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can run test-ntp_scanner" >&5
|
||||
$as_echo_n "checking if we can run test-ntp_scanner... " >&6; }
|
||||
ntp_test_ntp_scanner="no"
|
||||
case "$ntp_ept:$cross:$host" in
|
||||
no:0:*-*-freebsd6.4) ;;
|
||||
no:0:*-*-solaris*) ;;
|
||||
*) ntp_test_ntp_scanner="yes" ;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_test_ntp_scanner" >&5
|
||||
$as_echo "$ntp_test_ntp_scanner" >&6; }
|
||||
if test x$ntp_test_ntp_scanner = xyes; then
|
||||
BUILD_TEST_NTP_SCANNER_TRUE=
|
||||
BUILD_TEST_NTP_SCANNER_FALSE='#'
|
||||
else
|
||||
BUILD_TEST_NTP_SCANNER_TRUE='#'
|
||||
BUILD_TEST_NTP_SCANNER_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can run test-ntp_signd" >&5
|
||||
$as_echo_n "checking if we can run test-ntp_signd... " >&6; }
|
||||
ntp_test_ntp_signd="no"
|
||||
case "$ntp_ept:$cross:$host" in
|
||||
no:0:*-*-freebsd6.4) ;;
|
||||
no:0:*-*-solaris*) ;;
|
||||
*) ntp_test_ntp_signd="yes" ;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_test_ntp_signd" >&5
|
||||
$as_echo "$ntp_test_ntp_signd" >&6; }
|
||||
if test x$ntp_test_ntp_signd = xyes; then
|
||||
BUILD_TEST_NTP_SIGND_TRUE=
|
||||
BUILD_TEST_NTP_SIGND_FALSE='#'
|
||||
else
|
||||
BUILD_TEST_NTP_SIGND_TRUE='#'
|
||||
BUILD_TEST_NTP_SIGND_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
###
|
||||
|
||||
|
||||
@@ -37053,6 +37310,8 @@ ac_config_files="$ac_config_files scripts/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files scripts/build/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files scripts/build/genAuthors"
|
||||
|
||||
ac_config_files="$ac_config_files scripts/build/mkver"
|
||||
|
||||
ac_config_files="$ac_config_files scripts/calc_tickadj/Makefile"
|
||||
@@ -37091,6 +37350,8 @@ ac_config_files="$ac_config_files tests/libntp/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files tests/ntpd/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files tests/ntpq/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files tests/sandbox/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files tests/sec-2853/Makefile"
|
||||
@@ -37333,6 +37594,18 @@ if test -z "${GTEST_AVAILABLE_TRUE}" && test -z "${GTEST_AVAILABLE_FALSE}"; then
|
||||
as_fn_error $? "conditional \"GTEST_AVAILABLE\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${BUILD_TEST_NTP_RESTRICT_TRUE}" && test -z "${BUILD_TEST_NTP_RESTRICT_FALSE}"; then
|
||||
as_fn_error $? "conditional \"BUILD_TEST_NTP_RESTRICT\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${BUILD_TEST_NTP_SCANNER_TRUE}" && test -z "${BUILD_TEST_NTP_SCANNER_FALSE}"; then
|
||||
as_fn_error $? "conditional \"BUILD_TEST_NTP_SCANNER\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${BUILD_TEST_NTP_SIGND_TRUE}" && test -z "${BUILD_TEST_NTP_SIGND_FALSE}"; then
|
||||
as_fn_error $? "conditional \"BUILD_TEST_NTP_SIGND\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
|
||||
: "${CONFIG_STATUS=./config.status}"
|
||||
ac_write_fail=0
|
||||
@@ -37730,7 +38003,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by ntp $as_me 4.2.8p3, which was
|
||||
This file was extended by ntp $as_me 4.2.8p9, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -37797,7 +38070,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
ntp config.status 4.2.8p3
|
||||
ntp config.status 4.2.8p9
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
@@ -38325,6 +38598,7 @@ do
|
||||
"parseutil/Makefile") CONFIG_FILES="$CONFIG_FILES parseutil/Makefile" ;;
|
||||
"scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;;
|
||||
"scripts/build/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/build/Makefile" ;;
|
||||
"scripts/build/genAuthors") CONFIG_FILES="$CONFIG_FILES scripts/build/genAuthors" ;;
|
||||
"scripts/build/mkver") CONFIG_FILES="$CONFIG_FILES scripts/build/mkver" ;;
|
||||
"scripts/calc_tickadj/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/calc_tickadj/Makefile" ;;
|
||||
"scripts/calc_tickadj/calc_tickadj") CONFIG_FILES="$CONFIG_FILES scripts/calc_tickadj/calc_tickadj" ;;
|
||||
@@ -38344,6 +38618,7 @@ do
|
||||
"tests/bug-2803/Makefile") CONFIG_FILES="$CONFIG_FILES tests/bug-2803/Makefile" ;;
|
||||
"tests/libntp/Makefile") CONFIG_FILES="$CONFIG_FILES tests/libntp/Makefile" ;;
|
||||
"tests/ntpd/Makefile") CONFIG_FILES="$CONFIG_FILES tests/ntpd/Makefile" ;;
|
||||
"tests/ntpq/Makefile") CONFIG_FILES="$CONFIG_FILES tests/ntpq/Makefile" ;;
|
||||
"tests/sandbox/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sandbox/Makefile" ;;
|
||||
"tests/sec-2853/Makefile") CONFIG_FILES="$CONFIG_FILES tests/sec-2853/Makefile" ;;
|
||||
"util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;;
|
||||
@@ -39878,6 +40153,7 @@ _LT_EOF
|
||||
;;
|
||||
"ntpd/complete.conf":F) sed -e '/^rlimit$/d' -e '/^$/d' < ntpd/complete.conf > ntpd/complete.conf.new && mv ntpd/complete.conf.new ntpd/complete.conf ;;
|
||||
"ntpdc/nl.pl":F) chmod +x ntpdc/nl.pl ;;
|
||||
"scripts/build/genAuthors":F) chmod +x scripts/build/genAuthors ;;
|
||||
"scripts/build/mkver":F) chmod +x scripts/build/mkver ;;
|
||||
"scripts/calc_tickadj/calc_tickadj":F) chmod +x scripts/calc_tickadj/calc_tickadj ;;
|
||||
"scripts/ntp-wait/ntp-wait":F) chmod +x scripts/ntp-wait/ntp-wait ;;
|
||||
|
||||
+48
-55
@@ -11,6 +11,7 @@ AC_INIT(
|
||||
)
|
||||
AC_CONFIG_MACRO_DIR([sntp/m4])
|
||||
AC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
|
||||
AC_LANG([C])
|
||||
|
||||
AC_PRESERVE_HELP_ORDER
|
||||
|
||||
@@ -301,7 +302,9 @@ AC_CHECK_HEADER(
|
||||
AC_CHECK_HEADERS([fcntl.h fnmatch.h ieeefp.h inttypes.h kvm.h math.h])
|
||||
|
||||
AC_CHECK_HEADERS([memory.h netdb.h poll.h])
|
||||
AC_CHECK_HEADERS([sgtty.h stdatomic.h stdlib.h string.h termio.h])
|
||||
AC_CHECK_HEADERS([sgtty.h stdatomic.h])
|
||||
AC_HEADER_STDBOOL
|
||||
AC_CHECK_HEADERS([stdlib.h string.h termio.h])
|
||||
AC_CHECK_HEADERS([termios.h timepps.h timex.h unistd.h])
|
||||
|
||||
case "$host" in
|
||||
@@ -928,60 +931,6 @@ esac
|
||||
|
||||
NTP_RLIMIT_ITEMS
|
||||
|
||||
# HMS: Only if we are doing the MLOCKALL stuff...
|
||||
AC_MSG_CHECKING([for the default number of 4k stack pages])
|
||||
AC_ARG_WITH(
|
||||
[stack-limit],
|
||||
[AS_HELP_STRING(
|
||||
[--with-stack-limit],
|
||||
[? =50 (200 for openbsd) 4k pages]
|
||||
)],
|
||||
[ans=$withval],
|
||||
[ans=yes]
|
||||
)
|
||||
case "$ans" in
|
||||
yes | no)
|
||||
case "$host" in
|
||||
*-*-openbsd*)
|
||||
ans=200
|
||||
;;
|
||||
*) ans=50
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
[[1-9]][[0-9]]*)
|
||||
;;
|
||||
*) AC_MSG_ERROR(["--with-stack-limit requires an integer argument."])
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT([$ans])
|
||||
AC_DEFINE_UNQUOTED([DFLT_RLIMIT_STACK], [$ans],
|
||||
[Default number of 4k pages for RLIMIT_STACK])
|
||||
|
||||
# HMS: only if we have RLIMIT_MEMLOCK
|
||||
AC_MSG_CHECKING([for the default number of megabytes to MEMLOCK])
|
||||
AC_ARG_WITH(
|
||||
[memlock],
|
||||
[AS_HELP_STRING(
|
||||
[--with-memlock],
|
||||
[? =32 (megabytes)]
|
||||
)],
|
||||
[ans=$withval],
|
||||
[ans=yes]
|
||||
)
|
||||
case "$ans" in
|
||||
yes | no)
|
||||
ans=32
|
||||
;;
|
||||
[[1-9]][[0-9]]*) ;;
|
||||
*) AC_MSG_ERROR(["--with-memlock requires an integer argument."])
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT([$ans])
|
||||
AC_DEFINE_UNQUOTED([DFLT_RLIMIT_MEMLOCK], [$ans],
|
||||
[Default number of megabytes for RLIMIT_MEMLOCK])
|
||||
|
||||
|
||||
# some OSes prefer _exit() in forked children to exit()
|
||||
AC_CHECK_FUNCS([_exit])
|
||||
ntp_worker_child_exit=exit
|
||||
@@ -4211,6 +4160,24 @@ case "$ans" in
|
||||
esac
|
||||
|
||||
|
||||
AC_MSG_CHECKING([if we want the explicit 127.0.0.0/8 martian filter])
|
||||
AC_ARG_ENABLE(
|
||||
[bug3020-fix],
|
||||
[AS_HELP_STRING(
|
||||
[--enable-bug3020-fix],
|
||||
[+ Provide the explicit 127.0.0.0/8 martian filter]
|
||||
)],
|
||||
[ans=$enableval],
|
||||
[ans=yes]
|
||||
)
|
||||
AC_MSG_RESULT([$ans])
|
||||
case "$ans" in
|
||||
yes)
|
||||
AC_DEFINE([ENABLE_BUG3020_FIX], [1],
|
||||
[Provide the explicit 127.0.0.0/8 martian filter?])
|
||||
esac
|
||||
|
||||
|
||||
AC_MSG_CHECKING([if we should use the IRIG sawtooth filter])
|
||||
|
||||
case "$host" in
|
||||
@@ -4375,6 +4342,28 @@ case "$ntp_ok" in
|
||||
esac
|
||||
AC_MSG_RESULT([$ntp_ok])
|
||||
|
||||
###
|
||||
|
||||
AC_MSG_CHECKING([if we want dynamic interleave support])
|
||||
AC_ARG_ENABLE(
|
||||
[dynamic-interleave],
|
||||
[AS_HELP_STRING(
|
||||
[--enable-dynamic-interleave],
|
||||
[- dynamic interleave support]
|
||||
)],
|
||||
[ntp_ok=$enableval],
|
||||
[ntp_ok=no]
|
||||
)
|
||||
ntp_dynamic_interleave=0
|
||||
case "$ntp_ok" in
|
||||
yes)
|
||||
ntp_dynamic_interleave=1
|
||||
;;
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED([DYNAMIC_INTERLEAVE], [$ntp_dynamic_interleave],
|
||||
[support dynamic interleave?])
|
||||
AC_MSG_RESULT([$ntp_ok])
|
||||
|
||||
NTP_UNITYBUILD
|
||||
|
||||
dnl gtest is needed for our tests subdirs. It would be nice if we could
|
||||
@@ -4382,6 +4371,8 @@ dnl require a C++ compiler only if we will use gtest, but AC_PROG_CXX
|
||||
dnl can't be conditionalized.
|
||||
NTP_GOOGLETEST
|
||||
|
||||
NTP_PROBLEM_TESTS
|
||||
|
||||
###
|
||||
|
||||
AC_DEFINE_DIR([NTP_KEYSDIR], [sysconfdir],
|
||||
@@ -4406,6 +4397,7 @@ AC_CONFIG_FILES([ntpsnmpd/Makefile])
|
||||
AC_CONFIG_FILES([parseutil/Makefile])
|
||||
AC_CONFIG_FILES([scripts/Makefile])
|
||||
AC_CONFIG_FILES([scripts/build/Makefile])
|
||||
AC_CONFIG_FILES([scripts/build/genAuthors], [chmod +x scripts/build/genAuthors])
|
||||
AC_CONFIG_FILES([scripts/build/mkver], [chmod +x scripts/build/mkver])
|
||||
AC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
|
||||
AC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
|
||||
@@ -4425,6 +4417,7 @@ AC_CONFIG_FILES([tests/Makefile])
|
||||
AC_CONFIG_FILES([tests/bug-2803/Makefile])
|
||||
AC_CONFIG_FILES([tests/libntp/Makefile])
|
||||
AC_CONFIG_FILES([tests/ntpd/Makefile])
|
||||
AC_CONFIG_FILES([tests/ntpq/Makefile])
|
||||
AC_CONFIG_FILES([tests/sandbox/Makefile])
|
||||
AC_CONFIG_FILES([tests/sec-2853/Makefile])
|
||||
AC_CONFIG_FILES([util/Makefile])
|
||||
|
||||
@@ -20,7 +20,7 @@ color: #FF0000;
|
||||
<img src="pic/alice44.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/%7emills/pictures.html">from <i>Alice's Adventures in Wonderland</i>, Lewis Carroll</a>
|
||||
<p>Our resident cryptographer; now you see him, now you don't.</p>
|
||||
<p>Last update:
|
||||
<!-- #BeginDate format:En2m -->1-Dec-2012 04:44<!-- #EndDate -->
|
||||
<!-- #BeginDate format:En2m -->5-Feb-2016 09:13<!-- #EndDate -->
|
||||
UTC</p>
|
||||
<br clear="left">
|
||||
<h4>Related Links</h4>
|
||||
@@ -35,28 +35,28 @@ color: #FF0000;
|
||||
</ul>
|
||||
<hr>
|
||||
<h4 id="auth">Introduction</h4>
|
||||
<p>This page describes the various cryptographic authentication provisions in NTPv4. Authentication support allows the NTP client to verify that servers are in fact known and trusted and not intruders intending accidentally or intentionally to masquerade as a legitimate server. A detailed discussion of the NTP multi-layer security model and vulnerability analysis is in the white paper <a href="http://www.eecis.udel.edu/~mills/security.html">NTP Security Analysis</a>.</p>
|
||||
<p> The NTPv3 specification (RFC-1305) defined an authentication scheme properly described as <em>symmetric key cryptography</em>. It used the Data Encryption Standard (DES) algorithm operating in cipher-block chaining (CBC) mode. Subsequently, this algorithm was replaced by the RSA Message Digest 5 (MD5) algorithm commonly called keyed-MD5. Either algorithm computes a message digest or one-way hash which can be used to verify the client has the same message digest as the server. The MD5 message digest algorithm is included in the distribution, so without further cryptographic support, the distribution can be freely exported.</p>
|
||||
<p>If the OpenSSL cryptographic library is installed prior to building the distribution, all message digest algorithms included in the library may be used, including SHA and SHA1. However, if conformance to FIPS 140-2 is required, only a limited subset of these algorithms can be used. This library is available from <a href="http://www.openssl.org">http://www.openssl.org</a> and can be installed using the procedures outlined in the <a href="build.html">Building and Installing the Distribution</a> page. Once installed, the configure and build process automatically detects the library and links the library routines
|
||||
<p>This page describes the various cryptographic authentication provisions in NTPv4. Authentication support allows the NTP client to verify that servers are in fact known and trusted and not intruders intending accidentally or intentionally to masquerade as a legitimate server. A detailed discussion of the NTP multi-layer security model and vulnerability analysis is in the white paper <a href="http://www.eecis.udel.edu/~mills/security.html">NTP Security Analysis</a>.</p>
|
||||
<p> The NTPv3 specification (RFC-1305) defined an authentication scheme properly described as <em>symmetric key cryptography</em>. It used the Data Encryption Standard (DES) algorithm operating in cipher-block chaining (CBC) mode. Subsequently, this algorithm was replaced by the RSA Message Digest 5 (MD5) algorithm commonly called keyed-MD5. Either algorithm computes a message digest or one-way hash which can be used to verify the client has the same message digest as the server. The MD5 message digest algorithm is included in the distribution, so without further cryptographic support, the distribution can be freely exported.</p>
|
||||
<p>If the OpenSSL cryptographic library is installed prior to building the distribution, all message digest algorithms included in the library may be used, including SHA and SHA1. However, if conformance to FIPS 140-2 is required, only a limited subset of these algorithms can be used. This library is available from <a href="http://www.openssl.org">http://www.openssl.org</a> and can be installed using the procedures outlined in the <a href="build.html">Building and Installing the Distribution</a> page. Once installed, the configure and build process automatically detects the library and links the library routines
|
||||
required.</p>
|
||||
<p>In addition to the symmetric key algorithms, this distribution includes support for the Autokey public key algorithms and protocol specified in RFC-5906 "Network Time Protocol Version 4: Autokey Specification". This support is available only if the OpenSSL library has been installed and the <tt>--enable-autokey</tt> option is used when the distribution is built.</p>
|
||||
<p> Public key cryptography is generally considered more secure than symmetric key cryptography, since the security is based on private and public values which are generated by each participant and where the private value is never revealed. Autokey uses X.509 public certificates, which can be produced by commercial services, the OpenSSL application program, or the <a href="keygen.html"><tt>ntp-keygen</tt></a> utility program in the NTP software distribution.</p>
|
||||
<p>Note that according to US law, NTP binaries including OpenSSL library components, including the OpenSSL library itself, cannot be exported outside the US without license from the US Department of Commerce. Builders outside the US are advised to obtain the OpenSSL library directly from OpenSSL, which is outside the US, and build outside the US.</p>
|
||||
<p>Authentication is configured separately for each association using the <tt>key</tt> or <tt>autokey</tt> option of the <tt>server</tt> configuration command, as described in the <a href="confopt.html">Server Options</a> page. The <a href="keygen.html">ntp-keygen</a> page describes the files required for the various authentication schemes. Further details are in the briefings, papers and reports at the NTP project page linked from <a href="http://www.ntp.org">www.ntp.org</a>.</p>
|
||||
<p>By default, the client sends non-authenticated packets and the server responds with non-authenticated packets. If the client sends authenticated packets, the server responds with authenticated packets if correct, or a crypto-NAK packet if not.. In the case of unsolicited packets which might consume significant resources, such as broadcast or symmetric mode packets, , authentication is required, unless overridden by a <tt>disable auth</tt> command. In the current climate of targeted broadcast or "letterbomb" attacks, defeating this requirement would be decidedly dangerous. In any case, the <tt>notrust </tt>flag, described on the <a href="authopt.html">Access Control Options</a> page, can be used to disable access to all but correctly authenticated clients..</p>
|
||||
<p>In addition to the symmetric key algorithms, this distribution includes support for the Autokey public key algorithms and protocol specified in RFC-5906 "Network Time Protocol Version 4: Autokey Specification". This support is available only if the OpenSSL library has been installed and the <tt>--enable-autokey</tt> option is used when the distribution is built.</p>
|
||||
<p> Public key cryptography is generally considered more secure than symmetric key cryptography, since the security is based on private and public values which are generated by each participant and where the private value is never revealed. Autokey uses X.509 public certificates, which can be produced by commercial services, the OpenSSL application program, or the <a href="keygen.html"><tt>ntp-keygen</tt></a> utility program in the NTP software distribution.</p>
|
||||
<p>Note that according to US law, NTP binaries including OpenSSL library components, including the OpenSSL library itself, cannot be exported outside the US without license from the US Department of Commerce. Builders outside the US are advised to obtain the OpenSSL library directly from OpenSSL, which is outside the US, and build outside the US.</p>
|
||||
<p>Authentication is configured separately for each association using the <tt>key</tt> or <tt>autokey</tt> option of the <tt>server</tt> configuration command, as described in the <a href="confopt.html">Server Options</a> page. The <a href="keygen.html">ntp-keygen</a> page describes the files required for the various authentication schemes. Further details are in the briefings, papers and reports at the NTP project page linked from <a href="http://www.ntp.org">www.ntp.org</a>.</p>
|
||||
<p>By default, the client sends non-authenticated packets and the server responds with non-authenticated packets. If the client sends authenticated packets, the server responds with authenticated packets if correct, or a crypto-NAK packet if not. In the case of unsolicited packets which might consume significant resources, such as broadcast or symmetric mode packets, authentication is required, unless overridden by a <tt>disable auth</tt> command. In the current climate of targeted broadcast or "letterbomb" attacks, defeating this requirement would be decidedly dangerous. In any case, the <tt>notrust </tt>flag, described on the <a href="authopt.html">Access Control Options</a> page, can be used to disable access to all but correctly authenticated clients.</p>
|
||||
<h4 id="symm">Symmetric Key Cryptography</h4>
|
||||
<p>The original NTPv3 specification (RFC-1305), as well as the current NTPv4 specification (RFC-5905), allows any one of possibly 65,534 message digest keys (excluding zero), each distinguished by a 32-bit key ID, to authenticate an association. The servers and clients involved must agree on the key ID, key type and key to authenticate NTP packets.</p>
|
||||
<p>The message digest is a cryptographic hash computed by an algorithm such as MD5 or SHA. When authentication is specified, a message authentication code (MAC) is appended to the NTP packet header. The MAC consists of a 32-bit key identifier (key ID) followed by a 128- or 160-bit message digest. The algorithm computes the digest as the hash of a 128- or 160- bit message digest key concatenated with the NTP packet header fields with the exception of the MAC. On transmit, the message digest is computed and inserted in the MAC. On receive, the message digest is computed and compared with the MAC. The packet is accepted only if the two MACs are identical. If a discrepancy is found by the client, the client ignores the packet, but raises an alarm. If this happens at the server, the server returns a special message called a <em>crypto-NAK</em>. Since the crypto-NAK is protected by the loopback test, an intruder cannot disrupt the protocol by sending a bogus crypto-NAK.</p>
|
||||
<p>Keys and related information are specified in a keys file, which must be distributed and stored using secure means beyond the scope of the NTP protocol itself. Besides the keys used for ordinary NTP associations, additional keys can be used as passwords for the <tt><a href="ntpq.html">ntpq</a></tt> and <tt><a href="ntpdc.html">ntpdc</a></tt> utility programs. Ordinarily, the <tt>ntp.keys</tt> file is generated by the <tt><a href="keygen.html">ntp-keygen</a></tt> program, but it can be constructed and edited using an ordinary text editor.</p>
|
||||
<p> Each line of the keys file consists of three fields: a key ID in the range 1 to 65,534, inclusive, a key type, and a message digest key consisting of a printable ASCII string less than 40 characters, or a 40-character hex digit string. If the OpenSSL library is installed, the key type can be any message digest algorithm supported by the library. If the OpenSSL library is not installed, the only permitted key type is MD5.</p>
|
||||
<p>The original NTPv3 specification (RFC-1305), as well as the current NTPv4 specification (RFC-5905), allows any one of possibly 65,534 message digest keys (excluding zero), each distinguished by a 32-bit key ID, to authenticate an association. The servers and clients involved must agree on the key ID, key type and key to authenticate NTP packets.</p>
|
||||
<p>The message digest is a cryptographic hash computed by an algorithm such as MD5 or SHA. When authentication is specified, a message authentication code (MAC) is appended to the NTP packet header. The MAC consists of a 32-bit key identifier (key ID) followed by a 128- or 160-bit message digest. The algorithm computes the digest as the hash of a 128- or 160- bit message digest key concatenated with the NTP packet header fields with the exception of the MAC. On transmit, the message digest is computed and inserted in the MAC. On receive, the message digest is computed and compared with the MAC. The packet is accepted only if the two MACs are identical. If a discrepancy is found by the client, the client ignores the packet, but raises an alarm. If this happens at the server, the server returns a special message called a <em>crypto-NAK</em>. Since the crypto-NAK is protected by the loopback test, an intruder cannot disrupt the protocol by sending a bogus crypto-NAK.</p>
|
||||
<p>Keys and related information are specified in a keys file, which must be distributed and stored using secure means beyond the scope of the NTP protocol itself. Besides the keys used for ordinary NTP associations, additional keys can be used as passwords for the <tt><a href="ntpq.html">ntpq</a></tt> and <tt><a href="ntpdc.html">ntpdc</a></tt> utility programs. Ordinarily, the <tt>ntp.keys</tt> file is generated by the <tt><a href="keygen.html">ntp-keygen</a></tt> program, but it can be constructed and edited using an ordinary text editor.</p>
|
||||
<p> Each line of the keys file consists of three or four fields: a key ID in the range 1 to 65,534, inclusive, a key type, a message digest key consisting of a printable ASCII string less than 40 characters or a 40-character hex digit string, and an optional comma-separated list of IPs that are allowed to serve time. If the OpenSSL library is installed, the key type can be any message digest algorithm supported by the library. If the OpenSSL library is not installed, the only permitted key type is MD5.</p>
|
||||
<div align="center">
|
||||
<p><img src="pic/sx5.gif" alt="gif"></p>
|
||||
<p>Figure 1. Typical Symmetric Key File</p>
|
||||
</div>
|
||||
<p>Figure 1 shows a typical keys file used by the reference implementation when the OpenSSL library is installed. In this figure, for key IDs in he range 1-10, the key is interpreted as a printable ASCII string. For key IDs in the range 11-20, the key is a 40-character hex digit string. The key is truncated or zero-filled internally to either 128 or 160 bits, depending on the key type. The line can be edited later or new lines can be added to change any field. The key can be change to a password, such as <tt>2late4Me</tt> for key ID 10. Note that two or more keys files can be combined in any order as long as the key IDs are distinct.</p>
|
||||
<p>When <tt>ntpd</tt> is started, it reads the keys file specified by the <tt>keys</tt> command and installs the keys in the key cache. However, individual keys must be activated with the <tt>trustedkey</tt> configuration command before use. This allows, for instance, the installation of possibly several batches of keys and then activating a key remotely using <tt>ntpq</tt> or <tt>ntpdc</tt>. The <tt>requestkey</tt> command selects the key ID used as the password for the <tt>ntpdc</tt> utility, while the <tt>controlkey</tt> command selects the key ID used as the password for the <tt>ntpq</tt> utility.</p>
|
||||
<p>Figure 1 shows a typical keys file used by the reference implementation when the OpenSSL library is installed. In this figure, for key IDs in he range 1-10, the key is interpreted as a printable ASCII string. For key IDs in the range 11-20, the key is a 40-character hex digit string. The key is truncated or zero-filled internally to either 128 or 160 bits, depending on the key type. The line can be edited later or new lines can be added to change any field. The key can be change to a password, such as <tt>2late4Me</tt> for key ID 10. Note that two or more keys files can be combined in any order as long as the key IDs are distinct.</p>
|
||||
<p>When <tt>ntpd</tt> is started, it reads the keys file specified by the <tt>keys</tt> command and installs the keys in the key cache. However, individual keys must be activated with the <tt>trustedkey</tt> configuration command before use. This allows, for instance, the installation of possibly several batches of keys and then activating a key remotely using <tt>ntpq</tt> or <tt>ntpdc</tt>. The <tt>requestkey</tt> command selects the key ID used as the password for the <tt>ntpdc</tt> utility, while the <tt>controlkey</tt> command selects the key ID used as the password for the <tt>ntpq</tt> utility.</p>
|
||||
<h4 id="windows">Microsoft Windows Authentication</h4>
|
||||
<p>In addition to the above means, <tt>ntpd</tt> now supports Microsoft Windows MS-SNTP authentication using Active Directory services. This support was contributed by the Samba Team and is still in development. It is enabled using the <tt>mssntp</tt> flag of the <tt>restrict</tt> command described on the <a href="accopt.html#restrict">Access Control Options</a> page. <span class="style1">Note: Potential users should be aware that these services involve a TCP connection to another process that could potentially block, denying services to other users. Therefore, this flag should be used only for a dedicated server with no clients other than MS-SNTP.</span></p>
|
||||
<p>In addition to the above means, <tt>ntpd</tt> now supports Microsoft Windows MS-SNTP authentication using Active Directory services. This support was contributed by the Samba Team and is still in development. It is enabled using the <tt>mssntp</tt> flag of the <tt>restrict</tt> command described on the <a href="accopt.html#restrict">Access Control Options</a> page. <span class="style1">Note: Potential users should be aware that these services involve a TCP connection to another process that could potentially block, denying services to other users. Therefore, this flag should be used only for a dedicated server with no clients other than MS-SNTP.</span></p>
|
||||
<h4 id="pub">Public Key Cryptography</h4>
|
||||
<p>See the <a href="autokey.html">Autokey Public-Key Authentication</a> page.</p>
|
||||
<hr>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<img src="pic/alice47.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/%7emills/pictures.html">from <i>Alice's Adventures in Wonderland</i>, Lewis Carroll</a>
|
||||
<p>Caterpillar knows all the error codes, which is more than most of us do.</p>
|
||||
<p>Last update:
|
||||
<!-- #BeginDate format:En2m -->16-Jul-2014 04:48<!-- #EndDate -->
|
||||
<!-- #BeginDate format:En2m -->26-Jul-2015 06:26<!-- #EndDate -->
|
||||
UTC</p>
|
||||
</p>
|
||||
<br clear="left">
|
||||
@@ -296,7 +296,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><tt>3</tt></td>
|
||||
<td><tt>sel_outlyer</tt></td>
|
||||
<td><tt>sel_outlier</tt></td>
|
||||
<td><tt>-</tt></td>
|
||||
<td>discarded by the cluster algorithm</td>
|
||||
</tr>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<body>
|
||||
<h3>JJY Receivers</h3>
|
||||
<p>Last update:
|
||||
<!-- #BeginDate format:En2m -->15-May-2015 00:00<!-- #EndDate -->
|
||||
<!-- #BeginDate format:En2m -->08-May-2016 00:00<!-- #EndDate -->
|
||||
UTC <a href="driver40.html">ENGLISH</a> <a href="driver40-ja.html">JAPANESE</a></p>
|
||||
<hr>
|
||||
<h4>Synopsis</h4>
|
||||
@@ -136,7 +136,7 @@
|
||||
<tr>
|
||||
<td><code>{ENQ}1J{ETX}</code></td>
|
||||
<td> --> </td>
|
||||
<td><code>{STX}JYYMMDD HHMMSSS{ETX}</code></td>
|
||||
<td><code>{STX}JYYMMDDWHHMMSSS{ETX}</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
|
||||
<title>Miscellaneous Commands and Options</title>
|
||||
<!-- Changed by: Harlan Stenn, 29-Jun-2015 -->
|
||||
<!-- Changed by: Harlan Stenn, 17-Nov-2015 -->
|
||||
<link href="scripts/style.css" type="text/css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
@@ -11,7 +11,7 @@
|
||||
<img src="pic/boom3.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html">from <i>Pogo</i>, Walt Kelly</a>
|
||||
<p>We have three, now looking for more.</p>
|
||||
<p>Last update:
|
||||
<!-- #BeginDate format:En2m -->29-Jun-2015 05:56<!-- #EndDate -->
|
||||
<!-- #BeginDate format:En2m -->9-Nov-2016 12:26<!-- #EndDate -->
|
||||
UTC</p>
|
||||
<br clear="left">
|
||||
<h4>Related Links</h4>
|
||||
@@ -29,8 +29,9 @@
|
||||
<dd>The file format consists of a single line containing a single floating point number, which records the frequency offset measured in parts-per-million (PPM). The file is updated by first writing the current drift value into a temporary file and then renaming this file to replace the old version.</dd>
|
||||
<dt id="dscp"><tt>dscp <i>dscp</i></tt></dt>
|
||||
<dd>This command specifies the Differentiated Services Code Point (DSCP) value that is used in sent NTP packets. The default value is 46 for Expedited Forwarding (EF).</dd>
|
||||
<dt id="enable"><tt>enable [auth | bclient | calibrate | kernel | mode7 | monitor | ntp | stats]</tt><br>
|
||||
<tt>disable [auth | bclient | calibrate | kernel | mode7 | monitor | ntp | stats]</tt></dt>
|
||||
<dt id="enable"><tt>enable [auth | bclient | calibrate | kernel | mode7 | monitor | ntp | stats | unpeer_crypto_early | unpeer_crypto_nak_early | unpeer_digest_early]</tt></dt>
|
||||
|
||||
<dt><tt>disable [auth | bclient | calibrate | kernel | mode7 | monitor | ntp | stats | unpeer_crypto_early | unpeer_crypto_nak_early | unpeer_digest_early]</tt></dt>
|
||||
<dd>Provides a way to enable or disable various system options. Flags not mentioned are unaffected. Note that most of these flags can be modified remotely using <a href="ntpq.html"><tt>ntpq</tt></a> utility program's <tt>:config</tt> and <tt>config-from-file</tt> commands.
|
||||
<dl>
|
||||
<dt><tt>auth</tt></dt>
|
||||
@@ -50,6 +51,13 @@
|
||||
<dd>Enables time and frequency discipline. In effect, this switch opens and closes the feedback loop, which is useful for testing. The default for this flag is enable.</dd>
|
||||
<dt><tt>stats</tt></dt>
|
||||
<dd>Enables the statistics facility. See the <a href="monopt.html">Monitoring Options</a> page for further information. The default for this flag is enabled. This flag is excluded from runtime configuration using <tt>ntpq</tt>.</dd>
|
||||
| unpeer_crypto_early | unpeer_crypto_nak_early | unpeer_digest_early
|
||||
<dt><tt>unpeer_crypto_early</tt></dt>
|
||||
<dd>Enables the early resetting of an association in case of a crypto failure. This is generally a feature, but it can be used in a DoS attack. If you are seeing these packets being used as a DoS attack against your server, you should disable this flag. The default for this flag is enabled. This flag is excluded from runtime configuration using <tt>ntpq</tt>.</dd>
|
||||
<dt><tt>unpeer_crypto_nak_early</tt></dt>
|
||||
<dd>Enables the early resetting of an association in case of a crypto_NAK message. This is generally a feature, but it can be used in a DoS attack. If you are seeing these packets being used as a DoS attack against your server, you should disable this flag. The default for this flag is enabled. This flag is excluded from runtime configuration using <tt>ntpq</tt>.</dd>
|
||||
<dt><tt>unpeer_digest_early</tt></dt>
|
||||
<dd>Enables the early resetting of an association in case of an autokey digest failur. This is generally a feature, but it can be used in a DoS attack. If you are seeing these packets being used as a DoS attack against your server, you should disable this flag. The default for this flag is enabled. This flag is excluded from runtime configuration using <tt>ntpq</tt>.</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt id="includefile"><tt>includefile <i>includefile</i></tt></dt>
|
||||
@@ -57,7 +65,7 @@
|
||||
<dt id="interface"><tt>interface [listen | ignore | drop] [all | ipv4 | ipv6 | wildcard | <i>name</i> | <i>address</i>[/<i>prefixlen</i>]]</tt></dt>
|
||||
<dd>This command controls which network addresses <tt>ntpd</tt> opens, and whether input is dropped without processing. The first parameter determines the action for addresses which match the second parameter. That parameter specifies a class of addresses, or a specific interface name, or an address. In the address case, <tt><i>prefixlen</i></tt> determines how many bits must match for this rule to apply. <tt>ignore</tt> prevents opening matching addresses, <tt>drop</tt> causes <tt>ntpd</tt> to open the address and drop all received packets without examination. Multiple <tt>interface</tt> commands can be used. The last rule which matches a particular address determines the action for it. <tt>interface</tt> commands are disabled if any <a href="ntpd.html#--interface"><tt>-I</tt></a>, <a href="ntpd.html#--interface"><tt>--interface</tt></a>, <a href="ntpd.html#--novirtualips"><tt>-L</tt></a>, or <a href="ntpd.html#--novirtualips"><tt>--novirtualips</tt></a> command-line options are used. If none of those options are used and no <tt>interface</tt> actions are specified in the configuration file, all available network addresses are opened. The <tt>nic</tt> command is an alias for <tt>interface</tt>.</dd>
|
||||
<dt id="leapfile"><tt>leapfile <i>leapfile</i></tt></dt>
|
||||
<dd>This command loads the NIST leapseconds file and initializes the leapsecond values for the next leapsecond time, expiration time and TAI offset. The file can be obtained directly from NIST national time servers using <tt>ftp</tt> as the ASCII file <tt>pub/leap-seconds</tt>.</dd>
|
||||
<dd>This command loads the IERS leapseconds file and initializes the leapsecond values for the next leapsecond time, expiration time and TAI offset. The file can be obtained directly from the IERS at <a href="https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list">https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list</a> or <a href="ftp://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list">ftp://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list</a>.</dd>
|
||||
<dd>The <i>leapfile</i> is scanned when <tt>ntpd</tt> processes the <tt>leapfile</tt> directive or when <tt>ntpd</tt> detects that <i>leapfile</i> has changed. <tt>ntpd</tt> checks once a day to see if the <i>leapfile</i> has changed.</dd>
|
||||
<dd>While not strictly a security function, the Autokey protocol provides means to securely retrieve the current or updated leapsecond values from a server.</dd>
|
||||
<dt id="leapsmearinterval"><tt>leapsmearinterval <i>seconds</i></tt></dt>
|
||||
@@ -105,7 +113,7 @@
|
||||
<dd>
|
||||
<dl>
|
||||
<dt><tt>memlock <i>Nmegabytes</i></tt></dt>
|
||||
<dd>Specify the number of megabytes of memory that can be allocated. Probably only available under Linux, this option is useful when dropping root (the <tt>-i</tt> option). The default is 32 megabytes. Setting this to zero will prevent any attemp to lock memory.</dd>
|
||||
<dd>Specify the number of megabytes of memory that should be allocated and locked. Probably only available under Linux, this option may be useful when dropping root (the <tt>-i</tt> option). The default is 32 megabytes on non-Linux machines, and -1 under Linux. -1 means "do not lock the process into memory". 0 means "lock whatever memory the process wants into memory".</dd>
|
||||
<dt><tt>stacksize <i>N4kPages</i></tt></dt>
|
||||
<dd>Specifies the maximum size of the process stack on systems with the <tt>mlockall()</tt> function. Defaults to 50 4k pages (200 4k pages in OpenBSD).</dd>
|
||||
<dt><tt>filenum <i>Nfiledescriptors</i></tt></dt>
|
||||
@@ -121,7 +129,7 @@
|
||||
<dd>
|
||||
<dl>
|
||||
<dt><tt>allan <i>allan</i></tt></dt>
|
||||
<dd>Specifies the Allan intercept, which is a parameter of the PLL/FLL clock discipline algorithm, in seconds with default 1500 s.</dd>
|
||||
<dd>Specifies the Allan intercept, which is a parameter of the PLL/FLL clock discipline algorithm, in log2 seconds with default 11 (2048 s).</dd>
|
||||
<dt><tt>dispersion <i>dispersion</i></tt></dt>
|
||||
<dd>Specifies the dispersion increase rate in parts-per-million (PPM) with default 15 PPM.</dd>
|
||||
<dt><tt>freq <i>freq</i></tt></dt>
|
||||
@@ -137,10 +145,12 @@
|
||||
<dd>Specifies the stepout threshold in seconds. The default without this command is 300 s. Since this option also affects the training and startup intervals, it should not be set less than the default. Further details are on the <a href="clock.html">Clock State Machine</a> page.</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt id="tos"><tt>tos [beacon <i>beacon</i> | ceiling <i>ceiling</i> | cohort {0 | 1} | floor <i>floor</i> | maxclock <i>maxclock </i>| maxdist <i>maxdist</i> | minclock <i>minclock</i> | mindist <i>mindist </i>| minsane <i>minsane</i> | orphan <i>stratum</i> | orphanwait <em>delay</em>]</tt></dt>
|
||||
<dt id="tos"><tt>tos [bcpollbstep <i>poll-gate</i> | beacon <i>beacon</i> | ceiling <i>ceiling</i> | cohort {0 | 1} | floor <i>floor</i> | maxclock <i>maxclock </i>| maxdist <i>maxdist</i> | minclock <i>minclock</i> | mindist <i>mindist </i>| minsane <i>minsane</i> | orphan <i>stratum</i> | orphanwait <em>delay</em>]</tt></dt>
|
||||
<dd>This command alters certain system variables used by the the clock selection and clustering algorithms. The default values of these variables have been carefully optimized for a wide range of network speeds and reliability expectations. Very rarely is it necessary to change the default values; but, some folks can't resist twisting the knobs. It can be used to select the quality and quantity of peers used to synchronize the system clock and is most useful in dynamic server discovery schemes. The options are as follows:</dd>
|
||||
<dd>
|
||||
<dl>
|
||||
<dt><tt>bcpollbstep <i>poll-gate</i></tt></dt>
|
||||
<dd>This option will cause the client to delay believing backward time steps from a broadcast server for <tt>bcpollbstep</tt> poll intervals. NTP Broadcast networks are expected to be trusted, and if the server's time gets stepped backwards then it's desireable that the clients follow this change as soon as possible. However, in spite of various protections built-in to the broadcast protocol, it is possible that an attacker could perform a carefully-constructed replay attack and cause clients to erroneously step their clocks backward. If the risk of a successful broadcast replay attack is greater than the risk of the clients being out of sync in the event that there is a backward step on the broadcast time servers, this option may be used to cause the clients to delay beliveving backward time steps until <i>poll-gate</i> consecutive polls have been received. The default is 0, which means the client will accept these steps upon receipt. Any value from 0 to 4 can be specified.</dd>
|
||||
<dt><tt>beacon <i>beacon</i></tt></dt>
|
||||
<dd>The manycast server sends packets at intervals of 64 s if less than <tt>maxclock</tt> servers are available. Otherwise, it sends packets at the <i><tt>beacon</tt></i> interval in seconds. The default is 3600 s. See the <a href="discover.html">Automatic Server Discovery</a> page for further details.</dd>
|
||||
<dt><tt>ceiling <i>ceiling</i></tt></dt>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<img src="pic/pogo8.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html"></a> from <i>Pogo</i>, Walt Kelly</a>
|
||||
<p>Pig was hired to watch the logs.</p>
|
||||
<p>Last update:
|
||||
<!-- #BeginDate format:En2m -->31-Jan-2014 06:54<!-- #EndDate -->
|
||||
<!-- #BeginDate format:En2m -->14-Feb-2016 09:38<!-- #EndDate -->
|
||||
UTC</p>
|
||||
<br clear="left">
|
||||
<h4>Related Links</h4>
|
||||
@@ -295,7 +295,7 @@
|
||||
<dd>The status field is encoded in hex format as described in Appendix B of
|
||||
the NTP specification RFC 1305.</dd>
|
||||
<dt><tt>protostats</tt></dt>
|
||||
<dd>Record significant peer, system and [rptpcp; events. Each significant event
|
||||
<dd>Record significant peer, system and protocol events. Each significant event
|
||||
appends one line to the <tt>protostats</tt> file set:</dd>
|
||||
<dd><tt>49213 525.624 128.4.1.1 963a 8a <i>message</i></tt></dd>
|
||||
<dd>
|
||||
|
||||
+24
-24
@@ -7,9 +7,9 @@
|
||||
<link href="scripts/style.css" type="text/css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<h3>Performance Metrics</h3>
|
||||
<h3>Performance Metrics</h3>
|
||||
<p>Last update:
|
||||
<!-- #BeginDate format:En2m -->10-Mar-2014 05:23<!-- #EndDate -->
|
||||
<!-- #BeginDate format:En2m -->26-Jul-2015 06:29<!-- #EndDate -->
|
||||
UTC</p>
|
||||
<h4>Related Links</h4>
|
||||
<script type="text/javascript" language="javascript" src="scripts/special.txt"></script>
|
||||
@@ -25,45 +25,45 @@
|
||||
|
||||
<p>This page describes several statistics provided in the NTP specification and reference implementation and how they determine the accuracy and error measured during routine and exceptional operation. These statistics provide the following information.</p>
|
||||
<ul>
|
||||
<li>Nominal estimate of the server clock time relative to the client clock time. This is called <em>clock offset</em> symbolized by the Greek letter θ.</li>
|
||||
<li>Roundtrip system and network delay measured by the on-wire protocol. This is call <em>roundtrip delay</em> symbolized by the Greek letter δ.</li>
|
||||
<li>Potential clock offset error due to the maximum uncorrected system clock frequency error. This is called <em>dispersion</em> symbolized by the Greek letter ε.</li>
|
||||
<li>Expected error, consisting of the root mean square (RMS) nominal clock offset sample differencess in a sliding window of several samples. This is called <em>jitter</em> symbolized by the Greek letter φ.</li>
|
||||
<li>Nominal estimate of the server clock time relative to the client clock time. This is called <em>clock offset</em> symbolized by the Greek letter θ.</li>
|
||||
<li>Roundtrip system and network delay measured by the on-wire protocol. This is call <em>roundtrip delay</em> symbolized by the Greek letter δ.</li>
|
||||
<li>Potential clock offset error due to the maximum uncorrected system clock frequency error. This is called <em>dispersion</em> symbolized by the Greek letter ε.</li>
|
||||
<li>Expected error, consisting of the root mean square (RMS) nominal clock offset sample differencess in a sliding window of several samples. This is called <em>jitter</em> symbolized by the Greek letter φ.</li>
|
||||
</ul>
|
||||
<p> Figure 1 shows how the various measured statistics are collected and compiled to calibrate NTP performance.</p>
|
||||
<div align="center">
|
||||
<img src="pic/stats.gif" alt="gif">
|
||||
<p>Figure 1. Statistics Budget</p>
|
||||
</div>
|
||||
<p>The data represented in boxes labeled Server are contained in fields in packet received from the server. The data represented in boxes labeled Peer are computed by the on-wire protocol, as described below. The algorithms of the box labeled Selection and Combining Algorithms process the peer data to select a system peer. The System box represents summary data inherited from the system peer. These data are available to application programs and dependent downstream clients.</p>
|
||||
<p>The data represented in boxes labeled Server are contained in fields in packet received from the server. The data represented in boxes labeled Peer are computed by the on-wire protocol, as described below. The algorithms of the box labeled Selection and Combining Algorithms process the peer data to select a system peer. The System box represents summary data inherited from the system peer. These data are available to application programs and dependent downstream clients.</p>
|
||||
<h4 id="budget">2. Statistics Summary</h4>
|
||||
<p>Each NTP synchronization source is characterized by the offset θ and delay δ samples measured by the on-wire protocol, as described on the <a href="warp.html">How NTP Works</a> page. In addition, the dispersion ε sample is initialized with the sum of the source precision ρ<sub>R</sub> and the client precision ρ (not shown) as each source packet is received. The dispersion increases at a rate of 15 μs/s after that. For this purpose, the precision is equal to the latency to read the system clock. The offset, delay and dispersion are called the sample statistics.</p>
|
||||
<p>Each NTP synchronization source is characterized by the offset θ and delay δ samples measured by the on-wire protocol, as described on the <a href="warp.html">How NTP Works</a> page. In addition, the dispersion ε sample is initialized with the sum of the source precision ρ<sub>R</sub> and the client precision ρ (not shown) as each source packet is received. The dispersion increases at a rate of 15 μs/s after that. For this purpose, the precision is equal to the latency to read the system clock. The offset, delay and dispersion are called the sample statistics.</p>
|
||||
<blockquote>
|
||||
<p>Note. In very fast networks where the client clock frequency is not within 1 PPM or so of the the server clock frequency, the roundtrip delay may have small negative values. This is usually a temporary condition when the client is first started. When using the roundtrip delay in calculations, negative values are assumed zero.</p>
|
||||
<p>Note. In very fast networks where the client clock frequency is not within 1 PPM or so of the the server clock frequency, the roundtrip delay may have small negative values. This is usually a temporary condition when the client is first started. When using the roundtrip delay in calculations, negative values are assumed zero.</p>
|
||||
</blockquote>
|
||||
<p> In a window of eight (offset, delay, dispersion) samples, the algorithm described on the <a href="filter.html">Clock Filter Algorithm</a> page selects the sample with minimum delay, which generally represents the most accurate offset statistic. The selected offset sample determines the <em>peer offset</em> and <em>peer delay </em>statistics. The <em>peer dispersion</em> is a weighted average of the dispersion samples in the window. These quantities are recalculated as each update is received from the source. Between updates, both the sample dispersion and peer dispersion continue to grow at the same rate, 15 μs/s. Finally, the <em>peer jitter</em> φ is determined as the RMS differences between the offset samples in the window relative to the selected offset sample. The peer statistics are recorded by the <tt>peerstats</tt> option of the <a href="monopt.html#filegen"><tt>filegen</tt></a> command. Peer variables are displayed by the <tt>rv</tt> command of the <a href="ntpq.html#peer"><tt>ntpq</tt></a> program.</p>
|
||||
<p> The clock filter algorithm continues to process updates in this way until the source is no longer reachable. Reachability is determined by an eight-bit shift register, which is shifted left by one bit as each poll packet is sent, with 0 replacing the vacated rightmost bit. Each time a valid update is received, the rightmost bit is set to 1. The source is considered reachable if any bit is set to 1 in the register; otherwise, it is considered unreachable. When a source becomes unreachable, a dummy sample with "infinite" dispersion is inserted in the filter window at each poll, thus displacing old samples. This causes the peer dispersion to increase eventually to infinity.</p>
|
||||
<p>The composition of the source population and the system peer selection is redetermined as each update from each source is received. The system peer and system variables are determined as described on the <a href="prefer.html">Mitigation Rules and the <tt>prefer</tt> Keyword</a> page. The system variables Θ, Δ, Ε and Φ are updated from the system peer variables of the same name and the system stratum set one greater than the system peer stratum. The system statistics are recorded by the <tt>loopstats</tt> option of the <a href="monopt.html#filegen"><tt>filegen</tt></a> command. System variables are displayed by the <tt>rv</tt> command of the <a href="ntpq.html#system"><tt>ntpq</tt></a> program.</p>
|
||||
<p>Although it might seem counterintuitive, a cardinal rule in the selection process is, once a sample has been selected by the clock filter algorithm, older samples are no longer selectable. This applies also to the clock select algorithm. Once the peer variables for a source have been selected, older variables of the same or other sources are no longer selectable. The reason for these rules is to limit the time delay in the clock discipline algorithm. This is necessary to preserve the optimum impulse response and thus the risetime and overshoot.</p>
|
||||
<p> In a window of eight (offset, delay, dispersion) samples, the algorithm described on the <a href="filter.html">Clock Filter Algorithm</a> page selects the sample with minimum delay, which generally represents the most accurate offset statistic. The selected offset sample determines the <em>peer offset</em> and <em>peer delay </em>statistics. The <em>peer dispersion</em> is a weighted average of the dispersion samples in the window. These quantities are recalculated as each update is received from the source. Between updates, both the sample dispersion and peer dispersion continue to grow at the same rate, 15 μs/s. Finally, the <em>peer jitter</em> φ is determined as the RMS differences between the offset samples in the window relative to the selected offset sample. The peer statistics are recorded by the <tt>peerstats</tt> option of the <a href="monopt.html#filegen"><tt>filegen</tt></a> command. Peer variables are displayed by the <tt>rv</tt> command of the <a href="ntpq.html#peer"><tt>ntpq</tt></a> program.</p>
|
||||
<p> The clock filter algorithm continues to process updates in this way until the source is no longer reachable. Reachability is determined by an eight-bit shift register, which is shifted left by one bit as each poll packet is sent, with 0 replacing the vacated rightmost bit. Each time a valid update is received, the rightmost bit is set to 1. The source is considered reachable if any bit is set to 1 in the register; otherwise, it is considered unreachable. When a source becomes unreachable, a dummy sample with "infinite" dispersion is inserted in the filter window at each poll, thus displacing old samples. This causes the peer dispersion to increase eventually to infinity.</p>
|
||||
<p>The composition of the source population and the system peer selection is redetermined as each update from each source is received. The system peer and system variables are determined as described on the <a href="prefer.html">Mitigation Rules and the <tt>prefer</tt> Keyword</a> page. The system variables Θ, Δ, Ε and Φ are updated from the system peer variables of the same name and the system stratum set one greater than the system peer stratum. The system statistics are recorded by the <tt>loopstats</tt> option of the <a href="monopt.html#filegen"><tt>filegen</tt></a> command. System variables are displayed by the <tt>rv</tt> command of the <a href="ntpq.html#system"><tt>ntpq</tt></a> program.</p>
|
||||
<p>Although it might seem counterintuitive, a cardinal rule in the selection process is, once a sample has been selected by the clock filter algorithm, older samples are no longer selectable. This applies also to the clock select algorithm. Once the peer variables for a source have been selected, older variables of the same or other sources are no longer selectable. The reason for these rules is to limit the time delay in the clock discipline algorithm. This is necessary to preserve the optimum impulse response and thus the risetime and overshoot.</p>
|
||||
<p>This means that not every sample can be used to update the peer variables, and up to seven samples can be ignored between selected samples. This fact has been carefully considered in the discipline algorithm design with due consideration for feedback loop delay and minimum sampling rate. In engineering terms, even if only one sample in eight survives, the resulting sample rate is twice the Nyquist rate at any time constant and poll interval.</p>
|
||||
<h4 id="quality">3. Quality of Service</h4>
|
||||
<p>This section discusses how an NTP client determines the system performance using a peer population including reference clocks and remote servers. This is determined for each peer from two statistics, <em>peer jitter</em> and <em>root distance.</em> Peer jitter is determined from various jitter components as described above. It represents the expected error in determining the clock offset estimate. Root distance represents the maximum error of the estimate due to all causes.</p>
|
||||
<p>The root distance statistic is computed as one-half the <em> root delay</em> of the primary source of time; i.e., the reference clock, plus the <em> root dispersion</em> of that source. The root variables are included in the NTP packet header received from each source. At each update the root delay is recomputed as the sum of the root delay in the packet plus the peer delay, while the root dispersion is recomputed as the sum of the root dispersion in the packet plus the peer dispersion.</p>
|
||||
<p>This section discusses how an NTP client determines the system performance using a peer population including reference clocks and remote servers. This is determined for each peer from two statistics, <em>peer jitter</em> and <em>root distance.</em> Peer jitter is determined from various jitter components as described above. It represents the expected error in determining the clock offset estimate. Root distance represents the maximum error of the estimate due to all causes.</p>
|
||||
<p>The root distance statistic is computed as one-half the <em> root delay</em> of the primary source of time; i.e., the reference clock, plus the <em> root dispersion</em> of that source. The root variables are included in the NTP packet header received from each source. At each update the root delay is recomputed as the sum of the root delay in the packet plus the peer delay, while the root dispersion is recomputed as the sum of the root dispersion in the packet plus the peer dispersion.</p>
|
||||
<blockquote>
|
||||
<p>Note. In order to avoid timing loops, the root distance is adjusted to the maximum of the above computation and a <em>minimum threshold.</em> The minimum threshold defaults to 1 ms, but can be changed according to client preference using the <tt>mindist</tt> option of the <a href="miscopt.html#tos"><tt>tos</tt></a> command.</p>
|
||||
<p>Note. In order to avoid timing loops, the root distance is adjusted to the maximum of the above computation and a <em>minimum threshold.</em> The minimum threshold defaults to 1 ms, but can be changed according to client preference using the <tt>mindist</tt> option of the <a href="miscopt.html#tos"><tt>tos</tt></a> command.</p>
|
||||
</blockquote>
|
||||
<p>A source is considered selectable only if its root distance is less than the <em>select threshold</em>, by default 1.5 s, but can be changed according to client preference using the <tt>maxdist</tt> option of the <a href="miscopt.html#tos"><tt>tos</tt></a> command. When an upstream server loses all sources, its root distance apparent to dependent clients continues to increase. The clients are not aware of this condition and continue to accept synchronization as long as the root distance is less than the select threshold.</p>
|
||||
<p>The root distance statistic is used by the select, cluster and mitigation algorithms. In this respect, it is sometimes called the <em>synchronization distance</em> often shortened simply to <em>distance</em>. The root distance is also used in the following ways.</p>
|
||||
<p>A source is considered selectable only if its root distance is less than the <em>select threshold</em>, by default 1.5 s, but can be changed according to client preference using the <tt>maxdist</tt> option of the <a href="miscopt.html#tos"><tt>tos</tt></a> command. When an upstream server loses all sources, its root distance apparent to dependent clients continues to increase. The clients are not aware of this condition and continue to accept synchronization as long as the root distance is less than the select threshold.</p>
|
||||
<p>The root distance statistic is used by the select, cluster and mitigation algorithms. In this respect, it is sometimes called the <em>synchronization distance</em> often shortened simply to <em>distance</em>. The root distance is also used in the following ways.</p>
|
||||
<ul>
|
||||
<li>Root distance defines the maximum error of the clock offset estimate due to all causes as long as the source remains reachable..</li>
|
||||
<li>Root distance defines the upper and lower limits of the correctness interval. This interval represents the maximum clock offset for each of possibly several sources. The clock select algorithm computes the intersection of the correctness intervals to determine the truechimers from the selectable source population.</li>
|
||||
<li>Root distance is used by the clock cluster algorithm as a weight factor when pruning outlyers from the truechimer population.</li>
|
||||
<li>Root distance defines the upper and lower limits of the correctness interval. This interval represents the maximum clock offset for each of possibly several sources. The clock select algorithm computes the intersection of the correctness intervals to determine the truechimers from the selectable source population.</li>
|
||||
<li>Root distance is used by the clock cluster algorithm as a weight factor when pruning outliers from the truechimer population.</li>
|
||||
<li>The (normalized) reciprocal of the root distance is used as a weight factor by the combine algorithm when computing the system clock offset and system jitter.</li>
|
||||
<li>Root distance is used by the mitigation algorithm to select the system peer from among the cluster algorithm survivors.</li>
|
||||
<li>Root distance is used by the mitigation algorithm to select the system peer from among the cluster algorithm survivors.</li>
|
||||
</ul>
|
||||
<p>The root distance thus functions as a metric in the selection and weighting of the various available sources. The strategy is to select the system peer as the source with the minimum root distance and thus the minimum maximum error. The reference implementation uses the Bellman-Ford algorithm described in the literature, where the goal is to minimize the root distance. The algorithm selects the <em>system peer</em>, from which the system root delay and system root dispersion are inherited.</p>
|
||||
<p>The algorithms described on the <a href="prefer.html">Mitigation Rules and the <tt>prefer</tt> Keyword</a> page deliver several important statistics. The <em>system offset</em> and <em>system jitter</em> are weighted averages computed by the clock combine algorithm. System offset is best interpreted as the maximum-likelihood estimate of the system clock offset, while system jitter, also called estimated error, is best interpreted as the expected error of this estimate. <em>System delay</em> is the root delay inherited from the system peer, while <em>s</em><em>ystem dispersion</em> is the root dispersion plus contributions due to jitter and the absolute value of the system offset.</p>
|
||||
<p>The maximum system error, or <em>system distance</em>, is computed as one-half the system delay plus the system dispersion. In order to simplify discussion, certain minor contributions to the maximum error statistic are ignored. If the precision time kernel support is available, both the estimated error and maximum error are reported to user programs via the <tt>ntp_adjtime()</tt> kernel system call. See the <a href="kern.html">Kernel Model for Precision Timekeeping</a> page for further information.</p>
|
||||
<p>The root distance thus functions as a metric in the selection and weighting of the various available sources. The strategy is to select the system peer as the source with the minimum root distance and thus the minimum maximum error. The reference implementation uses the Bellman-Ford algorithm described in the literature, where the goal is to minimize the root distance. The algorithm selects the <em>system peer</em>, from which the system root delay and system root dispersion are inherited.</p>
|
||||
<p>The algorithms described on the <a href="prefer.html">Mitigation Rules and the <tt>prefer</tt> Keyword</a> page deliver several important statistics. The <em>system offset</em> and <em>system jitter</em> are weighted averages computed by the clock combine algorithm. System offset is best interpreted as the maximum-likelihood estimate of the system clock offset, while system jitter, also called estimated error, is best interpreted as the expected error of this estimate. <em>System delay</em> is the root delay inherited from the system peer, while <em>s</em><em>ystem dispersion</em> is the root dispersion plus contributions due to jitter and the absolute value of the system offset.</p>
|
||||
<p>The maximum system error, or <em>system distance</em>, is computed as one-half the system delay plus the system dispersion. In order to simplify discussion, certain minor contributions to the maximum error statistic are ignored. If the precision time kernel support is available, both the estimated error and maximum error are reported to user programs via the <tt>ntp_adjtime()</tt> kernel system call. See the <a href="kern.html">Kernel Model for Precision Timekeeping</a> page for further information.</p>
|
||||
<hr>
|
||||
<script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
|
||||
</body>
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
<img src="pic/pogo4.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/%7emills/pictures.html">from <i>Pogo</i>, Walt Kelly</a>
|
||||
<p>You need a little magic.</p>
|
||||
<p>Last update:
|
||||
<!-- #BeginDate format:En2m -->10-Mar-2014 05:25<!-- #EndDate -->
|
||||
<!-- #BeginDate format:En2m -->6-Feb-2016 07:17<!-- #EndDate -->
|
||||
UTC</p>
|
||||
<br clear="left">
|
||||
<hr>
|
||||
<p>In the protocol described in the NTP specification and reference implementation up to now, the transmit timestamp, which is captured before the message digest is computed and the packet queued for output, is properly called as a <em>softstamp</em> The receive timestamp, which is captured after the input driver interrupt routine and before the packet is queued for input, is properly called a <em>drivestamp</em>. For enhanced accuracy it is desirable to capture the transmit timestamp as close to the wire as possible; for example, after the output driver interrupt routine.</p>
|
||||
<p> In other words, we would like to replace the transmit softstamp with a drivestamp, but the problem is the transmit drivestamp is available only after the packet has been sent. A solution for this problem is the two-step or interleaved protocol described on this page and included in the the current reference implementation. In interleaved modes the transmit drivestamp for one packet is actually carried in the immediately following packet. The trick, however, is to implement the interleaved protocol without changing the NTP packet header format, without compromising backwards compatibility and without compromising the error recovery properties.</p>
|
||||
<p> The reference implementation captures a softstamp before the message digest routine and a drivestamp after the output interrupt routine. In this design the latter timestamp can be considered most accurate, as it avoids the various queuing and transmission latencies. The difference between the two timestamps, which is called the interleaved or output delay, varies from 16 μs for a dual-core Pentium running FreeBSD 6.1 to 1100 μs for a Sun Blade 1500 running Solaris 10.</p>
|
||||
<p>In the protocol described in the NTP specification and reference implementation up to now, the transmit timestamp, which is captured before the message digest is computed and the packet queued for output, is properly called as a <em>softstamp</em>. The receive timestamp, which is captured after the input driver interrupt routine and before the packet is queued for input, is properly called a <em>drivestamp</em>. For enhanced accuracy it is desirable to capture the transmit timestamp as close to the wire as possible; for example, after the output driver interrupt routine.</p>
|
||||
<p> In other words, we would like to replace the transmit softstamp with a drivestamp, but the problem is the transmit drivestamp is available only after the packet has been sent. A solution for this problem is the two-step or interleaved protocol described on this page and included in the the current reference implementation. In interleaved modes the transmit drivestamp for one packet is actually carried in the immediately following packet. The trick, however, is to implement the interleaved protocol without changing the NTP packet header format, without compromising backwards compatibility and without compromising the error recovery properties.</p>
|
||||
<p> The reference implementation captures a softstamp before the message digest routine and a drivestamp after the output interrupt routine. In this design the latter timestamp can be considered most accurate, as it avoids the various queuing and transmission latencies. The difference between the two timestamps, which is called the interleaved or output delay, varies from 16 μs (microseconds) for a dual-core Pentium running FreeBSD 6.1 to 1100 μs (microseconds) for a Sun Blade 1500 running Solaris 10.</p>
|
||||
<p>Interleaved mode can be used only in NTP symmetric and broadcast modes.
|
||||
It is activated by the <tt>xleave</tt> option with the <tt>peer</tt> or <tt>broadcast</tt> configuration
|
||||
commands. A broadcast server configured for interleaved mode is transparent to ordinary broadcast clients, so both ordinary and interleaved broadcast clients can use the same packets. An interleaved symmetric active peer automatically switches to ordinary symmetric mode if the other peer is not capable of operation in interleaved mode. </p>
|
||||
<p>As demonstrated in the white paper <a href="http://www.eecis.udel.edu/~mills/onwire.html">Analysis and Simulation of the NTP On-Wire Protocols</a>, the interleaved modes have the same resistance to lost packets, duplicate packets, packets crossed in flight and protocol restarts as the ordinary modes. An application of the interleaved symmetric mode in space missions is presented in the white paper <a href="http://www.eecis.udel.edu/~mills/proximity.html">Time Synchronization for Space Data Links</a>.</p>
|
||||
commands. A broadcast server configured for interleaved mode is transparent to ordinary broadcast clients, so both ordinary and interleaved broadcast clients can use the same packets. An interleaved symmetric active peer automatically switches to ordinary symmetric mode if the other peer is not capable of operation in interleaved mode.</p>
|
||||
<p>As demonstrated in the white paper <a href="http://www.eecis.udel.edu/~mills/onwire.html">Analysis and Simulation of the NTP On-Wire Protocols</a>, the interleaved modes have the same resistance to lost packets, duplicate packets, packets crossed in flight and protocol restarts as the ordinary modes. An application of the interleaved symmetric mode in space missions is presented in the white paper <a href="http://www.eecis.udel.edu/~mills/proximity.html">Time Synchronization for Space Data Links</a>.</p>
|
||||
<hr>
|
||||
<div align="center"> <img src="pic/pogo1a.gif" alt="gif"> </div>
|
||||
<br>
|
||||
|
||||
@@ -16,6 +16,7 @@ noinst_HEADERS = \
|
||||
intreswork.h \
|
||||
iosignal.h \
|
||||
l_stdlib.h \
|
||||
libssl_compat.h \
|
||||
lib_strbuf.h \
|
||||
libntp.h \
|
||||
mbg_gps166.h \
|
||||
@@ -36,6 +37,7 @@ noinst_HEADERS = \
|
||||
ntp_if.h \
|
||||
ntp_intres.h \
|
||||
ntp_io.h \
|
||||
ntp_keyacc.h \
|
||||
ntp_libopts.h \
|
||||
ntp_lineedit.h \
|
||||
ntp_lists.h \
|
||||
@@ -62,9 +64,11 @@ noinst_HEADERS = \
|
||||
ntpsim.h \
|
||||
parse.h \
|
||||
parse_conf.h \
|
||||
rc_cmdlength.h \
|
||||
recvbuff.h \
|
||||
refclock_atom.h \
|
||||
refidsmear.h \
|
||||
safecast.h \
|
||||
ssl_applink.c \
|
||||
timepps-SCO.h \
|
||||
timepps-Solaris.h \
|
||||
|
||||
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_locinfo.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_openssl.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_pkg_config.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_problemtests.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_prog_cc.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_rlimit.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
|
||||
@@ -227,6 +228,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_THREAD = @BUILD_THREAD@
|
||||
CALC_TICKADJ_DB = @CALC_TICKADJ_DB@
|
||||
CALC_TICKADJ_DL = @CALC_TICKADJ_DL@
|
||||
CALC_TICKADJ_DS = @CALC_TICKADJ_DS@
|
||||
@@ -235,6 +237,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@
|
||||
CFLAGS_NTP = @CFLAGS_NTP@
|
||||
CHUTEST = @CHUTEST@
|
||||
CONFIG_SHELL = @CONFIG_SHELL@
|
||||
@@ -296,6 +299,7 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LSCF = @LSCF@
|
||||
LTHREAD_LIBS = @LTHREAD_LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAKE_ADJTIMED = @MAKE_ADJTIMED@
|
||||
@@ -497,6 +501,7 @@ noinst_HEADERS = \
|
||||
intreswork.h \
|
||||
iosignal.h \
|
||||
l_stdlib.h \
|
||||
libssl_compat.h \
|
||||
lib_strbuf.h \
|
||||
libntp.h \
|
||||
mbg_gps166.h \
|
||||
@@ -517,6 +522,7 @@ noinst_HEADERS = \
|
||||
ntp_if.h \
|
||||
ntp_intres.h \
|
||||
ntp_io.h \
|
||||
ntp_keyacc.h \
|
||||
ntp_libopts.h \
|
||||
ntp_lineedit.h \
|
||||
ntp_lists.h \
|
||||
@@ -543,9 +549,11 @@ noinst_HEADERS = \
|
||||
ntpsim.h \
|
||||
parse.h \
|
||||
parse_conf.h \
|
||||
rc_cmdlength.h \
|
||||
recvbuff.h \
|
||||
refclock_atom.h \
|
||||
refidsmear.h \
|
||||
safecast.h \
|
||||
ssl_applink.c \
|
||||
timepps-SCO.h \
|
||||
timepps-Solaris.h \
|
||||
|
||||
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_locinfo.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_openssl.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_pkg_config.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_problemtests.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_prog_cc.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_rlimit.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
|
||||
@@ -185,6 +186,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_THREAD = @BUILD_THREAD@
|
||||
CALC_TICKADJ_DB = @CALC_TICKADJ_DB@
|
||||
CALC_TICKADJ_DL = @CALC_TICKADJ_DL@
|
||||
CALC_TICKADJ_DS = @CALC_TICKADJ_DS@
|
||||
@@ -193,6 +195,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@
|
||||
CFLAGS_NTP = @CFLAGS_NTP@
|
||||
CHUTEST = @CHUTEST@
|
||||
CONFIG_SHELL = @CONFIG_SHELL@
|
||||
@@ -254,6 +257,7 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LSCF = @LSCF@
|
||||
LTHREAD_LIBS = @LTHREAD_LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAKE_ADJTIMED = @MAKE_ADJTIMED@
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* libssl_compat.h -- OpenSSL v1.1 compatibility shims
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
*
|
||||
* Written by Juergen Perlinger <perlinger@ntp.org> for the NTP project
|
||||
*
|
||||
* Based on an idea by Kurt Roeckx <kurt@roeckx.be>
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
* This is a clean room implementation of shim functions that have
|
||||
* counterparts in the OpenSSL v1.1 API but not in earlier versions.
|
||||
*
|
||||
* If the OpenSSL version used for compilation needs the shims (that is,
|
||||
* does not provide the new functions) the names of these functions are
|
||||
* redirected to our shims.
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef NTP_LIBSSL_COMPAT_H
|
||||
#define NTP_LIBSSL_COMPAT_H
|
||||
|
||||
#include "openssl/evp.h"
|
||||
#include "openssl/dsa.h"
|
||||
#include "openssl/rsa.h"
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
# include <openssl/objects.h>
|
||||
# include <openssl/x509.h>
|
||||
|
||||
/* shim the new-style API on an old-style OpenSSL */
|
||||
|
||||
extern BN_GENCB* sslshimBN_GENCB_new(void);
|
||||
extern void sslshimBN_GENCB_free(BN_GENCB*);
|
||||
|
||||
extern EVP_MD_CTX* sslshim_EVP_MD_CTX_new(void);
|
||||
extern void sslshim_EVP_MD_CTX_free(EVP_MD_CTX *ctx);
|
||||
|
||||
extern int sslshim_EVP_PKEY_id(const EVP_PKEY * pkey);
|
||||
extern int sslshim_EVP_PKEY_base_id(const EVP_PKEY * pkey);
|
||||
extern RSA* sslshim_EVP_PKEY_get0_RSA(EVP_PKEY * pkey);
|
||||
extern DSA* sslshim_EVP_PKEY_get0_DSA(EVP_PKEY * pkey);
|
||||
|
||||
extern void sslshim_RSA_get0_key(const RSA *prsa, const BIGNUM **pn,
|
||||
const BIGNUM **pe, const BIGNUM **pd);
|
||||
extern int sslshim_RSA_set0_key(RSA *prsa, BIGNUM *n,
|
||||
BIGNUM *e, BIGNUM *d);
|
||||
extern void sslshim_RSA_get0_factors(const RSA *prsa, const BIGNUM **pp,
|
||||
const BIGNUM **pq);
|
||||
extern int sslshim_RSA_set0_factors(RSA *prsar, BIGNUM *p, BIGNUM *q);
|
||||
extern int sslshim_RSA_set0_crt_params(RSA *prsa, BIGNUM *dmp1,
|
||||
BIGNUM *dmq1, BIGNUM *iqmp);
|
||||
|
||||
extern void sslshim_DSA_SIG_get0(const DSA_SIG *psig, const BIGNUM **pr,
|
||||
const BIGNUM **ps);
|
||||
extern int sslshim_DSA_SIG_set0(DSA_SIG *psig, BIGNUM *r, BIGNUM *s);
|
||||
extern void sslshim_DSA_get0_pqg(const DSA *pdsa, const BIGNUM **pp,
|
||||
const BIGNUM **pq, const BIGNUM **pg);
|
||||
extern int sslshim_DSA_set0_pqg(DSA *pdsa, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||
extern void sslshim_DSA_get0_key(const DSA *pdsa, const BIGNUM **ppub_key,
|
||||
const BIGNUM **ppriv_key);
|
||||
extern int sslshim_DSA_set0_key(DSA *pdsa, BIGNUM *pub_key,
|
||||
BIGNUM *priv_key);
|
||||
|
||||
extern int sslshim_X509_get_signature_nid(const X509 *x);
|
||||
|
||||
#define BN_GENCB_new sslshimBN_GENCB_new
|
||||
#define BN_GENCB_free sslshimBN_GENCB_free
|
||||
|
||||
#define EVP_MD_CTX_new sslshim_EVP_MD_CTX_new
|
||||
#define EVP_MD_CTX_free sslshim_EVP_MD_CTX_free
|
||||
|
||||
#define EVP_PKEY_id sslshim_EVP_PKEY_id
|
||||
#define EVP_PKEY_base_id sslshim_EVP_PKEY_base_id
|
||||
#define EVP_PKEY_get0_RSA sslshim_EVP_PKEY_get0_RSA
|
||||
#define EVP_PKEY_get0_DSA sslshim_EVP_PKEY_get0_DSA
|
||||
|
||||
#define RSA_get0_key sslshim_RSA_get0_key
|
||||
#define RSA_set0_key sslshim_RSA_set0_key
|
||||
#define RSA_get0_factors sslshim_RSA_get0_factors
|
||||
#define RSA_set0_factors sslshim_RSA_set0_factors
|
||||
#define RSA_set0_crt_params sslshim_RSA_set0_crt_params
|
||||
|
||||
#define DSA_SIG_get0 sslshim_DSA_SIG_get0
|
||||
#define DSA_SIG_set0 sslshim_DSA_SIG_set0
|
||||
#define DSA_get0_pqg sslshim_DSA_get0_pqg
|
||||
#define DSA_set0_pqg sslshim_DSA_set0_pqg
|
||||
#define DSA_get0_key sslshim_DSA_get0_key
|
||||
#define DSA_set0_key sslshim_DSA_set0_key
|
||||
|
||||
#define X509_get_signature_nid sslshim_X509_get_signature_nid
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
#endif /* OPENSSL_VERSION_NUMBER < v1.1.0 */
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
#endif /* NTP_LIBSSL_COMPAT_H */
|
||||
@@ -175,6 +175,7 @@ typedef struct interface endpt;
|
||||
struct interface {
|
||||
endpt * elink; /* endpt list link */
|
||||
endpt * mclink; /* per-AF_* multicast list */
|
||||
void * ioreg_ctx; /* IO registration context */
|
||||
SOCKET fd; /* socket descriptor */
|
||||
SOCKET bfd; /* for receiving broadcasts */
|
||||
u_int32 ifnum; /* endpt instance count */
|
||||
@@ -241,6 +242,13 @@ struct interface {
|
||||
#define TEST13 0x1000 /* peer unreacable */
|
||||
#define PEER_TEST_MASK (TEST10 | TEST11 | TEST12 | TEST13)
|
||||
|
||||
/*
|
||||
* Unused flags
|
||||
*/
|
||||
#define TEST14 0x2000
|
||||
#define TEST15 0x4000
|
||||
#define TEST16 0x8000
|
||||
|
||||
/*
|
||||
* The peer structure. Holds state information relating to the guys
|
||||
* we are peering with. Most of this stuff is from section 3.2 of the
|
||||
@@ -350,6 +358,7 @@ struct peer {
|
||||
l_fp dst; /* destination timestamp */
|
||||
l_fp aorg; /* origin timestamp */
|
||||
l_fp borg; /* alternate origin timestamp */
|
||||
l_fp bxmt; /* most recent broadcast transmit timestamp */
|
||||
double offset; /* peer clock offset */
|
||||
double delay; /* peer roundtrip delay */
|
||||
double jitter; /* peer jitter (squares) */
|
||||
@@ -382,13 +391,15 @@ struct peer {
|
||||
* Statistic counters
|
||||
*/
|
||||
u_long timereset; /* time stat counters were reset */
|
||||
u_long timereceived; /* last packet received time */
|
||||
u_long timelastrec; /* last packet received time, incl. trash */
|
||||
u_long timereceived; /* last (clean) packet received time */
|
||||
u_long timereachable; /* last reachable/unreachable time */
|
||||
|
||||
u_long sent; /* packets sent */
|
||||
u_long received; /* packets received */
|
||||
u_long processed; /* packets processed */
|
||||
u_long badauth; /* bad authentication (TEST5) */
|
||||
u_long badNAK; /* invalid crypto-NAK */
|
||||
u_long bogusorg; /* bogus origin (TEST2, TEST3) */
|
||||
u_long oldpkt; /* old duplicate (TEST1) */
|
||||
u_long seldisptoolarge; /* bad header (TEST6, TEST7) */
|
||||
@@ -408,8 +419,7 @@ struct peer {
|
||||
* MODE_BROADCAST and MODE_BCLIENT appear in the transition
|
||||
* function. MODE_CONTROL and MODE_PRIVATE can appear in packets,
|
||||
* but those never survive to the transition function.
|
||||
* is a
|
||||
/ */
|
||||
*/
|
||||
#define MODE_UNSPEC 0 /* unspecified (old version) */
|
||||
#define MODE_ACTIVE 1 /* symmetric active mode */
|
||||
#define MODE_PASSIVE 2 /* symmetric passive mode */
|
||||
@@ -422,7 +432,7 @@ struct peer {
|
||||
#define MODE_CONTROL 6 /* control mode */
|
||||
#define MODE_PRIVATE 7 /* private mode */
|
||||
/*
|
||||
* This is a madeup mode for broadcast client.
|
||||
* This is a made-up mode for broadcast client.
|
||||
*/
|
||||
#define MODE_BCLIENT 6 /* broadcast client mode */
|
||||
|
||||
@@ -543,6 +553,7 @@ struct pkt {
|
||||
l_fp rec; /* receive time stamp */
|
||||
l_fp xmt; /* transmit time stamp */
|
||||
|
||||
#define MIN_V4_PKT_LEN (12 * sizeof(u_int32)) /* min header length */
|
||||
#define LEN_PKT_NOMAC (12 * sizeof(u_int32)) /* min header length */
|
||||
#define MIN_MAC_LEN (1 * sizeof(u_int32)) /* crypto_NAK */
|
||||
#define MAX_MD5_LEN (5 * sizeof(u_int32)) /* MD5 */
|
||||
@@ -708,6 +719,11 @@ struct pkt {
|
||||
#define PROTO_ORPHAN 26
|
||||
#define PROTO_ORPHWAIT 27
|
||||
#define PROTO_MODE7 28
|
||||
#define PROTO_UECRYPTO 29
|
||||
#define PROTO_UECRYPTONAK 30
|
||||
#define PROTO_UEDIGEST 31
|
||||
#define PROTO_PCEDIGEST 32
|
||||
#define PROTO_BCPOLLBSTEP 33
|
||||
|
||||
/*
|
||||
* Configuration items for the loop filter
|
||||
@@ -715,7 +731,7 @@ struct pkt {
|
||||
#define LOOP_DRIFTINIT 1 /* iniitialize frequency */
|
||||
#define LOOP_KERN_CLEAR 2 /* set initial frequency offset */
|
||||
#define LOOP_MAX 3 /* set both step offsets */
|
||||
#define LOOP_MAX_BACK 4 /* set bacward-step offset */
|
||||
#define LOOP_MAX_BACK 4 /* set backward-step offset */
|
||||
#define LOOP_MAX_FWD 5 /* set forward-step offset */
|
||||
#define LOOP_PANIC 6 /* set panic offseet */
|
||||
#define LOOP_PHI 7 /* set dispersion rate */
|
||||
|
||||
@@ -88,10 +88,6 @@ extern void calysto_assert(unsigned char cnd); /* check whether this holds */
|
||||
* We initially used NTP_REQUIRE() instead of REQUIRE() etc, but that
|
||||
* is unneccesarily verbose, as libisc use of REQUIRE() etc shows.
|
||||
*/
|
||||
#define NTP_REQUIRE(x) REQUIRE(x)
|
||||
#define NTP_INSIST(x) INSIST(x)
|
||||
#define NTP_INVARIANT(x) INVARIANT(x)
|
||||
#define NTP_ENSURE(x) ENSURE(x)
|
||||
|
||||
# ifdef DEBUG
|
||||
#define DEBUG_REQUIRE(x) REQUIRE(x)
|
||||
|
||||
@@ -157,6 +157,12 @@ ntpcal_daysplit(const vint64 *);
|
||||
extern vint64
|
||||
ntpcal_dayjoin(int32_t /* days */, int32_t /* seconds */);
|
||||
|
||||
/* Get the number of leap years since epoch for the number of elapsed
|
||||
* full years
|
||||
*/
|
||||
extern int32_t
|
||||
ntpcal_leapyears_in_years(int32_t /* years */);
|
||||
|
||||
/*
|
||||
* Convert elapsed years in Era into elapsed days in Era.
|
||||
*/
|
||||
@@ -220,6 +226,9 @@ ntpcal_date_to_rd(const struct calendar * /* jt */);
|
||||
*
|
||||
* if 'isleapyear' is not NULL, it will receive an integer that is 0
|
||||
* for regular years and a non-zero value for leap years.
|
||||
*
|
||||
* The input is limited to [-2^30, 2^30-1]. If the days exceed this
|
||||
* range, errno is set to EDOM and the result is saturated.
|
||||
*/
|
||||
extern ntpcal_split
|
||||
ntpcal_split_eradays(int32_t /* days */, int/*BOOL*/ * /* isleapyear */);
|
||||
@@ -330,6 +339,10 @@ ntpcal_date_to_time(const struct calendar * /* jd */);
|
||||
extern int32_t
|
||||
isocal_weeks_in_years(int32_t /* years */);
|
||||
|
||||
/*
|
||||
* The input is limited to [-2^30, 2^30-1]. If the weeks exceed this
|
||||
* range, errno is set to EDOM and the result is saturated.
|
||||
*/
|
||||
extern ntpcal_split
|
||||
isocal_split_eraweeks(int32_t /* weeks */);
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
extern int cmdline_server_count;
|
||||
extern char ** cmdline_servers;
|
||||
|
||||
/* set to zero if admin doesn't want memory locked */
|
||||
extern int do_memlock;
|
||||
/* set to zero if we're not locking memory */
|
||||
extern int cur_memlock;
|
||||
|
||||
typedef struct int_range_tag {
|
||||
int first;
|
||||
|
||||
@@ -104,7 +104,7 @@ struct ntp_control {
|
||||
#define CTL_PST_SEL_REJECT 0 /* reject */
|
||||
#define CTL_PST_SEL_SANE 1 /* x falsetick */
|
||||
#define CTL_PST_SEL_CORRECT 2 /* . excess */
|
||||
#define CTL_PST_SEL_SELCAND 3 /* - outlyer */
|
||||
#define CTL_PST_SEL_SELCAND 3 /* - outlier */
|
||||
#define CTL_PST_SEL_SYNCCAND 4 /* + candidate */
|
||||
#define CTL_PST_SEL_EXCESS 5 /* # backup */
|
||||
#define CTL_PST_SEL_SYSPEER 6 /* * sys.peer */
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#ifdef WORKER
|
||||
#define INITIAL_DNS_RETRY 2 /* seconds between queries */
|
||||
|
||||
/* flags for extended addrinfo version */
|
||||
#define GAIR_F_IGNDNSERR 0x0001 /* ignore DNS errors */
|
||||
|
||||
/*
|
||||
* you call getaddrinfo_sometime(name, service, &hints, retry, callback_func, context);
|
||||
* later (*callback_func)(rescode, gai_errno, context, name, service, hints, ai_result) is called.
|
||||
@@ -19,6 +22,9 @@ typedef void (*gai_sometime_callback)
|
||||
extern int getaddrinfo_sometime(const char *, const char *,
|
||||
const struct addrinfo *, int,
|
||||
gai_sometime_callback, void *);
|
||||
extern int getaddrinfo_sometime_ex(const char *, const char *,
|
||||
const struct addrinfo *, int,
|
||||
gai_sometime_callback, void *, u_int);
|
||||
/*
|
||||
* In gai_sometime_callback routines, the resulting addrinfo list is
|
||||
* only available until the callback returns. To hold on to the list
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
|
||||
#include "libntp.h" /* This needs Something above for GETDTABLESIZE */
|
||||
|
||||
#include "ntp_keyacc.h"
|
||||
|
||||
/*
|
||||
* Define FNDELAY and FASYNC using O_NONBLOCK and O_ASYNC if we need
|
||||
* to (and can). This is here initially for QNX, but may help for
|
||||
@@ -83,7 +85,6 @@ typedef enum {
|
||||
extern int qos;
|
||||
SOCKET move_fd(SOCKET fd);
|
||||
isc_boolean_t get_broadcastclient_flag(void);
|
||||
extern int is_ip_address(const char *, u_short, sockaddr_u *);
|
||||
extern void sau_from_netaddr(sockaddr_u *, const isc_netaddr_t *);
|
||||
extern void add_nic_rule(nic_rule_match match_type,
|
||||
const char *if_name, int prefixlen,
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* ntp_keyacc.h - key access stuff
|
||||
*/
|
||||
#ifndef NTP_KEYACC_H
|
||||
#define NTP_KEYACC_H
|
||||
|
||||
typedef struct keyaccess KeyAccT;
|
||||
struct keyaccess {
|
||||
KeyAccT * next;
|
||||
sockaddr_u addr;
|
||||
};
|
||||
|
||||
extern KeyAccT* keyacc_new_push(KeyAccT *head, const sockaddr_u *addr);
|
||||
extern KeyAccT* keyacc_pop_free(KeyAccT *head);
|
||||
extern KeyAccT* keyacc_all_free(KeyAccT *head);
|
||||
extern int keyacc_contains(const KeyAccT *head, const sockaddr_u *addr,
|
||||
int res_on_empty_list);
|
||||
|
||||
#endif /* NTP_KEYACC_H */
|
||||
@@ -215,9 +215,9 @@ do { \
|
||||
\
|
||||
for (pentry = (listhead); \
|
||||
pentry != NULL; \
|
||||
pentry = pentry->nextlink){ \
|
||||
NTP_INSIST(pentry != pentry->nextlink); \
|
||||
NTP_INSIST((listhead) != pentry->nextlink); \
|
||||
pentry = pentry->nextlink) { \
|
||||
INSIST(pentry != pentry->nextlink); \
|
||||
INSIST((listhead) != pentry->nextlink); \
|
||||
} \
|
||||
} while (FALSE)
|
||||
|
||||
|
||||
@@ -105,7 +105,8 @@ struct refclockio {
|
||||
int active; /* nonzero when in use */
|
||||
|
||||
#ifdef HAVE_IO_COMPLETION_PORT
|
||||
void * device_context; /* device-related data for i/o subsystem */
|
||||
void * ioreg_ctx; /* IO registration context */
|
||||
void * device_ctx; /* device-related data for i/o subsystem */
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -220,7 +221,7 @@ extern void refclock_buginfo(sockaddr_u *,
|
||||
extern void refclock_control(sockaddr_u *,
|
||||
const struct refclockstat *,
|
||||
struct refclockstat *);
|
||||
extern int refclock_open (char *, u_int, u_int);
|
||||
extern int refclock_open (const char *, u_int, u_int);
|
||||
extern int refclock_setup (int, u_int, u_int);
|
||||
extern void refclock_timer (struct peer *);
|
||||
extern void refclock_transmit(struct peer *);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "ntp_malloc.h"
|
||||
#include "ntp_string.h"
|
||||
#include "ntp_syslog.h"
|
||||
#include "ntp_keyacc.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define NTP_PRINTF(fmt, args) __attribute__((__format__(__printf__, fmt, args)))
|
||||
@@ -31,6 +32,7 @@ extern int mvsnprintf(char *, size_t, const char *, va_list)
|
||||
extern int msnprintf(char *, size_t, const char *, ...)
|
||||
NTP_PRINTF(3, 4);
|
||||
extern void msyslog(int, const char *, ...) NTP_PRINTF(2, 3);
|
||||
extern void mvsyslog(int, const char *, va_list) NTP_PRINTF(2, 0);
|
||||
extern void init_logging (const char *, u_int32, int);
|
||||
extern int change_logfile (const char *, int);
|
||||
extern void setup_logfile (const char *);
|
||||
@@ -64,10 +66,11 @@ typedef void (*ctrl_c_fn)(void);
|
||||
/* authkeys.c */
|
||||
extern void auth_delkeys (void);
|
||||
extern int auth_havekey (keyid_t);
|
||||
extern int authdecrypt (keyid_t, u_int32 *, int, int);
|
||||
extern int authencrypt (keyid_t, u_int32 *, int);
|
||||
extern int authdecrypt (keyid_t, u_int32 *, size_t, size_t);
|
||||
extern size_t authencrypt (keyid_t, u_int32 *, size_t);
|
||||
extern int authhavekey (keyid_t);
|
||||
extern int authistrusted (keyid_t);
|
||||
extern int authistrustedip (keyid_t, sockaddr_u *);
|
||||
extern int authreadkeys (const char *);
|
||||
extern void authtrust (keyid_t, u_long);
|
||||
extern int authusekey (keyid_t, int, const u_char *);
|
||||
@@ -94,9 +97,9 @@ extern void auth_prealloc_symkeys(int);
|
||||
extern int ymd2yd (int, int, int);
|
||||
|
||||
/* a_md5encrypt.c */
|
||||
extern int MD5authdecrypt (int, u_char *, u_int32 *, int, int);
|
||||
extern int MD5authencrypt (int, u_char *, u_int32 *, int);
|
||||
extern void MD5auth_setkey (keyid_t, int, const u_char *, size_t);
|
||||
extern int MD5authdecrypt (int, const u_char *, u_int32 *, size_t, size_t);
|
||||
extern size_t MD5authencrypt (int, const u_char *, u_int32 *, size_t);
|
||||
extern void MD5auth_setkey (keyid_t, int, const u_char *, size_t, KeyAccT *c);
|
||||
extern u_int32 addr2refid (sockaddr_u *);
|
||||
|
||||
/* emalloc.c */
|
||||
@@ -140,6 +143,7 @@ extern int atouint (const char *, u_long *);
|
||||
extern int hextoint (const char *, u_long *);
|
||||
extern const char * humanlogtime (void);
|
||||
extern const char * humantime (time_t);
|
||||
extern int is_ip_address (const char *, u_short, sockaddr_u *);
|
||||
extern char * mfptoa (u_int32, u_int32, short);
|
||||
extern char * mfptoms (u_int32, u_int32, short);
|
||||
extern const char * modetoa (size_t);
|
||||
@@ -196,7 +200,7 @@ extern int authnumfreekeys;
|
||||
extern keyid_t cache_keyid; /* key identifier */
|
||||
extern int cache_type; /* key type */
|
||||
extern u_char * cache_secret; /* secret */
|
||||
extern u_short cache_secretsize; /* secret octets */
|
||||
extern size_t cache_secretsize; /* secret octets */
|
||||
extern u_short cache_flags; /* KEY_ bit flags */
|
||||
|
||||
/* getopt.c */
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#ifdef VMS
|
||||
extern void msyslog();
|
||||
extern void mvsyslog();
|
||||
#else
|
||||
# ifndef SYS_VXWORKS
|
||||
# include <syslog.h>
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
#include <sys/types.h>
|
||||
#if defined(HAVE_INTTYPES_H)
|
||||
# include <inttypes.h>
|
||||
#elif defined(HAVE_STDINT_H)
|
||||
#endif
|
||||
#if defined(HAVE_STDINT_H)
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
@@ -34,6 +35,13 @@
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDBOOL_H
|
||||
# include <stdbool.h>
|
||||
#else
|
||||
typedef int bool; /* Can't use enum TRUE/FALSE because of above */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This is another naming conflict.
|
||||
* On NetBSD for MAC the macro "mac" is defined as 1
|
||||
@@ -217,6 +225,7 @@ typedef uint16_t associd_t; /* association ID */
|
||||
#define ASSOCID_MAX USHRT_MAX
|
||||
typedef u_int32 keyid_t; /* cryptographic key ID */
|
||||
#define KEYID_T_MAX (0xffffffff)
|
||||
|
||||
typedef u_int32 tstamp_t; /* NTP seconds timestamp */
|
||||
|
||||
/*
|
||||
|
||||
@@ -43,65 +43,97 @@ typedef struct blocking_pipe_header_tag {
|
||||
} blocking_pipe_header;
|
||||
|
||||
# ifdef WORK_THREAD
|
||||
# ifdef WORK_PIPE
|
||||
typedef pthread_t * thr_ref;
|
||||
typedef sem_t * sem_ref;
|
||||
# ifdef SYS_WINNT
|
||||
typedef struct { HANDLE thnd; } thread_type;
|
||||
typedef struct { HANDLE shnd; } sema_type;
|
||||
# else
|
||||
typedef HANDLE thr_ref;
|
||||
typedef HANDLE sem_ref;
|
||||
typedef pthread_t thread_type;
|
||||
typedef sem_t sema_type;
|
||||
# endif
|
||||
typedef thread_type *thr_ref;
|
||||
typedef sema_type *sem_ref;
|
||||
# endif
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
#ifdef WORK_FORK
|
||||
#if defined(WORK_FORK)
|
||||
|
||||
typedef struct blocking_child_tag {
|
||||
int reusable;
|
||||
int pid;
|
||||
int req_write_pipe; /* parent */
|
||||
int resp_read_pipe;
|
||||
void * resp_read_ctx;
|
||||
int req_read_pipe; /* child */
|
||||
int resp_write_pipe;
|
||||
int ispipe;
|
||||
int reusable;
|
||||
int pid;
|
||||
int req_write_pipe; /* parent */
|
||||
int resp_read_pipe;
|
||||
void * resp_read_ctx;
|
||||
int req_read_pipe; /* child */
|
||||
int resp_write_pipe;
|
||||
int ispipe;
|
||||
volatile u_int resp_ready_seen; /* signal/scan */
|
||||
volatile u_int resp_ready_done; /* consumer/mainloop */
|
||||
} blocking_child;
|
||||
|
||||
#elif defined(WORK_THREAD)
|
||||
|
||||
typedef struct blocking_child_tag {
|
||||
/*
|
||||
* blocking workitems and blocking_responses are dynamically-sized
|
||||
* one-dimensional arrays of pointers to blocking worker requests and
|
||||
* responses.
|
||||
*/
|
||||
/*
|
||||
* blocking workitems and blocking_responses are
|
||||
* dynamically-sized one-dimensional arrays of pointers to
|
||||
* blocking worker requests and responses.
|
||||
*
|
||||
* IMPORTANT: This structure is shared between threads, and all
|
||||
* access that is not atomic (especially queue operations) must
|
||||
* hold the 'accesslock' semaphore to avoid data races.
|
||||
*
|
||||
* The resource management (thread/semaphore
|
||||
* creation/destruction) functions and functions just testing a
|
||||
* handle are safe because these are only changed by the main
|
||||
* thread when no worker is running on the same data structure.
|
||||
*/
|
||||
int reusable;
|
||||
thr_ref thread_ref;
|
||||
u_int thread_id;
|
||||
blocking_pipe_header * volatile * volatile
|
||||
sem_ref accesslock; /* shared access lock */
|
||||
thr_ref thread_ref; /* thread 'handle' */
|
||||
|
||||
/* the reuest queue */
|
||||
blocking_pipe_header ** volatile
|
||||
workitems;
|
||||
volatile size_t workitems_alloc;
|
||||
size_t next_workitem; /* parent */
|
||||
size_t next_workeritem; /* child */
|
||||
blocking_pipe_header * volatile * volatile
|
||||
size_t head_workitem; /* parent */
|
||||
size_t tail_workitem; /* child */
|
||||
sem_ref workitems_pending; /* signalling */
|
||||
|
||||
/* the response queue */
|
||||
blocking_pipe_header ** volatile
|
||||
responses;
|
||||
volatile size_t responses_alloc;
|
||||
size_t next_response; /* child */
|
||||
size_t next_workresp; /* parent */
|
||||
size_t head_response; /* child */
|
||||
size_t tail_response; /* parent */
|
||||
|
||||
/* event handles / sem_t pointers */
|
||||
/* sem_ref child_is_blocking; */
|
||||
sem_ref blocking_req_ready;
|
||||
sem_ref wake_scheduled_sleep;
|
||||
|
||||
/* some systems use a pipe for notification, others a semaphore.
|
||||
* Both employ the queue above for the actual data transfer.
|
||||
*/
|
||||
#ifdef WORK_PIPE
|
||||
int resp_read_pipe; /* parent */
|
||||
int resp_write_pipe;/* child */
|
||||
int resp_read_pipe; /* parent */
|
||||
int resp_write_pipe; /* child */
|
||||
int ispipe;
|
||||
void * resp_read_ctx; /* child */
|
||||
void * resp_read_ctx; /* child */
|
||||
#else
|
||||
sem_ref blocking_response_ready;
|
||||
sem_ref responses_pending; /* signalling */
|
||||
#endif
|
||||
volatile u_int resp_ready_seen; /* signal/scan */
|
||||
volatile u_int resp_ready_done; /* consumer/mainloop */
|
||||
sema_type sem_table[4];
|
||||
thread_type thr_table[1];
|
||||
} blocking_child;
|
||||
|
||||
#endif /* WORK_THREAD */
|
||||
|
||||
/* we need some global tag to indicate any blocking child may be ready: */
|
||||
extern volatile u_int blocking_child_ready_seen;/* signal/scan */
|
||||
extern volatile u_int blocking_child_ready_done;/* consumer/mainloop */
|
||||
|
||||
extern blocking_child ** blocking_children;
|
||||
extern size_t blocking_children_alloc;
|
||||
extern int worker_per_query; /* boolean */
|
||||
@@ -111,10 +143,11 @@ extern u_int available_blocking_child_slot(void);
|
||||
extern int queue_blocking_request(blocking_work_req, void *,
|
||||
size_t, blocking_work_callback,
|
||||
void *);
|
||||
extern int queue_blocking_response(blocking_child *,
|
||||
extern int queue_blocking_response(blocking_child *,
|
||||
blocking_pipe_header *, size_t,
|
||||
const blocking_pipe_header *);
|
||||
extern void process_blocking_resp(blocking_child *);
|
||||
extern void harvest_blocking_responses(void);
|
||||
extern int send_blocking_req_internal(blocking_child *,
|
||||
blocking_pipe_header *,
|
||||
void *);
|
||||
@@ -138,6 +171,8 @@ extern void close_all_except(int);
|
||||
extern void kill_asyncio (int);
|
||||
#endif
|
||||
|
||||
extern void worker_global_lock(int inOrOut);
|
||||
|
||||
# ifdef WORK_PIPE
|
||||
typedef void (*addremove_io_fd_func)(int, int, int);
|
||||
extern addremove_io_fd_func addremove_io_fd;
|
||||
|
||||
@@ -156,7 +156,7 @@ extern u_int sys_tai;
|
||||
extern int freq_cnt;
|
||||
|
||||
/* ntp_monitor.c */
|
||||
#define MON_HASH_SIZE (1U << mon_hash_bits)
|
||||
#define MON_HASH_SIZE ((size_t)1U << mon_hash_bits)
|
||||
#define MON_HASH_MASK (MON_HASH_SIZE - 1)
|
||||
#define MON_HASH(addr) (sock_hash(addr) & MON_HASH_MASK)
|
||||
extern void init_mon (void);
|
||||
@@ -408,6 +408,7 @@ extern int hardpps_enable; /* kernel PPS discipline enabled */
|
||||
extern int ext_enable; /* external clock enabled */
|
||||
extern int cal_enable; /* refclock calibrate enable */
|
||||
extern int allow_panic; /* allow panic correction (-g) */
|
||||
extern int enable_panic_check; /* Can we check allow_panic's state? */
|
||||
extern int force_step_once; /* always step time once at startup (-G) */
|
||||
extern int mode_ntpdate; /* exit on first clock set (-q) */
|
||||
extern int peer_ntpdate; /* count of ntpdate peers */
|
||||
@@ -482,6 +483,7 @@ extern int sys_bclient; /* we set our time to broadcasts */
|
||||
extern double sys_bdelay; /* broadcast client default delay */
|
||||
extern int sys_authenticate; /* requre authentication for config */
|
||||
extern l_fp sys_authdelay; /* authentication delay */
|
||||
extern u_char sys_bcpollbstep; /* broadcast poll backstep gate */
|
||||
extern u_long sys_epoch; /* last clock update time */
|
||||
extern keyid_t sys_private; /* private value for session seed */
|
||||
extern int sys_manycastserver; /* respond to manycast client pkts */
|
||||
|
||||
@@ -107,9 +107,9 @@ extern unsigned int splclock (void);
|
||||
/*
|
||||
* some constants useful for GPS time conversion
|
||||
*/
|
||||
#define GPSORIGIN 2524953600UL /* NTP origin - GPS origin in seconds */
|
||||
#define GPSWRAP 990U /* assume week count less than this in the previous epoch */
|
||||
#define GPSWEEKS 1024U /* number of weeks until the GPS epch rolls over */
|
||||
#define GPSORIGIN 2524953600UL /* NTP origin - GPS origin in seconds */
|
||||
#define GPSWRAP 990 /* assume week count less than this in the previous epoch */
|
||||
#define GPSWEEKS 1024 /* number of weeks until the GPS epch rolls over */
|
||||
|
||||
/*
|
||||
* state flags
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
extern size_t remoteconfig_cmdlength( const char *src_buf, const char *src_end );
|
||||
@@ -91,7 +91,7 @@ extern void freerecvbuf(struct recvbuf *);
|
||||
|
||||
/* signal safe - no malloc */
|
||||
extern struct recvbuf *get_free_recv_buffer(void);
|
||||
/* signal unsafe - may malloc */
|
||||
/* signal unsafe - may malloc, never returs NULL */
|
||||
extern struct recvbuf *get_free_recv_buffer_alloc(void);
|
||||
|
||||
/* Add a buffer to the full list
|
||||
@@ -113,7 +113,7 @@ extern struct recvbuf *get_full_recv_buffer(void);
|
||||
* purge_recv_buffers_for_fd() - purges any previously-received input
|
||||
* from a given file descriptor.
|
||||
*/
|
||||
extern void purge_recv_buffers_for_fd(SOCKET);
|
||||
extern void purge_recv_buffers_for_fd(int);
|
||||
|
||||
/*
|
||||
* Checks to see if there are buffers to process
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef SAFECAST_H
|
||||
#define SAFECAST_H
|
||||
|
||||
#include <limits.h>
|
||||
static inline int size2int_chk(size_t v)
|
||||
{
|
||||
if (v > INT_MAX)
|
||||
abort();
|
||||
return (int)(v);
|
||||
}
|
||||
|
||||
static inline int size2int_sat(size_t v)
|
||||
{
|
||||
return (v > INT_MAX) ? INT_MAX : (int)v;
|
||||
}
|
||||
|
||||
/* Compilers can emit warning about increased alignment requirements
|
||||
* when casting pointers. The impact is tricky: on machines where
|
||||
* alignment is just a performance issue (x86,x64,...) this might just
|
||||
* cause a performance penalty. On others, an address error can occur
|
||||
* and the process dies...
|
||||
*
|
||||
* Still, there are many cases where the pointer arithmetic and the
|
||||
* buffer alignment make sure this does not happen. OTOH, the compiler
|
||||
* doesn't know this and still emits warnings.
|
||||
*
|
||||
* The following cast macros are going through void pointers to tell
|
||||
* the compiler that there is no alignment requirement to watch.
|
||||
*/
|
||||
#define UA_PTR(ptype,pval) ((ptype *)(void*)(pval))
|
||||
#define UAC_PTR(ptype,pval) ((const ptype *)(const void*)(pval))
|
||||
#define UAV_PTR(ptype,pval) ((volatile ptype *)(volatile void*)(pval))
|
||||
|
||||
#endif
|
||||
@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_locinfo.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_openssl.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_pkg_config.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_problemtests.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_prog_cc.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_rlimit.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
|
||||
@@ -224,6 +225,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_THREAD = @BUILD_THREAD@
|
||||
CALC_TICKADJ_DB = @CALC_TICKADJ_DB@
|
||||
CALC_TICKADJ_DL = @CALC_TICKADJ_DL@
|
||||
CALC_TICKADJ_DS = @CALC_TICKADJ_DS@
|
||||
@@ -232,6 +234,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@
|
||||
CFLAGS_NTP = @CFLAGS_NTP@
|
||||
CHUTEST = @CHUTEST@
|
||||
CONFIG_SHELL = @CONFIG_SHELL@
|
||||
@@ -293,6 +296,7 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LSCF = @LSCF@
|
||||
LTHREAD_LIBS = @LTHREAD_LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAKE_ADJTIMED = @MAKE_ADJTIMED@
|
||||
|
||||
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_locinfo.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_openssl.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_pkg_config.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_problemtests.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_prog_cc.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_rlimit.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
|
||||
@@ -185,6 +186,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_THREAD = @BUILD_THREAD@
|
||||
CALC_TICKADJ_DB = @CALC_TICKADJ_DB@
|
||||
CALC_TICKADJ_DL = @CALC_TICKADJ_DL@
|
||||
CALC_TICKADJ_DS = @CALC_TICKADJ_DS@
|
||||
@@ -193,6 +195,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@
|
||||
CFLAGS_NTP = @CFLAGS_NTP@
|
||||
CHUTEST = @CHUTEST@
|
||||
CONFIG_SHELL = @CONFIG_SHELL@
|
||||
@@ -254,6 +257,7 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LSCF = @LSCF@
|
||||
LTHREAD_LIBS = @LTHREAD_LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAKE_ADJTIMED = @MAKE_ADJTIMED@
|
||||
|
||||
@@ -278,7 +278,7 @@ isc_backtrace_getsymbol(const void *addr, const char **symbolp,
|
||||
result = ISC_R_NOTFOUND;
|
||||
else {
|
||||
*symbolp = found->symbol;
|
||||
*offsetp = (const char *)addr - (char *)found->addr;
|
||||
*offsetp = (u_long)((const char *)addr - (char *)found->addr);
|
||||
}
|
||||
|
||||
return (result);
|
||||
|
||||
@@ -406,7 +406,7 @@ isc__buffer_putmem(isc_buffer_t *b, const unsigned char *base,
|
||||
|
||||
void
|
||||
isc__buffer_putstr(isc_buffer_t *b, const char *source) {
|
||||
unsigned int l;
|
||||
size_t l;
|
||||
unsigned char *cp;
|
||||
|
||||
REQUIRE(ISC_BUFFER_VALID(b));
|
||||
@@ -421,7 +421,7 @@ isc__buffer_putstr(isc_buffer_t *b, const char *source) {
|
||||
|
||||
cp = isc_buffer_used(b);
|
||||
memcpy(cp, source, l);
|
||||
b->used += l;
|
||||
b->used += (u_int)l; /* checked above - no overflow here */
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
||||
@@ -145,5 +145,5 @@ isc_hmacmd5_verify2(isc_hmacmd5_t *ctx, unsigned char *digest, size_t len) {
|
||||
|
||||
REQUIRE(len <= ISC_MD5_DIGESTLENGTH);
|
||||
isc_hmacmd5_sign(ctx, newdigest);
|
||||
return (ISC_TF(memcmp(digest, newdigest, len) == 0));
|
||||
return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
|
||||
}
|
||||
@@ -538,7 +538,7 @@ isc_hmacsha1_verify(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len) {
|
||||
|
||||
REQUIRE(len <= ISC_SHA1_DIGESTLENGTH);
|
||||
isc_hmacsha1_sign(ctx, newdigest, ISC_SHA1_DIGESTLENGTH);
|
||||
return (ISC_TF(memcmp(digest, newdigest, len) == 0));
|
||||
return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -551,7 +551,7 @@ isc_hmacsha224_verify(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len)
|
||||
|
||||
REQUIRE(len <= ISC_SHA224_DIGESTLENGTH);
|
||||
isc_hmacsha224_sign(ctx, newdigest, ISC_SHA224_DIGESTLENGTH);
|
||||
return (ISC_TF(memcmp(digest, newdigest, len) == 0));
|
||||
return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -564,7 +564,7 @@ isc_hmacsha256_verify(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len)
|
||||
|
||||
REQUIRE(len <= ISC_SHA256_DIGESTLENGTH);
|
||||
isc_hmacsha256_sign(ctx, newdigest, ISC_SHA256_DIGESTLENGTH);
|
||||
return (ISC_TF(memcmp(digest, newdigest, len) == 0));
|
||||
return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -577,7 +577,7 @@ isc_hmacsha384_verify(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len)
|
||||
|
||||
REQUIRE(len <= ISC_SHA384_DIGESTLENGTH);
|
||||
isc_hmacsha384_sign(ctx, newdigest, ISC_SHA384_DIGESTLENGTH);
|
||||
return (ISC_TF(memcmp(digest, newdigest, len) == 0));
|
||||
return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -590,5 +590,5 @@ isc_hmacsha512_verify(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len)
|
||||
|
||||
REQUIRE(len <= ISC_SHA512_DIGESTLENGTH);
|
||||
isc_hmacsha512_sign(ctx, newdigest, ISC_SHA512_DIGESTLENGTH);
|
||||
return (ISC_TF(memcmp(digest, newdigest, len) == 0));
|
||||
return (ISC_TF(isc_tsmemcmp(digest, newdigest, len) == 0));
|
||||
}
|
||||
@@ -199,6 +199,24 @@ isc_string_regiondup(isc_mem_t *mctx, const isc_region_t *source);
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
isc_tsmemcmp(const void *p1, const void *p2, size_t len);
|
||||
/*
|
||||
* Lexicographic compare 'len' unsigned bytes from 'p1' and 'p2'
|
||||
* like 'memcmp()'.
|
||||
*
|
||||
* This function is safe from timing attacks as it has a runtime that
|
||||
* only depends on 'len' and has no early-out option.
|
||||
*
|
||||
* Use this to check MACs and other material that is security sensitive.
|
||||
*
|
||||
* Returns:
|
||||
* (let x be the byte offset of the first different byte)
|
||||
* -1 if (u_char)p1[x] < (u_char)p2[x]
|
||||
* 1 if (u_char)p1[x] > (u_char)p2[x]
|
||||
* 0 if byte series are equal
|
||||
*/
|
||||
|
||||
char *
|
||||
isc_string_separate(char **stringp, const char *delim);
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ static char rcsid[] = "$Id: inet_aton.c,v 1.23 2008/12/01 23:47:45 tbox Exp $";
|
||||
int
|
||||
isc_net_aton(const char *cp, struct in_addr *addr) {
|
||||
unsigned long val;
|
||||
int base, n;
|
||||
int base;
|
||||
unsigned char c;
|
||||
isc_uint8_t parts[4];
|
||||
isc_uint8_t *pp = parts;
|
||||
@@ -166,8 +166,7 @@ isc_net_aton(const char *cp, struct in_addr *addr) {
|
||||
* Concoct the address according to
|
||||
* the number of parts specified.
|
||||
*/
|
||||
n = pp - parts + 1;
|
||||
switch (n) {
|
||||
switch (pp - parts + 1) {
|
||||
case 1: /* a -- 32 bits */
|
||||
break;
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ inet_pton4(const char *src, unsigned char *dst) {
|
||||
const char *pch;
|
||||
|
||||
if ((pch = strchr(digits, ch)) != NULL) {
|
||||
unsigned int newv = *tp * 10 + (pch - digits);
|
||||
size_t newv = *tp * 10 + (pch - digits);
|
||||
|
||||
if (saw_digit && *tp == 0)
|
||||
return (0);
|
||||
@@ -197,12 +197,12 @@ inet_pton6(const char *src, unsigned char *dst) {
|
||||
* Since some memmove()'s erroneously fail to handle
|
||||
* overlapping regions, we'll do the shift by hand.
|
||||
*/
|
||||
const int n = tp - colonp;
|
||||
const size_t n = tp - colonp;
|
||||
int i;
|
||||
|
||||
if (tp == endp)
|
||||
return (0);
|
||||
for (i = 1; i <= n; i++) {
|
||||
for (i = 1; (size_t)i <= n; i++) {
|
||||
endp[- i] = colonp[n - i];
|
||||
colonp[n - i] = 0;
|
||||
}
|
||||
|
||||
@@ -1146,7 +1146,7 @@ greatest_version(isc_logchannel_t *channel, int *greatestp) {
|
||||
char *basenam, *digit_end;
|
||||
const char *dirname;
|
||||
int version, greatest = -1;
|
||||
unsigned int basenamelen;
|
||||
size_t basenamelen;
|
||||
isc_dir_t dir;
|
||||
isc_result_t result;
|
||||
char sep = '/';
|
||||
|
||||
@@ -159,7 +159,7 @@ isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target) {
|
||||
if (r == NULL)
|
||||
return (ISC_R_FAILURE);
|
||||
|
||||
alen = strlen(abuf);
|
||||
alen = (unsigned int)strlen(abuf); /* no overflow possible */
|
||||
INSIST(alen < sizeof(abuf));
|
||||
|
||||
zlen = 0;
|
||||
@@ -280,7 +280,6 @@ isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp) {
|
||||
for (; i < ipbytes; i++) {
|
||||
if (p[i] != 0)
|
||||
return (ISC_R_MASKNONCONTIG);
|
||||
i++;
|
||||
}
|
||||
*lenp = nbytes * 8 + nbits;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
@@ -134,7 +134,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
|
||||
break;
|
||||
#ifdef ISC_PLAFORM_HAVESYSUNH
|
||||
case AF_UNIX:
|
||||
plen = strlen(sockaddr->type.sunix.sun_path);
|
||||
plen = (unsigned int)strlen(sockaddr->type.sunix.sun_path);
|
||||
if (plen >= isc_buffer_availablelength(target))
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
@@ -153,7 +153,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
plen = strlen(pbuf);
|
||||
plen = (unsigned int)strlen(pbuf);
|
||||
INSIST(plen < sizeof(pbuf));
|
||||
|
||||
isc_netaddr_fromsockaddr(&netaddr, sockaddr);
|
||||
|
||||
@@ -329,7 +329,7 @@ ISC_TASKFUNC_SCOPE isc_result_t
|
||||
isc__task_create(isc_taskmgr_t *manager0, unsigned int quantum,
|
||||
isc_task_t **taskp)
|
||||
{
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc__taskmgr_t *manager = (void*)manager0;
|
||||
isc__task_t *task;
|
||||
isc_boolean_t exiting;
|
||||
isc_result_t result;
|
||||
@@ -1463,7 +1463,7 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) {
|
||||
*/
|
||||
|
||||
REQUIRE(managerp != NULL);
|
||||
manager = (isc__taskmgr_t *)*managerp;
|
||||
manager = (void*)(*managerp);
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
|
||||
#ifndef USE_WORKER_THREADS
|
||||
@@ -1559,7 +1559,7 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) {
|
||||
|
||||
ISC_TASKFUNC_SCOPE void
|
||||
isc__taskmgr_setmode(isc_taskmgr_t *manager0, isc_taskmgrmode_t mode) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc__taskmgr_t *manager = (void*)manager0;
|
||||
|
||||
LOCK(&manager->lock);
|
||||
manager->mode = mode;
|
||||
@@ -1568,7 +1568,7 @@ isc__taskmgr_setmode(isc_taskmgr_t *manager0, isc_taskmgrmode_t mode) {
|
||||
|
||||
ISC_TASKFUNC_SCOPE isc_taskmgrmode_t
|
||||
isc__taskmgr_mode(isc_taskmgr_t *manager0) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc__taskmgr_t *manager = (void*)manager0;
|
||||
isc_taskmgrmode_t mode;
|
||||
LOCK(&manager->lock);
|
||||
mode = manager->mode;
|
||||
@@ -1579,7 +1579,7 @@ isc__taskmgr_mode(isc_taskmgr_t *manager0) {
|
||||
#ifndef USE_WORKER_THREADS
|
||||
isc_boolean_t
|
||||
isc__taskmgr_ready(isc_taskmgr_t *manager0) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc__taskmgr_t *manager = (void*)manager0;
|
||||
isc_boolean_t is_ready;
|
||||
|
||||
#ifdef USE_SHARED_MANAGER
|
||||
@@ -1598,7 +1598,7 @@ isc__taskmgr_ready(isc_taskmgr_t *manager0) {
|
||||
|
||||
isc_result_t
|
||||
isc__taskmgr_dispatch(isc_taskmgr_t *manager0) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc__taskmgr_t *manager = (void*)manager0;
|
||||
|
||||
#ifdef USE_SHARED_MANAGER
|
||||
if (manager == NULL)
|
||||
@@ -1615,7 +1615,7 @@ isc__taskmgr_dispatch(isc_taskmgr_t *manager0) {
|
||||
#else
|
||||
ISC_TASKFUNC_SCOPE void
|
||||
isc__taskmgr_pause(isc_taskmgr_t *manager0) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc__taskmgr_t *manager = (void*)manager0;
|
||||
LOCK(&manager->lock);
|
||||
while (manager->tasks_running > 0) {
|
||||
WAIT(&manager->paused, &manager->lock);
|
||||
@@ -1626,7 +1626,7 @@ isc__taskmgr_pause(isc_taskmgr_t *manager0) {
|
||||
|
||||
ISC_TASKFUNC_SCOPE void
|
||||
isc__taskmgr_resume(isc_taskmgr_t *manager0) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc__taskmgr_t *manager = (void*)manager0;
|
||||
|
||||
LOCK(&manager->lock);
|
||||
if (manager->pause_requested) {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 1999-2001, 2003 Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <config.h>
|
||||
#include <limits.h>
|
||||
#include <isc/string.h>
|
||||
|
||||
/* Making a portable memcmp that has no internal branches and loops always
|
||||
* once for every byte without early-out shortcut has a few challenges.
|
||||
*
|
||||
* Inspired by 'timingsafe_memcmp()' from the BSD system and
|
||||
* https://github.com/libressl-portable/openbsd/blob/master/src/lib/libc/string/timingsafe_memcmp.c
|
||||
*
|
||||
* Sadly, that one is not portable C: It makes assumptions on the representation
|
||||
* of negative integers and assumes sign-preserving right-shift of negative
|
||||
* signed values. This is a rewrite from scratch that should not suffer from
|
||||
* such issues.
|
||||
*
|
||||
* 2015-12-12, J. Perlinger (perlinger-at-ntp-dot-org)
|
||||
*/
|
||||
int
|
||||
isc_tsmemcmp(const void *p1, const void *p2, size_t nb) {
|
||||
const unsigned char *ucp1 = p1;
|
||||
const unsigned char *ucp2 = p2;
|
||||
unsigned int isLT = 0u;
|
||||
unsigned int isGT = 0u;
|
||||
volatile unsigned int mask = (1u << CHAR_BIT);
|
||||
|
||||
for (/*NOP*/; 0 != nb; --nb, ++ucp1, ++ucp2) {
|
||||
isLT |= mask &
|
||||
((unsigned int)*ucp1 - (unsigned int)*ucp2);
|
||||
isGT |= mask &
|
||||
((unsigned int)*ucp2 - (unsigned int)*ucp1);
|
||||
mask &= ~(isLT | isGT);
|
||||
}
|
||||
return (int)(isGT >> CHAR_BIT) - (int)(isLT >> CHAR_BIT);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ struct isc_interfaceiter {
|
||||
IP_ADAPTER_ADDRESSES * ipaaCur; /* enumeration position */
|
||||
IP_ADAPTER_UNICAST_ADDRESS *ipuaCur; /* enumeration subposition */
|
||||
/* fields used for the older address enumeration ioctls */
|
||||
int socket;
|
||||
SOCKET socket;
|
||||
INTERFACE_INFO IFData; /* Current Interface Info */
|
||||
int numIF; /* Current Interface count */
|
||||
int v4IF; /* Number of IPv4 Interfaces */
|
||||
|
||||
@@ -216,7 +216,8 @@ initialize_ipv6only(void) {
|
||||
|
||||
static void
|
||||
try_ipv6pktinfo(void) {
|
||||
int s, on;
|
||||
SOCKET s;
|
||||
int on;
|
||||
char strbuf[ISC_STRERRORSIZE];
|
||||
isc_result_t result;
|
||||
int optname;
|
||||
|
||||
@@ -36,6 +36,7 @@ libisc_SRCS = \
|
||||
$(srcdir)/../lib/isc/unix/time.c \
|
||||
$(srcdir)/../lib/isc/sha1.c \
|
||||
$(srcdir)/../lib/isc/sockaddr.c \
|
||||
$(srcdir)/../lib/isc/tsmemcmp.c \
|
||||
$(NULL)
|
||||
|
||||
if PTHREADS
|
||||
@@ -70,7 +71,9 @@ libntp_a_SRCS = \
|
||||
humandate.c \
|
||||
icom.c \
|
||||
iosignal.c \
|
||||
is_ip_address.c \
|
||||
lib_strbuf.c \
|
||||
libssl_compat.c \
|
||||
machines.c \
|
||||
mktime.c \
|
||||
modetoa.c \
|
||||
|
||||
@@ -117,6 +117,7 @@ am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_locinfo.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_openssl.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_pkg_config.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_problemtests.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_prog_cc.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_rlimit.m4 \
|
||||
$(top_srcdir)/sntp/m4/ntp_sntp.m4 \
|
||||
@@ -149,15 +150,15 @@ am__libntp_a_SOURCES_DIST = systime.c a_md5encrypt.c adjtime.c \
|
||||
calyearstart.c clocktime.c clocktypes.c decodenetnum.c \
|
||||
dofptoa.c dolfptoa.c emalloc.c findconfig.c getopt.c \
|
||||
hextoint.c hextolfp.c humandate.c icom.c iosignal.c \
|
||||
lib_strbuf.c machines.c mktime.c modetoa.c mstolfp.c msyslog.c \
|
||||
netof.c ntp_calendar.c ntp_crypto_rnd.c ntp_intres.c \
|
||||
ntp_libopts.c ntp_lineedit.c ntp_random.c ntp_rfc2553.c \
|
||||
ntp_worker.c numtoa.c numtohost.c octtoint.c prettydate.c \
|
||||
refidsmear.c recvbuff.c refnumtoa.c snprintf.c socket.c \
|
||||
socktoa.c socktohost.c ssl_init.c statestr.c strdup.c \
|
||||
strl_obsd.c syssignal.c timetoa.c timevalops.c uglydate.c \
|
||||
vint64ops.c work_fork.c work_thread.c ymd2yd.c \
|
||||
$(srcdir)/../lib/isc/assertions.c \
|
||||
is_ip_address.c lib_strbuf.c libssl_compat.c machines.c \
|
||||
mktime.c modetoa.c mstolfp.c msyslog.c netof.c ntp_calendar.c \
|
||||
ntp_crypto_rnd.c ntp_intres.c ntp_libopts.c ntp_lineedit.c \
|
||||
ntp_random.c ntp_rfc2553.c ntp_worker.c numtoa.c numtohost.c \
|
||||
octtoint.c prettydate.c refidsmear.c recvbuff.c refnumtoa.c \
|
||||
snprintf.c socket.c socktoa.c socktohost.c ssl_init.c \
|
||||
statestr.c strdup.c strl_obsd.c syssignal.c timetoa.c \
|
||||
timevalops.c uglydate.c vint64ops.c work_fork.c work_thread.c \
|
||||
ymd2yd.c $(srcdir)/../lib/isc/assertions.c \
|
||||
$(srcdir)/../lib/isc/buffer.c \
|
||||
$(srcdir)/../lib/isc/backtrace-emptytbl.c \
|
||||
$(srcdir)/../lib/isc/backtrace.c \
|
||||
@@ -181,6 +182,7 @@ am__libntp_a_SOURCES_DIST = systime.c a_md5encrypt.c adjtime.c \
|
||||
$(srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/thread.c \
|
||||
$(srcdir)/../lib/isc/unix/time.c $(srcdir)/../lib/isc/sha1.c \
|
||||
$(srcdir)/../lib/isc/sockaddr.c \
|
||||
$(srcdir)/../lib/isc/tsmemcmp.c \
|
||||
$(srcdir)/../lib/isc/pthreads/mutex.c
|
||||
am__objects_1 =
|
||||
@PTHREADS_TRUE@am__objects_2 = mutex.$(OBJEXT)
|
||||
@@ -195,7 +197,7 @@ am__objects_3 = assertions.$(OBJEXT) buffer.$(OBJEXT) \
|
||||
result.$(OBJEXT) stdio.$(OBJEXT) stdtime.$(OBJEXT) \
|
||||
strerror.$(OBJEXT) task.$(OBJEXT) thread.$(OBJEXT) \
|
||||
time.$(OBJEXT) sha1.$(OBJEXT) sockaddr.$(OBJEXT) \
|
||||
$(am__objects_1) $(am__objects_2)
|
||||
tsmemcmp.$(OBJEXT) $(am__objects_1) $(am__objects_2)
|
||||
am__objects_4 = a_md5encrypt.$(OBJEXT) adjtime.$(OBJEXT) \
|
||||
atoint.$(OBJEXT) atolfp.$(OBJEXT) atouint.$(OBJEXT) \
|
||||
audio.$(OBJEXT) authkeys.$(OBJEXT) authreadkeys.$(OBJEXT) \
|
||||
@@ -206,7 +208,8 @@ am__objects_4 = a_md5encrypt.$(OBJEXT) adjtime.$(OBJEXT) \
|
||||
dolfptoa.$(OBJEXT) emalloc.$(OBJEXT) findconfig.$(OBJEXT) \
|
||||
getopt.$(OBJEXT) hextoint.$(OBJEXT) hextolfp.$(OBJEXT) \
|
||||
humandate.$(OBJEXT) icom.$(OBJEXT) iosignal.$(OBJEXT) \
|
||||
lib_strbuf.$(OBJEXT) machines.$(OBJEXT) mktime.$(OBJEXT) \
|
||||
is_ip_address.$(OBJEXT) lib_strbuf.$(OBJEXT) \
|
||||
libssl_compat.$(OBJEXT) machines.$(OBJEXT) mktime.$(OBJEXT) \
|
||||
modetoa.$(OBJEXT) mstolfp.$(OBJEXT) msyslog.$(OBJEXT) \
|
||||
netof.$(OBJEXT) ntp_calendar.$(OBJEXT) \
|
||||
ntp_crypto_rnd.$(OBJEXT) ntp_intres.$(OBJEXT) \
|
||||
@@ -231,15 +234,15 @@ am__libntpsim_a_SOURCES_DIST = systime_s.c a_md5encrypt.c adjtime.c \
|
||||
calyearstart.c clocktime.c clocktypes.c decodenetnum.c \
|
||||
dofptoa.c dolfptoa.c emalloc.c findconfig.c getopt.c \
|
||||
hextoint.c hextolfp.c humandate.c icom.c iosignal.c \
|
||||
lib_strbuf.c machines.c mktime.c modetoa.c mstolfp.c msyslog.c \
|
||||
netof.c ntp_calendar.c ntp_crypto_rnd.c ntp_intres.c \
|
||||
ntp_libopts.c ntp_lineedit.c ntp_random.c ntp_rfc2553.c \
|
||||
ntp_worker.c numtoa.c numtohost.c octtoint.c prettydate.c \
|
||||
refidsmear.c recvbuff.c refnumtoa.c snprintf.c socket.c \
|
||||
socktoa.c socktohost.c ssl_init.c statestr.c strdup.c \
|
||||
strl_obsd.c syssignal.c timetoa.c timevalops.c uglydate.c \
|
||||
vint64ops.c work_fork.c work_thread.c ymd2yd.c \
|
||||
$(srcdir)/../lib/isc/assertions.c \
|
||||
is_ip_address.c lib_strbuf.c libssl_compat.c machines.c \
|
||||
mktime.c modetoa.c mstolfp.c msyslog.c netof.c ntp_calendar.c \
|
||||
ntp_crypto_rnd.c ntp_intres.c ntp_libopts.c ntp_lineedit.c \
|
||||
ntp_random.c ntp_rfc2553.c ntp_worker.c numtoa.c numtohost.c \
|
||||
octtoint.c prettydate.c refidsmear.c recvbuff.c refnumtoa.c \
|
||||
snprintf.c socket.c socktoa.c socktohost.c ssl_init.c \
|
||||
statestr.c strdup.c strl_obsd.c syssignal.c timetoa.c \
|
||||
timevalops.c uglydate.c vint64ops.c work_fork.c work_thread.c \
|
||||
ymd2yd.c $(srcdir)/../lib/isc/assertions.c \
|
||||
$(srcdir)/../lib/isc/buffer.c \
|
||||
$(srcdir)/../lib/isc/backtrace-emptytbl.c \
|
||||
$(srcdir)/../lib/isc/backtrace.c \
|
||||
@@ -263,6 +266,7 @@ am__libntpsim_a_SOURCES_DIST = systime_s.c a_md5encrypt.c adjtime.c \
|
||||
$(srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/thread.c \
|
||||
$(srcdir)/../lib/isc/unix/time.c $(srcdir)/../lib/isc/sha1.c \
|
||||
$(srcdir)/../lib/isc/sockaddr.c \
|
||||
$(srcdir)/../lib/isc/tsmemcmp.c \
|
||||
$(srcdir)/../lib/isc/pthreads/mutex.c
|
||||
am_libntpsim_a_OBJECTS = systime_s.$(OBJEXT) $(am__objects_4)
|
||||
libntpsim_a_OBJECTS = $(am_libntpsim_a_OBJECTS)
|
||||
@@ -345,6 +349,7 @@ AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_THREAD = @BUILD_THREAD@
|
||||
CALC_TICKADJ_DB = @CALC_TICKADJ_DB@
|
||||
CALC_TICKADJ_DL = @CALC_TICKADJ_DL@
|
||||
CALC_TICKADJ_DS = @CALC_TICKADJ_DS@
|
||||
@@ -353,6 +358,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@
|
||||
CFLAGS_NTP = @CFLAGS_NTP@
|
||||
CHUTEST = @CHUTEST@
|
||||
CONFIG_SHELL = @CONFIG_SHELL@
|
||||
@@ -414,6 +420,7 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LSCF = @LSCF@
|
||||
LTHREAD_LIBS = @LTHREAD_LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAKE_ADJTIMED = @MAKE_ADJTIMED@
|
||||
@@ -627,7 +634,8 @@ libisc_SRCS = $(srcdir)/../lib/isc/assertions.c \
|
||||
$(srcdir)/../lib/isc/task.c \
|
||||
$(srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/thread.c \
|
||||
$(srcdir)/../lib/isc/unix/time.c $(srcdir)/../lib/isc/sha1.c \
|
||||
$(srcdir)/../lib/isc/sockaddr.c $(NULL) $(am__append_1)
|
||||
$(srcdir)/../lib/isc/sockaddr.c \
|
||||
$(srcdir)/../lib/isc/tsmemcmp.c $(NULL) $(am__append_1)
|
||||
libntp_a_SRCS = \
|
||||
a_md5encrypt.c \
|
||||
adjtime.c \
|
||||
@@ -656,7 +664,9 @@ libntp_a_SRCS = \
|
||||
humandate.c \
|
||||
icom.c \
|
||||
iosignal.c \
|
||||
is_ip_address.c \
|
||||
lib_strbuf.c \
|
||||
libssl_compat.c \
|
||||
machines.c \
|
||||
mktime.c \
|
||||
modetoa.c \
|
||||
@@ -802,8 +812,10 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_pton.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interfaceiter.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iosignal.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_ip_address.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib_strbuf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libssl_compat.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/machines.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@
|
||||
@@ -856,6 +868,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timetoa.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timevalops.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsmemcmp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uglydate.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vint64ops.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/work_fork.Po@am__quote@
|
||||
@@ -1317,6 +1330,20 @@ sockaddr.obj: $(srcdir)/../lib/isc/sockaddr.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sockaddr.obj `if test -f '$(srcdir)/../lib/isc/sockaddr.c'; then $(CYGPATH_W) '$(srcdir)/../lib/isc/sockaddr.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../lib/isc/sockaddr.c'; fi`
|
||||
|
||||
tsmemcmp.o: $(srcdir)/../lib/isc/tsmemcmp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tsmemcmp.o -MD -MP -MF $(DEPDIR)/tsmemcmp.Tpo -c -o tsmemcmp.o `test -f '$(srcdir)/../lib/isc/tsmemcmp.c' || echo '$(srcdir)/'`$(srcdir)/../lib/isc/tsmemcmp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tsmemcmp.Tpo $(DEPDIR)/tsmemcmp.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../lib/isc/tsmemcmp.c' object='tsmemcmp.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tsmemcmp.o `test -f '$(srcdir)/../lib/isc/tsmemcmp.c' || echo '$(srcdir)/'`$(srcdir)/../lib/isc/tsmemcmp.c
|
||||
|
||||
tsmemcmp.obj: $(srcdir)/../lib/isc/tsmemcmp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tsmemcmp.obj -MD -MP -MF $(DEPDIR)/tsmemcmp.Tpo -c -o tsmemcmp.obj `if test -f '$(srcdir)/../lib/isc/tsmemcmp.c'; then $(CYGPATH_W) '$(srcdir)/../lib/isc/tsmemcmp.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../lib/isc/tsmemcmp.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tsmemcmp.Tpo $(DEPDIR)/tsmemcmp.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/../lib/isc/tsmemcmp.c' object='tsmemcmp.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tsmemcmp.obj `if test -f '$(srcdir)/../lib/isc/tsmemcmp.c'; then $(CYGPATH_W) '$(srcdir)/../lib/isc/tsmemcmp.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../lib/isc/tsmemcmp.c'; fi`
|
||||
|
||||
mutex.o: $(srcdir)/../lib/isc/pthreads/mutex.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mutex.o -MD -MP -MF $(DEPDIR)/mutex.Tpo -c -o mutex.o `test -f '$(srcdir)/../lib/isc/pthreads/mutex.c' || echo '$(srcdir)/'`$(srcdir)/../lib/isc/pthreads/mutex.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mutex.Tpo $(DEPDIR)/mutex.Po
|
||||
|
||||
@@ -10,23 +10,24 @@
|
||||
#include "ntp_stdlib.h"
|
||||
#include "ntp.h"
|
||||
#include "ntp_md5.h" /* provides OpenSSL digest API */
|
||||
|
||||
#include "isc/string.h"
|
||||
#include "libssl_compat.h"
|
||||
/*
|
||||
* MD5authencrypt - generate message digest
|
||||
*
|
||||
* Returns length of MAC including key ID and digest.
|
||||
*/
|
||||
int
|
||||
size_t
|
||||
MD5authencrypt(
|
||||
int type, /* hash algorithm */
|
||||
u_char *key, /* key pointer */
|
||||
u_int32 *pkt, /* packet pointer */
|
||||
int length /* packet length */
|
||||
int type, /* hash algorithm */
|
||||
const u_char * key, /* key pointer */
|
||||
u_int32 * pkt, /* packet pointer */
|
||||
size_t length /* packet length */
|
||||
)
|
||||
{
|
||||
u_char digest[EVP_MAX_MD_SIZE];
|
||||
u_int len;
|
||||
EVP_MD_CTX ctx;
|
||||
EVP_MD_CTX *ctx;
|
||||
|
||||
/*
|
||||
* Compute digest of key concatenated with packet. Note: the
|
||||
@@ -34,18 +35,20 @@ MD5authencrypt(
|
||||
* was creaded.
|
||||
*/
|
||||
INIT_SSL();
|
||||
#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x0090700fL
|
||||
if (!EVP_DigestInit(&ctx, EVP_get_digestbynid(type))) {
|
||||
ctx = EVP_MD_CTX_new();
|
||||
if (!(ctx && EVP_DigestInit(ctx, EVP_get_digestbynid(type)))) {
|
||||
msyslog(LOG_ERR,
|
||||
"MAC encrypt: digest init failed");
|
||||
EVP_MD_CTX_free(ctx);
|
||||
return (0);
|
||||
}
|
||||
#else
|
||||
EVP_DigestInit(&ctx, EVP_get_digestbynid(type));
|
||||
#endif
|
||||
EVP_DigestUpdate(&ctx, key, cache_secretsize);
|
||||
EVP_DigestUpdate(&ctx, (u_char *)pkt, (u_int)length);
|
||||
EVP_DigestFinal(&ctx, digest, &len);
|
||||
EVP_DigestUpdate(ctx, key, cache_secretsize);
|
||||
EVP_DigestUpdate(ctx, (u_char *)pkt, length);
|
||||
EVP_DigestFinal(ctx, digest, &len);
|
||||
EVP_MD_CTX_free(ctx);
|
||||
/* If the MAC is longer than the MAX then truncate it. */
|
||||
if (len > MAX_MAC_LEN - 4)
|
||||
len = MAX_MAC_LEN - 4;
|
||||
memmove((u_char *)pkt + length + 4, digest, len);
|
||||
return (len + 4);
|
||||
}
|
||||
@@ -58,16 +61,16 @@ MD5authencrypt(
|
||||
*/
|
||||
int
|
||||
MD5authdecrypt(
|
||||
int type, /* hash algorithm */
|
||||
u_char *key, /* key pointer */
|
||||
u_int32 *pkt, /* packet pointer */
|
||||
int length, /* packet length */
|
||||
int size /* MAC size */
|
||||
int type, /* hash algorithm */
|
||||
const u_char * key, /* key pointer */
|
||||
u_int32 * pkt, /* packet pointer */
|
||||
size_t length, /* packet length */
|
||||
size_t size /* MAC size */
|
||||
)
|
||||
{
|
||||
u_char digest[EVP_MAX_MD_SIZE];
|
||||
u_int len;
|
||||
EVP_MD_CTX ctx;
|
||||
EVP_MD_CTX *ctx;
|
||||
|
||||
/*
|
||||
* Compute digest of key concatenated with packet. Note: the
|
||||
@@ -75,24 +78,26 @@ MD5authdecrypt(
|
||||
* was created.
|
||||
*/
|
||||
INIT_SSL();
|
||||
#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x0090700fL
|
||||
if (!EVP_DigestInit(&ctx, EVP_get_digestbynid(type))) {
|
||||
ctx = EVP_MD_CTX_new();
|
||||
if (!(ctx && EVP_DigestInit(ctx, EVP_get_digestbynid(type)))) {
|
||||
msyslog(LOG_ERR,
|
||||
"MAC decrypt: digest init failed");
|
||||
EVP_MD_CTX_free(ctx);
|
||||
return (0);
|
||||
}
|
||||
#else
|
||||
EVP_DigestInit(&ctx, EVP_get_digestbynid(type));
|
||||
#endif
|
||||
EVP_DigestUpdate(&ctx, key, cache_secretsize);
|
||||
EVP_DigestUpdate(&ctx, (u_char *)pkt, (u_int)length);
|
||||
EVP_DigestFinal(&ctx, digest, &len);
|
||||
if ((u_int)size != len + 4) {
|
||||
EVP_DigestUpdate(ctx, key, cache_secretsize);
|
||||
EVP_DigestUpdate(ctx, (u_char *)pkt, length);
|
||||
EVP_DigestFinal(ctx, digest, &len);
|
||||
EVP_MD_CTX_free(ctx);
|
||||
/* If the MAC is longer than the MAX then truncate it. */
|
||||
if (len > MAX_MAC_LEN - 4)
|
||||
len = MAX_MAC_LEN - 4;
|
||||
if (size != (size_t)len + 4) {
|
||||
msyslog(LOG_ERR,
|
||||
"MAC decrypt: MAC length error");
|
||||
return (0);
|
||||
}
|
||||
return !memcmp(digest, (char *)pkt + length + 4, len);
|
||||
return !isc_tsmemcmp(digest, (u_char *)pkt + length + 4, len);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -106,7 +111,7 @@ addr2refid(sockaddr_u *addr)
|
||||
{
|
||||
u_char digest[20];
|
||||
u_int32 addr_refid;
|
||||
EVP_MD_CTX ctx;
|
||||
EVP_MD_CTX *ctx;
|
||||
u_int len;
|
||||
|
||||
if (IS_IPV4(addr))
|
||||
@@ -114,24 +119,23 @@ addr2refid(sockaddr_u *addr)
|
||||
|
||||
INIT_SSL();
|
||||
|
||||
#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x0090700fL
|
||||
EVP_MD_CTX_init(&ctx);
|
||||
ctx = EVP_MD_CTX_new();
|
||||
EVP_MD_CTX_init(ctx);
|
||||
#ifdef EVP_MD_CTX_FLAG_NON_FIPS_ALLOW
|
||||
/* MD5 is not used as a crypto hash here. */
|
||||
EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
|
||||
EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
|
||||
#endif
|
||||
if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL)) {
|
||||
if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL)) {
|
||||
msyslog(LOG_ERR,
|
||||
"MD5 init failed");
|
||||
EVP_MD_CTX_free(ctx); /* pedantic... but safe */
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
EVP_DigestInit(&ctx, EVP_md5());
|
||||
#endif
|
||||
|
||||
EVP_DigestUpdate(&ctx, (u_char *)PSOCK_ADDR6(addr),
|
||||
EVP_DigestUpdate(ctx, (u_char *)PSOCK_ADDR6(addr),
|
||||
sizeof(struct in6_addr));
|
||||
EVP_DigestFinal(&ctx, digest, &len);
|
||||
EVP_DigestFinal(ctx, digest, &len);
|
||||
EVP_MD_CTX_free(ctx);
|
||||
memcpy(&addr_refid, digest, sizeof(addr_refid));
|
||||
return (addr_refid);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ atolfp(
|
||||
int isneg;
|
||||
static const char *digits = "0123456789";
|
||||
|
||||
NTP_REQUIRE(str != NULL);
|
||||
REQUIRE(str != NULL);
|
||||
|
||||
isneg = 0;
|
||||
dec_i = dec_f = 0;
|
||||
@@ -68,7 +68,7 @@ atolfp(
|
||||
|
||||
while (*cp != '\0' && (ind = strchr(digits, *cp)) != NULL) {
|
||||
dec_i = (dec_i << 3) + (dec_i << 1); /* multiply by 10 */
|
||||
dec_i += (ind - digits);
|
||||
dec_i += (u_long)(ind - digits);
|
||||
cp++;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ atolfp(
|
||||
&& (ind = strchr(digits, *cp)) != NULL) {
|
||||
ndec++;
|
||||
dec_f = (dec_f << 3) + (dec_f << 1); /* *10 */
|
||||
dec_f += (ind - digits);
|
||||
dec_f += (u_long)(ind - digits);
|
||||
cp++;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ static struct audio_device device; /* audio device ident */
|
||||
#ifdef PCM_STYLE_SOUND
|
||||
# define INIT_FILE "/etc/ntp.audio"
|
||||
int agc = SOUND_MIXER_WRITE_RECLEV; /* or IGAIN or LINE */
|
||||
int monitor = SOUND_MIXER_WRITE_VOLUME; /* or OGAIN */
|
||||
int audiomonitor = SOUND_MIXER_WRITE_VOLUME; /* or OGAIN */
|
||||
int devmask = 0;
|
||||
int recmask = 0;
|
||||
char cf_c_dev[100], cf_i_dev[100], cf_agc[100], cf_monitor[100];
|
||||
@@ -334,7 +334,7 @@ audio_init(
|
||||
/* devmask */
|
||||
i = mixer_name(cf_monitor, devmask);
|
||||
if (i >= 0)
|
||||
monitor = MIXER_WRITE(i);
|
||||
audiomonitor = MIXER_WRITE(i);
|
||||
else
|
||||
printf("monitor %s not in devmask %#x\n",
|
||||
cf_monitor, devmask);
|
||||
@@ -377,7 +377,9 @@ audio_gain(
|
||||
#ifdef PCM_STYLE_SOUND
|
||||
int l, r;
|
||||
|
||||
rval = 0;
|
||||
# ifdef GCC
|
||||
rval = 0; /* GCC thinks rval is used uninitialized */
|
||||
# endif
|
||||
|
||||
r = l = 100 * gain / 255; /* Normalize to 0-100 */
|
||||
# ifdef DEBUG
|
||||
@@ -392,10 +394,11 @@ audio_gain(
|
||||
if (cf_agc[0] != '\0')
|
||||
rval = ioctl(ctl_fd, agc, &l);
|
||||
else
|
||||
if (2 == port)
|
||||
rval = ioctl(ctl_fd, SOUND_MIXER_WRITE_LINE, &l);
|
||||
else
|
||||
rval = ioctl(ctl_fd, SOUND_MIXER_WRITE_MIC, &l);
|
||||
rval = ioctl(ctl_fd
|
||||
, (2 == port)
|
||||
? SOUND_MIXER_WRITE_LINE
|
||||
: SOUND_MIXER_WRITE_MIC
|
||||
, &l);
|
||||
if (-1 == rval) {
|
||||
printf("audio_gain: agc write: %s\n", strerror(errno));
|
||||
return rval;
|
||||
@@ -409,7 +412,7 @@ audio_gain(
|
||||
# endif
|
||||
l |= r << 8;
|
||||
if (cf_monitor[0] != '\0')
|
||||
rval = ioctl(ctl_fd, monitor, &l );
|
||||
rval = ioctl(ctl_fd, audiomonitor, &l );
|
||||
else
|
||||
rval = ioctl(ctl_fd, SOUND_MIXER_WRITE_VOLUME,
|
||||
&l);
|
||||
|
||||
+263
-122
@@ -15,6 +15,7 @@
|
||||
#include "ntp_string.h"
|
||||
#include "ntp_malloc.h"
|
||||
#include "ntp_stdlib.h"
|
||||
#include "ntp_keyacc.h"
|
||||
|
||||
/*
|
||||
* Structure to store keys in in the hash table.
|
||||
@@ -25,10 +26,11 @@ struct savekey {
|
||||
symkey * hlink; /* next in hash bucket */
|
||||
DECL_DLIST_LINK(symkey, llink); /* for overall & free lists */
|
||||
u_char * secret; /* shared secret */
|
||||
KeyAccT * keyacclist; /* Private key access list */
|
||||
u_long lifetime; /* remaining lifetime */
|
||||
keyid_t keyid; /* key identifier */
|
||||
u_short type; /* OpenSSL digest NID */
|
||||
u_short secretsize; /* secret octets */
|
||||
size_t secretsize; /* secret octets */
|
||||
u_short flags; /* KEY_ flags that wave */
|
||||
};
|
||||
|
||||
@@ -48,11 +50,11 @@ struct symkey_alloc_tag {
|
||||
symkey_alloc * authallocs;
|
||||
#endif /* DEBUG */
|
||||
|
||||
static inline u_short auth_log2(double x);
|
||||
static u_short auth_log2(size_t);
|
||||
static void auth_resize_hashtable(void);
|
||||
static void allocsymkey(symkey **, keyid_t, u_short,
|
||||
u_short, u_long, u_short, u_char *);
|
||||
static void freesymkey(symkey *, symkey **);
|
||||
static void allocsymkey(keyid_t, u_short,
|
||||
u_short, u_long, size_t, u_char *, KeyAccT *);
|
||||
static void freesymkey(symkey *);
|
||||
#ifdef DEBUG
|
||||
static void free_auth_mem(void);
|
||||
#endif
|
||||
@@ -63,7 +65,7 @@ symkey key_listhead; /* list of all in-use keys */;
|
||||
* keyid. We make this fairly big for potentially busy servers.
|
||||
*/
|
||||
#define DEF_AUTHHASHSIZE 64
|
||||
//#define HASHMASK ((HASHSIZE)-1)
|
||||
/*#define HASHMASK ((HASHSIZE)-1)*/
|
||||
#define KEYHASH(keyid) ((keyid) & authhashmask)
|
||||
|
||||
int authhashdisabled;
|
||||
@@ -91,12 +93,86 @@ int authnumfreekeys;
|
||||
|
||||
/*
|
||||
* The key cache. We cache the last key we looked at here.
|
||||
* Note: this should hold the last *trusted* key. Also the
|
||||
* cache is only loaded when the digest type / MAC algorithm
|
||||
* is valid.
|
||||
*/
|
||||
keyid_t cache_keyid; /* key identifier */
|
||||
u_char *cache_secret; /* secret */
|
||||
u_short cache_secretsize; /* secret length */
|
||||
size_t cache_secretsize; /* secret length */
|
||||
int cache_type; /* OpenSSL digest NID */
|
||||
u_short cache_flags; /* flags that wave */
|
||||
KeyAccT *cache_keyacclist; /* key access list */
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* manage key access lists
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
/* allocate and populate new access node and pushes it on the list.
|
||||
* Returns the new head.
|
||||
*/
|
||||
KeyAccT*
|
||||
keyacc_new_push(
|
||||
KeyAccT * head,
|
||||
const sockaddr_u * addr
|
||||
)
|
||||
{
|
||||
KeyAccT * node = emalloc(sizeof(KeyAccT));
|
||||
|
||||
memcpy(&node->addr, addr, sizeof(sockaddr_u));
|
||||
node->next = head;
|
||||
return node;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/* pop and deallocate the first node of a list of access nodes, if
|
||||
* the list is not empty. Returns the tail of the list.
|
||||
*/
|
||||
KeyAccT*
|
||||
keyacc_pop_free(
|
||||
KeyAccT *head
|
||||
)
|
||||
{
|
||||
KeyAccT * next = NULL;
|
||||
if (head) {
|
||||
next = head->next;
|
||||
free(head);
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/* deallocate the list; returns an empty list. */
|
||||
KeyAccT*
|
||||
keyacc_all_free(
|
||||
KeyAccT * head
|
||||
)
|
||||
{
|
||||
while (head)
|
||||
head = keyacc_pop_free(head);
|
||||
return head;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/* scan a list to see if it contains a given address. Return the
|
||||
* default result value in case of an empty list.
|
||||
*/
|
||||
int /*BOOL*/
|
||||
keyacc_contains(
|
||||
const KeyAccT *head,
|
||||
const sockaddr_u *addr,
|
||||
int defv)
|
||||
{
|
||||
if (head) {
|
||||
do {
|
||||
if (SOCK_EQ(&head->addr, addr))
|
||||
return TRUE;
|
||||
} while (NULL != (head = head->next));
|
||||
return FALSE;
|
||||
} else {
|
||||
return !!defv;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -136,12 +212,13 @@ free_auth_mem(void)
|
||||
symkey_alloc * next_alloc;
|
||||
|
||||
while (NULL != (sk = HEAD_DLIST(key_listhead, llink))) {
|
||||
freesymkey(sk, &key_hash[KEYHASH(sk->keyid)]);
|
||||
freesymkey(sk);
|
||||
}
|
||||
free(key_hash);
|
||||
key_hash = NULL;
|
||||
cache_keyid = 0;
|
||||
cache_flags = 0;
|
||||
cache_keyacclist = NULL;
|
||||
for (alloc = authallocs; alloc != NULL; alloc = next_alloc) {
|
||||
next_alloc = alloc->link;
|
||||
free(alloc->mem);
|
||||
@@ -210,10 +287,48 @@ auth_prealloc_symkeys(
|
||||
}
|
||||
|
||||
|
||||
static inline u_short
|
||||
auth_log2(double x)
|
||||
static u_short
|
||||
auth_log2(size_t x)
|
||||
{
|
||||
return (u_short)(log10(x) / log10(2));
|
||||
/*
|
||||
** bithack to calculate floor(log2(x))
|
||||
**
|
||||
** This assumes
|
||||
** - (sizeof(size_t) is a power of two
|
||||
** - CHAR_BITS is a power of two
|
||||
** - returning zero for arguments <= 0 is OK.
|
||||
**
|
||||
** Does only shifts, masks and sums in integer arithmetic in
|
||||
** log2(CHAR_BIT*sizeof(size_t)) steps. (that is, 5/6 steps for
|
||||
** 32bit/64bit size_t)
|
||||
*/
|
||||
int s;
|
||||
int r = 0;
|
||||
size_t m = ~(size_t)0;
|
||||
|
||||
for (s = sizeof(size_t) / 2 * CHAR_BIT; s != 0; s >>= 1) {
|
||||
m <<= s;
|
||||
if (x & m)
|
||||
r += s;
|
||||
else
|
||||
x <<= s;
|
||||
}
|
||||
return (u_short)r;
|
||||
}
|
||||
|
||||
static void
|
||||
authcache_flush_id(
|
||||
keyid_t id
|
||||
)
|
||||
{
|
||||
if (cache_keyid == id) {
|
||||
cache_keyid = 0;
|
||||
cache_type = 0;
|
||||
cache_flags = 0;
|
||||
cache_secret = NULL;
|
||||
cache_secretsize = 0;
|
||||
cache_keyacclist = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -234,7 +349,7 @@ auth_resize_hashtable(void)
|
||||
symkey * sk;
|
||||
|
||||
totalkeys = authnumkeys + authnumfreekeys;
|
||||
hashbits = auth_log2(totalkeys / 4.0) + 1;
|
||||
hashbits = auth_log2(totalkeys / 4) + 1;
|
||||
hashbits = max(4, hashbits);
|
||||
hashbits = min(15, hashbits);
|
||||
|
||||
@@ -261,16 +376,20 @@ auth_resize_hashtable(void)
|
||||
*/
|
||||
static void
|
||||
allocsymkey(
|
||||
symkey ** bucket,
|
||||
keyid_t id,
|
||||
u_short flags,
|
||||
u_short type,
|
||||
u_long lifetime,
|
||||
u_short secretsize,
|
||||
u_char * secret
|
||||
size_t secretsize,
|
||||
u_char * secret,
|
||||
KeyAccT * ka
|
||||
)
|
||||
{
|
||||
symkey * sk;
|
||||
symkey ** bucket;
|
||||
|
||||
bucket = &key_hash[KEYHASH(id)];
|
||||
|
||||
|
||||
if (authnumfreekeys < 1)
|
||||
auth_moremem(-1);
|
||||
@@ -281,6 +400,7 @@ allocsymkey(
|
||||
sk->type = type;
|
||||
sk->secretsize = secretsize;
|
||||
sk->secret = secret;
|
||||
sk->keyacclist = ka;
|
||||
sk->lifetime = lifetime;
|
||||
LINK_SLIST(*bucket, sk, hlink);
|
||||
LINK_TAIL_DLIST(key_listhead, sk, llink);
|
||||
@@ -294,12 +414,19 @@ allocsymkey(
|
||||
*/
|
||||
static void
|
||||
freesymkey(
|
||||
symkey * sk,
|
||||
symkey ** bucket
|
||||
symkey * sk
|
||||
)
|
||||
{
|
||||
symkey ** bucket;
|
||||
symkey * unlinked;
|
||||
|
||||
if (NULL == sk)
|
||||
return;
|
||||
|
||||
authcache_flush_id(sk->keyid);
|
||||
keyacc_all_free(sk->keyacclist);
|
||||
|
||||
bucket = &key_hash[KEYHASH(sk->keyid)];
|
||||
if (sk->secret != NULL) {
|
||||
memset(sk->secret, '\0', sk->secretsize);
|
||||
free(sk->secret);
|
||||
@@ -325,37 +452,26 @@ auth_findkey(
|
||||
{
|
||||
symkey * sk;
|
||||
|
||||
for (sk = key_hash[KEYHASH(id)]; sk != NULL; sk = sk->hlink) {
|
||||
if (id == sk->keyid) {
|
||||
for (sk = key_hash[KEYHASH(id)]; sk != NULL; sk = sk->hlink)
|
||||
if (id == sk->keyid)
|
||||
return sk;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* auth_havekey - return TRUE if the key id is zero or known
|
||||
* auth_havekey - return TRUE if the key id is zero or known. The
|
||||
* key needs not to be trusted.
|
||||
*/
|
||||
int
|
||||
auth_havekey(
|
||||
keyid_t id
|
||||
)
|
||||
{
|
||||
symkey * sk;
|
||||
|
||||
if (0 == id || cache_keyid == id) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (sk = key_hash[KEYHASH(id)]; sk != NULL; sk = sk->hlink) {
|
||||
if (id == sk->keyid) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return
|
||||
(0 == id) ||
|
||||
(cache_keyid == id) ||
|
||||
(NULL != auth_findkey(id));
|
||||
}
|
||||
|
||||
|
||||
@@ -371,35 +487,25 @@ authhavekey(
|
||||
symkey * sk;
|
||||
|
||||
authkeylookups++;
|
||||
if (0 == id || cache_keyid == id) {
|
||||
return TRUE;
|
||||
}
|
||||
if (0 == id || cache_keyid == id)
|
||||
return !!(KEY_TRUSTED & cache_flags);
|
||||
|
||||
/*
|
||||
* Seach the bin for the key. If found and the key type
|
||||
* is zero, somebody marked it trusted without specifying
|
||||
* a key or key type. In this case consider the key missing.
|
||||
* Search the bin for the key. If not found, or found but the key
|
||||
* type is zero, somebody marked it trusted without specifying a
|
||||
* key or key type. In this case consider the key missing.
|
||||
*/
|
||||
authkeyuncached++;
|
||||
for (sk = key_hash[KEYHASH(id)]; sk != NULL; sk = sk->hlink) {
|
||||
if (id == sk->keyid) {
|
||||
if (0 == sk->type) {
|
||||
authkeynotfound++;
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the key is not found, or if it is found but not trusted,
|
||||
* the key is not considered found.
|
||||
*/
|
||||
if (NULL == sk) {
|
||||
sk = auth_findkey(id);
|
||||
if ((sk == NULL) || (sk->type == 0)) {
|
||||
authkeynotfound++;
|
||||
return FALSE;
|
||||
}
|
||||
if (!(KEY_TRUSTED & sk->flags)) {
|
||||
|
||||
/*
|
||||
* If the key is not trusted, the key is not considered found.
|
||||
*/
|
||||
if ( ! (KEY_TRUSTED & sk->flags)) {
|
||||
authnokey++;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -412,6 +518,7 @@ authhavekey(
|
||||
cache_flags = sk->flags;
|
||||
cache_secret = sk->secret;
|
||||
cache_secretsize = sk->secretsize;
|
||||
cache_keyacclist = sk->keyacclist;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -426,7 +533,6 @@ authtrust(
|
||||
u_long trust
|
||||
)
|
||||
{
|
||||
symkey ** bucket;
|
||||
symkey * sk;
|
||||
u_long lifetime;
|
||||
|
||||
@@ -434,12 +540,9 @@ authtrust(
|
||||
* Search bin for key; if it does not exist and is untrusted,
|
||||
* forget it.
|
||||
*/
|
||||
bucket = &key_hash[KEYHASH(id)];
|
||||
for (sk = *bucket; sk != NULL; sk = sk->hlink) {
|
||||
if (id == sk->keyid)
|
||||
break;
|
||||
}
|
||||
if (!trust && NULL == sk)
|
||||
|
||||
sk = auth_findkey(id);
|
||||
if (!trust && sk == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
@@ -448,26 +551,22 @@ authtrust(
|
||||
* not to be trusted.
|
||||
*/
|
||||
if (sk != NULL) {
|
||||
if (cache_keyid == id) {
|
||||
cache_flags = 0;
|
||||
cache_keyid = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Key exists. If it is to be trusted, say so and
|
||||
* update its lifetime.
|
||||
* Key exists. If it is to be trusted, say so and update
|
||||
* its lifetime. If no longer trusted, return it to the
|
||||
* free list. Flush the cache first to be sure there are
|
||||
* no discrepancies.
|
||||
*/
|
||||
authcache_flush_id(id);
|
||||
if (trust > 0) {
|
||||
sk->flags |= KEY_TRUSTED;
|
||||
if (trust > 1)
|
||||
sk->lifetime = current_time + trust;
|
||||
else
|
||||
sk->lifetime = 0;
|
||||
return;
|
||||
} else {
|
||||
freesymkey(sk);
|
||||
}
|
||||
|
||||
/* No longer trusted, return it to the free list. */
|
||||
freesymkey(sk, bucket);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -480,7 +579,7 @@ authtrust(
|
||||
} else {
|
||||
lifetime = 0;
|
||||
}
|
||||
allocsymkey(bucket, id, KEY_TRUSTED, 0, lifetime, 0, NULL);
|
||||
allocsymkey(id, KEY_TRUSTED, 0, lifetime, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -489,22 +588,17 @@ authtrust(
|
||||
*/
|
||||
int
|
||||
authistrusted(
|
||||
keyid_t keyno
|
||||
keyid_t id
|
||||
)
|
||||
{
|
||||
symkey * sk;
|
||||
symkey ** bucket;
|
||||
|
||||
if (keyno == cache_keyid)
|
||||
if (id == cache_keyid)
|
||||
return !!(KEY_TRUSTED & cache_flags);
|
||||
|
||||
authkeyuncached++;
|
||||
bucket = &key_hash[KEYHASH(keyno)];
|
||||
for (sk = *bucket; sk != NULL; sk = sk->hlink) {
|
||||
if (keyno == sk->keyid)
|
||||
break;
|
||||
}
|
||||
if (NULL == sk || !(KEY_TRUSTED & sk->flags)) {
|
||||
sk = auth_findkey(id);
|
||||
if (sk == NULL || !(KEY_TRUSTED & sk->flags)) {
|
||||
authkeynotfound++;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -512,65 +606,109 @@ authistrusted(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* authistrustedip - determine if the IP is OK for the keyid
|
||||
*/
|
||||
int
|
||||
authistrustedip(
|
||||
keyid_t keyno,
|
||||
sockaddr_u * sau
|
||||
)
|
||||
{
|
||||
symkey * sk;
|
||||
|
||||
/* That specific key was already used to authenticate the
|
||||
* packet. Therefore, the key *must* exist... There's a chance
|
||||
* that is not trusted, though.
|
||||
*/
|
||||
if (keyno == cache_keyid) {
|
||||
return (KEY_TRUSTED & cache_flags) &&
|
||||
keyacc_contains(cache_keyacclist, sau, TRUE);
|
||||
} else {
|
||||
authkeyuncached++;
|
||||
sk = auth_findkey(keyno);
|
||||
INSIST(NULL != sk);
|
||||
return (KEY_TRUSTED & sk->flags) &&
|
||||
keyacc_contains(sk->keyacclist, sau, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Note: There are two locations below where 'strncpy()' is used. While
|
||||
* this function is a hazard by itself, it's essential that it is used
|
||||
* here. Bug 1243 involved that the secret was filled with NUL bytes
|
||||
* after the first NUL encountered, and 'strlcpy()' simply does NOT have
|
||||
* this behaviour. So disabling the fix and reverting to the buggy
|
||||
* behaviour due to compatibility issues MUST also fill with NUL and
|
||||
* this needs 'strncpy'. Also, the secret is managed as a byte blob of a
|
||||
* given size, and eventually truncating it and replacing the last byte
|
||||
* with a NUL would be a bug.
|
||||
* perlinger@ntp.org 2015-10-10
|
||||
*/
|
||||
void
|
||||
MD5auth_setkey(
|
||||
keyid_t keyno,
|
||||
int keytype,
|
||||
const u_char *key,
|
||||
size_t len
|
||||
size_t secretsize,
|
||||
KeyAccT *ka
|
||||
)
|
||||
{
|
||||
symkey * sk;
|
||||
symkey ** bucket;
|
||||
u_char * secret;
|
||||
size_t secretsize;
|
||||
|
||||
DEBUG_ENSURE(keytype <= USHRT_MAX);
|
||||
DEBUG_ENSURE(len < 4 * 1024);
|
||||
DEBUG_ENSURE(secretsize < 4 * 1024);
|
||||
/*
|
||||
* See if we already have the key. If so just stick in the
|
||||
* new value.
|
||||
*/
|
||||
bucket = &key_hash[KEYHASH(keyno)];
|
||||
for (sk = *bucket; sk != NULL; sk = sk->hlink) {
|
||||
if (keyno == sk->keyid) {
|
||||
sk->type = (u_short)keytype;
|
||||
secretsize = len;
|
||||
sk->secretsize = (u_short)secretsize;
|
||||
#ifndef DISABLE_BUG1243_FIX
|
||||
memcpy(sk->secret, key, secretsize);
|
||||
#else
|
||||
strlcpy((char *)sk->secret, (const char *)key,
|
||||
secretsize);
|
||||
#endif
|
||||
if (cache_keyid == keyno) {
|
||||
cache_flags = 0;
|
||||
cache_keyid = 0;
|
||||
}
|
||||
return;
|
||||
sk = auth_findkey(keyno);
|
||||
if (sk != NULL && keyno == sk->keyid) {
|
||||
/* TALOS-CAN-0054: make sure we have a new buffer! */
|
||||
if (NULL != sk->secret) {
|
||||
memset(sk->secret, 0, sk->secretsize);
|
||||
free(sk->secret);
|
||||
}
|
||||
sk->secret = emalloc(secretsize + 1);
|
||||
sk->type = (u_short)keytype;
|
||||
sk->secretsize = secretsize;
|
||||
/* make sure access lists don't leak here! */
|
||||
if (ka != sk->keyacclist) {
|
||||
keyacc_all_free(sk->keyacclist);
|
||||
sk->keyacclist = ka;
|
||||
}
|
||||
#ifndef DISABLE_BUG1243_FIX
|
||||
memcpy(sk->secret, key, secretsize);
|
||||
#else
|
||||
/* >MUST< use 'strncpy()' here! See above! */
|
||||
strncpy((char *)sk->secret, (const char *)key,
|
||||
secretsize);
|
||||
#endif
|
||||
authcache_flush_id(keyno);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Need to allocate new structure. Do it.
|
||||
*/
|
||||
secretsize = len;
|
||||
secret = emalloc(secretsize);
|
||||
secret = emalloc(secretsize + 1);
|
||||
#ifndef DISABLE_BUG1243_FIX
|
||||
memcpy(secret, key, secretsize);
|
||||
#else
|
||||
strlcpy((char *)secret, (const char *)key, secretsize);
|
||||
/* >MUST< use 'strncpy()' here! See above! */
|
||||
strncpy((char *)secret, (const char *)key, secretsize);
|
||||
#endif
|
||||
allocsymkey(bucket, keyno, 0, (u_short)keytype, 0,
|
||||
(u_short)secretsize, secret);
|
||||
allocsymkey(keyno, 0, (u_short)keytype, 0,
|
||||
secretsize, secret, ka);
|
||||
#ifdef DEBUG
|
||||
if (debug >= 4) {
|
||||
size_t j;
|
||||
|
||||
printf("auth_setkey: key %d type %d len %d ", (int)keyno,
|
||||
keytype, (int)secretsize);
|
||||
for (j = 0; j < secretsize; j++)
|
||||
for (j = 0; j < secretsize; j++) {
|
||||
printf("%02x", secret[j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
@@ -593,17 +731,20 @@ auth_delkeys(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't lose info as to which keys are trusted.
|
||||
* Don't lose info as to which keys are trusted. Make
|
||||
* sure there are no dangling pointers!
|
||||
*/
|
||||
if (KEY_TRUSTED & sk->flags) {
|
||||
if (sk->secret != NULL) {
|
||||
memset(sk->secret, '\0', sk->secretsize);
|
||||
memset(sk->secret, 0, sk->secretsize);
|
||||
free(sk->secret);
|
||||
sk->secret = NULL; /* TALOS-CAN-0054 */
|
||||
}
|
||||
sk->keyacclist = keyacc_all_free(sk->keyacclist);
|
||||
sk->secretsize = 0;
|
||||
sk->lifetime = 0;
|
||||
} else {
|
||||
freesymkey(sk, &key_hash[KEYHASH(sk->keyid)]);
|
||||
freesymkey(sk);
|
||||
}
|
||||
ITER_DLIST_END()
|
||||
}
|
||||
@@ -619,7 +760,7 @@ auth_agekeys(void)
|
||||
|
||||
ITER_DLIST_BEGIN(key_listhead, sk, llink, symkey)
|
||||
if (sk->lifetime > 0 && current_time > sk->lifetime) {
|
||||
freesymkey(sk, &key_hash[KEYHASH(sk->keyid)]);
|
||||
freesymkey(sk);
|
||||
authkeyexpired++;
|
||||
}
|
||||
ITER_DLIST_END()
|
||||
@@ -633,13 +774,13 @@ auth_agekeys(void)
|
||||
*
|
||||
* Returns length of authenticator field, zero if key not found.
|
||||
*/
|
||||
int
|
||||
size_t
|
||||
authencrypt(
|
||||
keyid_t keyno,
|
||||
u_int32 * pkt,
|
||||
int length
|
||||
size_t length
|
||||
)
|
||||
{\
|
||||
{
|
||||
/*
|
||||
* A zero key identifier means the sender has not verified
|
||||
* the last message was correctly authenticated. The MAC
|
||||
@@ -667,8 +808,8 @@ int
|
||||
authdecrypt(
|
||||
keyid_t keyno,
|
||||
u_int32 * pkt,
|
||||
int length,
|
||||
int size
|
||||
size_t length,
|
||||
size_t size
|
||||
)
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ntpd.h" /* Only for DPRINTF */
|
||||
#include "ntp_fp.h"
|
||||
#include "ntp.h"
|
||||
#include "ntp_syslog.h"
|
||||
#include "ntp_stdlib.h"
|
||||
#include "ntp_keyacc.h"
|
||||
|
||||
#ifdef OPENSSL
|
||||
#include "openssl/objects.h"
|
||||
@@ -62,6 +64,70 @@ nexttok(
|
||||
}
|
||||
|
||||
|
||||
/* TALOS-CAN-0055: possibly DoS attack by setting the key file to the
|
||||
* log file. This is hard to prevent (it would need to check two files
|
||||
* to be the same on the inode level, which will not work so easily with
|
||||
* Windows or VMS) but we can avoid the self-amplification loop: We only
|
||||
* log the first 5 errors, silently ignore the next 10 errors, and give
|
||||
* up when when we have found more than 15 errors.
|
||||
*
|
||||
* This avoids the endless file iteration we will end up with otherwise,
|
||||
* and also avoids overflowing the log file.
|
||||
*
|
||||
* Nevertheless, once this happens, the keys are gone since this would
|
||||
* require a save/swap strategy that is not easy to apply due to the
|
||||
* data on global/static level.
|
||||
*/
|
||||
|
||||
static const u_int nerr_loglimit = 5u;
|
||||
static const u_int nerr_maxlimit = 15;
|
||||
|
||||
static void log_maybe(u_int*, const char*, ...) NTP_PRINTF(2, 3);
|
||||
|
||||
typedef struct keydata KeyDataT;
|
||||
struct keydata {
|
||||
KeyDataT *next; /* queue/stack link */
|
||||
KeyAccT *keyacclist; /* key access list */
|
||||
keyid_t keyid; /* stored key ID */
|
||||
u_short keytype; /* stored key type */
|
||||
u_short seclen; /* length of secret */
|
||||
u_char secbuf[1]; /* begin of secret (formal only)*/
|
||||
};
|
||||
|
||||
static void
|
||||
log_maybe(
|
||||
u_int *pnerr,
|
||||
const char *fmt ,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
if ((NULL == pnerr) || (++(*pnerr) <= nerr_loglimit)) {
|
||||
va_start(ap, fmt);
|
||||
mvsyslog(LOG_ERR, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
free_keydata(
|
||||
KeyDataT *node
|
||||
)
|
||||
{
|
||||
KeyAccT *kap;
|
||||
|
||||
if (node) {
|
||||
while (node->keyacclist) {
|
||||
kap = node->keyacclist;
|
||||
node->keyacclist = kap->next;
|
||||
free(kap);
|
||||
}
|
||||
|
||||
/* purge secrets from memory before free()ing it */
|
||||
memset(node, 0, sizeof(*node) + node->seclen);
|
||||
free(node);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* authreadkeys - (re)read keys from a file.
|
||||
*/
|
||||
@@ -79,27 +145,29 @@ authreadkeys(
|
||||
u_char keystr[32]; /* Bug 2537 */
|
||||
size_t len;
|
||||
size_t j;
|
||||
|
||||
u_int nerr;
|
||||
KeyDataT *list = NULL;
|
||||
KeyDataT *next = NULL;
|
||||
/*
|
||||
* Open file. Complain and return if it can't be opened.
|
||||
*/
|
||||
fp = fopen(file, "r");
|
||||
if (fp == NULL) {
|
||||
msyslog(LOG_ERR, "authreadkeys: file %s: %m",
|
||||
msyslog(LOG_ERR, "authreadkeys: file '%s': %m",
|
||||
file);
|
||||
return (0);
|
||||
goto onerror;
|
||||
}
|
||||
INIT_SSL();
|
||||
|
||||
/*
|
||||
* Remove all existing keys
|
||||
*/
|
||||
auth_delkeys();
|
||||
|
||||
/*
|
||||
* Now read lines from the file, looking for key entries
|
||||
* Now read lines from the file, looking for key entries. Put
|
||||
* the data into temporary store for later propagation to avoid
|
||||
* two-pass processing.
|
||||
*/
|
||||
nerr = 0;
|
||||
while ((line = fgets(buf, sizeof buf, fp)) != NULL) {
|
||||
if (nerr > nerr_maxlimit)
|
||||
break;
|
||||
token = nexttok(&line);
|
||||
if (token == NULL)
|
||||
continue;
|
||||
@@ -108,16 +176,17 @@ authreadkeys(
|
||||
* First is key number. See if it is okay.
|
||||
*/
|
||||
keyno = atoi(token);
|
||||
if (keyno == 0) {
|
||||
msyslog(LOG_ERR,
|
||||
"authreadkeys: cannot change key %s", token);
|
||||
if (keyno < 1) {
|
||||
log_maybe(&nerr,
|
||||
"authreadkeys: cannot change key %s",
|
||||
token);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (keyno > NTP_MAXKEY) {
|
||||
msyslog(LOG_ERR,
|
||||
"authreadkeys: key %s > %d reserved for Autokey",
|
||||
token, NTP_MAXKEY);
|
||||
log_maybe(&nerr,
|
||||
"authreadkeys: key %s > %d reserved for Autokey",
|
||||
token, NTP_MAXKEY);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -126,10 +195,19 @@ authreadkeys(
|
||||
*/
|
||||
token = nexttok(&line);
|
||||
if (token == NULL) {
|
||||
msyslog(LOG_ERR,
|
||||
"authreadkeys: no key type for key %d", keyno);
|
||||
log_maybe(&nerr,
|
||||
"authreadkeys: no key type for key %d",
|
||||
keyno);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We want to silently ignore keys where we do not
|
||||
* support the requested digest type. OTOH, we want to
|
||||
* make sure the file is well-formed. That means we
|
||||
* have to process the line completely and have to
|
||||
* finally throw away the result... This is a bit more
|
||||
* work, but it also results in better error detection.
|
||||
*/
|
||||
#ifdef OPENSSL
|
||||
/*
|
||||
* The key type is the NID used by the message digest
|
||||
@@ -139,27 +217,28 @@ authreadkeys(
|
||||
*/
|
||||
keytype = keytype_from_text(token, NULL);
|
||||
if (keytype == 0) {
|
||||
msyslog(LOG_ERR,
|
||||
"authreadkeys: invalid type for key %d", keyno);
|
||||
continue;
|
||||
}
|
||||
if (EVP_get_digestbynid(keytype) == NULL) {
|
||||
msyslog(LOG_ERR,
|
||||
"authreadkeys: no algorithm for key %d", keyno);
|
||||
continue;
|
||||
log_maybe(NULL,
|
||||
"authreadkeys: invalid type for key %d",
|
||||
keyno);
|
||||
} else if (EVP_get_digestbynid(keytype) == NULL) {
|
||||
log_maybe(NULL,
|
||||
"authreadkeys: no algorithm for key %d",
|
||||
keyno);
|
||||
keytype = 0;
|
||||
}
|
||||
#else /* !OPENSSL follows */
|
||||
|
||||
/*
|
||||
* The key type is unused, but is required to be 'M' or
|
||||
* 'm' for compatibility.
|
||||
*/
|
||||
if (!(*token == 'M' || *token == 'm')) {
|
||||
msyslog(LOG_ERR,
|
||||
"authreadkeys: invalid type for key %d", keyno);
|
||||
continue;
|
||||
log_maybe(NULL,
|
||||
"authreadkeys: invalid type for key %d",
|
||||
keyno);
|
||||
keytype = 0;
|
||||
} else {
|
||||
keytype = KEY_TYPE_MD5;
|
||||
}
|
||||
keytype = KEY_TYPE_MD5;
|
||||
#endif /* !OPENSSL */
|
||||
|
||||
/*
|
||||
@@ -170,15 +249,21 @@ authreadkeys(
|
||||
*/
|
||||
token = nexttok(&line);
|
||||
if (token == NULL) {
|
||||
msyslog(LOG_ERR,
|
||||
"authreadkeys: no key for key %d", keyno);
|
||||
log_maybe(&nerr,
|
||||
"authreadkeys: no key for key %d", keyno);
|
||||
continue;
|
||||
}
|
||||
next = NULL;
|
||||
len = strlen(token);
|
||||
if (len <= 20) { /* Bug 2537 */
|
||||
MD5auth_setkey(keyno, keytype, (u_char *)token, len);
|
||||
next = emalloc(sizeof(KeyDataT) + len);
|
||||
next->keyacclist = NULL;
|
||||
next->keyid = keyno;
|
||||
next->keytype = keytype;
|
||||
next->seclen = len;
|
||||
memcpy(next->secbuf, token, len);
|
||||
} else {
|
||||
char hex[] = "0123456789abcdef";
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
u_char temp;
|
||||
char *ptr;
|
||||
size_t jlim;
|
||||
@@ -195,13 +280,90 @@ authreadkeys(
|
||||
keystr[j / 2] = temp << 4;
|
||||
}
|
||||
if (j < jlim) {
|
||||
msyslog(LOG_ERR,
|
||||
"authreadkeys: invalid hex digit for key %d", keyno);
|
||||
log_maybe(&nerr,
|
||||
"authreadkeys: invalid hex digit for key %d",
|
||||
keyno);
|
||||
continue;
|
||||
}
|
||||
MD5auth_setkey(keyno, keytype, keystr, jlim / 2);
|
||||
len = jlim/2; /* hmmmm.... what about odd length?!? */
|
||||
next = emalloc(sizeof(KeyDataT) + len);
|
||||
next->keyacclist = NULL;
|
||||
next->keyid = keyno;
|
||||
next->keytype = keytype;
|
||||
next->seclen = len;
|
||||
memcpy(next->secbuf, keystr, len);
|
||||
}
|
||||
|
||||
token = nexttok(&line);
|
||||
DPRINTF(0, ("authreadkeys: full access list <%s>\n", (token) ? token : "NULL"));
|
||||
if (token != NULL) { /* A comma-separated IP access list */
|
||||
char *tp = token;
|
||||
|
||||
while (tp) {
|
||||
char *i;
|
||||
sockaddr_u addr;
|
||||
|
||||
i = strchr(tp, (int)',');
|
||||
if (i)
|
||||
*i = '\0';
|
||||
DPRINTF(0, ("authreadkeys: access list: <%s>\n", tp));
|
||||
|
||||
if (is_ip_address(tp, AF_UNSPEC, &addr)) {
|
||||
next->keyacclist = keyacc_new_push(
|
||||
next->keyacclist, &addr);
|
||||
} else {
|
||||
log_maybe(&nerr,
|
||||
"authreadkeys: invalid IP address <%s> for key %d",
|
||||
tp, keyno);
|
||||
}
|
||||
|
||||
if (i) {
|
||||
tp = i + 1;
|
||||
} else {
|
||||
tp = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* check if this has to be weeded out... */
|
||||
if (0 == keytype) {
|
||||
free_keydata(next);
|
||||
next = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
INSIST(NULL != next);
|
||||
next->next = list;
|
||||
list = next;
|
||||
}
|
||||
fclose(fp);
|
||||
if (nerr > 0) {
|
||||
const char * why = "";
|
||||
if (nerr > nerr_maxlimit)
|
||||
why = " (emergency break)";
|
||||
msyslog(LOG_ERR,
|
||||
"authreadkeys: rejecting file '%s' after %u error(s)%s",
|
||||
file, nerr, why);
|
||||
goto onerror;
|
||||
}
|
||||
|
||||
/* first remove old file-based keys */
|
||||
auth_delkeys();
|
||||
/* insert the new key material */
|
||||
while (NULL != (next = list)) {
|
||||
list = next->next;
|
||||
MD5auth_setkey(next->keyid, next->keytype,
|
||||
next->secbuf, next->seclen, next->keyacclist);
|
||||
next->keyacclist = NULL; /* consumed by MD5auth_setkey */
|
||||
free_keydata(next);
|
||||
}
|
||||
return (1);
|
||||
|
||||
onerror:
|
||||
/* Mop up temporary storage before bailing out. */
|
||||
while (NULL != (next = list)) {
|
||||
list = next->next;
|
||||
free_keydata(next);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
@@ -23,12 +23,12 @@ authusekey(
|
||||
const u_char *str
|
||||
)
|
||||
{
|
||||
int len;
|
||||
size_t len;
|
||||
|
||||
len = strlen((const char *)str);
|
||||
if (0 == len)
|
||||
return 0;
|
||||
|
||||
MD5auth_setkey(keyno, keytype, str, len);
|
||||
MD5auth_setkey(keyno, keytype, str, len, NULL);
|
||||
return 1;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ caljulian(
|
||||
ntpcal_split split;
|
||||
|
||||
|
||||
NTP_INSIST(NULL != jt);
|
||||
INSIST(NULL != jt);
|
||||
|
||||
/*
|
||||
* Unfold ntp time around current time into NTP domain. Split
|
||||
|
||||
@@ -40,14 +40,14 @@ caltontp(
|
||||
int32_t eraday; /* CE Rata Die number */
|
||||
vint64 ntptime;/* resulting NTP time */
|
||||
|
||||
NTP_INSIST(jt != NULL);
|
||||
REQUIRE(jt != NULL);
|
||||
|
||||
NTP_REQUIRE(jt->month <= 13); /* permit month 0..13! */
|
||||
NTP_REQUIRE(jt->monthday <= 32);
|
||||
NTP_REQUIRE(jt->yearday <= 366);
|
||||
NTP_REQUIRE(jt->hour <= 24);
|
||||
NTP_REQUIRE(jt->minute <= MINSPERHR);
|
||||
NTP_REQUIRE(jt->second <= SECSPERMIN);
|
||||
REQUIRE(jt->month <= 13); /* permit month 0..13! */
|
||||
REQUIRE(jt->monthday <= 32);
|
||||
REQUIRE(jt->yearday <= 366);
|
||||
REQUIRE(jt->hour <= 24);
|
||||
REQUIRE(jt->minute <= MINSPERHR);
|
||||
REQUIRE(jt->second <= SECSPERMIN);
|
||||
|
||||
/*
|
||||
* First convert the date to he corresponding RataDie
|
||||
|
||||
@@ -35,8 +35,11 @@ decodenetnum(
|
||||
char *np;
|
||||
char name[80];
|
||||
|
||||
NTP_REQUIRE(num != NULL);
|
||||
NTP_REQUIRE(strlen(num) < sizeof(name));
|
||||
REQUIRE(num != NULL);
|
||||
|
||||
if (strlen(num) >= sizeof(name)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
port_str = NULL;
|
||||
if ('[' != num[0]) {
|
||||
@@ -72,7 +75,7 @@ decodenetnum(
|
||||
err = getaddrinfo(cp, "ntp", &hints, &ai);
|
||||
if (err != 0)
|
||||
return 0;
|
||||
NTP_INSIST(ai->ai_addrlen <= sizeof(*netnum));
|
||||
INSIST(ai->ai_addrlen <= sizeof(*netnum));
|
||||
ZERO(*netnum);
|
||||
memcpy(netnum, ai->ai_addr, ai->ai_addrlen);
|
||||
freeaddrinfo(ai);
|
||||
|
||||
@@ -40,7 +40,7 @@ dolfptoa(
|
||||
* including a possible rounding from the fractional part.
|
||||
*/
|
||||
cp = cpend = cpdec = &cbuf[10];
|
||||
for (dec = cp - cbuf; dec > 0 && fpi != 0; dec--) {
|
||||
for (dec = (int)(cp - cbuf); dec > 0 && fpi != 0; dec--) {
|
||||
/* can add another digit */
|
||||
u_int32 digit;
|
||||
|
||||
@@ -62,7 +62,7 @@ dolfptoa(
|
||||
cpdec += 3;
|
||||
}
|
||||
if ((size_t)dec > sizeof(cbuf) - (cpend - cbuf))
|
||||
dec = sizeof(cbuf) - (cpend - cbuf);
|
||||
dec = (int)(sizeof(cbuf) - (cpend - cbuf));
|
||||
|
||||
/*
|
||||
* If there's a fraction to deal with, do so.
|
||||
@@ -95,7 +95,7 @@ dolfptoa(
|
||||
u_char *tp = cpend;
|
||||
int carry = ((fpv & 0x80000000) != 0);
|
||||
|
||||
for (dec = tp - cbuf; carry && dec > 0; dec--) {
|
||||
for (dec = (int)(tp - cbuf); carry && dec > 0; dec--) {
|
||||
*--tp += 1;
|
||||
if (*tp == 10)
|
||||
*tp = 0;
|
||||
|
||||
@@ -76,8 +76,6 @@ ereallocz(
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
|
||||
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
|
||||
|
||||
@@ -37,8 +37,9 @@ hextolfp(
|
||||
while (*cp != '\0' && (cp - cpstart) < 8 &&
|
||||
(ind = strchr(digits, *cp)) != NULL) {
|
||||
dec_i = dec_i << 4; /* multiply by 16 */
|
||||
dec_i += ((ind - digits) > 15) ? (ind - digits) - 6
|
||||
: (ind - digits);
|
||||
dec_i += ((ind - digits) > 15)
|
||||
? (u_long)(ind - digits - 6)
|
||||
: (u_long)(ind - digits);
|
||||
cp++;
|
||||
}
|
||||
|
||||
@@ -51,8 +52,9 @@ hextolfp(
|
||||
while (*cp != '\0' && (cp - cpstart) < 8 &&
|
||||
(ind = strchr(digits, *cp)) != NULL) {
|
||||
dec_f = dec_f << 4; /* multiply by 16 */
|
||||
dec_f += ((ind - digits) > 15) ? (ind - digits) - 6
|
||||
: (ind - digits);
|
||||
dec_f += ((ind - digits) > 15)
|
||||
? (u_long)(ind - digits - 6)
|
||||
: (u_long)(ind - digits);
|
||||
cp++;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,16 @@
|
||||
* frequency. All other parameters must be manually set before use.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include "icom.h"
|
||||
#include <ntp_stdlib.h>
|
||||
#include <ntp_tty.h>
|
||||
#include <l_stdlib.h>
|
||||
#include <icom.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "ntp_tty.h"
|
||||
#include "l_stdlib.h"
|
||||
|
||||
#ifdef SYS_WINNT
|
||||
#undef write /* ports/winnt/include/config.h: #define write _write */
|
||||
@@ -60,9 +62,14 @@ static void doublefreq (double, u_char *, int);
|
||||
|
||||
/*
|
||||
* icom_freq(fd, ident, freq) - load radio frequency
|
||||
*
|
||||
* returns:
|
||||
* 0 (ok)
|
||||
* -1 (error)
|
||||
* 1 (short write to device)
|
||||
*/
|
||||
int
|
||||
icom_freq( /* returns 0 (ok), EIO (error) */
|
||||
icom_freq(
|
||||
int fd, /* file descriptor */
|
||||
int ident, /* ICOM radio identifier */
|
||||
double freq /* frequency (MHz) */
|
||||
@@ -71,6 +78,7 @@ icom_freq( /* returns 0 (ok), EIO (error) */
|
||||
u_char cmd[] = {PAD, PR, PR, 0, TX, V_SFREQ, 0, 0, 0, 0, FI,
|
||||
FI};
|
||||
int temp;
|
||||
int rc;
|
||||
|
||||
cmd[3] = (char)ident;
|
||||
if (ident == IC735)
|
||||
@@ -78,9 +86,17 @@ icom_freq( /* returns 0 (ok), EIO (error) */
|
||||
else
|
||||
temp = 5;
|
||||
doublefreq(freq * 1e6, &cmd[6], temp);
|
||||
temp = write(fd, cmd, temp + 7);
|
||||
rc = write(fd, cmd, temp + 7);
|
||||
if (rc == -1) {
|
||||
msyslog(LOG_ERR, "icom_freq: write() failed: %m");
|
||||
return -1;
|
||||
} else if (rc != temp + 7) {
|
||||
msyslog(LOG_ERR, "icom_freq: only wrote %d of %d bytes.",
|
||||
rc, temp+7);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* is_ip_address
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ntp_assert.h"
|
||||
#include "ntp_stdlib.h"
|
||||
#include "safecast.h"
|
||||
|
||||
/* Don't include ISC's version of IPv6 variables and structures */
|
||||
#define ISC_IPV6_H 1
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/sockaddr.h>
|
||||
|
||||
|
||||
/*
|
||||
* Code to tell if we have an IP address
|
||||
* If we have then return the sockaddr structure
|
||||
* and set the return value
|
||||
* see the bind9/getaddresses.c for details
|
||||
*/
|
||||
int
|
||||
is_ip_address(
|
||||
const char * host,
|
||||
u_short af,
|
||||
sockaddr_u * addr
|
||||
)
|
||||
{
|
||||
struct in_addr in4;
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *result;
|
||||
struct sockaddr_in6 *resaddr6;
|
||||
char tmpbuf[128];
|
||||
char *pch;
|
||||
|
||||
REQUIRE(host != NULL);
|
||||
REQUIRE(addr != NULL);
|
||||
|
||||
ZERO_SOCK(addr);
|
||||
|
||||
/*
|
||||
* Try IPv4, then IPv6. In order to handle the extended format
|
||||
* for IPv6 scoped addresses (address%scope_ID), we'll use a local
|
||||
* working buffer of 128 bytes. The length is an ad-hoc value, but
|
||||
* should be enough for this purpose; the buffer can contain a string
|
||||
* of at least 80 bytes for scope_ID in addition to any IPv6 numeric
|
||||
* addresses (up to 46 bytes), the delimiter character and the
|
||||
* terminating NULL character.
|
||||
*/
|
||||
if (AF_UNSPEC == af || AF_INET == af)
|
||||
if (inet_pton(AF_INET, host, &in4) == 1) {
|
||||
AF(addr) = AF_INET;
|
||||
SET_ADDR4N(addr, in4.s_addr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (AF_UNSPEC == af || AF_INET6 == af)
|
||||
if (sizeof(tmpbuf) > strlen(host)) {
|
||||
if ('[' == host[0]) {
|
||||
strlcpy(tmpbuf, &host[1], sizeof(tmpbuf));
|
||||
pch = strchr(tmpbuf, ']');
|
||||
if (pch != NULL)
|
||||
*pch = '\0';
|
||||
} else {
|
||||
strlcpy(tmpbuf, host, sizeof(tmpbuf));
|
||||
}
|
||||
ZERO(hints);
|
||||
hints.ai_family = AF_INET6;
|
||||
hints.ai_flags |= AI_NUMERICHOST;
|
||||
if (getaddrinfo(tmpbuf, NULL, &hints, &result) == 0) {
|
||||
AF(addr) = AF_INET6;
|
||||
resaddr6 = UA_PTR(struct sockaddr_in6, result->ai_addr);
|
||||
SET_ADDR6N(addr, resaddr6->sin6_addr);
|
||||
SET_SCOPE(addr, resaddr6->sin6_scope_id);
|
||||
|
||||
freeaddrinfo(result);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If we got here it was not an IP address
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
/*
|
||||
* libssl_compat.c -- OpenSSL v1.1 compatibility functions
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
* Written by Juergen Perlinger <perlinger@ntp.org> for the NTP project
|
||||
*
|
||||
* Based on an idea by Kurt Roeckx <kurt@roeckx.be>
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
* This is a clean room implementation of shim functions that have
|
||||
* counterparts in the OpenSSL v1.1 API but not in earlier versions. So
|
||||
* while OpenSSL broke binary compatibility with v1.1, this shim module
|
||||
* should provide the necessary source code compatibility with older
|
||||
* versions of OpenSSL.
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#include "ntp_types.h"
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
#include "libssl_compat.h"
|
||||
#include "ntp_assert.h"
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* replace a BIGNUM owned by the caller with another one if it's not
|
||||
* NULL, taking over the ownership of the new value. This clears & frees
|
||||
* the old value -- the clear might be overkill, but it's better to err
|
||||
* on the side of paranoia here.
|
||||
*/
|
||||
static void
|
||||
replace_bn_nn(
|
||||
BIGNUM ** ps,
|
||||
BIGNUM * n
|
||||
)
|
||||
{
|
||||
if (n) {
|
||||
REQUIRE(*ps != n);
|
||||
BN_clear_free(*ps);
|
||||
*ps = n;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* allocation and deallocation of prime number callbacks
|
||||
*/
|
||||
BN_GENCB*
|
||||
sslshimBN_GENCB_new(void)
|
||||
{
|
||||
return calloc(1,sizeof(BN_GENCB));
|
||||
}
|
||||
|
||||
void
|
||||
sslshimBN_GENCB_free(
|
||||
BN_GENCB *cb
|
||||
)
|
||||
{
|
||||
free(cb);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* allocation and deallocation of message digests
|
||||
*/
|
||||
EVP_MD_CTX*
|
||||
sslshim_EVP_MD_CTX_new(void)
|
||||
{
|
||||
return calloc(1, sizeof(EVP_MD_CTX));
|
||||
}
|
||||
|
||||
void
|
||||
sslshim_EVP_MD_CTX_free(
|
||||
EVP_MD_CTX * pctx
|
||||
)
|
||||
{
|
||||
free(pctx);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* get EVP keys and key type
|
||||
*/
|
||||
int
|
||||
sslshim_EVP_PKEY_id(
|
||||
const EVP_PKEY *pkey
|
||||
)
|
||||
{
|
||||
return (pkey) ? pkey->type : EVP_PKEY_NONE;
|
||||
}
|
||||
|
||||
int
|
||||
sslshim_EVP_PKEY_base_id(
|
||||
const EVP_PKEY *pkey
|
||||
)
|
||||
{
|
||||
return (pkey) ? EVP_PKEY_type(pkey->type) : EVP_PKEY_NONE;
|
||||
}
|
||||
|
||||
RSA*
|
||||
sslshim_EVP_PKEY_get0_RSA(
|
||||
EVP_PKEY * pkey
|
||||
)
|
||||
{
|
||||
return (pkey) ? pkey->pkey.rsa : NULL;
|
||||
}
|
||||
|
||||
DSA*
|
||||
sslshim_EVP_PKEY_get0_DSA(
|
||||
EVP_PKEY * pkey
|
||||
)
|
||||
{
|
||||
return (pkey) ? pkey->pkey.dsa : NULL;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* set/get RSA params
|
||||
*/
|
||||
void
|
||||
sslshim_RSA_get0_key(
|
||||
const RSA * prsa,
|
||||
const BIGNUM ** pn,
|
||||
const BIGNUM ** pe,
|
||||
const BIGNUM ** pd
|
||||
)
|
||||
{
|
||||
REQUIRE(prsa != NULL);
|
||||
|
||||
if (pn)
|
||||
*pn = prsa->n;
|
||||
if (pe)
|
||||
*pe = prsa->e;
|
||||
if (pd)
|
||||
*pd = prsa->d;
|
||||
}
|
||||
|
||||
int
|
||||
sslshim_RSA_set0_key(
|
||||
RSA * prsa,
|
||||
BIGNUM * n,
|
||||
BIGNUM * e,
|
||||
BIGNUM * d
|
||||
)
|
||||
{
|
||||
REQUIRE(prsa != NULL);
|
||||
if (!((prsa->n || n) && (prsa->e || e)))
|
||||
return 0;
|
||||
|
||||
replace_bn_nn(&prsa->n, n);
|
||||
replace_bn_nn(&prsa->e, e);
|
||||
replace_bn_nn(&prsa->d, d);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
sslshim_RSA_get0_factors(
|
||||
const RSA * prsa,
|
||||
const BIGNUM ** pp,
|
||||
const BIGNUM ** pq
|
||||
)
|
||||
{
|
||||
REQUIRE(prsa != NULL);
|
||||
|
||||
if (pp)
|
||||
*pp = prsa->p;
|
||||
if (pq)
|
||||
*pq = prsa->q;
|
||||
}
|
||||
|
||||
int
|
||||
sslshim_RSA_set0_factors(
|
||||
RSA * prsa,
|
||||
BIGNUM * p,
|
||||
BIGNUM * q
|
||||
)
|
||||
{
|
||||
REQUIRE(prsa != NULL);
|
||||
if (!((prsa->p || p) && (prsa->q || q)))
|
||||
return 0;
|
||||
|
||||
replace_bn_nn(&prsa->p, p);
|
||||
replace_bn_nn(&prsa->q, q);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
sslshim_RSA_set0_crt_params(
|
||||
RSA * prsa,
|
||||
BIGNUM * dmp1,
|
||||
BIGNUM * dmq1,
|
||||
BIGNUM * iqmp
|
||||
)
|
||||
{
|
||||
REQUIRE(prsa != NULL);
|
||||
if (!((prsa->dmp1 || dmp1) &&
|
||||
(prsa->dmq1 || dmq1) &&
|
||||
(prsa->iqmp || iqmp) ))
|
||||
return 0;
|
||||
|
||||
replace_bn_nn(&prsa->dmp1, dmp1);
|
||||
replace_bn_nn(&prsa->dmq1, dmq1);
|
||||
replace_bn_nn(&prsa->iqmp, iqmp);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* set/get DSA signature parameters
|
||||
*/
|
||||
void
|
||||
sslshim_DSA_SIG_get0(
|
||||
const DSA_SIG * psig,
|
||||
const BIGNUM ** pr,
|
||||
const BIGNUM ** ps
|
||||
)
|
||||
{
|
||||
REQUIRE(psig != NULL);
|
||||
|
||||
if (pr != NULL)
|
||||
*pr = psig->r;
|
||||
if (ps != NULL)
|
||||
*ps = psig->s;
|
||||
}
|
||||
|
||||
int
|
||||
sslshim_DSA_SIG_set0(
|
||||
DSA_SIG * psig,
|
||||
BIGNUM * r,
|
||||
BIGNUM * s
|
||||
)
|
||||
{
|
||||
REQUIRE(psig != NULL);
|
||||
if (!(r && s))
|
||||
return 0;
|
||||
|
||||
replace_bn_nn(&psig->r, r);
|
||||
replace_bn_nn(&psig->s, s);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* get/set DSA parameters
|
||||
*/
|
||||
void
|
||||
sslshim_DSA_get0_pqg(
|
||||
const DSA * pdsa,
|
||||
const BIGNUM ** pp,
|
||||
const BIGNUM ** pq,
|
||||
const BIGNUM ** pg
|
||||
)
|
||||
{
|
||||
REQUIRE(pdsa != NULL);
|
||||
|
||||
if (pp != NULL)
|
||||
*pp = pdsa->p;
|
||||
if (pq != NULL)
|
||||
*pq = pdsa->q;
|
||||
if (pg != NULL)
|
||||
*pg = pdsa->g;
|
||||
}
|
||||
|
||||
int
|
||||
sslshim_DSA_set0_pqg(
|
||||
DSA * pdsa,
|
||||
BIGNUM * p,
|
||||
BIGNUM * q,
|
||||
BIGNUM * g
|
||||
)
|
||||
{
|
||||
if (!((pdsa->p || p) && (pdsa->q || q) && (pdsa->g || g)))
|
||||
return 0;
|
||||
|
||||
replace_bn_nn(&pdsa->p, p);
|
||||
replace_bn_nn(&pdsa->q, q);
|
||||
replace_bn_nn(&pdsa->g, g);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
sslshim_DSA_get0_key(
|
||||
const DSA * pdsa,
|
||||
const BIGNUM ** ppub_key,
|
||||
const BIGNUM ** ppriv_key
|
||||
)
|
||||
{
|
||||
REQUIRE(pdsa != NULL);
|
||||
|
||||
if (ppub_key != NULL)
|
||||
*ppub_key = pdsa->pub_key;
|
||||
if (ppriv_key != NULL)
|
||||
*ppriv_key = pdsa->priv_key;
|
||||
}
|
||||
|
||||
int
|
||||
sslshim_DSA_set0_key(
|
||||
DSA * pdsa,
|
||||
BIGNUM * pub_key,
|
||||
BIGNUM * priv_key
|
||||
)
|
||||
{
|
||||
REQUIRE(pdsa != NULL);
|
||||
if (!(pdsa->pub_key || pub_key))
|
||||
return 0;
|
||||
|
||||
replace_bn_nn(&pdsa->pub_key, pub_key);
|
||||
replace_bn_nn(&pdsa->priv_key, priv_key);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
sslshim_X509_get_signature_nid(
|
||||
const X509 *x
|
||||
)
|
||||
{
|
||||
return OBJ_obj2nid(x->sig_alg->algorithm);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
#else /* OPENSSL_VERSION_NUMBER >= v1.1.0 */
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
NONEMPTY_TRANSLATION_UNIT
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
#endif
|
||||
/* ----------------------------------------------------------------- */
|
||||
@@ -40,7 +40,7 @@ struct hostent *gethostbyname(char *name)
|
||||
{
|
||||
struct hostent *host1;
|
||||
h_errno = 0; /* we are always successful!!! */
|
||||
host1 = (struct hostent *) malloc (sizeof(struct hostent));
|
||||
host1 = (struct hostent *) emalloc (sizeof(struct hostent));
|
||||
host1->h_name = name;
|
||||
host1->h_addrtype = AF_INET;
|
||||
host1->h_aliases = name;
|
||||
@@ -54,7 +54,7 @@ struct hostent *gethostbyaddr(char *name, int size, int addr_type)
|
||||
{
|
||||
struct hostent *host1;
|
||||
h_errno = 0; /* we are always successful!!! */
|
||||
host1 = (struct hostent *) malloc (sizeof(struct hostent));
|
||||
host1 = (struct hostent *) emalloc (sizeof(struct hostent));
|
||||
host1->h_name = name;
|
||||
host1->h_addrtype = AF_INET;
|
||||
host1->h_aliases = name;
|
||||
@@ -66,7 +66,7 @@ struct hostent *gethostbyaddr(char *name, int size, int addr_type)
|
||||
struct servent *getservbyname (char *name, char *type)
|
||||
{
|
||||
struct servent *serv1;
|
||||
serv1 = (struct servent *) malloc (sizeof(struct servent));
|
||||
serv1 = (struct servent *) emalloc (sizeof(struct servent));
|
||||
serv1->s_name = "ntp"; /* official service name */
|
||||
serv1->s_aliases = NULL; /* alias list */
|
||||
serv1->s_port = 123; /* port # */
|
||||
|
||||
Loaded 100 of 794 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user