diff options
author | delphij <delphij@FreeBSD.org> | 2016-01-08 15:53:48 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2016-01-08 15:53:48 +0000 |
commit | 31ece5769d393d00720a55b05dd7b3e85c2fcc52 (patch) | |
tree | eb428181ad7f992dbbff39c2be903eaab7149cfb /contrib/ntp/sntp | |
parent | 72bd55ca76570ee190062912e8f0350831baca6f (diff) | |
parent | 8518518f8f222e4d58e27928a988f034b82bbb77 (diff) | |
download | FreeBSD-src-31ece5769d393d00720a55b05dd7b3e85c2fcc52.zip FreeBSD-src-31ece5769d393d00720a55b05dd7b3e85c2fcc52.tar.gz |
MFV r293415:
ntp 4.2.8p5
Reviewed by: cy, roberto
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D4828
Diffstat (limited to 'contrib/ntp/sntp')
24 files changed, 135 insertions, 82 deletions
diff --git a/contrib/ntp/sntp/configure b/contrib/ntp/sntp/configure index 74d0587..ce397ef 100755 --- a/contrib/ntp/sntp/configure +++ b/contrib/ntp/sntp/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sntp 4.2.8p4. +# Generated by GNU Autoconf 2.69 for sntp 4.2.8p5. # # Report bugs to <http://bugs.ntp.org./>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sntp' PACKAGE_TARNAME='sntp' -PACKAGE_VERSION='4.2.8p4' -PACKAGE_STRING='sntp 4.2.8p4' +PACKAGE_VERSION='4.2.8p5' +PACKAGE_STRING='sntp 4.2.8p5' PACKAGE_BUGREPORT='http://bugs.ntp.org./' PACKAGE_URL='http://www.ntp.org./' @@ -1491,7 +1491,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 sntp 4.2.8p4 to adapt to many kinds of systems. +\`configure' configures sntp 4.2.8p5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1561,7 +1561,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sntp 4.2.8p4:";; + short | recursive ) echo "Configuration of sntp 4.2.8p5:";; esac cat <<\_ACEOF @@ -1706,7 +1706,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sntp configure 4.2.8p4 +sntp configure 4.2.8p5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2536,7 +2536,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 sntp $as_me 4.2.8p4, which was +It was created by sntp $as_me 4.2.8p5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3533,7 +3533,7 @@ fi # Define the identity of the package. PACKAGE='sntp' - VERSION='4.2.8p4' + VERSION='4.2.8p5' cat >>confdefs.h <<_ACEOF @@ -25155,9 +25155,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" ;; @@ -31109,7 +31110,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 sntp $as_me 4.2.8p4, which was +This file was extended by sntp $as_me 4.2.8p5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -31176,7 +31177,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="\\ -sntp config.status 4.2.8p4 +sntp config.status 4.2.8p5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/contrib/ntp/sntp/include/version.def b/contrib/ntp/sntp/include/version.def index 9f1ca6b..ddc02d4 100644 --- a/contrib/ntp/sntp/include/version.def +++ b/contrib/ntp/sntp/include/version.def @@ -1 +1 @@ -version = '4.2.8p4'; +version = '4.2.8p5'; diff --git a/contrib/ntp/sntp/include/version.texi b/contrib/ntp/sntp/include/version.texi index 64f037b..28b9357 100644 --- a/contrib/ntp/sntp/include/version.texi +++ b/contrib/ntp/sntp/include/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 21 October 2015 -@set EDITION 4.2.8p4 -@set VERSION 4.2.8p4 +@set UPDATED 07 January 2016 +@set EDITION 4.2.8p5 +@set VERSION 4.2.8p5 diff --git a/contrib/ntp/sntp/invoke-sntp.texi b/contrib/ntp/sntp/invoke-sntp.texi index 9a726fa..6ca3b06 100644 --- a/contrib/ntp/sntp/invoke-sntp.texi +++ b/contrib/ntp/sntp/invoke-sntp.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (invoke-sntp.texi) # -# It has been AutoGen-ed October 21, 2015 at 12:30:56 PM by AutoGen 5.18.5 +# It has been AutoGen-ed January 7, 2016 at 11:23:24 PM by AutoGen 5.18.5 # From the definitions sntp-opts.def # and the template file agtexi-cmd.tpl @end ignore @@ -101,7 +101,7 @@ with a status code of 0. @exampleindent 0 @example -sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4 +sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p5 Usage: sntp [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \ [ hostname-or-IP ...] Flg Arg Option-Name Description diff --git a/contrib/ntp/sntp/m4/ntp_libevent.m4 b/contrib/ntp/sntp/m4/ntp_libevent.m4 index 895360e..a465d9b 100644 --- a/contrib/ntp/sntp/m4/ntp_libevent.m4 +++ b/contrib/ntp/sntp/m4/ntp_libevent.m4 @@ -89,9 +89,10 @@ case "$ntp_use_local_libevent" in # 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" ;; diff --git a/contrib/ntp/sntp/m4/ntp_problemtests.m4 b/contrib/ntp/sntp/m4/ntp_problemtests.m4 index 4596e85..7cc14c9 100644 --- a/contrib/ntp/sntp/m4/ntp_problemtests.m4 +++ b/contrib/ntp/sntp/m4/ntp_problemtests.m4 @@ -28,8 +28,9 @@ AC_MSG_RESULT([$ntp_ept]) AC_MSG_CHECKING([if we can run test-ntp_restrict]) ntp_test_ntp_restrict="no" case "$ntp_ept:$cross:$host" in + no:0:*-*-freebsd6.4) ;; + no:0:*-*-hpux11.23*) ;; no:0:*-*-solaris*) ;; - no:0:*-*-hpux-11.23*) ;; *) ntp_test_ntp_restrict="yes" ;; esac AC_MSG_RESULT([$ntp_test_ntp_restrict]) @@ -38,6 +39,7 @@ AM_CONDITIONAL([BUILD_TEST_NTP_RESTRICT], [test x$ntp_test_ntp_restrict = xyes]) AC_MSG_CHECKING([if we can run test-ntp_scanner]) ntp_test_ntp_scanner="no" case "$ntp_ept:$cross:$host" in + no:0:*-*-freebsd6.4) ;; no:0:*-*-solaris*) ;; *) ntp_test_ntp_scanner="yes" ;; esac @@ -47,6 +49,7 @@ AM_CONDITIONAL([BUILD_TEST_NTP_SCANNER], [test x$ntp_test_ntp_scanner = xyes]) AC_MSG_CHECKING([if we can run test-ntp_signd]) ntp_test_ntp_signd="no" case "$ntp_ept:$cross:$host" in + no:0:*-*-freebsd6.4) ;; no:0:*-*-solaris*) ;; *) ntp_test_ntp_signd="yes" ;; esac diff --git a/contrib/ntp/sntp/m4/version.m4 b/contrib/ntp/sntp/m4/version.m4 index 7d51426..b8f98b5 100644 --- a/contrib/ntp/sntp/m4/version.m4 +++ b/contrib/ntp/sntp/m4/version.m4 @@ -1 +1 @@ -m4_define([VERSION_NUMBER],[4.2.8p4]) +m4_define([VERSION_NUMBER],[4.2.8p5]) diff --git a/contrib/ntp/sntp/networking.c b/contrib/ntp/sntp/networking.c index ddd45ef..6a176c5 100644 --- a/contrib/ntp/sntp/networking.c +++ b/contrib/ntp/sntp/networking.c @@ -136,7 +136,7 @@ process_pkt ( return PACKET_UNUSEABLE; } /* Note: pkt_len must be a multiple of 4 at this point! */ - packet_end = (u_int32*)((char*)rpkt + pkt_len); + packet_end = (void*)((char*)rpkt + pkt_len); exten_end = skip_efields(rpkt->exten, packet_end); if (NULL == exten_end) { msyslog(LOG_ERR, diff --git a/contrib/ntp/sntp/sntp-opts.c b/contrib/ntp/sntp/sntp-opts.c index e46a80c..69fb786 100644 --- a/contrib/ntp/sntp/sntp-opts.c +++ b/contrib/ntp/sntp/sntp-opts.c @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (sntp-opts.c) * - * It has been AutoGen-ed October 21, 2015 at 12:30:23 PM by AutoGen 5.18.5 + * It has been AutoGen-ed January 7, 2016 at 11:22:49 PM by AutoGen 5.18.5 * From the definitions sntp-opts.def * and the template file options * @@ -70,7 +70,7 @@ extern FILE * option_usage_fp; * static const strings for sntp options */ static char const sntp_opt_strs[2549] = -/* 0 */ "sntp 4.2.8p4\n" +/* 0 */ "sntp 4.2.8p5\n" "Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n" "This is free software. It is licensed for use, modification and\n" "redistribution under the terms of the NTP License, copies of which\n" @@ -155,7 +155,7 @@ static char const sntp_opt_strs[2549] = /* 2298 */ "LOAD_OPTS\0" /* 2308 */ "no-load-opts\0" /* 2321 */ "SNTP\0" -/* 2326 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4\n" +/* 2326 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p5\n" "Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n" "\t\t[ hostname-or-IP ...]\n\0" /* 2485 */ "$HOME\0" @@ -163,7 +163,7 @@ static char const sntp_opt_strs[2549] = /* 2493 */ ".ntprc\0" /* 2500 */ "http://bugs.ntp.org, bugs@ntp.org\0" /* 2534 */ "\n\0" -/* 2536 */ "sntp 4.2.8p4"; +/* 2536 */ "sntp 4.2.8p5"; /** * ipv4 option description with @@ -1173,7 +1173,7 @@ static void bogus_function(void) { translate option names. */ /* referenced via sntpOptions.pzCopyright */ - puts(_("sntp 4.2.8p4\n\ + puts(_("sntp 4.2.8p5\n\ Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n\ This is free software. It is licensed for use, modification and\n\ redistribution under the terms of the NTP License, copies of which\n\ @@ -1263,7 +1263,7 @@ implied warranty.\n")); puts(_("load options from a config file")); /* referenced via sntpOptions.pzUsageTitle */ - puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4\n\ + puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p5\n\ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\ \t\t[ hostname-or-IP ...]\n")); @@ -1271,7 +1271,7 @@ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\ puts(_("\n")); /* referenced via sntpOptions.pzFullVersion */ - puts(_("sntp 4.2.8p4")); + puts(_("sntp 4.2.8p5")); /* referenced via sntpOptions.pzFullUsage */ puts(_("<<<NOT-FOUND>>>")); diff --git a/contrib/ntp/sntp/sntp-opts.h b/contrib/ntp/sntp/sntp-opts.h index 895421e..78951ab 100644 --- a/contrib/ntp/sntp/sntp-opts.h +++ b/contrib/ntp/sntp/sntp-opts.h @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (sntp-opts.h) * - * It has been AutoGen-ed October 21, 2015 at 12:30:22 PM by AutoGen 5.18.5 + * It has been AutoGen-ed January 7, 2016 at 11:22:48 PM by AutoGen 5.18.5 * From the definitions sntp-opts.def * and the template file options * @@ -91,9 +91,9 @@ typedef enum { /** count of all options for sntp */ #define OPTION_CT 23 /** sntp version */ -#define SNTP_VERSION "4.2.8p4" +#define SNTP_VERSION "4.2.8p5" /** Full sntp version text */ -#define SNTP_FULL_VERSION "sntp 4.2.8p4" +#define SNTP_FULL_VERSION "sntp 4.2.8p5" /** * Interface defines for all options. Replace "n" with the UPPER_CASED diff --git a/contrib/ntp/sntp/sntp.1sntpman b/contrib/ntp/sntp/sntp.1sntpman index 89facc6..792fc52 100644 --- a/contrib/ntp/sntp/sntp.1sntpman +++ b/contrib/ntp/sntp/sntp.1sntpman @@ -10,11 +10,11 @@ .ds B-Font B .ds I-Font I .ds R-Font R -.TH sntp 1sntpman "21 Oct 2015" "4.2.8p4" "User Commands" +.TH sntp 1sntpman "07 Jan 2016" "4.2.8p5" "User Commands" .\" -.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-hEaqbg/ag-UEaiag) +.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-e.aO3S/ag-r.aG2S) .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:30:52 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:23:20 PM by AutoGen 5.18.5 .\" From the definitions sntp-opts.def .\" and the template file agman-cmd.tpl .SH NAME diff --git a/contrib/ntp/sntp/sntp.1sntpmdoc b/contrib/ntp/sntp/sntp.1sntpmdoc index b1b3940..8005e9a 100644 --- a/contrib/ntp/sntp/sntp.1sntpmdoc +++ b/contrib/ntp/sntp/sntp.1sntpmdoc @@ -1,9 +1,9 @@ -.Dd October 21 2015 +.Dd January 7 2016 .Dt SNTP 1sntpmdoc User Commands .Os .\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc) .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:30:59 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:23:27 PM by AutoGen 5.18.5 .\" From the definitions sntp-opts.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/contrib/ntp/sntp/sntp.html b/contrib/ntp/sntp/sntp.html index 5ea532e..6aa66fb 100644 --- a/contrib/ntp/sntp/sntp.html +++ b/contrib/ntp/sntp/sntp.html @@ -36,7 +36,7 @@ display the time offset of the system clock relative to the server clock. Run as root, it can correct the system clock to this offset as well. It can be run as an interactive command or from a cron job. - <p>This document applies to version 4.2.8p4 of <code>sntp</code>. + <p>This document applies to version 4.2.8p5 of <code>sntp</code>. <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4 IETF specification. @@ -176,7 +176,7 @@ the usage text by passing it through a pager program. used to select the program, defaulting to <span class="file">more</span>. Both will exit with a status code of 0. -<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4 +<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p5 Usage: sntp [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \ [ hostname-or-IP ...] Flg Arg Option-Name Description diff --git a/contrib/ntp/sntp/sntp.man.in b/contrib/ntp/sntp/sntp.man.in index 84afa7e..1d5e571 100644 --- a/contrib/ntp/sntp/sntp.man.in +++ b/contrib/ntp/sntp/sntp.man.in @@ -10,11 +10,11 @@ .ds B-Font B .ds I-Font I .ds R-Font R -.TH sntp @SNTP_MS@ "21 Oct 2015" "4.2.8p4" "User Commands" +.TH sntp @SNTP_MS@ "07 Jan 2016" "4.2.8p5" "User Commands" .\" -.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-hEaqbg/ag-UEaiag) +.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-e.aO3S/ag-r.aG2S) .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:30:52 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:23:20 PM by AutoGen 5.18.5 .\" From the definitions sntp-opts.def .\" and the template file agman-cmd.tpl .SH NAME diff --git a/contrib/ntp/sntp/sntp.mdoc.in b/contrib/ntp/sntp/sntp.mdoc.in index 0313e5e..5168a99 100644 --- a/contrib/ntp/sntp/sntp.mdoc.in +++ b/contrib/ntp/sntp/sntp.mdoc.in @@ -1,9 +1,9 @@ -.Dd October 21 2015 +.Dd January 7 2016 .Dt SNTP @SNTP_MS@ User Commands .Os .\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc) .\" -.\" It has been AutoGen-ed October 21, 2015 at 12:30:59 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed January 7, 2016 at 11:23:27 PM by AutoGen 5.18.5 .\" From the definitions sntp-opts.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/contrib/ntp/sntp/tests/keyFile.c b/contrib/ntp/sntp/tests/keyFile.c index 77dfee7..883658a 100644 --- a/contrib/ntp/sntp/tests/keyFile.c +++ b/contrib/ntp/sntp/tests/keyFile.c @@ -62,20 +62,27 @@ CompareKeysAlternative(int key_id, void test_ReadEmptyKeyFile(void) { struct key* keys = NULL; + const char *path = CreatePath("key-test-empty", INPUT_DIR); - TEST_ASSERT_EQUAL(0, auth_init(CreatePath("key-test-empty", INPUT_DIR), &keys)); + TEST_ASSERT_NOT_NULL(path); + TEST_ASSERT_EQUAL(0, auth_init(path, &keys)); TEST_ASSERT_NULL(keys); + + free((void *)path); } void test_ReadASCIIKeys(void) { struct key* keys = NULL; + const char *path = CreatePath("key-test-ascii", INPUT_DIR); - TEST_ASSERT_EQUAL(2, auth_init(CreatePath("key-test-ascii", INPUT_DIR), &keys)); - + TEST_ASSERT_NOT_NULL(path); + TEST_ASSERT_EQUAL(2, auth_init(path, &keys)); TEST_ASSERT_NOT_NULL(keys); + free((void *)path); + struct key* result = NULL; get_key(40, &result); TEST_ASSERT_NOT_NULL(result); @@ -91,10 +98,12 @@ test_ReadASCIIKeys(void) { void test_ReadHexKeys(void) { struct key* keys = NULL; + const char *path = CreatePath("key-test-hex", INPUT_DIR); - TEST_ASSERT_EQUAL(3, auth_init(CreatePath("key-test-hex", INPUT_DIR), &keys)); - + TEST_ASSERT_NOT_NULL(path); + TEST_ASSERT_EQUAL(3, auth_init(path, &keys)); TEST_ASSERT_NOT_NULL(keys); + free((void *)path); struct key* result = NULL; get_key(10, &result); @@ -119,10 +128,12 @@ test_ReadHexKeys(void) { void test_ReadKeyFileWithComments(void) { struct key* keys = NULL; + const char *path = CreatePath("key-test-comments", INPUT_DIR); - TEST_ASSERT_EQUAL(2, auth_init(CreatePath("key-test-comments", INPUT_DIR), &keys)); - + TEST_ASSERT_NOT_NULL(path); + TEST_ASSERT_EQUAL(2, auth_init(path, &keys)); TEST_ASSERT_NOT_NULL(keys); + free((void *)path); struct key* result = NULL; get_key(10, &result); @@ -140,10 +151,12 @@ test_ReadKeyFileWithComments(void) { void test_ReadKeyFileWithInvalidHex(void) { struct key* keys = NULL; + const char *path = CreatePath("key-test-invalid-hex", INPUT_DIR); - TEST_ASSERT_EQUAL(1, auth_init(CreatePath("key-test-invalid-hex", INPUT_DIR), &keys)); - + TEST_ASSERT_NOT_NULL(path); + TEST_ASSERT_EQUAL(1, auth_init(path, &keys)); TEST_ASSERT_NOT_NULL(keys); + free((void *)path); struct key* result = NULL; get_key(10, &result); diff --git a/contrib/ntp/sntp/tests/kodDatabase.c b/contrib/ntp/sntp/tests/kodDatabase.c index 0c3615d..3c05694 100644 --- a/contrib/ntp/sntp/tests/kodDatabase.c +++ b/contrib/ntp/sntp/tests/kodDatabase.c @@ -1,5 +1,6 @@ #include "config.h" +#include "ntp_workimpl.h" #include "ntp_types.h" #include "sntptest.h" #include "ntp_stdlib.h" @@ -20,6 +21,7 @@ void test_DeleteEntry(void); void setUp(void) { kod_init_kod_db("/dev/null", TRUE); + init_lib(); } diff --git a/contrib/ntp/sntp/tests/kodFile.c b/contrib/ntp/sntp/tests/kodFile.c index 6eb0971..f99d8cf 100644 --- a/contrib/ntp/sntp/tests/kodFile.c +++ b/contrib/ntp/sntp/tests/kodFile.c @@ -28,6 +28,7 @@ void setUp(void) { kod_db_cnt = 0; kod_db = NULL; + init_lib(); } diff --git a/contrib/ntp/sntp/tests/run-kodDatabase.c b/contrib/ntp/sntp/tests/run-kodDatabase.c index e5bf3d7..f655a6a 100644 --- a/contrib/ntp/sntp/tests/run-kodDatabase.c +++ b/contrib/ntp/sntp/tests/run-kodDatabase.c @@ -23,6 +23,7 @@ #include <setjmp.h> #include <stdio.h> #include "config.h" +#include "ntp_workimpl.h" #include "ntp_types.h" #include "sntptest.h" #include "ntp_stdlib.h" @@ -56,11 +57,11 @@ int main(int argc, char *argv[]) { progname = argv[0]; UnityBegin("kodDatabase.c"); - RUN_TEST(test_SingleEntryHandling, 13); - RUN_TEST(test_MultipleEntryHandling, 14); - RUN_TEST(test_NoMatchInSearch, 15); - RUN_TEST(test_AddDuplicate, 16); - RUN_TEST(test_DeleteEntry, 17); + RUN_TEST(test_SingleEntryHandling, 14); + RUN_TEST(test_MultipleEntryHandling, 15); + RUN_TEST(test_NoMatchInSearch, 16); + RUN_TEST(test_AddDuplicate, 17); + RUN_TEST(test_DeleteEntry, 18); return (UnityEnd()); } diff --git a/contrib/ntp/sntp/tests/run-t-log.c b/contrib/ntp/sntp/tests/run-t-log.c index dc9fa04..8d12345 100644 --- a/contrib/ntp/sntp/tests/run-t-log.c +++ b/contrib/ntp/sntp/tests/run-t-log.c @@ -49,9 +49,9 @@ int main(int argc, char *argv[]) { progname = argv[0]; UnityBegin("t-log.c"); - RUN_TEST(testChangePrognameInMysyslog, 9); - RUN_TEST(testOpenLogfileTest, 10); - RUN_TEST(testWriteInCustomLogfile, 35); + RUN_TEST(testChangePrognameInMysyslog, 10); + RUN_TEST(testOpenLogfileTest, 11); + RUN_TEST(testWriteInCustomLogfile, 12); return (UnityEnd()); } diff --git a/contrib/ntp/sntp/tests/t-log.c b/contrib/ntp/sntp/tests/t-log.c index 1546584..08d4b6c 100644 --- a/contrib/ntp/sntp/tests/t-log.c +++ b/contrib/ntp/sntp/tests/t-log.c @@ -6,63 +6,82 @@ //#include "log.h" #include "log.c" +void setUp(void); void testChangePrognameInMysyslog(void); void testOpenLogfileTest(void); +void testWriteInCustomLogfile(void); + + +void +setUp(void) { + init_lib(); +} //in var/log/syslog (may differ depending on your OS), logged name of the program will be "TEST_PROGNAME". -void testChangePrognameInMysyslog(void){ +void +testChangePrognameInMysyslog(void) +{ sntp_init_logging("TEST_PROGNAME"); - msyslog(LOG_ERR, "TESTING sntp_init_logging()"); //%m will print the last errno? + msyslog(LOG_ERR, "TESTING sntp_init_logging()"); + + return; } //writes log files in your own file instead of syslog! (MAY BE USEFUL TO SUPPRESS ERROR MESSAGES!) -void testOpenLogfileTest(void){ +void +testOpenLogfileTest(void) +{ sntp_init_logging("TEST_PROGNAME2"); //this name is consistent through the entire program unless changed - open_logfile("testLogfile.log"); + open_logfile("testLogfile.log"); //open_logfile("/var/log/syslog"); //this gives me "Permission Denied" when i do %m - + msyslog(LOG_ERR, "Cannot open log file %s","abcXX"); //cleanup_log(); //unnecessary after log.c fix! - + + return; } //multiple cleanup_log() causes segfault. Probably the reason it's static. Opening multiple open_logfile(name) will cause segfault x.x I'm guessing it's not intended to be changed. Cleanup after unity test doesn't fix it, looks like. Calling in tearDown() also causes issues. -void testWriteInCustomLogfile(void){ +void +testWriteInCustomLogfile(void) +{ char testString[256] = "12345 ABC"; char testName[256] = "TEST_PROGNAME3"; - remove("testLogfile2.log"); + (void)remove("testLogfile2.log"); sntp_init_logging(testName); open_logfile("testLogfile2.log"); // ./ causing issues //sntp_init_logging(testName); - - msyslog(LOG_ERR, testString); + + msyslog(LOG_ERR, "%s", testString); FILE * f = fopen("testLogfile2.log","r"); char line[256]; + TEST_ASSERT_TRUE( f != NULL); + //should be only 1 line - while (fgets(line, sizeof(line), f)) { - printf("%s", line); - } - + while (fgets(line, sizeof(line), f)) { + printf("%s", line); + } + char* x = strstr(line,testName); - + TEST_ASSERT_TRUE( x != NULL); x = strstr(line,testString); TEST_ASSERT_TRUE( x != NULL); //cleanup_log(); - fclose(f); //using this will also cause segfault, because at the end, log.c will call (using atexit(func) function) cleanup_log(void)-> fclose(syslog_file); + fclose(f); //using this will also cause segfault, because at the end, log.c will call (using atexit(func) function) cleanup_log(void)-> fclose(syslog_file); //After the 1st fclose, syslog_file = NULL, and is never reset -> hopefully fixed by editing log.c //TEST_ASSERT_EQUAL_STRING(testString,line); //doesn't work, line is dynamic because the process name is random. -} - + return; +} diff --git a/contrib/ntp/sntp/tests/utilities.c b/contrib/ntp/sntp/tests/utilities.c index 39d22d6..a68aaac 100644 --- a/contrib/ntp/sntp/tests/utilities.c +++ b/contrib/ntp/sntp/tests/utilities.c @@ -96,12 +96,12 @@ test_IPv4Address(void) { void test_IPv6Address(void) { - const struct in6_addr address = { + const struct in6_addr address = { { { 0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x08, 0xd3, 0x13, 0x19, 0x8a, 0x2e, 0x03, 0x70, 0x73, 0x34 - }; + } } }; const char * expected = "2001:db8:85a3:8d3:1319:8a2e:370:7334"; sockaddr_u input; struct addrinfo inputA; diff --git a/contrib/ntp/sntp/unity/unity_internals.h b/contrib/ntp/sntp/unity/unity_internals.h index c2aabc3..bf1bf3d 100644 --- a/contrib/ntp/sntp/unity/unity_internals.h +++ b/contrib/ntp/sntp/unity/unity_internals.h @@ -305,6 +305,18 @@ extern int UNITY_OUTPUT_CHAR(int); # undef UNITY_WEAK_PRAGMA #endif +#if !defined(UNITY_NORETURN_ATTRIBUTE) +# ifdef __GNUC__ // includes clang +# if !(defined(__WIN32__) && defined(__clang__)) +# define UNITY_NORETURN_ATTRIBUTE __attribute__((noreturn)) +# endif +# endif +#endif + +#ifndef UNITY_NORETURN_ATTRIBUTE +# define UNITY_NORETURN_ATTRIBUTE +#endif + //------------------------------------------------------- // Internal Structs Needed @@ -465,7 +477,7 @@ void UnityAssertNumbersWithin(const _U_SINT delta, const UNITY_LINE_TYPE lineNumber, const UNITY_DISPLAY_STYLE_T style); -void UnityFail(const char* message, const UNITY_LINE_TYPE line); +void UnityFail(const char* message, const UNITY_LINE_TYPE line) UNITY_NORETURN_ATTRIBUTE; void UnityIgnore(const char* message, const UNITY_LINE_TYPE line); diff --git a/contrib/ntp/sntp/version.c b/contrib/ntp/sntp/version.c index 4c87128..eb0e92b 100644 --- a/contrib/ntp/sntp/version.c +++ b/contrib/ntp/sntp/version.c @@ -2,4 +2,4 @@ * version file for sntp */ #include <config.h> -const char * Version = "sntp 4.2.8p4@1.3265-o Wed Oct 21 16:41:07 UTC 2015 (25)"; +const char * Version = "sntp 4.2.8p4@1.3265-o Thu Jan 7 23:23:18 UTC 2016 (26)"; |