+* [Bug 1776] sntp mishandles -t/--timeout and -a/--authentication.
+* Default to silent make rules, override with make V=1 or ./configure
+ --disable-silent-rules.
+* Correct --with-openssl-incdir defaulting with pkg-config.
+* Correct ./build on systems without gtest available.
(4.2.7p112) 2011/01/06 Released by Harlan Stenn <stenn@ntp.org>
* [Bug 1773] openssl not detected during ./configure.
* [Bug 1774] Segfaults if cryptostats enabled and built without OpenSSL.
"$NICEB" -7 $CONFIGURE
"$NICEB" -5 ./config.status &&
( cd sntp && "$NICEB" -5 ./config.status ) &&
- "$NICEB" -14 ${MAKE-make} V=0 &&
- ( cd sntp/tests &&
- "$NICEB" -14 ${MAKE-make} V=0 tests ) &&
- ( cd tests/libntp &&
- "$NICEB" -14 ${MAKE-make} V=0 tests ) &&
+ "$NICEB" -14 ${MAKE-make} &&
"$NICEB" -11 ${MAKE-make} check
) > $LOGF 2>&1
NTP_CACHEVERSION([main], [$ntp_configure_cache_version])
AM_INIT_AUTOMAKE
-dnl AM_SILENT_RULES req. automake 1.11
+dnl AM_SILENT_RULES req. automake 1.11. [yes] defaults V=0
m4_ifdef(
[AM_SILENT_RULES],
- [AM_SILENT_RULES]
+ [AM_SILENT_RULES([yes])]
)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
;;
esac
-AC_ARG_WITH(
- [rpath],
- [AS_HELP_STRING(
- [--without-rpath],
- [s Disable auto-added -R linker paths]
- )],
- [ans=$withval],
- [ans=x]
-)
-case "$ans" in
- no)
- need_dash_r=
- ;;
- yes)
- need_dash_r=1
- ;;
-esac
-# HMS: Why isn't this $build?
-# Well, that depends on if we need this for the build toolchain or
-# for info in the host executable...
-# I still have no idea which way this should go, but nobody has complained.
-case "$host" in
- *-*-netbsd*)
- case "$need_dash_r" in
- no) ;;
- *) need_dash_r=1
- ;;
- esac
- ;;
- *-*-solaris*)
- case "$need_dash_r" in
- no) ;;
- *) need_dash_r=1
- ;;
- esac
- ;;
-esac
-
dnl we need to check for cross compile tools for vxWorks here
AC_PROG_AWK
AC_PROG_MAKE_SET
# include "isc/md5.h"
typedef isc_md5_t MD5_CTX;
# define MD5Init(c) isc_md5_init(c)
-# define MD5Update(c, p, s) isc_md5_update(c, p, s)
+# define MD5Update(c, p, s) isc_md5_update(c, (const void *)(p), s)
# define MD5Final(d, c) isc_md5_final((c), (d)) /* swapped */
# endif
size_t *pdigest_len
)
{
- const u_long max_digest_len = MAX_MAC_LEN - sizeof(keyid_t);
int key_type;
u_int digest_len;
#ifdef OPENSSL
+ const u_long max_digest_len = MAX_MAC_LEN - sizeof(keyid_t);
u_char digest[EVP_MAX_MD_SIZE];
char * upcased;
char * pch;
NULL=
AUTOMAKE_OPTIONS =
-BUILT_SOURCES = stale_itc_gone
+BUILT_SOURCES =
noinst_LIBRARIES = @MAKE_LIBPARSE@ @MAKE_LIBPARSE_KERNEL@
EXTRA_LIBRARIES = libparse.a libparse_kernel.a
EXTRA_PROGRAMS = parsestreams parsesolaris
noinst_PROGRAMS = @MAKE_PARSEKMODULE@
-CLEANFILES = stale_itc_gone
+CLEANFILES =
K_CFLAGS = -DPARSESTREAM -DNTP_NEED_BOPS
# info_trimble.c was mistakenly created in the build directory
# previously. It is located in $(srcdir) and any updates must
# end up there.
-# As a transitional measure, a new target stale_itc_gone has been added
-# which removes the stale $(builddir)/info_trimble.c which will be in
-# the build directory of those tracking the source changes over time
-# while re-using the existing build directory which is not the source
-# directory. To ensure that rule fires in each of the commonly several
-# build trees sharing a single source tree, stale_itc_gone has been
-# added temporarily to BUILT_SOURCES. After a month or so, this
-# comment block can be removed, and stale_itc_gone with it. It should
-# come out of CLEANFILES (which still needs to be explicitly set, don't
-# simply remove the line) and BUILT_SOURCES at the same time the rule
-# is removed.
libparse_a_SOURCES = parse.c \
parse_conf.c \
EXTRA_DIST = parsesolaris.c parsestreams.c mkinfo_scmd.sed mkinfo_rcmd.sed info_trimble.c
-stale_itc_gone:
- -[ "$(srcdir)" != "." ] && rm -f info_trimble.c # rid ourselves of leftover from old way
- @echo "at most one info_trimble.c in source and build dirs" > $@
-
$(srcdir)/info_trimble.c: $(top_srcdir)/include/trimble.h $(srcdir)/Makefile.am $(srcdir)/mkinfo_scmd.sed $(srcdir)/mkinfo_rcmd.sed
sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.new
sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.new
dnl ######################################################################
dnl OpenSSL support shared by top-level and sntp/configure.ac
AC_DEFUN([NTP_OPENSSL], [
-
+
+AC_ARG_WITH(
+ [rpath],
+ [AS_HELP_STRING(
+ [--without-rpath],
+ [s Disable auto-added -R linker paths]
+ )],
+ [ans=$withval],
+ [ans=x]
+)
+case "$ans" in
+ no)
+ need_dash_r=
+ ;;
+ yes)
+ need_dash_r=1
+ ;;
+esac
+# HMS: Why isn't this $build?
+# Well, that depends on if we need this for the build toolchain or
+# for info in the host executable...
+# I still have no idea which way this should go, but nobody has complained.
+case "$host" in
+ *-*-netbsd*)
+ case "$need_dash_r" in
+ no) ;;
+ *) need_dash_r=1
+ ;;
+ esac
+ ;;
+ *-*-solaris*)
+ case "$need_dash_r" in
+ no) ;;
+ *) need_dash_r=1
+ ;;
+ esac
+ ;;
+esac
+
AC_SUBST([OPENSSL])
AC_SUBST([OPENSSL_INC])
AC_SUBST([OPENSSL_LIB])
'')
;;
*)
- pkgans="`$PKG_CONFIG --libs-only-L openssl | sed -e 's/^-L//'`" 2>/dev/null
- test -f "${pkgans}/pkgconfig/openssl.pc" && ans="$pkgans"
+ pkgans=`$PKG_CONFIG --libs-only-L openssl | sed -e 's/^-L//' 2>/dev/null`
+ # strip trailing whitespace
+ pkgans=`set $pkgans ; echo $[1]`
+ if test -f "${pkgans}/pkgconfig/openssl.pc" ; then
+ ans="$pkgans"
+ fi
;;
esac
;;
done
case "$i" in
no)
+ echo ""
+ echo "did not find libcrypto and libssl in any of $ans"
ans=no
OPENSSL_LIB=
;;
'')
;;
*)
- pkgans="`$PKG_CONFIG --cflags-only-I openssl | sed -e 's/^-I//'`" 2>/dev/null
- test -f "${pkgans}/pkgconfig/openssl.pc" && ans="$pkgans"
+ pkgans=`$PKG_CONFIG --cflags-only-I openssl | sed -e 's/^-I//' 2>/dev/null`
+ # strip trailing whitespace
+ pkgans=`set $pkgans ; echo $[1]`
+ if test -f "${pkgans}/openssl/evp.h" ; then
+ ans="$pkgans"
+ fi
;;
esac
;;
case "$ans" in
no)
;;
- *) # look for openssl/opensslconf.h:
+ *) # look for openssl/evp.h:
for i in $ans no
do
- test -f $i/openssl/opensslconf.h && break
+ test -f $i/openssl/evp.h && break
done
case "$i" in
no)
+ echo ""
+ echo "did not find openssl/evp.h in any of $ans"
ans=no
OPENSSL_INC=
;;
esac
;;
esac
+AS_UNSET([pkgans])
AC_MSG_RESULT([$ans])
AC_MSG_CHECKING([if we will use crypto])
*/
static void
send_random_tag_value(
- int index
+ int indx
)
{
u_long noise;
buf[2] = 'a' + noise % 26;
noise >>= 5;
buf[3] = '.';
- snprintf(&buf[4], sizeof(buf) - 4, "%d", index);
+ snprintf(&buf[4], sizeof(buf) - 4, "%d", indx);
ctl_putuint(buf, noise);
}
sockaddr_u addr_dist;
sockaddr_u min_dist;
+ ZERO_SOCK(&min_dist);
winner = NULL;
for (ep = ep_list; ep != NULL; ep = ep->elink) {
u_int flags,
u_char ttl,
keyid_t key,
- const char * group
+ const char * ident /* autokey group */
)
{
u_char cast_flags;
if ((MDF_ACAST | MDF_POOL) & cast_flags)
flags &= ~FLAG_PREEMPT;
return newpeer(srcadr, hostname, dstadr, hmode, version,
- minpoll, maxpoll, flags, cast_flags, ttl, key, group);
+ minpoll, maxpoll, flags, cast_flags, ttl, key, ident);
}
/*
u_char cast_flags,
u_char ttl,
keyid_t key,
- const char * group
+ const char *ident
)
{
struct peer *peer;
#endif /* AUTOKEY */
peer->ttl = (u_char)ttl;
peer->keyid = key;
- if (NULL != group)
- peer->ident = estrdup(group);
+ if (ident != NULL)
+ peer->ident = estrdup(ident);
peer->precision = sys_precision;
peer->hpoll = peer->minpoll;
if (cast_flags & MDF_ACAST)
if (debug)
printf(
"refclock_sample: n %d offset %.6f disp %.6f jitter %.6f\n",
- n, pp->offset, pp->disp, pp->jitter);
+ (int)n, pp->offset, pp->disp, pp->jitter);
#endif
return (int)n;
}
char tbuf[BMAX];
int dtr = TIOCM_DTR;
- DPRINTF(1, ("acts: %d %s\n", strlen(msg), msg));
+ DPRINTF(1, ("acts: %d %s\n", (int)strlen(msg), msg));
/*
* What to do depends on the state and the first token in the
register int n;
register struct recvbuf *rb;
struct sock_timeval tvzero;
- int fromlen;
+ GETSOCKNAME_SOCKLEN_TYPE fromlen;
l_fp ts;
int i;
#ifdef HAVE_POLL_H
for (row = 0; row < rows; row++) {
for (word = row; word < words; word += rows)
- fprintf(fp, "%-*.*s", col, col-1, list[word]);
+ fprintf(fp, "%-*.*s", (int)col,
+ (int)col - 1, list[word]);
fprintf(fp, "\n");
}
} else {
else
c = flash2[CTL_PEER_STATVAL(rstatus) & 0x3];
if (numhosts > 1)
- fprintf(fp, "%-*s ", maxhostlen, currenthost);
+ fprintf(fp, "%-*s ", (int)maxhostlen, currenthost);
if (AF_UNSPEC == af || AF(&srcadr) == af) {
if (!have_srchost)
strncpy(clock_name, nntohost(&srcadr),
maxhostlen = strlen(fullname);
}
if (numhosts > 1)
- fprintf(fp, "%-*.*s ", maxhostlen, maxhostlen, "server");
+ fprintf(fp, "%-*.*s ", (int)maxhostlen, (int)maxhostlen,
+ "server");
fprintf(fp,
" remote refid st t when poll reach delay offset jitter\n");
if (numhosts > 1)
for (i = 0; i < numhosts; ++i) {
if (getnetnum(chosts[i], &netnum, fullname, af))
- if ((int)strlen(fullname) > maxhostlen)
+ if (strlen(fullname) > maxhostlen)
maxhostlen = strlen(fullname);
}
if (numhosts > 1)
- (void) fprintf(fp, "%-*.*s ", maxhostlen, maxhostlen, "server");
- (void) fprintf(fp,
- " remote local st t when poll reach delay offset disp\n");
+ fprintf(fp, "%-*.*s ", (int)maxhostlen, (int)maxhostlen,
+ "server");
+ fprintf(fp,
+ " remote local st t when poll reach delay offset disp\n");
if (numhosts > 1)
for (i = 0; i <= maxhostlen; ++i)
- (void) fprintf(fp, "=");
- (void) fprintf(fp,
- "==============================================================================\n");
+ fprintf(fp, "=");
+ fprintf(fp,
+ "==============================================================================\n");
for (i = 0; i < numassoc; i++) {
if (!showall &&
- !(CTL_PEER_STATVAL(assoc_cache[i].status)
- & (CTL_PST_CONFIG|CTL_PST_REACH)))
+ !(CTL_PEER_STATVAL(assoc_cache[i].status) &
+ (CTL_PST_CONFIG | CTL_PST_REACH)))
continue;
- if (!dogetpeers(opeervarlist, (int)assoc_cache[i].assid, fp, af)) {
+ if (!dogetpeers(opeervarlist, assoc_cache[i].assid, fp, af))
return;
- }
}
return;
}
if (ppentry - sorted != (int)mru_count) {
fprintf(stderr,
- "mru_count %u should match MRU list depth %d.\n",
- mru_count, ppentry - sorted);
+ "mru_count %u should match MRU list depth %ld.\n",
+ mru_count, (long)(ppentry - sorted));
free(sorted);
goto cleanup_return;
}
for (f = 0; f < numfrags; f++)
fprintf(stderr,
"%2u: %5d %5d\t%3d octets\n",
- f, offsets[f],
+ (u_int)f, offsets[f],
offsets[f] +
counts[f],
counts[f]);
* boundary and no smaller than claimed by rpkt.count
*/
if (n & 0x3) {
- if (debug)
- printf("Response packet not padded, "
- "size = %d\n", n);
+ DPRINTF(1, ("Response packet not padded, size = %d\n",
+ n));
continue;
}
shouldbesize = (CTL_HEADER_LEN + count + 3) & ~3;
if (n < shouldbesize) {
- printf("Response packet claims %u octets "
- "payload, above %d received\n",
- count,
- n - CTL_HEADER_LEN
- );
+ printf("Response packet claims %u octets payload, above %ld received\n",
+ count, (long)(n - CTL_HEADER_LEN));
return ERR_INCOMPLETE;
}
printf("Got packet, size = %d\n", n);
if ((int)count > (n - CTL_HEADER_LEN)) {
if (debug)
- printf("Received count of %d octets, "
- "data in packet is %d\n",
- count, n-CTL_HEADER_LEN);
+ printf("Received count of %d octets, data in packet is %ld\n",
+ count,
+ (long)(n - CTL_HEADER_LEN));
continue;
}
if (count == 0 && CTL_ISMORE(rpkt.r_m_e_op)) {
*rsize = offsets[f-1] + counts[f-1];
if (debug)
fprintf(stderr,
- "%u packets reassembled into response\n",
- numfrags);
+ "%lu packets reassembled into response\n",
+ (u_long)numfrags);
return 0;
}
}
for (row = 0; row < rows; row++) {
for (word = row; word < words; word += rows)
- fprintf(fp, "%-*.*s", col, col-1,
- list[word]);
+ fprintf(fp, "%-*.*s", (int)col,
+ (int)col - 1, list[word]);
fprintf(fp, "\n");
}
} else {
NTP_CACHEVERSION([sntp], [$sntp_configure_cache_version])
AM_INIT_AUTOMAKE
-dnl AM_SILENT_RULES req. automake 1.11
+dnl AM_SILENT_RULES req. automake 1.11. [yes] defaults V=0
m4_ifdef(
[AM_SILENT_RULES],
- [AM_SILENT_RULES]
+ [AM_SILENT_RULES([yes])]
)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
/* Considering employing a variable that prevents functions of doing anything until
* everything is initialized properly
*/
- resc = resolve_hosts((const char **)argv, argc, &resh, ai_fam_pref);
+ resc = resolve_hosts((const char * const *)argv, argc, &resh,
+ ai_fam_pref);
if (resc < 1) {
printf("Unable to resolve hostname(s)\n");
return -1;
myargv[0] = OPT_ARG(BROADCAST);
myargv[1] = NULL;
- bcast = resolve_hosts(myargv, 1, &bcastaddr, ai_fam_pref);
+ bcast = resolve_hosts(myargv, 1, &bcastaddr,
+ ai_fam_pref);
}
/* Select a certain ntp server according to simple criteria? For now
char addr_buf[INET6_ADDRSTRLEN];
char *p_SNTP_PRETEND_TIME;
time_t pretend_time;
+#if SIZEOF_TIME_T == 8
+ longlong ll;
+#else
+ long l;
+#endif
if(rpktl > 0)
sw_case = 1;
p_SNTP_PRETEND_TIME = getenv("SNTP_PRETEND_TIME");
if (p_SNTP_PRETEND_TIME) {
+ pretend_time = 0;
#if SIZEOF_TIME_T == 4
- sscanf(p_SNTP_PRETEND_TIME, "%ld", &pretend_time);
+ if (1 == sscanf(p_SNTP_PRETEND_TIME, "%ld", &l))
+ pretend_time = (time_t)l;
#elif SIZEOF_TIME_T == 8
- sscanf(p_SNTP_PRETEND_TIME, "%lld", &pretend_time);
+ if (1 == sscanf(p_SNTP_PRETEND_TIME, "%lld", &ll))
+ pretend_time = (time_t)ll;
#else
# include "GRONK: unexpected value for SIZEOF_TIME_T"
#endif
- tv_dst.tv_sec = pretend_time;
+ if (0 != pretend_time)
+ tv_dst.tv_sec = pretend_time;
}
offset_calculation(rpkt, rpktl, &tv_dst, &offset,
register int try;
SOCKET sock;
struct key *pkt_key = NULL;
+ long l;
int key_id = 0;
struct timeval tv_xmt;
struct pkt x_pkt;
int error, rpktl, handle_pkt_res;
- if (ENABLED_OPT(AUTHENTICATION)) {
- key_id = (int) OPT_ARG(AUTHENTICATION);
+ if (ENABLED_OPT(AUTHENTICATION) &&
+ atoint(OPT_ARG(AUTHENTICATION), &l)) {
+ key_id = l;
get_key(key_id, &pkt_key);
}
- for (try=0; try<5; try++) {
+ for (try = 0; try < 5; try++) {
memset(&r_pkt, 0, sizeof rbuf);
- error = GETTIMEOFDAY(&tv_xmt, (struct timezone *)NULL);
+ error = GETTIMEOFDAY(&tv_xmt, NULL);
tv_xmt.tv_sec += JAN_1970;
#ifdef DEBUG
*/
int
resolve_hosts (
- const char **hosts,
- int hostc,
- struct addrinfo ***res,
- int pref_family
+ const char * const * hosts,
+ int hostc,
+ struct addrinfo *** res,
+ int pref_family
)
{
register unsigned int a;
int recv_bytes = 0;
int rdy_socks;
GETSOCKNAME_SOCKLEN_TYPE ss_len;
+ long l;
struct timeval timeout_tv;
fd_set bcst_fd;
#ifdef MCAST
#endif /* ISC_PLATFORM_HAVEIPV6 */
FD_ZERO(&bcst_fd);
FD_SET(rsock, &bcst_fd);
- if (ENABLED_OPT(TIMEOUT))
- timeout_tv.tv_sec = (int) OPT_ARG(TIMEOUT);
+ if (ENABLED_OPT(TIMEOUT) && atoint(OPT_ARG(TIMEOUT), &l))
+ timeout_tv.tv_sec = l;
else
timeout_tv.tv_sec = 68; /* ntpd broadcasts every 64s */
timeout_tv.tv_usec = 0;
int rdy_socks;
int pkt_len;
sockaddr_u sender;
+ long l;
struct timeval timeout_tv;
fd_set recv_fd;
FD_ZERO(&recv_fd);
FD_SET(rsock, &recv_fd);
- if (ENABLED_OPT(TIMEOUT))
- timeout_tv.tv_sec = (int) OPT_ARG(TIMEOUT);
+ if (ENABLED_OPT(TIMEOUT) && atoint(OPT_ARG(TIMEOUT), &l))
+ timeout_tv.tv_sec = l;
else
timeout_tv.tv_sec = 68; /* ntpd broadcasts every 64s */
timeout_tv.tv_usec = 0;
/* From ntpdate.c */
int is_reachable (struct addrinfo *dst);
-int resolve_hosts (const char **hosts, int hostc, struct addrinfo ***res, int pref_family);
+int resolve_hosts (const char * const *hosts, int hostc,
+ struct addrinfo ***res, int pref_family);
void create_socket (SOCKET *rsock, sockaddr_u *dest);
char *grpkey = NULL; /* identity extension */
int nid; /* X509 digest/signature scheme */
FILE *fstr = NULL; /* file handle */
+ char groupbuf[MAXHOSTNAME + 1];
#define iffsw HAVE_OPT(ID_KEY)
#endif /* AUTOKEY */
char hostbuf[MAXHOSTNAME + 1];
- char groupbuf[MAXHOSTNAME + 1];
progname = argv[0];