Skip to content

Commit 9a59a33

Browse files
increase test coverage
1 parent 92eae9e commit 9a59a33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+4582
-1627
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,5 @@ survey.sh
232232
buildpkg.sh
233233
config.h.in
234234

235+
236+
config.h

INSTALL

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
1. Prerequisites
22
----------------
33

4-
You will need working installations of Zlib and OpenSSL.
4+
You will need working installations of Zlib and libcrypto (LibreSSL /
5+
OpenSSL)
56

67
Zlib 1.1.4 or 1.2.1.2 or greater (ealier 1.2.x versions have problems):
78
http://www.gzip.org/zlib/
89

9-
OpenSSL 0.9.6 or greater:
10-
http://www.openssl.org/
10+
libcrypto (LibreSSL or OpenSSL >= 0.9.8f)
11+
LibreSSL http://www.libressl.org/ ; or
12+
OpenSSL http://www.openssl.org/
1113

12-
(OpenSSL 0.9.5a is partially supported, but some ciphers (SSH protocol 1
13-
Blowfish) do not work correctly.)
14+
LibreSSL/OpenSSL should be compiled as a position-independent library
15+
(i.e. with -fPIC) otherwise OpenSSH will not be able to link with it.
16+
If you must use a non-position-independent libcrypto, then you may need
17+
to configure OpenSSH --without-pie.
1418

1519
The remaining items are optional.
1620

1721
NB. If you operating system supports /dev/random, you should configure
18-
OpenSSL to use it. OpenSSH relies on OpenSSL's direct support of
19-
/dev/random, or failing that, either prngd or egd
22+
libcrypto (LibreSSL/OpenSSL) to use it. OpenSSH relies on libcrypto's
23+
direct support of /dev/random, or failing that, either prngd or egd
2024

2125
PRNGD:
2226

@@ -27,10 +31,10 @@ http://prngd.sourceforge.net/
2731

2832
EGD:
2933

30-
The Entropy Gathering Daemon (EGD) is supported if you have a system which
31-
lacks /dev/random and don't want to use OpenSSH's internal entropy collection.
34+
If the kernel lacks /dev/random the Entropy Gathering Daemon (EGD) is
35+
supported only if libcrypto supports it.
3236

33-
http://www.lothar.com/tech/crypto/
37+
http://egd.sourceforge.net/
3438

3539
PAM:
3640

@@ -55,15 +59,6 @@ passphrase requester. This is maintained separately at:
5559

5660
http://www.jmknoble.net/software/x11-ssh-askpass/
5761

58-
TCP Wrappers:
59-
60-
If you wish to use the TCP wrappers functionality you will need at least
61-
tcpd.h and libwrap.a, either in the standard include and library paths,
62-
or in the directory specified by --with-tcp-wrappers. Version 7.6 is
63-
known to work.
64-
65-
http://ftp.porcupine.org/pub/security/index.html
66-
6762
S/Key Libraries:
6863

6964
If you wish to use --with-skey then you will need the library below
@@ -80,10 +75,16 @@ these multi-platform ports:
8075
http://www.thrysoee.dk/editline/
8176
http://sourceforge.net/projects/libedit/
8277

78+
LDNS:
79+
80+
LDNS is a DNS BSD-licensed resolver library which supports DNSSEC.
81+
82+
http://nlnetlabs.nl/projects/ldns/
83+
8384
Autoconf:
8485

8586
If you modify configure.ac or configure doesn't exist (eg if you checked
86-
the code out of CVS yourself) then you will need autoconf-2.61 to rebuild
87+
the code out of CVS yourself) then you will need autoconf-2.68 to rebuild
8788
the automatically generated files by running "autoreconf". Earlier
8889
versions may also work but this is not guaranteed.
8990

@@ -174,9 +175,6 @@ Integration Architecture. The default for OSF1 machines is enable.
174175
--with-skey=PATH will enable S/Key one time password support. You will
175176
need the S/Key libraries and header files installed for this to work.
176177

177-
--with-tcp-wrappers will enable TCP Wrappers (/etc/hosts.allow|deny)
178-
support.
179-
180178
--with-md5-passwords will enable the use of MD5 passwords. Enable this
181179
if your operating system uses MD5 passwords and the system crypt() does
182180
not support them directly (see the crypt(3/3c) man page). If enabled, the
@@ -198,10 +196,11 @@ created.
198196

199197
--with-xauth=PATH specifies the location of the xauth binary
200198

201-
--with-ssl-dir=DIR allows you to specify where your OpenSSL libraries
199+
--with-ssl-dir=DIR allows you to specify where your Libre/OpenSSL
200+
libraries
202201
are installed.
203202

204-
--with-ssl-engine enables OpenSSL's (hardware) ENGINE support
203+
--with-ssl-engine enables Libre/OpenSSL's (hardware) ENGINE support
205204

