diff options
author | des <des@FreeBSD.org> | 2017-09-02 21:58:42 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2017-09-02 21:58:42 +0000 |
commit | ca26403304720e30901aa6f7bde4883af9662d2d (patch) | |
tree | 24e8f197b92c6ecd99617ac7584b6ba544a46aec /crypto/openssh/regress/unittests | |
parent | ce0d6faba2a9fd27ff0fc0942a4e51f5203bb88f (diff) | |
download | FreeBSD-src-ca26403304720e30901aa6f7bde4883af9662d2d.zip FreeBSD-src-ca26403304720e30901aa6f7bde4883af9662d2d.tar.gz |
MFH (r314306,r314720): Upgrade OpenSSH to 7.4p1.
Diffstat (limited to 'crypto/openssh/regress/unittests')
-rw-r--r-- | crypto/openssh/regress/unittests/Makefile | 4 | ||||
-rw-r--r-- | crypto/openssh/regress/unittests/Makefile.inc | 10 | ||||
-rw-r--r-- | crypto/openssh/regress/unittests/bitmap/Makefile | 4 | ||||
-rw-r--r-- | crypto/openssh/regress/unittests/hostkeys/Makefile | 4 | ||||
-rw-r--r-- | crypto/openssh/regress/unittests/kex/Makefile | 4 | ||||
-rw-r--r-- | crypto/openssh/regress/unittests/match/Makefile | 10 | ||||
-rw-r--r-- | crypto/openssh/regress/unittests/match/tests.c | 113 | ||||
-rw-r--r-- | crypto/openssh/regress/unittests/sshbuf/Makefile | 2 | ||||
-rw-r--r-- | crypto/openssh/regress/unittests/sshkey/Makefile | 4 | ||||
-rw-r--r-- | crypto/openssh/regress/unittests/utf8/Makefile | 4 | ||||
-rw-r--r-- | crypto/openssh/regress/unittests/utf8/tests.c | 7 |
11 files changed, 142 insertions, 24 deletions
diff --git a/crypto/openssh/regress/unittests/Makefile b/crypto/openssh/regress/unittests/Makefile index 0a95d4b..e70b166 100644 --- a/crypto/openssh/regress/unittests/Makefile +++ b/crypto/openssh/regress/unittests/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.6 2016/05/26 19:14:25 schwarze Exp $ +# $OpenBSD: Makefile,v 1.7 2016/08/19 06:44:13 djm Exp $ REGRESS_FAIL_EARLY= yes -SUBDIR= test_helper sshbuf sshkey bitmap kex hostkeys utf8 +SUBDIR= test_helper sshbuf sshkey bitmap kex hostkeys utf8 match .include <bsd.subdir.mk> diff --git a/crypto/openssh/regress/unittests/Makefile.inc b/crypto/openssh/regress/unittests/Makefile.inc index 7385e2b..3d9eaba 100644 --- a/crypto/openssh/regress/unittests/Makefile.inc +++ b/crypto/openssh/regress/unittests/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.6 2015/07/01 23:11:18 djm Exp $ +# $OpenBSD: Makefile.inc,v 1.9 2016/11/01 13:43:27 tb Exp $ .include <bsd.own.mk> .include <bsd.obj.mk> @@ -49,11 +49,15 @@ DPADD+=${.CURDIR}/../test_helper/libtest_helper.a .if exists(${.CURDIR}/${SSHREL}/lib/${__objdir}) LDADD+=-L${.CURDIR}/${SSHREL}/lib/${__objdir} -lssh -DPADD+=${.CURDIR}/${SSHREL}/lib/${__objdir}/libssh.a +LIBSSH=${.CURDIR}/${SSHREL}/lib/${__objdir}/libssh.a .else LDADD+=-L${.CURDIR}/${SSHREL}/lib -lssh -DPADD+=${.CURDIR}/${SSHREL}/lib/libssh.a +LIBSSH=${.CURDIR}/${SSHREL}/lib/libssh.a .endif +DPADD+=${LIBSSH} +${PROG}: ${LIBSSH} +${LIBSSH}: + cd ${.CURDIR}/${SSHREL} && ${MAKE} lib LDADD+= -lcrypto DPADD+= ${LIBCRYPTO} diff --git a/crypto/openssh/regress/unittests/bitmap/Makefile b/crypto/openssh/regress/unittests/bitmap/Makefile index b704d22..bd21949 100644 --- a/crypto/openssh/regress/unittests/bitmap/Makefile +++ b/crypto/openssh/regress/unittests/bitmap/Makefile @@ -1,6 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2015/01/15 07:36:28 djm Exp $ - -TEST_ENV= "MALLOC_OPTIONS=AFGJPRX" +# $OpenBSD: Makefile,v 1.3 2016/11/01 13:43:27 tb Exp $ PROG=test_bitmap SRCS=tests.c diff --git a/crypto/openssh/regress/unittests/hostkeys/Makefile b/crypto/openssh/regress/unittests/hostkeys/Makefile index f52a85f..ae3c342 100644 --- a/crypto/openssh/regress/unittests/hostkeys/Makefile +++ b/crypto/openssh/regress/unittests/hostkeys/Makefile @@ -1,6 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2015/02/16 22:18:34 djm Exp $ - -TEST_ENV= "MALLOC_OPTIONS=AFGJPRX" +# $OpenBSD: Makefile,v 1.3 2016/11/01 13:43:27 tb Exp $ PROG=test_hostkeys SRCS=tests.c test_iterate.c diff --git a/crypto/openssh/regress/unittests/kex/Makefile b/crypto/openssh/regress/unittests/kex/Makefile index 6532cb0..7ed3126 100644 --- a/crypto/openssh/regress/unittests/kex/Makefile +++ b/crypto/openssh/regress/unittests/kex/Makefile @@ -1,6 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2015/01/24 10:39:21 miod Exp $ - -TEST_ENV= "MALLOC_OPTIONS=AFGJPRX" +# $OpenBSD: Makefile,v 1.4 2016/11/01 13:43:27 tb Exp $ PROG=test_kex SRCS=tests.c test_kex.c diff --git a/crypto/openssh/regress/unittests/match/Makefile b/crypto/openssh/regress/unittests/match/Makefile new file mode 100644 index 0000000..bd4aed8 --- /dev/null +++ b/crypto/openssh/regress/unittests/match/Makefile @@ -0,0 +1,10 @@ +# $OpenBSD: Makefile,v 1.3 2016/11/01 13:43:27 tb Exp $ + +PROG=test_match +SRCS=tests.c +REGRESS_TARGETS=run-regress-${PROG} + +run-regress-${PROG}: ${PROG} + env ${TEST_ENV} ./${PROG} + +.include <bsd.regress.mk> diff --git a/crypto/openssh/regress/unittests/match/tests.c b/crypto/openssh/regress/unittests/match/tests.c new file mode 100644 index 0000000..7ff319c --- /dev/null +++ b/crypto/openssh/regress/unittests/match/tests.c @@ -0,0 +1,113 @@ +/* $OpenBSD: tests.c,v 1.3 2016/09/21 17:03:54 djm Exp $ */ +/* + * Regress test for matching functions + * + * Placed in the public domain + */ + +#include "includes.h" + +#include <sys/types.h> +#include <sys/param.h> +#include <stdio.h> +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif +#include <stdlib.h> +#include <string.h> + +#include "../test_helper/test_helper.h" + +#include "match.h" + +void +tests(void) +{ + TEST_START("match_pattern"); + ASSERT_INT_EQ(match_pattern("", ""), 1); + ASSERT_INT_EQ(match_pattern("", "aaa"), 0); + ASSERT_INT_EQ(match_pattern("aaa", ""), 0); + ASSERT_INT_EQ(match_pattern("aaa", "aaaa"), 0); + ASSERT_INT_EQ(match_pattern("aaaa", "aaa"), 0); + TEST_DONE(); + + TEST_START("match_pattern wildcard"); + ASSERT_INT_EQ(match_pattern("", "*"), 1); + ASSERT_INT_EQ(match_pattern("a", "?"), 1); + ASSERT_INT_EQ(match_pattern("aa", "a?"), 1); + ASSERT_INT_EQ(match_pattern("a", "*"), 1); + ASSERT_INT_EQ(match_pattern("aa", "a*"), 1); + ASSERT_INT_EQ(match_pattern("aa", "?*"), 1); + ASSERT_INT_EQ(match_pattern("aa", "**"), 1); + ASSERT_INT_EQ(match_pattern("aa", "?a"), 1); + ASSERT_INT_EQ(match_pattern("aa", "*a"), 1); + ASSERT_INT_EQ(match_pattern("ba", "a?"), 0); + ASSERT_INT_EQ(match_pattern("ba", "a*"), 0); + ASSERT_INT_EQ(match_pattern("ab", "?a"), 0); + ASSERT_INT_EQ(match_pattern("ab", "*a"), 0); + TEST_DONE(); + + TEST_START("match_pattern_list"); + ASSERT_INT_EQ(match_pattern_list("", "", 0), 0); /* no patterns */ + ASSERT_INT_EQ(match_pattern_list("", "*", 0), 1); + ASSERT_INT_EQ(match_pattern_list("", "!*", 0), -1); + ASSERT_INT_EQ(match_pattern_list("", "!a,*", 0), 1); + ASSERT_INT_EQ(match_pattern_list("", "*,!a", 0), 1); + ASSERT_INT_EQ(match_pattern_list("", "a,!*", 0), -1); + ASSERT_INT_EQ(match_pattern_list("", "!*,a", 0), -1); + ASSERT_INT_EQ(match_pattern_list("a", "", 0), 0); + ASSERT_INT_EQ(match_pattern_list("a", "*", 0), 1); + ASSERT_INT_EQ(match_pattern_list("a", "!*", 0), -1); + ASSERT_INT_EQ(match_pattern_list("a", "!a", 0), -1); + /* XXX negated ASSERT_INT_EQ(match_pattern_list("a", "!b", 0), 1); */ + ASSERT_INT_EQ(match_pattern_list("a", "!a,*", 0), -1); + ASSERT_INT_EQ(match_pattern_list("b", "!a,*", 0), 1); + ASSERT_INT_EQ(match_pattern_list("a", "*,!a", 0), -1); + ASSERT_INT_EQ(match_pattern_list("b", "*,!a", 0), 1); + ASSERT_INT_EQ(match_pattern_list("a", "a,!*", 0), -1); + ASSERT_INT_EQ(match_pattern_list("b", "a,!*", 0), -1); + ASSERT_INT_EQ(match_pattern_list("a", "a,!a", 0), -1); + /* XXX negated ASSERT_INT_EQ(match_pattern_list("b", "a,!a", 0), 1); */ + ASSERT_INT_EQ(match_pattern_list("a", "!*,a", 0), -1); + ASSERT_INT_EQ(match_pattern_list("b", "!*,a", 0), -1); + TEST_DONE(); + + TEST_START("match_pattern_list lowercase"); + ASSERT_INT_EQ(match_pattern_list("abc", "ABC", 0), 0); + ASSERT_INT_EQ(match_pattern_list("ABC", "abc", 0), 0); + ASSERT_INT_EQ(match_pattern_list("abc", "ABC", 1), 1); + ASSERT_INT_EQ(match_pattern_list("ABC", "abc", 1), 0); + TEST_DONE(); + + TEST_START("addr_match_list"); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "127.0.0.1/44"), -2); + ASSERT_INT_EQ(addr_match_list(NULL, "127.0.0.1/44"), -2); + ASSERT_INT_EQ(addr_match_list("a", "*"), 0); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "*"), 1); + ASSERT_INT_EQ(addr_match_list(NULL, "*"), 0); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "127.0.0.1"), 1); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "127.0.0.2"), 0); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.1"), -1); + /* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.2"), 1); */ + ASSERT_INT_EQ(addr_match_list("127.0.0.255", "127.0.0.0/24"), 1); + ASSERT_INT_EQ(addr_match_list("127.0.1.1", "127.0.0.0/24"), 0); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "127.0.0.0/24"), 1); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "127.0.1.0/24"), 0); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.0/24"), -1); + /* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.1.0/24"), 1); */ + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "10.0.0.1,!127.0.0.1"), -1); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.1,10.0.0.1"), -1); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "10.0.0.1,127.0.0.2"), 0); + ASSERT_INT_EQ(addr_match_list("127.0.0.1", "127.0.0.2,10.0.0.1"), 0); + /* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "10.0.0.1,!127.0.0.2"), 1); */ + /* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.2,10.0.0.1"), 1); */ + TEST_DONE(); + +/* + * XXX TODO + * int match_host_and_ip(const char *, const char *, const char *); + * int match_user(const char *, const char *, const char *, const char *); + * char *match_list(const char *, const char *, u_int *); + * int addr_match_cidr_list(const char *, const char *); + */ +} diff --git a/crypto/openssh/regress/unittests/sshbuf/Makefile b/crypto/openssh/regress/unittests/sshbuf/Makefile index 85f99ac..69b2756 100644 --- a/crypto/openssh/regress/unittests/sshbuf/Makefile +++ b/crypto/openssh/regress/unittests/sshbuf/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2014/04/30 05:32:00 djm Exp $ +# $OpenBSD: Makefile,v 1.5 2016/11/01 13:43:27 tb Exp $ PROG=test_sshbuf SRCS=tests.c diff --git a/crypto/openssh/regress/unittests/sshkey/Makefile b/crypto/openssh/regress/unittests/sshkey/Makefile index 1bcd266..cfbfcf8 100644 --- a/crypto/openssh/regress/unittests/sshkey/Makefile +++ b/crypto/openssh/regress/unittests/sshkey/Makefile @@ -1,6 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2014/06/24 01:14:18 djm Exp $ - -TEST_ENV= "MALLOC_OPTIONS=AFGJPRX" +# $OpenBSD: Makefile,v 1.4 2016/11/01 13:43:27 tb Exp $ PROG=test_sshkey SRCS=tests.c test_sshkey.c test_file.c test_fuzz.c common.c diff --git a/crypto/openssh/regress/unittests/utf8/Makefile b/crypto/openssh/regress/unittests/utf8/Makefile index 150ea2f..a975264f 100644 --- a/crypto/openssh/regress/unittests/utf8/Makefile +++ b/crypto/openssh/regress/unittests/utf8/Makefile @@ -1,6 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2016/05/30 12:14:08 schwarze Exp $ - -TEST_ENV= "MALLOC_OPTIONS=CFGJPRSUX" +# $OpenBSD: Makefile,v 1.4 2016/11/01 13:43:27 tb Exp $ PROG=test_utf8 SRCS=tests.c diff --git a/crypto/openssh/regress/unittests/utf8/tests.c b/crypto/openssh/regress/unittests/utf8/tests.c index fad2ec2..31f9fe9 100644 --- a/crypto/openssh/regress/unittests/utf8/tests.c +++ b/crypto/openssh/regress/unittests/utf8/tests.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tests.c,v 1.2 2016/05/30 12:05:56 schwarze Exp $ */ +/* $OpenBSD: tests.c,v 1.3 2016/12/19 04:55:18 djm Exp $ */ /* * Regress test for the utf8.h *mprintf() API * @@ -6,10 +6,12 @@ * and placed in the public domain. */ +#include "includes.h" + #include <locale.h> #include <string.h> -#include "test_helper.h" +#include "../test_helper/test_helper.h" #include "utf8.h" @@ -63,7 +65,6 @@ tests(void) TEST_DONE(); badarg(); - one("null", NULL, 8, 6, 6, "(null)"); one("empty", "", 2, 0, 0, ""); one("ascii", "x", -2, -2, -2, "x"); one("newline", "a\nb", -2, -2, -2, "a\nb"); |