diff options
author | Colin Watson <cjwatson@debian.org> | 2014-10-07 12:13:50 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-10-07 12:13:50 +0100 |
commit | 487bdb3a5ef6075887b830ccb8a0b14f6da78e93 (patch) | |
tree | a2cff6fec1e6c4b4153a170a3e172cfe6bfdec46 /openbsd-compat/regress | |
parent | 796ba4fd011b5d0d9d78d592ba2f30fc9d5ed2e7 (diff) | |
parent | 28453d58058a4d60c3ebe7d7f0c31a510cbf6158 (diff) |
Import openssh_6.7p1.orig.tar.gz
Diffstat (limited to 'openbsd-compat/regress')
-rw-r--r-- | openbsd-compat/regress/Makefile.in | 6 | ||||
-rw-r--r-- | openbsd-compat/regress/opensslvertest.c | 69 |
2 files changed, 72 insertions, 3 deletions
diff --git a/openbsd-compat/regress/Makefile.in b/openbsd-compat/regress/Makefile.in index bcf214bd0..dabdb0912 100644 --- a/openbsd-compat/regress/Makefile.in +++ b/openbsd-compat/regress/Makefile.in | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: Makefile.in,v 1.4 2006/08/19 09:12:14 dtucker Exp $ | 1 | # $Id: Makefile.in,v 1.5 2014/06/17 13:06:08 dtucker Exp $ |
2 | 2 | ||
3 | sysconfdir=@sysconfdir@ | 3 | sysconfdir=@sysconfdir@ |
4 | piddir=@piddir@ | 4 | piddir=@piddir@ |
@@ -16,11 +16,11 @@ LIBS=@LIBS@ | |||
16 | LDFLAGS=@LDFLAGS@ $(LIBCOMPAT) | 16 | LDFLAGS=@LDFLAGS@ $(LIBCOMPAT) |
17 | 17 | ||
18 | TESTPROGS=closefromtest$(EXEEXT) snprintftest$(EXEEXT) strduptest$(EXEEXT) \ | 18 | TESTPROGS=closefromtest$(EXEEXT) snprintftest$(EXEEXT) strduptest$(EXEEXT) \ |
19 | strtonumtest$(EXEEXT) | 19 | strtonumtest$(EXEEXT) opensslvertest$(EXEEXT) |
20 | 20 | ||
21 | all: t-exec ${OTHERTESTS} | 21 | all: t-exec ${OTHERTESTS} |
22 | 22 | ||
23 | %$(EXEEXT): %.c | 23 | %$(EXEEXT): %.c $(LIBCOMPAT) |
24 | $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $< $(LIBCOMPAT) $(LIBS) | 24 | $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $< $(LIBCOMPAT) $(LIBS) |
25 | 25 | ||
26 | t-exec: $(TESTPROGS) | 26 | t-exec: $(TESTPROGS) |
diff --git a/openbsd-compat/regress/opensslvertest.c b/openbsd-compat/regress/opensslvertest.c new file mode 100644 index 000000000..5d019b598 --- /dev/null +++ b/openbsd-compat/regress/opensslvertest.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2014 Darren Tucker | ||
3 | * | ||
4 | * Permission to use, copy, modify, and distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #include <stdio.h> | ||
18 | #include <stdlib.h> | ||
19 | |||
20 | int ssh_compatible_openssl(long, long); | ||
21 | |||
22 | struct version_test { | ||
23 | long headerver; | ||
24 | long libver; | ||
25 | int result; | ||
26 | } version_tests[] = { | ||
27 | /* built with 0.9.8b release headers */ | ||
28 | { 0x0090802fL, 0x0090802fL, 1}, /* exact match */ | ||
29 | { 0x0090802fL, 0x0090804fL, 1}, /* newer library fix version: ok */ | ||
30 | { 0x0090802fL, 0x0090801fL, 1}, /* older library fix version: ok */ | ||
31 | { 0x0090802fL, 0x0090702fL, 0}, /* older library minor version: NO */ | ||
32 | { 0x0090802fL, 0x0090902fL, 0}, /* newer library minor version: NO */ | ||
33 | { 0x0090802fL, 0x0080802fL, 0}, /* older library major version: NO */ | ||
34 | { 0x0090802fL, 0x1000100fL, 0}, /* newer library major version: NO */ | ||
35 | |||
36 | /* built with 1.0.1b release headers */ | ||
37 | { 0x1000101fL, 0x1000101fL, 1},/* exact match */ | ||
38 | { 0x1000101fL, 0x1000102fL, 1}, /* newer library patch version: ok */ | ||
39 | { 0x1000101fL, 0x1000100fL, 1}, /* older library patch version: ok */ | ||
40 | { 0x1000101fL, 0x1000201fL, 1}, /* newer library fix version: ok */ | ||
41 | { 0x1000101fL, 0x1000001fL, 0}, /* older library fix version: NO */ | ||
42 | { 0x1000101fL, 0x1010101fL, 0}, /* newer library minor version: NO */ | ||
43 | { 0x1000101fL, 0x0000101fL, 0}, /* older library major version: NO */ | ||
44 | { 0x1000101fL, 0x2000101fL, 0}, /* newer library major version: NO */ | ||
45 | }; | ||
46 | |||
47 | void | ||
48 | fail(long hver, long lver, int result) | ||
49 | { | ||
50 | fprintf(stderr, "opensslver: header %lx library %lx != %d \n", hver, lver, result); | ||
51 | exit(1); | ||
52 | } | ||
53 | |||
54 | int | ||
55 | main(void) | ||
56 | { | ||
57 | unsigned int i; | ||
58 | int res; | ||
59 | long hver, lver; | ||
60 | |||
61 | for (i = 0; i < sizeof(version_tests) / sizeof(version_tests[0]); i++) { | ||
62 | hver = version_tests[i].headerver; | ||
63 | lver = version_tests[i].libver; | ||
64 | res = version_tests[i].result; | ||
65 | if (ssh_compatible_openssl(hver, lver) != res) | ||
66 | fail(hver, lver, res); | ||
67 | } | ||
68 | exit(0); | ||
69 | } | ||