206205
--with-4in6 Check for IPv4 in IPv6 mapped addresses and convert them to
207206
real (AF_INET) IPv4 addresses. Works around some quirks on Linux.
@@ -260,4 +259,4 @@ Please refer to the "reporting bugs" section of the webpage at
260259
http://www.openssh.com/
261260

262261

263-
$Id: INSTALL,v 1.86 2011/05/05 03:48:37 djm Exp $
262+
$Id: INSTALL,v 1.91 2014/09/09 02:23:11 dtucker Exp $

LICENCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ OpenSSH contains no GPL code.
207207
The SCO Group
208208
Daniel Walsh
209209
Red Hat, Inc
210+
Simon Vallet / Genoscope
210211

211212
* Redistribution and use in source and binary forms, with or without
212213
* modification, are permitted provided that the following conditions

Makefile.in

Lines changed: 142 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ $(SSHOBJS): Makefile.in config.h
151151
$(SSHDOBJS): Makefile.in config.h
152152

153153
.c.o:
154-
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
154+
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
155155

156156
LIBWIN32COMPAT=contrib/win32/win32compat/@LIBWIN32COMPAT@
157157
$(LIBWIN32COMPAT): always
@@ -207,9 +207,10 @@ $(MANPAGES): $(MANPAGES_IN)
207207
manpage=$(srcdir)/`echo $@ | sed 's/\.out$$//'`; \
208208
fi; \
209209
if test "$(MANTYPE)" = "man"; then \
210-
$(FIXPATHSCMD) $${manpage} | $(AWK) -f $(srcdir)/mdoc2man.awk > $@; \
210+
$(FIXPATHSCMD) $${manpage} | $(FIXALGORITHMSCMD) | \
211+
$(AWK) -f $(srcdir)/mdoc2man.awk > $@; \
211212
else \
212-
$(FIXPATHSCMD) $${manpage} > $@; \
213+
$(FIXPATHSCMD) $${manpage} | $(FIXALGORITHMSCMD) > $@; \
213214
fi
214215

215216
$(CONFIGFILES): $(CONFIGFILES_IN)
@@ -230,6 +231,18 @@ umac128.o: umac.c
230231
clean: regressclean
231232
rm -f *.o *.a $(TARGETS) logintest config.cache config.log
232233
rm -f *.out core survey
234+
rm -f regress/unittests/test_helper/*.a
235+
rm -f regress/unittests/test_helper/*.o
236+
rm -f regress/unittests/sshbuf/*.o
237+
rm -f regress/unittests/sshbuf/test_sshbuf
238+
rm -f regress/unittests/sshkey/*.o
239+
rm -f regress/unittests/sshkey/test_sshkey
240+
rm -f regress/unittests/bitmap/*.o
241+
rm -f regress/unittests/bitmap/test_bitmap
242+
rm -f regress/unittests/hostkeys/*.o
243+
rm -f regress/unittests/hostkeys/test_hostkeys
244+
rm -f regress/unittests/kex/*.o
245+
rm -f regress/unittests/kex/test_kex
233246
(cd openbsd-compat && $(MAKE) clean)
234247
if test -f contrib/win32/win32compat/Makefile ; then \
235248
(cd contrib/win32/win32compat && $(MAKE) clean) \
@@ -239,8 +252,20 @@ distclean: regressclean
239252
rm -f *.o *.a $(TARGETS) logintest config.cache config.log
240253
rm -f *.out core opensshd.init openssh.xml
241254
rm -f Makefile buildpkg.sh config.h config.status
242-
rm -f survey.sh openbsd-compat/regress/Makefile *~
255+
rm -f survey.sh openbsd-compat/regress/Makefile *~
243256
rm -rf autom4te.cache
257+
rm -f regress/unittests/test_helper/*.a
258+
rm -f regress/unittests/test_helper/*.o
259+
rm -f regress/unittests/sshbuf/*.o
260+
rm -f regress/unittests/sshbuf/test_sshbuf
261+
rm -f regress/unittests/sshkey/*.o
262+
rm -f regress/unittests/sshkey/test_sshkey
263+
rm -f regress/unittests/bitmap/*.o
264+
rm -f regress/unittests/bitmap/test_bitmap
265+
rm -f regress/unittests/hostkeys/*.o
266+
rm -f regress/unittests/hostkeys/test_hostkeys
267+
rm -f regress/unittests/kex/*.o
268+
rm -f regress/unittests/kex/test_kex
244269
(cd openbsd-compat && $(MAKE) distclean)
245270
if test -f contrib/win32/win32compat/Makefile ; then \
246271
(cd contrib/win32/win32compat && $(MAKE) distclean) \
@@ -416,12 +441,117 @@ uninstall:
416441
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
417442
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
418443

419-
tests interop-tests: $(TARGETS)
444+
regress-prep:
445+
[ -d `pwd`/regress ] || mkdir -p `pwd`/regress
446+
[ -d `pwd`/regress/unittests ] || mkdir -p `pwd`/regress/unittests
447+
[ -d `pwd`/regress/unittests/test_helper ] || \
448+
mkdir -p `pwd`/regress/unittests/test_helper
449+
[ -d `pwd`/regress/unittests/sshbuf ] || \
450+
mkdir -p `pwd`/regress/unittests/sshbuf
451+
[ -d `pwd`/regress/unittests/sshkey ] || \
452+
mkdir -p `pwd`/regress/unittests/sshkey
453+
[ -d `pwd`/regress/unittests/bitmap ] || \
454+
mkdir -p `pwd`/regress/unittests/bitmap
455+
[ -d `pwd`/regress/unittests/hostkeys ] || \
456+
mkdir -p `pwd`/regress/unittests/hostkeys
457+
[ -d `pwd`/regress/unittests/kex ] || \
458+
mkdir -p `pwd`/regress/unittests/kex
459+
[ -f `pwd`/regress/Makefile ] || \
460+
ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
461+
462+
regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c
463+
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
464+
$(LDFLAGS) ./libssh.a -lopenbsd-compat @LINKWIN32COMPAT@ $(LIBS)
465+
466+
regress/setuid-allowed$(EXEEXT): $(srcdir)/regress/setuid-allowed.c
467+
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
468+
$(LDFLAGS) ./libssh.a -lopenbsd-compat @LINKWIN32COMPAT@ $(LIBS)
469+
470+
regress/netcat$(EXEEXT): $(srcdir)/regress/netcat.c
471+
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
472+
$(LDFLAGS) ./libssh.a -lopenbsd-compat @LINKWIN32COMPAT@ $(LIBS)
473+
474+
UNITTESTS_TEST_HELPER_OBJS=\
475+
regress/unittests/test_helper/test_helper.o \
476+
regress/unittests/test_helper/fuzz.o
477+
478+
regress/unittests/test_helper/libtest_helper.a: ${UNITTESTS_TEST_HELPER_OBJS}
479+
$(AR) rv $@ $(UNITTESTS_TEST_HELPER_OBJS)
480+
$(RANLIB) $@
481+
482+
UNITTESTS_TEST_SSHBUF_OBJS=\
483+
regress/unittests/sshbuf/tests.o \
484+
regress/unittests/sshbuf/test_sshbuf.o \
485+
regress/unittests/sshbuf/test_sshbuf_getput_basic.o \
486+
regress/unittests/sshbuf/test_sshbuf_getput_crypto.o \
487+
regress/unittests/sshbuf/test_sshbuf_misc.o \
488+
regress/unittests/sshbuf/test_sshbuf_fuzz.o \
489+
regress/unittests/sshbuf/test_sshbuf_getput_fuzz.o \
490+
regress/unittests/sshbuf/test_sshbuf_fixed.o
491+
492+
regress/unittests/sshbuf/test_sshbuf$(EXEEXT): ${UNITTESTS_TEST_SSHBUF_OBJS} \
493+
regress/unittests/test_helper/libtest_helper.a libssh.a
494+
$(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_SSHBUF_OBJS) \
495+
regress/unittests/test_helper/libtest_helper.a \
496+
./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
497+
498+
UNITTESTS_TEST_SSHKEY_OBJS=\
499+
regress/unittests/sshkey/test_fuzz.o \
500+
regress/unittests/sshkey/tests.o \
501+
regress/unittests/sshkey/common.o \
502+
regress/unittests/sshkey/test_file.o \
503+
regress/unittests/sshkey/test_sshkey.o
504+
505+
regress/unittests/sshkey/test_sshkey$(EXEEXT): ${UNITTESTS_TEST_SSHKEY_OBJS} \
506+
regress/unittests/test_helper/libtest_helper.a libssh.a
507+
$(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_SSHKEY_OBJS) \
508+
regress/unittests/test_helper/libtest_helper.a \
509+
./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
510+
511+
UNITTESTS_TEST_BITMAP_OBJS=\
512+
regress/unittests/bitmap/tests.o
513+
514+
regress/unittests/bitmap/test_bitmap$(EXEEXT): ${UNITTESTS_TEST_BITMAP_OBJS} \
515+
regress/unittests/test_helper/libtest_helper.a libssh.a
516+
$(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_BITMAP_OBJS) \
517+
regress/unittests/test_helper/libtest_helper.a \
518+
./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
519+
520+
UNITTESTS_TEST_KEX_OBJS=\
521+
regress/unittests/kex/tests.o \
522+
regress/unittests/kex/test_kex.o \
523+
roaming_dummy.o
524+
525+
regress/unittests/kex/test_kex$(EXEEXT): ${UNITTESTS_TEST_KEX_OBJS} \
526+
regress/unittests/test_helper/libtest_helper.a libssh.a
527+
$(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_KEX_OBJS) \
528+
regress/unittests/test_helper/libtest_helper.a \
529+
./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
530+
531+
UNITTESTS_TEST_HOSTKEYS_OBJS=\
532+
regress/unittests/hostkeys/tests.o \
533+
regress/unittests/hostkeys/test_iterate.o
534+
535+
regress/unittests/hostkeys/test_hostkeys$(EXEEXT): \
536+
${UNITTESTS_TEST_HOSTKEYS_OBJS} \
537+
regress/unittests/test_helper/libtest_helper.a libssh.a
538+
$(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_HOSTKEYS_OBJS) \
539+
regress/unittests/test_helper/libtest_helper.a \
540+
./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
541+
542+
REGRESS_BINARIES=\
543+
regress/modpipe$(EXEEXT) \
544+
regress/setuid-allowed$(EXEEXT) \
545+
regress/netcat$(EXEEXT) \
546+
regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \
547+
regress/unittests/sshkey/test_sshkey$(EXEEXT) \
548+
regress/unittests/bitmap/test_bitmap$(EXEEXT) \
549+
regress/unittests/hostkeys/test_hostkeys$(EXEEXT) \
550+
regress/unittests/kex/test_kex$(EXEEXT)
551+
552+
tests interop-tests t-exec: regress-prep $(TARGETS) $(REGRESS_BINARIES)
420553
BUILDDIR=`pwd`; \
421-
[ -d `pwd`/regress ] || mkdir -p `pwd`/regress; \
422-
[ -f `pwd`/regress/Makefile ] || \
423-
ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile ; \
424-
TEST_SHELL="@TEST_SHELL@"; \
554+
TEST_SSH_SCP="$${BUILDDIR}/scp"; \
425555
TEST_SSH_SSH="$${BUILDDIR}/ssh"; \
426556
TEST_SSH_SSHD="$${BUILDDIR}/sshd"; \
427557
TEST_SSH_SSHAGENT="$${BUILDDIR}/ssh-agent"; \
@@ -436,15 +566,15 @@ tests interop-tests: $(TARGETS)
436566
TEST_SSH_CONCH="conch"; \
437567
TEST_SSH_IPV6="@TEST_SSH_IPV6@" ; \
438568
TEST_SSH_ECC="@TEST_SSH_ECC@" ; \
439-
TEST_SSH_SHA256="@TEST_SSH_SHA256@" ; \
440569
cd $(srcdir)/regress || exit $$?; \
441570
$(MAKE) \
442571
.OBJDIR="$${BUILDDIR}/regress" \
443572
.CURDIR="`pwd`" \
444573
BUILDDIR="$${BUILDDIR}" \
445574
OBJ="$${BUILDDIR}/regress/" \
446575
PATH="$${BUILDDIR}:$${PATH}" \
447-
TEST_SHELL="$${TEST_SHELL}" \
576+
TEST_ENV=MALLOC_OPTIONS="@TEST_MALLOC_OPTIONS@" \
577+
TEST_SSH_SCP="$${TEST_SSH_SCP}" \
448578
TEST_SSH_SSH="$${TEST_SSH_SSH}" \
449579
TEST_SSH_SSHD="$${TEST_SSH_SSHD}" \
450580
TEST_SSH_SSHAGENT="$${TEST_SSH_SSHAGENT}" \
@@ -459,7 +589,7 @@ tests interop-tests: $(TARGETS)
459589
TEST_SSH_CONCH="$${TEST_SSH_CONCH}" \
460590
TEST_SSH_IPV6="$${TEST_SSH_IPV6}" \
461591
TEST_SSH_ECC="$${TEST_SSH_ECC}" \
462-
TEST_SSH_SHA256="$${TEST_SSH_SHA256}" \
592+
TEST_SHELL="${TEST_SHELL}" \
463593
EXEEXT="$(EXEEXT)" \
464594
$@ && echo all tests passed
465595

OVERVIEW

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ these programs.
6565
packets. CRC code comes from crc32.c.
6666

6767
- The code in packet.c calls the buffer manipulation routines
68-
(buffer.c, bufaux.c), compression routines (compress.c, zlib),
69-
and the encryption routines.
68+
(buffer.c, bufaux.c), compression routines (zlib), and the
69+
encryption routines.
7070

7171
X11, TCP/IP, and Agent forwarding
7272

@@ -165,4 +165,4 @@ these programs.
165165
uidswap.c uid-swapping
166166
xmalloc.c "safe" malloc routines
167167

168-
$OpenBSD: OVERVIEW,v 1.11 2006/08/03 03:34:41 deraadt Exp $
168+
$OpenBSD: OVERVIEW,v 1.12 2015/07/08 19:01:15 markus Exp $

0 commit comments

Comments
 (0)