summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cvsignore28
-rw-r--r--ChangeLog12387
-rw-r--r--Makefile.in101
-rw-r--r--PROTOCOL53
-rw-r--r--PROTOCOL.krl9
-rw-r--r--README2
-rw-r--r--atomicio.c3
-rw-r--r--auth-options.c83
-rw-r--r--auth-options.h4
-rw-r--r--auth-rh-rsa.c4
-rw-r--r--auth-rhosts.c64
-rw-r--r--auth-rsa.c10
-rw-r--r--auth.c72
-rw-r--r--auth.h21
-rw-r--r--auth1.c4
-rw-r--r--auth2-chall.c7
-rw-r--r--auth2-gss.c22
-rw-r--r--auth2-hostbased.c36
-rw-r--r--auth2-pubkey.c82
-rw-r--r--auth2.c18
-rw-r--r--authfd.c840
-rw-r--r--authfd.h60
-rw-r--r--authfile.c125
-rw-r--r--authfile.h13
-rw-r--r--bitmap.c212
-rw-r--r--bitmap.h56
-rw-r--r--bufbn.c6
-rw-r--r--buffer.h1
-rw-r--r--canohost.c35
-rw-r--r--channels.c77
-rw-r--r--channels.h28
-rw-r--r--cipher-3des1.c21
-rw-r--r--cipher-aesctr.c11
-rw-r--r--cipher-bf1.c21
-rw-r--r--cipher-chachapoly.c3
-rw-r--r--cipher-ctr.c4
-rw-r--r--cipher.c10
-rw-r--r--cipher.h8
-rw-r--r--clientloop.c455
-rw-r--r--compat.c17
-rw-r--r--compat.h4
-rw-r--r--compress.c167
-rw-r--r--compress.h25
-rw-r--r--config.h.in41
-rwxr-xr-xconfigure29933
-rw-r--r--configure.ac911
-rw-r--r--contrib/Makefile4
-rw-r--r--contrib/caldera/openssh.spec365
-rwxr-xr-xcontrib/caldera/ssh-host-keygen36
-rwxr-xr-xcontrib/caldera/sshd.init125
-rw-r--r--contrib/caldera/sshd.pam8
-rw-r--r--contrib/cygwin/ssh-host-config30
-rw-r--r--contrib/cygwin/ssh-user-config27
-rw-r--r--contrib/redhat/openssh.spec2
-rw-r--r--contrib/suse/openssh.spec2
-rw-r--r--deattack.c81
-rw-r--r--deattack.h11
-rw-r--r--defines.h25
-rw-r--r--dh.c62
-rw-r--r--dh.h6
-rw-r--r--digest-libc.c51
-rw-r--r--digest-openssl.c25
-rw-r--r--digest.h8
-rw-r--r--dispatch.c118
-rw-r--r--dispatch.h35
-rw-r--r--dns.c41
-rw-r--r--dns.h7
-rw-r--r--entropy.c12
-rw-r--r--ge25519.h4
-rw-r--r--groupaccess.c4
-rw-r--r--gss-genr.c3
-rw-r--r--gss-serv.c3
-rw-r--r--hmac.c6
-rw-r--r--hostfile.c625
-rw-r--r--hostfile.h64
-rw-r--r--includes.h5
-rw-r--r--kex.c657
-rw-r--r--kex.h195
-rw-r--r--kexc25519.c94
-rw-r--r--kexc25519c.c161
-rw-r--r--kexc25519s.c134
-rw-r--r--kexdh.c90
-rw-r--r--kexdhc.c199
-rw-r--r--kexdhs.c190
-rw-r--r--kexecdh.c85
-rw-r--r--kexecdhc.c221
-rw-r--r--kexecdhs.c201
-rw-r--r--kexgex.c108
-rw-r--r--kexgexc.c296
-rw-r--r--kexgexs.c263
-rw-r--r--key.c59
-rw-r--r--key.h8
-rw-r--r--krl.c845
-rw-r--r--krl.h38
-rw-r--r--loginrec.c10
-rw-r--r--mac.c96
-rw-r--r--mac.h30
-rw-r--r--misc.c6
-rw-r--r--moduli.06
-rw-r--r--moduli.c14
-rw-r--r--monitor.c395
-rw-r--r--monitor.h4
-rw-r--r--monitor_fdpass.c4
-rw-r--r--monitor_mm.c8
-rw-r--r--monitor_wrap.c255
-rw-r--r--monitor_wrap.h9
-rw-r--r--msg.c25
-rw-r--r--msg.h7
-rw-r--r--mux.c6
-rw-r--r--opacket.c349
-rw-r--r--opacket.h168
-rw-r--r--openbsd-compat/.cvsignore1
-rw-r--r--openbsd-compat/Makefile.in2
-rw-r--r--openbsd-compat/arc4random.c36
-rw-r--r--openbsd-compat/bcrypt_pbkdf.c29
-rw-r--r--openbsd-compat/bsd-misc.c14
-rw-r--r--openbsd-compat/fake-rfc2553.h3
-rw-r--r--openbsd-compat/getrrsetbyname-ldns.c2
-rw-r--r--openbsd-compat/md5.c251
-rw-r--r--openbsd-compat/md5.h51
-rw-r--r--openbsd-compat/openbsd-compat.h7
-rw-r--r--openbsd-compat/openssl-compat.c4
-rw-r--r--openbsd-compat/openssl-compat.h3
-rw-r--r--openbsd-compat/port-tun.c17
-rw-r--r--openbsd-compat/readpassphrase.c8
-rw-r--r--openbsd-compat/reallocarray.c46
-rw-r--r--openbsd-compat/regress/.cvsignore6
-rw-r--r--openbsd-compat/rmd160.c376
-rw-r--r--openbsd-compat/rmd160.h61
-rw-r--r--openbsd-compat/sha1.c177
-rw-r--r--openbsd-compat/sha1.h58
-rw-r--r--openbsd-compat/sha2.c40
-rw-r--r--openbsd-compat/sha2.h19
-rw-r--r--openbsd-compat/xcrypt.c2
-rw-r--r--packet.c2857
-rw-r--r--packet.h284
-rw-r--r--progressmeter.c6
-rw-r--r--progressmeter.h4
-rw-r--r--readconf.c519
-rw-r--r--readconf.h24
-rw-r--r--regress/.cvsignore31
-rw-r--r--regress/Makefile47
-rw-r--r--regress/agent-pkcs11.sh4
-rw-r--r--regress/agent-timeout.sh4
-rw-r--r--regress/agent.sh8
-rw-r--r--regress/broken-pipe.sh4
-rw-r--r--regress/cert-hostkey.sh111
-rw-r--r--regress/cfgmatch.sh23
-rw-r--r--regress/cipher-speed.sh8
-rw-r--r--regress/connect-privsep.sh8
-rw-r--r--regress/connect.sh4
-rw-r--r--regress/dynamic-forward.sh4
-rw-r--r--regress/exit-status.sh4
-rw-r--r--regress/forcecommand.sh26
-rw-r--r--regress/forward-control.sh6
-rw-r--r--regress/forwarding.sh20
-rw-r--r--regress/host-expand.sh4
-rw-r--r--regress/hostkey-agent.sh52
-rw-r--r--regress/hostkey-rotate.sh128
-rw-r--r--regress/integrity.sh6
-rw-r--r--regress/key-options.sh10
-rw-r--r--regress/keygen-change.sh9
-rw-r--r--regress/keygen-knownhosts.sh197
-rw-r--r--regress/keyscan.sh9
-rw-r--r--regress/krl.sh90
-rw-r--r--regress/limit-keytype.sh80
-rw-r--r--regress/localcommand.sh4
-rw-r--r--regress/multiplex.sh25
-rw-r--r--regress/multipubkey.sh66
-rw-r--r--regress/netcat.c1690
-rw-r--r--regress/proto-mismatch.sh6
-rw-r--r--regress/proto-version.sh10
-rw-r--r--regress/proxy-connect.sh6
-rw-r--r--regress/reconfigure.sh31
-rw-r--r--regress/reexec.sh4
-rw-r--r--regress/rekey.sh24
-rw-r--r--regress/sshd-log-wrapper.sh8
-rw-r--r--regress/stderr-data.sh4
-rw-r--r--regress/t11.ok1
-rw-r--r--regress/t4.ok2
-rw-r--r--regress/test-exec.sh88
-rw-r--r--regress/transfer.sh4
-rw-r--r--regress/try-ciphers.sh8
-rw-r--r--regress/unittests/Makefile6
-rw-r--r--regress/unittests/Makefile.inc4
-rw-r--r--regress/unittests/bitmap/Makefile12
-rw-r--r--regress/unittests/bitmap/tests.c135
-rw-r--r--regress/unittests/hostkeys/Makefile12
-rw-r--r--regress/unittests/hostkeys/mktestdata.sh94
-rw-r--r--regress/unittests/hostkeys/test_iterate.c1171
-rw-r--r--regress/unittests/hostkeys/testdata/dsa_1.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/dsa_2.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/dsa_3.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/dsa_4.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/dsa_5.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/dsa_6.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ecdsa_1.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ecdsa_2.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ecdsa_3.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ecdsa_4.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ecdsa_5.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ecdsa_6.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ed25519_1.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ed25519_2.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ed25519_3.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ed25519_4.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ed25519_5.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/ed25519_6.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/known_hosts61
-rw-r--r--regress/unittests/hostkeys/testdata/rsa1_1.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa1_2.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa1_3.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa1_4.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa1_5.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa1_6.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa_1.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa_2.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa_3.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa_4.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa_5.pub1
-rw-r--r--regress/unittests/hostkeys/testdata/rsa_6.pub1
-rw-r--r--regress/unittests/hostkeys/tests.c16
-rw-r--r--regress/unittests/kex/Makefile14
-rw-r--r--regress/unittests/kex/test_kex.c197
-rw-r--r--regress/unittests/kex/tests.c14
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_getput_crypto.c8
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c4
-rw-r--r--regress/unittests/sshkey/common.c4
-rwxr-xr-xregress/unittests/sshkey/mktestdata.sh4
-rw-r--r--regress/unittests/sshkey/test_file.c33
-rw-r--r--regress/unittests/sshkey/test_fuzz.c13
-rw-r--r--regress/unittests/sshkey/test_sshkey.c192
-rw-r--r--regress/unittests/sshkey/testdata/dsa_1-cert.fp2
-rw-r--r--regress/unittests/sshkey/testdata/dsa_1.fp2
-rw-r--r--regress/unittests/sshkey/testdata/dsa_2.fp2
-rw-r--r--regress/unittests/sshkey/testdata/ecdsa_1-cert.fp2
-rw-r--r--regress/unittests/sshkey/testdata/ecdsa_1.fp2
-rw-r--r--regress/unittests/sshkey/testdata/ecdsa_2.fp2
-rw-r--r--regress/unittests/sshkey/testdata/ed25519_1-cert.fp2
-rw-r--r--regress/unittests/sshkey/testdata/ed25519_1.fp2
-rw-r--r--regress/unittests/sshkey/testdata/ed25519_2.fp2
-rw-r--r--regress/unittests/sshkey/testdata/rsa1_1.fp2
-rw-r--r--regress/unittests/sshkey/testdata/rsa1_2.fp2
-rw-r--r--regress/unittests/sshkey/testdata/rsa_1-cert.fp2
-rw-r--r--regress/unittests/sshkey/testdata/rsa_1.fp2
-rw-r--r--regress/unittests/sshkey/testdata/rsa_2.fp2
-rw-r--r--regress/unittests/test_helper/Makefile5
-rw-r--r--regress/unittests/test_helper/fuzz.c102
-rw-r--r--regress/unittests/test_helper/test_helper.c67
-rw-r--r--regress/unittests/test_helper/test_helper.h13
-rwxr-xr-xregress/valgrind-unit.sh20
-rw-r--r--regress/yes-head.sh4
-rw-r--r--rijndael.c339
-rw-r--r--roaming_client.c5
-rw-r--r--roaming_common.c5
-rw-r--r--roaming_dummy.c13
-rw-r--r--sandbox-systrace.c4
-rw-r--r--scard/.cvsignore2
-rw-r--r--scp.012
-rw-r--r--scp.110
-rw-r--r--scp.c7
-rw-r--r--servconf.c123
-rw-r--r--servconf.h8
-rw-r--r--serverloop.c122
-rw-r--r--session.c15
-rw-r--r--sftp-client.c863
-rw-r--r--sftp-client.h44
-rw-r--r--sftp-common.c101
-rw-r--r--sftp-common.h7
-rw-r--r--sftp-glob.c4
-rw-r--r--sftp-server.010
-rw-r--r--sftp-server.86
-rw-r--r--sftp-server.c592
-rw-r--r--sftp.016
-rw-r--r--sftp.16
-rw-r--r--sftp.c26
-rw-r--r--ssh-add.013
-rw-r--r--ssh-add.115
-rw-r--r--ssh-add.c327
-rw-r--r--ssh-agent.014
-rw-r--r--ssh-agent.115
-rw-r--r--ssh-agent.c561
-rw-r--r--ssh-dss.c3
-rw-r--r--ssh-ecdsa.c4
-rw-r--r--ssh-ed25519.c14
-rw-r--r--ssh-keygen.050
-rw-r--r--ssh-keygen.122
-rw-r--r--ssh-keygen.c1157
-rw-r--r--ssh-keyscan.026
-rw-r--r--ssh-keyscan.16
-rw-r--r--ssh-keyscan.c160
-rw-r--r--ssh-keysign.06
-rw-r--r--ssh-keysign.c153
-rw-r--r--ssh-pkcs11-helper.04
-rw-r--r--ssh-pkcs11-helper.c2
-rw-r--r--ssh-pkcs11.c34
-rw-r--r--ssh-pkcs11.h4
-rw-r--r--ssh-rsa.c3
-rw-r--r--ssh.0169
-rw-r--r--ssh.135
-rw-r--r--ssh.c221
-rw-r--r--ssh_api.c537
-rw-r--r--ssh_api.h137
-rw-r--r--ssh_config.0513
-rw-r--r--ssh_config.5152
-rw-r--r--sshbuf-getput-basic.c57
-rw-r--r--sshbuf-getput-crypto.c21
-rw-r--r--sshbuf-misc.c5
-rw-r--r--sshbuf.c4
-rw-r--r--sshbuf.h4
-rw-r--r--sshconnect.c110
-rw-r--r--sshconnect1.c76
-rw-r--r--sshconnect2.c573
-rw-r--r--sshd.065
-rw-r--r--sshd.816
-rw-r--r--sshd.c303
-rw-r--r--sshd_config4
-rw-r--r--sshd_config.0360
-rw-r--r--sshd_config.5107
-rw-r--r--ssherr.c12
-rw-r--r--ssherr.h6
-rw-r--r--sshkey.c415
-rw-r--r--sshkey.h27
-rw-r--r--sshlogin.c6
-rw-r--r--sshpty.c11
-rw-r--r--uidswap.c4
-rw-r--r--version.h4
-rw-r--r--xmalloc.c14
328 files changed, 52319 insertions, 19755 deletions
diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 000000000..9baaa3b4e
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1,28 @@
1*.0
2*.out
3Makefile
4autom4te.cache
5buildit.sh
6buildpkg.sh
7config.cache
8config.h
9config.h.in
10config.log
11config.status
12configure
13openssh.xml
14opensshd.init
15scp
16sftp
17sftp-server
18ssh
19ssh-add
20ssh-agent
21ssh-keygen
22ssh-keyscan
23ssh-keysign
24ssh-pkcs11-helper
25sshd
26stamp-h.in
27survey
28survey.sh
diff --git a/ChangeLog b/ChangeLog
index 63aeae556..092cc48ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3817 +1,8584 @@
120131006 1commit 9f82e5a9042f2d872e98f48a876fcab3e25dd9bb
2 - (djm) Release OpenSSH-6.7 2Author: Tim Rice <tim@multitalents.net>
3 3Date: Mon Mar 16 22:49:20 2015 -0700
420141003
5 - (djm) [sshd_config.5] typo; from Iain Morgan
6
720141001
8 - (djm) [openbsd-compat/Makefile.in openbsd-compat/kludge-fd_set.c]
9 [openbsd-compat/openbsd-compat.h] Kludge around bad glibc
10 _FORTIFY_SOURCE check that doesn't grok heap-allocated fd_sets;
11 ok dtucker@
12
1320140910
14 - (djm) [sandbox-seccomp-filter.c] Allow mremap and exit for DietLibc;
15 patch from Felix von Leitner; ok dtucker
16
1720140908
18 - (dtucker) [INSTALL] Update info about egd. ok djm@
19
2020140904
21 - (djm) [openbsd-compat/arc4random.c] Zero seed after keying PRNG
22
2320140903
24 - (djm) [defines.h sshbuf.c] Move __predict_true|false to defines.h and
25 conditionalise to avoid duplicate definition.
26 - (djm) [contrib/cygwin/ssh-host-config] Fix old code leading to
27 permissions/ACLs; from Corinna Vinschen
28
2920140830
30 - (djm) [openbsd-compat/openssl-compat.h] add
31 OPENSSL_[RD]SA_MAX_MODULUS_BITS defines for OpenSSL that lacks them
32 - (djm) [misc.c] Missing newline between functions
33 - (djm) [openbsd-compat/openssl-compat.h] add include guard
34 - (djm) [Makefile.in] Make TEST_SHELL a variable; "good idea" tim@
35
3620140827
37 - (djm) [regress/unittests/sshbuf/test_sshbuf_getput_crypto.c]
38 [regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c]
39 [regress/unittests/sshkey/common.c]
40 [regress/unittests/sshkey/test_file.c]
41 [regress/unittests/sshkey/test_fuzz.c]
42 [regress/unittests/sshkey/test_sshkey.c] Don't include openssl/ec.h
43 on !ECC OpenSSL systems
44 - (djm) [monitor.c sshd.c] SIGXFSZ needs to be ignored in postauth
45 monitor, not preauth; bz#2263
46 - (djm) [openbsd-compat/explicit_bzero.c] implement explicit_bzero()
47 using memset_s() where possible; improve fallback to indirect bzero
48 via a volatile pointer to give it more of a chance to avoid being
49 optimised away.
50
5120140825
52 - (djm) [bufec.c] Skip this file on !ECC OpenSSL
53 - (djm) [INSTALL] Recommend libcrypto be built -fPIC, mention LibreSSL,
54 update OpenSSL version requirement.
55
5620140824
57 - (djm) [sftp-server.c] Some systems (e.g. Irix) have prctl() but not
58 PR_SET_DUMPABLE, so adjust ifdef; reported by Tom Christensen
59
6020140823
61 - (djm) [sshd.c] Ignore SIGXFSZ in preauth monitor child; can explode on
62 lastlog writing on platforms with high UIDs; bz#2263
63 - (djm) [configure.ac] We now require a working vsnprintf everywhere (not
64 just for systems that lack asprintf); check for it always and extend
65 test to catch more brokenness. Fixes builds on Solaris <= 9
66
6720140822
68 - (djm) [configure.ac] include leading zero characters in OpenSSL version
69 number; fixes test for unsupported versions
70 - (djm) [sshbuf-getput-crypto.c] Fix compilation when OpenSSL lacks ECC
71 - (djm) [openbsd-compat/bsd-snprintf.c] Fix compilation failure (prototype/
72 definition mismatch) and warning for broken/missing snprintf case.
73 - (djm) [configure.ac] double braces to appease autoconf
74
7520140821
76 - (djm) [Makefile.in] fix reference to libtest_helper.a in sshkey test too.
77 - (djm) [key.h] Fix ifdefs for no-ECC OpenSSL
78 - (djm) [regress/unittests/test_helper/test_helper.c] Fix for systems that
79 don't set __progname. Diagnosed by Tom Christensen.
80
8120140820
82 - (djm) [configure.ac] Check OpenSSL version is supported at configure time;
83 suggested by Kevin Brott
84 - (djm) [Makefile.in] refer to libtest_helper.a by explicit path rather than
85 -L/-l; fixes linking problems on some platforms
86 - (djm) [sshkey.h] Fix compilation when OpenSSL lacks ECC
87 - (djm) [contrib/cygwin/README] Correct build instructions; from Corinna
88
8920140819
90 - (djm) [serverloop.c] Fix syntax error on Cygwin; from Corinna Vinschen
91 - (djm) [sshbuf.h] Fix compilation on systems without OPENSSL_HAS_ECC.
92 - (djm) [ssh-dss.c] Include openssl/dsa.h for DSA_SIG
93 - (djm) [INSTALL contrib/caldera/openssh.spec contrib/cygwin/README]
94 [contrib/redhat/openssh.spec contrib/suse/openssh.spec] Remove mentions
95 of TCP wrappers.
96
9720140811
98 - (djm) [myproposal.h] Make curve25519 KEX dependent on
99 HAVE_EVP_SHA256 instead of OPENSSL_HAS_ECC.
100
10120140810
102 - (djm) [README contrib/caldera/openssh.spec]
103 [contrib/redhat/openssh.spec contrib/suse/openssh.spec] Update versions
104
10520140801
106 - (djm) [regress/multiplex.sh] Skip test for non-OpenBSD netcat. We need
107 a better solution, but this will have to do for now.
108 - (djm) [regress/multiplex.sh] Instruct nc not to quit as soon as stdin
109 is closed; avoid regress failures when stdin is /dev/null
110 - (djm) [regress/multiplex.sh] Use -d (detach stdin) flag to disassociate
111 nc from stdin, it's more portable
112
11320140730
114 - OpenBSD CVS Sync
115 - millert@cvs.openbsd.org 2014/07/24 22:57:10
116 [ssh.1]
117 Mention UNIX-domain socket forwarding too. OK jmc@ deraadt@
118 - dtucker@cvs.openbsd.org 2014/07/25 21:22:03
119 [ssh-agent.c]
120 Clear buffer used for handling messages. This prevents keys being
121 left in memory after they have been expired or deleted in some cases
122 (but note that ssh-agent is setgid so you would still need root to
123 access them). Pointed out by Kevin Burns, ok deraadt
124 - schwarze@cvs.openbsd.org 2014/07/28 15:40:08
125 [sftp-server.8 sshd_config.5]
126 some systems no longer need /dev/log;
127 issue noticed by jirib;
128 ok deraadt
129
13020140725
131 - (djm) [regress/multiplex.sh] restore incorrectly deleted line;
132 pointed out by Christian Hesse
133
13420140722
135 - (djm) [regress/multiplex.sh] ssh mux master lost -N somehow;
136 put it back
137 - (djm) [regress/multiplex.sh] change the test for still-open Unix
138 domain sockets to be robust against nc implementations that produce
139 error messages.
140 - (dtucker) [regress/unittests/sshkey/test_{file,fuzz,sshkey}.c] Wrap ecdsa-
141 specific tests inside OPENSSL_HAS_ECC.
142 - (dtucker) OpenBSD CVS Sync
143 - dtucker@cvs.openbsd.org 2014/07/22 01:18:50
144 [key.c]
145 Prevent spam from key_load_private_pem during hostbased auth. ok djm@
146 - guenther@cvs.openbsd.org 2014/07/22 07:13:42
147 [umac.c]
148 Convert from <sys/endian.h> to the shiney new <endian.h>
149 ok dtucker@, who also confirmed that -portable handles this already
150 (ID sync only, includes.h pulls in endian.h if available.)
151 - djm@cvs.openbsd.org 2014/07/22 01:32:12
152 [regress/multiplex.sh]
153 change the test for still-open Unix domain sockets to be robust against
154 nc implementations that produce error messages. from -portable
155 (Id sync only)
156 - dtucker@cvs.openbsd.org 2014/07/22 23:23:22
157 [regress/unittests/sshkey/mktestdata.sh]
158 Sign test certs with ed25519 instead of ecdsa so that they'll work in
159 -portable on platforms that don't have ECDSA in their OpenSSL. ok djm
160 - dtucker@cvs.openbsd.org 2014/07/22 23:57:40
161 [regress/unittests/sshkey/mktestdata.sh]
162 Add $OpenBSD tag to make syncs easier
163 - dtucker@cvs.openbsd.org 2014/07/22 23:35:38
164 [regress/unittests/sshkey/testdata/*]
165 Regenerate test keys with certs signed with ed25519 instead of ecdsa.
166 These can be used in -portable on platforms that don't support ECDSA.
167
16820140721
169 - OpenBSD CVS Sync
170 - millert@cvs.openbsd.org 2014/07/15 15:54:15
171 [forwarding.sh multiplex.sh]
172 Add support for Unix domain socket forwarding. A remote TCP port
173 may be forwarded to a local Unix domain socket and vice versa or
174 both ends may be a Unix domain socket. This is a reimplementation
175 of the streamlocal patches by William Ahern from:
176 http://www.25thandclement.com/~william/projects/streamlocal.html
177 OK djm@ markus@
178 - (djm) [regress/multiplex.sh] Not all netcat accept the -N option.
179 - (dtucker) [sshkey.c] ifdef out unused variable when compiling without
180 OPENSSL_HAS_ECC.
181
18220140721
183 - (dtucker) [cipher.c openbsd-compat/openssl-compat.h] Restore the bits
184 needed to build AES CTR mode against OpenSSL 0.9.8f and above. ok djm
185 - (dtucker) [regress/unittests/sshkey/
186 {common,test_file,test_fuzz,test_sshkey}.c] Wrap stdint.h includes in
187 ifdefs.
188
18920140719
190 - (tim) [openbsd-compat/port-uw.c] Include misc.h for fwd_opts, used
191 in servconf.h.
192
19320140718
194 - OpenBSD CVS Sync
195 - millert@cvs.openbsd.org 2014/07/15 15:54:14
196 [PROTOCOL auth-options.c auth-passwd.c auth-rh-rsa.c auth-rhosts.c]
197 [auth-rsa.c auth.c auth1.c auth2-hostbased.c auth2-kbdint.c auth2-none.c]
198 [auth2-passwd.c auth2-pubkey.c auth2.c canohost.c channels.c channels.h]
199 [clientloop.c misc.c misc.h monitor.c mux.c packet.c readconf.c]
200 [readconf.h servconf.c servconf.h serverloop.c session.c ssh-agent.c]
201 [ssh.c ssh_config.5 sshconnect.c sshconnect1.c sshconnect2.c sshd.c]
202 [sshd_config.5 sshlogin.c]
203 Add support for Unix domain socket forwarding. A remote TCP port
204 may be forwarded to a local Unix domain socket and vice versa or
205 both ends may be a Unix domain socket. This is a reimplementation
206 of the streamlocal patches by William Ahern from:
207 http://www.25thandclement.com/~william/projects/streamlocal.html
208 OK djm@ markus@
209 - jmc@cvs.openbsd.org 2014/07/16 14:48:57
210 [ssh.1]
211 add the streamlocal* options to ssh's -o list; millert says they're
212 irrelevant for scp/sftp;
213 ok markus millert
214 - djm@cvs.openbsd.org 2014/07/17 00:10:56
215 [sandbox-systrace.c]
216 ifdef SYS_sendsyslog so this will compile without patching on -stable
217 - djm@cvs.openbsd.org 2014/07/17 00:10:18
218 [mux.c]
219 preserve errno across syscall
220 - djm@cvs.openbsd.org 2014/07/17 00:12:03
221 [key.c]
222 silence "incorrect passphrase" error spam; reported and ok dtucker@
223 - djm@cvs.openbsd.org 2014/07/17 07:22:19
224 [mux.c ssh.c]
225 reflect stdio-forward ("ssh -W host:port ...") failures in exit status.
226 previously we were always returning 0. bz#2255 reported by Brendan
227 Germain; ok dtucker
228 - djm@cvs.openbsd.org 2014/07/18 02:46:01
229 [ssh-agent.c]
230 restore umask around listener socket creation (dropped in streamlocal patch
231 merge)
232 - (dtucker) [auth2-gss.c gss-serv-krb5.c] Include misc.h for fwd_opts, used
233 in servconf.h.
234 - (dtucker) [Makefile.in] Add a t-exec target to run just the executable
235 tests.
236 - (dtucker) [key.c sshkey.c] Put new ecdsa bits inside ifdef OPENSSL_HAS_ECC.
237
23820140717
239 - (djm) [digest-openssl.c] Preserve array order when disabling digests.
240 Reported by Petr Lautrbach.
241 - OpenBSD CVS Sync
242 - deraadt@cvs.openbsd.org 2014/07/11 08:09:54
243 [sandbox-systrace.c]
244 Permit use of SYS_sendsyslog from inside the sandbox. Clock is ticking,
245 update your kernels and sshd soon.. libc will start using sendsyslog()
246 in about 4 days.
247 - tedu@cvs.openbsd.org 2014/07/11 13:54:34
248 [myproposal.h]
249 by popular demand, add back hamc-sha1 to server proposal for better compat
250 with many clients still in use. ok deraadt
251
25220140715
253 - (djm) [configure.ac] Delay checks for arc4random* until after libcrypto
254 has been located; fixes builds agains libressl-portable
255
25620140711
257 - OpenBSD CVS Sync
258 - benno@cvs.openbsd.org 2014/07/09 14:15:56
259 [ssh-add.c]
260 fix ssh-add crash while loading more than one key
261 ok markus@
262 4
26320140709 5 portability fix: Solaris systems may not have a grep that understands -q
264 - OpenBSD CVS Sync
265 - djm@cvs.openbsd.org 2014/07/07 08:19:12
266 [ssh_config.5]
267 mention that ProxyCommand is executed using shell "exec" to avoid
268 a lingering process; bz#1977
269 - djm@cvs.openbsd.org 2014/07/09 01:45:10
270 [sftp.c]
271 more useful error message when GLOB_NOSPACE occurs;
272 bz#2254, patch from Orion Poplawski
273 - djm@cvs.openbsd.org 2014/07/09 03:02:15
274 [key.c]
275 downgrade more error() to debug() to better match what old authfile.c
276 did; suppresses spurious errors with hostbased authentication enabled
277 - djm@cvs.openbsd.org 2014/07/06 07:42:03
278 [multiplex.sh test-exec.sh]
279 add a hook to the cleanup() function to kill $SSH_PID if it is set
280
281 use it to kill the mux master started in multiplex.sh (it was being left
282 around on fatal failures)
283 - djm@cvs.openbsd.org 2014/07/07 08:15:26
284 [multiplex.sh]
285 remove forced-fatal that I stuck in there to test the new cleanup
286 logic and forgot to remove...
287
28820140706
289 - OpenBSD CVS Sync
290 - djm@cvs.openbsd.org 2014/07/03 23:18:35
291 [authfile.h]
292 remove leakmalloc droppings
293 - djm@cvs.openbsd.org 2014/07/05 23:11:48
294 [channels.c]
295 fix remote-forward cancel regression; ok markus@
296
29720140704
298 - OpenBSD CVS Sync
299 - jsing@cvs.openbsd.org 2014/07/03 12:42:16
300 [cipher-chachapoly.c]
301 Call chacha_ivsetup() immediately before chacha_encrypt_bytes() - this
302 makes it easier to verify that chacha_encrypt_bytes() is only called once
303 per chacha_ivsetup() call.
304 ok djm@
305 - djm@cvs.openbsd.org 2014/07/03 22:23:46
306 [sshconnect.c]
307 when rekeying, skip file/DNS lookup if it is the same as the key sent
308 during initial key exchange. bz#2154 patch from Iain Morgan; ok markus@
309 - djm@cvs.openbsd.org 2014/07/03 22:33:41
310 [channels.c]
311 allow explicit ::1 and 127.0.0.1 forwarding bind addresses when
312 GatewayPorts=no; allows client to choose address family;
313 bz#2222 ok markus@
314 - djm@cvs.openbsd.org 2014/07/03 22:40:43
315 [servconf.c servconf.h session.c sshd.8 sshd_config.5]
316 Add a sshd_config PermitUserRC option to control whether ~/.ssh/rc is
317 executed, mirroring the no-user-rc authorized_keys option;
318 bz#2160; ok markus@
319
32020140703
321 - (djm) [digest-openssl.c configure.ac] Disable RIPEMD160 if libcrypto
322 doesn't support it.
323 - (djm) [monitor_fdpass.c] Use sys/poll.h if poll.h doesn't exist;
324 bz#2237
325 - OpenBSD CVS Sync
326 - djm@cvs.openbsd.org 2014/07/03 01:45:38
327 [sshkey.c]
328 make Ed25519 keys' title fit properly in the randomart border; bz#2247
329 based on patch from Christian Hesse
330 - djm@cvs.openbsd.org 2014/07/03 03:11:03
331 [ssh-agent.c]
332 Only cleanup agent socket in the main agent process and not in any
333 subprocesses it may have started (e.g. forked askpass). Fixes
334 agent sockets being zapped when askpass processes fatal();
335 bz#2236 patch from Dmitry V. Levin
336 - djm@cvs.openbsd.org 2014/07/03 03:15:01
337 [ssh-add.c]
338 make stdout line-buffered; saves partial output getting lost when
339 ssh-add fatal()s part-way through (e.g. when listing keys from an
340 agent that supports key types that ssh-add doesn't);
341 bz#2234, reported by Phil Pennock
342 - djm@cvs.openbsd.org 2014/07/03 03:26:43
343 [digest-openssl.c]
344 use EVP_Digest() for one-shot hash instead of creating, updating,
345 finalising and destroying a context.
346 bz#2231, based on patch from Timo Teras
347 - djm@cvs.openbsd.org 2014/07/03 03:34:09
348 [gss-serv.c session.c ssh-keygen.c]
349 standardise on NI_MAXHOST for gethostname() string lengths; about
350 1/2 the cases were using it already. Fixes bz#2239 en passant
351 - djm@cvs.openbsd.org 2014/07/03 03:47:27
352 [ssh-keygen.c]
353 When hashing or removing hosts using ssh-keygen, don't choke on
354 @revoked markers and don't remove @cert-authority markers;
355 bz#2241, reported by mlindgren AT runelind.net
356 - djm@cvs.openbsd.org 2014/07/03 04:36:45
357 [digest.h]
358 forward-declare struct sshbuf so consumers don't need to include sshbuf.h
359 - djm@cvs.openbsd.org 2014/07/03 05:32:36
360 [ssh_config.5]
361 mention '%%' escape sequence in HostName directives and how it may
362 be used to specify IPv6 link-local addresses
363 - djm@cvs.openbsd.org 2014/07/03 05:38:17
364 [ssh.1]
365 document that -g will only work in the multiplexed case if applied to
366 the mux master
367 - djm@cvs.openbsd.org 2014/07/03 06:39:19
368 [ssh.c ssh_config.5]
369 Add a %C escape sequence for LocalCommand and ControlPath that expands
370 to a unique identifer based on a has of the tuple of (local host,
371 remote user, hostname, port).
372
373 Helps avoid exceeding sockaddr_un's miserly pathname limits for mux
374 control paths.
375
376 bz#2220, based on patch from mancha1 AT zoho.com; ok markus@
377 - jmc@cvs.openbsd.org 2014/07/03 07:45:27
378 [ssh_config.5]
379 escape %C since groff thinks it part of an Rs/Re block;
380 - djm@cvs.openbsd.org 2014/07/03 11:16:55
381 [auth.c auth.h auth1.c auth2.c]
382 make the "Too many authentication failures" message include the
383 user, source address, port and protocol in a format similar to the
384 authentication success / failure messages; bz#2199, ok dtucker
385
38620140702
387 - OpenBSD CVS Sync
388 - deraadt@cvs.openbsd.org 2014/06/13 08:26:29
389 [sandbox-systrace.c]
390 permit SYS_getentropy
391 from matthew
392 - matthew@cvs.openbsd.org 2014/06/18 02:59:13
393 [sandbox-systrace.c]
394 Now that we have a dedicated getentropy(2) system call for
395 arc4random(3), we can disallow __sysctl(2) in OpenSSH's systrace
396 sandbox.
397
398 ok djm
399 - naddy@cvs.openbsd.org 2014/06/18 15:42:09
400 [sshbuf-getput-crypto.c]
401 The ssh_get_bignum functions must accept the same range of bignums
402 the corresponding ssh_put_bignum functions create. This fixes the
403 use of 16384-bit RSA keys (bug reported by Eivind Evensen).
404 ok djm@
405 - djm@cvs.openbsd.org 2014/06/24 00:52:02
406 [krl.c]
407 fix bug in KRL generation: multiple consecutive revoked certificate
408 serial number ranges could be serialised to an invalid format.
409
410 Readers of a broken KRL caused by this bug will fail closed, so no
411 should-have-been-revoked key will be accepted.
412 - djm@cvs.openbsd.org 2014/06/24 01:13:21
413 [Makefile.in auth-bsdauth.c auth-chall.c auth-options.c auth-rsa.c
414 [auth2-none.c auth2-pubkey.c authfile.c authfile.h cipher-3des1.c
415 [cipher-chachapoly.c cipher-chachapoly.h cipher.c cipher.h
416 [digest-libc.c digest-openssl.c digest.h dns.c entropy.c hmac.h
417 [hostfile.c key.c key.h krl.c monitor.c packet.c rsa.c rsa.h
418 [ssh-add.c ssh-agent.c ssh-dss.c ssh-ecdsa.c ssh-ed25519.c
419 [ssh-keygen.c ssh-pkcs11-client.c ssh-pkcs11-helper.c ssh-pkcs11.c
420 [ssh-rsa.c sshbuf-misc.c sshbuf.h sshconnect.c sshconnect1.c
421 [sshconnect2.c sshd.c sshkey.c sshkey.h
422 [openbsd-compat/openssl-compat.c openbsd-compat/openssl-compat.h]
423 New key API: refactor key-related functions to be more library-like,
424 existing API is offered as a set of wrappers.
425
426 with and ok markus@
427
428 Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
429 Dempsky and Ron Bowes for a detailed review a few months ago.
430 NB. This commit also removes portable OpenSSH support for OpenSSL
431 <0.9.8e.
432 - djm@cvs.openbsd.org 2014/06/24 02:19:48
433 [ssh.c]
434 don't fatal() when hostname canonicalisation fails with a
435 ProxyCommand in use; continue and allow the ProxyCommand to
436 connect anyway (e.g. to a host with a name outside the DNS
437 behind a bastion)
438 - djm@cvs.openbsd.org 2014/06/24 02:21:01
439 [scp.c]
440 when copying local->remote fails during read, don't send uninitialised
441 heap to the remote end. Reported by Jann Horn
442 - deraadt@cvs.openbsd.org 2014/06/25 14:16:09
443 [sshbuf.c]
444 unblock SIGSEGV before raising it
445 ok djm
446 - markus@cvs.openbsd.org 2014/06/27 16:41:56
447 [channels.c channels.h clientloop.c ssh.c]
448 fix remote fwding with same listen port but different listen address
449 with gerhard@, ok djm@
450 - markus@cvs.openbsd.org 2014/06/27 18:50:39
451 [ssh-add.c]
452 fix loading of private keys
453 - djm@cvs.openbsd.org 2014/06/30 12:54:39
454 [key.c]
455 suppress spurious error message when loading key with a passphrase;
456 reported by kettenis@ ok markus@
457 - djm@cvs.openbsd.org 2014/07/02 04:59:06
458 [cipher-3des1.c]
459 fix ssh protocol 1 on the server that regressed with the sshkey change
460 (sometimes fatal() after auth completed), make file return useful status
461 codes.
462 NB. Id sync only for these two. They were bundled into the sshkey merge
463 above, since it was easier to sync the entire file and then apply
464 portable-specific changed atop it.
465 - djm@cvs.openbsd.org 2014/04/30 05:32:00
466 [regress/Makefile]
467 unit tests for new buffer API; including basic fuzz testing
468 NB. Id sync only.
469 - djm@cvs.openbsd.org 2014/05/21 07:04:21
470 [regress/integrity.sh]
471 when failing because of unexpected output, show the offending output
472 - djm@cvs.openbsd.org 2014/06/24 01:04:43
473 [regress/krl.sh]
474 regress test for broken consecutive revoked serial number ranges
475 - djm@cvs.openbsd.org 2014/06/24 01:14:17
476 [Makefile.in regress/Makefile regress/unittests/Makefile]
477 [regress/unittests/sshkey/Makefile]
478 [regress/unittests/sshkey/common.c]
479 [regress/unittests/sshkey/common.h]
480 [regress/unittests/sshkey/mktestdata.sh]
481 [regress/unittests/sshkey/test_file.c]
482 [regress/unittests/sshkey/test_fuzz.c]
483 [regress/unittests/sshkey/test_sshkey.c]
484 [regress/unittests/sshkey/tests.c]
485 [regress/unittests/sshkey/testdata/dsa_1]
486 [regress/unittests/sshkey/testdata/dsa_1-cert.fp]
487 [regress/unittests/sshkey/testdata/dsa_1-cert.pub]
488 [regress/unittests/sshkey/testdata/dsa_1.fp]
489 [regress/unittests/sshkey/testdata/dsa_1.fp.bb]
490 [regress/unittests/sshkey/testdata/dsa_1.param.g]
491 [regress/unittests/sshkey/testdata/dsa_1.param.priv]
492 [regress/unittests/sshkey/testdata/dsa_1.param.pub]
493 [regress/unittests/sshkey/testdata/dsa_1.pub]
494 [regress/unittests/sshkey/testdata/dsa_1_pw]
495 [regress/unittests/sshkey/testdata/dsa_2]
496 [regress/unittests/sshkey/testdata/dsa_2.fp]
497 [regress/unittests/sshkey/testdata/dsa_2.fp.bb]
498 [regress/unittests/sshkey/testdata/dsa_2.pub]
499 [regress/unittests/sshkey/testdata/dsa_n]
500 [regress/unittests/sshkey/testdata/dsa_n_pw]
501 [regress/unittests/sshkey/testdata/ecdsa_1]
502 [regress/unittests/sshkey/testdata/ecdsa_1-cert.fp]
503 [regress/unittests/sshkey/testdata/ecdsa_1-cert.pub]
504 [regress/unittests/sshkey/testdata/ecdsa_1.fp]
505 [regress/unittests/sshkey/testdata/ecdsa_1.fp.bb]
506 [regress/unittests/sshkey/testdata/ecdsa_1.param.curve]
507 [regress/unittests/sshkey/testdata/ecdsa_1.param.priv]
508 [regress/unittests/sshkey/testdata/ecdsa_1.param.pub]
509 [regress/unittests/sshkey/testdata/ecdsa_1.pub]
510 [regress/unittests/sshkey/testdata/ecdsa_1_pw]
511 [regress/unittests/sshkey/testdata/ecdsa_2]
512 [regress/unittests/sshkey/testdata/ecdsa_2.fp]
513 [regress/unittests/sshkey/testdata/ecdsa_2.fp.bb]
514 [regress/unittests/sshkey/testdata/ecdsa_2.param.curve]
515 [regress/unittests/sshkey/testdata/ecdsa_2.param.priv]
516 [regress/unittests/sshkey/testdata/ecdsa_2.param.pub]
517 [regress/unittests/sshkey/testdata/ecdsa_2.pub]
518 [regress/unittests/sshkey/testdata/ecdsa_n]
519 [regress/unittests/sshkey/testdata/ecdsa_n_pw]
520 [regress/unittests/sshkey/testdata/ed25519_1]
521 [regress/unittests/sshkey/testdata/ed25519_1-cert.fp]
522 [regress/unittests/sshkey/testdata/ed25519_1-cert.pub]
523 [regress/unittests/sshkey/testdata/ed25519_1.fp]
524 [regress/unittests/sshkey/testdata/ed25519_1.fp.bb]
525 [regress/unittests/sshkey/testdata/ed25519_1.pub]
526 [regress/unittests/sshkey/testdata/ed25519_1_pw]
527 [regress/unittests/sshkey/testdata/ed25519_2]
528 [regress/unittests/sshkey/testdata/ed25519_2.fp]
529 [regress/unittests/sshkey/testdata/ed25519_2.fp.bb]
530 [regress/unittests/sshkey/testdata/ed25519_2.pub]
531 [regress/unittests/sshkey/testdata/pw]
532 [regress/unittests/sshkey/testdata/rsa1_1]
533 [regress/unittests/sshkey/testdata/rsa1_1.fp]
534 [regress/unittests/sshkey/testdata/rsa1_1.fp.bb]
535 [regress/unittests/sshkey/testdata/rsa1_1.param.n]
536 [regress/unittests/sshkey/testdata/rsa1_1.pub]
537 [regress/unittests/sshkey/testdata/rsa1_1_pw]
538 [regress/unittests/sshkey/testdata/rsa1_2]
539 [regress/unittests/sshkey/testdata/rsa1_2.fp]
540 [regress/unittests/sshkey/testdata/rsa1_2.fp.bb]
541 [regress/unittests/sshkey/testdata/rsa1_2.param.n]
542 [regress/unittests/sshkey/testdata/rsa1_2.pub]
543 [regress/unittests/sshkey/testdata/rsa_1]
544 [regress/unittests/sshkey/testdata/rsa_1-cert.fp]
545 [regress/unittests/sshkey/testdata/rsa_1-cert.pub]
546 [regress/unittests/sshkey/testdata/rsa_1.fp]
547 [regress/unittests/sshkey/testdata/rsa_1.fp.bb]
548 [regress/unittests/sshkey/testdata/rsa_1.param.n]
549 [regress/unittests/sshkey/testdata/rsa_1.param.p]
550 [regress/unittests/sshkey/testdata/rsa_1.param.q]
551 [regress/unittests/sshkey/testdata/rsa_1.pub]
552 [regress/unittests/sshkey/testdata/rsa_1_pw]
553 [regress/unittests/sshkey/testdata/rsa_2]
554 [regress/unittests/sshkey/testdata/rsa_2.fp]
555 [regress/unittests/sshkey/testdata/rsa_2.fp.bb]
556 [regress/unittests/sshkey/testdata/rsa_2.param.n]
557 [regress/unittests/sshkey/testdata/rsa_2.param.p]
558 [regress/unittests/sshkey/testdata/rsa_2.param.q]
559 [regress/unittests/sshkey/testdata/rsa_2.pub]
560 [regress/unittests/sshkey/testdata/rsa_n]
561 [regress/unittests/sshkey/testdata/rsa_n_pw]
562 unit and fuzz tests for new key API
563 - (djm) [sshkey.c] Conditionalise inclusion of util.h
564 - (djm) [regress/Makefile] fix execution of sshkey unit/fuzz test
565
56620140618
567 - (tim) [openssh/session.c] Work around to get chroot sftp working on UnixWare
568
56920140617
570 - (dtucker) [entropy.c openbsd-compat/openssl-compat.{c,h}
571 openbsd-compat/regress/{.cvsignore,Makefile.in,opensslvertest.c}]
572 Move the OpenSSL header/library version test into its own function and add
573 tests for it. Fix it to allow fix version upgrades (but not downgrades).
574 Prompted by chl@ via OpenSMTPD (issue #462) and Debian (bug #748150).
575 ok djm@ chl@
576
57720140616
578 - (dtucker) [defines.h] Fix undef of _PATH_MAILDIR. From rak at debian via
579 OpenSMTPD and chl@
580
58120140612
582 - (dtucker) [configure.ac] Remove tcpwrappers support, support has already
583 been removed from sshd.c.
584
58520140611
586 - (dtucker) [defines.h] Add va_copy if we don't already have it, taken from
587 openbsd-compat/bsd-asprintf.c.
588 - (dtucker) [regress/unittests/sshbuf/*.c regress/unittests/test_helper/*]
589 Wrap stdlib.h include an ifdef for platforms that don't have it.
590 - (tim) [regress/unittests/test_helper/test_helper.h] Add includes.h for
591 u_intXX_t types.
592
59320140610
594 - (dtucker) [regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
595 regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c] Only do NISTP256
596 curve tests if OpenSSL has them.
597 - (dtucker) [myprosal.h] Don't include curve25519-sha256@libssh.org in
598 the proposal if the version of OpenSSL we're using doesn't support ECC.
599 - (dtucker) [regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c] ifdef
600 ECC variable too.
601 - (dtucker) OpenBSD CVS Sync
602 - djm@cvs.openbsd.org 2014/06/05 22:17:50
603 [sshconnect2.c]
604 fix inverted test that caused PKCS#11 keys that were explicitly listed
605 not to be preferred. Reported by Dirk-Willem van Gulik
606 - dtucker@cvs.openbsd.org 2014/06/10 21:46:11
607 [sshbuf.h]
608 Group ECC functions together to make things a little easier in -portable.
609 "doesn't bother me" deraadt@
610 - (dtucker) [sshbuf.h] Only declare ECC functions if building without
611 OpenSSL or if OpenSSL has ECC.
612 - (dtucker) [openbsd-compat/arc4random.c] Use explicit_bzero instead of an
613 assigment that might get optimized out. ok djm@
614 - (dtucker) [bufaux.c bufbn.c bufec.c buffer.c] Pull in includes.h for
615 compat stuff, specifically whether or not OpenSSL has ECC.
616
61720140527
618 - (djm) [cipher.c] Fix merge botch.
619 - (djm) [contrib/cygwin/ssh-host-config] Updated Cygwin ssh-host-config
620 from Corinna Vinschen, fixing a number of bugs and preparing for
621 Cygwin 1.7.30.
622 - (djm) [configure.ac openbsd-compat/bsd-cygwin_util.c]
623 [openbsd-compat/bsd-cygwin_util.h] On Cygwin, determine privilege
624 separation user at runtime, since it may need to be a domain account.
625 Patch from Corinna Vinschen.
626
62720140522
628 - (djm) [Makefile.in] typo in path
629
63020140521
631 - (djm) [commit configure.ac defines.h sshpty.c] don't attempt to use
632 vhangup on Linux. It doens't work for non-root users, and for them
633 it just messes up the tty settings.
634 - (djm) [misc.c] Use CLOCK_BOOTTIME in preference to CLOCK_MONOTONIC
635 when it is available. It takes into account time spent suspended,
636 thereby ensuring timeouts (e.g. for expiring agent keys) fire
637 correctly. bz#2228 reported by John Haxby
638
63920140519
640 - (djm) [rijndael.c rijndael.h] Sync with newly-ressurected versions ine
641 OpenBSD
642 - OpenBSD CVS Sync
643 - logan@cvs.openbsd.org 2014/04/20 09:24:26
644 [dns.c dns.h ssh-keygen.c]
645 Add support for SSHFP DNS records for ED25519 key types.
646 OK from djm@
647 - logan@cvs.openbsd.org 2014/04/21 14:36:16
648 [sftp-client.c sftp-client.h sftp.c]
649 Implement sftp upload resume support.
650 OK from djm@, with input from guenther@, mlarkin@ and
651 okan@
652 - logan@cvs.openbsd.org 2014/04/22 10:07:12
653 [sftp.c]
654 Sort the sftp command list.
655 OK from djm@
656 - logan@cvs.openbsd.org 2014/04/22 12:42:04
657 [sftp.1]
658 Document sftp upload resume.
659 OK from djm@, with feedback from okan@.
660 - jmc@cvs.openbsd.org 2014/04/22 14:16:30
661 [sftp.1]
662 zap eol whitespace;
663 - djm@cvs.openbsd.org 2014/04/23 12:42:34
664 [readconf.c]
665 don't record duplicate IdentityFiles
666 - djm@cvs.openbsd.org 2014/04/28 03:09:18
667 [authfile.c bufaux.c buffer.h channels.c krl.c mux.c packet.c packet.h]
668 [ssh-keygen.c]
669 buffer_get_string_ptr's return should be const to remind
670 callers that futzing with it will futz with the actual buffer
671 contents
672 - djm@cvs.openbsd.org 2014/04/29 13:10:30
673 [clientloop.c serverloop.c]
674 bz#1818 - don't send channel success/failre replies on channels that
675 have sent a close already; analysis and patch from Simon Tatham;
676 ok markus@
677 - markus@cvs.openbsd.org 2014/04/29 18:01:49
678 [auth.c authfd.c authfile.c bufaux.c cipher.c cipher.h hostfile.c]
679 [kex.c key.c mac.c monitor.c monitor_wrap.c myproposal.h packet.c]
680 [roaming_client.c ssh-agent.c ssh-keygen.c ssh-keyscan.c ssh-keysign.c]
681 [ssh-pkcs11.h ssh.c sshconnect.c sshconnect2.c sshd.c]
682 make compiling against OpenSSL optional (make OPENSSL=no);
683 reduces algorithms to curve25519, aes-ctr, chacha, ed25519;
684 allows us to explore further options; with and ok djm
685 - dtucker@cvs.openbsd.org 2014/04/29 19:58:50
686 [sftp.c]
687 Move nulling of variable next to where it's freed. ok markus@
688 - dtucker@cvs.openbsd.org 2014/04/29 20:36:51
689 [sftp.c]
690 Don't attempt to append a nul quote char to the filename. Should prevent
691 fatal'ing with "el_insertstr failed" when there's a single quote char
692 somewhere in the string. bz#2238, ok markus@
693 - djm@cvs.openbsd.org 2014/04/30 05:29:56
694 [bufaux.c bufbn.c bufec.c buffer.c buffer.h sshbuf-getput-basic.c]
695 [sshbuf-getput-crypto.c sshbuf-misc.c sshbuf.c sshbuf.h ssherr.c]
696 [ssherr.h]
697 New buffer API; the first installment of the conversion/replacement
698 of OpenSSH's internals to make them usable as a standalone library.
699
700 This includes a set of wrappers to make it compatible with the
701 existing buffer API so replacement can occur incrementally.
702
703 With and ok markus@
704
705 Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
706 Dempsky and Ron Bowes for a detailed review.
707 - naddy@cvs.openbsd.org 2014/04/30 19:07:48
708 [mac.c myproposal.h umac.c]
709 UMAC can use our local fallback implementation of AES when OpenSSL isn't
710 available. Glue code straight from Ted Krovetz's original umac.c.
711 ok markus@
712 - djm@cvs.openbsd.org 2014/05/02 03:27:54
713 [chacha.h cipher-chachapoly.h digest.h hmac.h kex.h kexc25519.c]
714 [misc.h poly1305.h ssh-pkcs11.c defines.h]
715 revert __bounded change; it causes way more problems for portable than
716 it solves; pointed out by dtucker@
717 - markus@cvs.openbsd.org 2014/05/03 17:20:34
718 [monitor.c packet.c packet.h]
719 unbreak compression, by re-init-ing the compression code in the
720 post-auth child. the new buffer code is more strict, and requires
721 buffer_init() while the old code was happy after a bzero();
722 originally from djm@
723 - logan@cvs.openbsd.org 2014/05/05 07:02:30
724 [sftp.c]
725 Zap extra whitespace.
726
727 OK from djm@ and dtucker@
728 - (djm) [configure.ac] Unconditionally define WITH_OPENSSL until we write
729 portability glue to support building without libcrypto
730 - (djm) [Makefile.in configure.ac sshbuf-getput-basic.c]
731 [sshbuf-getput-crypto.c sshbuf.c] compilation and portability fixes
732 - OpenBSD CVS Sync
733 - djm@cvs.openbsd.org 2014/03/13 20:44:49
734 [login-timeout.sh]
735 this test is a sorry mess of race conditions; add another sleep
736 to avoid a failure on slow machines (at least until I find a
737 better way)
738 - djm@cvs.openbsd.org 2014/04/21 22:15:37
739 [dhgex.sh integrity.sh kextype.sh rekey.sh try-ciphers.sh]
740 repair regress tests broken by server-side default cipher/kex/mac changes
741 by ensuring that the option under test is included in the server's
742 algorithm list
743 - dtucker@cvs.openbsd.org 2014/05/03 18:46:14
744 [proxy-connect.sh]
745 Add tests for with and without compression, with and without privsep.
746 - logan@cvs.openbsd.org 2014/05/04 10:40:59
747 [connect-privsep.sh]
748 Remove the Z flag from the list of malloc options as it
749 was removed from malloc.c 10 days ago.
750
751 OK from miod@
752 - (djm) [regress/unittests/Makefile]
753 [regress/unittests/Makefile.inc]
754 [regress/unittests/sshbuf/Makefile]
755 [regress/unittests/sshbuf/test_sshbuf.c]
756 [regress/unittests/sshbuf/test_sshbuf_fixed.c]
757 [regress/unittests/sshbuf/test_sshbuf_fuzz.c]
758 [regress/unittests/sshbuf/test_sshbuf_getput_basic.c]
759 [regress/unittests/sshbuf/test_sshbuf_getput_crypto.c]
760 [regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c]
761 [regress/unittests/sshbuf/test_sshbuf_misc.c]
762 [regress/unittests/sshbuf/tests.c]
763 [regress/unittests/test_helper/Makefile]
764 [regress/unittests/test_helper/fuzz.c]
765 [regress/unittests/test_helper/test_helper.c]
766 [regress/unittests/test_helper/test_helper.h]
767 Import new unit tests from OpenBSD; not yet hooked up to build.
768 - (djm) [regress/Makefile Makefile.in]
769 [regress/unittests/sshbuf/test_sshbuf.c
770 [regress/unittests/sshbuf/test_sshbuf_fixed.c]
771 [regress/unittests/sshbuf/test_sshbuf_fuzz.c]
772 [regress/unittests/sshbuf/test_sshbuf_getput_basic.c]
773 [regress/unittests/sshbuf/test_sshbuf_getput_crypto.c]
774 [regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c]
775 [regress/unittests/sshbuf/test_sshbuf_misc.c]
776 [regress/unittests/sshbuf/tests.c]
777 [regress/unittests/test_helper/fuzz.c]
778 [regress/unittests/test_helper/test_helper.c]
779 Hook new unit tests into the build and "make tests"
780 - (djm) [sshbuf.c] need __predict_false
781
78220140430
783 - (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already
784 have it. Only attempt to use __attribute__(__bounded__) for gcc.
785
78620140420
787 - OpenBSD CVS Sync
788 - djm@cvs.openbsd.org 2014/03/03 22:22:30
789 [session.c]
790 ignore enviornment variables with embedded '=' or '\0' characters;
791 spotted by Jann Horn; ok deraadt@
792 Id sync only - portable already has this.
793 - djm@cvs.openbsd.org 2014/03/12 04:44:58
794 [ssh-keyscan.c]
795 scan for Ed25519 keys by default too
796 - djm@cvs.openbsd.org 2014/03/12 04:50:32
797 [auth-bsdauth.c ssh-keygen.c]
798 don't count on things that accept arguments by reference to clear
799 things for us on error; most things do, but it's unsafe form.
800 - djm@cvs.openbsd.org 2014/03/12 04:51:12
801 [authfile.c]
802 correct test that kdf name is not "none" or "bcrypt"
803 - naddy@cvs.openbsd.org 2014/03/12 13:06:59
804 [ssh-keyscan.1]
805 scan for Ed25519 keys by default too
806 - deraadt@cvs.openbsd.org 2014/03/15 17:28:26
807 [ssh-agent.c ssh-keygen.1 ssh-keygen.c]
808 Improve usage() and documentation towards the standard form.
809 In particular, this line saves a lot of man page reading time.
810 usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
811 [-N new_passphrase] [-C comment] [-f output_keyfile]
812 ok schwarze jmc
813 - tedu@cvs.openbsd.org 2014/03/17 19:44:10
814 [ssh.1]
815 old descriptions of des and blowfish are old. maybe ok deraadt
816 - tedu@cvs.openbsd.org 2014/03/19 14:42:44
817 [scp.1]
818 there is no need for rcp anymore
819 ok deraadt millert
820 - markus@cvs.openbsd.org 2014/03/25 09:40:03
821 [myproposal.h]
822 trimm default proposals.
823
824 This commit removes the weaker pre-SHA2 hashes, the broken ciphers
825 (arcfour), and the broken modes (CBC) from the default configuration
826 (the patch only changes the default, all the modes are still available
827 for the config files).
828
829 ok djm@, reminded by tedu@ & naddy@ and discussed with many
830 - deraadt@cvs.openbsd.org 2014/03/26 17:16:26
831 [myproposal.h]
832 The current sharing of myproposal[] between both client and server code
833 makes the previous diff highly unpallatable. We want to go in that
834 direction for the server, but not for the client. Sigh.
835 Brought up by naddy.
836 - markus@cvs.openbsd.org 2014/03/27 23:01:27
837 [myproposal.h ssh-keyscan.c sshconnect2.c sshd.c]
838 disable weak proposals in sshd, but keep them in ssh; ok djm@
839 - djm@cvs.openbsd.org 2014/03/26 04:55:35
840 [chacha.h cipher-chachapoly.h digest.h hmac.h kex.h kexc25519.c
841 [misc.h poly1305.h ssh-pkcs11.c]
842 use __bounded(...) attribute recently added to sys/cdefs.h instead of
843 longform __attribute__(__bounded(...));
844
845 for brevity and a warning free compilation with llvm/clang
846 - tedu@cvs.openbsd.org 2014/03/26 19:58:37
847 [sshd.8 sshd.c]
848 remove libwrap support. ok deraadt djm mfriedl
849 - naddy@cvs.openbsd.org 2014/03/28 05:17:11
850 [ssh_config.5 sshd_config.5]
851 sync available and default algorithms, improve algorithm list formatting
852 help from jmc@ and schwarze@, ok deraadt@
853 - jmc@cvs.openbsd.org 2014/03/31 13:39:34
854 [ssh-keygen.1]
855 the text for the -K option was inserted in the wrong place in -r1.108;
856 fix From: Matthew Clarke
857 - djm@cvs.openbsd.org 2014/04/01 02:05:27
858 [ssh-keysign.c]
859 include fingerprint of key not found
860 use arc4random_buf() instead of loop+arc4random()
861 - djm@cvs.openbsd.org 2014/04/01 03:34:10
862 [sshconnect.c]
863 When using VerifyHostKeyDNS with a DNSSEC resolver, down-convert any
864 certificate keys to plain keys and attempt SSHFP resolution.
865
866 Prevents a server from skipping SSHFP lookup and forcing a new-hostkey
867 dialog by offering only certificate keys.
868
869 Reported by mcv21 AT cam.ac.uk
870 - djm@cvs.openbsd.org 2014/04/01 05:32:57
871 [packet.c]
872 demote a debug3 to PACKET_DEBUG; ok markus@
873 - djm@cvs.openbsd.org 2014/04/12 04:55:53
874 [sshd.c]
875 avoid crash at exit: check that pmonitor!=NULL before dereferencing;
876 bz#2225, patch from kavi AT juniper.net
877 - djm@cvs.openbsd.org 2014/04/16 23:22:45
878 [bufaux.c]
879 skip leading zero bytes in buffer_put_bignum2_from_string();
880 reported by jan AT mojzis.com; ok markus@
881 - djm@cvs.openbsd.org 2014/04/16 23:28:12
882 [ssh-agent.1]
883 remove the identity files from this manpage - ssh-agent doesn't deal
884 with them at all and the same information is duplicated in ssh-add.1
885 (which does deal with them); prodded by deraadt@
886 - djm@cvs.openbsd.org 2014/04/18 23:52:25
887 [compat.c compat.h sshconnect2.c sshd.c version.h]
888 OpenSSH 6.5 and 6.6 have a bug that causes ~0.2% of connections
889 using the curve25519-sha256@libssh.org KEX exchange method to fail
890 when connecting with something that implements the spec properly.
891
892 Disable this KEX method when speaking to one of the affected
893 versions.
894
895 reported by Aris Adamantiadis; ok markus@
896 - djm@cvs.openbsd.org 2014/04/19 05:54:59
897 [compat.c]
898 missing wildcard; pointed out by naddy@
899 - tedu@cvs.openbsd.org 2014/04/19 14:53:48
900 [ssh-keysign.c sshd.c]
901 Delete futile calls to RAND_seed. ok djm
902 NB. Id sync only. This only applies to OpenBSD's libcrypto slashathon
903 - tedu@cvs.openbsd.org 2014/04/19 18:15:16
904 [sshd.8]
905 remove some really old rsh references
906 - tedu@cvs.openbsd.org 2014/04/19 18:42:19
907 [ssh.1]
908 delete .xr to hosts.equiv. there's still an unfortunate amount of
909 documentation referring to rhosts equivalency in here.
910 - djm@cvs.openbsd.org 2014/04/20 02:30:25
911 [misc.c misc.h umac.c]
912 use get/put_u32 to load values rather than *((UINT32 *)p) that breaks on
913 strict-alignment architectures; reported by and ok stsp@
914 - djm@cvs.openbsd.org 2014/04/20 02:49:32
915 [compat.c]
916 add a canonical 6.6 + curve25519 bignum fix fake version that I can
917 recommend people use ahead of the openssh-6.7 release
918
91920140401
920 - (djm) On platforms that support it, use prctl() to prevent sftp-server
921 from accessing /proc/self/{mem,maps}; patch from jann AT thejh.net
922 - (djm) Use full release (e.g. 6.5p1) in debug output rather than just
923 version. From des@des.no
924
92520140317
926 - (djm) [sandbox-seccomp-filter.c] Soft-fail stat() syscalls. Add XXX to
927 remind myself to add sandbox violation logging via the log socket.
928
92920140314
930 - (tim) [opensshd.init.in] Add support for ed25519
931
93220140313
933 - (djm) Release OpenSSH 6.6
934
93520140304
936 - OpenBSD CVS Sync
937 - djm@cvs.openbsd.org 2014/03/03 22:22:30
938 [session.c]
939 ignore enviornment variables with embedded '=' or '\0' characters;
940 spotted by Jann Horn; ok deraadt@
941
94220140301
943 - (djm) [regress/Makefile] Disable dhgex regress test; it breaks when
944 no moduli file exists at the expected location.
945
94620140228
947 - OpenBSD CVS Sync
948 - djm@cvs.openbsd.org 2014/02/27 00:41:49
949 [bufbn.c]
950 fix unsigned overflow that could lead to reading a short ssh protocol
951 1 bignum value; found by Ben Hawkes; ok deraadt@
952 - djm@cvs.openbsd.org 2014/02/27 08:25:09
953 [bufbn.c]
954 off by one in range check
955 - djm@cvs.openbsd.org 2014/02/27 22:47:07
956 [sshd_config.5]
957 bz#2184 clarify behaviour of a keyword that appears in multiple
958 matching Match blocks; ok dtucker@
959 - djm@cvs.openbsd.org 2014/02/27 22:57:40
960 [version.h]
961 openssh-6.6
962 - dtucker@cvs.openbsd.org 2014/01/19 23:43:02
963 [regress/sftp-chroot.sh]
964 Don't use -q on sftp as it suppresses logging, instead redirect the
965 output to the regress logfile.
966 - dtucker@cvs.openbsd.org 2014/01/20 00:00:30
967 [sregress/ftp-chroot.sh]
968 append to rather than truncating the log file
969 - dtucker@cvs.openbsd.org 2014/01/25 04:35:32
970 [regress/Makefile regress/dhgex.sh]
971 Add a test for DH GEX sizes
972 - djm@cvs.openbsd.org 2014/01/26 10:22:10
973 [regress/cert-hostkey.sh]
974 automatically generate revoked keys from listed keys rather than
975 manually specifying each type; from portable
976 (Id sync only)
977 - djm@cvs.openbsd.org 2014/01/26 10:49:17
978 [scp-ssh-wrapper.sh scp.sh]
979 make sure $SCP is tested on the remote end rather than whichever one
980 happens to be in $PATH; from portable
981 (Id sync only)
982 - djm@cvs.openbsd.org 2014/02/27 20:04:16
983 [login-timeout.sh]
984 remove any existing LoginGraceTime from sshd_config before adding
985 a specific one for the test back in
986 - djm@cvs.openbsd.org 2014/02/27 21:21:25
987 [agent-ptrace.sh agent.sh]
988 keep return values that are printed in error messages;
989 from portable
990 (Id sync only)
991 - (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
992 [contrib/suse/openssh.spec] Crank version numbers
993 - (djm) [regress/host-expand.sh] Add RCS Id
994
99520140227
996 - OpenBSD CVS Sync
997 - djm@cvs.openbsd.org 2014/02/26 20:18:37
998 [ssh.c]
999 bz#2205: avoid early hostname lookups unless canonicalisation is enabled;
1000 ok dtucker@ markus@
1001 - djm@cvs.openbsd.org 2014/02/26 20:28:44
1002 [auth2-gss.c gss-serv.c ssh-gss.h sshd.c]
1003 bz#2107 - cache OIDs of supported GSSAPI mechanisms before privsep
1004 sandboxing, as running this code in the sandbox can cause violations;
1005 ok markus@
1006 - djm@cvs.openbsd.org 2014/02/26 20:29:29
1007 [channels.c]
1008 don't assume that the socks4 username is \0 terminated;
1009 spotted by Ben Hawkes; ok markus@
1010 - markus@cvs.openbsd.org 2014/02/26 21:53:37
1011 [sshd.c]
1012 ssh_gssapi_prepare_supported_oids needs GSSAPI
1013
101420140224
1015 - OpenBSD CVS Sync
1016 - djm@cvs.openbsd.org 2014/02/07 06:55:54
1017 [cipher.c mac.c]
1018 remove some logging that makes ssh debugging output very verbose;
1019 ok markus
1020 - djm@cvs.openbsd.org 2014/02/15 23:05:36
1021 [channels.c]
1022 avoid spurious "getsockname failed: Bad file descriptor" errors in ssh -W;
1023 bz#2200, debian#738692 via Colin Watson; ok dtucker@
1024 - djm@cvs.openbsd.org 2014/02/22 01:32:19
1025 [readconf.c]
1026 when processing Match blocks, skip 'exec' clauses if previous predicates
1027 failed to match; ok markus@
1028 - djm@cvs.openbsd.org 2014/02/23 20:03:42
1029 [ssh-ed25519.c]
1030 check for unsigned overflow; not reachable in OpenSSH but others might
1031 copy our code...
1032 - djm@cvs.openbsd.org 2014/02/23 20:11:36
1033 [readconf.c readconf.h ssh.c ssh_config.5]
1034 reparse ssh_config and ~/.ssh/config if hostname canonicalisation changes
1035 the hostname. This allows users to write configurations that always
1036 refer to canonical hostnames, e.g.
1037
1038 CanonicalizeHostname yes
1039 CanonicalDomains int.example.org example.org
1040 CanonicalizeFallbackLocal no
1041
1042 Host *.int.example.org
1043 Compression off
1044 Host *.example.org
1045 User djm
1046
1047 ok markus@
1048 6
104920140213 7commit 8ef691f7d9ef500257a549d0906d78187490668f
1050 - (dtucker) [configure.ac openbsd-compat/openssl-compat.{c,h}] Add compat 8Author: Damien Miller <djm@google.com>
1051 code for older OpenSSL versions that don't have EVP_MD_CTX_copy_ex. 9Date: Wed Mar 11 10:35:26 2015 +1100
1052
105320140207
1054 - OpenBSD CVS Sync
1055 - naddy@cvs.openbsd.org 2014/02/05 20:13:25
1056 [ssh-keygen.1 ssh-keygen.c]
1057 tweak synopsis: calling ssh-keygen without any arguments is fine; ok jmc@
1058 while here, fix ordering in usage(); requested by jmc@
1059 - djm@cvs.openbsd.org 2014/02/06 22:21:01
1060 [sshconnect.c]
1061 in ssh_create_socket(), only do the getaddrinfo for BindAddress when
1062 BindAddress is actually specified. Fixes regression in 6.5 for
1063 UsePrivilegedPort=yes; patch from Corinna Vinschen
1064
106520140206
1066 - (dtucker) [openbsd-compat/bsd-poll.c] Don't bother checking for non-NULL
1067 before freeing since free(NULL) is a no-op. ok djm.
1068 - (djm) [sandbox-seccomp-filter.c] Not all Linux architectures define
1069 __NR_shutdown; some go via the socketcall(2) multiplexer.
1070
107120140205
1072 - (djm) [sandbox-capsicum.c] Don't fatal if Capsicum is offered by
1073 headers/libc but not supported by the kernel. Patch from Loganaden
1074 Velvindron @ AfriNIC
1075
107620140204
1077 - OpenBSD CVS Sync
1078 - markus@cvs.openbsd.org 2014/01/27 18:58:14
1079 [Makefile.in digest.c digest.h hostfile.c kex.h mac.c hmac.c hmac.h]
1080 replace openssl HMAC with an implementation based on our ssh_digest_*
1081 ok and feedback djm@
1082 - markus@cvs.openbsd.org 2014/01/27 19:18:54
1083 [auth-rsa.c cipher.c ssh-agent.c sshconnect1.c sshd.c]
1084 replace openssl MD5 with our ssh_digest_*; ok djm@
1085 - markus@cvs.openbsd.org 2014/01/27 20:13:46
1086 [digest.c digest-openssl.c digest-libc.c Makefile.in]
1087 rename digest.c to digest-openssl.c and add libc variant; ok djm@
1088 - jmc@cvs.openbsd.org 2014/01/28 14:13:39
1089 [ssh-keyscan.1]
1090 kill some bad Pa;
1091 From: Jan Stary
1092 - djm@cvs.openbsd.org 2014/01/29 00:19:26
1093 [sshd.c]
1094 use kill(0, ...) instead of killpg(0, ...); on most operating systems
1095 they are equivalent, but SUSv2 describes the latter as having undefined
1096 behaviour; from portable; ok dtucker
1097 (Id sync only; change is already in portable)
1098 - djm@cvs.openbsd.org 2014/01/29 06:18:35
1099 [Makefile.in auth.h auth2-jpake.c auth2.c jpake.c jpake.h monitor.c]
1100 [monitor.h monitor_wrap.c monitor_wrap.h readconf.c readconf.h]
1101 [schnorr.c schnorr.h servconf.c servconf.h ssh2.h sshconnect2.c]
1102 remove experimental, never-enabled JPAKE code; ok markus@
1103 - jmc@cvs.openbsd.org 2014/01/29 14:04:51
1104 [sshd_config.5]
1105 document kbdinteractiveauthentication;
1106 requested From: Ross L Richardson
1107
1108 dtucker/markus helped explain its workings;
1109 - djm@cvs.openbsd.org 2014/01/30 22:26:14
1110 [sandbox-systrace.c]
1111 allow shutdown(2) syscall in sandbox - it may be called by packet_close()
1112 from portable
1113 (Id sync only; change is already in portable)
1114 - tedu@cvs.openbsd.org 2014/01/31 16:39:19
1115 [auth2-chall.c authfd.c authfile.c bufaux.c bufec.c canohost.c]
1116 [channels.c cipher-chachapoly.c clientloop.c configure.ac hostfile.c]
1117 [kexc25519.c krl.c monitor.c sandbox-systrace.c session.c]
1118 [sftp-client.c ssh-keygen.c ssh.c sshconnect2.c sshd.c sshlogin.c]
1119 [openbsd-compat/explicit_bzero.c openbsd-compat/openbsd-compat.h]
1120 replace most bzero with explicit_bzero, except a few that cna be memset
1121 ok djm dtucker
1122 - djm@cvs.openbsd.org 2014/02/02 03:44:32
1123 [auth1.c auth2-chall.c auth2-passwd.c authfile.c bufaux.c bufbn.c]
1124 [buffer.c cipher-3des1.c cipher.c clientloop.c gss-serv.c kex.c]
1125 [kexdhc.c kexdhs.c kexecdhc.c kexgexc.c kexecdhs.c kexgexs.c key.c]
1126 [monitor.c monitor_wrap.c packet.c readpass.c rsa.c serverloop.c]
1127 [ssh-add.c ssh-agent.c ssh-dss.c ssh-ecdsa.c ssh-ed25519.c]
1128 [ssh-keygen.c ssh-rsa.c sshconnect.c sshconnect1.c sshconnect2.c]
1129 [sshd.c]
1130 convert memset of potentially-private data to explicit_bzero()
1131 - djm@cvs.openbsd.org 2014/02/03 23:28:00
1132 [ssh-ecdsa.c]
1133 fix memory leak; ECDSA_SIG_new() allocates 'r' and 's' for us, unlike
1134 DSA_SIG_new. Reported by Batz Spear; ok markus@
1135 - djm@cvs.openbsd.org 2014/02/02 03:44:31
1136 [digest-libc.c digest-openssl.c]
1137 convert memset of potentially-private data to explicit_bzero()
1138 - djm@cvs.openbsd.org 2014/02/04 00:24:29
1139 [ssh.c]
1140 delay lowercasing of hostname until right before hostname
1141 canonicalisation to unbreak case-sensitive matching of ssh_config;
1142 reported by Ike Devolder; ok markus@
1143 - (djm) [openbsd-compat/Makefile.in] Add missing explicit_bzero.o
1144 - (djm) [regress/setuid-allowed.c] Missing string.h for strerror()
1145
114620140131
1147 - (djm) [sandbox-seccomp-filter.c sandbox-systrace.c] Allow shutdown(2)
1148 syscall from sandboxes; it may be called by packet_close.
1149 - (dtucker) [readconf.c] Include <arpa/inet.h> for the hton macros. Fixes
1150 build with HP-UX's compiler. Patch from Kevin Brott.
1151 - (tim) [Makefile.in] build regress/setuid-allow.
1152
115320140130
1154 - (djm) [configure.ac] Only check for width-specified integer types
1155 in headers that actually exist. patch from Tom G. Christensen;
1156 ok dtucker@
1157 - (djm) [configure.ac atomicio.c] Kludge around NetBSD offering
1158 different symbols for 'read' when various compiler flags are
1159 in use, causing atomicio.c comparisons against it to break and
1160 read/write operations to hang; ok dtucker
1161 - (djm) Release openssh-6.5p1
1162
116320140129
1164 - (djm) [configure.ac] Fix broken shell test '==' vs '='; patch from
1165 Tom G. Christensen
1166
116720140128
1168 - (djm) [configure.ac] Search for inet_ntop in libnsl and libresovl;
1169 ok dtucker
1170 - (djm) [sshd.c] Use kill(0, ...) instead of killpg(0, ...); the
1171 latter being specified to have undefined behaviour in SUSv3;
1172 ok dtucker
1173 - (tim) [regress/agent.sh regress/agent-ptrace.sh] Assign $? to a variable
1174 when used as an error message inside an if statement so we display the
1175 correct into. agent.sh patch from Petr Lautrbach.
1176
117720140127
1178 - (dtucker) [Makefile.in] Remove trailing backslash which some make
1179 implementations (eg older Solaris) do not cope with.
1180
118120140126
1182 - OpenBSD CVS Sync
1183 - dtucker@cvs.openbsd.org 2014/01/25 10:12:50
1184 [cipher.c cipher.h kex.c kex.h kexgexc.c]
1185 Add a special case for the DH group size for 3des-cbc, which has an
1186 effective strength much lower than the key size. This causes problems
1187 with some cryptlib implementations, which don't support group sizes larger
1188 than 4k but also don't use the largest group size it does support as
1189 specified in the RFC. Based on a patch from Petr Lautrbach at Redhat,
1190 reduced by me with input from Markus. ok djm@ markus@
1191 - markus@cvs.openbsd.org 2014/01/25 20:35:37
1192 [kex.c]
1193 dh_need needs to be set to max(seclen, blocksize, ivlen, mac_len)
1194 ok dtucker@, noted by mancha
1195 - (djm) [configure.ac sandbox-capsicum.c sandbox-rlimit.c] Disable
1196 RLIMIT_NOFILE pseudo-sandbox on FreeBSD. In some configurations,
1197 libc will attempt to open additional file descriptors for crypto
1198 offload and crash if they cannot be opened.
1199 - (djm) [configure.ac] correct AC_DEFINE for previous.
1200
120120140125
1202 - (djm) [configure.ac] Fix detection of capsicum sandbox on FreeBSD
1203 - (djm) [configure.ac] Do not attempt to use capsicum sandbox unless
1204 sys/capability.h exists and cap_rights_limit is in libc. Fixes
1205 build on FreeBSD9x which provides the header but not the libc
1206 support.
1207 - (djm) [configure.ac] autoconf sets finds to 'yes' not '1', so test
1208 against the correct thing.
1209
121020140124
1211 - (djm) [Makefile.in regress/scp-ssh-wrapper.sh regress/scp.sh] Make
1212 the scp regress test actually test the built scp rather than the one
1213 in $PATH. ok dtucker@
1214
121520140123
1216 - (tim) [session.c] Improve error reporting on set_id().
1217 - (dtucker) [configure.ac] NetBSD's (and FreeBSD's) strnvis is gratuitously
1218 incompatible with OpenBSD's despite post-dating it by more than a decade.
1219 Declare it as broken, and document FreeBSD's as the same. ok djm@
1220
122120140122
1222 - (djm) [openbsd-compat/setproctitle.c] Don't fail to compile if a
1223 platform that is expected to use the reuse-argv style setproctitle
1224 hack surprises us by providing a setproctitle in libc; ok dtucker
1225 - (djm) [configure.ac] Unless specifically requested, only attempt
1226 to build Position Independent Executables on gcc >= 4.x; ok dtucker
1227 - (djm) [configure.ac aclocal.m4] More tests to detect fallout from
1228 platform hardening options: include some long long int arithmatic
1229 to detect missing support functions for -ftrapv in libgcc and
1230 equivalents, actually test linking when -ftrapv is supplied and
1231 set either both -pie/-fPIE or neither. feedback and ok dtucker@
1232
123320140121
1234 - (dtucker) [configure.ac] Make PIE a configure-time option which defaults
1235 to on platforms where it's known to be reliably detected and off elsewhere.
1236 Works around platforms such as FreeBSD 9.1 where it does not interop with
1237 -ftrapv (it seems to work but fails when trying to link ssh). ok djm@
1238 - (dtucker) [aclocal.m4] Differentiate between compile-time and link-time
1239 tests in the configure output. ok djm.
1240 - (tim) [platform.c session.c] Fix bug affecting SVR5 platforms introduced
1241 with sftp chroot support. Move set_id call after chroot.
1242 - (djm) [aclocal.m4] Flesh out the code run in the OSSH_CHECK_CFLAG_COMPILE
1243 and OSSH_CHECK_LDFLAG_LINK tests to give them a better chance of
1244 detecting toolchain-related problems; ok dtucker
1245
124620140120
1247 - (dtucker) [gss-serv-krb5.c] Fall back to krb5_cc_gen_new if the Kerberos
1248 implementation does not have krb5_cc_new_unique, similar to what we do
1249 in auth-krb5.c.
1250 - (djm) [regress/cert-hostkey.sh] Fix regress failure on platforms that
1251 skip one or more key types (e.g. RHEL/CentOS 6.5); ok dtucker@
1252 - (djm) OpenBSD CVS Sync
1253 - djm@cvs.openbsd.org 2014/01/20 00:08:48
1254 [digest.c]
1255 memleak; found by Loganaden Velvindron @ AfriNIC; ok markus@
1256
125720140119
1258 - (dtucker) OpenBSD CVS Sync
1259 - dtucker@cvs.openbsd.org 2014/01/17 06:23:24
1260 [sftp-server.c]
1261 fix log message statvfs. ok djm
1262 - dtucker@cvs.openbsd.org 2014/01/18 09:36:26
1263 [session.c]
1264 explicitly define USE_PIPES to 1 to prevent redefinition warnings in
1265 portable on platforms that use pipes for everything. From vinschen at
1266 redhat.
1267 - dtucker@cvs.openbsd.org 2014/01/19 04:17:29
1268 [canohost.c addrmatch.c]
1269 Cast socklen_t when comparing to size_t and use socklen_t to iterate over
1270 the ip options, both to prevent signed/unsigned comparison warnings.
1271 Patch from vinschen at redhat via portable openssh, begrudging ok deraadt.
1272 - djm@cvs.openbsd.org 2014/01/19 04:48:08
1273 [ssh_config.5]
1274 fix inverted meaning of 'no' and 'yes' for CanonicalizeFallbackLocal
1275 - dtucker@cvs.openbsd.org 2014/01/19 11:21:51
1276 [addrmatch.c]
1277 Cast the sizeof to socklen_t so it'll work even if the supplied len is
1278 negative. Suggested by and ok djm, ok deraadt.
1279
128020140118
1281 - (dtucker) [uidswap.c] Prevent unused variable warnings on Cygwin. Patch
1282 from vinschen at redhat.com
1283 - (dtucker) [openbsd-compat/bsd-cygwin_util.h] Add missing function
1284 declarations that stopped being included when we stopped including
1285 <windows.h> from openbsd-compat/bsd-cygwin_util.h. Patch from vinschen at
1286 redhat.com.
1287 - (dtucker) [configure.ac] On Cygwin the getopt variables (like optargs,
1288 optind) are defined in getopt.h already. Unfortunately they are defined as
1289 "declspec(dllimport)" for historical reasons, because the GNU linker didn't
1290 allow auto-import on PE/COFF targets way back when. The problem is the
1291 dllexport attributes collide with the definitions in the various source
1292 files in OpenSSH, which obviousy define the variables without
1293 declspec(dllimport). The least intrusive way to get rid of these warnings
1294 is to disable warnings for GCC compiler attributes when building on Cygwin.
1295 Patch from vinschen at redhat.com.
1296 - (dtucker) [sandbox-capsicum.c] Correct some error messages and make the
1297 return value check for cap_enter() consistent with the other uses in
1298 FreeBSD. From by Loganaden Velvindron @ AfriNIC via bz#2140.
1299
130020140117
1301 - (dtucker) [aclocal.m4 configure.ac] Add some additional compiler/toolchain
1302 hardening flags including -fstack-protector-strong. These default to on
1303 if the toolchain supports them, but there is a configure-time knob
1304 (--without-hardening) to disable them if necessary. ok djm@
1305 - (djm) [sftp-client.c] signed/unsigned comparison fix
1306 - (dtucker) [loginrec.c] Cast to the types specfied in the format
1307 specification to prevent warnings.
1308 - (dtucker) [crypto_api.h] Wrap stdlib.h include inside #ifdef HAVE_STDINT_H.
1309 - (dtucker) [poly1305.c] Wrap stdlib.h include inside #ifdef HAVE_STDINT_H.
1310 - (dtucker) [blocks.c fe25519.c ge25519.c hash.c sc25519.c verify.c] Include
1311 includes.h to pull in all of the compatibility stuff.
1312 - (dtucker) [openbsd-compat/bcrypt_pbkdf.c] Wrap stdlib.h include inside
1313 #ifdef HAVE_STDINT_H.
1314 - (dtucker) [defines.h] Add typedefs for uintXX_t types for platforms that
1315 don't have them.
1316 - (dtucker) [configure.ac] Split AC_CHECK_FUNCS for OpenSSL functions into
1317 separate lines and alphabetize for easier diffing of changes.
1318 - (dtucker) OpenBSD CVS Sync
1319 - djm@cvs.openbsd.org 2014/01/17 00:21:06
1320 [sftp-client.c]
1321 signed/unsigned comparison warning fix; from portable (Id sync only)
1322 - dtucker@cvs.openbsd.org 2014/01/17 05:26:41
1323 [digest.c]
1324 remove unused includes. ok djm@
1325 - (djm) [Makefile.in configure.ac sandbox-capsicum.c sandbox-darwin.c]
1326 [sandbox-null.c sandbox-rlimit.c sandbox-seccomp-filter.c]
1327 [sandbox-systrace.c ssh-sandbox.h sshd.c] Support preauth sandboxing
1328 using the Capsicum API introduced in FreeBSD 10. Patch by Dag-Erling
1329 Smorgrav, updated by Loganaden Velvindron @ AfriNIC; ok dtucker@
1330 - (dtucker) [configure.ac digest.c openbsd-compat/openssl-compat.c
1331 openbsd-compat/openssl-compat.h] Add compatibility layer for older
1332 openssl versions. ok djm@
1333 - (dtucker) Fix typo in #ifndef.
1334 - (dtucker) [configure.ac openbsd-compat/bsd-statvfs.c
1335 openbsd-compat/bsd-statvfs.h] Implement enough of statvfs on top of statfs
1336 to be useful (and for the regression tests to pass) on platforms that
1337 have statfs and fstatfs. ok djm@
1338 - (dtucker) [openbsd-compat/bsd-statvfs.h] Only start including headers if we
1339 need them to cut down on the name collisions.
1340 - (dtucker) [configure.ac] Also look in inttypes.h for uintXX_t types.
1341 - (dtucker) [configure.ac] Have --without-hardening not turn off
1342 stack-protector since that has a separate flag that's been around a while.
1343 - (dtucker) [readconf.c] Wrap paths.h inside an ifdef. Allows building on
1344 Solaris.
1345 - (dtucker) [defines.h] Move our definitions of uintXX_t types down to after
1346 they're defined if we have to define them ourselves. Fixes builds on old
1347 AIX.
1348
134920140118
1350 - (djm) OpenBSD CVS Sync
1351 - djm@cvs.openbsd.org 2014/01/16 07:31:09
1352 [sftp-client.c]
1353 needless and incorrect cast to size_t can break resumption of
1354 large download; patch from tobias@
1355 - djm@cvs.openbsd.org 2014/01/16 07:32:00
1356 [version.h]
1357 openssh-6.5
1358 - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
1359 [contrib/suse/openssh.spec] Crank RPM spec version numbers.
1360 - (djm) [README] update release notes URL.
1361
136220140112
1363 - (djm) OpenBSD CVS Sync
1364 - djm@cvs.openbsd.org 2014/01/10 05:59:19
1365 [sshd_config]
1366 the /etc/ssh/ssh_host_ed25519_key is loaded by default too
1367 - djm@cvs.openbsd.org 2014/01/12 08:13:13
1368 [bufaux.c buffer.h kex.c kex.h kexc25519.c kexc25519c.c kexc25519s.c]
1369 [kexdhc.c kexdhs.c kexecdhc.c kexecdhs.c kexgexc.c kexgexs.c]
1370 avoid use of OpenSSL BIGNUM type and functions for KEX with
1371 Curve25519 by adding a buffer_put_bignum2_from_string() that stores
1372 a string using the bignum encoding rules. Will make it easier to
1373 build a reduced-feature OpenSSH without OpenSSL in the future;
1374 ok markus@
1375 10
137620140110 11 fix compile with clang
1377 - (djm) OpenBSD CVS Sync 12
1378 - tedu@cvs.openbsd.org 2014/01/04 17:50:55 13commit 4df590cf8dc799e8986268d62019b487a8ed63ad
1379 [mac.c monitor_mm.c monitor_mm.h xmalloc.c] 14Author: Damien Miller <djm@google.com>
1380 use standard types and formats for size_t like variables. ok dtucker 15Date: Wed Mar 11 10:02:39 2015 +1100
1381 - guenther@cvs.openbsd.org 2014/01/09 03:26:00 16
1382 [sftp-common.c] 17 make unit tests work for !OPENSSH_HAS_ECC
1383 When formating the time for "ls -l"-style output, show dates in the future 18
1384 with the year, and rearrange a comparison to avoid a potentional signed 19commit 307bb40277ca2c32e97e61d70d1ed74b571fd6ba
1385 arithmetic overflow that would give the wrong result. 20Author: djm@openbsd.org <djm@openbsd.org>
1386 ok djm@ 21Date: Sat Mar 7 04:41:48 2015 +0000
1387 - djm@cvs.openbsd.org 2014/01/09 23:20:00 22
1388 [digest.c digest.h hostfile.c kex.c kex.h kexc25519.c kexc25519c.c] 23 upstream commit
1389 [kexc25519s.c kexdh.c kexecdh.c kexecdhc.c kexecdhs.c kexgex.c kexgexc.c] 24
1390 [kexgexs.c key.c key.h roaming_client.c roaming_common.c schnorr.c] 25 unbreak for w/SSH1 (default) case; ok markus@ deraadt@
1391 [schnorr.h ssh-dss.c ssh-ecdsa.c ssh-rsa.c sshconnect2.c] 26
1392 Introduce digest API and use it to perform all hashing operations 27commit b44ee0c998fb4c5f3c3281f2398af5ce42840b6f
1393 rather than calling OpenSSL EVP_Digest* directly. Will make it easier 28Author: Damien Miller <djm@mindrot.org>
1394 to build a reduced-feature OpenSSH without OpenSSL in future; 29Date: Thu Mar 5 18:39:20 2015 -0800
1395 feedback, ok markus@ 30
1396 - djm@cvs.openbsd.org 2014/01/09 23:26:48 31 unbreak hostkeys test for w/ SSH1 case
1397 [sshconnect.c sshd.c] 32
1398 ban clients/servers that suffer from SSH_BUG_DERIVEKEY, they are ancient, 33commit 55e5bdeb519cb60cc18b7ba0545be581fb8598b4
1399 deranged and might make some attacks on KEX easier; ok markus@ 34Author: djm@openbsd.org <djm@openbsd.org>
1400 35Date: Fri Mar 6 01:40:56 2015 +0000
140120140108 36
1402 - (djm) [regress/.cvsignore] Ignore regress test droppings; ok dtucker@ 37 upstream commit
1403 38
140420131231 39 fix sshkey_certify() return value for unsupported key types;
1405 - (djm) OpenBSD CVS Sync 40 ok markus@ deraadt@
1406 - djm@cvs.openbsd.org 2013/12/30 23:52:28 41
1407 [auth2-hostbased.c auth2-pubkey.c compat.c compat.h ssh-rsa.c] 42commit be8f658e550a434eac04256bfbc4289457a24e99
1408 [sshconnect.c sshconnect2.c sshd.c] 43Author: Damien Miller <djm@mindrot.org>
1409 refuse RSA keys from old proprietary clients/servers that use the 44Date: Wed Mar 4 15:38:03 2015 -0800
1410 obsolete RSA+MD5 signature scheme. it will still be possible to connect 45
1411 with these clients/servers but only DSA keys will be accepted, and we'll 46 update version numbers to match version.h
1412 deprecate them entirely in a future release. ok markus@ 47
1413 48commit ac5e8acefa253eb5e5ba186e34236c0e8007afdc
141420131229 49Author: djm@openbsd.org <djm@openbsd.org>
1415 - (djm) [loginrec.c] Check for username truncation when looking up lastlog 50Date: Wed Mar 4 23:22:35 2015 +0000
1416 entries 51
1417 - (djm) [regress/Makefile] Add some generated files for cleaning 52 upstream commit
1418 - (djm) OpenBSD CVS Sync 53
1419 - djm@cvs.openbsd.org 2013/12/19 00:10:30 54 make these work with !SSH1; ok markus@ deraadt@
1420 [ssh-add.c] 55
1421 skip requesting smartcard PIN when removing keys from agent; bz#2187 56commit 2f04af92f036b0c87a23efb259c37da98cd81fe6
1422 patch from jay AT slushpupie.com; ok dtucker 57Author: djm@openbsd.org <djm@openbsd.org>
1423 - dtucker@cvs.openbsd.org 2013/12/19 00:19:12 58Date: Wed Mar 4 21:12:59 2015 +0000
1424 [serverloop.c] 59
1425 Cast client_alive_interval to u_int64_t before assinging to 60 upstream commit
1426 max_time_milliseconds to avoid potential integer overflow in the timeout. 61
1427 bz#2170, patch from Loganaden Velvindron, ok djm@ 62 make ssh-add -D work with !SSH1 agent
1428 - djm@cvs.openbsd.org 2013/12/19 00:27:57 63
1429 [auth-options.c] 64commit a05adf95d2af6abb2b7826ddaa7a0ec0cdc1726b
1430 simplify freeing of source-address certificate restriction 65Author: Damien Miller <djm@mindrot.org>
1431 - djm@cvs.openbsd.org 2013/12/19 01:04:36 66Date: Wed Mar 4 00:55:48 2015 -0800
1432 [channels.c] 67
1433 bz#2147: fix multiple remote forwardings with dynamically assigned 68 netcat needs poll.h portability goop
1434 listen ports. In the s->c message to open the channel we were sending 69
1435 zero (the magic number to request a dynamic port) instead of the actual 70commit dad2b1892b4c1b7e58df483a8c5b983c4454e099
1436 listen port. The client therefore had no way of discriminating between 71Author: markus@openbsd.org <markus@openbsd.org>
1437 them. 72Date: Tue Mar 3 22:35:19 2015 +0000
1438 73
1439 Diagnosis and fix by ronf AT timeheart.net 74 upstream commit
1440 - djm@cvs.openbsd.org 2013/12/19 01:19:41 75
1441 [ssh-agent.c] 76 make it possible to run tests w/o ssh1 support; ok djm@
1442 bz#2186: don't crash (NULL deref) when deleting PKCS#11 keys from an agent 77
1443 that has a mix of normal and PKCS#11 keys; fix from jay AT slushpupie.com; 78commit d48a22601bdd3eec054794c535f4ae8d8ae4c6e2
1444 ok dtucker 79Author: djm@openbsd.org <djm@openbsd.org>
1445 - djm@cvs.openbsd.org 2013/12/19 22:57:13 80Date: Wed Mar 4 18:53:53 2015 +0000
1446 [poly1305.c poly1305.h] 81
1447 use full name for author, with his permission 82 upstream commit
1448 - tedu@cvs.openbsd.org 2013/12/21 07:10:47 83
1449 [ssh-keygen.1] 84 crank; ok markus, deraadt
1450 small typo 85
1451 - djm@cvs.openbsd.org 2013/12/27 22:30:17 86commit bbffb23daa0b002dd9f296e396a9ab8a5866b339
1452 [ssh-dss.c ssh-ecdsa.c ssh-rsa.c] 87Author: Damien Miller <djm@mindrot.org>
1453 make the original RSA and DSA signing/verification code look more like 88Date: Tue Mar 3 13:50:27 2015 -0800
1454 the ECDSA/Ed25519 ones: use key_type_plain() when checking the key type 89
1455 rather than tediously listing all variants, use __func__ for debug/ 90 more --without-ssh1 fixes
1456 error messages 91
1457 - djm@cvs.openbsd.org 2013/12/27 22:37:18 92commit 6c2039286f503e2012a58a1d109e389016e7a99b
1458 [ssh-rsa.c] 93Author: Damien Miller <djm@mindrot.org>
1459 correct comment 94Date: Tue Mar 3 13:48:48 2015 -0800
1460 - djm@cvs.openbsd.org 2013/12/29 02:28:10 95
1461 [key.c] 96 fix merge both that broke --without-ssh1 compile
1462 allow ed25519 keys to appear as certificate authorities 97
1463 - djm@cvs.openbsd.org 2013/12/29 02:37:04 98commit 111dfb225478a76f89ecbcd31e96eaf1311b59d3
1464 [key.c] 99Author: djm@openbsd.org <djm@openbsd.org>
1465 correct comment for key_to_certified() 100Date: Tue Mar 3 21:21:13 2015 +0000
1466 - djm@cvs.openbsd.org 2013/12/29 02:49:52 101
1467 [key.c] 102 upstream commit
1468 correct comment for key_drop_cert() 103
1469 - djm@cvs.openbsd.org 2013/12/29 04:20:04 104 add SSH1 Makefile knob to make it easier to build without
1470 [key.c] 105 SSH1 support; ok markus@
1471 to make sure we don't omit any key types as valid CA keys again, 106
1472 factor the valid key type check into a key_type_is_valid_ca() 107commit 3f7f5e6c5d2aa3f6710289c1a30119e534e56c5c
1473 function 108Author: djm@openbsd.org <djm@openbsd.org>
1474 - djm@cvs.openbsd.org 2013/12/29 04:29:25 109Date: Tue Mar 3 20:42:49 2015 +0000
1475 [authfd.c] 110
1476 allow deletion of ed25519 keys from the agent 111 upstream commit
1477 - djm@cvs.openbsd.org 2013/12/29 04:35:50 112
1478 [authfile.c] 113 expand __unused to full __attribute__ for better portability
1479 don't refuse to load Ed25519 certificates 114
1480 - djm@cvs.openbsd.org 2013/12/29 05:42:16 115commit 2fab9b0f8720baf990c931e3f68babb0bf9949c6
1481 [ssh.c] 116Author: Damien Miller <djm@mindrot.org>
1482 don't forget to load Ed25519 certs too 117Date: Wed Mar 4 07:41:27 2015 +1100
1483 - djm@cvs.openbsd.org 2013/12/29 05:57:02 118
1484 [sshconnect.c] 119 avoid warning
1485 when showing other hostkeys, don't forget Ed25519 keys 120
1486 121commit d1bc844322461f882b4fd2277ba9a8d4966573d2
148720131221 122Author: Damien Miller <djm@mindrot.org>
1488 - (dtucker) [regress/keytype.sh] Actually test ecdsa key types. 123Date: Wed Mar 4 06:31:45 2015 +1100
1489 124
149020131219 125 Revert "define __unused to nothing if not already defined"
1491 - (dtucker) [configure.ac] bz#2178: Don't try to use BSM on Solaris versions 126
1492 greater than 11 either rather than just 11. Patch from Tomas Kuthan. 127 This reverts commit 1598419e38afbaa8aa5df8dd6b0af98301e2c908.
1493 - (dtucker) [auth-pam.c] bz#2163: check return value from pam_get_item(). 128
1494 Patch from Loganaden Velvindron. 129 Some system headers have objects named __unused
1495 130
149620131218 131commit 00797e86b2d98334d1bb808f65fa1fd47f328ff1
1497 - (djm) OpenBSD CVS Sync 132Author: Damien Miller <djm@mindrot.org>
1498 - djm@cvs.openbsd.org 2013/12/07 08:08:26 133Date: Wed Mar 4 05:02:45 2015 +1100
1499 [ssh-keygen.1] 134
1500 document -a and -o wrt new key format 135 check for crypt and DES_crypt in openssl block
1501 - naddy@cvs.openbsd.org 2013/12/07 11:58:46 136
1502 [ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh-keysign.8 ssh.1] 137 fixes builds on systems that use DES_crypt; based on patch
1503 [ssh_config.5 sshd.8 sshd_config.5] 138 from Roumen Petrov
1504 add missing mentions of ed25519; ok djm@ 139
1505 - dtucker@cvs.openbsd.org 2013/12/08 09:53:27 140commit 1598419e38afbaa8aa5df8dd6b0af98301e2c908
1506 [sshd_config.5] 141Author: Damien Miller <djm@mindrot.org>
1507 Use a literal for the default value of KEXAlgorithms. ok deraadt jmc 142Date: Wed Mar 4 04:59:13 2015 +1100
1508 - markus@cvs.openbsd.org 2013/12/09 11:03:45 143
1509 [blocks.c ed25519.c fe25519.c fe25519.h ge25519.c ge25519.h] 144 define __unused to nothing if not already defined
1510 [ge25519_base.data hash.c sc25519.c sc25519.h verify.c] 145
1511 Add Authors for the public domain ed25519/nacl code. 146 fixes builds on BSD/OS
1512 see also http://nacl.cr.yp.to/features.html 147
1513 All of the NaCl software is in the public domain. 148commit d608a51daad4f14ad6ab43d7cf74ef4801cc3fe9
1514 and http://ed25519.cr.yp.to/software.html 149Author: djm@openbsd.org <djm@openbsd.org>
1515 The Ed25519 software is in the public domain. 150Date: Tue Mar 3 17:53:40 2015 +0000
1516 - markus@cvs.openbsd.org 2013/12/09 11:08:17 151
1517 [crypto_api.h] 152 upstream commit
1518 remove unused defines 153
1519 - pascal@cvs.openbsd.org 2013/12/15 18:17:26 154 reorder logic for better portability; patch from Roumen
1520 [ssh-add.c] 155 Petrov
1521 Make ssh-add also add .ssh/id_ed25519; fixes lie in manual page. 156
1522 ok markus@ 157commit 68d2dfc464fbcdf8d6387884260f9801f4352393
1523 - djm@cvs.openbsd.org 2013/12/15 21:42:35 158Author: djm@openbsd.org <djm@openbsd.org>
1524 [cipher-chachapoly.c] 159Date: Tue Mar 3 06:48:58 2015 +0000
1525 add some comments and constify a constant 160
1526 - markus@cvs.openbsd.org 2013/12/17 10:36:38 161 upstream commit
1527 [crypto_api.h] 162
1528 I've assempled the header file by cut&pasting from generated headers 163 Allow "ssh -Q protocol-version" to list supported SSH
1529 and the source files. 164 protocol versions. Useful for detecting builds without SSH v.1 support; idea
1530
153120131208
1532 - (djm) [openbsd-compat/bsd-setres_id.c] Missing header; from Corinna
1533 Vinschen
1534 - (djm) [Makefile.in regress/Makefile regress/agent-ptrace.sh]
1535 [regress/setuid-allowed.c] Check that ssh-agent is not on a no-setuid
1536 filesystem before running agent-ptrace.sh; ok dtucker
1537
153820131207
1539 - (djm) OpenBSD CVS Sync
1540 - djm@cvs.openbsd.org 2013/12/05 22:59:45
1541 [sftp-client.c]
1542 fix memory leak in error path in do_readdir(); pointed out by
1543 Loganaden Velvindron @ AfriNIC in bz#2163
1544 - djm@cvs.openbsd.org 2013/12/06 03:40:51
1545 [ssh-keygen.c]
1546 remove duplicated character ('g') in getopt() string;
1547 document the (few) remaining option characters so we don't have to
1548 rummage next time.
1549 - markus@cvs.openbsd.org 2013/12/06 13:30:08
1550 [authfd.c key.c key.h ssh-agent.c]
1551 move private key (de)serialization to key.c; ok djm
1552 - markus@cvs.openbsd.org 2013/12/06 13:34:54
1553 [authfile.c authfile.h cipher.c cipher.h key.c packet.c ssh-agent.c]
1554 [ssh-keygen.c PROTOCOL.key] new private key format, bcrypt as KDF by
1555 default; details in PROTOCOL.key; feedback and lots help from djm;
1556 ok djm@
1557 - markus@cvs.openbsd.org 2013/12/06 13:39:49
1558 [authfd.c authfile.c key.c key.h myproposal.h pathnames.h readconf.c]
1559 [servconf.c ssh-agent.c ssh-keygen.c ssh-keyscan.1 ssh-keyscan.c]
1560 [ssh-keysign.c ssh.c ssh_config.5 sshd.8 sshd.c verify.c ssh-ed25519.c]
1561 [sc25519.h sc25519.c hash.c ge25519_base.data ge25519.h ge25519.c]
1562 [fe25519.h fe25519.c ed25519.c crypto_api.h blocks.c]
1563 support ed25519 keys (hostkeys and user identities) using the public
1564 domain ed25519 reference code from SUPERCOP, see
1565 http://ed25519.cr.yp.to/software.html
1566 feedback, help & ok djm@
1567 - jmc@cvs.openbsd.org 2013/12/06 15:29:07
1568 [sshd.8]
1569 missing comma;
1570 - djm@cvs.openbsd.org 2013/12/07 00:19:15
1571 [key.c]
1572 set k->cert = NULL after freeing it
1573 - markus@cvs.openbsd.org 2013/12/06 13:52:46
1574 [regress/Makefile regress/agent.sh regress/cert-hostkey.sh]
1575 [regress/cert-userkey.sh regress/keytype.sh]
1576 test ed25519 support; from djm@
1577 - (djm) [blocks.c ed25519.c fe25519.c fe25519.h ge25519.c ge25519.h]
1578 [ge25519_base.data hash.c sc25519.c sc25519.h verify.c] Fix RCS idents
1579 - (djm) [Makefile.in] Add ed25519 sources
1580 - (djm) [authfile.c] Conditionalise inclusion of util.h
1581 - (djm) [configure.ac openbsd-compat/Makefile.in openbsd-compat/bcrypt_pbkdf.c]
1582 [openbsd-compat/blf.h openbsd-compat/blowfish.c]
1583 [openbsd-compat/openbsd-compat.h] Start at supporting bcrypt_pbkdf in
1584 portable.
1585 - (djm) [ed25519.c ssh-ed25519.c openbsd-compat/Makefile.in]
1586 [openbsd-compat/bcrypt_pbkdf.c] Make ed25519/new key format compile on
1587 Linux
1588 - (djm) [regress/cert-hostkey.sh] Fix merge botch
1589 - (djm) [Makefile.in] PATHSUBS and keygen bits for Ed25519; from
1590 Loganaden Velvindron @ AfriNIC in bz#2179
1591
159220131205
1593 - (djm) OpenBSD CVS Sync
1594 - jmc@cvs.openbsd.org 2013/11/21 08:05:09
1595 [ssh_config.5 sshd_config.5]
1596 no need for .Pp before displays;
1597 - deraadt@cvs.openbsd.org 2013/11/25 18:04:21
1598 [ssh.1 ssh.c]
1599 improve -Q usage and such. One usage change is that the option is now
1600 case-sensitive
1601 ok dtucker markus djm
1602 - jmc@cvs.openbsd.org 2013/11/26 12:14:54
1603 [ssh.1 ssh.c]
1604 - put -Q in the right place
1605 - Ar was a poor choice for the arguments to -Q. i've chosen an
1606 admittedly equally poor Cm, at least consistent with the rest
1607 of the docs. also no need for multiple instances
1608 - zap a now redundant Nm
1609 - usage() sync
1610 - deraadt@cvs.openbsd.org 2013/11/26 19:15:09
1611 [pkcs11.h]
1612 cleanup 1 << 31 idioms. Resurrection of this issue pointed out by
1613 Eitan Adler ok markus for ssh, implies same change in kerberosV
1614 - djm@cvs.openbsd.org 2013/12/01 23:19:05
1615 [PROTOCOL]
1616 mention curve25519-sha256@libssh.org key exchange algorithm
1617 - djm@cvs.openbsd.org 2013/12/02 02:50:27
1618 [PROTOCOL.chacha20poly1305]
1619 typo; from Jon Cave
1620 - djm@cvs.openbsd.org 2013/12/02 02:56:17
1621 [ssh-pkcs11-helper.c]
1622 use-after-free; bz#2175 patch from Loganaden Velvindron @ AfriNIC
1623 - djm@cvs.openbsd.org 2013/12/02 03:09:22
1624 [key.c]
1625 make key_to_blob() return a NULL blob on failure; part of
1626 bz#2175 from Loganaden Velvindron @ AfriNIC
1627 - djm@cvs.openbsd.org 2013/12/02 03:13:14
1628 [cipher.c]
1629 correct bzero of chacha20+poly1305 key context. bz#2177 from
1630 Loganaden Velvindron @ AfriNIC
1631
1632 Also make it a memset for consistency with the rest of cipher.c
1633 - djm@cvs.openbsd.org 2013/12/04 04:20:01
1634 [sftp-client.c]
1635 bz#2171: don't leak local_fd on error; from Loganaden Velvindron @
1636 AfriNIC
1637 - djm@cvs.openbsd.org 2013/12/05 01:16:41
1638 [servconf.c servconf.h]
1639 bz#2161 - fix AuthorizedKeysCommand inside a Match block and
1640 rearrange things so the same error is harder to make next time;
1641 with and ok dtucker@
1642 - (dtucker) [configure.ac] bz#2173: use pkg-config --libs to include correct
1643 -L location for libedit. Patch from Serge van den Boom.
1644
164520131121
1646 - (djm) OpenBSD CVS Sync
1647 - dtucker@cvs.openbsd.org 2013/11/08 11:15:19
1648 [bufaux.c bufbn.c buffer.c sftp-client.c sftp-common.c sftp-glob.c]
1649 [uidswap.c] Include stdlib.h for free() as per the man page.
1650 - markus@cvs.openbsd.org 2013/11/13 13:48:20
1651 [ssh-pkcs11.c]
1652 add missing braces found by pedro
1653 - djm@cvs.openbsd.org 2013/11/20 02:19:01
1654 [sshd.c]
1655 delay closure of in/out fds until after "Bad protocol version
1656 identification..." message, as get_remote_ipaddr/get_remote_port
1657 require them open.
1658 - deraadt@cvs.openbsd.org 2013/11/20 20:53:10
1659 [scp.c]
1660 unsigned casts for ctype macros where neccessary
1661 ok guenther millert markus
1662 - deraadt@cvs.openbsd.org 2013/11/20 20:54:10
1663 [canohost.c clientloop.c match.c readconf.c sftp.c]
1664 unsigned casts for ctype macros where neccessary
1665 ok guenther millert markus
1666 - djm@cvs.openbsd.org 2013/11/21 00:45:44
1667 [Makefile.in PROTOCOL PROTOCOL.chacha20poly1305 authfile.c chacha.c]
1668 [chacha.h cipher-chachapoly.c cipher-chachapoly.h cipher.c cipher.h]
1669 [dh.c myproposal.h packet.c poly1305.c poly1305.h servconf.c ssh.1]
1670 [ssh.c ssh_config.5 sshd_config.5] Add a new protocol 2 transport
1671 cipher "chacha20-poly1305@openssh.com" that combines Daniel
1672 Bernstein's ChaCha20 stream cipher and Poly1305 MAC to build an
1673 authenticated encryption mode.
1674
1675 Inspired by and similar to Adam Langley's proposal for TLS:
1676 http://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-03
1677 but differs in layout used for the MAC calculation and the use of a
1678 second ChaCha20 instance to separately encrypt packet lengths.
1679 Details are in the PROTOCOL.chacha20poly1305 file.
1680
1681 Feedback markus@, naddy@; manpage bits Loganden Velvindron @ AfriNIC
1682 ok markus@ naddy@
1683 - naddy@cvs.openbsd.org 2013/11/18 05:09:32
1684 [regress/forward-control.sh]
1685 bump timeout to 10 seconds to allow slow machines (e.g. Alpha PC164)
1686 to successfully run this; ok djm@
1687 - djm@cvs.openbsd.org 2013/11/21 03:15:46
1688 [regress/krl.sh]
1689 add some reminders for additional tests that I'd like to implement
1690 - djm@cvs.openbsd.org 2013/11/21 03:16:47
1691 [regress/modpipe.c]
1692 use unsigned long long instead of u_int64_t here to avoid warnings
1693 on some systems portable OpenSSH is built on.
1694 - djm@cvs.openbsd.org 2013/11/21 03:18:51
1695 [regress/cipher-speed.sh regress/integrity.sh regress/rekey.sh]
1696 [regress/try-ciphers.sh]
1697 use new "ssh -Q cipher-auth" query to obtain lists of authenticated
1698 encryption ciphers instead of specifying them manually; ensures that
1699 the new chacha20poly1305@openssh.com mode is tested;
1700
1701 ok markus@ and naddy@ as part of the diff to add
1702 chacha20poly1305@openssh.com
1703
170420131110
1705 - (dtucker) [regress/keytype.sh] Populate ECDSA key types to be tested by
1706 querying the ones that are compiled in.
1707
170820131109
1709 - (dtucker) OpenBSD CVS Sync
1710 - dtucker@cvs.openbsd.org 2013/11/09 05:41:34
1711 [regress/test-exec.sh regress/rekey.sh]
1712 Use smaller test data files to speed up tests. Grow test datafiles
1713 where necessary for a specific test.
1714 - (dtucker) [configure.ac kex.c key.c myproposal.h] Test for the presence of
1715 NID_X9_62_prime256v1, NID_secp384r1 and NID_secp521r1 and test that the
1716 latter actually works before using it. Fedora (at least) has NID_secp521r1
1717 that doesn't work (see https://bugzilla.redhat.com/show_bug.cgi?id=1021897).
1718 - (dtucker) [configure.ac] Fix brackets in NID_secp521r1 test.
1719 - (dtucker) [configure.ac] Add missing "test".
1720 - (dtucker) [key.c] Check for the correct defines for NID_secp521r1.
1721
172220131108
1723 - (dtucker) OpenBSD CVS Sync
1724 - dtucker@cvs.openbsd.org 2013/11/08 01:06:14
1725 [regress/rekey.sh]
1726 Rekey less frequently during tests to speed them up
1727 - (djm) OpenBSD CVS Sync
1728 - dtucker@cvs.openbsd.org 2013/11/07 11:58:27
1729 [cipher.c cipher.h kex.c kex.h mac.c mac.h servconf.c ssh.c]
1730 Output the effective values of Ciphers, MACs and KexAlgorithms when
1731 the default has not been overridden. ok markus@
1732 - djm@cvs.openbsd.org 2013/11/08 00:39:15
1733 [auth-options.c auth2-chall.c authfd.c channels.c cipher-3des1.c]
1734 [clientloop.c gss-genr.c monitor_mm.c packet.c schnorr.c umac.c]
1735 [sftp-client.c sftp-glob.c]
1736 use calloc for all structure allocations; from markus@
1737 - djm@cvs.openbsd.org 2013/11/08 01:38:11
1738 [version.h]
1739 openssh-6.4
1740 - (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
1741 [contrib/suse/openssh.spec] Update version numbers following release.
1742 - (dtucker) [openbsd-compat/openbsd-compat.h] Add null implementation of
1743 arc4random_stir for platforms that have arc4random but don't have
1744 arc4random_stir (right now this is only OpenBSD -current).
1745 - (dtucker) [kex.c] Only enable CURVE25519_SHA256 if we actually have
1746 EVP_sha256.
1747 - (dtucker) [myproposal.h] Conditionally enable CURVE25519_SHA256.
1748 - (dtucker) [openbsd-compat/bsd-poll.c] Add headers to prevent compile
1749 warnings.
1750 - (dtucker) [Makefile.in configure.ac] Set MALLOC_OPTIONS per platform
1751 and pass in TEST_ENV. use stderr to get polluted
1752 and the stderr-data test to fail.
1753 - (dtucker) [contrib/cygwin/ssh-host-config] Simplify host key generation:
1754 rather than testing and generating each key, call ssh-keygen -A.
1755 Patch from vinschen at redhat.com.
1756 - (dtucker) OpenBSD CVS Sync
1757 - dtucker@cvs.openbsd.org 2013/11/09 05:41:34
1758 [regress/test-exec.sh regress/rekey.sh]
1759 Use smaller test data files to speed up tests. Grow test datafiles
1760 where necessary for a specific test.
1761
176220131107
1763 - (djm) [ssh-pkcs11.c] Bring back "non-constant initialiser" fix (rev 1.5)
1764 that got lost in recent merge.
1765 - (djm) [Makefile.in monitor.c] Missed chunks of curve25519 KEX diff
1766 - (djm) [regress/modpipe.c regress/rekey.sh] Never intended to commit these
1767 - (djm) [configure.ac defines.h] Skip arc4random_stir() calls on platforms
1768 that lack it but have arc4random_uniform()
1769 - (djm) OpenBSD CVS Sync
1770 - markus@cvs.openbsd.org 2013/11/04 11:51:16
1771 [monitor.c]
1772 fix rekeying for KEX_C25519_SHA256; noted by dtucker@
1773 RCSID sync only; I thought this was a merge botch and fixed it already
1774 - markus@cvs.openbsd.org 2013/11/06 16:52:11
1775 [monitor_wrap.c]
1776 fix rekeying for AES-GCM modes; ok deraadt
1777 - djm@cvs.openbsd.org 2013/11/06 23:05:59
1778 [ssh-pkcs11.c]
1779 from portable: s/true/true_val/ to avoid name collisions on dump platforms
1780 RCSID sync only
1781 - (dtucker) OpenBSD CVS Sync
1782 - djm@cvs.openbsd.org 2013/10/09 23:44:14
1783 [regress/Makefile] (ID sync only)
1784 regression test for sftp request white/blacklisting and readonly mode.
1785 - markus@cvs.openbsd.org 2013/11/02 22:39:53
1786 [regress/kextype.sh]
1787 add curve25519-sha256@libssh.org
1788 - dtucker@cvs.openbsd.org 2013/11/04 12:27:42
1789 [regress/rekey.sh]
1790 Test rekeying with all KexAlgorithms.
1791 - dtucker@cvs.openbsd.org 2013/11/07 00:12:05
1792 [regress/rekey.sh]
1793 Test rekeying for every Cipher, MAC and KEX, plus test every KEX with
1794 the GCM ciphers.
1795 - dtucker@cvs.openbsd.org 2013/11/07 01:12:51
1796 [regress/rekey.sh]
1797 Factor out the data transfer rekey tests
1798 - dtucker@cvs.openbsd.org 2013/11/07 02:48:38
1799 [regress/integrity.sh regress/cipher-speed.sh regress/try-ciphers.sh]
1800 Use ssh -Q instead of hardcoding lists of ciphers or MACs.
1801 - dtucker@cvs.openbsd.org 2013/11/07 03:55:41
1802 [regress/kextype.sh]
1803 Use ssh -Q to get kex types instead of a static list.
1804 - dtucker@cvs.openbsd.org 2013/11/07 04:26:56
1805 [regress/kextype.sh]
1806 trailing space
1807 - (dtucker) [Makefile.in configure.ac] Remove TEST_SSH_SHA256 environment
1808 variable. It's no longer used now that we get the supported MACs from
1809 ssh -Q.
1810
181120131104
1812 - (djm) OpenBSD CVS Sync
1813 - markus@cvs.openbsd.org 2013/11/02 20:03:54
1814 [ssh-pkcs11.c]
1815 support pkcs#11 tokes that only provide x509 zerts instead of raw pubkeys;
1816 fixes bz#1908; based on patch from Laurent Barbe; ok djm
1817 - markus@cvs.openbsd.org 2013/11/02 21:59:15
1818 [kex.c kex.h myproposal.h ssh-keyscan.c sshconnect2.c sshd.c]
1819 use curve25519 for default key exchange (curve25519-sha256@libssh.org);
1820 initial patch from Aris Adamantiadis; ok djm@
1821 - markus@cvs.openbsd.org 2013/11/02 22:10:15
1822 [kexdhs.c kexecdhs.c]
1823 no need to include monitor_wrap.h
1824 - markus@cvs.openbsd.org 2013/11/02 22:24:24
1825 [kexdhs.c kexecdhs.c]
1826 no need to include ssh-gss.h
1827 - markus@cvs.openbsd.org 2013/11/02 22:34:01
1828 [auth-options.c]
1829 no need to include monitor_wrap.h and ssh-gss.h
1830 - markus@cvs.openbsd.org 2013/11/02 22:39:19
1831 [ssh_config.5 sshd_config.5]
1832 the default kex is now curve25519-sha256@libssh.org
1833 - djm@cvs.openbsd.org 2013/11/03 10:37:19
1834 [roaming_common.c]
1835 fix a couple of function definitions foo() -> foo(void)
1836 (-Wold-style-definition)
1837 - (djm) [kexc25519.c kexc25519c.c kexc25519s.c] Import missed files from
1838 KEX/curve25519 change
1839
184020131103
1841 - (dtucker) [openbsd-compat/bsd-misc.c] Include time.h for nanosleep.
1842 From OpenSMTPD where it prevents "implicit declaration" warnings (it's
1843 a no-op in OpenSSH). From chl at openbsd.
1844 - (dtucker) [openbsd-compat/setproctitle.c] Handle error case form the 2nd
1845 vsnprintf. From eric at openbsd via chl@.
1846 - (dtucker) [configure.ac defines.h] Add typedefs for intmax_t and uintmax_t
1847 for platforms that don't have them.
1848
184920131030
1850 - (djm) OpenBSD CVS Sync
1851 - djm@cvs.openbsd.org 2013/10/29 09:42:11
1852 [key.c key.h]
1853 fix potential stack exhaustion caused by nested certificates;
1854 report by Mateusz Kocielski; ok dtucker@ markus@
1855 - djm@cvs.openbsd.org 2013/10/29 09:48:02
1856 [servconf.c servconf.h session.c sshd_config sshd_config.5]
1857 shd_config PermitTTY to disallow TTY allocation, mirroring the
1858 longstanding no-pty authorized_keys option;
1859 bz#2070, patch from Teran McKinney; ok markus@
1860 - jmc@cvs.openbsd.org 2013/10/29 18:49:32
1861 [sshd_config.5]
1862 pty(4), not pty(7);
1863
186420131026
1865 - (djm) OpenBSD CVS Sync
1866 - djm@cvs.openbsd.org 2013/10/25 23:04:51
1867 [ssh.c]
1868 fix crash when using ProxyCommand caused by previous commit - was calling
1869 freeaddrinfo(NULL); spotted by sthen@ and Tim Ruehsen, patch by sthen@
1870
187120131025
1872 - (djm) [ssh-keygen.c ssh-keysign.c sshconnect1.c sshd.c] Remove
1873 unnecessary arc4random_stir() calls. The only ones left are to ensure
1874 that the PRNG gets a different state after fork() for platforms that
1875 have broken the API.
1876
187720131024
1878 - (djm) [auth-krb5.c] bz#2032 - use local username in krb5_kuserok check
1879 rather than full client name which may be of form user@REALM;
1880 patch from Miguel Sanders; ok dtucker@
1881 - (djm) OpenBSD CVS Sync
1882 - dtucker@cvs.openbsd.org 2013/10/23 05:40:58
1883 [servconf.c]
1884 fix comment
1885 - djm@cvs.openbsd.org 2013/10/23 23:35:32
1886 [sshd.c]
1887 include local address and port in "Connection from ..." message (only
1888 shown at loglevel>=verbose)
1889 - dtucker@cvs.openbsd.org 2013/10/24 00:49:49
1890 [moduli.c]
1891 Periodically print progress and, if possible, expected time to completion
1892 when screening moduli for DH groups. ok deraadt djm
1893 - dtucker@cvs.openbsd.org 2013/10/24 00:51:48
1894 [readconf.c servconf.c ssh_config.5 sshd_config.5]
1895 Disallow empty Match statements and add "Match all" which matches
1896 everything. ok djm, man page help jmc@
1897 - djm@cvs.openbsd.org 2013/10/24 08:19:36
1898 [ssh.c]
1899 fix bug introduced in hostname canonicalisation commit: don't try to
1900 resolve hostnames when a ProxyCommand is set unless the user has forced
1901 canonicalisation; spotted by Iain Morgan
1902 - (tim) [regress/sftp-perm.sh] We need a shell that understands "! somecmd"
1903
190420131023
1905 - (djm) OpenBSD CVS Sync
1906 - djm@cvs.openbsd.org 2013/10/20 04:39:28
1907 [ssh_config.5]
1908 document % expansions performed by "Match command ..."
1909 - djm@cvs.openbsd.org 2013/10/20 06:19:28
1910 [readconf.c ssh_config.5]
1911 rename "command" subclause of the recently-added "Match" keyword to
1912 "exec"; it's shorter, clearer in intent and we might want to add the
1913 ability to match against the command being executed at the remote end in
1914 the future.
1915 - djm@cvs.openbsd.org 2013/10/20 09:51:26
1916 [scp.1 sftp.1]
1917 add canonicalisation options to -o lists
1918 - jmc@cvs.openbsd.org 2013/10/20 18:00:13
1919 [ssh_config.5]
1920 tweak the "exec" description, as worded by djm;
1921 - djm@cvs.openbsd.org 2013/10/23 03:03:07
1922 [readconf.c]
1923 Hostname may have %h sequences that should be expanded prior to Match
1924 evaluation; spotted by Iain Morgan
1925 - djm@cvs.openbsd.org 2013/10/23 03:05:19
1926 [readconf.c ssh.c]
1927 comment
1928 - djm@cvs.openbsd.org 2013/10/23 04:16:22
1929 [ssh-keygen.c]
1930 Make code match documentation: relative-specified certificate expiry time
1931 should be relative to current time and not the validity start time.
1932 Reported by Petr Lautrbach; ok deraadt@
1933
193420131018
1935 - (djm) OpenBSD CVS Sync
1936 - djm@cvs.openbsd.org 2013/10/09 23:44:14
1937 [regress/Makefile regress/sftp-perm.sh]
1938 regression test for sftp request white/blacklisting and readonly mode.
1939 - jmc@cvs.openbsd.org 2013/10/17 07:35:48
1940 [sftp.1 sftp.c]
1941 tweak previous;
1942 - djm@cvs.openbsd.org 2013/10/17 22:08:04
1943 [sshd.c]
1944 include remote port in bad banner message; bz#2162
1945
194620131017
1947 - (djm) OpenBSD CVS Sync
1948 - jmc@cvs.openbsd.org 2013/10/15 14:10:25
1949 [ssh.1 ssh_config.5]
1950 tweak previous;
1951 - djm@cvs.openbsd.org 2013/10/16 02:31:47
1952 [readconf.c readconf.h roaming_client.c ssh.1 ssh.c ssh_config.5]
1953 [sshconnect.c sshconnect.h]
1954 Implement client-side hostname canonicalisation to allow an explicit
1955 search path of domain suffixes to use to convert unqualified host names
1956 to fully-qualified ones for host key matching.
1957 This is particularly useful for host certificates, which would otherwise
1958 need to list unqualified names alongside fully-qualified ones (and this
1959 causes a number of problems).
1960 "looks fine" markus@
1961 - jmc@cvs.openbsd.org 2013/10/16 06:42:25
1962 [ssh_config.5]
1963 tweak previous;
1964 - djm@cvs.openbsd.org 2013/10/16 22:49:39
1965 [readconf.c readconf.h ssh.1 ssh.c ssh_config.5]
1966 s/canonicalise/canonicalize/ for consistency with existing spelling,
1967 e.g. authorized_keys; pointed out by naddy@
1968 - djm@cvs.openbsd.org 2013/10/16 22:58:01
1969 [ssh.c ssh_config.5]
1970 one I missed in previous: s/isation/ization/
1971 - djm@cvs.openbsd.org 2013/10/17 00:30:13
1972 [PROTOCOL sftp-client.c sftp-client.h sftp-server.c sftp.1 sftp.c]
1973 fsync@openssh.com protocol extension for sftp-server
1974 client support to allow calling fsync() faster successful transfer
1975 patch mostly by imorgan AT nas.nasa.gov; bz#1798
1976 "fine" markus@ "grumble OK" deraadt@ "doesn't sound bad to me" millert@
1977 - djm@cvs.openbsd.org 2013/10/17 00:46:49
1978 [ssh.c]
1979 rearrange check to reduce diff against -portable
1980 (Id sync only)
1981
198220131015
1983 - (djm) OpenBSD CVS Sync
1984 - djm@cvs.openbsd.org 2013/10/09 23:42:17
1985 [sftp-server.8 sftp-server.c]
1986 Add ability to whitelist and/or blacklist sftp protocol requests by name.
1987 Refactor dispatch loop and consolidate read-only mode checks.
1988 Make global variables static, since sftp-server is linked into sshd(8).
1989 ok dtucker@
1990 - djm@cvs.openbsd.org 2013/10/10 00:53:25
1991 [sftp-server.c]
1992 add -Q, -P and -p to usage() before jmc@ catches me
1993 - djm@cvs.openbsd.org 2013/10/10 01:43:03
1994 [sshd.c]
1995 bz#2139: fix re-exec fallback by ensuring that startup_pipe is correctly
1996 updated; ok dtucker@
1997 - djm@cvs.openbsd.org 2013/10/11 02:45:36
1998 [sftp-client.c]
1999 rename flag arguments to be more clear and consistent.
2000 reorder some internal function arguments to make adding additional flags
2001 easier.
2002 no functional change
2003 - djm@cvs.openbsd.org 2013/10/11 02:52:23
2004 [sftp-client.c]
2005 missed one arg reorder
2006 - djm@cvs.openbsd.org 2013/10/11 02:53:45
2007 [sftp-client.h]
2008 obsolete comment
2009 - jmc@cvs.openbsd.org 2013/10/14 14:18:56
2010 [sftp-server.8 sftp-server.c]
2011 tweak previous;
2012 ok djm
2013 - djm@cvs.openbsd.org 2013/10/14 21:20:52
2014 [session.c session.h]
2015 Add logging of session starts in a useful format; ok markus@ feedback and
2016 ok dtucker@
2017 - djm@cvs.openbsd.org 2013/10/14 22:22:05
2018 [readconf.c readconf.h ssh-keysign.c ssh.c ssh_config.5]
2019 add a "Match" keyword to ssh_config that allows matching on hostname,
2020 user and result of arbitrary commands. "nice work" markus@
2021 - djm@cvs.openbsd.org 2013/10/14 23:28:23
2022 [canohost.c misc.c misc.h readconf.c sftp-server.c ssh.c]
2023 refactor client config code a little:
2024 add multistate option partsing to readconf.c, similar to servconf.c's
2025 existing code.
2026 move checking of options that accept "none" as an argument to readconf.c
2027 add a lowercase() function and use it instead of explicit tolower() in
2028 loops
2029 part of a larger diff that was ok markus@
2030 - djm@cvs.openbsd.org 2013/10/14 23:31:01
2031 [ssh.c]
2032 whitespace at EOL; pointed out by markus@
2033 - [ssh.c] g/c unused variable.
2034
203520131010
2036 - (dtucker) OpenBSD CVS Sync
2037 - sthen@cvs.openbsd.org 2013/09/16 11:35:43
2038 [ssh_config]
2039 Remove gssapi config parts from ssh_config, as was already done for
2040 sshd_config. Req by/ok ajacoutot@
2041 ID SYNC ONLY for portable; kerberos/gssapi is still pretty popular
2042 - djm@cvs.openbsd.org 2013/09/19 00:24:52
2043 [progressmeter.c]
2044 store the initial file offset so the progress meter doesn't freak out
2045 when resuming sftp transfers. bz#2137; patch from Iain Morgan; ok dtucker@`
2046 - djm@cvs.openbsd.org 2013/09/19 00:49:12
2047 [sftp-client.c]
2048 fix swapped pflag and printflag in sftp upload_dir; from Iain Morgan
2049 - djm@cvs.openbsd.org 2013/09/19 01:24:46
2050 [channels.c]
2051 bz#1297 - tell the client (via packet_send_debug) when their preferred
2052 listen address has been overridden by the server's GatewayPorts;
2053 ok dtucker@
2054 - djm@cvs.openbsd.org 2013/09/19 01:26:29
2055 [sshconnect.c]
2056 bz#1211: make BindAddress work with UsePrivilegedPort=yes; patch from
2057 swp AT swp.pp.ru; ok dtucker@
2058 - dtucker@cvs.openbsd.org 2013/10/08 11:42:13
2059 [dh.c dh.h]
2060 Increase the size of the Diffie-Hellman groups requested for a each
2061 symmetric key size. New values from NIST Special Publication 800-57 with
2062 the upper limit specified by RFC4419. Pointed out by Peter Backes, ok
2063 djm@.
2064
206520131009
2066 - (djm) [openbsd-compat/arc4random.c openbsd-compat/chacha_private.h] Pull
2067 in OpenBSD implementation of arc4random, shortly to replace the existing
2068 bsd-arc4random.c
2069 - (djm) [openbsd-compat/Makefile.in openbsd-compat/arc4random.c]
2070 [openbsd-compat/bsd-arc4random.c] Replace old RC4-based arc4random
2071 implementation with recent OpenBSD's ChaCha-based PRNG. ok dtucker@,
2072 tested tim@
2073
207420130922
2075 - (dtucker) [platform.c platform.h sshd.c] bz#2156: restore Linux oom_adj
2076 setting when handling SIGHUP to maintain behaviour over retart. Patch
2077 from Matthew Ife.
2078
207920130918
2080 - (dtucker) [sshd_config] Trailing whitespace; from jstjohn at purdue edu.
2081
208220130914
2083 - (djm) OpenBSD CVS Sync
2084 - djm@cvs.openbsd.org 2013/08/22 19:02:21
2085 [sshd.c]
2086 Stir PRNG after post-accept fork. The child gets a different PRNG state
2087 anyway via rexec and explicit privsep reseeds, but it's good to be sure.
2088 ok markus@
2089 - mikeb@cvs.openbsd.org 2013/08/28 12:34:27
2090 [ssh-keygen.c]
2091 improve batch processing a bit by making use of the quite flag a bit
2092 more often and exit with a non zero code if asked to find a hostname
2093 in a known_hosts file and it wasn't there;
2094 originally from reyk@, ok djm
2095 - djm@cvs.openbsd.org 2013/08/31 00:13:54
2096 [sftp.c]
2097 make ^w match ksh behaviour (delete previous word instead of entire line)
2098 - deraadt@cvs.openbsd.org 2013/09/02 22:00:34
2099 [ssh-keygen.c sshconnect1.c sshd.c]
2100 All the instances of arc4random_stir() are bogus, since arc4random()
2101 does this itself, inside itself, and has for a very long time.. Actually,
2102 this was probably reducing the entropy available.
2103 ok djm
2104 ID SYNC ONLY for portable; we don't trust other arc4random implementations
2105 to do this right.
2106 - sthen@cvs.openbsd.org 2013/09/07 13:53:11
2107 [sshd_config]
2108 Remove commented-out kerberos/gssapi config options from sample config,
2109 kerberos support is currently not enabled in ssh in OpenBSD. Discussed with
2110 various people; ok deraadt@
2111 ID SYNC ONLY for portable; kerberos/gssapi is still pretty popular
2112 - djm@cvs.openbsd.org 2013/09/12 01:41:12
2113 [clientloop.c]
2114 fix connection crash when sending break (~B) on ControlPersist'd session;
2115 ok dtucker@
2116 - djm@cvs.openbsd.org 2013/09/13 06:54:34
2117 [channels.c]
2118 avoid unaligned access in code that reused a buffer to send a
2119 struct in_addr in a reply; simpler just use use buffer_put_int();
2120 from portable; spotted by and ok dtucker@
2121
212220130828
2123 - (djm) [openbsd-compat/bsd-snprintf.c] teach our local snprintf code the
2124 'j' (intmax_t/uintmax_t) and 'z' (size_t/ssize_t) conversions in case we
2125 start to use them in the future.
2126 - (djm) [openbsd-compat/bsd-snprintf.c] #ifdef noytet for intmax_t bits
2127 until we have configure support.
2128
212920130821
2130 - (djm) OpenBSD CVS Sync
2131 - djm@cvs.openbsd.org 2013/08/06 23:03:49
2132 [sftp.c]
2133 fix some whitespace at EOL
2134 make list of commands an enum rather than a long list of defines
2135 add -a to usage()
2136 - djm@cvs.openbsd.org 2013/08/06 23:05:01
2137 [sftp.1]
2138 document top-level -a option (the -a option to 'get' was already
2139 documented)
2140 - djm@cvs.openbsd.org 2013/08/06 23:06:01
2141 [servconf.c]
2142 add cast to avoid format warning; from portable
2143 - jmc@cvs.openbsd.org 2013/08/07 06:24:51
2144 [sftp.1 sftp.c]
2145 sort -a;
2146 - djm@cvs.openbsd.org 2013/08/08 04:52:04
2147 [sftp.c]
2148 fix two year old regression: symlinking a file would incorrectly
2149 canonicalise the target path. bz#2129 report from delphij AT freebsd.org
2150 - djm@cvs.openbsd.org 2013/08/08 05:04:03
2151 [sftp-client.c sftp-client.h sftp.c]
2152 add a "-l" flag for the rename command to force it to use the silly
2153 standard SSH_FXP_RENAME command instead of the POSIX-rename- like
2154 posix-rename@openssh.com extension.
2155
2156 intended for use in regress tests, so no documentation.
2157 - djm@cvs.openbsd.org 2013/08/09 03:37:25
2158 [sftp.c]
2159 do getopt parsing for all sftp commands (with an empty optstring for
2160 commands without arguments) to ensure consistent behaviour
2161 - djm@cvs.openbsd.org 2013/08/09 03:39:13
2162 [sftp-client.c]
2163 two problems found by a to-be-committed regress test: 1) msg_id was not
2164 being initialised so was starting at a random value from the heap
2165 (harmless, but confusing). 2) some error conditions were not being
2166 propagated back to the caller
2167 - djm@cvs.openbsd.org 2013/08/09 03:56:42
2168 [sftp.c]
2169 enable ctrl-left-arrow and ctrl-right-arrow to move forward/back a word;
2170 matching ksh's relatively recent change.
2171 - djm@cvs.openbsd.org 2013/08/13 18:32:08
2172 [ssh-keygen.c]
2173 typo in error message; from Stephan Rickauer
2174 - djm@cvs.openbsd.org 2013/08/13 18:33:08
2175 [ssh-keygen.c]
2176 another of the same typo
2177 - jmc@cvs.openbsd.org 2013/08/14 08:39:27
2178 [scp.1 ssh.1]
2179 some Bx/Ox conversion;
2180 From: Jan Stary
2181 - djm@cvs.openbsd.org 2013/08/20 00:11:38
2182 [readconf.c readconf.h ssh_config.5 sshconnect.c]
2183 Add a ssh_config ProxyUseFDPass option that supports the use of
2184 ProxyCommands that establish a connection and then pass a connected
2185 file descriptor back to ssh(1). This allows the ProxyCommand to exit
2186 rather than have to shuffle data back and forth and enables ssh to use
2187 getpeername, etc. to obtain address information just like it does with
2188 regular directly-connected sockets. ok markus@
2189 - jmc@cvs.openbsd.org 2013/08/20 06:56:07
2190 [ssh.1 ssh_config.5]
2191 some proxyusefdpass tweaks;
2192
219320130808
2194 - (dtucker) [regress/Makefile regress/test-exec.sh] Don't try to use test -nt
2195 since some platforms (eg really old FreeBSD) don't have it. Instead,
2196 run "make clean" before a complete regress run. ok djm.
2197 - (dtucker) [misc.c] Fall back to time(2) at runtime if clock_gettime(
2198 CLOCK_MONOTONIC...) fails. Some older versions of RHEL have the
2199 CLOCK_MONOTONIC define but don't actually support it. Found and tested
2200 by Kevin Brott, ok djm.
2201 - (dtucker) [misc.c] Remove define added for fallback testing that was
2202 mistakenly included in the previous commit.
2203 - (dtucker) [regress/Makefile regress/test-exec.sh] Roll back the -nt
2204 removal. The "make clean" removes modpipe which is built by the top-level
2205 directory before running the tests. Spotted by tim@
2206 - (djm) Release 6.3p1
2207
220820130804
2209 - (dtucker) [auth-krb5.c configure.ac openbsd-compat/bsd-misc.h] Add support
2210 for building with older Heimdal versions. ok djm.
2211
221220130801
2213 - (djm) [channels.c channels.h] bz#2135: On Solaris, isatty() on a non-
2214 blocking connecting socket will clear any stored errno that might
2215 otherwise have been retrievable via getsockopt(). A hack to limit writes
2216 to TTYs on AIX was triggering this. Since only AIX needs the hack, wrap
2217 it in an #ifdef. Diagnosis and patch from Ivo Raisr.
2218 - (djm) [sshlogin.h] Fix prototype merge botch from 2006; bz#2134
2219
222020130725
2221 - (djm) OpenBSD CVS Sync
2222 - djm@cvs.openbsd.org 2013/07/20 22:20:42
2223 [krl.c]
2224 fix verification error in (as-yet usused) KRL signature checking path
2225 - djm@cvs.openbsd.org 2013/07/22 05:00:17
2226 [umac.c]
2227 make MAC key, data to be hashed and nonce for final hash const;
2228 checked with -Wcast-qual
2229 - djm@cvs.openbsd.org 2013/07/22 12:20:02
2230 [umac.h]
2231 oops, forgot to commit corresponding header change;
2232 spotted by jsg and jasper
2233 - djm@cvs.openbsd.org 2013/07/25 00:29:10
2234 [ssh.c]
2235 daemonise backgrounded (ControlPersist'ed) multiplexing master to ensure
2236 it is fully detached from its controlling terminal. based on debugging
2237 - djm@cvs.openbsd.org 2013/07/25 00:56:52
2238 [sftp-client.c sftp-client.h sftp.1 sftp.c]
2239 sftp support for resuming partial downloads; patch mostly by Loganaden
2240 Velvindron/AfriNIC with some tweaks by me; feedback and ok dtucker@
2241 "Just be careful" deraadt@
2242 - djm@cvs.openbsd.org 2013/07/25 00:57:37
2243 [version.h]
2244 openssh-6.3 for release
2245 - dtucker@cvs.openbsd.org 2013/05/30 20:12:32
2246 [regress/test-exec.sh]
2247 use ssh and sshd as testdata since it needs to be >256k for the rekey test
2248 - dtucker@cvs.openbsd.org 2013/06/10 21:56:43
2249 [regress/forwarding.sh]
2250 Add test for forward config parsing
2251 - djm@cvs.openbsd.org 2013/06/21 02:26:26
2252 [regress/sftp-cmds.sh regress/test-exec.sh]
2253 unbreak sftp-cmds for renamed test data (s/ls/data/)
2254 - (tim) [sftp-client.c] Use of a gcc extension trips up native compilers on
2255 Solaris and UnixWare. Feedback and OK djm@
2256 - (tim) [regress/forwarding.sh] Fix for building outside source tree.
2257
225820130720
2259 - (djm) OpenBSD CVS Sync
2260 - markus@cvs.openbsd.org 2013/07/19 07:37:48
2261 [auth.h kex.h kexdhs.c kexecdhs.c kexgexs.c monitor.c servconf.c]
2262 [servconf.h session.c sshd.c sshd_config.5]
2263 add ssh-agent(1) support to sshd(8); allows encrypted hostkeys,
2264 or hostkeys on smartcards; most of the work by Zev Weiss; bz #1974
2265 ok djm@
2266 - djm@cvs.openbsd.org 2013/07/20 01:43:46
2267 [umac.c]
2268 use a union to ensure correct alignment; ok deraadt
2269 - djm@cvs.openbsd.org 2013/07/20 01:44:37
2270 [ssh-keygen.c ssh.c]
2271 More useful error message on missing current user in /etc/passwd
2272 - djm@cvs.openbsd.org 2013/07/20 01:50:20
2273 [ssh-agent.c]
2274 call cleanup_handler on SIGINT when in debug mode to ensure sockets
2275 are cleaned up on manual exit; bz#2120
2276 - djm@cvs.openbsd.org 2013/07/20 01:55:13
2277 [auth-krb5.c gss-serv-krb5.c gss-serv.c]
2278 fix kerberos/GSSAPI deprecation warnings and linking; "looks okay" millert@
2279
228020130718
2281 - (djm) OpenBSD CVS Sync
2282 - dtucker@cvs.openbsd.org 2013/06/10 19:19:44
2283 [readconf.c]
2284 revert 1.203 while we investigate crashes reported by okan@
2285 - guenther@cvs.openbsd.org 2013/06/17 04:48:42
2286 [scp.c]
2287 Handle time_t values as long long's when formatting them and when
2288 parsing them from remote servers.
2289 Improve error checking in parsing of 'T' lines.
2290 ok dtucker@ deraadt@
2291 - markus@cvs.openbsd.org 2013/06/20 19:15:06
2292 [krl.c]
2293 don't leak the rdata blob on errors; ok djm@
2294 - djm@cvs.openbsd.org 2013/06/21 00:34:49
2295 [auth-rsa.c auth.h auth2-hostbased.c auth2-pubkey.c monitor.c]
2296 for hostbased authentication, print the client host and user on
2297 the auth success/failure line; bz#2064, ok dtucker@
2298 - djm@cvs.openbsd.org 2013/06/21 00:37:49
2299 [ssh_config.5]
2300 explicitly mention that IdentitiesOnly can be used with IdentityFile
2301 to control which keys are offered from an agent.
2302 - djm@cvs.openbsd.org 2013/06/21 05:42:32
2303 [dh.c]
2304 sprinkle in some error() to explain moduli(5) parse failures
2305 - djm@cvs.openbsd.org 2013/06/21 05:43:10
2306 [scp.c]
2307 make this -Wsign-compare clean after time_t conversion
2308 - djm@cvs.openbsd.org 2013/06/22 06:31:57
2309 [scp.c]
2310 improved time_t overflow check suggested by guenther@
2311 - jmc@cvs.openbsd.org 2013/06/27 14:05:37
2312 [ssh-keygen.1 ssh.1 ssh_config.5 sshd.8 sshd_config.5]
2313 do not use Sx for sections outwith the man page - ingo informs me that
2314 stuff like html will render with broken links;
2315 issue reported by Eric S. Raymond, via djm
2316 - markus@cvs.openbsd.org 2013/07/02 12:31:43
2317 [dh.c]
2318 remove extra whitespace
2319 - djm@cvs.openbsd.org 2013/07/12 00:19:59
2320 [auth-options.c auth-rsa.c bufaux.c buffer.h channels.c hostfile.c]
2321 [hostfile.h mux.c packet.c packet.h roaming_common.c serverloop.c]
2322 fix pointer-signedness warnings from clang/llvm-3.3; "seems nice" deraadt@
2323 - djm@cvs.openbsd.org 2013/07/12 00:20:00
2324 [sftp.c ssh-keygen.c ssh-pkcs11.c]
2325 fix pointer-signedness warnings from clang/llvm-3.3; "seems nice" deraadt@
2326 - djm@cvs.openbsd.org 2013/07/12 00:43:50
2327 [misc.c]
2328 in ssh_gai_strerror() don't fallback to strerror for EAI_SYSTEM when
2329 errno == 0. Avoids confusing error message in some broken resolver
2330 cases. bz#2122 patch from plautrba AT redhat.com; ok dtucker
2331 - djm@cvs.openbsd.org 2013/07/12 05:42:03
2332 [ssh-keygen.c]
2333 do_print_resource_record() can never be called with a NULL filename, so
2334 don't attempt (and bungle) asking for one if it has not been specified
2335 bz#2127 ok dtucker@
2336 - djm@cvs.openbsd.org 2013/07/12 05:48:55
2337 [ssh.c]
2338 set TCP nodelay for connections started with -N; bz#2124 ok dtucker@
2339 - schwarze@cvs.openbsd.org 2013/07/16 00:07:52
2340 [scp.1 sftp-server.8 ssh-keyscan.1 ssh-keysign.8 ssh-pkcs11-helper.8]
2341 use .Mt for email addresses; from Jan Stary <hans at stare dot cz>; ok jmc@
2342 - djm@cvs.openbsd.org 2013/07/18 01:12:26
2343 [ssh.1]
2344 be more exact wrt perms for ~/.ssh/config; bz#2078
2345
234620130702
2347 - (dtucker) [contrib/cygwin/README contrib/cygwin/ssh-host-config
2348 contrib/cygwin/ssh-user-config] Modernizes and improve readability of
2349 the Cygwin README file (which hasn't been updated for ages), drop
2350 unsupported OSes from the ssh-host-config help text, and drop an
2351 unneeded option from ssh-user-config. Patch from vinschen at redhat com.
2352
235320130610
2354 - (djm) OpenBSD CVS Sync
2355 - dtucker@cvs.openbsd.org 2013/06/07 15:37:52
2356 [channels.c channels.h clientloop.c]
2357 Add an "ABANDONED" channel state and use for mux sessions that are
2358 disconnected via the ~. escape sequence. Channels in this state will
2359 be able to close if the server responds, but do not count as active channels.
2360 This means that if you ~. all of the mux clients when using ControlPersist
2361 on a broken network, the backgrounded mux master will exit when the
2362 Control Persist time expires rather than hanging around indefinitely.
2363 bz#1917, also reported and tested by tedu@. ok djm@ markus@.
2364 - (dtucker) [Makefile.in configure.ac fixalgorithms] Remove unsupported
2365 algorithms (Ciphers, MACs and HostKeyAlgorithms) from man pages.
2366 - (dtucker) [myproposal.h] Do not advertise AES GSM ciphers if we don't have
2367 the required OpenSSL support. Patch from naddy at freebsd.
2368 - (dtucker) [myproposal.h] Make the conditional algorithm support consistent
2369 and add some comments so it's clear what goes where.
2370
237120130605
2372 - (dtucker) [myproposal.h] Enable sha256 kex methods based on the presence of
2373 the necessary functions, not from the openssl version.
2374 - (dtucker) [contrib/ssh-copy-id] bz#2117: Use portable operator in test.
2375 Patch from cjwatson at debian.
2376 - (dtucker) [regress/forwarding.sh] For (as yet unknown) reason, the
2377 forwarding test is extremely slow copying data on some machines so switch
2378 back to copying the much smaller ls binary until we can figure out why
2379 this is.
2380 - (dtucker) [Makefile.in] append $CFLAGS to compiler options when building
2381 modpipe in case there's anything in there we need.
2382 - (dtucker) OpenBSD CVS Sync
2383 - dtucker@cvs.openbsd.org 2013/06/02 21:01:51
2384 [channels.h]
2385 typo in comment
2386 - dtucker@cvs.openbsd.org 2013/06/02 23:36:29
2387 [clientloop.h clientloop.c mux.c]
2388 No need for the mux cleanup callback to be visible so restore it to static
2389 and call it through the detach_user function pointer. ok djm@
2390 - dtucker@cvs.openbsd.org 2013/06/03 00:03:18
2391 [mac.c]
2392 force the MAC output to be 64-bit aligned so umac won't see unaligned
2393 accesses on strict-alignment architectures. bz#2101, patch from
2394 tomas.kuthan at oracle.com, ok djm@
2395 - dtucker@cvs.openbsd.org 2013/06/04 19:12:23
2396 [scp.c]
2397 use MAXPATHLEN for buffer size instead of fixed value. ok markus
2398 - dtucker@cvs.openbsd.org 2013/06/04 20:42:36
2399 [sftp.c]
2400 Make sftp's libedit interface marginally multibyte aware by building up
2401 the quoted string by character instead of by byte. Prevents failures
2402 when linked against a libedit built with wide character support (bz#1990).
2403 "looks ok" djm
2404 - dtucker@cvs.openbsd.org 2013/06/05 02:07:29
2405 [mux.c]
2406 fix leaks in mux error paths, from Zhenbo Xu, found by Melton. bz#1967,
2407 ok djm
2408 - dtucker@cvs.openbsd.org 2013/06/05 02:27:50
2409 [sshd.c]
2410 When running sshd -D, close stderr unless we have explicitly requesting
2411 logging to stderr. From james.hunt at ubuntu.com via bz#1976, djm's patch
2412 so, err, ok dtucker.
2413 - dtucker@cvs.openbsd.org 2013/06/05 12:52:38
2414 [sshconnect2.c]
2415 Fix memory leaks found by Zhenbo Xu and the Melton tool. bz#1967, ok djm
2416 - dtucker@cvs.openbsd.org 2013/06/05 22:00:28
2417 [readconf.c]
2418 plug another memleak. bz#1967, from Zhenbo Xu, detected by Melton, ok djm
2419 - (dtucker) [configure.ac sftp.c openbsd-compat/openbsd-compat.h] Cater for
2420 platforms that don't have multibyte character support (specifically,
2421 mblen).
2422
242320130602
2424 - (tim) [Makefile.in] Make Solaris, UnixWare, & OpenServer linkers happy
2425 linking regress/modpipe.
2426 - (dtucker) OpenBSD CVS Sync
2427 - dtucker@cvs.openbsd.org 2013/06/02 13:33:05
2428 [progressmeter.c]
2429 Add misc.h for monotime prototype. (ID sync only).
2430 - dtucker@cvs.openbsd.org 2013/06/02 13:35:58
2431 [ssh-agent.c]
2432 Make parent_alive_interval time_t to avoid signed/unsigned comparison
2433 - (dtucker) [configure.ac] sys/un.h needs sys/socket.h on some platforms
2434 to prevent noise from configure. Patch from Nathan Osman. (bz#2114).
2435 - (dtucker) [configure.ac] bz#2111: don't try to use lastlog on Android.
2436 Patch from Nathan Osman.
2437 - (tim) [configure.ac regress/Makefile] With rev 1.47 of test-exec.sh we
2438 need a shell that can handle "[ file1 -nt file2 ]". Rather than keep
2439 dealing with shell portability issues in regression tests, we let
2440 configure find us a capable shell on those platforms with an old /bin/sh.
2441 - (tim) [aclocal.m4] Enhance OSSH_CHECK_CFLAG_COMPILE to check stderr.
2442 feedback and ok dtucker
2443 - (tim) [regress/sftp-chroot.sh] skip if no sudo. ok dtucker
2444 - (dtucker) [configure.ac] Some platforms need sys/types.h before sys/un.h.
2445 - (dtucker) [configure.ac] Some other platforms need sys/types.h before
2446 sys/socket.h.
2447
244820130601
2449 - (dtucker) [configure.ac openbsd-compat/xcrypt.c] bz#2112: fall back to
2450 using openssl's DES_crypt function on platorms that don't have a native
2451 one, eg Android. Based on a patch from Nathan Osman.
2452 - (dtucker) [configure.ac defines.h] Test for fd_mask, howmany and NFDBITS
2453 rather than trying to enumerate the plaforms that don't have them.
2454 Based on a patch from Nathan Osman, with help from tim@.
2455 - (dtucker) OpenBSD CVS Sync
2456 - djm@cvs.openbsd.org 2013/05/17 00:13:13
2457 [xmalloc.h cipher.c sftp-glob.c ssh-keyscan.c ssh.c sftp-common.c
2458 ssh-ecdsa.c auth2-chall.c compat.c readconf.c kexgexs.c monitor.c
2459 gss-genr.c cipher-3des1.c kex.c monitor_wrap.c ssh-pkcs11-client.c
2460 auth-options.c rsa.c auth2-pubkey.c sftp.c hostfile.c auth2.c
2461 servconf.c auth.c authfile.c xmalloc.c uuencode.c sftp-client.c
2462 auth2-gss.c sftp-server.c bufaux.c mac.c session.c jpake.c kexgexc.c
2463 sshconnect.c auth-chall.c auth2-passwd.c sshconnect1.c buffer.c
2464 kexecdhs.c kexdhs.c ssh-rsa.c auth1.c ssh-pkcs11.c auth2-kbdint.c
2465 kexdhc.c sshd.c umac.c ssh-dss.c auth2-jpake.c bufbn.c clientloop.c
2466 monitor_mm.c scp.c roaming_client.c serverloop.c key.c auth-rsa.c
2467 ssh-pkcs11-helper.c ssh-keysign.c ssh-keygen.c match.c channels.c
2468 sshconnect2.c addrmatch.c mux.c canohost.c kexecdhc.c schnorr.c
2469 ssh-add.c misc.c auth2-hostbased.c ssh-agent.c bufec.c groupaccess.c
2470 dns.c packet.c readpass.c authfd.c moduli.c]
2471 bye, bye xfree(); ok markus@
2472 - djm@cvs.openbsd.org 2013/05/19 02:38:28
2473 [auth2-pubkey.c]
2474 fix failure to recognise cert-authority keys if a key of a different type
2475 appeared in authorized_keys before it; ok markus@
2476 - djm@cvs.openbsd.org 2013/05/19 02:42:42
2477 [auth.h auth.c key.c monitor.c auth-rsa.c auth2.c auth1.c key.h]
2478 Standardise logging of supplemental information during userauth. Keys
2479 and ruser is now logged in the auth success/failure message alongside
2480 the local username, remote host/port and protocol in use. Certificates
2481 contents and CA are logged too.
2482 Pushing all logging onto a single line simplifies log analysis as it is
2483 no longer necessary to relate information scattered across multiple log
2484 entries. "I like it" markus@
2485 - dtucker@cvs.openbsd.org 2013/05/31 12:28:10
2486 [ssh-agent.c]
2487 Use time_t where appropriate. ok djm
2488 - dtucker@cvs.openbsd.org 2013/06/01 13:15:52
2489 [ssh-agent.c clientloop.c misc.h packet.c progressmeter.c misc.c
2490 channels.c sandbox-systrace.c]
2491 Use clock_gettime(CLOCK_MONOTONIC ...) for ssh timers so that things like
2492 keepalives and rekeying will work properly over clock steps. Suggested by
2493 markus@, "looks good" djm@.
2494 - dtucker@cvs.openbsd.org 2013/06/01 20:59:25
2495 [scp.c sftp-client.c]
2496 Replace S_IWRITE, which isn't standardized, with S_IWUSR, which is. Patch
2497 from Nathan Osman via bz#2085. ok deraadt.
2498 - dtucker@cvs.openbsd.org 2013/06/01 22:34:50
2499 [sftp-client.c]
2500 Update progressmeter when data is acked, not when it's sent. bz#2108, from
2501 Debian via Colin Watson, ok djm@
2502 - (dtucker) [M auth-chall.c auth-krb5.c auth-pam.c cipher-aes.c cipher-ctr.c
2503 groupaccess.c loginrec.c monitor.c monitor_wrap.c session.c sshd.c
2504 sshlogin.c uidswap.c openbsd-compat/bsd-cygwin_util.c
2505 openbsd-compat/getrrsetbyname-ldns.c openbsd-compat/port-aix.c
2506 openbsd-compat/port-linux.c] Replace portable-specific instances of xfree
2507 with the equivalent calls to free.
2508 - (dtucker) [configure.ac misc.c] Look for clock_gettime in librt and fall
2509 back to time(NULL) if we can't find it anywhere.
2510 - (dtucker) [sandbox-seccomp-filter.c] Allow clock_gettimeofday.
2511
251220130529
2513 - (dtucker) [configure.ac openbsd-compat/bsd-misc.h] bz#2087: Add a null
2514 implementation of endgrent for platforms that don't have it (eg Android).
2515 Loosely based on a patch from Nathan Osman, ok djm
2516
2517 20130517
2518 - (dtucker) OpenBSD CVS Sync
2519 - djm@cvs.openbsd.org 2013/03/07 00:20:34
2520 [regress/proxy-connect.sh]
2521 repeat test with a style appended to the username
2522 - dtucker@cvs.openbsd.org 2013/03/23 11:09:43
2523 [regress/test-exec.sh]
2524 Only regenerate host keys if they don't exist or if ssh-keygen has changed
2525 since they were. Reduces test runtime by 5-30% depending on machine
2526 speed.
2527 - dtucker@cvs.openbsd.org 2013/04/06 06:00:22
2528 [regress/rekey.sh regress/test-exec.sh regress/integrity.sh
2529 regress/multiplex.sh Makefile regress/cfgmatch.sh]
2530 Split the regress log into 3 parts: the debug output from ssh, the debug
2531 log from sshd and the output from the client command (ssh, scp or sftp).
2532 Somewhat functional now, will become more useful when ssh/sshd -E is added.
2533 - dtucker@cvs.openbsd.org 2013/04/07 02:16:03
2534 [regress/Makefile regress/rekey.sh regress/integrity.sh
2535 regress/sshd-log-wrapper.sh regress/forwarding.sh regress/test-exec.sh]
2536 use -E option for ssh and sshd to write debuging logs to ssh{,d}.log and
2537 save the output from any failing tests. If a test fails the debug output
2538 from ssh and sshd for the failing tests (and only the failing tests) should
2539 be available in failed-ssh{,d}.log.
2540 - djm@cvs.openbsd.org 2013/04/18 02:46:12
2541 [regress/Makefile regress/sftp-chroot.sh]
2542 test sshd ChrootDirectory+internal-sftp; feedback & ok dtucker@
2543 - dtucker@cvs.openbsd.org 2013/04/22 07:23:08
2544 [regress/multiplex.sh]
2545 Write mux master logs to regress.log instead of ssh.log to keep separate
2546 - djm@cvs.openbsd.org 2013/05/10 03:46:14
2547 [regress/modpipe.c]
2548 sync some portability changes from portable OpenSSH (id sync only)
2549 - dtucker@cvs.openbsd.org 2013/05/16 02:10:35
2550 [regress/rekey.sh]
2551 Add test for time-based rekeying
2552 - dtucker@cvs.openbsd.org 2013/05/16 03:33:30
2553 [regress/rekey.sh]
2554 test rekeying when there's no data being transferred
2555 - dtucker@cvs.openbsd.org 2013/05/16 04:26:10
2556 [regress/rekey.sh]
2557 add server-side rekey test
2558 - dtucker@cvs.openbsd.org 2013/05/16 05:48:31
2559 [regress/rekey.sh]
2560 add tests for RekeyLimit parsing
2561 - dtucker@cvs.openbsd.org 2013/05/17 00:37:40
2562 [regress/agent.sh regress/keytype.sh regress/cfgmatch.sh
2563 regress/forcecommand.sh regress/proto-version.sh regress/test-exec.sh
2564 regress/cipher-speed.sh regress/cert-hostkey.sh regress/cert-userkey.sh
2565 regress/ssh-com.sh]
2566 replace 'echo -n' with 'printf' since it's more portable
2567 also remove "echon" hack.
2568 - dtucker@cvs.openbsd.org 2013/05/17 01:16:09
2569 [regress/agent-timeout.sh]
2570 Pull back some portability changes from -portable:
2571 - TIMEOUT is a read-only variable in some shells
2572 - not all greps have -q so redirect to /dev/null instead.
2573 (ID sync only)
2574 - dtucker@cvs.openbsd.org 2013/05/17 01:32:11
2575 [regress/integrity.sh]
2576 don't print output from ssh before getting it (it's available in ssh.log)
2577 - dtucker@cvs.openbsd.org 2013/05/17 04:29:14
2578 [regress/sftp.sh regress/putty-ciphers.sh regress/cipher-speed.sh
2579 regress/test-exec.sh regress/sftp-batch.sh regress/dynamic-forward.sh
2580 regress/putty-transfer.sh regress/conch-ciphers.sh regress/sftp-cmds.sh
2581 regress/scp.sh regress/ssh-com-sftp.sh regress/rekey.sh
2582 regress/putty-kex.sh regress/stderr-data.sh regress/stderr-after-eof.sh
2583 regress/sftp-badcmds.sh regress/reexec.sh regress/ssh-com-client.sh
2584 regress/sftp-chroot.sh regress/forwarding.sh regress/transfer.sh
2585 regress/multiplex.sh]
2586 Move the setting of DATA and COPY into test-exec.sh
2587 - dtucker@cvs.openbsd.org 2013/05/17 10:16:26
2588 [regress/try-ciphers.sh]
2589 use expr for math to keep diffs vs portable down
2590 (id sync only)
2591 - dtucker@cvs.openbsd.org 2013/05/17 10:23:52
2592 [regress/login-timeout.sh regress/reexec.sh regress/test-exec.sh]
2593 Use SUDO when cat'ing pid files and running the sshd log wrapper so that
2594 it works with a restrictive umask and the pid files are not world readable.
2595 Changes from -portable. (id sync only)
2596 - dtucker@cvs.openbsd.org 2013/05/17 10:24:48
2597 [regress/localcommand.sh]
2598 use backticks for portability. (id sync only)
2599 - dtucker@cvs.openbsd.org 2013/05/17 10:26:26
2600 [regress/sftp-badcmds.sh]
2601 remove unused BATCH variable. (id sync only)
2602 - dtucker@cvs.openbsd.org 2013/05/17 10:28:11
2603 [regress/sftp.sh]
2604 only compare copied data if sftp succeeds. from portable (id sync only)
2605 - dtucker@cvs.openbsd.org 2013/05/17 10:30:07
2606 [regress/test-exec.sh]
2607 wait a bit longer for startup and use case for absolute path.
2608 from portable (id sync only)
2609 - dtucker@cvs.openbsd.org 2013/05/17 10:33:09
2610 [regress/agent-getpeereid.sh]
2611 don't redirect stdout from sudo. from portable (id sync only)
2612 - dtucker@cvs.openbsd.org 2013/05/17 10:34:30
2613 [regress/portnum.sh]
2614 use a more portable negated if structure. from portable (id sync only)
2615 - dtucker@cvs.openbsd.org 2013/05/17 10:35:43
2616 [regress/scp.sh]
2617 use a file extention that's not special on some platforms. from portable
2618 (id sync only)
2619 - (dtucker) [regress/bsd.regress.mk] Remove unused file. We've never used it
2620 in portable and it's long gone in openbsd.
2621 - (dtucker) [regress/integrity.sh]. Force fixed Diffie-Hellman key exchange
2622 methods. When the openssl version doesn't support ECDH then next one on
2623 the list is DH group exchange, but that causes a bit more traffic which can
2624 mean that the tests flip bits in the initial exchange rather than the MACed
2625 traffic and we get different errors to what the tests look for.
2626 - (dtucker) [openbsd-compat/getopt.h] Remove unneeded bits.
2627 - (dtucker) [regress/cfgmatch.sh] Resync config file setup with openbsd.
2628 - (dtucker) [regress/agent-getpeereid.sh] Resync spaces with openbsd.
2629 - (dtucker) [regress/integrity.sh regress/krl.sh regress/test-exec.sh]
2630 Move the jot helper function to portable-specific part of test-exec.sh.
2631 - (dtucker) [regress/test-exec.sh] Move the portable-specific functions
2632 together and add a couple of missing lines from openbsd.
2633 - (dtucker) [regress/stderr-after-eof.sh regress/test-exec.sh] Move the md5
2634 helper function to the portable part of test-exec.sh.
2635 - (dtucker) [regress/runtests.sh] Remove obsolete test driver script.
2636 - (dtucker) [regress/cfgmatch.sh] Remove unneeded sleep renderd obsolete by
2637 rev 1.6 which calls wait.
2638
263920130516
2640 - (djm) [contrib/ssh-copy-id] Fix bug that could cause "rm *" to be
2641 executed if mktemp failed; bz#2105 ok dtucker@
2642 - (dtucker) OpenBSD CVS Sync
2643 - tedu@cvs.openbsd.org 2013/04/23 17:49:45
2644 [misc.c]
2645 use xasprintf instead of a series of strlcats and strdup. ok djm
2646 - tedu@cvs.openbsd.org 2013/04/24 16:01:46
2647 [misc.c]
2648 remove extra parens noticed by nicm
2649 - dtucker@cvs.openbsd.org 2013/05/06 07:35:12
2650 [sftp-server.8]
2651 Reference the version of the sftp draft we actually implement. ok djm@
2652 - djm@cvs.openbsd.org 2013/05/10 03:40:07
2653 [sshconnect2.c]
2654 fix bzero(ptr_to_struct, sizeof(ptr_to_struct)); bz#2100 from
2655 Colin Watson
2656 - djm@cvs.openbsd.org 2013/05/10 04:08:01
2657 [key.c]
2658 memleak in cert_free(), wasn't actually freeing the struct;
2659 bz#2096 from shm AT digitalsun.pl
2660 - dtucker@cvs.openbsd.org 2013/05/10 10:13:50
2661 [ssh-pkcs11-helper.c]
2662 remove unused extern optarg. ok markus@
2663 - dtucker@cvs.openbsd.org 2013/05/16 02:00:34
2664 [ssh_config sshconnect2.c packet.c readconf.h readconf.c clientloop.c
2665 ssh_config.5 packet.h]
2666 Add an optional second argument to RekeyLimit in the client to allow
2667 rekeying based on elapsed time in addition to amount of traffic.
2668 with djm@ jmc@, ok djm
2669 - dtucker@cvs.openbsd.org 2013/05/16 04:09:14
2670 [sshd_config.5 servconf.c servconf.h packet.c serverloop.c monitor.c sshd_config
2671 sshd.c] Add RekeyLimit to sshd with the same syntax as the client allowing
2672 rekeying based on traffic volume or time. ok djm@, help & ok jmc@ for the man
2673 page.
2674 - djm@cvs.openbsd.org 2013/05/16 04:27:50
2675 [ssh_config.5 readconf.h readconf.c]
2676 add the ability to ignore specific unrecognised ssh_config options;
2677 bz#866; ok markus@
2678 - jmc@cvs.openbsd.org 2013/05/16 06:28:45
2679 [ssh_config.5]
2680 put IgnoreUnknown in the right place;
2681 - jmc@cvs.openbsd.org 2013/05/16 06:30:06
2682 [sshd_config.5]
2683 oops! avoid Xr to self;
2684 - dtucker@cvs.openbsd.org 2013/05/16 09:08:41
2685 [log.c scp.c sshd.c serverloop.c schnorr.c sftp.c]
2686 Fix some "unused result" warnings found via clang and -portable.
2687 ok markus@
2688 - dtucker@cvs.openbsd.org 2013/05/16 09:12:31
2689 [readconf.c servconf.c]
2690 switch RekeyLimit traffic volume parsing to scan_scaled. ok djm@
2691 - dtucker@cvs.openbsd.org 2013/05/16 10:43:34
2692 [servconf.c readconf.c]
2693 remove now-unused variables
2694 - dtucker@cvs.openbsd.org 2013/05/16 10:44:06
2695 [servconf.c]
2696 remove another now-unused variable
2697 - (dtucker) [configure.ac readconf.c servconf.c
2698 openbsd-compat/openbsd-compat.h] Add compat bits for scan_scaled.
2699
270020130510
2701 - (dtucker) [configure.ac] Enable -Wsizeof-pointer-memaccess if the compiler
2702 supports it. Mentioned by Colin Watson in bz#2100, ok djm.
2703 - (dtucker) [openbsd-compat/getopt.c] Factor out portibility changes to
2704 getopt.c. Preprocessed source is identical other than line numbers.
2705 - (dtucker) [openbsd-compat/getopt_long.c] Import from OpenBSD. No
2706 portability changes yet.
2707 - (dtucker) [openbsd-compat/Makefile.in openbsd-compat/getopt.c
2708 openbsd-compat/getopt_long.c regress/modpipe.c] Remove getopt.c, add
2709 portability code to getopt_long.c and switch over Makefile and the ugly
2710 hack in modpipe.c. Fixes bz#1448.
2711 - (dtucker) [openbsd-compat/getopt.h openbsd-compat/getopt_long.c
2712 openbsd-compat/openbsd-compat.h] pull in getopt.h from openbsd and plumb
2713 in to use it when we're using our own getopt.
2714 - (dtucker) [kex.c] Only include sha256 and ECC key exchange methods when the
2715 underlying libraries support them.
2716 - (dtucker) [configure.ac] Add -Werror to the -Qunused-arguments test so
2717 we don't get a warning on compilers that *don't* support it. Add
2718 -Wno-unknown-warning-option. Move both to the start of the list for
2719 maximum noise suppression. Tested with gcc 4.6.3, gcc 2.95.4 and clang 2.9.
2720
272120130423
2722 - (djm) [auth.c configure.ac misc.c monitor.c monitor_wrap.c] Support
2723 platforms, such as Android, that lack struct passwd.pw_gecos. Report
2724 and initial patch from Nathan Osman bz#2086; feedback tim@ ok dtucker@
2725 - (djm) OpenBSD CVS Sync
2726 - markus@cvs.openbsd.org 2013/03/05 20:16:09
2727 [sshconnect2.c]
2728 reset pubkey order on partial success; ok djm@
2729 - djm@cvs.openbsd.org 2013/03/06 23:35:23
2730 [session.c]
2731 fatal() when ChrootDirectory specified by running without root privileges;
2732 ok markus@
2733 - djm@cvs.openbsd.org 2013/03/06 23:36:53
2734 [readconf.c]
2735 g/c unused variable (-Wunused)
2736 - djm@cvs.openbsd.org 2013/03/07 00:19:59
2737 [auth2-pubkey.c monitor.c]
2738 reconstruct the original username that was sent by the client, which may
2739 have included a style (e.g. "root:skey") when checking public key
2740 signatures. Fixes public key and hostbased auth when the client specified
2741 a style; ok markus@
2742 - markus@cvs.openbsd.org 2013/03/07 19:27:25
2743 [auth.h auth2-chall.c auth2.c monitor.c sshd_config.5]
2744 add submethod support to AuthenticationMethods; ok and freedback djm@
2745 - djm@cvs.openbsd.org 2013/03/08 06:32:58
2746 [ssh.c]
2747 allow "ssh -f none ..." ok markus@
2748 - djm@cvs.openbsd.org 2013/04/05 00:14:00
2749 [auth2-gss.c krl.c sshconnect2.c]
2750 hush some {unused, printf type} warnings
2751 - djm@cvs.openbsd.org 2013/04/05 00:31:49
2752 [pathnames.h]
2753 use the existing _PATH_SSH_USER_RC define to construct the other
2754 pathnames; bz#2077, ok dtucker@ (no binary change)
2755 - djm@cvs.openbsd.org 2013/04/05 00:58:51
2756 [mux.c]
2757 cleanup mux-created channels that are in SSH_CHANNEL_OPENING state too
2758 (in addition to ones already in OPEN); bz#2079, ok dtucker@
2759 - markus@cvs.openbsd.org 2013/04/06 16:07:00
2760 [channels.c sshd.c]
2761 handle ECONNABORTED for accept(); ok deraadt some time ago...
2762 - dtucker@cvs.openbsd.org 2013/04/07 02:10:33
2763 [log.c log.h ssh.1 ssh.c sshd.8 sshd.c]
2764 Add -E option to ssh and sshd to append debugging logs to a specified file
2765 instead of stderr or syslog. ok markus@, man page help jmc@
2766 - dtucker@cvs.openbsd.org 2013/04/07 09:40:27
2767 [sshd.8]
2768 clarify -e text. suggested by & ok jmc@
2769 - djm@cvs.openbsd.org 2013/04/11 02:27:50
2770 [packet.c]
2771 quiet disconnect notifications on the server from error() back to logit()
2772 if it is a normal client closure; bz#2057 ok+feedback dtucker@
2773 - dtucker@cvs.openbsd.org 2013/04/17 09:04:09
2774 [session.c]
2775 revert rev 1.262; it fails because uid is already set here. ok djm@
2776 - djm@cvs.openbsd.org 2013/04/18 02:16:07
2777 [sftp.c]
2778 make "sftp -q" do what it says on the sticker: hush everything but errors;
2779 ok dtucker@
2780 - djm@cvs.openbsd.org 2013/04/19 01:00:10
2781 [sshd_config.5]
2782 document the requirment that the AuthorizedKeysCommand be owned by root;
2783 ok dtucker@ markus@
2784 - djm@cvs.openbsd.org 2013/04/19 01:01:00
2785 [ssh-keygen.c]
2786 fix some memory leaks; bz#2088 ok dtucker@
2787 - djm@cvs.openbsd.org 2013/04/19 01:03:01
2788 [session.c]
2789 reintroduce 1.262 without the connection-killing bug:
2790 fatal() when ChrootDirectory specified by running without root privileges;
2791 ok markus@
2792 - djm@cvs.openbsd.org 2013/04/19 01:06:50
2793 [authfile.c cipher.c cipher.h kex.c kex.h kexecdh.c kexecdhc.c kexecdhs.c]
2794 [key.c key.h mac.c mac.h packet.c ssh.1 ssh.c]
2795 add the ability to query supported ciphers, MACs, key type and KEX
2796 algorithms to ssh. Includes some refactoring of KEX and key type handling
2797 to be table-driven; ok markus@
2798 - djm@cvs.openbsd.org 2013/04/19 11:10:18
2799 [ssh.c]
2800 add -Q to usage; reminded by jmc@
2801 - djm@cvs.openbsd.org 2013/04/19 12:07:08
2802 [kex.c]
2803 remove duplicated list entry pointed out by naddy@
2804 - dtucker@cvs.openbsd.org 2013/04/22 01:17:18
2805 [mux.c]
2806 typo in debug output: evitval->exitval
2807
280820130418
2809 - (djm) [config.guess config.sub] Update to last versions before they switch
2810 to GPL3. ok dtucker@
2811 - (dtucker) [configure.ac] Use -Qunused-arguments to suppress warnings from
2812 unused argument warnings (in particular, -fno-builtin-memset) from clang.
2813
281420130404
2815 - (dtucker) OpenBSD CVS Sync
2816 - dtucker@cvs.openbsd.org 2013/02/17 23:16:57
2817 [readconf.c ssh.c readconf.h sshconnect2.c]
2818 Keep track of which IndentityFile options were manually supplied and which
2819 were default options, and don't warn if the latter are missing.
2820 ok markus@
2821 - dtucker@cvs.openbsd.org 2013/02/19 02:12:47
2822 [krl.c]
2823 Remove bogus include. ok djm
2824 - dtucker@cvs.openbsd.org 2013/02/22 04:45:09
2825 [ssh.c readconf.c readconf.h]
2826 Don't complain if IdentityFiles specified in system-wide configs are
2827 missing. ok djm, deraadt.
2828 - markus@cvs.openbsd.org 2013/02/22 19:13:56
2829 [sshconnect.c]
2830 support ProxyCommand=- (stdin/out already point to the proxy); ok djm@
2831 - djm@cvs.openbsd.org 2013/02/22 22:09:01
2832 [ssh.c]
2833 Allow IdenityFile=none; ok markus deraadt (and dtucker for an earlier
2834 version)
2835
283620130401
2837 - (dtucker) [openbsd-compat/bsd-cygwin_util.{c,h}] Don't include windows.h
2838 to avoid conflicting definitions of __int64, adding the required bits.
2839 Patch from Corinna Vinschen.
2840
284120130323
2842 - (tim) [Makefile.in] remove some duplication introduced in 20130220 commit.
2843
284420130322
2845 - (djm) [contrib/ssh-copy-id contrib/ssh-copy-id.1] Updated to Phil
2846 Hands' greatly revised version.
2847 - (djm) Release 6.2p1
2848 - (dtucker) [configure.ac] Add stdlib.h to zlib check for exit() prototype.
2849 - (dtucker) [includes.h] Check if _GNU_SOURCE is already defined before
2850 defining it again. Prevents warnings if someone, eg, sets it in CFLAGS.
2851
285220130318
2853 - (djm) [configure.ac log.c scp.c sshconnect2.c openbsd-compat/vis.c]
2854 [openbsd-compat/vis.h] FreeBSD's strnvis isn't compatible with OpenBSD's
2855 so mark it as broken. Patch from des AT des.no
2856
285720130317
2858 - (tim) [configure.ac] OpenServer 5 wants lastlog even though it has none
2859 of the bits the configure test looks for.
2860
286120130316
2862 - (djm) [configure.ac] Disable utmp, wtmp and/or lastlog if the platform
2863 is unable to successfully compile them. Based on patch from des AT
2864 des.no
2865 - (djm) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h]
2866 Add a usleep replacement for platforms that lack it; ok dtucker
2867 - (djm) [session.c] FreeBSD needs setusercontext(..., LOGIN_SETUMASK) to
2868 occur after UID switch; patch from John Marshall via des AT des.no;
2869 ok dtucker@
2870
287120130312
2872 - (dtucker) [regress/Makefile regress/cipher-speed.sh regress/test-exec.sh]
2873 Improve portability of cipher-speed test, based mostly on a patch from
2874 Iain Morgan.
2875 - (dtucker) [auth.c configure.ac platform.c platform.h] Accept uid 2 ("bin")
2876 in addition to root as an owner of system directories on AIX and HP-UX.
2877 ok djm@
2878
287920130307
2880 - (dtucker) [INSTALL] Bump documented autoconf version to what we're
2881 currently using.
2882 - (dtucker) [defines.h] Remove SIZEOF_CHAR bits since the test for it
2883 was removed in configure.ac rev 1.481 as it was redundant.
2884 - (tim) [Makefile.in] Add another missing $(EXEEXT) I should have seen 3 days
2885 ago.
2886 - (djm) [configure.ac] Add a timeout to the select/rlimit test to give it a
2887 chance to complete on broken systems; ok dtucker@
2888
288920130306
2890 - (dtucker) [regress/forward-control.sh] Wait longer for the forwarding
2891 connection to start so that the test works on slower machines.
2892 - (dtucker) [configure.ac] test that we can set number of file descriptors
2893 to zero with setrlimit before enabling the rlimit sandbox. This affects
2894 (at least) HPUX 11.11.
2895
289620130305
2897 - (djm) [regress/modpipe.c] Compilation fix for AIX and parsing fix for
2898 HP/UX. Spotted by Kevin Brott
2899 - (dtucker) [configure.ac] use "=" for shell test and not "==". Spotted by
2900 Amit Kulkarni and Kevin Brott.
2901 - (dtucker) [Makefile.in] Remove trailing "\" on PATHS, which caused obscure
2902 build breakage on (at least) HP-UX 11.11. Found by Amit Kulkarni and Kevin
2903 Brott.
2904 - (tim) [Makefile.in] Add missing $(EXEEXT). Found by Roumen Petrov.
2905
290620130227
2907 - (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
2908 [contrib/suse/openssh.spec] Crank version numbers
2909 - (tim) [regress/forward-control.sh] use sh in case login shell is csh.
2910 - (tim) [regress/integrity.sh] shell portability fix.
2911 - (tim) [regress/integrity.sh] keep old solaris awk from hanging.
2912 - (tim) [regress/krl.sh] keep old solaris awk from hanging.
2913
291420130226
2915 - OpenBSD CVS Sync
2916 - djm@cvs.openbsd.org 2013/02/20 08:27:50
2917 [integrity.sh]
2918 Add an option to modpipe that warns if the modification offset it not
2919 reached in it's stream and turn it on for t-integrity. This should catch
2920 cases where the session is not fuzzed for being too short (cf. my last
2921 "oops" commit)
2922 - (djm) [regress/integrity.sh] Run sshd via $SUDO; fixes tinderbox breakage
2923 for UsePAM=yes configuration
2924
292520130225
2926 - (dtucker) [configure.ac ssh-gss.h] bz#2073: additional #includes needed
2927 to use Solaris native GSS libs. Patch from Pierre Ossman.
2928
292920130223
2930 - (djm) [configure.ac includes.h loginrec.c mux.c sftp.c] Prefer
2931 bsd/libutil.h to libutil.h to avoid deprecation warnings on Ubuntu.
2932 ok tim
2933
293420130222
2935 - (dtucker) [Makefile.in configure.ac] bz#2072: don't link krb5 libs to
2936 ssh(1) since they're not needed. Patch from Pierre Ossman, ok djm.
2937 - (dtucker) [configure.ac] bz#2073: look for Solaris' differently-named
2938 libgss too. Patch from Pierre Ossman, ok djm.
2939 - (djm) [configure.ac sandbox-seccomp-filter.c] Support for Linux
2940 seccomp-bpf sandbox on ARM. Patch from shawnlandden AT gmail.com;
2941 ok dtucker
2942
294320130221
2944 - (tim) [regress/forward-control.sh] shell portability fix.
2945
294620130220
2947 - (tim) [regress/cipher-speed.sh regress/try-ciphers.sh] shell portability fix.
2948 - (tim) [krl.c Makefile.in regress/Makefile regress/modpipe.c] remove unneeded
2949 err.h include from krl.c. Additional portability fixes for modpipe. OK djm
2950 - OpenBSD CVS Sync
2951 - djm@cvs.openbsd.org 2013/02/20 08:27:50
2952 [regress/integrity.sh regress/modpipe.c]
2953 Add an option to modpipe that warns if the modification offset it not
2954 reached in it's stream and turn it on for t-integrity. This should catch
2955 cases where the session is not fuzzed for being too short (cf. my last
2956 "oops" commit)
2957 - djm@cvs.openbsd.org 2013/02/20 08:29:27
2958 [regress/modpipe.c]
2959 s/Id/OpenBSD/ in RCS tag
2960
296120130219
2962 - OpenBSD CVS Sync
2963 - djm@cvs.openbsd.org 2013/02/18 22:26:47
2964 [integrity.sh]
2965 crank the offset yet again; it was still fuzzing KEX one of Darren's
2966 portable test hosts at 2800
2967 - djm@cvs.openbsd.org 2013/02/19 02:14:09
2968 [integrity.sh]
2969 oops, forgot to increase the output of the ssh command to ensure that
2970 we actually reach $offset
2971 - (djm) [regress/integrity.sh] Skip SHA2-based MACs on configurations that
2972 lack support for SHA2.
2973 - (djm) [regress/modpipe.c] Add local err, and errx functions for platforms
2974 that do not have them.
2975
297620130217
2977 - OpenBSD CVS Sync
2978 - djm@cvs.openbsd.org 2013/02/17 23:16:55
2979 [integrity.sh]
2980 make the ssh command generates some output to ensure that there are at
2981 least offset+tries bytes in the stream.
2982
298320130216
2984 - OpenBSD CVS Sync
2985 - djm@cvs.openbsd.org 2013/02/16 06:08:45
2986 [integrity.sh]
2987 make sure the fuzz offset is actually past the end of KEX for all KEX
2988 types. diffie-hellman-group-exchange-sha256 requires an offset around
2989 2700. Noticed via test failures in portable OpenSSH on platforms that
2990 lack ECC and this the more byte-frugal ECDH KEX algorithms.
2991
299220130215
2993 - (djm) [contrib/suse/rc.sshd] Use SSHD_BIN consistently; bz#2056 from
2994 Iain Morgan
2995 - (dtucker) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h]
2996 Use getpgrp() if we don't have getpgid() (old BSDs, maybe others).
2997 - (dtucker) [configure.ac openbsd-compat/Makefile.in openbsd-compat/strtoull.c
2998 openbsd-compat/openbsd-compat.h] Add strtoull to compat library for
2999 platforms that don't have it.
3000 - (dtucker) [openbsd-compat/openbsd-compat.h] Add prototype for strtoul,
3001 group strto* function prototypes together.
3002 - (dtucker) [openbsd-compat/bsd-misc.c] Handle the case where setpgrp() takes
3003 an argument. Pointed out by djm.
3004 - (djm) OpenBSD CVS Sync
3005 - djm@cvs.openbsd.org 2013/02/14 21:35:59
3006 [auth2-pubkey.c]
3007 Correct error message that had a typo and was logging the wrong thing;
3008 patch from Petr Lautrbach
3009 - dtucker@cvs.openbsd.org 2013/02/15 00:21:01
3010 [sshconnect2.c]
3011 Warn more loudly if an IdentityFile provided by the user cannot be read.
3012 bz #1981, ok djm@
3013
301420130214
3015 - (djm) [regress/krl.sh] Don't use ecdsa keys in environment that lack ECC.
3016 - (djm) [regress/krl.sh] typo; found by Iain Morgan
3017 - (djm) [regress/integrity.sh] Start fuzzing from offset 2500 (instead
3018 of 2300) to avoid clobbering the end of (non-MAC'd) KEX. Verified by
3019 Iain Morgan
3020
302120130212
3022 - (djm) OpenBSD CVS Sync
3023 - djm@cvs.openbsd.org 2013/01/24 21:45:37
3024 [krl.c]
3025 fix handling of (unused) KRL signatures; skip string in correct buffer
3026 - djm@cvs.openbsd.org 2013/01/24 22:08:56
3027 [krl.c]
3028 skip serial lookup when cert's serial number is zero
3029 - krw@cvs.openbsd.org 2013/01/25 05:00:27
3030 [krl.c]
3031 Revert last. Breaks due to likely typo. Let djm@ fix later.
3032 ok djm@ via dlg@
3033 - djm@cvs.openbsd.org 2013/01/25 10:22:19
3034 [krl.c]
3035 redo last commit without the vi-vomit that snuck in:
3036 skip serial lookup when cert's serial number is zero
3037 (now with 100% better comment)
3038 - djm@cvs.openbsd.org 2013/01/26 06:11:05
3039 [Makefile.in acss.c acss.h cipher-acss.c cipher.c]
3040 [openbsd-compat/openssl-compat.h]
3041 remove ACSS, now that it is gone from libcrypto too
3042 - djm@cvs.openbsd.org 2013/01/27 10:06:12
3043 [krl.c]
3044 actually use the xrealloc() return value; spotted by xi.wang AT gmail.com
3045 - dtucker@cvs.openbsd.org 2013/02/06 00:20:42
3046 [servconf.c sshd_config sshd_config.5]
3047 Change default of MaxStartups to 10:30:100 to start doing random early
3048 drop at 10 connections up to 100 connections. This will make it harder
3049 to DoS as CPUs have come a long way since the original value was set
3050 back in 2000. Prompted by nion at debian org, ok markus@
3051 - dtucker@cvs.openbsd.org 2013/02/06 00:22:21
3052 [auth.c]
3053 Fix comment, from jfree.e1 at gmail
3054 - djm@cvs.openbsd.org 2013/02/08 00:41:12
3055 [sftp.c]
3056 fix NULL deref when built without libedit and control characters
3057 entered as command; debugging and patch from Iain Morgan an
3058 Loganaden Velvindron in bz#1956
3059 - markus@cvs.openbsd.org 2013/02/10 21:19:34
3060 [version.h]
3061 openssh 6.2
3062 - djm@cvs.openbsd.org 2013/02/10 23:32:10
3063 [ssh-keygen.c]
3064 append to moduli file when screening candidates rather than overwriting.
3065 allows resumption of interrupted screen; patch from Christophe Garault
3066 in bz#1957; ok dtucker@
3067 - djm@cvs.openbsd.org 2013/02/10 23:35:24
3068 [packet.c]
3069 record "Received disconnect" messages at ERROR rather than INFO priority,
3070 since they are abnormal and result in a non-zero ssh exit status; patch
3071 from Iain Morgan in bz#2057; ok dtucker@
3072 - dtucker@cvs.openbsd.org 2013/02/11 21:21:58
3073 [sshd.c]
3074 Add openssl version to debug output similar to the client. ok markus@
3075 - djm@cvs.openbsd.org 2013/02/11 23:58:51
3076 [regress/try-ciphers.sh]
3077 remove acss here too
3078 - (djm) [regress/try-ciphers.sh] clean up CVS merge botch
3079
308020130211
3081 - (djm) [configure.ac openbsd-compat/openssl-compat.h] Repair build on old
3082 libcrypto that lacks EVP_CIPHER_CTX_ctrl
3083
308420130208
3085 - (djm) [contrib/redhat/sshd.init] treat RETVAL as an integer;
3086 patch from Iain Morgan in bz#2059
3087 - (dtucker) [configure.ac openbsd-compat/sys-tree.h] Test if compiler allows
3088 __attribute__ on return values and work around if necessary. ok djm@
3089
309020130207
3091 - (djm) [configure.ac] Don't probe seccomp capability of running kernel
3092 at configure time; the seccomp sandbox will fall back to rlimit at
3093 runtime anyway. Patch from plautrba AT redhat.com in bz#2011
3094
309520130120
3096 - (djm) [cipher-aes.c cipher-ctr.c openbsd-compat/openssl-compat.h]
3097 Move prototypes for replacement ciphers to openssl-compat.h; fix EVP
3098 prototypes for openssl-1.0.0-fips.
3099 - (djm) OpenBSD CVS Sync
3100 - jmc@cvs.openbsd.org 2013/01/18 07:57:47
3101 [ssh-keygen.1]
3102 tweak previous;
3103 - jmc@cvs.openbsd.org 2013/01/18 07:59:46
3104 [ssh-keygen.c]
3105 -u before -V in usage();
3106 - jmc@cvs.openbsd.org 2013/01/18 08:00:49
3107 [sshd_config.5]
3108 tweak previous;
3109 - jmc@cvs.openbsd.org 2013/01/18 08:39:04
3110 [ssh-keygen.1]
3111 add -Q to the options list; ok djm
3112 - jmc@cvs.openbsd.org 2013/01/18 21:48:43
3113 [ssh-keygen.1]
3114 command-line (adj.) -> command line (n.);
3115 - jmc@cvs.openbsd.org 2013/01/19 07:13:25
3116 [ssh-keygen.1]
3117 fix some formatting; ok djm
3118 - markus@cvs.openbsd.org 2013/01/19 12:34:55
3119 [krl.c]
3120 RB_INSERT does not remove existing elments; ok djm@
3121 - (djm) [openbsd-compat/sys-tree.h] Sync with OpenBSD. krl.c needs newer
3122 version.
3123 - (djm) [regress/krl.sh] replacement for jot; most platforms lack it
3124
312520130118
3126 - (djm) OpenBSD CVS Sync
3127 - djm@cvs.openbsd.org 2013/01/17 23:00:01
3128 [auth.c key.c key.h ssh-keygen.1 ssh-keygen.c sshd_config.5]
3129 [krl.c krl.h PROTOCOL.krl]
3130 add support for Key Revocation Lists (KRLs). These are a compact way to
3131 represent lists of revoked keys and certificates, taking as little as
3132 a single bit of incremental cost to revoke a certificate by serial number.
3133 KRLs are loaded via the existing RevokedKeys sshd_config option.
3134 feedback and ok markus@
3135 - djm@cvs.openbsd.org 2013/01/18 00:45:29
3136 [regress/Makefile regress/cert-userkey.sh regress/krl.sh]
3137 Tests for Key Revocation Lists (KRLs)
3138 - djm@cvs.openbsd.org 2013/01/18 03:00:32
3139 [krl.c]
3140 fix KRL generation bug for list sections
3141
314220130117
3143 - (djm) [regress/cipher-speed.sh regress/integrity.sh regress/try-ciphers.sh]
3144 check for GCM support before testing GCM ciphers.
3145
314620130112
3147 - (djm) OpenBSD CVS Sync
3148 - djm@cvs.openbsd.org 2013/01/12 11:22:04
3149 [cipher.c]
3150 improve error message for integrity failure in AES-GCM modes; ok markus@
3151 - djm@cvs.openbsd.org 2013/01/12 11:23:53
3152 [regress/cipher-speed.sh regress/integrity.sh regress/try-ciphers.sh]
3153 test AES-GCM modes; feedback markus@
3154 - (djm) [regress/integrity.sh] repair botched merge
3155
315620130109
3157 - (djm) OpenBSD CVS Sync
3158 - dtucker@cvs.openbsd.org 2012/12/14 05:26:43
3159 [auth.c]
3160 use correct string in error message; from rustybsd at gmx.fr
3161 - djm@cvs.openbsd.org 2013/01/02 00:32:07
3162 [clientloop.c mux.c]
3163 channel_setup_local_fwd_listener() returns 0 on failure, not -ve
3164 bz#2055 reported by mathieu.lacage AT gmail.com
3165 - djm@cvs.openbsd.org 2013/01/02 00:33:49
3166 [PROTOCOL.agent]
3167 correct format description for SSH_AGENTC_ADD_RSA_ID_CONSTRAINED
3168 bz#2051 from david AT lechnology.com
3169 - djm@cvs.openbsd.org 2013/01/03 05:49:36
3170 [servconf.h]
3171 add a couple of ServerOptions members that should be copied to the privsep
3172 child (for consistency, in this case they happen only to be accessed in
3173 the monitor); ok dtucker@
3174 - djm@cvs.openbsd.org 2013/01/03 12:49:01
3175 [PROTOCOL]
3176 fix description of MAC calculation for EtM modes; ok markus@
3177 - djm@cvs.openbsd.org 2013/01/03 12:54:49
3178 [sftp-server.8 sftp-server.c]
3179 allow specification of an alternate start directory for sftp-server(8)
3180 "I like this" markus@
3181 - djm@cvs.openbsd.org 2013/01/03 23:22:58
3182 [ssh-keygen.c]
3183 allow fingerprinting of keys hosted in PKCS#11 tokens: ssh-keygen -lD ...
3184 ok markus@
3185 - jmc@cvs.openbsd.org 2013/01/04 19:26:38
3186 [sftp-server.8 sftp-server.c]
3187 sftp-server.8: add argument name to -d
3188 sftp-server.c: add -d to usage()
3189 ok djm
3190 - markus@cvs.openbsd.org 2013/01/08 18:49:04
3191 [PROTOCOL authfile.c cipher.c cipher.h kex.c kex.h monitor_wrap.c]
3192 [myproposal.h packet.c ssh_config.5 sshd_config.5]
3193 support AES-GCM as defined in RFC 5647 (but with simpler KEX handling)
3194 ok and feedback djm@
3195 - djm@cvs.openbsd.org 2013/01/09 05:40:17
3196 [ssh-keygen.c]
3197 correctly initialise fingerprint type for fingerprinting PKCS#11 keys
3198 - (djm) [cipher.c configure.ac openbsd-compat/openssl-compat.h]
3199 Fix merge botch, automatically detect AES-GCM in OpenSSL, move a little
3200 cipher compat code to openssl-compat.h
3201
320220121217
3203 - (dtucker) [Makefile.in] Add some scaffolding so that the new regress
3204 tests will work with VPATH directories.
3205
320620121213
3207 - (djm) OpenBSD CVS Sync
3208 - markus@cvs.openbsd.org 2012/12/12 16:45:52
3209 [packet.c]
3210 reset incoming_packet buffer for each new packet in EtM-case, too;
3211 this happens if packets are parsed only parially (e.g. ignore
3212 messages sent when su/sudo turn off echo); noted by sthen/millert
3213 - naddy@cvs.openbsd.org 2012/12/12 16:46:10
3214 [cipher.c]
3215 use OpenSSL's EVP_aes_{128,192,256}_ctr() API and remove our hand-rolled
3216 counter mode code; ok djm@
3217 - (djm) [configure.ac cipher-ctr.c] Adapt EVP AES CTR change to retain our
3218 compat code for older OpenSSL
3219 - (djm) [cipher.c] Fix missing prototype for compat code
3220
322120121212
3222 - (djm) OpenBSD CVS Sync
3223 - markus@cvs.openbsd.org 2012/12/11 22:16:21
3224 [monitor.c]
3225 drain the log messages after receiving the keystate from the unpriv
3226 child. otherwise it might block while sending. ok djm@
3227 - markus@cvs.openbsd.org 2012/12/11 22:31:18
3228 [PROTOCOL authfile.c cipher.c cipher.h kex.h mac.c myproposal.h]
3229 [packet.c ssh_config.5 sshd_config.5]
3230 add encrypt-then-mac (EtM) modes to openssh by defining new mac algorithms
3231 that change the packet format and compute the MAC over the encrypted
3232 message (including the packet size) instead of the plaintext data;
3233 these EtM modes are considered more secure and used by default.
3234 feedback and ok djm@
3235 - sthen@cvs.openbsd.org 2012/12/11 22:51:45
3236 [mac.c]
3237 fix typo, s/tem/etm in hmac-ripemd160-tem. ok markus@
3238 - markus@cvs.openbsd.org 2012/12/11 22:32:56
3239 [regress/try-ciphers.sh]
3240 add etm modes
3241 - markus@cvs.openbsd.org 2012/12/11 22:42:11
3242 [regress/Makefile regress/modpipe.c regress/integrity.sh]
3243 test the integrity of the packets; with djm@
3244 - markus@cvs.openbsd.org 2012/12/11 23:12:13
3245 [try-ciphers.sh]
3246 add hmac-ripemd160-etm@openssh.com
3247 - (djm) [mac.c] fix merge botch
3248 - (djm) [regress/Makefile regress/integrity.sh] Make the integrity.sh test
3249 work on platforms without 'jot'
3250 - (djm) [regress/integrity.sh] Fix awk quoting, packet length skip
3251 - (djm) [regress/Makefile] fix t-exec rule
3252
325320121207
3254 - (dtucker) OpenBSD CVS Sync
3255 - dtucker@cvs.openbsd.org 2012/12/06 06:06:54
3256 [regress/keys-command.sh]
3257 Fix some problems with the keys-command test:
3258 - use string comparison rather than numeric comparison
3259 - check for existing KEY_COMMAND file and don't clobber if it exists
3260 - clean up KEY_COMMAND file if we do create it.
3261 - check that KEY_COMMAND is executable (which it won't be if eg /var/run
3262 is mounted noexec).
3263 ok djm.
3264 - jmc@cvs.openbsd.org 2012/12/03 08:33:03
3265 [ssh-add.1 sshd_config.5]
3266 tweak previous;
3267 - markus@cvs.openbsd.org 2012/12/05 15:42:52
3268 [ssh-add.c]
3269 prevent double-free of comment; ok djm@
3270 - dtucker@cvs.openbsd.org 2012/12/07 01:51:35
3271 [serverloop.c]
3272 Cast signal to int for logging. A no-op on openbsd (they're always ints)
3273 but will prevent warnings in portable. ok djm@
3274
327520121205
3276 - (tim) [defines.h] Some platforms are missing ULLONG_MAX. Feedback djm@.
3277
327820121203
3279 - (djm) [openbsd-compat/sys-queue.h] Sync with OpenBSD to get
3280 TAILQ_FOREACH_SAFE needed for upcoming changes.
3281 - (djm) OpenBSD CVS Sync
3282 - djm@cvs.openbsd.org 2012/12/02 20:26:11
3283 [ssh_config.5 sshconnect2.c]
3284 Make IdentitiesOnly apply to keys obtained from a PKCS11Provider.
3285 This allows control of which keys are offered from tokens using
3286 IdentityFile. ok markus@
3287 - djm@cvs.openbsd.org 2012/12/02 20:42:15
3288 [ssh-add.1 ssh-add.c]
3289 make deleting explicit keys "ssh-add -d" symmetric with adding keys -
3290 try to delete the corresponding certificate too and respect the -k option
3291 to allow deleting of the key only; feedback and ok markus@
3292 - djm@cvs.openbsd.org 2012/12/02 20:46:11
3293 [auth-options.c channels.c servconf.c servconf.h serverloop.c session.c]
3294 [sshd_config.5]
3295 make AllowTcpForwarding accept "local" and "remote" in addition to its
3296 current "yes"/"no" to allow the server to specify whether just local or
3297 remote TCP forwarding is enabled. ok markus@
3298 - dtucker@cvs.openbsd.org 2012/10/05 02:20:48
3299 [regress/cipher-speed.sh regress/try-ciphers.sh]
3300 Add umac-128@openssh.com to the list of MACs to be tested
3301 - djm@cvs.openbsd.org 2012/10/19 05:10:42
3302 [regress/cert-userkey.sh]
3303 include a serial number when generating certs
3304 - djm@cvs.openbsd.org 2012/11/22 22:49:30
3305 [regress/Makefile regress/keys-command.sh]
3306 regress for AuthorizedKeysCommand; hints from markus@
3307 - djm@cvs.openbsd.org 2012/12/02 20:47:48
3308 [Makefile regress/forward-control.sh]
3309 regress for AllowTcpForwarding local/remote; ok markus@
3310 - djm@cvs.openbsd.org 2012/12/03 00:14:06
3311 [auth2-chall.c ssh-keygen.c]
3312 Fix compilation with -Wall -Werror (trivial type fixes)
3313 - (djm) [configure.ac] Turn on -g for gcc compilers. Helps pre-installation
3314 debugging. ok dtucker@
3315 - (djm) [configure.ac] Revert previous. configure.ac already does this
3316 for us.
3317
331820121114
3319 - (djm) OpenBSD CVS Sync
3320 - djm@cvs.openbsd.org 2012/11/14 02:24:27
3321 [auth2-pubkey.c]
3322 fix username passed to helper program
3323 prepare stdio fds before closefrom()
3324 spotted by landry@
3325 - djm@cvs.openbsd.org 2012/11/14 02:32:15
3326 [ssh-keygen.c]
3327 allow the full range of unsigned serial numbers; 'fine' deraadt@
3328 - djm@cvs.openbsd.org 2012/12/02 20:34:10
3329 [auth.c auth.h auth1.c auth2-chall.c auth2-gss.c auth2-jpake.c auth2.c]
3330 [monitor.c monitor.h]
3331 Fixes logging of partial authentication when privsep is enabled
3332 Previously, we recorded "Failed xxx" since we reset authenticated before
3333 calling auth_log() in auth2.c. This adds an explcit "Partial" state.
3334
3335 Add a "submethod" to auth_log() to report which submethod is used
3336 for keyboard-interactive.
3337
3338 Fix multiple authentication when one of the methods is
3339 keyboard-interactive.
3340
3341 ok markus@
3342 - dtucker@cvs.openbsd.org 2012/10/05 02:05:30
3343 [regress/multiplex.sh]
3344 Use 'kill -0' to test for the presence of a pid since it's more portable
3345
334620121107
3347 - (djm) OpenBSD CVS Sync
3348 - eric@cvs.openbsd.org 2011/11/28 08:46:27
3349 [moduli.5]
3350 fix formula
3351 ok djm@
3352 - jmc@cvs.openbsd.org 2012/09/26 17:34:38
3353 [moduli.5]
3354 last stage of rfc changes, using consistent Rs/Re blocks, and moving the
3355 references into a STANDARDS section;
3356
335720121105
3358 - (dtucker) [uidswap.c openbsd-compat/Makefile.in
3359 openbsd-compat/bsd-setres_id.c openbsd-compat/bsd-setres_id.h
3360 openbsd-compat/openbsd-compat.h] Move the fallback code for setting uids
3361 and gids from uidswap.c to the compat library, which allows it to work with
3362 the new setresuid calls in auth2-pubkey. with tim@, ok djm@
3363 - (dtucker) [auth2-pubkey.c] wrap paths.h in an ifdef for platforms that
3364 don't have it. Spotted by tim@.
3365
336620121104
3367 - (djm) OpenBSD CVS Sync
3368 - jmc@cvs.openbsd.org 2012/10/31 08:04:50
3369 [sshd_config.5]
3370 tweak previous;
3371 - djm@cvs.openbsd.org 2012/11/04 10:38:43
3372 [auth2-pubkey.c sshd.c sshd_config.5]
3373 Remove default of AuthorizedCommandUser. Administrators are now expected
3374 to explicitly specify a user. feedback and ok markus@
3375 - djm@cvs.openbsd.org 2012/11/04 11:09:15
3376 [auth.h auth1.c auth2.c monitor.c servconf.c servconf.h sshd.c]
3377 [sshd_config.5]
3378 Support multiple required authentication via an AuthenticationMethods
3379 option. This option lists one or more comma-separated lists of
3380 authentication method names. Successful completion of all the methods in
3381 any list is required for authentication to complete;
3382 feedback and ok markus@
3383
338420121030
3385 - (djm) OpenBSD CVS Sync
3386 - markus@cvs.openbsd.org 2012/10/05 12:34:39
3387 [sftp.c]
3388 fix signed vs unsigned warning; feedback & ok: djm@
3389 - djm@cvs.openbsd.org 2012/10/30 21:29:55
3390 [auth-rsa.c auth.c auth.h auth2-pubkey.c servconf.c servconf.h]
3391 [sshd.c sshd_config sshd_config.5]
3392 new sshd_config option AuthorizedKeysCommand to support fetching
3393 authorized_keys from a command in addition to (or instead of) from
3394 the filesystem. The command is run as the target server user unless
3395 another specified via a new AuthorizedKeysCommandUser option.
3396
3397 patch originally by jchadima AT redhat.com, reworked by me; feedback
3398 and ok markus@ 165 and ok markus@
3399 166
340020121019 167commit 39e2f1229562e1195169905607bc12290d21f021
3401 - (tim) [buildpkg.sh.in] Double up on some backslashes so they end up in 168Author: millert@openbsd.org <millert@openbsd.org>
3402 the generated file as intended. 169Date: Sun Mar 1 15:44:40 2015 +0000
3403
340420121005
3405 - (dtucker) OpenBSD CVS Sync
3406 - djm@cvs.openbsd.org 2012/09/17 09:54:44
3407 [sftp.c]
3408 an XXX for later
3409 - markus@cvs.openbsd.org 2012/09/17 13:04:11
3410 [packet.c]
3411 clear old keys on rekeing; ok djm
3412 - dtucker@cvs.openbsd.org 2012/09/18 10:36:12
3413 [sftp.c]
3414 Add bounds check on sftp tab-completion. Part of a patch from from
3415 Jean-Marc Robert via tech@, ok djm
3416 - dtucker@cvs.openbsd.org 2012/09/21 10:53:07
3417 [sftp.c]
3418 Fix improper handling of absolute paths when PWD is part of the completed
3419 path. Patch from Jean-Marc Robert via tech@, ok djm.
3420 - dtucker@cvs.openbsd.org 2012/09/21 10:55:04
3421 [sftp.c]
3422 Fix handling of filenames containing escaped globbing characters and
3423 escape "#" and "*". Patch from Jean-Marc Robert via tech@, ok djm.
3424 - jmc@cvs.openbsd.org 2012/09/26 16:12:13
3425 [ssh.1]
3426 last stage of rfc changes, using consistent Rs/Re blocks, and moving the
3427 references into a STANDARDS section;
3428 - naddy@cvs.openbsd.org 2012/10/01 13:59:51
3429 [monitor_wrap.c]
3430 pasto; ok djm@
3431 - djm@cvs.openbsd.org 2012/10/02 07:07:45
3432 [ssh-keygen.c]
3433 fix -z option, broken in revision 1.215
3434 - markus@cvs.openbsd.org 2012/10/04 13:21:50
3435 [myproposal.h ssh_config.5 umac.h sshd_config.5 ssh.1 sshd.8 mac.c]
3436 add umac128 variant; ok djm@ at n2k12
3437 - dtucker@cvs.openbsd.org 2012/09/06 04:11:07
3438 [regress/try-ciphers.sh]
3439 Restore missing space. (Id sync only).
3440 - dtucker@cvs.openbsd.org 2012/09/09 11:51:25
3441 [regress/multiplex.sh]
3442 Add test for ssh -Ostop
3443 - dtucker@cvs.openbsd.org 2012/09/10 00:49:21
3444 [regress/multiplex.sh]
3445 Log -O cmd output to the log file and make logging consistent with the
3446 other tests. Test clean shutdown of an existing channel when testing
3447 "stop".
3448 - dtucker@cvs.openbsd.org 2012/09/10 01:51:19
3449 [regress/multiplex.sh]
3450 use -Ocheck and waiting for completions by PID to make multiplexing test
3451 less racy and (hopefully) more reliable on slow hardware.
3452 - [Makefile umac.c] Add special-case target to build umac128.o.
3453 - [umac.c] Enforce allowed umac output sizes. From djm@.
3454 - [Makefile.in] "Using $< in a non-suffix rule context is a GNUmake idiom".
3455
345620120917
3457 - (dtucker) OpenBSD CVS Sync
3458 - dtucker@cvs.openbsd.org 2012/09/13 23:37:36
3459 [servconf.c]
3460 Fix comment line length
3461 - markus@cvs.openbsd.org 2012/09/14 16:51:34
3462 [sshconnect.c]
3463 remove unused variable
3464
346520120907
3466 - (dtucker) OpenBSD CVS Sync
3467 - dtucker@cvs.openbsd.org 2012/09/06 09:50:13
3468 [clientloop.c]
3469 Make the escape command help (~?) context sensitive so that only commands
3470 that will work in the current session are shown. ok markus@
3471 - jmc@cvs.openbsd.org 2012/09/06 13:57:42
3472 [ssh.1]
3473 missing letter in previous;
3474 - dtucker@cvs.openbsd.org 2012/09/07 00:30:19
3475 [clientloop.c]
3476 Print '^Z' instead of a raw ^Z when the sequence is not supported. ok djm@
3477 - dtucker@cvs.openbsd.org 2012/09/07 01:10:21
3478 [clientloop.c]
3479 Merge escape help text for ~v and ~V; ok djm@
3480 - dtucker@cvs.openbsd.org 2012/09/07 06:34:21
3481 [clientloop.c]
3482 when muxmaster is run with -N, make it shut down gracefully when a client
3483 sends it "-O stop" rather than hanging around (bz#1985). ok djm@
3484
348520120906
3486 - (dtucker) OpenBSD CVS Sync
3487 - jmc@cvs.openbsd.org 2012/08/15 18:25:50
3488 [ssh-keygen.1]
3489 a little more info on certificate validity;
3490 requested by Ross L Richardson, and provided by djm
3491 - dtucker@cvs.openbsd.org 2012/08/17 00:45:45
3492 [clientloop.c clientloop.h mux.c]
3493 Force a clean shutdown of ControlMaster client sessions when the ~. escape
3494 sequence is used. This means that ~. should now work in mux clients even
3495 if the server is no longer responding. Found by tedu, ok djm.
3496 - djm@cvs.openbsd.org 2012/08/17 01:22:56
3497 [kex.c]
3498 add some comments about better handling first-KEX-follows notifications
3499 from the server. Nothing uses these right now. No binary change
3500 - djm@cvs.openbsd.org 2012/08/17 01:25:58
3501 [ssh-keygen.c]
3502 print details of which host lines were deleted when using
3503 "ssh-keygen -R host"; ok markus@
3504 - djm@cvs.openbsd.org 2012/08/17 01:30:00
3505 [compat.c sshconnect.c]
3506 Send client banner immediately, rather than waiting for the server to
3507 move first for SSH protocol 2 connections (the default). Patch based on
3508 one in bz#1999 by tls AT panix.com, feedback dtucker@ ok markus@
3509 - dtucker@cvs.openbsd.org 2012/09/06 04:37:39
3510 [clientloop.c log.c ssh.1 log.h]
3511 Add ~v and ~V escape sequences to raise and lower the logging level
3512 respectively. Man page help from jmc, ok deraadt jmc
3513
351420120830
3515 - (dtucker) [moduli] Import new moduli file.
3516
351720120828
3518 - (djm) Release openssh-6.1
3519
352020120828
3521 - (dtucker) [openbsd-compat/bsd-cygwin_util.h] define WIN32_LEAN_AND_MEAN
3522 for compatibility with future mingw-w64 headers. Patch from vinschen at
3523 redhat com.
3524
352520120822
3526 - (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
3527 [contrib/suse/openssh.spec] Update version numbers
3528
352920120731
3530 - (djm) OpenBSD CVS Sync
3531 - jmc@cvs.openbsd.org 2012/07/06 06:38:03
3532 [ssh-keygen.c]
3533 missing full stop in usage();
3534 - djm@cvs.openbsd.org 2012/07/10 02:19:15
3535 [servconf.c servconf.h sshd.c sshd_config]
3536 Turn on systrace sandboxing of pre-auth sshd by default for new installs
3537 by shipping a config that overrides the current UsePrivilegeSeparation=yes
3538 default. Make it easier to flip the default in the future by adding too.
3539 prodded markus@ feedback dtucker@ "get it in" deraadt@
3540 - dtucker@cvs.openbsd.org 2012/07/13 01:35:21
3541 [servconf.c]
3542 handle long comments in config files better. bz#2025, ok markus
3543 - markus@cvs.openbsd.org 2012/07/22 18:19:21
3544 [version.h]
3545 openssh 6.1
3546
354720120720
3548 - (dtucker) Import regened moduli file.
3549
355020120706
3551 - (djm) [sandbox-seccomp-filter.c] fallback to rlimit if seccomp filter is
3552 not available. Allows use of sshd compiled on host with a filter-capable
3553 kernel on hosts that lack the support. bz#2011 ok dtucker@
3554 - (djm) [configure.ac] Recursively expand $(bindir) to ensure it has no
3555 unexpanded $(prefix) embedded. bz#2007 patch from nix-corp AT
3556 esperi.org.uk; ok dtucker@
3557- (djm) OpenBSD CVS Sync
3558 - dtucker@cvs.openbsd.org 2012/07/06 00:41:59
3559 [moduli.c ssh-keygen.1 ssh-keygen.c]
3560 Add options to specify starting line number and number of lines to process
3561 when screening moduli candidates. This allows processing of different
3562 parts of a candidate moduli file in parallel. man page help jmc@, ok djm@
3563 - djm@cvs.openbsd.org 2012/07/06 01:37:21
3564 [mux.c]
3565 fix memory leak of passed-in environment variables and connection
3566 context when new session message is malformed; bz#2003 from Bert.Wesarg
3567 AT googlemail.com
3568 - djm@cvs.openbsd.org 2012/07/06 01:47:38
3569 [ssh.c]
3570 move setting of tty_flag to after config parsing so RequestTTY options
3571 are correctly picked up. bz#1995 patch from przemoc AT gmail.com;
3572 ok dtucker@
3573 170
357420120704 171 upstream commit
3575 - (dtucker) [configure.ac openbsd-compat/bsd-misc.h] Add setlinebuf for 172
3576 platforms that don't have it. "looks good" tim@ 173 Make sure we only call getnameinfo() for AF_INET or AF_INET6
3577 174 sockets. getpeername() of a Unix domain socket may return without error on
357820120703 175 some systems without actually setting ss_family so getnameinfo() was getting
3579 - (dtucker) [configure.ac] Detect platforms that can't use select(2) with 176 called with ss_family set to AF_UNSPEC. OK djm@
3580 setrlimit(RLIMIT_NOFILE, rl_zero) and disable the rlimit sandbox on those. 177
3581 - (dtucker) [configure.ac sandbox-rlimit.c] Test whether or not 178commit e47536ba9692d271b8ad89078abdecf0a1c11707
3582 setrlimit(RLIMIT_FSIZE, rl_zero) and skip it if it's not supported. Its 179Author: Damien Miller <djm@mindrot.org>
3583 benefit is minor, so it's not worth disabling the sandbox if it doesn't 180Date: Sat Feb 28 08:20:11 2015 -0800
3584 work. 181
3585 182 portability fixes for regress/netcat.c
358620120702 183
3587- (dtucker) OpenBSD CVS Sync 184 Mostly avoiding "err(1, NULL)"
3588 - naddy@cvs.openbsd.org 2012/06/29 13:57:25 185
3589 [ssh_config.5 sshd_config.5] 186commit 02973ad5f6f49d8420e50a392331432b0396c100
3590 match the documented MAC order of preference to the actual one; 187Author: Damien Miller <djm@mindrot.org>
3591 ok dtucker@ 188Date: Sat Feb 28 08:05:27 2015 -0800
3592 - markus@cvs.openbsd.org 2012/06/30 14:35:09 189
3593 [sandbox-systrace.c sshd.c] 190 twiddle another test for portability
3594 fix a during the load of the sandbox policies (child can still make 191
3595 the read-syscall and wait forever for systrace-answers) by replacing 192 from Tom G. Christensen
3596 the read/write synchronisation with SIGSTOP/SIGCONT; 193
3597 report and help hshoexer@; ok djm@, dtucker@ 194commit f7f3116abf2a6e2f309ab096b08c58d19613e5d0
3598 - dtucker@cvs.openbsd.org 2012/07/02 08:50:03 195Author: Damien Miller <djm@mindrot.org>
3599 [ssh.c] 196Date: Fri Feb 27 15:52:49 2015 -0800
3600 set interactive ToS for forwarded X11 sessions. ok djm@ 197
3601 - dtucker@cvs.openbsd.org 2012/07/02 12:13:26 198 twiddle test for portability
3602 [ssh-pkcs11-helper.c sftp-client.c] 199
3603 fix a couple of "assigned but not used" warnings. ok markus@ 200commit 1ad3a77cc9d5568f5437ff99d377aa7a41859b83
3604 - dtucker@cvs.openbsd.org 2012/07/02 14:37:06 201Author: Damien Miller <djm@mindrot.org>
3605 [regress/connect-privsep.sh] 202Date: Thu Feb 26 20:33:22 2015 -0800
3606 remove exit from end of test since it prevents reporting failure 203
3607 - (dtucker) [regress/reexec.sh regress/sftp-cmds.sh regress/test-exec.sh] 204 make regress/netcat.c fd passing (more) portable
3608 Move cygwin detection to test-exec and use to skip reexec test on cygwin. 205
3609 - (dtucker) [regress/test-exec.sh] Correct uname for cygwin/w2k. 206commit 9e1cfca7e1fe9cf8edb634fc894e43993e4da1ea
3610 207Author: Damien Miller <djm@mindrot.org>
361120120629 208Date: Thu Feb 26 20:32:58 2015 -0800
3612 - OpenBSD CVS Sync 209
3613 - dtucker@cvs.openbsd.org 2012/06/21 00:16:07 210 create OBJ/valgrind-out before running unittests
3614 [addrmatch.c] 211
3615 fix strlcpy truncation check. from carsten at debian org, ok markus 212commit bd58853102cee739f0e115e6d4b5334332ab1442
3616 - dtucker@cvs.openbsd.org 2012/06/22 12:30:26 213Author: Damien Miller <djm@mindrot.org>
3617 [monitor.c sshconnect2.c] 214Date: Wed Feb 25 16:58:22 2015 -0800
3618 remove dead code following 'for (;;)' loops. 215
3619 From Steve.McClellan at radisys com, ok markus@ 216 valgrind support
3620 - dtucker@cvs.openbsd.org 2012/06/22 14:36:33 217
3621 [sftp.c] 218commit f43d17269194761eded9e89f17456332f4c83824
3622 Remove unused variable leftover from tab-completion changes. 219Author: djm@openbsd.org <djm@openbsd.org>
3623 From Steve.McClellan at radisys com, ok markus@ 220Date: Thu Feb 26 20:45:47 2015 +0000
3624 - dtucker@cvs.openbsd.org 2012/06/26 11:02:30 221
3625 [sandbox-systrace.c] 222 upstream commit
3626 Add mquery to the list of allowed syscalls for "UsePrivilegeSeparation 223
3627 sandbox" since malloc now uses it. From johnw.mail at gmail com. 224 don't printf NULL key comments; reported by Tom Christensen
3628 - dtucker@cvs.openbsd.org 2012/06/28 05:07:45 225
3629 [mac.c myproposal.h ssh_config.5 sshd_config.5] 226commit 6e6458b476ec854db33e3e68ebf4f489d0ab3df8
3630 Remove hmac-sha2-256-96 and hmac-sha2-512-96 MACs since they were removed 227Author: djm@openbsd.org <djm@openbsd.org>
3631 from draft6 of the spec and will not be in the RFC when published. Patch 228Date: Wed Feb 25 23:05:47 2015 +0000
3632 from mdb at juniper net via bz#2023, ok markus. 229
3633 - naddy@cvs.openbsd.org 2012/06/29 13:57:25 230 upstream commit
3634 [ssh_config.5 sshd_config.5] 231
3635 match the documented MAC order of preference to the actual one; ok dtucker@ 232 zero cmsgbuf before use; we initialise the bits we use
3636 - dtucker@cvs.openbsd.org 2012/05/13 01:42:32 233 but valgrind still spams warning on it
3637 [regress/addrmatch.sh] 234
3638 Add "Match LocalAddress" and "Match LocalPort" to sshd and adjust tests 235commit a63cfa26864b93ab6afefad0b630e5358ed8edfa
3639 to match. Feedback and ok djm@ markus@. 236Author: djm@openbsd.org <djm@openbsd.org>
3640 - djm@cvs.openbsd.org 2012/06/01 00:47:35 237Date: Wed Feb 25 19:54:02 2015 +0000
3641 [regress/multiplex.sh regress/forwarding.sh] 238
3642 append to rather than truncate test log; bz#2013 from openssh AT 239 upstream commit
3643 roumenpetrov.info 240
3644 - djm@cvs.openbsd.org 2012/06/01 00:52:52 241 fix small memory leak when UpdateHostkeys=no
3645 [regress/sftp-cmds.sh] 242
3646 don't delete .* on cleanup due to unintended env expansion; pointed out in 243commit e6b950341dd75baa8526f1862bca39e52f5b879b
3647 bz#2014 by openssh AT roumenpetrov.info 244Author: Tim Rice <tim@multitalents.net>
3648 - dtucker@cvs.openbsd.org 2012/06/26 12:06:59 245Date: Wed Feb 25 09:56:48 2015 -0800
3649 [regress/connect-privsep.sh] 246
3650 test sandbox with every malloc option 247 Revert "Work around finicky USL linker so netcat will build."
3651 - dtucker@cvs.openbsd.org 2012/06/28 05:07:45 248
3652 [regress/try-ciphers.sh regress/cipher-speed.sh] 249 This reverts commit d1db656021d0cd8c001a6692f772f1de29b67c8b.
3653 Remove hmac-sha2-256-96 and hmac-sha2-512-96 MACs since they were removed 250
3654 from draft6 of the spec and will not be in the RFC when published. Patch 251 No longer needed with commit 678e473e2af2e4802f24dd913985864d9ead7fb3
3655 from mdb at juniper net via bz#2023, ok markus. 252
3656 - (dtucker) [myproposal.h] Remove trailing backslash to fix compile error. 253commit 6f621603f9cff2a5d6016a404c96cb2f8ac2dec0
3657 - (dtucker) [key.c] ifdef out sha256 key types on platforms that don't have 254Author: djm@openbsd.org <djm@openbsd.org>
3658 the required functions in libcrypto. 255Date: Wed Feb 25 17:29:38 2015 +0000
3659 256
366020120628 257 upstream commit
3661 - (dtucker) [openbsd-compat/getrrsetbyname-ldns.c] bz #2022: prevent null 258
3662 pointer deref in the client when built with LDNS and using DNSSEC with a 259 don't leak validity of user in "too many authentication
3663 CNAME. Patch from gregdlg+mr at hochet info. 260 failures" disconnect message; reported by Sebastian Reitenbach
3664 261
366520120622 262commit 6288e3a935494df12519164f52ca5c8c65fc3ca5
3666 - (dtucker) [contrib/cygwin/ssh-host-config] Ensure that user sshd runs as 263Author: naddy@openbsd.org <naddy@openbsd.org>
3667 can logon as a service. Patch from vinschen at redhat com. 264Date: Tue Feb 24 15:24:05 2015 +0000
3668 265
366920120620 266 upstream commit
3670 - (djm) OpenBSD CVS Sync 267
3671 - djm@cvs.openbsd.org 2011/12/02 00:41:56 268 add -v (show ASCII art) to -l's synopsis; ok djm@
3672 [mux.c] 269
3673 fix bz#1948: ssh -f doesn't fork for multiplexed connection. 270commit 678e473e2af2e4802f24dd913985864d9ead7fb3
271Author: Darren Tucker <dtucker@zip.com.au>
272Date: Thu Feb 26 04:12:58 2015 +1100
273
274 Remove dependency on xmalloc.
275
276 Remove ssh_get_progname's dependency on xmalloc, which should reduce
277 link order problems. ok djm@
278
279commit 5d5ec165c5b614b03678afdad881f10e25832e46
280Author: Darren Tucker <dtucker@zip.com.au>
281Date: Wed Feb 25 15:32:49 2015 +1100
282
283 Restrict ECDSA and ECDH tests.
284
285 ifdef out some more ECDSA and ECDH tests when built against an OpenSSL
286 that does not have eliptic curve functionality.
287
288commit 1734e276d99b17e92d4233fac7aef3a3180aaca7
289Author: Darren Tucker <dtucker@zip.com.au>
290Date: Wed Feb 25 13:40:45 2015 +1100
291
292 Move definition of _NSIG.
293
294 _NSIG is only unsed in one file, so move it there prevent redefinition
295 warnings reported by Kevin Brott.
296
297commit a47ead7c95cfbeb72721066c4da2312e5b1b9f3d
298Author: Darren Tucker <dtucker@zip.com.au>
299Date: Wed Feb 25 13:17:40 2015 +1100
300
301 Add includes.h for compatibility stuff.
302
303commit 38806bda6d2e48ad32812b461eebe17672ada771
304Author: Damien Miller <djm@mindrot.org>
305Date: Tue Feb 24 16:50:06 2015 -0800
306
307 include netdb.h to look for MAXHOSTNAMELEN; ok tim
308
309commit d1db656021d0cd8c001a6692f772f1de29b67c8b
310Author: Tim Rice <tim@multitalents.net>
311Date: Tue Feb 24 10:42:08 2015 -0800
312
313 Work around finicky USL linker so netcat will build.
314
315commit cb030ce25f555737e8ba97bdd7883ac43f3ff2a3
316Author: Damien Miller <djm@mindrot.org>
317Date: Tue Feb 24 09:23:04 2015 -0800
318
319 include includes.h to avoid build failure on AIX
320
321commit 13af342458f5064144abbb07e5ac9bbd4eb42567
322Author: Tim Rice <tim@multitalents.net>
323Date: Tue Feb 24 07:56:47 2015 -0800
324
325 Original portability patch from djm@ for platforms missing err.h.
326 Fix name space clash on Solaris 10. Still more to do for Solaris 10
327 to deal with msghdr structure differences. ok djm@
328
329commit 910209203d0cd60c5083901cbcc0b7b44d9f48d2
330Author: Tim Rice <tim@multitalents.net>
331Date: Mon Feb 23 22:06:56 2015 -0800
332
333 cleaner way fix dispatch.h portion of commit
334 a88dd1da119052870bb2654c1a32c51971eade16
335 (some systems have sig_atomic_t in signal.h, some in sys/signal.h)
336 Sounds good to me djm@
337
338commit 676c38d7cbe65b76bbfff796861bb6615cc6a596
339Author: Tim Rice <tim@multitalents.net>
340Date: Mon Feb 23 21:51:33 2015 -0800
341
342 portability fix: if we can't dind a better define for HOST_NAME_MAX, use 255
343
344commit 1221b22023dce38cbc90ba77eae4c5d78c77a5e6
345Author: Tim Rice <tim@multitalents.net>
346Date: Mon Feb 23 21:50:34 2015 -0800
347
348 portablity fix: s/__inline__/inline/
349
350commit 4c356308a88d309c796325bb75dce90ca16591d5
351Author: Darren Tucker <dtucker@zip.com.au>
352Date: Tue Feb 24 13:49:31 2015 +1100
353
354 Wrap stdint.h includes in HAVE_STDINT_H.
355
356commit c9c88355c6a27a908e7d1e5003a2b35ea99c1614
357Author: Darren Tucker <dtucker@zip.com.au>
358Date: Tue Feb 24 13:43:57 2015 +1100
359
360 Add AI_NUMERICSERV to fake-rfc2553.
361
362 Our getaddrinfo implementation always returns numeric values already.
363
364commit ef342ab1ce6fb9a4b30186c89c309d0ae9d0eeb4
365Author: Darren Tucker <dtucker@zip.com.au>
366Date: Tue Feb 24 13:39:57 2015 +1100
367
368 Include OpenSSL's objects.h before bn.h.
369
370 Prevents compile errors on some platforms (at least old GCCs and AIX's
371 XLC compilers).
372
373commit dcc8997d116f615195aa7c9ec019fb36c28c6228
374Author: Darren Tucker <dtucker@zip.com.au>
375Date: Tue Feb 24 12:30:59 2015 +1100
376
377 Convert two macros into functions.
378
379 Convert packet_send_debug and packet_disconnect from macros to
380 functions. Some older GCCs (2.7.x, 2.95.x) see to have problems with
381 variadic macros with only one argument so we convert these two into
382 functions. ok djm@
383
384commit 2285c30d51b7e2052c6526445abe7e7cc7e170a1
385Author: djm@openbsd.org <djm@openbsd.org>
386Date: Mon Feb 23 22:21:21 2015 +0000
387
388 upstream commit
389
390 further silence spurious error message even when -v is
391 specified (e.g. to get visual host keys); reported by naddy@
392
393commit 9af21979c00652029e160295e988dea40758ece2
394Author: Damien Miller <djm@mindrot.org>
395Date: Tue Feb 24 09:04:32 2015 +1100
396
397 don't include stdint.h unless HAVE_STDINT_H set
398
399commit 62f678dd51660d6f8aee1da33d3222c5de10a89e
400Author: Damien Miller <djm@mindrot.org>
401Date: Tue Feb 24 09:02:54 2015 +1100
402
403 nother sys/queue.h -> sys-queue.h fix
404
405 spotted by Tom Christensen
406
407commit b3c19151cba2c0ed01b27f55de0d723ad07ca98f
408Author: djm@openbsd.org <djm@openbsd.org>
409Date: Mon Feb 23 20:32:15 2015 +0000
410
411 upstream commit
412
413 fix a race condition by using a mux socket rather than an
414 ineffectual wait statement
415
416commit a88dd1da119052870bb2654c1a32c51971eade16
417Author: Damien Miller <djm@mindrot.org>
418Date: Tue Feb 24 06:30:29 2015 +1100
419
420 various include fixes for portable
421
422commit 5248429b5ec524d0a65507cff0cdd6e0cb99effd
423Author: djm@openbsd.org <djm@openbsd.org>
424Date: Mon Feb 23 16:55:51 2015 +0000
425
426 upstream commit
427
428 add an XXX to remind me to improve sshkey_load_public
429
430commit e94e4b07ef2eaead38b085a60535df9981cdbcdb
431Author: djm@openbsd.org <djm@openbsd.org>
432Date: Mon Feb 23 16:55:31 2015 +0000
433
434 upstream commit
435
436 silence a spurious error message when listing
437 fingerprints for known_hosts; bz#2342
438
439commit f2293a65392b54ac721f66bc0b44462e8d1d81f8
440Author: djm@openbsd.org <djm@openbsd.org>
441Date: Mon Feb 23 16:33:25 2015 +0000
442
443 upstream commit
444
445 fix setting/clearing of TTY raw mode around
446 UpdateHostKeys=ask confirmation question; reported by Herb Goldman
447
448commit f2004cd1adf34492eae0a44b1ef84e0e31b06088
449Author: Darren Tucker <dtucker@zip.com.au>
450Date: Mon Feb 23 05:04:21 2015 +1100
451
452 Repair for non-ECC OpenSSL.
453
454 Ifdef out the ECC parts when building with an OpenSSL that doesn't have
455 it.
456
457commit 37f9220db8d1a52c75894c3de1e5f2ae5bd71b6f
458Author: Darren Tucker <dtucker@zip.com.au>
459Date: Mon Feb 23 03:07:24 2015 +1100
460
461 Wrap stdint.h includes in ifdefs.
462
463commit f81f1bbc5b892c8614ea740b1f92735652eb43f0
464Author: Tim Rice <tim@multitalents.net>
465Date: Sat Feb 21 18:12:10 2015 -0800
466
467 out of tree build fix
468
469commit 2e13a1e4d22f3b503c3bfc878562cc7386a1d1ae
470Author: Tim Rice <tim@multitalents.net>
471Date: Sat Feb 21 18:08:51 2015 -0800
472
473 mkdir kex unit test directory so testing out of tree builds works
474
475commit 1797f49b1ba31e8700231cd6b1d512d80bb50d2c
476Author: halex@openbsd.org <halex@openbsd.org>
477Date: Sat Feb 21 21:46:57 2015 +0000
478
479 upstream commit
480
481 make "ssh-add -d" properly remove a corresponding
482 certificate, and also not whine and fail if there is none
483
484 ok djm@
485
486commit 7faaa32da83a609059d95dbfcb0649fdb04caaf6
487Author: Damien Miller <djm@mindrot.org>
488Date: Sun Feb 22 07:57:27 2015 +1100
489
490 mkdir hostkey and bitmap unit test directories
491
492commit bd49da2ef197efac5e38f5399263a8b47990c538
493Author: djm@openbsd.org <djm@openbsd.org>
494Date: Fri Feb 20 23:46:01 2015 +0000
495
496 upstream commit
497
498 sort options useable under Match case-insensitively; prodded
499 jmc@
500
501commit 1a779a0dd6cd8b4a1a40ea33b5415ab8408128ac
502Author: djm@openbsd.org <djm@openbsd.org>
503Date: Sat Feb 21 20:51:02 2015 +0000
504
505 upstream commit
506
507 correct paths to configuration files being written/updated;
508 they live in $OBJ not cwd; some by Roumen Petrov
509
510commit 28ba006c1acddff992ae946d0bc0b500b531ba6b
511Author: Darren Tucker <dtucker@zip.com.au>
512Date: Sat Feb 21 15:41:07 2015 +1100
513
514 More correct checking of HAVE_DECL_AI_NUMERICSERV.
515
516commit e50e8c97a9cecae1f28febccaa6ca5ab3bc10f54
517Author: Darren Tucker <dtucker@zip.com.au>
518Date: Sat Feb 21 15:10:33 2015 +1100
519
520 Add null declaration of AI_NUMERICINFO.
521
522 Some platforms (older FreeBSD and DragonFly versions) do have
523 getaddrinfo() but do not have AI_NUMERICINFO. so define it to zero
524 in those cases.
525
526commit 18a208d6a460d707a45916db63a571e805f5db46
527Author: djm@openbsd.org <djm@openbsd.org>
528Date: Fri Feb 20 22:40:32 2015 +0000
529
530 upstream commit
531
532 more options that are available under Match; bz#2353 reported
533 by calestyo AT scientia.net
534
535commit 44732de06884238049f285f1455b2181baa7dc82
536Author: djm@openbsd.org <djm@openbsd.org>
537Date: Fri Feb 20 22:17:21 2015 +0000
538
539 upstream commit
540
541 UpdateHostKeys fixes:
542
543 I accidentally changed the format of the hostkeys@openssh.com messages
544 last week without changing the extension name, and this has been causing
545 connection failures for people who are running -current. First reported
546 by sthen@
547
548 s/hostkeys@openssh.com/hostkeys-00@openssh.com/
549 Change the name of the proof message too, and reorder it a little.
550
551 Also, UpdateHostKeys=ask is incompatible with ControlPersist (no TTY
552 available to read the response) so disable UpdateHostKeys if it is in
553 ask mode and ControlPersist is active (and document this)
554
555commit 13a39414d25646f93e6d355521d832a03aaaffe2
556Author: djm@openbsd.org <djm@openbsd.org>
557Date: Tue Feb 17 00:14:05 2015 +0000
558
559 upstream commit
560
561 Regression: I broke logging of public key fingerprints in
562 1.46. Pointed out by Pontus Lundkvist
563
564commit 773dda25e828c4c9a52f7bdce6e1e5924157beab
565Author: Damien Miller <djm@mindrot.org>
566Date: Fri Jan 30 23:10:17 2015 +1100
567
568 repair --without-openssl; broken in refactor
569
570commit e89c780886b23600de1e1c8d74aabd1ff61f43f0
571Author: Damien Miller <djm@google.com>
572Date: Tue Feb 17 10:04:55 2015 +1100
573
574 hook up hostkeys unittest to portable Makefiles
575
576commit 0abf41f99aa16ff09b263bead242d6cb2dbbcf99
577Author: djm@openbsd.org <djm@openbsd.org>
578Date: Mon Feb 16 22:21:03 2015 +0000
579
580 upstream commit
581
582 enable hostkeys unit tests
583
584commit 68a5d647ccf0fb6782b2f749433a1eee5bc9044b
585Author: djm@openbsd.org <djm@openbsd.org>
586Date: Mon Feb 16 22:20:50 2015 +0000
587
588 upstream commit
589
590 check string/memory compare arguments aren't NULL
591
592commit ef575ef20d09f20722e26b45dab80b3620469687
593Author: djm@openbsd.org <djm@openbsd.org>
594Date: Mon Feb 16 22:18:34 2015 +0000
595
596 upstream commit
597
598 unit tests for hostfile.c code, just hostkeys_foreach so
599 far
600
601commit 8ea3365e6aa2759ccf5c76eaea62cbc8a280b0e7
602Author: markus@openbsd.org <markus@openbsd.org>
603Date: Sat Feb 14 12:43:16 2015 +0000
604
605 upstream commit
606
607 test server rekey limit
608
609commit ce63c4b063c39b2b22d4ada449c9e3fbde788cb3
610Author: djm@openbsd.org <djm@openbsd.org>
611Date: Mon Feb 16 22:30:03 2015 +0000
612
613 upstream commit
614
615 partial backout of:
616
617 revision 1.441
618 date: 2015/01/31 20:30:05; author: djm; state: Exp; lines: +17 -10; commitid
619 : x8klYPZMJSrVlt3O;
620 Let sshd load public host keys even when private keys are missing.
621 Allows sshd to advertise additional keys for future key rotation.
622 Also log fingerprint of hostkeys loaded; ok markus@
623
624 hostkey updates now require access to the private key, so we can't
625 load public keys only. The improved log messages (fingerprints of keys
626 loaded) are kept.
627
628commit 523463a3a2a9bfc6cfc5afa01bae9147f76a37cc
629Author: djm@openbsd.org <djm@openbsd.org>
630Date: Mon Feb 16 22:13:32 2015 +0000
631
632 upstream commit
633
634 Revise hostkeys@openssh.com hostkey learning extension.
635
636 The client will not ask the server to prove ownership of the private
637 halves of any hitherto-unseen hostkeys it offers to the client.
638
639 Allow UpdateHostKeys option to take an 'ask' argument to let the
640 user manually review keys offered.
641
642 ok markus@
643
644commit 6c5c949782d86a6e7d58006599c7685bfcd01685
645Author: djm@openbsd.org <djm@openbsd.org>
646Date: Mon Feb 16 22:08:57 2015 +0000
647
648 upstream commit
649
650 Refactor hostkeys_foreach() and dependent code Deal with
651 IP addresses (i.e. CheckHostIP) Don't clobber known_hosts when nothing
652 changed ok markus@ as part of larger commit
653
654commit 51b082ccbe633dc970df1d1f4c9c0497115fe721
655Author: miod@openbsd.org <miod@openbsd.org>
656Date: Mon Feb 16 18:26:26 2015 +0000
657
658 upstream commit
659
660 Declare ge25519_base as extern, to prevent it from
661 becoming a common. Gets us rid of ``lignment 4 of symbol
662 `crypto_sign_ed25519_ref_ge25519_base' in mod_ge25519.o is smaller than 16 in
663 mod_ed25519.o'' warnings at link time.
664
665commit 02db468bf7e3281a8e3c058ced571b38b6407c34
666Author: markus@openbsd.org <markus@openbsd.org>
667Date: Fri Feb 13 18:57:00 2015 +0000
668
669 upstream commit
670
671 make rekey_limit for sshd w/privsep work; ok djm@
672 dtucker@
673
674commit 8ec67d505bd23c8bf9e17b7a364b563a07a58ec8
675Author: dtucker@openbsd.org <dtucker@openbsd.org>
676Date: Thu Feb 12 20:34:19 2015 +0000
677
678 upstream commit
679
680 Prevent sshd spamming syslog with
681 "ssh_dispatch_run_fatal: disconnected". ok markus@
682
683commit d4c0295d1afc342057ba358237acad6be8af480b
684Author: djm@openbsd.org <djm@openbsd.org>
685Date: Wed Feb 11 01:20:38 2015 +0000
686
687 upstream commit
688
689 Some packet error messages show the address of the peer,
690 but might be generated after the socket to the peer has suffered a TCP reset.
691 In these cases, getpeername() won't work so cache the address earlier.
692
693 spotted in the wild via deraadt@ and tedu@
694
695commit 4af1709cf774475ce5d1bc3ddcc165f6c222897d
696Author: jsg@openbsd.org <jsg@openbsd.org>
697Date: Mon Feb 9 23:22:37 2015 +0000
698
699 upstream commit
700
701 fix some leaks in error paths ok markus@
702
703commit fd36834871d06a03e1ff8d69e41992efa1bbf85f
704Author: millert@openbsd.org <millert@openbsd.org>
705Date: Fri Feb 6 23:21:59 2015 +0000
706
707 upstream commit
708
709 SIZE_MAX is standard, we should be using it in preference to
710 the obsolete SIZE_T_MAX. OK miod@ beck@
711
712commit 1910a286d7771eab84c0b047f31c0a17505236fa
713Author: millert@openbsd.org <millert@openbsd.org>
714Date: Thu Feb 5 12:59:57 2015 +0000
715
716 upstream commit
717
718 Include stdint.h, not limits.h to get SIZE_MAX. OK guenther@
719
720commit ce4f59b2405845584f45e0b3214760eb0008c06c
721Author: deraadt@openbsd.org <deraadt@openbsd.org>
722Date: Tue Feb 3 08:07:20 2015 +0000
723
724 upstream commit
725
726 missing ; djm and mlarkin really having great
727 interactions recently
728
729commit 5d34aa94938abb12b877a25be51862757f25d54b
730Author: halex@openbsd.org <halex@openbsd.org>
731Date: Tue Feb 3 00:34:14 2015 +0000
732
733 upstream commit
734
735 slightly extend the passphrase prompt if running with -c
736 in order to give the user a chance to notice if unintentionally running
737 without it
738
739 wording tweak and ok djm@
740
741commit cb3bde373e80902c7d5d0db429f85068d19b2918
742Author: djm@openbsd.org <djm@openbsd.org>
743Date: Mon Feb 2 22:48:53 2015 +0000
744
745 upstream commit
746
747 handle PKCS#11 C_Login returning
748 CKR_USER_ALREADY_LOGGED_IN; based on patch from Yuri Samoilenko; ok markus@
749
750commit 15ad750e5ec3cc69765b7eba1ce90060e7083399
751Author: djm@openbsd.org <djm@openbsd.org>
752Date: Mon Feb 2 07:41:40 2015 +0000
753
754 upstream commit
755
756 turn UpdateHostkeys off by default until I figure out
757 mlarkin@'s warning message; requested by deraadt@
758
759commit 3cd5103c1e1aaa59bd66f7f52f6ebbcd5deb12f9
760Author: deraadt@openbsd.org <deraadt@openbsd.org>
761Date: Mon Feb 2 01:57:44 2015 +0000
762
763 upstream commit
764
765 increasing encounters with difficult DNS setups in
766 darknets has convinced me UseDNS off by default is better ok djm
767
768commit 6049a548a8a68ff0bbe581ab1748ea6a59ecdc38
769Author: djm@openbsd.org <djm@openbsd.org>
770Date: Sat Jan 31 20:30:05 2015 +0000
771
772 upstream commit
773
774 Let sshd load public host keys even when private keys are
775 missing. Allows sshd to advertise additional keys for future key rotation.
776 Also log fingerprint of hostkeys loaded; ok markus@
777
778commit 46347ed5968f582661e8a70a45f448e0179ca0ab
779Author: djm@openbsd.org <djm@openbsd.org>
780Date: Fri Jan 30 11:43:14 2015 +0000
781
782 upstream commit
783
784 Add a ssh_config HostbasedKeyType option to control which
785 host public key types are tried during hostbased authentication.
786
787 This may be used to prevent too many keys being sent to the server,
788 and blowing past its MaxAuthTries limit.
789
790 bz#2211 based on patch by Iain Morgan; ok markus@
791
792commit 802660cb70453fa4d230cb0233bc1bbdf8328de1
793Author: djm@openbsd.org <djm@openbsd.org>
794Date: Fri Jan 30 10:44:49 2015 +0000
795
796 upstream commit
797
798 set a timeout to prevent hangs when talking to busted
799 servers; ok markus@
800
801commit 86936ec245a15c7abe71a0722610998b0a28b194
802Author: djm@openbsd.org <djm@openbsd.org>
803Date: Fri Jan 30 01:11:39 2015 +0000
804
805 upstream commit
806
807 regression test for 'wildcard CA' serial/key ID revocations
808
809commit 4509b5d4a4fa645a022635bfa7e86d09b285001f
810Author: djm@openbsd.org <djm@openbsd.org>
811Date: Fri Jan 30 01:13:33 2015 +0000
812
813 upstream commit
814
815 avoid more fatal/exit in the packet.c paths that
816 ssh-keyscan uses; feedback and "looks good" markus@
817
818commit 669aee994348468af8b4b2ebd29b602cf2860b22
819Author: djm@openbsd.org <djm@openbsd.org>
820Date: Fri Jan 30 01:10:33 2015 +0000
821
822 upstream commit
823
824 permit KRLs that revoke certificates by serial number or
825 key ID without scoping to a particular CA; ok markus@
826
827commit 7a2c368477e26575d0866247d3313da4256cb2b5
828Author: djm@openbsd.org <djm@openbsd.org>
829Date: Fri Jan 30 00:59:19 2015 +0000
830
831 upstream commit
832
833 missing parentheses after if in do_convert_from() broke
834 private key conversion from other formats some time in 2010; bz#2345 reported
835 by jjelen AT redhat.com
836
837commit 25f5f78d8bf5c22d9cea8b49de24ebeee648a355
838Author: djm@openbsd.org <djm@openbsd.org>
839Date: Fri Jan 30 00:22:25 2015 +0000
840
841 upstream commit
842
843 fix ssh protocol 1, spotted by miod@
844
845commit 9ce86c926dfa6e0635161b035e3944e611cbccf0
846Author: djm@openbsd.org <djm@openbsd.org>
847Date: Wed Jan 28 22:36:00 2015 +0000
848
849 upstream commit
850
851 update to new API (key_fingerprint => sshkey_fingerprint)
852 check sshkey_fingerprint return values; ok markus
853
854commit 9125525c37bf73ad3ee4025520889d2ce9d10f29
855Author: djm@openbsd.org <djm@openbsd.org>
856Date: Wed Jan 28 22:05:31 2015 +0000
857
858 upstream commit
859
860 avoid fatal() calls in packet code makes ssh-keyscan more
861 reliable against server failures ok dtucker@ markus@
862
863commit fae7bbe544cba7a9e5e4ab47ff6faa3d978646eb
864Author: djm@openbsd.org <djm@openbsd.org>
865Date: Wed Jan 28 21:15:47 2015 +0000
866
867 upstream commit
868
869 avoid fatal() calls in packet code makes ssh-keyscan more
870 reliable against server failures ok dtucker@ markus@
871
872commit 1a3d14f6b44a494037c7deab485abe6496bf2c60
873Author: djm@openbsd.org <djm@openbsd.org>
874Date: Wed Jan 28 11:07:25 2015 +0000
875
876 upstream commit
877
878 remove obsolete comment
879
880commit 80c25b7bc0a71d75c43a4575d9a1336f589eb639
881Author: okan@openbsd.org <okan@openbsd.org>
882Date: Tue Jan 27 12:54:06 2015 +0000
883
884 upstream commit
885
886 Since r1.2 removed the use of PRI* macros, inttypes.h is
887 no longer required.
888
889 ok djm@
890
891commit 69ff64f69615c2a21c97cb5878a0996c21423257
892Author: Damien Miller <djm@mindrot.org>
893Date: Tue Jan 27 23:07:43 2015 +1100
894
895 compile on systems without TCP_MD5SIG (e.g. OSX)
896
897commit 358964f3082fb90b2ae15bcab07b6105cfad5a43
898Author: Damien Miller <djm@mindrot.org>
899Date: Tue Jan 27 23:07:25 2015 +1100
900
901 use ssh-keygen under test rather than system's
902
903commit a2c95c1bf33ea53038324d1fdd774bc953f98236
904Author: Damien Miller <djm@mindrot.org>
905Date: Tue Jan 27 23:06:59 2015 +1100
906
907 OSX lacks HOST_NAME_MAX, has _POSIX_HOST_NAME_MAX
908
909commit ade31d7b6f608a19b85bee29a7a00b1e636a2919
910Author: Damien Miller <djm@mindrot.org>
911Date: Tue Jan 27 23:06:23 2015 +1100
912
913 these need active_state defined to link on OSX
914
915 temporary measure until active_state goes away entirely
916
917commit e56aa87502f22c5844918c10190e8b4f785f067b
918Author: djm@openbsd.org <djm@openbsd.org>
919Date: Tue Jan 27 12:01:36 2015 +0000
920
921 upstream commit
922
923 use printf instead of echo -n to reduce diff against
924 -portable
925
926commit 9f7637f56eddfaf62ce3c0af89c25480f2cf1068
927Author: jmc@openbsd.org <jmc@openbsd.org>
928Date: Mon Jan 26 13:55:29 2015 +0000
929
930 upstream commit
931
932 sort previous;
933
934commit 3076ee7d530d5b16842fac7a6229706c7e5acd26
935Author: djm@openbsd.org <djm@openbsd.org>
936Date: Mon Jan 26 13:36:53 2015 +0000
937
938 upstream commit
939
940 properly restore umask
941
942commit d411d395556b73ba1b9e451516a0bd6697c4b03d
943Author: djm@openbsd.org <djm@openbsd.org>
944Date: Mon Jan 26 06:12:18 2015 +0000
945
946 upstream commit
947
948 regression test for host key rotation
949
950commit fe8a3a51699afbc6407a8fae59b73349d01e49f8
951Author: djm@openbsd.org <djm@openbsd.org>
952Date: Mon Jan 26 06:11:28 2015 +0000
953
954 upstream commit
955
956 adapt to sshkey API tweaks
957
958commit 7dd355fb1f0038a3d5cdca57ebab4356c7a5b434
959Author: miod@openbsd.org <miod@openbsd.org>
960Date: Sat Jan 24 10:39:21 2015 +0000
961
962 upstream commit
963
964 Move -lz late in the linker commandline for things to
965 build on static arches.
966
967commit 0dad3b806fddb93c475b30853b9be1a25d673a33
968Author: miod@openbsd.org <miod@openbsd.org>
969Date: Fri Jan 23 21:21:23 2015 +0000
970
971 upstream commit
972
973 -Wpointer-sign is supported by gcc 4 only.
974
975commit 2b3b1c1e4bd9577b6e780c255c278542ea66c098
976Author: djm@openbsd.org <djm@openbsd.org>
977Date: Tue Jan 20 22:58:57 2015 +0000
978
979 upstream commit
980
981 use SUBDIR to recuse into unit tests; makes "make obj"
982 actually work
983
984commit 1d1092bff8db27080155541212b420703f8b9c92
985Author: djm@openbsd.org <djm@openbsd.org>
986Date: Mon Jan 26 12:16:36 2015 +0000
987
988 upstream commit
989
990 correct description of UpdateHostKeys in ssh_config.5 and
991 add it to -o lists for ssh, scp and sftp; pointed out by jmc@
992
993commit 5104db7cbd6cdd9c5971f4358e74414862fc1022
994Author: djm@openbsd.org <djm@openbsd.org>
995Date: Mon Jan 26 06:10:03 2015 +0000
996
997 upstream commit
998
999 correctly match ECDSA subtype (== curve) for
1000 offered/recevied host keys. Fixes connection-killing host key mismatches when
1001 a server offers multiple ECDSA keys with different curve type (an extremely
1002 unlikely configuration).
1003
1004 ok markus, "looks mechanical" deraadt@
1005
1006commit 8d4f87258f31cb6def9b3b55b6a7321d84728ff2
1007Author: djm@openbsd.org <djm@openbsd.org>
1008Date: Mon Jan 26 03:04:45 2015 +0000
1009
1010 upstream commit
1011
1012 Host key rotation support.
1013
1014 Add a hostkeys@openssh.com protocol extension (global request) for
1015 a server to inform a client of all its available host key after
1016 authentication has completed. The client may record the keys in
1017 known_hosts, allowing it to upgrade to better host key algorithms
1018 and a server to gracefully rotate its keys.
1019
1020 The client side of this is controlled by a UpdateHostkeys config
1021 option (default on).
1022
1023 ok markus@
1024
1025commit 60b1825262b1f1e24fc72050b907189c92daf18e
1026Author: djm@openbsd.org <djm@openbsd.org>
1027Date: Mon Jan 26 02:59:11 2015 +0000
1028
1029 upstream commit
1030
1031 small refactor and add some convenience functions; ok
1032 markus
1033
1034commit a5a3e3328ddce91e76f71ff479022d53e35c60c9
1035Author: jmc@openbsd.org <jmc@openbsd.org>
1036Date: Thu Jan 22 21:00:42 2015 +0000
1037
1038 upstream commit
1039
1040 heirarchy -> hierarchy;
1041
1042commit dcff5810a11195c57e1b3343c0d6b6f2b9974c11
1043Author: deraadt@openbsd.org <deraadt@openbsd.org>
1044Date: Thu Jan 22 20:24:41 2015 +0000
1045
1046 upstream commit
1047
1048 Provide a warning about chroot misuses (which sadly, seem
1049 to have become quite popular because shiny). sshd cannot detect/manage/do
1050 anything about these cases, best we can do is warn in the right spot in the
1051 man page. ok markus
1052
1053commit 087266ec33c76fc8d54ac5a19efacf2f4a4ca076
1054Author: deraadt@openbsd.org <deraadt@openbsd.org>
1055Date: Tue Jan 20 23:14:00 2015 +0000
1056
1057 upstream commit
1058
1059 Reduce use of <sys/param.h> and transition to <limits.h>
1060 throughout. ok djm markus
1061
1062commit 57e783c8ba2c0797f93977e83b2a8644a03065d8
1063Author: markus@openbsd.org <markus@openbsd.org>
1064Date: Tue Jan 20 20:16:21 2015 +0000
1065
1066 upstream commit
1067
1068 kex_setup errors are fatal()
1069
1070commit 1d6424a6ff94633c221297ae8f42d54e12a20912
1071Author: djm@openbsd.org <djm@openbsd.org>
1072Date: Tue Jan 20 08:02:33 2015 +0000
1073
1074 upstream commit
1075
1076 this test would accidentally delete agent.sh if run without
1077 obj/
1078
1079commit 12b5f50777203e12575f1b08568281e447249ed3
1080Author: djm@openbsd.org <djm@openbsd.org>
1081Date: Tue Jan 20 07:56:44 2015 +0000
1082
1083 upstream commit
1084
1085 make this compile with KERBEROS5 enabled
1086
1087commit e2cc6bef08941256817d44d146115b3478586ad4
1088Author: djm@openbsd.org <djm@openbsd.org>
1089Date: Tue Jan 20 07:55:33 2015 +0000
1090
1091 upstream commit
1092
1093 fix hostkeys in agent; ok markus@
1094
1095commit 1ca3e2155aa5d3801a7ae050f85c71f41fcb95b1
1096Author: Damien Miller <djm@mindrot.org>
1097Date: Tue Jan 20 10:11:31 2015 +1100
1098
1099 fix kex test
1100
1101commit c78a578107c7e6dcf5d30a2f34cb6581bef14029
1102Author: markus@openbsd.org <markus@openbsd.org>
1103Date: Mon Jan 19 20:45:25 2015 +0000
1104
1105 upstream commit
1106
1107 finally enable the KEX tests I wrote some years ago...
1108
1109commit 31821d7217e686667d04935aeec99e1fc4a46e7e
1110Author: markus@openbsd.org <markus@openbsd.org>
1111Date: Mon Jan 19 20:42:31 2015 +0000
1112
1113 upstream commit
1114
1115 adapt to new error message (SSH_ERR_MAC_INVALID)
1116
1117commit d3716ca19e510e95d956ae14d5b367e364bff7f1
1118Author: djm@openbsd.org <djm@openbsd.org>
1119Date: Mon Jan 19 17:31:13 2015 +0000
1120
1121 upstream commit
1122
1123 this test was broken in at least two ways, such that it
1124 wasn't checking that a KRL was not excluding valid keys
1125
1126commit 3f797653748e7c2b037dacb57574c01d9ef3b4d3
1127Author: markus@openbsd.org <markus@openbsd.org>
1128Date: Mon Jan 19 20:32:39 2015 +0000
1129
1130 upstream commit
1131
1132 switch ssh-keyscan from setjmp to multiple ssh transport
1133 layer instances ok djm@
1134
1135commit f582f0e917bb0017b00944783cd5f408bf4b0b5e
1136Author: markus@openbsd.org <markus@openbsd.org>
1137Date: Mon Jan 19 20:30:23 2015 +0000
1138
1139 upstream commit
1140
1141 add experimental api for packet layer; ok djm@
1142
1143commit 48b3b2ba75181f11fca7f327058a591f4426cade
1144Author: markus@openbsd.org <markus@openbsd.org>
1145Date: Mon Jan 19 20:20:20 2015 +0000
1146
1147 upstream commit
1148
1149 store compat flags in struct ssh; ok djm@
1150
1151commit 57d10cbe861a235dd269c74fb2fe248469ecee9d
1152Author: markus@openbsd.org <markus@openbsd.org>
1153Date: Mon Jan 19 20:16:15 2015 +0000
1154
1155 upstream commit
1156
1157 adapt kex to sshbuf and struct ssh; ok djm@
1158
1159commit 3fdc88a0def4f86aa88a5846ac079dc964c0546a
1160Author: markus@openbsd.org <markus@openbsd.org>
1161Date: Mon Jan 19 20:07:45 2015 +0000
1162
1163 upstream commit
1164
1165 move dispatch to struct ssh; ok djm@
1166
1167commit 091c302829210c41e7f57c3f094c7b9c054306f0
1168Author: markus@openbsd.org <markus@openbsd.org>
1169Date: Mon Jan 19 19:52:16 2015 +0000
1170
1171 upstream commit
1172
1173 update packet.c & isolate, introduce struct ssh a) switch
1174 packet.c to buffer api and isolate per-connection info into struct ssh b)
1175 (de)serialization of the state is moved from monitor to packet.c c) the old
1176 packet.c API is implemented in opacket.[ch] d) compress.c/h is removed and
1177 integrated into packet.c with and ok djm@
1178
1179commit 4e62cc68ce4ba20245d208b252e74e91d3785b74
1180Author: djm@openbsd.org <djm@openbsd.org>
1181Date: Mon Jan 19 17:35:48 2015 +0000
1182
1183 upstream commit
1184
1185 fix format strings in (disabled) debugging
1186
1187commit d85e06245907d49a2cd0cfa0abf59150ad616f42
1188Author: djm@openbsd.org <djm@openbsd.org>
1189Date: Mon Jan 19 06:01:32 2015 +0000
1190
1191 upstream commit
1192
1193 be a bit more careful in these tests to ensure that
1194 known_hosts is clean
1195
1196commit 7947810eab5fe0ad311f32a48f4d4eb1f71be6cf
1197Author: djm@openbsd.org <djm@openbsd.org>
1198Date: Sun Jan 18 22:00:18 2015 +0000
1199
1200 upstream commit
1201
1202 regression test for known_host file editing using
1203 ssh-keygen (-H / -R / -F) after hostkeys_foreach() change; feedback and ok
1204 markus@
1205
1206commit 3a2b09d147a565d8a47edf37491e149a02c0d3a3
1207Author: djm@openbsd.org <djm@openbsd.org>
1208Date: Sun Jan 18 19:54:46 2015 +0000
1209
1210 upstream commit
1211
1212 more and better key tests
1213
1214 test signatures and verification
1215 test certificate generation
1216 flesh out nested cert test
1217
1218 removes most of the XXX todo markers
1219
1220commit 589e69fd82724cfc9738f128e4771da2e6405d0d
1221Author: djm@openbsd.org <djm@openbsd.org>
1222Date: Sun Jan 18 19:53:58 2015 +0000
1223
1224 upstream commit
1225
1226 make the signature fuzzing test much more rigorous:
1227 ensure that the fuzzed input cases do not match the original (using new
1228 fuzz_matches_original() function) and check that the verification fails in
1229 each case
1230
1231commit 80603c0daa2538c349c1c152405580b164d5475f
1232Author: djm@openbsd.org <djm@openbsd.org>
1233Date: Sun Jan 18 19:52:44 2015 +0000
1234
1235 upstream commit
1236
1237 add a fuzz_matches_original() function to the fuzzer to
1238 detect fuzz cases that are identical to the original data. Hacky
1239 implementation, but very useful when you need the fuzz to be different, e.g.
1240 when verifying signature
1241
1242commit 87d5495bd337e358ad69c524fcb9495208c0750b
1243Author: djm@openbsd.org <djm@openbsd.org>
1244Date: Sun Jan 18 19:50:55 2015 +0000
1245
1246 upstream commit
1247
1248 better dumps from the fuzzer (shown on errors) -
1249 include the original data as well as the fuzzed copy.
1250
1251commit d59ec478c453a3fff05badbbfd96aa856364f2c2
1252Author: djm@openbsd.org <djm@openbsd.org>
1253Date: Sun Jan 18 19:47:55 2015 +0000
1254
1255 upstream commit
1256
1257 enable hostkey-agent.sh test
1258
1259commit 26b3425170bf840e4b095e1c10bf25a0a3e3a105
1260Author: djm@openbsd.org <djm@openbsd.org>
1261Date: Sat Jan 17 18:54:30 2015 +0000
1262
1263 upstream commit
1264
1265 unit test for hostkeys in ssh-agent
1266
1267commit 9e06a0fb23ec55d9223b26a45bb63c7649e2f2f2
1268Author: markus@openbsd.org <markus@openbsd.org>
1269Date: Thu Jan 15 23:41:29 2015 +0000
1270
1271 upstream commit
1272
1273 add kex unit tests
1274
1275commit d2099dec6da21ae627f6289aedae6bc1d41a22ce
1276Author: deraadt@openbsd.org <deraadt@openbsd.org>
1277Date: Mon Jan 19 00:32:54 2015 +0000
1278
1279 upstream commit
1280
1281 djm, your /usr/include tree is old
1282
1283commit 2b3c3c76c30dc5076fe09d590f5b26880f148a54
1284Author: djm@openbsd.org <djm@openbsd.org>
1285Date: Sun Jan 18 21:51:19 2015 +0000
1286
1287 upstream commit
1288
1289 some feedback from markus@: comment hostkeys_foreach()
1290 context and avoid a member in it.
1291
1292commit cecb30bc2ba6d594366e657d664d5c494b6c8a7f
1293Author: djm@openbsd.org <djm@openbsd.org>
1294Date: Sun Jan 18 21:49:42 2015 +0000
1295
1296 upstream commit
1297
1298 make ssh-keygen use hostkeys_foreach(). Removes some
1299 horrendous code; ok markus@
1300
1301commit ec3d065df3a9557ea96b02d061fd821a18c1a0b9
1302Author: djm@openbsd.org <djm@openbsd.org>
1303Date: Sun Jan 18 21:48:09 2015 +0000
1304
1305 upstream commit
1306
1307 convert load_hostkeys() (hostkey ordering and
1308 known_host matching) to use the new hostkey_foreach() iterator; ok markus
1309
1310commit c29811cc480a260e42fd88849fc86a80c1e91038
1311Author: djm@openbsd.org <djm@openbsd.org>
1312Date: Sun Jan 18 21:40:23 2015 +0000
1313
1314 upstream commit
1315
1316 introduce hostkeys_foreach() to allow iteration over a
1317 known_hosts file or controlled subset thereof. This will allow us to pull out
1318 some ugly and duplicated code, and will be used to implement hostkey rotation
1319 later.
1320
1321 feedback and ok markus
1322
1323commit f101d8291da01bbbfd6fb8c569cfd0cc61c0d346
1324Author: deraadt@openbsd.org <deraadt@openbsd.org>
1325Date: Sun Jan 18 14:01:00 2015 +0000
1326
1327 upstream commit
1328
1329 string truncation due to sizeof(size) ok djm markus
1330
1331commit 35d6022b55b7969fc10c261cb6aa78cc4a5fcc41
1332Author: djm@openbsd.org <djm@openbsd.org>
1333Date: Sun Jan 18 13:33:34 2015 +0000
1334
1335 upstream commit
1336
1337 avoid trailing ',' in host key algorithms
1338
1339commit 7efb455789a0cb76bdcdee91c6060a3dc8f5c007
1340Author: djm@openbsd.org <djm@openbsd.org>
1341Date: Sun Jan 18 13:22:28 2015 +0000
1342
1343 upstream commit
1344
1345 infer key length correctly when user specified a fully-
1346 qualified key name instead of using the -b bits option; ok markus@
1347
1348commit 83f8ffa6a55ccd0ce9d8a205e3e7439ec18fedf5
1349Author: djm@openbsd.org <djm@openbsd.org>
1350Date: Sat Jan 17 18:53:34 2015 +0000
1351
1352 upstream commit
1353
1354 fix hostkeys on ssh agent; found by unit test I'm about
1355 to commit
1356
1357commit 369d61f17657b814124268f99c033e4dc6e436c1
1358Author: schwarze@openbsd.org <schwarze@openbsd.org>
1359Date: Fri Jan 16 16:20:23 2015 +0000
1360
1361 upstream commit
1362
1363 garbage collect empty .No macros mandoc warns about
1364
1365commit bb8b442d32dbdb8521d610e10d8b248d938bd747
1366Author: djm@openbsd.org <djm@openbsd.org>
1367Date: Fri Jan 16 15:55:07 2015 +0000
1368
1369 upstream commit
1370
1371 regression: incorrect error message on
1372 otherwise-successful ssh-keygen -A. Reported by Dmitry Orlov, via deraadt@
1373
1374commit 9010902954a40b59d0bf3df3ccbc3140a653e2bc
1375Author: djm@openbsd.org <djm@openbsd.org>
1376Date: Fri Jan 16 07:19:48 2015 +0000
1377
1378 upstream commit
1379
1380 when hostname canonicalisation is enabled, try to parse
1381 hostnames as addresses before looking them up for canonicalisation. fixes
1382 bz#2074 and avoids needless DNS lookups in some cases; ok markus
1383
1384commit 2ae4f337b2a5fb2841b6b0053b49496fef844d1c
1385Author: deraadt@openbsd.org <deraadt@openbsd.org>
1386Date: Fri Jan 16 06:40:12 2015 +0000
1387
1388 upstream commit
1389
1390 Replace <sys/param.h> with <limits.h> and other less
1391 dirty headers where possible. Annotate <sys/param.h> lines with their
1392 current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1,
1393 LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of
1394 MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution.
1395 These are the files confirmed through binary verification. ok guenther,
1396 millert, doug (helped with the verification protocol)
1397
1398commit 3c4726f4c24118e8f1bb80bf75f1456c76df072c
1399Author: markus@openbsd.org <markus@openbsd.org>
1400Date: Thu Jan 15 21:38:50 2015 +0000
1401
1402 upstream commit
1403
1404 remove xmalloc, switch to sshbuf
1405
1406commit e17ac01f8b763e4b83976b9e521e90a280acc097
1407Author: markus@openbsd.org <markus@openbsd.org>
1408Date: Thu Jan 15 21:37:14 2015 +0000
1409
1410 upstream commit
1411
1412 switch to sshbuf
1413
1414commit ddef9995a1fa6c7a8ff3b38bfe6cf724bebf13d0
1415Author: naddy@openbsd.org <naddy@openbsd.org>
1416Date: Thu Jan 15 18:32:54 2015 +0000
1417
1418 upstream commit
1419
1420 handle UMAC128 initialization like UMAC; ok djm@ markus@
1421
1422commit f14564c1f7792446bca143580aef0e7ac25dcdae
1423Author: djm@openbsd.org <djm@openbsd.org>
1424Date: Thu Jan 15 11:04:36 2015 +0000
1425
1426 upstream commit
1427
1428 fix regression reported by brad@ for passworded keys without
1429 agent present
1430
1431commit 45c0fd70bb2a88061319dfff20cb12ef7b1bc47e
1432Author: Damien Miller <djm@mindrot.org>
1433Date: Thu Jan 15 22:08:23 2015 +1100
1434
1435 make bitmap test compile
1436
1437commit d333f89abf7179021e5c3f28673f469abe032062
1438Author: djm@openbsd.org <djm@openbsd.org>
1439Date: Thu Jan 15 07:36:28 2015 +0000
1440
1441 upstream commit
1442
1443 unit tests for KRL bitmap
1444
1445commit 7613f828f49c55ff356007ae9645038ab6682556
1446Author: markus@openbsd.org <markus@openbsd.org>
1447Date: Wed Jan 14 09:58:21 2015 +0000
1448
1449 upstream commit
1450
1451 re-add comment about full path
1452
1453commit 6c43b48b307c41cd656b415621a644074579a578
1454Author: markus@openbsd.org <markus@openbsd.org>
1455Date: Wed Jan 14 09:54:38 2015 +0000
1456
1457 upstream commit
1458
1459 don't reset to the installed sshd; connect before
1460 reconfigure, too
1461
1462commit 771bb47a1df8b69061f09462e78aa0b66cd594bf
1463Author: djm@openbsd.org <djm@openbsd.org>
1464Date: Tue Jan 13 14:51:51 2015 +0000
1465
1466 upstream commit
1467
1468 implement a SIGINFO handler so we can discern a stuck
1469 fuzz test from a merely glacial one; prompted by and ok markus
1470
1471commit cfaa57962f8536f3cf0fd7daf4d6a55d6f6de45f
1472Author: djm@openbsd.org <djm@openbsd.org>
1473Date: Tue Jan 13 08:23:26 2015 +0000
1474
1475 upstream commit
1476
1477 use $SSH instead of installed ssh to allow override;
1478 spotted by markus@
1479
1480commit 0920553d0aee117a596b03ed5b49b280d34a32c5
1481Author: djm@openbsd.org <djm@openbsd.org>
1482Date: Tue Jan 13 07:49:49 2015 +0000
1483
1484 upstream commit
1485
1486 regress test for PubkeyAcceptedKeyTypes; ok markus@
1487
1488commit 27ca1a5c0095eda151934bca39a77e391f875d17
1489Author: markus@openbsd.org <markus@openbsd.org>
1490Date: Mon Jan 12 20:13:27 2015 +0000
1491
1492 upstream commit
1493
1494 unbreak parsing of pubkey comments; with gerhard; ok
1495 djm/deraadt
1496
1497commit 55358f0b4e0b83bc0df81c5f854c91b11e0bb4dc
1498Author: djm@openbsd.org <djm@openbsd.org>
1499Date: Mon Jan 12 11:46:32 2015 +0000
1500
1501 upstream commit
1502
1503 fatal if soft-PKCS11 library is missing rather (rather
1504 than continue and fail with a more cryptic error)
1505
1506commit c3554cdd2a1a62434b8161017aa76fa09718a003
1507Author: djm@openbsd.org <djm@openbsd.org>
1508Date: Mon Jan 12 11:12:38 2015 +0000
1509
1510 upstream commit
1511
1512 let this test all supporte key types; pointed out/ok
1513 markus@
1514
1515commit 1129dcfc5a3e508635004bcc05a3574cb7687167
1516Author: djm@openbsd.org <djm@openbsd.org>
1517Date: Thu Jan 15 09:40:00 2015 +0000
1518
1519 upstream commit
1520
1521 sync ssh-keysign, ssh-keygen and some dependencies to the
1522 new buffer/key API; mostly mechanical, ok markus@
1523
1524commit e4ebf5586452bf512da662ac277aaf6ecf0efe7c
1525Author: djm@openbsd.org <djm@openbsd.org>
1526Date: Thu Jan 15 07:57:08 2015 +0000
1527
1528 upstream commit
1529
1530 remove commented-out test code now that it has moved to a
1531 proper unit test
1532
1533commit e81cba066c1e9eb70aba0f6e7c0ff220611b370f
1534Author: djm@openbsd.org <djm@openbsd.org>
1535Date: Wed Jan 14 20:54:29 2015 +0000
1536
1537 upstream commit
1538
1539 whitespace
1540
1541commit 141efe49542f7156cdbc2e4cd0a041d8b1aab622
1542Author: djm@openbsd.org <djm@openbsd.org>
1543Date: Wed Jan 14 20:05:27 2015 +0000
1544
1545 upstream commit
1546
1547 move authfd.c and its tentacles to the new buffer/key
1548 API; ok markus@
1549
1550commit 0088c57af302cda278bd26d8c3ae81d5b6f7c289
1551Author: djm@openbsd.org <djm@openbsd.org>
1552Date: Wed Jan 14 19:33:41 2015 +0000
1553
1554 upstream commit
1555
1556 fix small regression: ssh-agent would return a success
1557 message but an empty signature if asked to sign using an unknown key; ok
1558 markus@
1559
1560commit b03ebe2c22b8166e4f64c37737f4278676e3488d
1561Author: Damien Miller <djm@mindrot.org>
1562Date: Thu Jan 15 03:08:58 2015 +1100
1563
1564 more --without-openssl
1565
1566 fix some regressions caused by upstream merges
1567
1568 enable KRLs now that they no longer require BIGNUMs
1569
1570commit bc42cc6fe784f36df225c44c93b74830027cb5a2
1571Author: Damien Miller <djm@mindrot.org>
1572Date: Thu Jan 15 03:08:29 2015 +1100
1573
1574 kludge around tun API mismatch betterer
1575
1576commit c332110291089b624fa0951fbf2d1ee6de525b9f
1577Author: Damien Miller <djm@mindrot.org>
1578Date: Thu Jan 15 02:59:51 2015 +1100
1579
1580 some systems lack SO_REUSEPORT
1581
1582commit 83b9678a62cbdc74eb2031cf1e1e4ffd58e233ae
1583Author: Damien Miller <djm@mindrot.org>
1584Date: Thu Jan 15 02:35:50 2015 +1100
1585
1586 fix merge botch
1587
1588commit 0cdc5a3eb6fb383569a4da2a30705d9b90428d6b
1589Author: Damien Miller <djm@mindrot.org>
1590Date: Thu Jan 15 02:35:33 2015 +1100
1591
1592 unbreak across API change
1593
1594commit 6e2549ac2b5e7f96cbc2d83a6e0784b120444b47
1595Author: Damien Miller <djm@mindrot.org>
1596Date: Thu Jan 15 02:30:18 2015 +1100
1597
1598 need includes.h for portable OpenSSH
1599
1600commit 72ef7c148c42db7d5632a29f137f8b87b579f2d9
1601Author: Damien Miller <djm@mindrot.org>
1602Date: Thu Jan 15 02:21:31 2015 +1100
1603
1604 support --without-openssl at configure time
1605
1606 Disables and removes dependency on OpenSSL. Many features don't
1607 work and the set of crypto options is greatly restricted. This
1608 will only work on system with native arc4random or /dev/urandom.
1609
1610 Considered highly experimental for now.
1611
1612commit 4f38c61c68ae7e3f9ee4b3c38bc86cd39f65ece9
1613Author: Damien Miller <djm@mindrot.org>
1614Date: Thu Jan 15 02:28:00 2015 +1100
1615
1616 add files missed in last commit
1617
1618commit a165bab605f7be55940bb8fae977398e8c96a46d
1619Author: djm@openbsd.org <djm@openbsd.org>
1620Date: Wed Jan 14 15:02:39 2015 +0000
1621
1622 upstream commit
1623
1624 avoid BIGNUM in KRL code by using a simple bitmap;
1625 feedback and ok markus
1626
1627commit 7d845f4a0b7ec97887be204c3760e44de8bf1f32
1628Author: djm@openbsd.org <djm@openbsd.org>
1629Date: Wed Jan 14 13:54:13 2015 +0000
1630
1631 upstream commit
1632
1633 update sftp client and server to new buffer API. pretty
1634 much just mechanical changes; with & ok markus
1635
1636commit 139ca81866ec1b219c717d17061e5e7ad1059e2a
1637Author: markus@openbsd.org <markus@openbsd.org>
1638Date: Wed Jan 14 13:09:09 2015 +0000
1639
1640 upstream commit
1641
1642 switch to sshbuf/sshkey; with & ok djm@
1643
1644commit 81bfbd0bd35683de5d7f2238b985e5f8150a9180
1645Author: Damien Miller <djm@mindrot.org>
1646Date: Wed Jan 14 21:48:18 2015 +1100
1647
1648 support --without-openssl at configure time
1649
1650 Disables and removes dependency on OpenSSL. Many features don't
1651 work and the set of crypto options is greatly restricted. This
1652 will only work on system with native arc4random or /dev/urandom.
1653
1654 Considered highly experimental for now.
1655
1656commit 54924b53af15ccdcbb9f89984512b5efef641a31
1657Author: djm@openbsd.org <djm@openbsd.org>
1658Date: Wed Jan 14 10:46:28 2015 +0000
1659
1660 upstream commit
1661
1662 avoid an warning for the !OPENSSL case
1663
1664commit ae8b463217f7c9b66655bfc3945c050ffdaeb861
1665Author: markus@openbsd.org <markus@openbsd.org>
1666Date: Wed Jan 14 10:30:34 2015 +0000
1667
1668 upstream commit
1669
1670 swith auth-options to new sshbuf/sshkey; ok djm@
1671
1672commit 540e891191b98b89ee90aacf5b14a4a68635e763
1673Author: djm@openbsd.org <djm@openbsd.org>
1674Date: Wed Jan 14 10:29:45 2015 +0000
1675
1676 upstream commit
1677
1678 make non-OpenSSL aes-ctr work on sshd w/ privsep; ok
1679 markus@
1680
1681commit 60c2c4ea5e1ad0ddfe8b2877b78ed5143be79c53
1682Author: markus@openbsd.org <markus@openbsd.org>
1683Date: Wed Jan 14 10:24:42 2015 +0000
1684
1685 upstream commit
1686
1687 remove unneeded includes, sync my copyright across files
1688 & whitespace; ok djm@
1689
1690commit 128343bcdb0b60fc826f2733df8cf979ec1627b4
1691Author: markus@openbsd.org <markus@openbsd.org>
1692Date: Tue Jan 13 19:31:40 2015 +0000
1693
1694 upstream commit
1695
1696 adapt mac.c to ssherr.h return codes (de-fatal) and
1697 simplify dependencies ok djm@
1698
1699commit e7fd952f4ea01f09ceb068721a5431ac2fd416ed
1700Author: djm@openbsd.org <djm@openbsd.org>
1701Date: Tue Jan 13 19:04:35 2015 +0000
1702
1703 upstream commit
1704
1705 sync changes from libopenssh; prepared by markus@ mostly
1706 debug output tweaks, a couple of error return value changes and some other
1707 minor stuff
1708
1709commit 76c0480a85675f03a1376167cb686abed01a3583
1710Author: Damien Miller <djm@mindrot.org>
1711Date: Tue Jan 13 19:38:18 2015 +1100
1712
1713 add --without-ssh1 option to configure
1714
1715 Allows disabling support for SSH protocol 1.
1716
1717commit 1f729f0614d1376c3332fa1edb6a5e5cec7e9e03
1718Author: djm@openbsd.org <djm@openbsd.org>
1719Date: Tue Jan 13 07:39:19 2015 +0000
1720
1721 upstream commit
1722
1723 add sshd_config HostbasedAcceptedKeyTypes and
1724 PubkeyAcceptedKeyTypes options to allow sshd to control what public key types
1725 will be accepted. Currently defaults to all. Feedback & ok markus@
1726
1727commit 816d1538c24209a93ba0560b27c4fda57c3fff65
1728Author: markus@openbsd.org <markus@openbsd.org>
1729Date: Mon Jan 12 20:13:27 2015 +0000
1730
1731 upstream commit
1732
1733 unbreak parsing of pubkey comments; with gerhard; ok
1734 djm/deraadt
1735
1736commit 0097565f849851812df610b7b6b3c4bd414f6c62
1737Author: markus@openbsd.org <markus@openbsd.org>
1738Date: Mon Jan 12 19:22:46 2015 +0000
1739
1740 upstream commit
1741
1742 missing error assigment on sshbuf_put_string()
1743
1744commit a7f49dcb527dd17877fcb8d5c3a9a6f550e0bba5
1745Author: djm@openbsd.org <djm@openbsd.org>
1746Date: Mon Jan 12 15:18:07 2015 +0000
1747
1748 upstream commit
1749
1750 apparently memcpy(x, NULL, 0) is undefined behaviour
1751 according to C99 (cf. sections 7.21.1 and 7.1.4), so check skip memcpy calls
1752 when length==0; ok markus@
1753
1754commit 905fe30fca82f38213763616d0d26eb6790bde33
1755Author: markus@openbsd.org <markus@openbsd.org>
1756Date: Mon Jan 12 14:05:19 2015 +0000
1757
1758 upstream commit
1759
1760 free->sshkey_free; ok djm@
1761
1762commit f067cca2bc20c86b110174c3fef04086a7f57b13
1763Author: markus@openbsd.org <markus@openbsd.org>
1764Date: Mon Jan 12 13:29:27 2015 +0000
1765
1766 upstream commit
1767
1768 allow WITH_OPENSSL w/o WITH_SSH1; ok djm@
1769
1770commit c4bfafcc2a9300d9cfb3c15e75572d3a7d74670d
1771Author: djm@openbsd.org <djm@openbsd.org>
1772Date: Thu Jan 8 13:10:58 2015 +0000
1773
1774 upstream commit
1775
1776 adjust for sshkey_load_file() API change
1777
1778commit e752c6d547036c602b89e9e704851463bd160e32
1779Author: djm@openbsd.org <djm@openbsd.org>
1780Date: Thu Jan 8 13:44:36 2015 +0000
1781
1782 upstream commit
1783
1784 fix ssh_config FingerprintHash evaluation order; from Petr
1785 Lautrbach
1786
1787commit ab24ab847b0fc94c8d5e419feecff0bcb6d6d1bf
1788Author: djm@openbsd.org <djm@openbsd.org>
1789Date: Thu Jan 8 10:15:45 2015 +0000
1790
1791 upstream commit
1792
1793 reorder hostbased key attempts to better match the
1794 default hostkey algorithms order in myproposal.h; ok markus@
1795
1796commit 1195f4cb07ef4b0405c839293c38600b3e9bdb46
1797Author: djm@openbsd.org <djm@openbsd.org>
1798Date: Thu Jan 8 10:14:08 2015 +0000
1799
1800 upstream commit
1801
1802 deprecate key_load_private_pem() and
1803 sshkey_load_private_pem() interfaces. Refactor the generic key loading API to
1804 not require pathnames to be specified (they weren't really used).
1805
1806 Fixes a few other things en passant:
1807
1808 Makes ed25519 keys work for hostbased authentication (ssh-keysign
1809 previously used the PEM-only routines).
1810
1811 Fixes key comment regression bz#2306: key pathnames were being lost as
1812 comment fields.
1813
1814 ok markus@
1815
1816commit febbe09e4e9aff579b0c5cc1623f756862e4757d
1817Author: tedu@openbsd.org <tedu@openbsd.org>
1818Date: Wed Jan 7 18:15:07 2015 +0000
1819
1820 upstream commit
1821
1822 workaround for the Meyer, et al, Bleichenbacher Side
1823 Channel Attack. fake up a bignum key before RSA decryption. discussed/ok djm
1824 markus
1825
1826commit 5191df927db282d3123ca2f34a04d8d96153911a
1827Author: djm@openbsd.org <djm@openbsd.org>
1828Date: Tue Dec 23 22:42:48 2014 +0000
1829
1830 upstream commit
1831
1832 KNF and add a little more debug()
1833
1834commit 8abd80315d3419b20e6938f74d37e2e2b547f0b7
1835Author: jmc@openbsd.org <jmc@openbsd.org>
1836Date: Mon Dec 22 09:26:31 2014 +0000
1837
1838 upstream commit
1839
1840 add fingerprinthash to the options list;
1841
1842commit 296ef0560f60980da01d83b9f0e1a5257826536f
1843Author: jmc@openbsd.org <jmc@openbsd.org>
1844Date: Mon Dec 22 09:24:59 2014 +0000
1845
1846 upstream commit
1847
1848 tweak previous;
1849
1850commit 462082eacbd37778a173afb6b84c6f4d898a18b5
1851Author: Damien Miller <djm@google.com>
1852Date: Tue Dec 30 08:16:11 2014 +1100
1853
1854 avoid uninitialised free of ldns_res
1855
1856 If an invalid rdclass was passed to getrrsetbyname() then
1857 this would execute a free on an uninitialised pointer.
1858 OpenSSH only ever calls this with a fixed and valid rdclass.
1859
1860 Reported by Joshua Rogers
1861
1862commit 01b63498801053f131a0740eb9d13faf35d636c8
1863Author: Damien Miller <djm@google.com>
1864Date: Mon Dec 29 18:10:18 2014 +1100
1865
1866 pull updated OpenBSD BCrypt PBKDF implementation
1867
1868 Includes fix for 1 byte output overflow for large key length
1869 requests (not reachable in OpenSSH).
1870
1871 Pointed out by Joshua Rogers
1872
1873commit c528c1b4af2f06712177b3de9b30705752f7cbcb
1874Author: Damien Miller <djm@google.com>
1875Date: Tue Dec 23 15:26:13 2014 +1100
1876
1877 fix variable name for IPv6 case in construct_utmpx
1878
1879 patch from writeonce AT midipix.org via bz#2296
1880
1881commit 293cac52dcda123244b2e594d15592e5e481c55e
1882Author: Damien Miller <djm@google.com>
1883Date: Mon Dec 22 16:30:42 2014 +1100
1884
1885 include and use OpenBSD netcat in regress/
1886
1887commit 8f6784f0cb56dc4fd00af3e81a10050a5785228d
1888Author: djm@openbsd.org <djm@openbsd.org>
1889Date: Mon Dec 22 09:05:17 2014 +0000
1890
1891 upstream commit
1892
1893 mention ssh -Q feature to list supported { MAC, cipher,
1894 KEX, key } algorithms in more places and include the query string used to
1895 list the relevant information; bz#2288
1896
1897commit 449e11b4d7847079bd0a2daa6e3e7ea03d8ef700
1898Author: jmc@openbsd.org <jmc@openbsd.org>
1899Date: Mon Dec 22 08:24:17 2014 +0000
1900
1901 upstream commit
1902
1903 tweak previous;
1904
1905commit 4bea0ab3290c0b9dd2aa199e932de8e7e18062d6
1906Author: djm@openbsd.org <djm@openbsd.org>
1907Date: Mon Dec 22 08:06:03 2014 +0000
1908
1909 upstream commit
1910
1911 regression test for multiple required pubkey authentication;
1912 ok markus@
1913
1914commit f1c4d8ec52158b6f57834b8cd839605b0a33e7f2
1915Author: djm@openbsd.org <djm@openbsd.org>
1916Date: Mon Dec 22 08:04:23 2014 +0000
1917
1918 upstream commit
1919
1920 correct description of what will happen when a
1921 AuthorizedKeysCommand is specified but AuthorizedKeysCommandUser is not (sshd
1922 will refuse to start)
1923
1924commit 161cf419f412446635013ac49e8c660cadc36080
1925Author: djm@openbsd.org <djm@openbsd.org>
1926Date: Mon Dec 22 07:55:51 2014 +0000
1927
1928 upstream commit
1929
1930 make internal handling of filename arguments of "none"
1931 more consistent with ssh. "none" arguments are now replaced with NULL when
1932 the configuration is finalised.
1933
1934 Simplifies checking later on (just need to test not-NULL rather than
1935 that + strcmp) and cleans up some inconsistencies. ok markus@
1936
1937commit f69b69b8625be447b8826b21d87713874dac25a6
1938Author: djm@openbsd.org <djm@openbsd.org>
1939Date: Mon Dec 22 07:51:30 2014 +0000
1940
1941 upstream commit
1942
1943 remember which public keys have been used for
1944 authentication and refuse to accept previously-used keys.
1945
1946 This allows AuthenticationMethods=publickey,publickey to require
1947 that users authenticate using two _different_ pubkeys.
1948
1949 ok markus@
1950
1951commit 46ac2ed4677968224c4ca825bc98fc68dae183f0
1952Author: djm@openbsd.org <djm@openbsd.org>
1953Date: Mon Dec 22 07:24:11 2014 +0000
1954
1955 upstream commit
1956
1957 fix passing of wildcard forward bind addresses when
1958 connection multiplexing is in use; patch from Sami Hartikainen via bz#2324;
3674 ok dtucker@ 1959 ok dtucker@
3675 - djm@cvs.openbsd.org 2011/12/04 23:16:12 1960
3676 [mux.c] 1961commit 0d1b241a262e4d0a6bbfdd595489ab1b853c43a1
3677 revert: 1962Author: djm@openbsd.org <djm@openbsd.org>
3678 > revision 1.32 1963Date: Mon Dec 22 06:14:29 2014 +0000
3679 > date: 2011/12/02 00:41:56; author: djm; state: Exp; lines: +4 -1 1964
3680 > fix bz#1948: ssh -f doesn't fork for multiplexed connection. 1965 upstream commit
3681 > ok dtucker@ 1966
3682 it interacts badly with ControlPersist 1967 make this slightly easier to diff against portable
3683 - djm@cvs.openbsd.org 2012/01/07 21:11:36 1968
3684 [mux.c] 1969commit 0715bcdddbf68953964058f17255bf54734b8737
3685 fix double-free in new session handler 1970Author: Damien Miller <djm@mindrot.org>
3686 NB. Id sync only 1971Date: Mon Dec 22 13:47:07 2014 +1100
3687 - djm@cvs.openbsd.org 2012/05/23 03:28:28 1972
3688 [dns.c dns.h key.c key.h ssh-keygen.c] 1973 add missing regress output file
3689 add support for RFC6594 SSHFP DNS records for ECDSA key types. 1974
3690 patch from bugzilla-m67 AT nulld.me in bz#1978; ok + tweak markus@ 1975commit 1e30483c8ad2c2f39445d4a4b6ab20c241e40593
3691 (Original authors Ondřej Surý, Ondřej Caletka and Daniel Black) 1976Author: djm@openbsd.org <djm@openbsd.org>
3692 - djm@cvs.openbsd.org 2012/06/01 00:49:35 1977Date: Mon Dec 22 02:15:52 2014 +0000
3693 [PROTOCOL.mux] 1978
3694 correct types of port numbers (integers, not strings); bz#2004 from 1979 upstream commit
3695 bert.wesarg AT googlemail.com 1980
3696 - djm@cvs.openbsd.org 2012/06/01 01:01:22 1981 adjust for new SHA256 key fingerprints and
3697 [mux.c] 1982 slightly-different MD5 hex fingerprint format
3698 fix memory leak when mux socket creation fails; bz#2002 from bert.wesarg 1983
3699 AT googlemail.com 1984commit 6b40567ed722df98593ad8e6a2d2448fc2b4b151
3700 - dtucker@cvs.openbsd.org 2012/06/18 11:43:53 1985Author: djm@openbsd.org <djm@openbsd.org>
3701 [jpake.c] 1986Date: Mon Dec 22 01:14:49 2014 +0000
3702 correct sizeof usage. patch from saw at online.de, ok deraadt 1987
3703 - dtucker@cvs.openbsd.org 2012/06/18 11:49:58 1988 upstream commit
3704 [ssh_config.5] 1989
3705 RSA instead of DSA twice. From Steve.McClellan at radisys com 1990 poll changes to netcat (usr.bin/netcat.c r1.125) broke
3706 - dtucker@cvs.openbsd.org 2012/06/18 12:07:07 1991 this test; fix it by ensuring more stdio fds are sent to devnull
3707 [ssh.1 sshd.8] 1992
3708 Remove mention of 'three' key files since there are now four. From 1993commit a5375ccb970f49dddf7d0ef63c9b713ede9e7260
3709 Steve.McClellan at radisys com. 1994Author: jmc@openbsd.org <jmc@openbsd.org>
3710 - dtucker@cvs.openbsd.org 2012/06/18 12:17:18 1995Date: Sun Dec 21 23:35:14 2014 +0000
3711 [ssh.1] 1996
3712 Clarify description of -W. Noted by Steve.McClellan at radisys com, 1997 upstream commit
3713 ok jmc 1998
3714 - markus@cvs.openbsd.org 2012/06/19 18:25:28 1999 tweak previous;
3715 [servconf.c servconf.h sshd_config.5] 2000
3716 sshd_config: extend Match to allow AcceptEnv and {Allow,Deny}{Users,Groups} 2001commit b79efde5c3badf5ce4312fe608d8307eade533c5
3717 this allows 'Match LocalPort 1022' combined with 'AllowUser bauer' 2002Author: djm@openbsd.org <djm@openbsd.org>
3718 ok djm@ (back in March) 2003Date: Sun Dec 21 23:12:42 2014 +0000
3719 - jmc@cvs.openbsd.org 2012/06/19 21:35:54 2004
3720 [sshd_config.5] 2005 upstream commit
3721 tweak previous; ok markus 2006
3722 - djm@cvs.openbsd.org 2012/06/20 04:42:58 2007 document FingerprintHash here too
3723 [clientloop.c serverloop.c] 2008
3724 initialise accept() backoff timer to avoid EINVAL from select(2) in 2009commit d16bdd8027dd116afa01324bb071a4016cdc1a75
3725 rekeying 2010Author: Damien Miller <djm@mindrot.org>
3726 2011Date: Mon Dec 22 10:18:09 2014 +1100
372720120519 2012
3728 - (dtucker) [configure.ac] bz#2010: fix non-portable shell construct. Patch 2013 missing include for base64 encoding
3729 from cjwatson at debian org. 2014
3730 - (dtucker) [configure.ac contrib/Makefile] bz#1996: use AC_PATH_TOOL to find 2015commit 56d1c83cdd1ac76f1c6bd41e01e80dad834f3994
3731 pkg-config so it does the right thing when cross-compiling. Patch from 2016Author: djm@openbsd.org <djm@openbsd.org>
3732 cjwatson at debian org. 2017Date: Sun Dec 21 22:27:55 2014 +0000
3733- (dtucker) OpenBSD CVS Sync 2018
3734 - dtucker@cvs.openbsd.org 2012/05/13 01:42:32 2019 upstream commit
3735 [servconf.h servconf.c sshd.8 sshd.c auth.c sshd_config.5] 2020
3736 Add "Match LocalAddress" and "Match LocalPort" to sshd and adjust tests 2021 Add FingerprintHash option to control algorithm used for
3737 to match. Feedback and ok djm@ markus@. 2022 key fingerprints. Default changes from MD5 to SHA256 and format from hex to
3738 - dtucker@cvs.openbsd.org 2012/05/19 06:30:30 2023 base64.
3739 [sshd_config.5] 2024
3740 Document PermitOpen none. bz#2001, patch from Loganaden Velvindron 2025 Feedback and ok naddy@ markus@
3741 2026
374220120504 2027commit 058f839fe15c51be8b3a844a76ab9a8db550be4f
3743 - (dtucker) [configure.ac] Include <sys/param.h> rather than <sys/types.h> 2028Author: djm@openbsd.org <djm@openbsd.org>
3744 to fix building on some plaforms. Fom bowman at math utah edu and 2029Date: Thu Dec 18 23:58:04 2014 +0000
3745 des at des no. 2030
3746 2031 upstream commit
374720120427 2032
3748 - (dtucker) [regress/addrmatch.sh] skip tests when running on a non-ipv6 2033 don't count partial authentication success as a failure
3749 platform rather than exiting early, so that we still clean up and return 2034 against MaxAuthTries; ok deraadt@
3750 success or failure to test-exec.sh 2035
3751 2036commit c7219f4f54d64d6dde66dbcf7a2699daa782d2a1
375220120426 2037Author: djm@openbsd.org <djm@openbsd.org>
3753 - (djm) [auth-passwd.c] Handle crypt() returning NULL; from Paul Wouters 2038Date: Fri Dec 12 00:02:17 2014 +0000
3754 via Niels 2039
3755 - (djm) [auth-krb5.c] Save errno across calls that might modify it; 2040 upstream commit
3756 ok dtucker@ 2041
3757 2042 revert chunk I didn't mean to commit yet; via jmc@
375820120423 2043
3759 - OpenBSD CVS Sync 2044commit 7de5991aa3997e2981440f39c1ea01273a0a2c7b
3760 - djm@cvs.openbsd.org 2012/04/23 08:18:17 2045Author: Damien Miller <djm@mindrot.org>
3761 [channels.c] 2046Date: Thu Dec 18 11:44:06 2014 +1100
3762 fix function proto/source mismatch 2047
3763 2048 upstream libc change
376420120422 2049
3765 - OpenBSD CVS Sync 2050 revision 1.2
3766 - djm@cvs.openbsd.org 2012/02/29 11:21:26 2051 date: 2014/12/08 03:45:00; author: bcook; state: Exp; lines: +2 -2; commitid: 7zWEBgJJOCZ2hvTV;
3767 [ssh-keygen.c] 2052 avoid left shift overflow in reallocarray.
3768 allow conversion of RSA1 keys to public PEM and PKCS8; "nice" markus@ 2053
3769 - guenther@cvs.openbsd.org 2012/03/15 03:10:27 2054 Some 64-bit platforms (e.g. Windows 64) have a 32-bit long. So, shifting
3770 [session.c] 2055 1UL 32-bits to the left causes an overflow. This replaces the constant 1UL with
3771 root should always be excluded from the test for /etc/nologin instead 2056 (size_t)1 so that we get the correct constant size for the platform.
3772 of having it always enforced even when marked as ignorenologin. This 2057
3773 regressed when the logic was incompletely flipped around in rev 1.251 2058 discussed with tedu@ & deraadt@
3774 ok halex@ millert@ 2059
3775 - djm@cvs.openbsd.org 2012/03/28 07:23:22 2060commit 2048f85a5e6da8bc6e0532efe02ecfd4e63c978c
3776 [PROTOCOL.certkeys] 2061Author: Damien Miller <djm@mindrot.org>
3777 explain certificate extensions/crit split rationale. Mention requirement 2062Date: Thu Dec 18 10:15:49 2014 +1100
3778 that each appear at most once per cert. 2063
3779 - dtucker@cvs.openbsd.org 2012/03/29 23:54:36 2064 include CFLAGS in gnome askpass targets
3780 [channels.c channels.h servconf.c] 2065
3781 Add PermitOpen none option based on patch from Loganaden Velvindron 2066 from Fedora
3782 (bz #1949). ok djm@ 2067
3783 - djm@cvs.openbsd.org 2012/04/11 13:16:19 2068commit 48b68ce19ca42fa488960028048dec023f7899bb
3784 [channels.c channels.h clientloop.c serverloop.c] 2069Author: djm@openbsd.org <djm@openbsd.org>
3785 don't spin in accept() when out of fds (ENFILE/ENFILE) - back off for a 2070Date: Thu Dec 11 08:20:09 2014 +0000
3786 while; ok deraadt@ markus@ 2071
3787 - djm@cvs.openbsd.org 2012/04/11 13:17:54 2072 upstream commit
3788 [auth.c] 2073
3789 Support "none" as an argument for AuthorizedPrincipalsFile to indicate 2074 explicitly include sys/param.h in files that use the
3790 no file should be read. 2075 howmany() macro; from portable
3791 - djm@cvs.openbsd.org 2012/04/11 13:26:40 2076
3792 [sshd.c] 2077commit d663bea30a294d440fef4398e5cd816317bd4518
3793 don't spin in accept() when out of fds (ENFILE/ENFILE) - back off for a 2078Author: djm@openbsd.org <djm@openbsd.org>
3794 while; ok deraadt@ markus@ 2079Date: Thu Dec 11 05:25:06 2014 +0000
3795 - djm@cvs.openbsd.org 2012/04/11 13:34:17 2080
3796 [ssh-keyscan.1 ssh-keyscan.c] 2081 upstream commit
3797 now that sshd defaults to offering ECDSA keys, ssh-keyscan should also 2082
3798 look for them by default; bz#1971 2083 mention AuthorizedKeysCommandUser must be set for
3799 - djm@cvs.openbsd.org 2012/04/12 02:42:32 2084 AuthorizedKeysCommand to be run; bz#2287
3800 [servconf.c servconf.h sshd.c sshd_config sshd_config.5] 2085
3801 VersionAddendum option to allow server operators to append some arbitrary 2086commit 17bf3d81e00f2abb414a4fd271118cf4913f049f
3802 text to the SSH-... banner; ok deraadt@ "don't care" markus@ 2087Author: djm@openbsd.org <djm@openbsd.org>
3803 - djm@cvs.openbsd.org 2012/04/12 02:43:55 2088Date: Thu Dec 11 05:13:28 2014 +0000
3804 [sshd_config sshd_config.5] 2089
3805 mention AuthorizedPrincipalsFile=none default 2090 upstream commit
3806 - djm@cvs.openbsd.org 2012/04/20 03:24:23 2091
3807 [sftp.c] 2092 show in debug output which hostkeys are being tried when
3808 setlinebuf(3) is more readable than setvbuf(.., _IOLBF, ...) 2093 attempting hostbased auth; patch from Iain Morgan
3809 - jmc@cvs.openbsd.org 2012/04/20 16:26:22 2094
3810 [ssh.1] 2095commit da0277e3717eadf5b15e03379fc29db133487e94
3811 use "brackets" instead of "braces", for consistency; 2096Author: djm@openbsd.org <djm@openbsd.org>
3812 2097Date: Thu Dec 11 04:16:14 2014 +0000
381320120420 2098
3814 - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec] 2099 upstream commit
3815 [contrib/suse/openssh.spec] Update for release 6.0 2100
3816 - (djm) [README] Update URL to release notes. 2101 Make manual reflect reality: sftp-server's -d option
3817 - (djm) Release openssh-6.0 2102 accepts a "%d" option, not a "%h" one.
2103
2104 bz#2316; reported by Kirk Wolf
2105
2106commit 4cf87f4b81fa9380bce5fcff7b0f8382ae3ad996
2107Author: djm@openbsd.org <djm@openbsd.org>
2108Date: Wed Dec 10 01:24:09 2014 +0000
2109
2110 upstream commit
2111
2112 better error value for invalid signature length
2113
2114commit 4bfad14ca56f8ae04f418997816b4ba84e2cfc3c
2115Author: Darren Tucker <dtucker@zip.com.au>
2116Date: Wed Dec 10 02:12:51 2014 +1100
2117
2118 Resync more with OpenBSD's rijndael.c, in particular "#if 0"-ing out some
2119 unused code. Should fix compile error reported by plautrba at redhat.
2120
2121commit 642652d280499691c8212ec6b79724b50008ce09
2122Author: Darren Tucker <dtucker@zip.com.au>
2123Date: Wed Dec 10 01:32:23 2014 +1100
2124
2125 Add reallocarray to compat library
2126
2127commit 3dfd8d93dfcc69261f5af99df56f3ff598581979
2128Author: djm@openbsd.org <djm@openbsd.org>
2129Date: Thu Dec 4 22:31:50 2014 +0000
2130
2131 upstream commit
2132
2133 add tests for new client RevokedHostKeys option; refactor
2134 to make it a bit more readable
2135
2136commit a31046cad1aed16a0b55171192faa6d02665ccec
2137Author: krw@openbsd.org <krw@openbsd.org>
2138Date: Wed Nov 19 13:35:37 2014 +0000
2139
2140 upstream commit
2141
2142 Nuke yet more obvious #include duplications.
2143
2144 ok deraadt@
2145
2146commit a7c762e5b2c1093542c0bc1df25ccec0b4cf479f
2147Author: djm@openbsd.org <djm@openbsd.org>
2148Date: Thu Dec 4 20:47:36 2014 +0000
2149
2150 upstream commit
2151
2152 key_in_file() wrapper is no longer used
2153
2154commit 5e39a49930d885aac9c76af3129332b6e772cd75
2155Author: djm@openbsd.org <djm@openbsd.org>
2156Date: Thu Dec 4 02:24:32 2014 +0000
2157
2158 upstream commit
2159
2160 add RevokedHostKeys option for the client
2161
2162 Allow textfile or KRL-based revocation of hostkeys.
2163
2164commit 74de254bb92c684cf53461da97f52d5ba34ded80
2165Author: djm@openbsd.org <djm@openbsd.org>
2166Date: Thu Dec 4 01:49:59 2014 +0000
2167
2168 upstream commit
2169
2170 convert KRL code to new buffer API
2171
2172 ok markus@
2173
2174commit db995f2eed5fc432598626fa3e30654503bf7151
2175Author: millert@openbsd.org <millert@openbsd.org>
2176Date: Wed Nov 26 18:34:51 2014 +0000
2177
2178 upstream commit
2179
2180 Prefer setvbuf() to setlinebuf() for portability; ok
2181 deraadt@
2182
2183commit 72bba3d179ced8b425272efe6956a309202a91f3
2184Author: jsg@openbsd.org <jsg@openbsd.org>
2185Date: Mon Nov 24 03:39:22 2014 +0000
2186
2187 upstream commit
2188
2189 Fix crashes in the handling of the sshd config file found
2190 with the afl fuzzer.
2191
2192 ok deraadt@ djm@
2193
2194commit 867f49c666adcfe92bf539d9c37c1accdea08bf6
2195Author: Damien Miller <djm@mindrot.org>
2196Date: Wed Nov 26 13:22:41 2014 +1100
2197
2198 Avoid Cygwin ssh-host-config reading /etc/group
2199
2200 Patch from Corinna Vinschen
2201
2202commit 8b66f36291a721b1ba7c44f24a07fdf39235593e
2203Author: Damien Miller <djm@mindrot.org>
2204Date: Wed Nov 26 13:20:35 2014 +1100
2205
2206 allow custom service name for sshd on Cygwin
2207
2208 Permits the use of multiple sshd running with different service names.
2209
2210 Patch by Florian Friesdorf via Corinna Vinschen
2211
2212commit 08c0eebf55d70a9ae1964399e609288ae3186a0c
2213Author: jmc@openbsd.org <jmc@openbsd.org>
2214Date: Sat Nov 22 19:21:03 2014 +0000
2215
2216 upstream commit
2217
2218 restore word zapped in previous, and remove some useless
2219 "No" macros;
2220
2221commit a1418a0033fba43f061513e992e1cbcc3343e563
2222Author: deraadt@openbsd.org <deraadt@openbsd.org>
2223Date: Sat Nov 22 18:15:41 2014 +0000
2224
2225 upstream commit
2226
2227 /dev/random has created the same effect as /dev/arandom
2228 (and /dev/urandom) for quite some time. Mop up the last few, by using
2229 /dev/random where we actually want it, or not even mentioning arandom where
2230 it is irrelevant.
2231
2232commit b6de5ac9ed421362f479d1ad4fa433d2e25dad5b
2233Author: djm@openbsd.org <djm@openbsd.org>
2234Date: Fri Nov 21 01:00:38 2014 +0000
2235
2236 upstream commit
2237
2238 fix NULL pointer dereference crash on invalid timestamp
2239
2240 found using Michal Zalewski's afl fuzzer
2241
2242commit a1f8110cd5ed818d59b3a2964fab7de76e92c18e
2243Author: mikeb@openbsd.org <mikeb@openbsd.org>
2244Date: Tue Nov 18 22:38:48 2014 +0000
2245
2246 upstream commit
2247
2248 Sync AES code to the one shipped in OpenSSL/LibreSSL.
2249
2250 This includes a commit made by Andy Polyakov <appro at openssl ! org>
2251 to the OpenSSL source tree on Wed, 28 Jun 2006 with the following
2252 message: "Mitigate cache-collision timing attack on last round."
2253
2254 OK naddy, miod, djm
2255
2256commit 335c83d5f35d8620e16b8aa26592d4f836e09ad2
2257Author: krw@openbsd.org <krw@openbsd.org>
2258Date: Tue Nov 18 20:54:28 2014 +0000
2259
2260 upstream commit
2261
2262 Nuke more obvious #include duplications.
2263
2264 ok deraadt@ millert@ tedu@
2265
2266commit 51b64e44121194ae4bf153dee391228dada2abcb
2267Author: djm@openbsd.org <djm@openbsd.org>
2268Date: Mon Nov 17 00:21:40 2014 +0000
2269
2270 upstream commit
2271
2272 fix KRL generation when multiple CAs are in use
2273
2274 We would generate an invalid KRL when revoking certs by serial
2275 number for multiple CA keys due to a section being written out
2276 twice.
2277
2278 Also extend the regress test to catch this case by having it
2279 produce a multi-CA KRL.
2280
2281 Reported by peter AT pean.org
2282
2283commit d2d51003a623e21fb2b25567c4878d915e90aa2a
2284Author: djm@openbsd.org <djm@openbsd.org>
2285Date: Tue Nov 18 01:02:25 2014 +0000
2286
2287 upstream commit
2288
2289 fix NULL pointer dereference crash in key loading
2290
2291 found by Michal Zalewski's AFL fuzzer
2292
2293commit 9f9fad0191028edc43d100d0ded39419b6895fdf
2294Author: djm@openbsd.org <djm@openbsd.org>
2295Date: Mon Nov 17 00:21:40 2014 +0000
2296
2297 upstream commit
2298
2299 fix KRL generation when multiple CAs are in use
2300
2301 We would generate an invalid KRL when revoking certs by serial
2302 number for multiple CA keys due to a section being written out
2303 twice.
2304
2305 Also extend the regress test to catch this case by having it
2306 produce a multi-CA KRL.
2307
2308 Reported by peter AT pean.org
2309
2310commit da8af83d3f7ec00099963e455010e0ed1d7d0140
2311Author: bentley@openbsd.org <bentley@openbsd.org>
2312Date: Sat Nov 15 14:41:03 2014 +0000
2313
2314 upstream commit
2315
2316 Reduce instances of `` '' in manuals.
2317
2318 troff displays these as typographic quotes, but nroff implementations
2319 almost always print them literally, which rarely has the intended effect
2320 with modern fonts, even in stock xterm.
2321
2322 These uses of `` '' can be replaced either with more semantic alternatives
2323 or with Dq, which prints typographic quotes in a UTF-8 locale (but will
2324 automatically fall back to `` '' in an ASCII locale).
2325
2326 improvements and ok schwarze@
2327
2328commit fc302561369483bb755b17f671f70fb894aec01d
2329Author: djm@openbsd.org <djm@openbsd.org>
2330Date: Mon Nov 10 22:25:49 2014 +0000
2331
2332 upstream commit
2333
2334 mux-related manual tweaks
2335
2336 mention ControlPersist=0 is the same as ControlPersist=yes
2337
2338 recommend that ControlPath sockets be placed in a og-w directory
2339
2340commit 0e4cff5f35ed11102fe3783779960ef07e0cd381
2341Author: Damien Miller <djm@google.com>
2342Date: Wed Nov 5 11:01:31 2014 +1100
2343
2344 Prepare scripts for next Cygwin release
2345
2346 Makes the Cygwin-specific ssh-user-config script independent of the
2347 existence of /etc/passwd. The next Cygwin release will allow to
2348 generate passwd and group entries from the Windows account DBs, so the
2349 scripts have to adapt.
2350
2351 from Corinna Vinschen
2352
2353commit 7d0ba5336651731949762eb8877ce9e3b52df436
2354Author: Damien Miller <djm@mindrot.org>
2355Date: Thu Oct 30 10:45:41 2014 +1100
2356
2357 include version number in OpenSSL-too-old error
2358
2359commit 3bcb92e04d9207e9f78d82f7918c6d3422054ce9
2360Author: lteo@openbsd.org <lteo@openbsd.org>
2361Date: Fri Oct 24 02:01:20 2014 +0000
2362
2363 upstream commit
2364
2365 Remove unnecessary include: netinet/in_systm.h is not needed
2366 by these programs.
2367
2368 NB. skipped for portable
2369
2370 ok deraadt@ millert@
2371
2372commit 6fdcaeb99532e28a69f1a1599fbd540bb15b70a0
2373Author: djm@openbsd.org <djm@openbsd.org>
2374Date: Mon Oct 20 03:43:01 2014 +0000
2375
2376 upstream commit
2377
2378 whitespace
2379
2380commit 165bc8786299e261706ed60342985f9de93a7461
2381Author: daniel@openbsd.org <daniel@openbsd.org>
2382Date: Tue Oct 14 03:09:59 2014 +0000
2383
2384 upstream commit
2385
2386 plug a memory leak; from Maxime Villard.
2387
2388 ok djm@
2389
2390commit b1ba15f3885947c245c2dbfaad0a04ba050abea0
2391Author: jmc@openbsd.org <jmc@openbsd.org>
2392Date: Thu Oct 9 06:21:31 2014 +0000
2393
2394 upstream commit
2395
2396 tweak previous;
2397
2398commit 259a02ebdf74ad90b41d116ecf70aa823fa4c6e7
2399Author: djm@openbsd.org <djm@openbsd.org>
2400Date: Mon Oct 13 00:38:35 2014 +0000
2401
2402 upstream commit
2403
2404 whitespace
2405
2406commit 957fbceb0f3166e41b76fdb54075ab3b9cc84cba
2407Author: djm@openbsd.org <djm@openbsd.org>
2408Date: Wed Oct 8 22:20:25 2014 +0000
2409
2410 upstream commit
2411
2412 Tweak config reparsing with host canonicalisation
2413
2414 Make the second pass through the config files always run when
2415 hostname canonicalisation is enabled.
2416
2417 Add a "Match canonical" criteria that allows ssh_config Match
2418 blocks to trigger only in the second config pass.
2419
2420 Add a -G option to ssh that causes it to parse its configuration
2421 and dump the result to stdout, similar to "sshd -T"
2422
2423 Allow ssh_config Port options set in the second config parse
2424 phase to be applied (they were being ignored).
2425
2426 bz#2267 bz#2286; ok markus
2427
2428commit 5c0dafd38bf66feeeb45fa0741a5baf5ad8039ba
2429Author: djm@openbsd.org <djm@openbsd.org>
2430Date: Wed Oct 8 22:15:27 2014 +0000
2431
2432 upstream commit
2433
2434 another -Wpointer-sign from clang
2435
2436commit bb005dc815ebda9af3ae4b39ca101c4da918f835
2437Author: djm@openbsd.org <djm@openbsd.org>
2438Date: Wed Oct 8 22:15:06 2014 +0000
2439
2440 upstream commit
2441
2442 fix a few -Wpointer-sign warnings from clang
2443
2444commit 3cc1fbb4fb0e804bfb873fd363cea91b27fc8188
2445Author: djm@openbsd.org <djm@openbsd.org>
2446Date: Wed Oct 8 21:45:48 2014 +0000
2447
2448 upstream commit
2449
2450 parse cert sections using nested buffers to reduce
2451 copies; ok markus
2452
2453commit 4a45922aebf99164e2fc83d34fe55b11ae1866ef
2454Author: djm@openbsd.org <djm@openbsd.org>
2455Date: Mon Oct 6 00:47:15 2014 +0000
2456
2457 upstream commit
2458
2459 correct options in usage(); from mancha1 AT zoho.com
2460
2461commit 48dffd5bebae6fed0556dc5c36cece0370690618
2462Author: djm@openbsd.org <djm@openbsd.org>
2463Date: Tue Sep 9 09:45:36 2014 +0000
2464
2465 upstream commit
2466
2467 mention permissions on tun(4) devices in PermitTunnel
2468 documentation; bz#2273
2469
2470commit a5883d4eccb94b16c355987f58f86a7dee17a0c2
2471Author: djm@openbsd.org <djm@openbsd.org>
2472Date: Wed Sep 3 18:55:07 2014 +0000
2473
2474 upstream commit
2475
2476 tighten permissions on pty when the "tty" group does
2477 not exist; pointed out by Corinna Vinschen; ok markus
2478
2479commit 180bcb406b58bf30723c01a6b010e48ee626dda8
2480Author: sobrado@openbsd.org <sobrado@openbsd.org>
2481Date: Sat Aug 30 16:32:25 2014 +0000
2482
2483 upstream commit
2484
2485 typo.
2486
2487commit f70b22bcdd52f6bf127047b3584371e6e5d45627
2488Author: sobrado@openbsd.org <sobrado@openbsd.org>
2489Date: Sat Aug 30 15:33:50 2014 +0000
2490
2491 upstream commit
2492
2493 improve capitalization for the Ed25519 public-key
2494 signature system.
2495
2496 ok djm@
2497
2498commit 7df8818409c752cf3f0c3f8044fe9aebed8647bd
2499Author: doug@openbsd.org <doug@openbsd.org>
2500Date: Thu Aug 21 01:08:52 2014 +0000
2501
2502 upstream commit
2503
2504 Free resources on error in mkstemp and fdopen
2505
2506 ok djm@
2507
2508commit 40ba4c9733aaed08304714faeb61529f18da144b
2509Author: deraadt@openbsd.org <deraadt@openbsd.org>
2510Date: Wed Aug 20 01:28:55 2014 +0000
2511
2512 upstream commit
2513
2514 djm how did you make a typo like that...
2515
2516commit 57d378ec9278ba417a726f615daad67d157de666
2517Author: djm@openbsd.org <djm@openbsd.org>
2518Date: Tue Aug 19 23:58:28 2014 +0000
2519
2520 upstream commit
2521
2522 When dumping the server configuration (sshd -T), print
2523 correct KEX, MAC and cipher defaults. Spotted by Iain Morgan
2524
2525commit 7ff880ede5195d0b17e7f1e3b6cfbc4cb6f85240
2526Author: djm@openbsd.org <djm@openbsd.org>
2527Date: Tue Aug 19 23:57:18 2014 +0000
2528
2529 upstream commit
2530
2531 ~-expand lcd paths
2532
2533commit 4460a7ad0c78d4cd67c467f6e9f4254d0404ed59
2534Author: Damien Miller <djm@mindrot.org>
2535Date: Sun Oct 12 12:35:48 2014 +1100
2536
2537 remove duplicated KEX_DH1 entry
2538
2539commit c9b8426a616138d0d762176c94f51aff3faad5ff
2540Author: Damien Miller <djm@mindrot.org>
2541Date: Thu Oct 9 10:34:06 2014 +1100
2542
2543 remove ChangeLog file
2544
2545 Commit logs will be generated from git at release time.
2546
2547commit 81d18ff7c93a04affbf3903e0963859763219aed
2548Author: Damien Miller <djm@google.com>
2549Date: Tue Oct 7 21:24:25 2014 +1100
2550
2551 delete contrib/caldera directory
2552
2553commit 0ec9e87d3638206456968202f05bb5123670607a
2554Author: Damien Miller <djm@google.com>
2555Date: Tue Oct 7 19:57:27 2014 +1100
2556
2557 test commit
2558
2559commit 8fb65a44568701b779f3d77326bceae63412d28d
2560Author: Damien Miller <djm@mindrot.org>
2561Date: Tue Oct 7 09:21:49 2014 +1100
2562
2563 - (djm) Release OpenSSH-6.7
2564
2565commit e8c9f2602c46f6781df5e52e6cd8413dab4602a3
2566Author: Damien Miller <djm@mindrot.org>
2567Date: Fri Oct 3 09:24:56 2014 +1000
2568
2569 - (djm) [sshd_config.5] typo; from Iain Morgan
2570
2571commit 703b98a26706f5083801d11059486d77491342ae
2572Author: Damien Miller <djm@mindrot.org>
2573Date: Wed Oct 1 09:43:07 2014 +1000
2574
2575 - (djm) [openbsd-compat/Makefile.in openbsd-compat/kludge-fd_set.c]
2576 [openbsd-compat/openbsd-compat.h] Kludge around bad glibc
2577 _FORTIFY_SOURCE check that doesn't grok heap-allocated fd_sets;
2578 ok dtucker@
2579
2580commit 0fa0ed061bbfedb0daa705e220748154a84c3413
2581Author: Damien Miller <djm@mindrot.org>
2582Date: Wed Sep 10 08:15:34 2014 +1000
2583
2584 - (djm) [sandbox-seccomp-filter.c] Allow mremap and exit for DietLibc;
2585 patch from Felix von Leitner; ok dtucker
2586
2587commit ad7d23d461c3b7e1dcb15db13aee5f4b94dc1a95
2588Author: Darren Tucker <dtucker@zip.com.au>
2589Date: Tue Sep 9 12:23:10 2014 +1000
2590
2591 20140908
2592 - (dtucker) [INSTALL] Update info about egd. ok djm@
2593
2594commit 2a8699f37cc2515e3bc60e0c677ba060f4d48191
2595Author: Damien Miller <djm@mindrot.org>
2596Date: Thu Sep 4 03:46:05 2014 +1000
2597
2598 - (djm) [openbsd-compat/arc4random.c] Zero seed after keying PRNG
2599
2600commit 44988defb1f5e3afe576d86000365e1f07a1b494
2601Author: Damien Miller <djm@mindrot.org>
2602Date: Wed Sep 3 05:35:32 2014 +1000
2603
2604 - (djm) [contrib/cygwin/ssh-host-config] Fix old code leading to
2605 permissions/ACLs; from Corinna Vinschen
2606
2607commit 23f269562b7537b2f6f5014e50a25e5dcc55a837
2608Author: Damien Miller <djm@mindrot.org>
2609Date: Wed Sep 3 05:33:25 2014 +1000
2610
2611 - (djm) [defines.h sshbuf.c] Move __predict_true|false to defines.h and
2612 conditionalise to avoid duplicate definition.
2613
2614commit 41c8de2c0031cf59e7cf0c06b5bcfbf4852c1fda
2615Author: Damien Miller <djm@mindrot.org>
2616Date: Sat Aug 30 16:23:06 2014 +1000
2617
2618 - (djm) [Makefile.in] Make TEST_SHELL a variable; "good idea" tim@
2619
2620commit d7c81e216a7bd9eed6e239c970d9261bb1651947
2621Author: Damien Miller <djm@mindrot.org>
2622Date: Sat Aug 30 04:18:28 2014 +1000
2623
2624 - (djm) [openbsd-compat/openssl-compat.h] add include guard
2625
2626commit 4687802dda57365b984b897fc3c8e2867ea09b22
2627Author: Damien Miller <djm@mindrot.org>
2628Date: Sat Aug 30 03:29:19 2014 +1000
2629
2630 - (djm) [misc.c] Missing newline between functions
2631
2632commit 51c77e29220dee87c53be2dc47092934acab26fe
2633Author: Damien Miller <djm@mindrot.org>
2634Date: Sat Aug 30 02:30:30 2014 +1000
2635
2636 - (djm) [openbsd-compat/openssl-compat.h] add
2637 OPENSSL_[RD]SA_MAX_MODULUS_BITS defines for OpenSSL that lacks them
2638
2639commit 3d673d103bad35afaec6e7ef73e5277216ce33a3
2640Author: Damien Miller <djm@mindrot.org>
2641Date: Wed Aug 27 06:32:01 2014 +1000
2642
2643 - (djm) [openbsd-compat/explicit_bzero.c] implement explicit_bzero()
2644 using memset_s() where possible; improve fallback to indirect bzero
2645 via a volatile pointer to give it more of a chance to avoid being
2646 optimised away.
2647
2648commit 146218ac11a1eb0dcade6f793d7acdef163b5ddc
2649Author: Damien Miller <djm@mindrot.org>
2650Date: Wed Aug 27 04:11:55 2014 +1000
2651
2652 - (djm) [monitor.c sshd.c] SIGXFSZ needs to be ignored in postauth
2653 monitor, not preauth; bz#2263
2654
2655commit 1b215c098b3b37e38aa4e4c91bb908eee41183b1
2656Author: Damien Miller <djm@mindrot.org>
2657Date: Wed Aug 27 04:04:40 2014 +1000
2658
2659 - (djm) [regress/unittests/sshbuf/test_sshbuf_getput_crypto.c]
2660 [regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c]
2661 [regress/unittests/sshkey/common.c]
2662 [regress/unittests/sshkey/test_file.c]
2663 [regress/unittests/sshkey/test_fuzz.c]
2664 [regress/unittests/sshkey/test_sshkey.c] Don't include openssl/ec.h
2665 on !ECC OpenSSL systems
2666
2667commit ad013944af0a19e3f612089d0099bb397cf6502d
2668Author: Damien Miller <djm@mindrot.org>
2669Date: Tue Aug 26 09:27:28 2014 +1000
2670
2671 - (djm) [INSTALL] Recommend libcrypto be built -fPIC, mention LibreSSL,
2672 update OpenSSL version requirement.
2673
2674commit ed126de8ee04c66640a0ea2697c4aaf36801f100
2675Author: Damien Miller <djm@mindrot.org>
2676Date: Tue Aug 26 08:37:47 2014 +1000
2677
2678 - (djm) [bufec.c] Skip this file on !ECC OpenSSL
2679
2680commit 9c1dede005746864a4fdb36a7cdf6c51296ca909
2681Author: Damien Miller <djm@mindrot.org>
2682Date: Sun Aug 24 03:01:06 2014 +1000
2683
2684 - (djm) [sftp-server.c] Some systems (e.g. Irix) have prctl() but not
2685 PR_SET_DUMPABLE, so adjust ifdef; reported by Tom Christensen
2686
2687commit d244a5816fd1312a33404b436e4dd83594f1119e
2688Author: Damien Miller <djm@mindrot.org>
2689Date: Sat Aug 23 17:06:49 2014 +1000
2690
2691 - (djm) [configure.ac] We now require a working vsnprintf everywhere (not
2692 just for systems that lack asprintf); check for it always and extend
2693 test to catch more brokenness. Fixes builds on Solaris <= 9
2694
2695commit 4cec036362a358e398e6a2e6d19d8e5780558634
2696Author: Damien Miller <djm@mindrot.org>
2697Date: Sat Aug 23 03:11:09 2014 +1000
2698
2699 - (djm) [sshd.c] Ignore SIGXFSZ in preauth monitor child; can explode on
2700 lastlog writing on platforms with high UIDs; bz#2263
2701
2702commit 394a60f2598d28b670d934b93942a3370b779b39
2703Author: Damien Miller <djm@mindrot.org>
2704Date: Fri Aug 22 18:06:20 2014 +1000
2705
2706 - (djm) [configure.ac] double braces to appease autoconf
2707
2708commit 4d69aeabd6e60afcdc7cca177ca751708ab79a9d
2709Author: Damien Miller <djm@mindrot.org>
2710Date: Fri Aug 22 17:48:27 2014 +1000
2711
2712 - (djm) [openbsd-compat/bsd-snprintf.c] Fix compilation failure (prototype/
2713 definition mismatch) and warning for broken/missing snprintf case.
2714
2715commit 0c11f1ac369d2c0aeb0ab0458a7cd04c72fe5e9e
2716Author: Damien Miller <djm@mindrot.org>
2717Date: Fri Aug 22 17:36:56 2014 +1000
2718
2719 - (djm) [sshbuf-getput-crypto.c] Fix compilation when OpenSSL lacks ECC
2720
2721commit 6d62784b8973340b251fea6b04890f471adf28db
2722Author: Damien Miller <djm@mindrot.org>
2723Date: Fri Aug 22 17:36:19 2014 +1000
2724
2725 - (djm) [configure.ac] include leading zero characters in OpenSSL version
2726 number; fixes test for unsupported versions
2727
2728commit 4f1ff1ed782117f5d5204d4e91156ed5da07cbb7
2729Author: Damien Miller <djm@mindrot.org>
2730Date: Thu Aug 21 15:54:50 2014 +1000
2731
2732 - (djm) [regress/unittests/test_helper/test_helper.c] Fix for systems that
2733 don't set __progname. Diagnosed by Tom Christensen.
2734
2735commit 005a64da0f457410045ef0bfa93c863c2450447d
2736Author: Damien Miller <djm@mindrot.org>
2737Date: Thu Aug 21 10:48:41 2014 +1000
2738
2739 - (djm) [key.h] Fix ifdefs for no-ECC OpenSSL
2740
2741commit aa6598ebb3343c7380e918388e10e8ca5852b613
2742Author: Damien Miller <djm@mindrot.org>
2743Date: Thu Aug 21 10:47:54 2014 +1000
2744
2745 - (djm) [Makefile.in] fix reference to libtest_helper.a in sshkey test too.
2746
2747commit 54703e3cf63f0c80d4157e5ad7dbc2b363ee2c56
2748Author: Damien Miller <djm@mindrot.org>
2749Date: Wed Aug 20 11:10:51 2014 +1000
2750
2751 - (djm) [contrib/cygwin/README] Correct build instructions; from Corinna
2752
2753commit f0935698f0461f24d8d1f1107b476ee5fd4db1cb
2754Author: Damien Miller <djm@mindrot.org>
2755Date: Wed Aug 20 11:06:50 2014 +1000
2756
2757 - (djm) [sshkey.h] Fix compilation when OpenSSL lacks ECC
2758
2759commit c5089ecaec3b2c02f014f4e67518390702a4ba14
2760Author: Damien Miller <djm@mindrot.org>
2761Date: Wed Aug 20 11:06:20 2014 +1000
2762
2763 - (djm) [Makefile.in] refer to libtest_helper.a by explicit path rather than
2764 -L/-l; fixes linking problems on some platforms
2765
2766commit 2195847e503a382f83ee969b0a8bd3dfe0e55c18
2767Author: Damien Miller <djm@mindrot.org>
2768Date: Wed Aug 20 11:05:03 2014 +1000
2769
2770 - (djm) [configure.ac] Check OpenSSL version is supported at configure time;
2771 suggested by Kevin Brott
2772
2773commit a75aca1bbc989aa9f8b1b08489d37855f3d24d1a
2774Author: Damien Miller <djm@mindrot.org>
2775Date: Tue Aug 19 11:36:07 2014 +1000
2776
2777 - (djm) [INSTALL contrib/caldera/openssh.spec contrib/cygwin/README]
2778 [contrib/redhat/openssh.spec contrib/suse/openssh.spec] Remove mentions
2779 of TCP wrappers.
2780
2781commit 3f022b5a9477abceeb1bbeab04b055f3cc7ca8f6
2782Author: Damien Miller <djm@mindrot.org>
2783Date: Tue Aug 19 11:32:34 2014 +1000
2784
2785 - (djm) [ssh-dss.c] Include openssl/dsa.h for DSA_SIG
2786
2787commit 88137902632aceb923990e98cf5dc923bb3ef2f5
2788Author: Damien Miller <djm@mindrot.org>
2789Date: Tue Aug 19 11:28:11 2014 +1000
2790
2791 - (djm) [sshbuf.h] Fix compilation on systems without OPENSSL_HAS_ECC.
2792
2793commit 2f3d1e7fb2eabd3cfbfd8d0f7bdd2f9a1888690b
2794Author: Damien Miller <djm@mindrot.org>
2795Date: Tue Aug 19 11:14:36 2014 +1000
2796
2797 - (djm) [myproposal.h] Make curve25519 KEX dependent on
2798 HAVE_EVP_SHA256 instead of OPENSSL_HAS_ECC.
2799
2800commit d4e7d59d01a6c7f59e8c1f94a83c086e9a33d8aa
2801Author: Damien Miller <djm@mindrot.org>
2802Date: Tue Aug 19 11:14:17 2014 +1000
2803
2804 - (djm) [serverloop.c] Fix syntax error on Cygwin; from Corinna Vinschen
2805
2806commit 9eaeea2cf2b6af5f166cfa9ad3c7a90711a147a9
2807Author: Damien Miller <djm@mindrot.org>
2808Date: Sun Aug 10 11:35:05 2014 +1000
2809
2810 - (djm) [README contrib/caldera/openssh.spec]
2811 [contrib/redhat/openssh.spec contrib/suse/openssh.spec] Update versions
2812
2813commit f8988fbef0c9801d19fa2f8f4f041690412bec37
2814Author: Damien Miller <djm@mindrot.org>
2815Date: Fri Aug 1 13:31:52 2014 +1000
2816
2817 - (djm) [regress/multiplex.sh] Use -d (detach stdin) flag to disassociate
2818 nc from stdin, it's more portable
2819
2820commit 5b3879fd4b7a4e3d43bab8f40addda39bc1169d0
2821Author: Damien Miller <djm@mindrot.org>
2822Date: Fri Aug 1 12:28:31 2014 +1000
2823
2824 - (djm) [regress/multiplex.sh] Instruct nc not to quit as soon as stdin
2825 is closed; avoid regress failures when stdin is /dev/null
2826
2827commit a9c46746d266f8a1b092a72b2150682d1af8ebfc
2828Author: Damien Miller <djm@mindrot.org>
2829Date: Fri Aug 1 12:26:49 2014 +1000
2830
2831 - (djm) [regress/multiplex.sh] Skip test for non-OpenBSD netcat. We need
2832 a better solution, but this will have to do for now.
2833
2834commit 426117b2e965e43f47015942b5be8dd88fe74b88
2835Author: Damien Miller <djm@mindrot.org>
2836Date: Wed Jul 30 12:33:20 2014 +1000
2837
2838 - schwarze@cvs.openbsd.org 2014/07/28 15:40:08
2839 [sftp-server.8 sshd_config.5]
2840 some systems no longer need /dev/log;
2841 issue noticed by jirib;
2842 ok deraadt
2843
2844commit f497794b6962eaf802ab4ac2a7b22ae591cca1d5
2845Author: Damien Miller <djm@mindrot.org>
2846Date: Wed Jul 30 12:32:46 2014 +1000
2847
2848 - dtucker@cvs.openbsd.org 2014/07/25 21:22:03
2849 [ssh-agent.c]
2850 Clear buffer used for handling messages. This prevents keys being
2851 left in memory after they have been expired or deleted in some cases
2852 (but note that ssh-agent is setgid so you would still need root to
2853 access them). Pointed out by Kevin Burns, ok deraadt
2854
2855commit a8a0f65c57c8ecba94d65948e9090da54014dfef
2856Author: Damien Miller <djm@mindrot.org>
2857Date: Wed Jul 30 12:32:28 2014 +1000
2858
2859 - OpenBSD CVS Sync
2860 - millert@cvs.openbsd.org 2014/07/24 22:57:10
2861 [ssh.1]
2862 Mention UNIX-domain socket forwarding too. OK jmc@ deraadt@
2863
2864commit 56b840f2b81e14a2f95c203403633a72566736f8
2865Author: Damien Miller <djm@mindrot.org>
2866Date: Fri Jul 25 08:11:30 2014 +1000
2867
2868 - (djm) [regress/multiplex.sh] restore incorrectly deleted line;
2869 pointed out by Christian Hesse
2870
2871commit dd417b60d5ca220565d1014e92b7f8f43dc081eb
2872Author: Darren Tucker <dtucker@zip.com.au>
2873Date: Wed Jul 23 10:41:21 2014 +1000
2874
2875 - dtucker@cvs.openbsd.org 2014/07/22 23:35:38
2876 [regress/unittests/sshkey/testdata/*]
2877 Regenerate test keys with certs signed with ed25519 instead of ecdsa.
2878 These can be used in -portable on platforms that don't support ECDSA.
2879
2880commit 40e50211896369dba8f64f3b5e5fd58b76f5ac3f
2881Author: Darren Tucker <dtucker@zip.com.au>
2882Date: Wed Jul 23 10:35:45 2014 +1000
2883
2884 - dtucker@cvs.openbsd.org 2014/07/22 23:57:40
2885 [regress/unittests/sshkey/mktestdata.sh]
2886 Add $OpenBSD tag to make syncs easier
2887
2888commit 07e644251e809b1d4c062cf85bd1146a7e3f5a8a
2889Author: Darren Tucker <dtucker@zip.com.au>
2890Date: Wed Jul 23 10:34:26 2014 +1000
2891
2892 - dtucker@cvs.openbsd.org 2014/07/22 23:23:22
2893 [regress/unittests/sshkey/mktestdata.sh]
2894 Sign test certs with ed25519 instead of ecdsa so that they'll work in
2895 -portable on platforms that don't have ECDSA in their OpenSSL. ok djm
2896
2897commit cea099a7c4eaecb01b001e5453bb4e5c25006c22
2898Author: Darren Tucker <dtucker@zip.com.au>
2899Date: Wed Jul 23 10:04:02 2014 +1000
2900
2901 - djm@cvs.openbsd.org 2014/07/22 01:32:12
2902 [regress/multiplex.sh]
2903 change the test for still-open Unix domain sockets to be robust against
2904 nc implementations that produce error messages. from -portable
2905 (Id sync only)
2906
2907commit 31eb78078d349b32ea41952ecc944b3ad6cb0d45
2908Author: Darren Tucker <dtucker@zip.com.au>
2909Date: Wed Jul 23 09:43:42 2014 +1000
2910
2911 - guenther@cvs.openbsd.org 2014/07/22 07:13:42
2912 [umac.c]
2913 Convert from <sys/endian.h> to the shiney new <endian.h>
2914 ok dtucker@, who also confirmed that -portable handles this already
2915 (ID sync only, includes.h pulls in endian.h if available.)
2916
2917commit 820763efef2d19d965602533036c2b4badc9d465
2918Author: Darren Tucker <dtucker@zip.com.au>
2919Date: Wed Jul 23 09:40:46 2014 +1000
2920
2921 - dtucker@cvs.openbsd.org 2014/07/22 01:18:50
2922 [key.c]
2923 Prevent spam from key_load_private_pem during hostbased auth. ok djm@
2924
2925commit c4ee219a66f3190fa96cbd45b4d11015685c6306
2926Author: Darren Tucker <dtucker@zip.com.au>
2927Date: Wed Jul 23 04:27:50 2014 +1000
2928
2929 - (dtucker) [regress/unittests/sshkey/test_{file,fuzz,sshkey}.c] Wrap ecdsa-
2930 specific tests inside OPENSSL_HAS_ECC.
2931
2932commit 04f4824940ea3edd60835416ececbae16438968a
2933Author: Damien Miller <djm@mindrot.org>
2934Date: Tue Jul 22 11:31:47 2014 +1000
2935
2936 - (djm) [regress/multiplex.sh] change the test for still-open Unix
2937 domain sockets to be robust against nc implementations that produce
2938 error messages.
2939
2940commit 5ea4fe00d55453aaa44007330bb4c3181bd9b796
2941Author: Damien Miller <djm@mindrot.org>
2942Date: Tue Jul 22 09:39:19 2014 +1000
2943
2944 - (djm) [regress/multiplex.sh] ssh mux master lost -N somehow;
2945 put it back
2946
2947commit 948a1774a79a85f9deba6d74db95f402dee32c69
2948Author: Darren Tucker <dtucker@zip.com.au>
2949Date: Tue Jul 22 01:07:11 2014 +1000
2950
2951 - (dtucker) [sshkey.c] ifdef out unused variable when compiling without
2952 OPENSSL_HAS_ECC.
2953
2954commit c8f610f6cc57ae129758052439d9baf13699097b
2955Author: Damien Miller <djm@mindrot.org>
2956Date: Mon Jul 21 10:23:27 2014 +1000
2957
2958 - (djm) [regress/multiplex.sh] Not all netcat accept the -N option.
2959
2960commit 0e4e95566cd95c887f69272499b8f3880b3ec0f5
2961Author: Damien Miller <djm@mindrot.org>
2962Date: Mon Jul 21 09:52:54 2014 +1000
2963
2964 - millert@cvs.openbsd.org 2014/07/15 15:54:15
2965 [forwarding.sh multiplex.sh]
2966 Add support for Unix domain socket forwarding. A remote TCP port
2967 may be forwarded to a local Unix domain socket and vice versa or
2968 both ends may be a Unix domain socket. This is a reimplementation
2969 of the streamlocal patches by William Ahern from:
2970 http://www.25thandclement.com/~william/projects/streamlocal.html
2971 OK djm@ markus@
2972
2973commit 93a87ab27ecdc709169fb24411133998f81e2761
2974Author: Darren Tucker <dtucker@zip.com.au>
2975Date: Mon Jul 21 06:30:25 2014 +1000
2976
2977 - (dtucker) [regress/unittests/sshkey/
2978 {common,test_file,test_fuzz,test_sshkey}.c] Wrap stdint.h includes in
2979 ifdefs.
2980
2981commit 5573171352ea23df2dc6d2fe0324d023b7ba697c
2982Author: Darren Tucker <dtucker@zip.com.au>
2983Date: Mon Jul 21 02:24:59 2014 +1000
2984
2985 - (dtucker) [cipher.c openbsd-compat/openssl-compat.h] Restore the bits
2986 needed to build AES CTR mode against OpenSSL 0.9.8f and above. ok djm
2987
2988commit 74e28682711d005026c7c8f15f96aea9d3c8b5a3
2989Author: Tim Rice <tim@multitalents.net>
2990Date: Fri Jul 18 20:00:11 2014 -0700
2991
2992 - (tim) [openbsd-compat/port-uw.c] Include misc.h for fwd_opts, used
2993 in servconf.h.
2994
2995commit d1a0421f8e5e933fee6fb58ee6b9a22c63c8a613
2996Author: Darren Tucker <dtucker@zip.com.au>
2997Date: Sat Jul 19 07:23:55 2014 +1000
2998
2999 - (dtucker) [key.c sshkey.c] Put new ecdsa bits inside ifdef OPENSSL_HAS_ECC.
3000
3001commit f0fe9ea1be62227c130b317769de3d1e736b6dc1
3002Author: Darren Tucker <dtucker@zip.com.au>
3003Date: Sat Jul 19 06:33:12 2014 +1000
3004
3005 - (dtucker) [Makefile.in] Add a t-exec target to run just the executable
3006 tests.
3007
3008commit 450bc1180d4b061434a4b733c5c8814fa30b022b
3009Author: Darren Tucker <dtucker@zip.com.au>
3010Date: Sat Jul 19 06:23:18 2014 +1000
3011
3012 - (dtucker) [auth2-gss.c gss-serv-krb5.c] Include misc.h for fwd_opts, used
3013 in servconf.h.
3014
3015commit ab2ec586baad122ed169285c31927ccf58bc7b28
3016Author: Damien Miller <djm@mindrot.org>
3017Date: Fri Jul 18 15:04:47 2014 +1000
3018
3019 - djm@cvs.openbsd.org 2014/07/18 02:46:01
3020 [ssh-agent.c]
3021 restore umask around listener socket creation (dropped in streamlocal patch
3022 merge)
3023
3024commit 357610d15946381ae90c271837dcdd0cdce7145f
3025Author: Damien Miller <djm@mindrot.org>
3026Date: Fri Jul 18 15:04:10 2014 +1000
3027
3028 - djm@cvs.openbsd.org 2014/07/17 07:22:19
3029 [mux.c ssh.c]
3030 reflect stdio-forward ("ssh -W host:port ...") failures in exit status.
3031 previously we were always returning 0. bz#2255 reported by Brendan
3032 Germain; ok dtucker
3033
3034commit dad9a4a0b7c2b5d78605f8df28718f116524134e
3035Author: Damien Miller <djm@mindrot.org>
3036Date: Fri Jul 18 15:03:49 2014 +1000
3037
3038 - djm@cvs.openbsd.org 2014/07/17 00:12:03
3039 [key.c]
3040 silence "incorrect passphrase" error spam; reported and ok dtucker@
3041
3042commit f42f7684ecbeec6ce50e0310f80b3d6da2aaf533
3043Author: Damien Miller <djm@mindrot.org>
3044Date: Fri Jul 18 15:03:27 2014 +1000
3045
3046 - djm@cvs.openbsd.org 2014/07/17 00:10:18
3047 [mux.c]
3048 preserve errno across syscall
3049
3050commit 1b83320628cb0733e3688b85bfe4d388a7c51909
3051Author: Damien Miller <djm@mindrot.org>
3052Date: Fri Jul 18 15:03:02 2014 +1000
3053
3054 - djm@cvs.openbsd.org 2014/07/17 00:10:56
3055 [sandbox-systrace.c]
3056 ifdef SYS_sendsyslog so this will compile without patching on -stable
3057
3058commit 6d57656331bcd754d912950e4a18ad259d596e61
3059Author: Damien Miller <djm@mindrot.org>
3060Date: Fri Jul 18 15:02:06 2014 +1000
3061
3062 - jmc@cvs.openbsd.org 2014/07/16 14:48:57
3063 [ssh.1]
3064 add the streamlocal* options to ssh's -o list; millert says they're
3065 irrelevant for scp/sftp;
3066
3067 ok markus millert
3068
3069commit 7acefbbcbeab725420ea07397ae35992f505f702
3070Author: Damien Miller <djm@mindrot.org>
3071Date: Fri Jul 18 14:11:24 2014 +1000
3072
3073 - millert@cvs.openbsd.org 2014/07/15 15:54:14
3074 [PROTOCOL auth-options.c auth-passwd.c auth-rh-rsa.c auth-rhosts.c]
3075 [auth-rsa.c auth.c auth1.c auth2-hostbased.c auth2-kbdint.c auth2-none.c]
3076 [auth2-passwd.c auth2-pubkey.c auth2.c canohost.c channels.c channels.h]
3077 [clientloop.c misc.c misc.h monitor.c mux.c packet.c readconf.c]
3078 [readconf.h servconf.c servconf.h serverloop.c session.c ssh-agent.c]
3079 [ssh.c ssh_config.5 sshconnect.c sshconnect1.c sshconnect2.c sshd.c]
3080 [sshd_config.5 sshlogin.c]
3081 Add support for Unix domain socket forwarding. A remote TCP port
3082 may be forwarded to a local Unix domain socket and vice versa or
3083 both ends may be a Unix domain socket. This is a reimplementation
3084 of the streamlocal patches by William Ahern from:
3085 http://www.25thandclement.com/~william/projects/streamlocal.html
3086 OK djm@ markus@
3087
3088commit 6262d760e00714523633bd989d62e273a3dca99a
3089Author: Damien Miller <djm@mindrot.org>
3090Date: Thu Jul 17 09:52:07 2014 +1000
3091
3092 - tedu@cvs.openbsd.org 2014/07/11 13:54:34
3093 [myproposal.h]
3094 by popular demand, add back hamc-sha1 to server proposal for better compat
3095 with many clients still in use. ok deraadt
3096
3097commit 9d69d937b46ecba17f16d923e538ceda7b705c7a
3098Author: Damien Miller <djm@mindrot.org>
3099Date: Thu Jul 17 09:49:37 2014 +1000
3100
3101 - deraadt@cvs.openbsd.org 2014/07/11 08:09:54
3102 [sandbox-systrace.c]
3103 Permit use of SYS_sendsyslog from inside the sandbox. Clock is ticking,
3104 update your kernels and sshd soon.. libc will start using sendsyslog()
3105 in about 4 days.
3106
3107commit f6293a0b4129826fc2e37e4062f96825df43c326
3108Author: Damien Miller <djm@mindrot.org>
3109Date: Thu Jul 17 09:01:25 2014 +1000
3110
3111 - (djm) [digest-openssl.c] Preserve array order when disabling digests.
3112 Reported by Petr Lautrbach.
3113
3114commit 00f9cd230709c04399ef5ff80492d70a55230694
3115Author: Damien Miller <djm@mindrot.org>
3116Date: Tue Jul 15 10:41:38 2014 +1000
3117
3118 - (djm) [configure.ac] Delay checks for arc4random* until after libcrypto
3119 has been located; fixes builds agains libressl-portable
3120
3121commit 1d0df3249c87019556b83306c28d4769375c2edc
3122Author: Damien Miller <djm@mindrot.org>
3123Date: Fri Jul 11 09:19:04 2014 +1000
3124
3125 - OpenBSD CVS Sync
3126 - benno@cvs.openbsd.org 2014/07/09 14:15:56
3127 [ssh-add.c]
3128 fix ssh-add crash while loading more than one key
3129 ok markus@
3130
3131commit 7a57eb3d105aa4ced15fb47001092c58811e6d9d
3132Author: Damien Miller <djm@mindrot.org>
3133Date: Wed Jul 9 13:22:31 2014 +1000
3134
3135 - djm@cvs.openbsd.org 2014/07/07 08:15:26
3136 [multiplex.sh]
3137 remove forced-fatal that I stuck in there to test the new cleanup
3138 logic and forgot to remove...
3139
3140commit 612f965239a30fe536b11ece1834d9f470aeb029
3141Author: Damien Miller <djm@mindrot.org>
3142Date: Wed Jul 9 13:22:03 2014 +1000
3143
3144 - djm@cvs.openbsd.org 2014/07/06 07:42:03
3145 [multiplex.sh test-exec.sh]
3146 add a hook to the cleanup() function to kill $SSH_PID if it is set
3147
3148 use it to kill the mux master started in multiplex.sh (it was being left
3149 around on fatal failures)
3150
3151commit d0bb950485ba121e43a77caf434115ed6417b46f
3152Author: Damien Miller <djm@mindrot.org>
3153Date: Wed Jul 9 13:07:28 2014 +1000
3154
3155 - djm@cvs.openbsd.org 2014/07/09 03:02:15
3156 [key.c]
3157 downgrade more error() to debug() to better match what old authfile.c
3158 did; suppresses spurious errors with hostbased authentication enabled
3159
3160commit 0070776a038655c57f57e70cd05e4c38a5de9d84
3161Author: Damien Miller <djm@mindrot.org>
3162Date: Wed Jul 9 13:07:06 2014 +1000
3163
3164 - djm@cvs.openbsd.org 2014/07/09 01:45:10
3165 [sftp.c]
3166 more useful error message when GLOB_NOSPACE occurs;
3167 bz#2254, patch from Orion Poplawski
3168
3169commit 079bac2a43c74ef7cf56850afbab3b1932534c50
3170Author: Damien Miller <djm@mindrot.org>
3171Date: Wed Jul 9 13:06:25 2014 +1000
3172
3173 - djm@cvs.openbsd.org 2014/07/07 08:19:12
3174 [ssh_config.5]
3175 mention that ProxyCommand is executed using shell "exec" to avoid
3176 a lingering process; bz#1977
3177
3178commit 3a48cc090096cf99b9de592deb5f90e444edebfb
3179Author: Damien Miller <djm@mindrot.org>
3180Date: Sun Jul 6 09:32:49 2014 +1000
3181
3182 - djm@cvs.openbsd.org 2014/07/05 23:11:48
3183 [channels.c]
3184 fix remote-forward cancel regression; ok markus@
3185
3186commit 48bae3a38cb578713e676708164f6e7151cc64fa
3187Author: Damien Miller <djm@mindrot.org>
3188Date: Sun Jul 6 09:27:06 2014 +1000
3189
3190 - djm@cvs.openbsd.org 2014/07/03 23:18:35
3191 [authfile.h]
3192 remove leakmalloc droppings
3193
3194commit 72e6b5c9ed5e72ca3a6ccc3177941b7c487a0826
3195Author: Damien Miller <djm@mindrot.org>
3196Date: Fri Jul 4 09:00:04 2014 +1000
3197
3198 - djm@cvs.openbsd.org 2014/07/03 22:40:43
3199 [servconf.c servconf.h session.c sshd.8 sshd_config.5]
3200 Add a sshd_config PermitUserRC option to control whether ~/.ssh/rc is
3201 executed, mirroring the no-user-rc authorized_keys option;
3202 bz#2160; ok markus@
3203
3204commit 602943d1179a08dfa70af94f62296ea5e3d6ebb8
3205Author: Damien Miller <djm@mindrot.org>
3206Date: Fri Jul 4 08:59:41 2014 +1000
3207
3208 - djm@cvs.openbsd.org 2014/07/03 22:33:41
3209 [channels.c]
3210 allow explicit ::1 and 127.0.0.1 forwarding bind addresses when
3211 GatewayPorts=no; allows client to choose address family;
3212 bz#2222 ok markus@
3213
3214commit 6b37fbb7921d156b31e2c8f39d9e1b6746c34983
3215Author: Damien Miller <djm@mindrot.org>
3216Date: Fri Jul 4 08:59:24 2014 +1000
3217
3218 - djm@cvs.openbsd.org 2014/07/03 22:23:46
3219 [sshconnect.c]
3220 when rekeying, skip file/DNS lookup if it is the same as the key sent
3221 during initial key exchange. bz#2154 patch from Iain Morgan; ok markus@
3222
3223commit d2c3cd5f2e47ee24cf7093ce8e948c2e79dfc3fd
3224Author: Damien Miller <djm@mindrot.org>
3225Date: Fri Jul 4 08:59:01 2014 +1000
3226
3227 - jsing@cvs.openbsd.org 2014/07/03 12:42:16
3228 [cipher-chachapoly.c]
3229 Call chacha_ivsetup() immediately before chacha_encrypt_bytes() - this
3230 makes it easier to verify that chacha_encrypt_bytes() is only called once
3231 per chacha_ivsetup() call.
3232 ok djm@
3233
3234commit 686feb560ec43a06ba04da82b50f3c183c947309
3235Author: Damien Miller <djm@mindrot.org>
3236Date: Thu Jul 3 21:29:38 2014 +1000
3237
3238 - djm@cvs.openbsd.org 2014/07/03 11:16:55
3239 [auth.c auth.h auth1.c auth2.c]
3240 make the "Too many authentication failures" message include the
3241 user, source address, port and protocol in a format similar to the
3242 authentication success / failure messages; bz#2199, ok dtucker
3243
3244commit 0f12341402e18fd9996ec23189b9418d2722453f
3245Author: Damien Miller <djm@mindrot.org>
3246Date: Thu Jul 3 21:28:09 2014 +1000
3247
3248 - jmc@cvs.openbsd.org 2014/07/03 07:45:27
3249 [ssh_config.5]
3250 escape %C since groff thinks it part of an Rs/Re block;
3251
3252commit 9c38643c5cd47a19db2cc28279dcc28abadc22b3
3253Author: Damien Miller <djm@mindrot.org>
3254Date: Thu Jul 3 21:27:46 2014 +1000
3255
3256 - djm@cvs.openbsd.org 2014/07/03 06:39:19
3257 [ssh.c ssh_config.5]
3258 Add a %C escape sequence for LocalCommand and ControlPath that expands
3259 to a unique identifer based on a has of the tuple of (local host,
3260 remote user, hostname, port).
3261
3262 Helps avoid exceeding sockaddr_un's miserly pathname limits for mux
3263 control paths.
3264
3265 bz#2220, based on patch from mancha1 AT zoho.com; ok markus@
3266
3267commit 49d9bfe2b2f3e90cc158a215dffa7675e57e7830
3268Author: Damien Miller <djm@mindrot.org>
3269Date: Thu Jul 3 21:26:42 2014 +1000
3270
3271 - djm@cvs.openbsd.org 2014/07/03 05:38:17
3272 [ssh.1]
3273 document that -g will only work in the multiplexed case if applied to
3274 the mux master
3275
3276commit ef9f13ba4c58057b2166d1f2e790535da402fbe5
3277Author: Damien Miller <djm@mindrot.org>
3278Date: Thu Jul 3 21:26:21 2014 +1000
3279
3280 - djm@cvs.openbsd.org 2014/07/03 05:32:36
3281 [ssh_config.5]
3282 mention '%%' escape sequence in HostName directives and how it may
3283 be used to specify IPv6 link-local addresses
3284
3285commit e6a407789e5432dd2e53336fb73476cc69048c54
3286Author: Damien Miller <djm@mindrot.org>
3287Date: Thu Jul 3 21:25:03 2014 +1000
3288
3289 - djm@cvs.openbsd.org 2014/07/03 04:36:45
3290 [digest.h]
3291 forward-declare struct sshbuf so consumers don't need to include sshbuf.h
3292
3293commit 4a1d3d50f02d0a8a4ef95ea4749293cbfb89f919
3294Author: Damien Miller <djm@mindrot.org>
3295Date: Thu Jul 3 21:24:40 2014 +1000
3296
3297 - djm@cvs.openbsd.org 2014/07/03 03:47:27
3298 [ssh-keygen.c]
3299 When hashing or removing hosts using ssh-keygen, don't choke on
3300 @revoked markers and don't remove @cert-authority markers;
3301 bz#2241, reported by mlindgren AT runelind.net
3302
3303commit e5c0d52ceb575c3db8c313e0b1aa3845943d7ba8
3304Author: Damien Miller <djm@mindrot.org>
3305Date: Thu Jul 3 21:24:19 2014 +1000
3306
3307 - djm@cvs.openbsd.org 2014/07/03 03:34:09
3308 [gss-serv.c session.c ssh-keygen.c]
3309 standardise on NI_MAXHOST for gethostname() string lengths; about
3310 1/2 the cases were using it already. Fixes bz#2239 en passant
3311
3312commit c174a3b7c14e0d178c61219de2aa1110e209950c
3313Author: Damien Miller <djm@mindrot.org>
3314Date: Thu Jul 3 21:23:24 2014 +1000
3315
3316 - djm@cvs.openbsd.org 2014/07/03 03:26:43
3317 [digest-openssl.c]
3318 use EVP_Digest() for one-shot hash instead of creating, updating,
3319 finalising and destroying a context.
3320 bz#2231, based on patch from Timo Teras
3321
3322commit d7ca2cd31ecc4d63a055e2dcc4bf35c13f2db4c5
3323Author: Damien Miller <djm@mindrot.org>
3324Date: Thu Jul 3 21:23:01 2014 +1000
3325
3326 - djm@cvs.openbsd.org 2014/07/03 03:15:01
3327 [ssh-add.c]
3328 make stdout line-buffered; saves partial output getting lost when
3329 ssh-add fatal()s part-way through (e.g. when listing keys from an
3330 agent that supports key types that ssh-add doesn't);
3331 bz#2234, reported by Phil Pennock
3332
3333commit b1e967c8d7c7578dd0c172d85b3046cf54ea42ba
3334Author: Damien Miller <djm@mindrot.org>
3335Date: Thu Jul 3 21:22:40 2014 +1000
3336
3337 - djm@cvs.openbsd.org 2014/07/03 03:11:03
3338 [ssh-agent.c]
3339 Only cleanup agent socket in the main agent process and not in any
3340 subprocesses it may have started (e.g. forked askpass). Fixes
3341 agent sockets being zapped when askpass processes fatal();
3342 bz#2236 patch from Dmitry V. Levin
3343
3344commit 61e28e55c3438d796b02ef878bcd28620d452670
3345Author: Damien Miller <djm@mindrot.org>
3346Date: Thu Jul 3 21:22:22 2014 +1000
3347
3348 - djm@cvs.openbsd.org 2014/07/03 01:45:38
3349 [sshkey.c]
3350 make Ed25519 keys' title fit properly in the randomart border; bz#2247
3351 based on patch from Christian Hesse
3352
3353commit 9eb4cd9a32c32d40d36450b68ed93badc6a94c68
3354Author: Damien Miller <djm@mindrot.org>
3355Date: Thu Jul 3 13:29:50 2014 +1000
3356
3357 - (djm) [monitor_fdpass.c] Use sys/poll.h if poll.h doesn't exist;
3358 bz#2237
3359
3360commit 8da0fa24934501909408327298097b1629b89eaa
3361Author: Damien Miller <djm@mindrot.org>
3362Date: Thu Jul 3 11:54:19 2014 +1000
3363
3364 - (djm) [digest-openssl.c configure.ac] Disable RIPEMD160 if libcrypto
3365 doesn't support it.
3366
3367commit 81309c857dd0dbc0a1245a16d621c490ad48cfbb
3368Author: Damien Miller <djm@mindrot.org>
3369Date: Wed Jul 2 17:45:55 2014 +1000
3370
3371 - (djm) [regress/Makefile] fix execution of sshkey unit/fuzz test
3372
3373commit 82b2482ce68654815ee049b9bf021bb362a35ff2
3374Author: Damien Miller <djm@mindrot.org>
3375Date: Wed Jul 2 17:43:41 2014 +1000
3376
3377 - (djm) [sshkey.c] Conditionalise inclusion of util.h
3378
3379commit dd8b1dd7933eb6f5652641b0cdced34a387f2e80
3380Author: Damien Miller <djm@mindrot.org>
3381Date: Wed Jul 2 17:38:31 2014 +1000
3382
3383 - djm@cvs.openbsd.org 2014/06/24 01:14:17
3384 [Makefile.in regress/Makefile regress/unittests/Makefile]
3385 [regress/unittests/sshkey/Makefile]
3386 [regress/unittests/sshkey/common.c]
3387 [regress/unittests/sshkey/common.h]
3388 [regress/unittests/sshkey/mktestdata.sh]
3389 [regress/unittests/sshkey/test_file.c]
3390 [regress/unittests/sshkey/test_fuzz.c]
3391 [regress/unittests/sshkey/test_sshkey.c]
3392 [regress/unittests/sshkey/tests.c]
3393 [regress/unittests/sshkey/testdata/dsa_1]
3394 [regress/unittests/sshkey/testdata/dsa_1-cert.fp]
3395 [regress/unittests/sshkey/testdata/dsa_1-cert.pub]
3396 [regress/unittests/sshkey/testdata/dsa_1.fp]
3397 [regress/unittests/sshkey/testdata/dsa_1.fp.bb]
3398 [regress/unittests/sshkey/testdata/dsa_1.param.g]
3399 [regress/unittests/sshkey/testdata/dsa_1.param.priv]
3400 [regress/unittests/sshkey/testdata/dsa_1.param.pub]
3401 [regress/unittests/sshkey/testdata/dsa_1.pub]
3402 [regress/unittests/sshkey/testdata/dsa_1_pw]
3403 [regress/unittests/sshkey/testdata/dsa_2]
3404 [regress/unittests/sshkey/testdata/dsa_2.fp]
3405 [regress/unittests/sshkey/testdata/dsa_2.fp.bb]
3406 [regress/unittests/sshkey/testdata/dsa_2.pub]
3407 [regress/unittests/sshkey/testdata/dsa_n]
3408 [regress/unittests/sshkey/testdata/dsa_n_pw]
3409 [regress/unittests/sshkey/testdata/ecdsa_1]
3410 [regress/unittests/sshkey/testdata/ecdsa_1-cert.fp]
3411 [regress/unittests/sshkey/testdata/ecdsa_1-cert.pub]
3412 [regress/unittests/sshkey/testdata/ecdsa_1.fp]
3413 [regress/unittests/sshkey/testdata/ecdsa_1.fp.bb]
3414 [regress/unittests/sshkey/testdata/ecdsa_1.param.curve]
3415 [regress/unittests/sshkey/testdata/ecdsa_1.param.priv]
3416 [regress/unittests/sshkey/testdata/ecdsa_1.param.pub]
3417 [regress/unittests/sshkey/testdata/ecdsa_1.pub]
3418 [regress/unittests/sshkey/testdata/ecdsa_1_pw]
3419 [regress/unittests/sshkey/testdata/ecdsa_2]
3420 [regress/unittests/sshkey/testdata/ecdsa_2.fp]
3421 [regress/unittests/sshkey/testdata/ecdsa_2.fp.bb]
3422 [regress/unittests/sshkey/testdata/ecdsa_2.param.curve]
3423 [regress/unittests/sshkey/testdata/ecdsa_2.param.priv]
3424 [regress/unittests/sshkey/testdata/ecdsa_2.param.pub]
3425 [regress/unittests/sshkey/testdata/ecdsa_2.pub]
3426 [regress/unittests/sshkey/testdata/ecdsa_n]
3427 [regress/unittests/sshkey/testdata/ecdsa_n_pw]
3428 [regress/unittests/sshkey/testdata/ed25519_1]
3429 [regress/unittests/sshkey/testdata/ed25519_1-cert.fp]
3430 [regress/unittests/sshkey/testdata/ed25519_1-cert.pub]
3431 [regress/unittests/sshkey/testdata/ed25519_1.fp]
3432 [regress/unittests/sshkey/testdata/ed25519_1.fp.bb]
3433 [regress/unittests/sshkey/testdata/ed25519_1.pub]
3434 [regress/unittests/sshkey/testdata/ed25519_1_pw]
3435 [regress/unittests/sshkey/testdata/ed25519_2]
3436 [regress/unittests/sshkey/testdata/ed25519_2.fp]
3437 [regress/unittests/sshkey/testdata/ed25519_2.fp.bb]
3438 [regress/unittests/sshkey/testdata/ed25519_2.pub]
3439 [regress/unittests/sshkey/testdata/pw]
3440 [regress/unittests/sshkey/testdata/rsa1_1]
3441 [regress/unittests/sshkey/testdata/rsa1_1.fp]
3442 [regress/unittests/sshkey/testdata/rsa1_1.fp.bb]
3443 [regress/unittests/sshkey/testdata/rsa1_1.param.n]
3444 [regress/unittests/sshkey/testdata/rsa1_1.pub]
3445 [regress/unittests/sshkey/testdata/rsa1_1_pw]
3446 [regress/unittests/sshkey/testdata/rsa1_2]
3447 [regress/unittests/sshkey/testdata/rsa1_2.fp]
3448 [regress/unittests/sshkey/testdata/rsa1_2.fp.bb]
3449 [regress/unittests/sshkey/testdata/rsa1_2.param.n]
3450 [regress/unittests/sshkey/testdata/rsa1_2.pub]
3451 [regress/unittests/sshkey/testdata/rsa_1]
3452 [regress/unittests/sshkey/testdata/rsa_1-cert.fp]
3453 [regress/unittests/sshkey/testdata/rsa_1-cert.pub]
3454 [regress/unittests/sshkey/testdata/rsa_1.fp]
3455 [regress/unittests/sshkey/testdata/rsa_1.fp.bb]
3456 [regress/unittests/sshkey/testdata/rsa_1.param.n]
3457 [regress/unittests/sshkey/testdata/rsa_1.param.p]
3458 [regress/unittests/sshkey/testdata/rsa_1.param.q]
3459 [regress/unittests/sshkey/testdata/rsa_1.pub]
3460 [regress/unittests/sshkey/testdata/rsa_1_pw]
3461 [regress/unittests/sshkey/testdata/rsa_2]
3462 [regress/unittests/sshkey/testdata/rsa_2.fp]
3463 [regress/unittests/sshkey/testdata/rsa_2.fp.bb]
3464 [regress/unittests/sshkey/testdata/rsa_2.param.n]
3465 [regress/unittests/sshkey/testdata/rsa_2.param.p]
3466 [regress/unittests/sshkey/testdata/rsa_2.param.q]
3467 [regress/unittests/sshkey/testdata/rsa_2.pub]
3468 [regress/unittests/sshkey/testdata/rsa_n]
3469 [regress/unittests/sshkey/testdata/rsa_n_pw]
3470 unit and fuzz tests for new key API
3471
3472commit c1dc24b71f087f385b92652b9673f52af64e0428
3473Author: Damien Miller <djm@mindrot.org>
3474Date: Wed Jul 2 17:02:03 2014 +1000
3475
3476 - djm@cvs.openbsd.org 2014/06/24 01:04:43
3477 [regress/krl.sh]
3478 regress test for broken consecutive revoked serial number ranges
3479
3480commit 43d3ed2dd3feca6d0326c7dc82588d2faa115e92
3481Author: Damien Miller <djm@mindrot.org>
3482Date: Wed Jul 2 17:01:08 2014 +1000
3483
3484 - djm@cvs.openbsd.org 2014/05/21 07:04:21
3485 [regress/integrity.sh]
3486 when failing because of unexpected output, show the offending output
3487
3488commit 5a96707ffc8d227c2e7d94fa6b0317f8a152cf4e
3489Author: Damien Miller <djm@mindrot.org>
3490Date: Wed Jul 2 15:38:05 2014 +1000
3491
3492 - djm@cvs.openbsd.org 2014/04/30 05:32:00
3493 [regress/Makefile]
3494 unit tests for new buffer API; including basic fuzz testing
3495 NB. Id sync only.
3496
3497commit 3ff92ba756aee48e4ae3e0aeff7293517b3dd185
3498Author: Damien Miller <djm@mindrot.org>
3499Date: Wed Jul 2 15:33:09 2014 +1000
3500
3501 - djm@cvs.openbsd.org 2014/06/30 12:54:39
3502 [key.c]
3503 suppress spurious error message when loading key with a passphrase;
3504 reported by kettenis@ ok markus@
3505 - djm@cvs.openbsd.org 2014/07/02 04:59:06
3506 [cipher-3des1.c]
3507 fix ssh protocol 1 on the server that regressed with the sshkey change
3508 (sometimes fatal() after auth completed), make file return useful status
3509 codes.
3510 NB. Id sync only for these two. They were bundled into the sshkey merge
3511 above, since it was easier to sync the entire file and then apply
3512 portable-specific changed atop it.
3513
3514commit ec3d0e24a1e46873d80507f5cd8ee6d0d03ac5dc
3515Author: Damien Miller <djm@mindrot.org>
3516Date: Wed Jul 2 15:30:00 2014 +1000
3517
3518 - markus@cvs.openbsd.org 2014/06/27 18:50:39
3519 [ssh-add.c]
3520 fix loading of private keys
3521
3522commit 4b3ed647d5b328cf68e6a8ffbee490d8e0683e82
3523Author: Damien Miller <djm@mindrot.org>
3524Date: Wed Jul 2 15:29:40 2014 +1000
3525
3526 - markus@cvs.openbsd.org 2014/06/27 16:41:56
3527 [channels.c channels.h clientloop.c ssh.c]
3528 fix remote fwding with same listen port but different listen address
3529 with gerhard@, ok djm@
3530
3531commit 9e01ff28664921ce9b6500681333e42fb133b4d0
3532Author: Damien Miller <djm@mindrot.org>
3533Date: Wed Jul 2 15:29:21 2014 +1000
3534
3535 - deraadt@cvs.openbsd.org 2014/06/25 14:16:09
3536 [sshbuf.c]
3537 unblock SIGSEGV before raising it
3538 ok djm
3539
3540commit 1845fe6bda0729e52f4c645137f4fc3070b5438a
3541Author: Damien Miller <djm@mindrot.org>
3542Date: Wed Jul 2 15:29:01 2014 +1000
3543
3544 - djm@cvs.openbsd.org 2014/06/24 02:21:01
3545 [scp.c]
3546 when copying local->remote fails during read, don't send uninitialised
3547 heap to the remote end. Reported by Jann Horn
3548
3549commit 19439e9a2a0ac0b4b3b1210e89695418beb1c883
3550Author: Damien Miller <djm@mindrot.org>
3551Date: Wed Jul 2 15:28:40 2014 +1000
3552
3553 - djm@cvs.openbsd.org 2014/06/24 02:19:48
3554 [ssh.c]
3555 don't fatal() when hostname canonicalisation fails with a
3556 ProxyCommand in use; continue and allow the ProxyCommand to
3557 connect anyway (e.g. to a host with a name outside the DNS
3558 behind a bastion)
3559
3560commit 8668706d0f52654fe64c0ca41a96113aeab8d2b8
3561Author: Damien Miller <djm@mindrot.org>
3562Date: Wed Jul 2 15:28:02 2014 +1000
3563
3564 - djm@cvs.openbsd.org 2014/06/24 01:13:21
3565 [Makefile.in auth-bsdauth.c auth-chall.c auth-options.c auth-rsa.c
3566 [auth2-none.c auth2-pubkey.c authfile.c authfile.h cipher-3des1.c
3567 [cipher-chachapoly.c cipher-chachapoly.h cipher.c cipher.h
3568 [digest-libc.c digest-openssl.c digest.h dns.c entropy.c hmac.h
3569 [hostfile.c key.c key.h krl.c monitor.c packet.c rsa.c rsa.h
3570 [ssh-add.c ssh-agent.c ssh-dss.c ssh-ecdsa.c ssh-ed25519.c
3571 [ssh-keygen.c ssh-pkcs11-client.c ssh-pkcs11-helper.c ssh-pkcs11.c
3572 [ssh-rsa.c sshbuf-misc.c sshbuf.h sshconnect.c sshconnect1.c
3573 [sshconnect2.c sshd.c sshkey.c sshkey.h
3574 [openbsd-compat/openssl-compat.c openbsd-compat/openssl-compat.h]
3575 New key API: refactor key-related functions to be more library-like,
3576 existing API is offered as a set of wrappers.
3577
3578 with and ok markus@
3579
3580 Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
3581 Dempsky and Ron Bowes for a detailed review a few months ago.
3582
3583 NB. This commit also removes portable OpenSSH support for OpenSSL
3584 <0.9.8e.
3585
3586commit 2cd7929250cf9e9f658d70dcd452f529ba08c942
3587Author: Damien Miller <djm@mindrot.org>
3588Date: Wed Jul 2 12:48:30 2014 +1000
3589
3590 - djm@cvs.openbsd.org 2014/06/24 00:52:02
3591 [krl.c]
3592 fix bug in KRL generation: multiple consecutive revoked certificate
3593 serial number ranges could be serialised to an invalid format.
3594
3595 Readers of a broken KRL caused by this bug will fail closed, so no
3596 should-have-been-revoked key will be accepted.
3597
3598commit 99db840ee8dbbd2b3fbc6c45d0ee2f6a65e96898
3599Author: Damien Miller <djm@mindrot.org>
3600Date: Wed Jul 2 12:48:04 2014 +1000
3601
3602 - naddy@cvs.openbsd.org 2014/06/18 15:42:09
3603 [sshbuf-getput-crypto.c]
3604 The ssh_get_bignum functions must accept the same range of bignums
3605 the corresponding ssh_put_bignum functions create. This fixes the
3606 use of 16384-bit RSA keys (bug reported by Eivind Evensen).
3607 ok djm@
3608
3609commit 84a89161a9629239b64171ef3e22ef6a3e462d51
3610Author: Damien Miller <djm@mindrot.org>
3611Date: Wed Jul 2 12:47:48 2014 +1000
3612
3613 - matthew@cvs.openbsd.org 2014/06/18 02:59:13
3614 [sandbox-systrace.c]
3615 Now that we have a dedicated getentropy(2) system call for
3616 arc4random(3), we can disallow __sysctl(2) in OpenSSH's systrace
3617 sandbox.
3618
3619 ok djm
3620
3621commit 51504ceec627c0ad57b9f75585c7b3d277f326be
3622Author: Damien Miller <djm@mindrot.org>
3623Date: Wed Jul 2 12:47:25 2014 +1000
3624
3625 - deraadt@cvs.openbsd.org 2014/06/13 08:26:29
3626 [sandbox-systrace.c]
3627 permit SYS_getentropy
3628 from matthew
3629
3630commit a261b8df59117f7dc52abb3a34b35a40c2c9fa88
3631Author: Tim Rice <tim@multitalents.net>
3632Date: Wed Jun 18 16:17:28 2014 -0700
3633
3634 - (tim) [openssh/session.c] Work around to get chroot sftp working on UnixWare
3635
3636commit 316fac6f18f87262a315c79bcf68b9f92c9337e4
3637Author: Darren Tucker <dtucker@zip.com.au>
3638Date: Tue Jun 17 23:06:07 2014 +1000
3639
3640 - (dtucker) [entropy.c openbsd-compat/openssl-compat.{c,h}
3641 openbsd-compat/regress/{.cvsignore,Makefile.in,opensslvertest.c}]
3642 Move the OpenSSL header/library version test into its own function and add
3643 tests for it. Fix it to allow fix version upgrades (but not downgrades).
3644 Prompted by chl@ via OpenSMTPD (issue #462) and Debian (bug #748150).
3645 ok djm@ chl@
3646
3647commit af665bb7b092a59104db1e65577851cf35b86e32
3648Author: Darren Tucker <dtucker@zip.com.au>
3649Date: Mon Jun 16 22:50:55 2014 +1000
3650
3651 - (dtucker) [defines.h] Fix undef of _PATH_MAILDIR. From rak at debian via
3652 OpenSMTPD and chl@
3653
3654commit f9696566fb41320820f3b257ab564fa321bb3751
3655Author: Darren Tucker <dtucker@zip.com.au>
3656Date: Fri Jun 13 11:06:04 2014 +1000
3657
3658 - (dtucker) [configure.ac] Remove tcpwrappers support, support has already
3659 been removed from sshd.c.
3660
3661commit 5e2b8894b0b24af4ad0a2f7aa33ebf255df7a8bc
3662Author: Tim Rice <tim@multitalents.net>
3663Date: Wed Jun 11 18:31:10 2014 -0700
3664
3665 - (tim) [regress/unittests/test_helper/test_helper.h] Add includes.h for
3666 u_intXX_t types.
3667
3668commit 985ee2cbc3e43bc65827c3c0d4df3faa99160c37
3669Author: Darren Tucker <dtucker@zip.com.au>
3670Date: Thu Jun 12 05:32:29 2014 +1000
3671
3672 - (dtucker) [regress/unittests/sshbuf/*.c regress/unittests/test_helper/*]
3673 Wrap stdlib.h include an ifdef for platforms that don't have it.
3674
3675commit cf5392c2db2bb1dbef9818511d34056404436109
3676Author: Darren Tucker <dtucker@zip.com.au>
3677Date: Thu Jun 12 05:22:49 2014 +1000
3678
3679 - (dtucker) [defines.h] Add va_copy if we don't already have it, taken from
3680 openbsd-compat/bsd-asprintf.c.
3681
3682commit 58538d795e0b662f2f4e5a7193f1204bbe992ddd
3683Author: Darren Tucker <dtucker@zip.com.au>
3684Date: Wed Jun 11 13:39:24 2014 +1000
3685
3686 - (dtucker) [bufaux.c bufbn.c bufec.c buffer.c] Pull in includes.h for
3687 compat stuff, specifically whether or not OpenSSL has ECC.
3688
3689commit eb012ac581fd0abc16ee86ee3a68cf07c8ce4d08
3690Author: Darren Tucker <dtucker@zip.com.au>
3691Date: Wed Jun 11 13:10:00 2014 +1000
3692
3693 - (dtucker) [openbsd-compat/arc4random.c] Use explicit_bzero instead of an
3694 assigment that might get optimized out. ok djm@
3695
3696commit b9609fd86c623d6d440e630f5f9a63295f7aea20
3697Author: Darren Tucker <dtucker@zip.com.au>
3698Date: Wed Jun 11 08:04:02 2014 +1000
3699
3700 - (dtucker) [sshbuf.h] Only declare ECC functions if building without
3701 OpenSSL or if OpenSSL has ECC.
3702
3703commit a54a040f66944c6e8913df8635a01a2327219be9
3704Author: Darren Tucker <dtucker@zip.com.au>
3705Date: Wed Jun 11 07:58:35 2014 +1000
3706
3707 - dtucker@cvs.openbsd.org 2014/06/10 21:46:11
3708 [sshbuf.h]
3709 Group ECC functions together to make things a little easier in -portable.
3710 "doesn't bother me" deraadt@
3711
3712commit 9f92c53bad04a89067756be8198d4ec2d8a08875
3713Author: Darren Tucker <dtucker@zip.com.au>
3714Date: Wed Jun 11 07:57:58 2014 +1000
3715
3716 - djm@cvs.openbsd.org 2014/06/05 22:17:50
3717 [sshconnect2.c]
3718 fix inverted test that caused PKCS#11 keys that were explicitly listed
3719 not to be preferred. Reported by Dirk-Willem van Gulik
3720
3721commit 15c254a25394f96643da2ad0f674acdc51e89856
3722Author: Darren Tucker <dtucker@zip.com.au>
3723Date: Wed Jun 11 07:38:49 2014 +1000
3724
3725 - (dtucker) [regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c] ifdef
3726 ECC variable too.
3727
3728commit d7af0cc5bf273eeed0897a99420bc26841d07d8f
3729Author: Darren Tucker <dtucker@zip.com.au>
3730Date: Wed Jun 11 07:37:25 2014 +1000
3731
3732 - (dtucker) [myprosal.h] Don't include curve25519-sha256@libssh.org in
3733 the proposal if the version of OpenSSL we're using doesn't support ECC.
3734
3735commit 67508ac2563c33d582be181a3e777c65f549d22f
3736Author: Darren Tucker <dtucker@zip.com.au>
3737Date: Wed Jun 11 06:27:16 2014 +1000
3738
3739 - (dtucker) [regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
3740 regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c] Only do NISTP256
3741 curve tests if OpenSSL has them.
3742
3743commit 6482d90a65459a88c18c925368525855832272b3
3744Author: Damien Miller <djm@mindrot.org>
3745Date: Tue May 27 14:34:42 2014 +1000
3746
3747 - (djm) [configure.ac openbsd-compat/bsd-cygwin_util.c]
3748 [openbsd-compat/bsd-cygwin_util.h] On Cygwin, determine privilege
3749 separation user at runtime, since it may need to be a domain account.
3750 Patch from Corinna Vinschen.
3751
3752commit f9eb5e0734f7a7f6e975809eb54684d2a06a7ffc
3753Author: Damien Miller <djm@mindrot.org>
3754Date: Tue May 27 14:31:58 2014 +1000
3755
3756 - (djm) [contrib/cygwin/ssh-host-config] Updated Cygwin ssh-host-config
3757 from Corinna Vinschen, fixing a number of bugs and preparing for
3758 Cygwin 1.7.30.
3759
3760commit eae88744662e6b149f43ef071657727f1a157d95
3761Author: Damien Miller <djm@mindrot.org>
3762Date: Tue May 27 14:27:02 2014 +1000
3763
3764 - (djm) [cipher.c] Fix merge botch.
3765
3766commit 564b5e253c1d95c26a00e8288f0089a2571661c3
3767Author: Damien Miller <djm@mindrot.org>
3768Date: Thu May 22 08:23:59 2014 +1000
3769
3770 - (djm) [Makefile.in] typo in path
3771
3772commit e84d10302aeaf7a1acb05c451f8718143656856a
3773Author: Damien Miller <djm@mindrot.org>
3774Date: Wed May 21 17:13:36 2014 +1000
3775
3776 revert a diff I didn't mean to commit
3777
3778commit 795b86313f1f1aab9691666c4f2d5dae6e4acd50
3779Author: Damien Miller <djm@mindrot.org>
3780Date: Wed May 21 17:12:53 2014 +1000
3781
3782 - (djm) [misc.c] Use CLOCK_BOOTTIME in preference to CLOCK_MONOTONIC
3783 when it is available. It takes into account time spent suspended,
3784 thereby ensuring timeouts (e.g. for expiring agent keys) fire
3785 correctly. bz#2228 reported by John Haxby
3786
3787commit 18912775cb97c0b1e75e838d3c7d4b56648137b5
3788Author: Damien Miller <djm@mindrot.org>
3789Date: Wed May 21 17:06:46 2014 +1000
3790
3791 - (djm) [commit configure.ac defines.h sshpty.c] don't attempt to use
3792 vhangup on Linux. It doens't work for non-root users, and for them
3793 it just messes up the tty settings.
3794
3795commit 7f1c264d3049cd95234e91970ccb5406e1d15b27
3796Author: Damien Miller <djm@mindrot.org>
3797Date: Thu May 15 18:01:52 2014 +1000
3798
3799 - (djm) [sshbuf.c] need __predict_false
3800
3801commit e7429f2be8643e1100380a8a7389d85cc286c8fe
3802Author: Damien Miller <djm@mindrot.org>
3803Date: Thu May 15 18:01:01 2014 +1000
3804
3805 - (djm) [regress/Makefile Makefile.in]
3806 [regress/unittests/sshbuf/test_sshbuf.c
3807 [regress/unittests/sshbuf/test_sshbuf_fixed.c]
3808 [regress/unittests/sshbuf/test_sshbuf_fuzz.c]
3809 [regress/unittests/sshbuf/test_sshbuf_getput_basic.c]
3810 [regress/unittests/sshbuf/test_sshbuf_getput_crypto.c]
3811 [regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c]
3812 [regress/unittests/sshbuf/test_sshbuf_misc.c]
3813 [regress/unittests/sshbuf/tests.c]
3814 [regress/unittests/test_helper/fuzz.c]
3815 [regress/unittests/test_helper/test_helper.c]
3816 Hook new unit tests into the build and "make tests"
3817
3818commit def1de086707b0e6b046fe7e115c60aca0227a99
3819Author: Damien Miller <djm@mindrot.org>
3820Date: Thu May 15 15:17:15 2014 +1000
3821
3822 - (djm) [regress/unittests/Makefile]
3823 [regress/unittests/Makefile.inc]
3824 [regress/unittests/sshbuf/Makefile]
3825 [regress/unittests/sshbuf/test_sshbuf.c]
3826 [regress/unittests/sshbuf/test_sshbuf_fixed.c]
3827 [regress/unittests/sshbuf/test_sshbuf_fuzz.c]
3828 [regress/unittests/sshbuf/test_sshbuf_getput_basic.c]
3829 [regress/unittests/sshbuf/test_sshbuf_getput_crypto.c]
3830 [regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c]
3831 [regress/unittests/sshbuf/test_sshbuf_misc.c]
3832 [regress/unittests/sshbuf/tests.c]
3833 [regress/unittests/test_helper/Makefile]
3834 [regress/unittests/test_helper/fuzz.c]
3835 [regress/unittests/test_helper/test_helper.c]
3836 [regress/unittests/test_helper/test_helper.h]
3837 Import new unit tests from OpenBSD; not yet hooked up to build.
3838
3839commit 167685756fde8bc213a8df2c8e1848e312db0f46
3840Author: Damien Miller <djm@mindrot.org>
3841Date: Thu May 15 15:08:40 2014 +1000
3842
3843 - logan@cvs.openbsd.org 2014/05/04 10:40:59
3844 [connect-privsep.sh]
3845 Remove the Z flag from the list of malloc options as it
3846 was removed from malloc.c 10 days ago.
3847
3848 OK from miod@
3849
3850commit d0b69fe90466920d69c96069312e24b581771bd7
3851Author: Damien Miller <djm@mindrot.org>
3852Date: Thu May 15 15:08:19 2014 +1000
3853
3854 - dtucker@cvs.openbsd.org 2014/05/03 18:46:14
3855 [proxy-connect.sh]
3856 Add tests for with and without compression, with and without privsep.
3857
3858commit edb1af50441d19fb2dd9ccb4d75bf14473fca584
3859Author: Damien Miller <djm@mindrot.org>
3860Date: Thu May 15 15:07:53 2014 +1000
3861
3862 - djm@cvs.openbsd.org 2014/04/21 22:15:37
3863 [dhgex.sh integrity.sh kextype.sh rekey.sh try-ciphers.sh]
3864 repair regress tests broken by server-side default cipher/kex/mac changes
3865 by ensuring that the option under test is included in the server's
3866 algorithm list
3867
3868commit 54343e95c70994695f8842fb22836321350198d3
3869Author: Damien Miller <djm@mindrot.org>
3870Date: Thu May 15 15:07:33 2014 +1000
3871
3872 - djm@cvs.openbsd.org 2014/03/13 20:44:49
3873 [login-timeout.sh]
3874 this test is a sorry mess of race conditions; add another sleep
3875 to avoid a failure on slow machines (at least until I find a
3876 better way)
3877
3878commit e5b9f0f2ee6e133894307e44e862b66426990733
3879Author: Damien Miller <djm@mindrot.org>
3880Date: Thu May 15 14:58:07 2014 +1000
3881
3882 - (djm) [Makefile.in configure.ac sshbuf-getput-basic.c]
3883 [sshbuf-getput-crypto.c sshbuf.c] compilation and portability fixes
3884
3885commit b9c566788a9ebd6a9d466f47a532124f111f0542
3886Author: Damien Miller <djm@mindrot.org>
3887Date: Thu May 15 14:43:37 2014 +1000
3888
3889 - (djm) [configure.ac] Unconditionally define WITH_OPENSSL until we write
3890 portability glue to support building without libcrypto
3891
3892commit 3dc27178b42234b653a32f7a87292d7994045ee3
3893Author: Damien Miller <djm@mindrot.org>
3894Date: Thu May 15 14:37:59 2014 +1000
3895
3896 - logan@cvs.openbsd.org 2014/05/05 07:02:30
3897 [sftp.c]
3898 Zap extra whitespace.
3899
3900 OK from djm@ and dtucker@
3901
3902commit c31a0cd5b31961f01c5b731f62a6cb9d4f767472
3903Author: Damien Miller <djm@mindrot.org>
3904Date: Thu May 15 14:37:39 2014 +1000
3905
3906 - markus@cvs.openbsd.org 2014/05/03 17:20:34
3907 [monitor.c packet.c packet.h]
3908 unbreak compression, by re-init-ing the compression code in the
3909 post-auth child. the new buffer code is more strict, and requires
3910 buffer_init() while the old code was happy after a bzero();
3911 originally from djm@
3912
3913commit 686c7d9ee6f44b2be4128d7860b6b37adaeba733
3914Author: Damien Miller <djm@mindrot.org>
3915Date: Thu May 15 14:37:03 2014 +1000
3916
3917 - djm@cvs.openbsd.org 2014/05/02 03:27:54
3918 [chacha.h cipher-chachapoly.h digest.h hmac.h kex.h kexc25519.c]
3919 [misc.h poly1305.h ssh-pkcs11.c defines.h]
3920 revert __bounded change; it causes way more problems for portable than
3921 it solves; pointed out by dtucker@
3922
3923commit 294c58a007cfb2f3bddc4fc3217e255857ffb9bf
3924Author: Damien Miller <djm@mindrot.org>
3925Date: Thu May 15 14:35:03 2014 +1000
3926
3927 - naddy@cvs.openbsd.org 2014/04/30 19:07:48
3928 [mac.c myproposal.h umac.c]
3929 UMAC can use our local fallback implementation of AES when OpenSSL isn't
3930 available. Glue code straight from Ted Krovetz's original umac.c.
3931 ok markus@
3932
3933commit 05e82c3b963c33048128baf72a6f6b3a1c10b4c1
3934Author: Damien Miller <djm@mindrot.org>
3935Date: Thu May 15 14:33:43 2014 +1000
3936
3937 - djm@cvs.openbsd.org 2014/04/30 05:29:56
3938 [bufaux.c bufbn.c bufec.c buffer.c buffer.h sshbuf-getput-basic.c]
3939 [sshbuf-getput-crypto.c sshbuf-misc.c sshbuf.c sshbuf.h ssherr.c]
3940 [ssherr.h]
3941 New buffer API; the first installment of the conversion/replacement
3942 of OpenSSH's internals to make them usable as a standalone library.
3943
3944 This includes a set of wrappers to make it compatible with the
3945 existing buffer API so replacement can occur incrementally.
3946
3947 With and ok markus@
3948
3949 Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
3950 Dempsky and Ron Bowes for a detailed review.
3951
3952commit 380948180f847a26f2d0c85b4dad3dca2ed2fd8b
3953Author: Damien Miller <djm@mindrot.org>
3954Date: Thu May 15 14:25:18 2014 +1000
3955
3956 - dtucker@cvs.openbsd.org 2014/04/29 20:36:51
3957 [sftp.c]
3958 Don't attempt to append a nul quote char to the filename. Should prevent
3959 fatal'ing with "el_insertstr failed" when there's a single quote char
3960 somewhere in the string. bz#2238, ok markus@
3961
3962commit d7fd8bedd4619a2ec7fd02aae4c4e1db4431ad9f
3963Author: Damien Miller <djm@mindrot.org>
3964Date: Thu May 15 14:24:59 2014 +1000
3965
3966 - dtucker@cvs.openbsd.org 2014/04/29 19:58:50
3967 [sftp.c]
3968 Move nulling of variable next to where it's freed. ok markus@
3969
3970commit 1f0311c7c7d10c94ff7f823de9c5b2ed79368b14
3971Author: Damien Miller <djm@mindrot.org>
3972Date: Thu May 15 14:24:09 2014 +1000
3973
3974 - markus@cvs.openbsd.org 2014/04/29 18:01:49
3975 [auth.c authfd.c authfile.c bufaux.c cipher.c cipher.h hostfile.c]
3976 [kex.c key.c mac.c monitor.c monitor_wrap.c myproposal.h packet.c]
3977 [roaming_client.c ssh-agent.c ssh-keygen.c ssh-keyscan.c ssh-keysign.c]
3978 [ssh-pkcs11.h ssh.c sshconnect.c sshconnect2.c sshd.c]
3979 make compiling against OpenSSL optional (make OPENSSL=no);
3980 reduces algorithms to curve25519, aes-ctr, chacha, ed25519;
3981 allows us to explore further options; with and ok djm
3982
3983commit c5893785564498cea73cb60d2cf199490483e080
3984Author: Damien Miller <djm@mindrot.org>
3985Date: Thu May 15 13:48:49 2014 +1000
3986
3987 - djm@cvs.openbsd.org 2014/04/29 13:10:30
3988 [clientloop.c serverloop.c]
3989 bz#1818 - don't send channel success/failre replies on channels that
3990 have sent a close already; analysis and patch from Simon Tatham;
3991 ok markus@
3992
3993commit 633de33b192d808d87537834c316dc8b75fe1880
3994Author: Damien Miller <djm@mindrot.org>
3995Date: Thu May 15 13:48:26 2014 +1000
3996
3997 - djm@cvs.openbsd.org 2014/04/28 03:09:18
3998 [authfile.c bufaux.c buffer.h channels.c krl.c mux.c packet.c packet.h]
3999 [ssh-keygen.c]
4000 buffer_get_string_ptr's return should be const to remind
4001 callers that futzing with it will futz with the actual buffer
4002 contents
4003
4004commit 15271907843e4ae50dcfc83b3594014cf5e9607b
4005Author: Damien Miller <djm@mindrot.org>
4006Date: Thu May 15 13:47:56 2014 +1000
4007
4008 - djm@cvs.openbsd.org 2014/04/23 12:42:34
4009 [readconf.c]
4010 don't record duplicate IdentityFiles
4011
4012commit 798a02568b13a2e46efebd81f08c8f4bb33a6dc7
4013Author: Damien Miller <djm@mindrot.org>
4014Date: Thu May 15 13:47:37 2014 +1000
4015
4016 - jmc@cvs.openbsd.org 2014/04/22 14:16:30
4017 [sftp.1]
4018 zap eol whitespace;
4019
4020commit d875ff78d2b8436807381051de112f0ebf9b9ae1
4021Author: Damien Miller <djm@mindrot.org>
4022Date: Thu May 15 13:47:15 2014 +1000
4023
4024 - logan@cvs.openbsd.org 2014/04/22 12:42:04
4025 [sftp.1]
4026 Document sftp upload resume.
4027 OK from djm@, with feedback from okan@.
4028
4029commit b15cd7bb097fd80dc99520f45290ef775da1ef19
4030Author: Damien Miller <djm@mindrot.org>
4031Date: Thu May 15 13:46:52 2014 +1000
4032
4033 - logan@cvs.openbsd.org 2014/04/22 10:07:12
4034 [sftp.c]
4035 Sort the sftp command list.
4036 OK from djm@
4037
4038commit d8accc0aa72656ba63d50937165c5ae49db1dcd6
4039Author: Damien Miller <djm@mindrot.org>
4040Date: Thu May 15 13:46:25 2014 +1000
4041
4042 - logan@cvs.openbsd.org 2014/04/21 14:36:16
4043 [sftp-client.c sftp-client.h sftp.c]
4044 Implement sftp upload resume support.
4045 OK from djm@, with input from guenther@, mlarkin@ and
4046 okan@
4047
4048commit 16cd3928a87d20c77b13592a74b60b08621d3ce6
4049Author: Damien Miller <djm@mindrot.org>
4050Date: Thu May 15 13:45:58 2014 +1000
4051
4052 - logan@cvs.openbsd.org 2014/04/20 09:24:26
4053 [dns.c dns.h ssh-keygen.c]
4054 Add support for SSHFP DNS records for ED25519 key types.
4055 OK from djm@
4056
4057commit ec0b67eb3b4e12f296ced1fafa01860c374f7eea
4058Author: Damien Miller <djm@mindrot.org>
4059Date: Thu May 15 13:45:26 2014 +1000
4060
4061 - (djm) [rijndael.c rijndael.h] Sync with newly-ressurected versions ine
4062 OpenBSD
4063
4064commit f028460d0b2e5a584355321015cde69bf6fd933e
4065Author: Darren Tucker <dtucker@zip.com.au>
4066Date: Thu May 1 02:24:35 2014 +1000
4067
4068 - (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already
4069 have it. Only attempt to use __attribute__(__bounded__) for gcc.
4070
4071commit b628cc4c3e4a842bab5e4584d18c2bc5fa4d0edf
4072Author: Damien Miller <djm@mindrot.org>
4073Date: Sun Apr 20 13:33:58 2014 +1000
4074
4075 - djm@cvs.openbsd.org 2014/04/20 02:49:32
4076 [compat.c]
4077 add a canonical 6.6 + curve25519 bignum fix fake version that I can
4078 recommend people use ahead of the openssh-6.7 release
4079
4080commit 888566913933a802f3a329ace123ebcb7154cf78
4081Author: Damien Miller <djm@mindrot.org>
4082Date: Sun Apr 20 13:33:19 2014 +1000
4083
4084 - djm@cvs.openbsd.org 2014/04/20 02:30:25
4085 [misc.c misc.h umac.c]
4086 use get/put_u32 to load values rather than *((UINT32 *)p) that breaks on
4087 strict-alignment architectures; reported by and ok stsp@
4088
4089commit 16f85cbc7e5139950e6a38317e7c8b368beafa5d
4090Author: Damien Miller <djm@mindrot.org>
4091Date: Sun Apr 20 13:29:28 2014 +1000
4092
4093 - tedu@cvs.openbsd.org 2014/04/19 18:42:19
4094 [ssh.1]
4095 delete .xr to hosts.equiv. there's still an unfortunate amount of
4096 documentation referring to rhosts equivalency in here.
4097
4098commit 69cb24b7356ec3f0fc5ff04a68f98f2c55c766f4
4099Author: Damien Miller <djm@mindrot.org>
4100Date: Sun Apr 20 13:29:06 2014 +1000
4101
4102 - tedu@cvs.openbsd.org 2014/04/19 18:15:16
4103 [sshd.8]
4104 remove some really old rsh references
4105
4106commit 84c1e7bca8c4ceaccf4d5557e39a833585a3c77e
4107Author: Damien Miller <djm@mindrot.org>
4108Date: Sun Apr 20 13:27:53 2014 +1000
4109
4110 - tedu@cvs.openbsd.org 2014/04/19 14:53:48
4111 [ssh-keysign.c sshd.c]
4112 Delete futile calls to RAND_seed. ok djm
4113 NB. Id sync only. This only applies to OpenBSD's libcrypto slashathon
4114
4115commit 0e6b67423b8662f9ca4c92750309e144fd637ef1
4116Author: Damien Miller <djm@mindrot.org>
4117Date: Sun Apr 20 13:27:01 2014 +1000
4118
4119 - djm@cvs.openbsd.org 2014/04/19 05:54:59
4120 [compat.c]
4121 missing wildcard; pointed out by naddy@
4122
4123commit 9395b28223334826837c15e8c1bb4dfb3b0d2ca5
4124Author: Damien Miller <djm@mindrot.org>
4125Date: Sun Apr 20 13:25:30 2014 +1000
4126
4127 - djm@cvs.openbsd.org 2014/04/18 23:52:25
4128 [compat.c compat.h sshconnect2.c sshd.c version.h]
4129 OpenSSH 6.5 and 6.6 have a bug that causes ~0.2% of connections
4130 using the curve25519-sha256@libssh.org KEX exchange method to fail
4131 when connecting with something that implements the spec properly.
4132
4133 Disable this KEX method when speaking to one of the affected
4134 versions.
4135
4136 reported by Aris Adamantiadis; ok markus@
4137
4138commit 8c492da58f8ceb85cf5f7066f23e26fb813a963d
4139Author: Damien Miller <djm@mindrot.org>
4140Date: Sun Apr 20 13:25:09 2014 +1000
4141
4142 - djm@cvs.openbsd.org 2014/04/16 23:28:12
4143 [ssh-agent.1]
4144 remove the identity files from this manpage - ssh-agent doesn't deal
4145 with them at all and the same information is duplicated in ssh-add.1
4146 (which does deal with them); prodded by deraadt@
4147
4148commit adbfdbbdccc70c9bd70d81ae096db115445c6e26
4149Author: Damien Miller <djm@mindrot.org>
4150Date: Sun Apr 20 13:24:49 2014 +1000
4151
4152 - djm@cvs.openbsd.org 2014/04/16 23:22:45
4153 [bufaux.c]
4154 skip leading zero bytes in buffer_put_bignum2_from_string();
4155 reported by jan AT mojzis.com; ok markus@
4156
4157commit 75c62728dc87af6805696eeb520b9748faa136c8
4158Author: Damien Miller <djm@mindrot.org>
4159Date: Sun Apr 20 13:24:31 2014 +1000
4160
4161 - djm@cvs.openbsd.org 2014/04/12 04:55:53
4162 [sshd.c]
4163 avoid crash at exit: check that pmonitor!=NULL before dereferencing;
4164 bz#2225, patch from kavi AT juniper.net
4165
4166commit 2a328437fb1b0976f2f4522d8645803d5a5d0967
4167Author: Damien Miller <djm@mindrot.org>
4168Date: Sun Apr 20 13:24:01 2014 +1000
4169
4170 - djm@cvs.openbsd.org 2014/04/01 05:32:57
4171 [packet.c]
4172 demote a debug3 to PACKET_DEBUG; ok markus@
4173
4174commit 7d6a9fb660c808882d064e152d6070ffc3844c3f
4175Author: Damien Miller <djm@mindrot.org>
4176Date: Sun Apr 20 13:23:43 2014 +1000
4177
4178 - djm@cvs.openbsd.org 2014/04/01 03:34:10
4179 [sshconnect.c]
4180 When using VerifyHostKeyDNS with a DNSSEC resolver, down-convert any
4181 certificate keys to plain keys and attempt SSHFP resolution.
4182
4183 Prevents a server from skipping SSHFP lookup and forcing a new-hostkey
4184 dialog by offering only certificate keys.
4185
4186 Reported by mcv21 AT cam.ac.uk
4187
4188commit fcd62c0b66b8415405ed0af29c236329eb88cc0f
4189Author: Damien Miller <djm@mindrot.org>
4190Date: Sun Apr 20 13:23:21 2014 +1000
4191
4192 - djm@cvs.openbsd.org 2014/04/01 02:05:27
4193 [ssh-keysign.c]
4194 include fingerprint of key not found
4195 use arc4random_buf() instead of loop+arc4random()
4196
4197commit 43b156cf72f900f88065b0a1c1ebd09ab733ca46
4198Author: Damien Miller <djm@mindrot.org>
4199Date: Sun Apr 20 13:23:03 2014 +1000
4200
4201 - jmc@cvs.openbsd.org 2014/03/31 13:39:34
4202 [ssh-keygen.1]
4203 the text for the -K option was inserted in the wrong place in -r1.108;
4204 fix From: Matthew Clarke
4205
4206commit c1621c84f2dc1279065ab9fde2aa9327af418900
4207Author: Damien Miller <djm@mindrot.org>
4208Date: Sun Apr 20 13:22:46 2014 +1000
4209
4210 - naddy@cvs.openbsd.org 2014/03/28 05:17:11
4211 [ssh_config.5 sshd_config.5]
4212 sync available and default algorithms, improve algorithm list formatting
4213 help from jmc@ and schwarze@, ok deraadt@
4214
4215commit f2719b7c2b8a3b14d778d8a6d8dc729b5174b054
4216Author: Damien Miller <djm@mindrot.org>
4217Date: Sun Apr 20 13:22:18 2014 +1000
4218
4219 - tedu@cvs.openbsd.org 2014/03/26 19:58:37
4220 [sshd.8 sshd.c]
4221 remove libwrap support. ok deraadt djm mfriedl
4222
4223commit 4f40209aa4060b9c066a2f0d9332ace7b8dfb391
4224Author: Damien Miller <djm@mindrot.org>
4225Date: Sun Apr 20 13:21:22 2014 +1000
4226
4227 - djm@cvs.openbsd.org 2014/03/26 04:55:35
4228 [chacha.h cipher-chachapoly.h digest.h hmac.h kex.h kexc25519.c
4229 [misc.h poly1305.h ssh-pkcs11.c]
4230 use __bounded(...) attribute recently added to sys/cdefs.h instead of
4231 longform __attribute__(__bounded(...));
4232
4233 for brevity and a warning free compilation with llvm/clang
4234
4235commit 9235a030ad1b16903fb495d81544e0f7c7449523
4236Author: Damien Miller <djm@mindrot.org>
4237Date: Sun Apr 20 13:17:20 2014 +1000
4238
4239 Three commits in one (since they touch the same heavily-diverged file
4240 repeatedly):
4241
4242 - markus@cvs.openbsd.org 2014/03/25 09:40:03
4243 [myproposal.h]
4244 trimm default proposals.
4245
4246 This commit removes the weaker pre-SHA2 hashes, the broken ciphers
4247 (arcfour), and the broken modes (CBC) from the default configuration
4248 (the patch only changes the default, all the modes are still available
4249 for the config files).
4250
4251 ok djm@, reminded by tedu@ & naddy@ and discussed with many
4252 - deraadt@cvs.openbsd.org 2014/03/26 17:16:26
4253 [myproposal.h]
4254 The current sharing of myproposal[] between both client and server code
4255 makes the previous diff highly unpallatable. We want to go in that
4256 direction for the server, but not for the client. Sigh.
4257 Brought up by naddy.
4258 - markus@cvs.openbsd.org 2014/03/27 23:01:27
4259 [myproposal.h ssh-keyscan.c sshconnect2.c sshd.c]
4260 disable weak proposals in sshd, but keep them in ssh; ok djm@
4261
4262commit 6e1777f592f15f4559728c78204617537b1ac076
4263Author: Damien Miller <djm@mindrot.org>
4264Date: Sun Apr 20 13:02:58 2014 +1000
4265
4266 - tedu@cvs.openbsd.org 2014/03/19 14:42:44
4267 [scp.1]
4268 there is no need for rcp anymore
4269 ok deraadt millert
4270
4271commit eb1b7c514d2a7b1802ccee8cd50e565a4d419887
4272Author: Damien Miller <djm@mindrot.org>
4273Date: Sun Apr 20 13:02:26 2014 +1000
4274
4275 - tedu@cvs.openbsd.org 2014/03/17 19:44:10
4276 [ssh.1]
4277 old descriptions of des and blowfish are old. maybe ok deraadt
4278
4279commit f0858de6e1324ec730752387074b111b8551081e
4280Author: Damien Miller <djm@mindrot.org>
4281Date: Sun Apr 20 13:01:30 2014 +1000
4282
4283 - deraadt@cvs.openbsd.org 2014/03/15 17:28:26
4284 [ssh-agent.c ssh-keygen.1 ssh-keygen.c]
4285 Improve usage() and documentation towards the standard form.
4286 In particular, this line saves a lot of man page reading time.
4287 usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
4288 [-N new_passphrase] [-C comment] [-f output_keyfile]
4289 ok schwarze jmc
4290
4291commit 94bfe0fbd6e91a56b5b0ab94ac955d2a67d101aa
4292Author: Damien Miller <djm@mindrot.org>
4293Date: Sun Apr 20 13:00:51 2014 +1000
4294
4295 - naddy@cvs.openbsd.org 2014/03/12 13:06:59
4296 [ssh-keyscan.1]
4297 scan for Ed25519 keys by default too
4298
4299commit 3819519288b2b3928c6882f5883b0f55148f4fc0
4300Author: Damien Miller <djm@mindrot.org>
4301Date: Sun Apr 20 13:00:28 2014 +1000
4302
4303 - djm@cvs.openbsd.org 2014/03/12 04:51:12
4304 [authfile.c]
4305 correct test that kdf name is not "none" or "bcrypt"
4306
4307commit 8f9cd709c7cf0655d414306a0ed28306b33802be
4308Author: Damien Miller <djm@mindrot.org>
4309Date: Sun Apr 20 13:00:11 2014 +1000
4310
4311 - djm@cvs.openbsd.org 2014/03/12 04:50:32
4312 [auth-bsdauth.c ssh-keygen.c]
4313 don't count on things that accept arguments by reference to clear
4314 things for us on error; most things do, but it's unsafe form.
4315
4316commit 1c7ef4be83f6dec84509a312518b9df00ab491d9
4317Author: Damien Miller <djm@mindrot.org>
4318Date: Sun Apr 20 12:59:46 2014 +1000
4319
4320 - djm@cvs.openbsd.org 2014/03/12 04:44:58
4321 [ssh-keyscan.c]
4322 scan for Ed25519 keys by default too
4323
4324commit c10bf4d051c97939b30a1616c0499310057d07da
4325Author: Damien Miller <djm@mindrot.org>
4326Date: Sun Apr 20 12:58:04 2014 +1000
4327
4328 - djm@cvs.openbsd.org 2014/03/03 22:22:30
4329 [session.c]
4330 ignore enviornment variables with embedded '=' or '\0' characters;
4331 spotted by Jann Horn; ok deraadt@
4332 Id sync only - portable already has this.
4333
4334commit c2e49062faccbcd7135c40d1c78c5c329c58fc2e
4335Author: Damien Miller <djm@mindrot.org>
4336Date: Tue Apr 1 14:42:46 2014 +1100
4337
4338 - (djm) Use full release (e.g. 6.5p1) in debug output rather than just
4339 version. From des@des.no
4340
4341commit 14928b7492abec82afa4c2b778fc03f78cd419b6
4342Author: Damien Miller <djm@mindrot.org>
4343Date: Tue Apr 1 14:38:07 2014 +1100
4344
4345 - (djm) On platforms that support it, use prctl() to prevent sftp-server
4346 from accessing /proc/self/{mem,maps}; patch from jann AT thejh.net
4347
4348commit 48abc47e60048461fe9117e108a7e99ea1ac2bb8
4349Author: Damien Miller <djm@mindrot.org>
4350Date: Mon Mar 17 14:45:56 2014 +1100
4351
4352 - (djm) [sandbox-seccomp-filter.c] Soft-fail stat() syscalls. Add XXX to
4353 remind myself to add sandbox violation logging via the log socket.
4354
4355commit 9c36698ca2f554ec221dc7ef29c7a89e97c88705
4356Author: Tim Rice <tim@multitalents.net>
4357Date: Fri Mar 14 12:45:01 2014 -0700
4358
4359 20140314
4360 - (tim) [opensshd.init.in] Add support for ed25519
4361
4362commit 19158b2447e35838d69b2b735fb640d1e86061ea
4363Author: Damien Miller <djm@mindrot.org>
4364Date: Thu Mar 13 13:14:21 2014 +1100
4365
4366 - (djm) Release OpenSSH 6.6
4367
4368commit 8569eba5d7f7348ce3955eeeb399f66f25c52ece
4369Author: Damien Miller <djm@mindrot.org>
4370Date: Tue Mar 4 09:35:17 2014 +1100
4371
4372 - djm@cvs.openbsd.org 2014/03/03 22:22:30
4373 [session.c]
4374 ignore enviornment variables with embedded '=' or '\0' characters;
4375 spotted by Jann Horn; ok deraadt@
4376
4377commit 2476c31b96e89aec7d4e73cb6fbfb9a4290de3a7
4378Author: Damien Miller <djm@mindrot.org>
4379Date: Sun Mar 2 04:01:00 2014 +1100
4380
4381 - (djm) [regress/Makefile] Disable dhgex regress test; it breaks when
4382 no moduli file exists at the expected location.
4383
4384commit c83fdf30e9db865575b2521b1fe46315cf4c70ae
4385Author: Damien Miller <djm@mindrot.org>
4386Date: Fri Feb 28 10:34:03 2014 +1100
4387
4388 - (djm) [regress/host-expand.sh] Add RCS Id
4389
4390commit 834aeac3555e53f7d29a6fcf3db010dfb99681c7
4391Author: Damien Miller <djm@mindrot.org>
4392Date: Fri Feb 28 10:25:16 2014 +1100
4393
4394 - djm@cvs.openbsd.org 2014/02/27 21:21:25
4395 [agent-ptrace.sh agent.sh]
4396 keep return values that are printed in error messages;
4397 from portable
4398 (Id sync only)
4399
4400commit 4f7f1a9a0de24410c30952c7e16d433240422182
4401Author: Damien Miller <djm@mindrot.org>
4402Date: Fri Feb 28 10:24:11 2014 +1100
4403
4404 - djm@cvs.openbsd.org 2014/02/27 20:04:16
4405 [login-timeout.sh]
4406 remove any existing LoginGraceTime from sshd_config before adding
4407 a specific one for the test back in
4408
4409commit d705d987c27f68080c8798eeb5262adbdd6b4ffd
4410Author: Damien Miller <djm@mindrot.org>
4411Date: Fri Feb 28 10:23:26 2014 +1100
4412
4413 - djm@cvs.openbsd.org 2014/01/26 10:49:17
4414 [scp-ssh-wrapper.sh scp.sh]
4415 make sure $SCP is tested on the remote end rather than whichever one
4416 happens to be in $PATH; from portable
4417 (Id sync only)
4418
4419commit 624a3ca376e3955a4b9d936c9e899e241b65d357
4420Author: Damien Miller <djm@mindrot.org>
4421Date: Fri Feb 28 10:22:37 2014 +1100
4422
4423 - djm@cvs.openbsd.org 2014/01/26 10:22:10
4424 [regress/cert-hostkey.sh]
4425 automatically generate revoked keys from listed keys rather than
4426 manually specifying each type; from portable
4427 (Id sync only)
4428
4429commit b84392328425e4b9a71f8bde5fe6a4a4c48d3ec4
4430Author: Damien Miller <djm@mindrot.org>
4431Date: Fri Feb 28 10:21:26 2014 +1100
4432
4433 - dtucker@cvs.openbsd.org 2014/01/25 04:35:32
4434 [regress/Makefile regress/dhgex.sh]
4435 Add a test for DH GEX sizes
4436
4437commit 1e2aa3d90472293ea19008f02336d6d68aa05793
4438Author: Damien Miller <djm@mindrot.org>
4439Date: Fri Feb 28 10:19:51 2014 +1100
4440
4441 - dtucker@cvs.openbsd.org 2014/01/20 00:00:30
4442 [sftp-chroot.sh]
4443 append to rather than truncating the log file
4444
4445commit f483cc16fe7314e24a37aa3a4422b03c013c3213
4446Author: Damien Miller <djm@mindrot.org>
4447Date: Fri Feb 28 10:19:11 2014 +1100
4448
4449 - dtucker@cvs.openbsd.org 2014/01/19 23:43:02
4450 [regress/sftp-chroot.sh]
4451 Don't use -q on sftp as it suppresses logging, instead redirect the
4452 output to the regress logfile.
4453
4454commit 6486f16f1c0ebd6f39286f6ab5e08286d90a994a
4455Author: Damien Miller <djm@mindrot.org>
4456Date: Fri Feb 28 10:03:52 2014 +1100
4457
4458 - (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
4459 [contrib/suse/openssh.spec] Crank version numbers
4460
4461commit 92cf5adea194140380e6af6ec32751f9ad540794
4462Author: Damien Miller <djm@mindrot.org>
4463Date: Fri Feb 28 10:01:53 2014 +1100
4464
4465 - djm@cvs.openbsd.org 2014/02/27 22:57:40
4466 [version.h]
4467 openssh-6.6
4468
4469commit fc5d6759aba71eb205b296b5f148010ffc828583
4470Author: Damien Miller <djm@mindrot.org>
4471Date: Fri Feb 28 10:01:28 2014 +1100
4472
4473 - djm@cvs.openbsd.org 2014/02/27 22:47:07
4474 [sshd_config.5]
4475 bz#2184 clarify behaviour of a keyword that appears in multiple
4476 matching Match blocks; ok dtucker@
4477
4478commit 172ec7e0af1a5f1d682f6a2dca335c6c186153d5
4479Author: Damien Miller <djm@mindrot.org>
4480Date: Fri Feb 28 10:00:57 2014 +1100
4481
4482 - djm@cvs.openbsd.org 2014/02/27 08:25:09
4483 [bufbn.c]
4484 off by one in range check
4485
4486commit f9a9aaba437c2787e40cf7cc928281950e161678
4487Author: Damien Miller <djm@mindrot.org>
4488Date: Fri Feb 28 10:00:27 2014 +1100
4489
4490 - djm@cvs.openbsd.org 2014/02/27 00:41:49
4491 [bufbn.c]
4492 fix unsigned overflow that could lead to reading a short ssh protocol
4493 1 bignum value; found by Ben Hawkes; ok deraadt@
4494
4495commit fb3423b612713d9cde67c8a75f6f51188d6a3de3
4496Author: Damien Miller <djm@mindrot.org>
4497Date: Thu Feb 27 10:20:07 2014 +1100
4498
4499 - markus@cvs.openbsd.org 2014/02/26 21:53:37
4500 [sshd.c]
4501 ssh_gssapi_prepare_supported_oids needs GSSAPI
4502
4503commit 1348129a34f0f7728c34d86c100a32dcc8d1f922
4504Author: Damien Miller <djm@mindrot.org>
4505Date: Thu Feb 27 10:18:32 2014 +1100
4506
4507 - djm@cvs.openbsd.org 2014/02/26 20:29:29
4508 [channels.c]
4509 don't assume that the socks4 username is \0 terminated;
4510 spotted by Ben Hawkes; ok markus@
4511
4512commit e6a74aeeacd01d885262ff8e50eb28faee8c8039
4513Author: Damien Miller <djm@mindrot.org>
4514Date: Thu Feb 27 10:17:49 2014 +1100
4515
4516 - djm@cvs.openbsd.org 2014/02/26 20:28:44
4517 [auth2-gss.c gss-serv.c ssh-gss.h sshd.c]
4518 bz#2107 - cache OIDs of supported GSSAPI mechanisms before privsep
4519 sandboxing, as running this code in the sandbox can cause violations;
4520 ok markus@
4521
4522commit 08b57c67f3609340ff703fe2782d7058acf2529e
4523Author: Damien Miller <djm@mindrot.org>
4524Date: Thu Feb 27 10:17:13 2014 +1100
4525
4526 - djm@cvs.openbsd.org 2014/02/26 20:18:37
4527 [ssh.c]
4528 bz#2205: avoid early hostname lookups unless canonicalisation is enabled;
4529 ok dtucker@ markus@
4530
4531commit 13f97b2286142fd0b8eab94e4ce84fe124eeb752
4532Author: Damien Miller <djm@mindrot.org>
4533Date: Mon Feb 24 15:57:55 2014 +1100
4534
4535 - djm@cvs.openbsd.org 2014/02/23 20:11:36
4536 [readconf.c readconf.h ssh.c ssh_config.5]
4537 reparse ssh_config and ~/.ssh/config if hostname canonicalisation changes
4538 the hostname. This allows users to write configurations that always
4539 refer to canonical hostnames, e.g.
4540
4541 CanonicalizeHostname yes
4542 CanonicalDomains int.example.org example.org
4543 CanonicalizeFallbackLocal no
4544
4545 Host *.int.example.org
4546 Compression off
4547 Host *.example.org
4548 User djm
4549
4550 ok markus@
4551
4552commit bee3a234f3d1ad4244952bcff1b4b7c525330dc2
4553Author: Damien Miller <djm@mindrot.org>
4554Date: Mon Feb 24 15:57:22 2014 +1100
4555
4556 - djm@cvs.openbsd.org 2014/02/23 20:03:42
4557 [ssh-ed25519.c]
4558 check for unsigned overflow; not reachable in OpenSSH but others might
4559 copy our code...
4560
4561commit 0628780abe61e7e50cba48cdafb1837f49ff23b2
4562Author: Damien Miller <djm@mindrot.org>
4563Date: Mon Feb 24 15:56:45 2014 +1100
4564
4565 - djm@cvs.openbsd.org 2014/02/22 01:32:19
4566 [readconf.c]
4567 when processing Match blocks, skip 'exec' clauses if previous predicates
4568 failed to match; ok markus@
4569
4570commit 0890dc8191bb201eb01c3429feec0300a9d3a930
4571Author: Damien Miller <djm@mindrot.org>
4572Date: Mon Feb 24 15:56:07 2014 +1100
4573
4574 - djm@cvs.openbsd.org 2014/02/15 23:05:36
4575 [channels.c]
4576 avoid spurious "getsockname failed: Bad file descriptor" errors in ssh -W;
4577 bz#2200, debian#738692 via Colin Watson; ok dtucker@
4578
4579commit d3cf67e1117c25d151d0f86396e77ee3a827045a
4580Author: Damien Miller <djm@mindrot.org>
4581Date: Mon Feb 24 15:55:36 2014 +1100
4582
4583 - djm@cvs.openbsd.org 2014/02/07 06:55:54
4584 [cipher.c mac.c]
4585 remove some logging that makes ssh debugging output very verbose;
4586 ok markus
4587
4588commit 03ae081aeaa118361c81ece76eb7cc1aaa2b40c5
4589Author: Tim Rice <tim@multitalents.net>
4590Date: Fri Feb 21 09:09:34 2014 -0800
4591
4592 20140221
4593 - (tim) [configure.ac] Fix cut-and-paste error. Patch from Bryan Drewery.
4594
4595commit 4a20959d2e3c90e9d66897c0b4032c785672d815
4596Author: Darren Tucker <dtucker@zip.com.au>
4597Date: Thu Feb 13 16:38:32 2014 +1100
4598
4599 - (dtucker) [configure.ac openbsd-compat/openssl-compat.{c,h}] Add compat
4600 code for older OpenSSL versions that don't have EVP_MD_CTX_copy_ex.
4601
4602commit d1a7a9c0fd1ac2e3314cceb2891959fd2cd9eabb
4603Author: Damien Miller <djm@mindrot.org>
4604Date: Fri Feb 7 09:24:33 2014 +1100
4605
4606 - djm@cvs.openbsd.org 2014/02/06 22:21:01
4607 [sshconnect.c]
4608 in ssh_create_socket(), only do the getaddrinfo for BindAddress when
4609 BindAddress is actually specified. Fixes regression in 6.5 for
4610 UsePrivilegedPort=yes; patch from Corinna Vinschen
4611
4612commit 6ce35b6cc4ead1bf98abec34cb2e2d6ca0abb15e
4613Author: Damien Miller <djm@mindrot.org>
4614Date: Fri Feb 7 09:24:14 2014 +1100
4615
4616 - naddy@cvs.openbsd.org 2014/02/05 20:13:25
4617 [ssh-keygen.1 ssh-keygen.c]
4618 tweak synopsis: calling ssh-keygen without any arguments is fine; ok jmc@
4619 while here, fix ordering in usage(); requested by jmc@
4620
4621commit 6434cb2cfbbf0a46375d2d22f2ff9927feb5e478
4622Author: Damien Miller <djm@mindrot.org>
4623Date: Thu Feb 6 11:17:50 2014 +1100
4624
4625 - (djm) [sandbox-seccomp-filter.c] Not all Linux architectures define
4626 __NR_shutdown; some go via the socketcall(2) multiplexer.
4627
4628commit 8d36f9ac71eff2e9f5770c0518b73d875f270647
4629Author: Darren Tucker <dtucker@zip.com.au>
4630Date: Thu Feb 6 10:44:13 2014 +1100
4631
4632 - (dtucker) [openbsd-compat/bsd-poll.c] Don't bother checking for non-NULL
4633 before freeing since free(NULL) is a no-op. ok djm.
4634
4635commit a0959da3680b4ce8cf911caf3293a6d90f88eeb7
4636Author: Damien Miller <djm@mindrot.org>
4637Date: Wed Feb 5 10:33:45 2014 +1100
4638
4639 - (djm) [sandbox-capsicum.c] Don't fatal if Capsicum is offered by
4640 headers/libc but not supported by the kernel. Patch from Loganaden
4641 Velvindron @ AfriNIC
4642
4643commit 9c449bc183b256c84d8f740727b0bc54d247b15e
4644Author: Damien Miller <djm@mindrot.org>
4645Date: Tue Feb 4 11:38:28 2014 +1100
4646
4647 - (djm) [regress/setuid-allowed.c] Missing string.h for strerror()
4648
4649commit bf7e0f03be661b6f5b3bfe325135ce19391f9c4d
4650Author: Damien Miller <djm@mindrot.org>
4651Date: Tue Feb 4 11:37:50 2014 +1100
4652
4653 - (djm) [openbsd-compat/Makefile.in] Add missing explicit_bzero.o
4654
4655commit eb6d870a0ea8661299bb2ea8f013d3ace04e2024
4656Author: Damien Miller <djm@mindrot.org>
4657Date: Tue Feb 4 11:26:34 2014 +1100
4658
4659 - djm@cvs.openbsd.org 2014/02/04 00:24:29
4660 [ssh.c]
4661 delay lowercasing of hostname until right before hostname
4662 canonicalisation to unbreak case-sensitive matching of ssh_config;
4663 reported by Ike Devolder; ok markus@
4664
4665commit d56b44d2dfa093883a5c4e91be3f72d99946b170
4666Author: Damien Miller <djm@mindrot.org>
4667Date: Tue Feb 4 11:26:04 2014 +1100
4668
4669 - djm@cvs.openbsd.org 2014/02/04 00:24:29
4670 [ssh.c]
4671 delay lowercasing of hostname until right before hostname
4672 canonicalisation to unbreak case-sensitive matching of ssh_config;
4673 reported by Ike Devolder; ok markus@
4674
4675commit db3c595ea74ea9ccd5aa644d7e1f8dc675710731
4676Author: Damien Miller <djm@mindrot.org>
4677Date: Tue Feb 4 11:25:45 2014 +1100
4678
4679 - djm@cvs.openbsd.org 2014/02/02 03:44:31
4680 [digest-libc.c digest-openssl.c]
4681 convert memset of potentially-private data to explicit_bzero()
4682
4683commit aae07e2e2000dd318418fd7fd4597760904cae32
4684Author: Damien Miller <djm@mindrot.org>
4685Date: Tue Feb 4 11:20:40 2014 +1100
4686
4687 - djm@cvs.openbsd.org 2014/02/03 23:28:00
4688 [ssh-ecdsa.c]
4689 fix memory leak; ECDSA_SIG_new() allocates 'r' and 's' for us, unlike
4690 DSA_SIG_new. Reported by Batz Spear; ok markus@
4691
4692commit a5103f413bde6f31bff85d6e1fd29799c647d765
4693Author: Damien Miller <djm@mindrot.org>
4694Date: Tue Feb 4 11:20:14 2014 +1100
4695
4696 - djm@cvs.openbsd.org 2014/02/02 03:44:32
4697 [auth1.c auth2-chall.c auth2-passwd.c authfile.c bufaux.c bufbn.c]
4698 [buffer.c cipher-3des1.c cipher.c clientloop.c gss-serv.c kex.c]
4699 [kexdhc.c kexdhs.c kexecdhc.c kexgexc.c kexecdhs.c kexgexs.c key.c]
4700 [monitor.c monitor_wrap.c packet.c readpass.c rsa.c serverloop.c]
4701 [ssh-add.c ssh-agent.c ssh-dss.c ssh-ecdsa.c ssh-ed25519.c]
4702 [ssh-keygen.c ssh-rsa.c sshconnect.c sshconnect1.c sshconnect2.c]
4703 [sshd.c]
4704 convert memset of potentially-private data to explicit_bzero()
4705
4706commit 1d2c4564265ee827147af246a16f3777741411ed
4707Author: Damien Miller <djm@mindrot.org>
4708Date: Tue Feb 4 11:18:20 2014 +1100
4709
4710 - tedu@cvs.openbsd.org 2014/01/31 16:39:19
4711 [auth2-chall.c authfd.c authfile.c bufaux.c bufec.c canohost.c]
4712 [channels.c cipher-chachapoly.c clientloop.c configure.ac hostfile.c]
4713 [kexc25519.c krl.c monitor.c sandbox-systrace.c session.c]
4714 [sftp-client.c ssh-keygen.c ssh.c sshconnect2.c sshd.c sshlogin.c]
4715 [openbsd-compat/explicit_bzero.c openbsd-compat/openbsd-compat.h]
4716 replace most bzero with explicit_bzero, except a few that cna be memset
4717 ok djm dtucker
4718
4719commit 3928de067c286683a95fbdbdb5fdb3c78a0e5efd
4720Author: Damien Miller <djm@mindrot.org>
4721Date: Tue Feb 4 11:13:54 2014 +1100
4722
4723 - djm@cvs.openbsd.org 2014/01/30 22:26:14
4724 [sandbox-systrace.c]
4725 allow shutdown(2) syscall in sandbox - it may be called by packet_close()
4726 from portable
4727 (Id sync only; change is already in portable)
4728
4729commit e1e480aee8a9af6cfbe7188667b7b940d6b57f9f
4730Author: Damien Miller <djm@mindrot.org>
4731Date: Tue Feb 4 11:13:17 2014 +1100
4732
4733 - jmc@cvs.openbsd.org 2014/01/29 14:04:51
4734 [sshd_config.5]
4735 document kbdinteractiveauthentication;
4736 requested From: Ross L Richardson
4737
4738 dtucker/markus helped explain its workings;
4739
4740commit 7cc194f70d4a5ec9a82d19422eaf18db4a6624c6
4741Author: Damien Miller <djm@mindrot.org>
4742Date: Tue Feb 4 11:12:56 2014 +1100
4743
4744 - djm@cvs.openbsd.org 2014/01/29 06:18:35
4745 [Makefile.in auth.h auth2-jpake.c auth2.c jpake.c jpake.h monitor.c]
4746 [monitor.h monitor_wrap.c monitor_wrap.h readconf.c readconf.h]
4747 [schnorr.c schnorr.h servconf.c servconf.h ssh2.h sshconnect2.c]
4748 remove experimental, never-enabled JPAKE code; ok markus@
4749
4750commit b0f26544cf6f4feeb1a4f6db09fca834f5c9867d
4751Author: Damien Miller <djm@mindrot.org>
4752Date: Tue Feb 4 11:10:01 2014 +1100
4753
4754 - djm@cvs.openbsd.org 2014/01/29 00:19:26
4755 [sshd.c]
4756 use kill(0, ...) instead of killpg(0, ...); on most operating systems
4757 they are equivalent, but SUSv2 describes the latter as having undefined
4758 behaviour; from portable; ok dtucker
4759 (Id sync only; change is already in portable)
4760
4761commit f8f35bc471500348bb262039fb1fc43175d251b0
4762Author: Damien Miller <djm@mindrot.org>
4763Date: Tue Feb 4 11:09:12 2014 +1100
4764
4765 - jmc@cvs.openbsd.org 2014/01/28 14:13:39
4766 [ssh-keyscan.1]
4767 kill some bad Pa;
4768 From: Jan Stary
4769
4770commit 0ba85d696ae9daf66002c2e4ab0d6bb111e1a787
4771Author: Damien Miller <djm@mindrot.org>
4772Date: Tue Feb 4 11:08:38 2014 +1100
4773
4774 ignore a few more regress droppings
4775
4776commit ec93d15170b7a6ddf63fd654bd0f6a752acc19dd
4777Author: Damien Miller <djm@mindrot.org>
4778Date: Tue Feb 4 11:07:13 2014 +1100
4779
4780 - markus@cvs.openbsd.org 2014/01/27 20:13:46
4781 [digest.c digest-openssl.c digest-libc.c Makefile.in]
4782 rename digest.c to digest-openssl.c and add libc variant; ok djm@
4783
4784commit 4a1c7aa640fb97d3472d51b215b6a0ec0fd025c7
4785Author: Damien Miller <djm@mindrot.org>
4786Date: Tue Feb 4 11:03:36 2014 +1100
4787
4788 - markus@cvs.openbsd.org 2014/01/27 19:18:54
4789 [auth-rsa.c cipher.c ssh-agent.c sshconnect1.c sshd.c]
4790 replace openssl MD5 with our ssh_digest_*; ok djm@
4791
4792commit 4e8d937af79ce4e253f77ec93489d098b25becc3
4793Author: Damien Miller <djm@mindrot.org>
4794Date: Tue Feb 4 11:02:42 2014 +1100
4795
4796 - markus@cvs.openbsd.org 2014/01/27 18:58:14
4797 [Makefile.in digest.c digest.h hostfile.c kex.h mac.c hmac.c hmac.h]
4798 replace openssl HMAC with an implementation based on our ssh_digest_*
4799 ok and feedback djm@
4800
4801commit 69d0d09f76bab5aec86fbf78489169f63bd16475
4802Author: Tim Rice <tim@multitalents.net>
4803Date: Fri Jan 31 14:25:18 2014 -0800
4804
4805 - (tim) [Makefile.in] build regress/setuid-allow.
4806
4807commit 0eeafcd76b972a3d159f3118227c149a4d7817fe
4808Author: Darren Tucker <dtucker@zip.com.au>
4809Date: Fri Jan 31 14:18:51 2014 +1100
4810
4811 - (dtucker) [readconf.c] Include <arpa/inet.h> for the hton macros. Fixes
4812 build with HP-UX's compiler. Patch from Kevin Brott.
4813
4814commit 7e5cec6070673e9f9785ffc749837ada22fbe99f
4815Author: Damien Miller <djm@mindrot.org>
4816Date: Fri Jan 31 09:25:34 2014 +1100
4817
4818 - (djm) [sandbox-seccomp-filter.c sandbox-systrace.c] Allow shutdown(2)
4819 syscall from sandboxes; it may be called by packet_close.
4820
4821commit cdb6c90811caa5df2df856be9b0b16db020fe31d
4822Author: Damien Miller <djm@mindrot.org>
4823Date: Thu Jan 30 12:50:17 2014 +1100
4824
4825 - (djm) Release openssh-6.5p1
4826
4827commit 996ea80b1884b676a901439f1f2681eb6ff68501
4828Author: Damien Miller <djm@mindrot.org>
4829Date: Thu Jan 30 12:49:55 2014 +1100
4830
4831 trim entries prior to openssh-6.0p1
4832
4833commit f5bbd3b657b6340551c8a95f74a70857ff8fac79
4834Author: Damien Miller <djm@mindrot.org>
4835Date: Thu Jan 30 11:26:46 2014 +1100
4836
4837 - (djm) [configure.ac atomicio.c] Kludge around NetBSD offering
4838 different symbols for 'read' when various compiler flags are
4839 in use, causing atomicio.c comparisons against it to break and
4840 read/write operations to hang; ok dtucker
4841
4842commit c2868192ddc4e1420a50389e18c05db20b0b1f32
4843Author: Damien Miller <djm@mindrot.org>
4844Date: Thu Jan 30 10:21:19 2014 +1100
4845
4846 - (djm) [configure.ac] Only check for width-specified integer types
4847 in headers that actually exist. patch from Tom G. Christensen;
4848 ok dtucker@
4849
4850commit c161fc90fc86e2035710570238a9e1ca7a68d2a5
4851Author: Damien Miller <djm@mindrot.org>
4852Date: Wed Jan 29 21:01:33 2014 +1100
4853
4854 - (djm) [configure.ac] Fix broken shell test '==' vs '='; patch from
4855 Tom G. Christensen
4856
4857commit 6f917ad376481995ab7d29fb53b08ec8d507eb9e
4858Author: Tim Rice <tim@multitalents.net>
4859Date: Tue Jan 28 10:26:25 2014 -0800
4860
4861 - (tim) [regress/agent.sh regress/agent-ptrace.sh] Assign $? to a variable
4862 when used as an error message inside an if statement so we display the
4863 correct into. agent.sh patch from Petr Lautrbach.
4864
4865commit ab16ef4152914d44ce6f76e48167d26d22f66a06
4866Author: Damien Miller <djm@mindrot.org>
4867Date: Tue Jan 28 15:08:12 2014 +1100
4868
4869 - (djm) [sshd.c] Use kill(0, ...) instead of killpg(0, ...); the
4870 latter being specified to have undefined behaviour in SUSv3;
4871 ok dtucker
4872
4873commit ab0394905884dc6e58c3721211c6b38fb8fc2ca8
4874Author: Damien Miller <djm@mindrot.org>
4875Date: Tue Jan 28 15:07:10 2014 +1100
4876
4877 - (djm) [configure.ac] Search for inet_ntop in libnsl and libresovl;
4878 ok dtucker
4879
4880commit 4ab20a82d4d4168d62318923f62382f6ef242fcd
4881Author: Darren Tucker <dtucker@zip.com.au>
4882Date: Mon Jan 27 17:35:04 2014 +1100
4883
4884 - (dtucker) [Makefile.in] Remove trailing backslash which some make
4885 implementations (eg older Solaris) do not cope with.
4886
4887commit e7e8b3cfe9f8665faaf0e68b33df5bbb431bd129
4888Author: Darren Tucker <dtucker@zip.com.au>
4889Date: Mon Jan 27 17:32:50 2014 +1100
4890
4891 Welcome to 2014
4892
4893commit 5b447c0aac0dd444251e276f6bb3bbbe1c05331c
4894Author: Damien Miller <djm@mindrot.org>
4895Date: Sun Jan 26 09:46:53 2014 +1100
4896
4897 - (djm) [configure.ac] correct AC_DEFINE for previous.
4898
4899commit 2035b2236d3b1f76c749c642a43e03c85eae76e6
4900Author: Damien Miller <djm@mindrot.org>
4901Date: Sun Jan 26 09:39:53 2014 +1100
4902
4903 - (djm) [configure.ac sandbox-capsicum.c sandbox-rlimit.c] Disable
4904 RLIMIT_NOFILE pseudo-sandbox on FreeBSD. In some configurations,
4905 libc will attempt to open additional file descriptors for crypto
4906 offload and crash if they cannot be opened.
4907
4908commit a92ac7410475fbb00383c7402aa954dc0a75ae19
4909Author: Damien Miller <djm@mindrot.org>
4910Date: Sun Jan 26 09:38:03 2014 +1100
4911
4912 - markus@cvs.openbsd.org 2014/01/25 20:35:37
4913 [kex.c]
4914 dh_need needs to be set to max(seclen, blocksize, ivlen, mac_len)
4915 ok dtucker@, noted by mancha
4916
4917commit 76eea4ab4e658670ca6e76dd1e6d17f262208b57
4918Author: Damien Miller <djm@mindrot.org>
4919Date: Sun Jan 26 09:37:25 2014 +1100
4920
4921 - dtucker@cvs.openbsd.org 2014/01/25 10:12:50
4922 [cipher.c cipher.h kex.c kex.h kexgexc.c]
4923 Add a special case for the DH group size for 3des-cbc, which has an
4924 effective strength much lower than the key size. This causes problems
4925 with some cryptlib implementations, which don't support group sizes larger
4926 than 4k but also don't use the largest group size it does support as
4927 specified in the RFC. Based on a patch from Petr Lautrbach at Redhat,
4928 reduced by me with input from Markus. ok djm@ markus@
4929
4930commit 603b8f47f1cd9ed95a2017447db8e60ca6704594
4931Author: Damien Miller <djm@mindrot.org>
4932Date: Sat Jan 25 13:16:59 2014 +1100
4933
4934 - (djm) [configure.ac] autoconf sets finds to 'yes' not '1', so test
4935 against the correct thing.
4936
4937commit c96d85376d779b6ac61525b5440010d344d2f23f
4938Author: Damien Miller <djm@mindrot.org>
4939Date: Sat Jan 25 13:12:28 2014 +1100
4940
4941 - (djm) [configure.ac] Do not attempt to use capsicum sandbox unless
4942 sys/capability.h exists and cap_rights_limit is in libc. Fixes
4943 build on FreeBSD9x which provides the header but not the libc
4944 support.
4945
4946commit f62ecef9939cb3dbeb10602fd705d4db3976d822
4947Author: Damien Miller <djm@mindrot.org>
4948Date: Sat Jan 25 12:34:38 2014 +1100
4949
4950 - (djm) [configure.ac] Fix detection of capsicum sandbox on FreeBSD
4951
4952commit b0e0f760b861676a3fe5c40133b270713d5321a9
4953Author: Damien Miller <djm@mindrot.org>
4954Date: Fri Jan 24 14:27:04 2014 +1100
4955
4956 - (djm) [Makefile.in regress/scp-ssh-wrapper.sh regress/scp.sh] Make
4957 the scp regress test actually test the built scp rather than the one
4958 in $PATH. ok dtucker@
4959
4960commit 42a092530159637da9cb7f9e1b5f4679e34a85e6
4961Author: Darren Tucker <dtucker@zip.com.au>
4962Date: Thu Jan 23 23:14:39 2014 +1100
4963
4964 - (dtucker) [configure.ac] NetBSD's (and FreeBSD's) strnvis is gratuitously
4965 incompatible with OpenBSD's despite post-dating it by more than a decade.
4966 Declare it as broken, and document FreeBSD's as the same. ok djm@
4967
4968commit 617da33c20cb59f9ea6c99c881d92493371ef7b8
4969Author: Tim Rice <tim@multitalents.net>
4970Date: Wed Jan 22 19:16:10 2014 -0800
4971
4972 - (tim) [session.c] Improve error reporting on set_id().
4973
4974commit 5c2ff5e31f57d303ebb414d84a934c02728fa568
4975Author: Damien Miller <djm@mindrot.org>
4976Date: Wed Jan 22 21:30:12 2014 +1100
4977
4978 - (djm) [configure.ac aclocal.m4] More tests to detect fallout from
4979 platform hardening options: include some long long int arithmatic
4980 to detect missing support functions for -ftrapv in libgcc and
4981 equivalents, actually test linking when -ftrapv is supplied and
4982 set either both -pie/-fPIE or neither. feedback and ok dtucker@
4983
4984commit 852472a54b8a0dc3e53786b313baaa86850a4273
4985Author: Damien Miller <djm@mindrot.org>
4986Date: Wed Jan 22 16:31:18 2014 +1100
4987
4988 - (djm) [configure.ac] Unless specifically requested, only attempt
4989 to build Position Independent Executables on gcc >= 4.x; ok dtucker
4990
4991commit ee87838786cef0194db36ae0675b3e7c4e8ec661
4992Author: Damien Miller <djm@mindrot.org>
4993Date: Wed Jan 22 16:30:15 2014 +1100
4994
4995 - (djm) [openbsd-compat/setproctitle.c] Don't fail to compile if a
4996 platform that is expected to use the reuse-argv style setproctitle
4997 hack surprises us by providing a setproctitle in libc; ok dtucker
4998
4999commit 5c96a154c7940fa67b1f11c421e390dbbc159f27
5000Author: Damien Miller <djm@mindrot.org>
5001Date: Tue Jan 21 13:10:26 2014 +1100
5002
5003 - (djm) [aclocal.m4] Flesh out the code run in the OSSH_CHECK_CFLAG_COMPILE
5004 and OSSH_CHECK_LDFLAG_LINK tests to give them a better chance of
5005 detecting toolchain-related problems; ok dtucker
5006
5007commit 9464ba6fb34bb42eb3501ec3c5143662e75674bf
5008Author: Tim Rice <tim@multitalents.net>
5009Date: Mon Jan 20 17:59:28 2014 -0800
5010
5011 - (tim) [platform.c session.c] Fix bug affecting SVR5 platforms introduced
5012 with sftp chroot support. Move set_id call after chroot.
5013
5014commit a6d573caa14d490e6c42fb991bcb5c6860ec704b
5015Author: Darren Tucker <dtucker@zip.com.au>
5016Date: Tue Jan 21 12:50:46 2014 +1100
5017
5018 - (dtucker) [aclocal.m4] Differentiate between compile-time and link-time
5019 tests in the configure output. ok djm.
5020
5021commit 096118dc73ab14810b3c12785c0b5acb01ad6123
5022Author: Darren Tucker <dtucker@zip.com.au>
5023Date: Tue Jan 21 12:48:51 2014 +1100
5024
5025 - (dtucker) [configure.ac] Make PIE a configure-time option which defaults
5026 to on platforms where it's known to be reliably detected and off elsewhere.
5027 Works around platforms such as FreeBSD 9.1 where it does not interop with
5028 -ftrapv (it seems to work but fails when trying to link ssh). ok djm@
5029
5030commit f9df7f6f477792254eab33cdef71a6d66488cb88
5031Author: Damien Miller <djm@mindrot.org>
5032Date: Mon Jan 20 20:07:15 2014 +1100
5033
5034 - (djm) [regress/cert-hostkey.sh] Fix regress failure on platforms that
5035 skip one or more key types (e.g. RHEL/CentOS 6.5); ok dtucker@
5036
5037commit c74e70eb52ccc0082bd5a70b5798bb01c114d138
5038Author: Darren Tucker <dtucker@zip.com.au>
5039Date: Mon Jan 20 13:18:09 2014 +1100
5040
5041 - (dtucker) [gss-serv-krb5.c] Fall back to krb5_cc_gen_new if the Kerberos
5042 implementation does not have krb5_cc_new_unique, similar to what we do
5043 in auth-krb5.c.
5044
5045commit 3510979e83b6a18ec8773c64c3fa04aa08b2e783
5046Author: Damien Miller <djm@mindrot.org>
5047Date: Mon Jan 20 12:41:53 2014 +1100
5048
5049 - djm@cvs.openbsd.org 2014/01/20 00:08:48
5050 [digest.c]
5051 memleak; found by Loganaden Velvindron @ AfriNIC; ok markus@
5052
5053commit 7eee358d7a6580479bee5cd7e52810ebfd03e5b2
5054Author: Darren Tucker <dtucker@zip.com.au>
5055Date: Sun Jan 19 22:37:02 2014 +1100
5056
5057 - dtucker@cvs.openbsd.org 2014/01/19 11:21:51
5058 [addrmatch.c]
5059 Cast the sizeof to socklen_t so it'll work even if the supplied len is
5060 negative. Suggested by and ok djm, ok deraadt.
5061
5062commit b7e01c09b56ab26e8fac56bbce0fd25e36d12bb0
5063Author: Darren Tucker <dtucker@zip.com.au>
5064Date: Sun Jan 19 22:36:13 2014 +1100
5065
5066 - djm@cvs.openbsd.org 2014/01/19 04:48:08
5067 [ssh_config.5]
5068 fix inverted meaning of 'no' and 'yes' for CanonicalizeFallbackLocal
5069
5070commit 7b1ded04adce42efa25ada7c3a39818d3109b724
5071Author: Darren Tucker <dtucker@zip.com.au>
5072Date: Sun Jan 19 15:30:02 2014 +1100
5073
5074 - dtucker@cvs.openbsd.org 2014/01/19 04:17:29
5075 [canohost.c addrmatch.c]
5076 Cast socklen_t when comparing to size_t and use socklen_t to iterate over
5077 the ip options, both to prevent signed/unsigned comparison warnings.
5078 Patch from vinschen at redhat via portable openssh, begrudging ok deraadt.
5079
5080commit 293ee3c9f0796d99ebb033735f0e315f2e0180bf
5081Author: Darren Tucker <dtucker@zip.com.au>
5082Date: Sun Jan 19 15:28:01 2014 +1100
5083
5084 - dtucker@cvs.openbsd.org 2014/01/18 09:36:26
5085 [session.c]
5086 explicitly define USE_PIPES to 1 to prevent redefinition warnings in
5087 portable on platforms that use pipes for everything. From redhat @
5088 redhat.
5089
5090commit 2aca159d05f9e7880d1d8f1ce49a218840057f53
5091Author: Darren Tucker <dtucker@zip.com.au>
5092Date: Sun Jan 19 15:25:34 2014 +1100
5093
5094 - dtucker@cvs.openbsd.org 2014/01/17 06:23:24
5095 [sftp-server.c]
5096 fix log message statvfs. ok djm
5097
5098commit 841f7da89ae8b367bb502d61c5c41916c6e7ae4c
5099Author: Darren Tucker <dtucker@zip.com.au>
5100Date: Sat Jan 18 22:12:15 2014 +1100
5101
5102 - (dtucker) [sandbox-capsicum.c] Correct some error messages and make the
5103 return value check for cap_enter() consistent with the other uses in
5104 FreeBSD. From by Loganaden Velvindron @ AfriNIC via bz#2140.
5105
5106commit fdce3731660699b2429e93e822f2ccbaccd163ae
5107Author: Darren Tucker <dtucker@zip.com.au>
5108Date: Sat Jan 18 21:12:42 2014 +1100
5109
5110 - (dtucker) [configure.ac] On Cygwin the getopt variables (like optargs,
5111 optind) are defined in getopt.h already. Unfortunately they are defined as
5112 "declspec(dllimport)" for historical reasons, because the GNU linker didn't
5113 allow auto-import on PE/COFF targets way back when. The problem is the
5114 dllexport attributes collide with the definitions in the various source
5115 files in OpenSSH, which obviousy define the variables without
5116 declspec(dllimport). The least intrusive way to get rid of these warnings
5117 is to disable warnings for GCC compiler attributes when building on Cygwin.
5118 Patch from vinschen at redhat.com.
5119
5120commit 1411c9263f46e1ee49d0d302bf7258ebe69ce827
5121Author: Darren Tucker <dtucker@zip.com.au>
5122Date: Sat Jan 18 21:03:59 2014 +1100
5123
5124 - (dtucker) [openbsd-compat/bsd-cygwin_util.h] Add missing function
5125 declarations that stopped being included when we stopped including
5126 <windows.h> from openbsd-compat/bsd-cygwin_util.h. Patch from vinschen at
5127 redhat.com.
5128
5129commit 89c532d843c95a085777c66365067d64d1937eb9
5130Author: Darren Tucker <dtucker@zip.com.au>
5131Date: Sat Jan 18 20:43:49 2014 +1100
5132
5133 - (dtucker) [uidswap.c] Prevent unused variable warnings on Cygwin. Patch
5134 from vinschen at redhat.com
5135
5136commit 355f861022be7b23d3009fae8f3c9f6f7fc685f7
5137Author: Darren Tucker <dtucker@zip.com.au>
5138Date: Sat Jan 18 00:12:38 2014 +1100
5139
5140 - (dtucker) [defines.h] Move our definitions of uintXX_t types down to after
5141 they're defined if we have to define them ourselves. Fixes builds on old
5142 AIX.
5143
5144commit a3357661ee1d5d553294f36e4940e8285c7f1332
5145Author: Darren Tucker <dtucker@zip.com.au>
5146Date: Sat Jan 18 00:03:57 2014 +1100
5147
5148 - (dtucker) [readconf.c] Wrap paths.h inside an ifdef. Allows building on
5149 Solaris.
5150
5151commit 9edcbff46ff01c8d5dee9c1aa843f09e9ad8a80e
5152Author: Darren Tucker <dtucker@zip.com.au>
5153Date: Fri Jan 17 21:54:32 2014 +1100
5154
5155 - (dtucker) [configure.ac] Have --without-toolchain-hardening not turn off
5156 stack-protector since that has a separate flag that's been around a while.
5157
5158commit 6d725687c490d4ba957a1bbc0ba0a2956c09fa69
5159Author: Darren Tucker <dtucker@zip.com.au>
5160Date: Fri Jan 17 19:17:34 2014 +1100
5161
5162 - (dtucker) [configure.ac] Also look in inttypes.h for uintXX_t types.
5163
5164commit 5055699c7f7c7ef21703a443ec73117da392f6ae
5165Author: Darren Tucker <dtucker@zip.com.au>
5166Date: Fri Jan 17 18:48:22 2014 +1100
5167
5168 - (dtucker) [openbsd-compat/bsd-statvfs.h] Only start including headers if we
5169 need them to cut down on the name collisions.
5170
5171commit a5cf1e220def07290260e4125e74f41ac75cf88d
5172Author: Darren Tucker <dtucker@zip.com.au>
5173Date: Fri Jan 17 18:10:58 2014 +1100
5174
5175 - (dtucker) [configure.ac openbsd-compat/bsd-statvfs.c
5176 openbsd-compat/bsd-statvfs.h] Implement enough of statvfs on top of statfs
5177 to be useful (and for the regression tests to pass) on platforms that
5178 have statfs and fstatfs. ok djm@
5179
5180commit 1357d71d7b6d269969520aaa3e84d312ec971d5b
5181Author: Darren Tucker <dtucker@zip.com.au>
5182Date: Fri Jan 17 18:00:40 2014 +1100
5183
5184 - (dtucker) Fix typo in #ifndef.
5185
5186commit d23a91ffb289d3553a58b7a60cec39fba9f0f506
5187Author: Darren Tucker <dtucker@zip.com.au>
5188Date: Fri Jan 17 17:32:30 2014 +1100
5189
5190 - (dtucker) [configure.ac digest.c openbsd-compat/openssl-compat.c
5191 openbsd-compat/openssl-compat.h] Add compatibility layer for older
5192 openssl versions. ok djm@
5193
5194commit 868ea1ea1c1bfdbee5dbad78f81999c5983ecf31
5195Author: Damien Miller <djm@mindrot.org>
5196Date: Fri Jan 17 16:47:04 2014 +1100
5197
5198 - (djm) [Makefile.in configure.ac sandbox-capsicum.c sandbox-darwin.c]
5199 [sandbox-null.c sandbox-rlimit.c sandbox-seccomp-filter.c]
5200 [sandbox-systrace.c ssh-sandbox.h sshd.c] Support preauth sandboxing
5201 using the Capsicum API introduced in FreeBSD 10. Patch by Dag-Erling
5202 Smorgrav, updated by Loganaden Velvindron @ AfriNIC; ok dtucker@
5203
5204commit a9d186a8b50d18869a10e9203abf71c83ddb1f79
5205Author: Darren Tucker <dtucker@zip.com.au>
5206Date: Fri Jan 17 16:30:49 2014 +1100
5207
5208 - dtucker@cvs.openbsd.org 2014/01/17 05:26:41
5209 [digest.c]
5210 remove unused includes. ok djm@
5211
5212commit 5f1c57a7a7eb39c0e4fee3367712337dbcaef024
5213Author: Darren Tucker <dtucker@zip.com.au>
5214Date: Fri Jan 17 16:29:45 2014 +1100
5215
5216 - djm@cvs.openbsd.org 2014/01/17 00:21:06
5217 [sftp-client.c]
5218 signed/unsigned comparison warning fix; from portable (Id sync only)
5219
5220commit c548722361d89fb12c108528f96b306a26477b18
5221Author: Darren Tucker <dtucker@zip.com.au>
5222Date: Fri Jan 17 15:12:16 2014 +1100
5223
5224 - (dtucker) [configure.ac] Split AC_CHECK_FUNCS for OpenSSL functions into
5225 separate lines and alphabetize for easier diffing of changes.
5226
5227commit acad351a5b1c37de9130c9c1710445cc45a7f6b9
5228Author: Darren Tucker <dtucker@zip.com.au>
5229Date: Fri Jan 17 14:20:05 2014 +1100
5230
5231 - (dtucker) [defines.h] Add typedefs for uintXX_t types for platforms that
5232 don't have them.
5233
5234commit c3ed065ce8417aaa46490836648c173a5010f226
5235Author: Darren Tucker <dtucker@zip.com.au>
5236Date: Fri Jan 17 14:18:45 2014 +1100
5237
5238 - (dtucker) [openbsd-compat/bcrypt_pbkdf.c] Wrap stdlib.h include inside
5239 #ifdef HAVE_STDINT_H.
5240
5241commit f45f78ae437062c7d9506c5f475b7215f486be44
5242Author: Darren Tucker <dtucker@zip.com.au>
5243Date: Fri Jan 17 12:43:43 2014 +1100
5244
5245 - (dtucker) [blocks.c fe25519.c ge25519.c hash.c sc25519.c verify.c] Include
5246 includes.h to pull in all of the compatibility stuff.
5247
5248commit 99df369d0340caac145d57f700d830147ff18b87
5249Author: Darren Tucker <dtucker@zip.com.au>
5250Date: Fri Jan 17 12:42:17 2014 +1100
5251
5252 - (dtucker) [poly1305.c] Wrap stdlib.h include inside #ifdef HAVE_STDINT_H.
5253
5254commit ac413b62ea1957e80c711acbe0c11b908273fc01
5255Author: Darren Tucker <dtucker@zip.com.au>
5256Date: Fri Jan 17 12:31:33 2014 +1100
5257
5258 - (dtucker) [crypto_api.h] Wrap stdlib.h include inside #ifdef HAVE_STDINT_H.
5259
5260commit 1c4a011e9c939e74815346a560843e1862c300b8
5261Author: Darren Tucker <dtucker@zip.com.au>
5262Date: Fri Jan 17 12:23:23 2014 +1100
5263
5264 - (dtucker) [loginrec.c] Cast to the types specfied in the format
5265 specification to prevent warnings.
5266
5267commit c3d483f9a8275be1113535a1e0d0e384f605f3c4
5268Author: Damien Miller <djm@mindrot.org>
5269Date: Fri Jan 17 11:20:26 2014 +1100
5270
5271 - (djm) [sftp-client.c] signed/unsigned comparison fix
5272
5273commit fd994379dd972417d0491767f7cd9b5bf23f4975
5274Author: Darren Tucker <dtucker@zip.com.au>
5275Date: Fri Jan 17 09:53:24 2014 +1100
5276
5277 - (dtucker) [aclocal.m4 configure.ac] Add some additional compiler/toolchain
5278 hardening flags including -fstack-protector-strong. These default to on
5279 if the toolchain supports them, but there is a configure-time knob
5280 (--without-hardening) to disable them if necessary. ok djm@
5281
5282commit 366224d21768ee8ec28cfbcc5fbade1b32582d58
5283Author: Damien Miller <djm@mindrot.org>
5284Date: Thu Jan 16 18:51:44 2014 +1100
5285
5286 - (djm) [README] update release notes URL.
5287
5288commit 2ae77e64f8fa82cbf25c9755e8e847709b978b40
5289Author: Damien Miller <djm@mindrot.org>
5290Date: Thu Jan 16 18:51:07 2014 +1100
5291
5292 - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
5293 [contrib/suse/openssh.spec] Crank RPM spec version numbers.
5294
5295commit 0fa29e6d777c73a1b4ddd3b996b06ee20022ae8a
5296Author: Damien Miller <djm@mindrot.org>
5297Date: Thu Jan 16 18:42:31 2014 +1100
5298
5299 - djm@cvs.openbsd.org 2014/01/16 07:32:00
5300 [version.h]
5301 openssh-6.5
5302
5303commit 52c371cd6d2598cc73d4e633811b3012119c47e2
5304Author: Damien Miller <djm@mindrot.org>
5305Date: Thu Jan 16 18:42:10 2014 +1100
5306
5307 - djm@cvs.openbsd.org 2014/01/16 07:31:09
5308 [sftp-client.c]
5309 needless and incorrect cast to size_t can break resumption of
5310 large download; patch from tobias@
5311
5312commit 91b580e4bec55118bf96ab3cdbe5a50839e75d0a
5313Author: Damien Miller <djm@mindrot.org>
5314Date: Sun Jan 12 19:21:22 2014 +1100
5315
5316 - djm@cvs.openbsd.org 2014/01/12 08:13:13
5317 [bufaux.c buffer.h kex.c kex.h kexc25519.c kexc25519c.c kexc25519s.c]
5318 [kexdhc.c kexdhs.c kexecdhc.c kexecdhs.c kexgexc.c kexgexs.c]
5319 avoid use of OpenSSL BIGNUM type and functions for KEX with
5320 Curve25519 by adding a buffer_put_bignum2_from_string() that stores
5321 a string using the bignum encoding rules. Will make it easier to
5322 build a reduced-feature OpenSSH without OpenSSL in the future;
5323 ok markus@
5324
5325commit af5d4481f4c7c8c3c746e68b961bb85ef907800e
5326Author: Damien Miller <djm@mindrot.org>
5327Date: Sun Jan 12 19:20:47 2014 +1100
5328
5329 - djm@cvs.openbsd.org 2014/01/10 05:59:19
5330 [sshd_config]
5331 the /etc/ssh/ssh_host_ed25519_key is loaded by default too
5332
5333commit 58cd63bc63038acddfb4051ed14e11179d8f4941
5334Author: Damien Miller <djm@mindrot.org>
5335Date: Fri Jan 10 10:59:24 2014 +1100
5336
5337 - djm@cvs.openbsd.org 2014/01/09 23:26:48
5338 [sshconnect.c sshd.c]
5339 ban clients/servers that suffer from SSH_BUG_DERIVEKEY, they are ancient,
5340 deranged and might make some attacks on KEX easier; ok markus@
5341
5342commit b3051d01e505c9c2dc00faab472a0d06fa6b0e65
5343Author: Damien Miller <djm@mindrot.org>
5344Date: Fri Jan 10 10:58:53 2014 +1100
5345
5346 - djm@cvs.openbsd.org 2014/01/09 23:20:00
5347 [digest.c digest.h hostfile.c kex.c kex.h kexc25519.c kexc25519c.c]
5348 [kexc25519s.c kexdh.c kexecdh.c kexecdhc.c kexecdhs.c kexgex.c kexgexc.c]
5349 [kexgexs.c key.c key.h roaming_client.c roaming_common.c schnorr.c]
5350 [schnorr.h ssh-dss.c ssh-ecdsa.c ssh-rsa.c sshconnect2.c]
5351 Introduce digest API and use it to perform all hashing operations
5352 rather than calling OpenSSL EVP_Digest* directly. Will make it easier
5353 to build a reduced-feature OpenSSH without OpenSSL in future;
5354 feedback, ok markus@
5355
5356commit e00e413dd16eb747fb2c15a099971d91c13cf70f
5357Author: Damien Miller <djm@mindrot.org>
5358Date: Fri Jan 10 10:40:45 2014 +1100
5359
5360 - guenther@cvs.openbsd.org 2014/01/09 03:26:00
5361 [sftp-common.c]
5362 When formating the time for "ls -l"-style output, show dates in the future
5363 with the year, and rearrange a comparison to avoid a potentional signed
5364 arithmetic overflow that would give the wrong result.
5365
5366 ok djm@
5367
5368commit 3e49853650448883685cfa32fa382d0ba6d51d48
5369Author: Damien Miller <djm@mindrot.org>
5370Date: Fri Jan 10 10:37:05 2014 +1100
5371
5372 - tedu@cvs.openbsd.org 2014/01/04 17:50:55
5373 [mac.c monitor_mm.c monitor_mm.h xmalloc.c]
5374 use standard types and formats for size_t like variables. ok dtucker
5375
5376commit a9c1e500ef609795cbc662848edb1a1dca279c81
5377Author: Damien Miller <djm@mindrot.org>
5378Date: Wed Jan 8 16:13:12 2014 +1100
5379
5380 - (djm) [regress/.cvsignore] Ignore regress test droppings; ok dtucker@
5381
5382commit 324541e5264e1489ca0babfaf2b39612eb80dfb3
5383Author: Damien Miller <djm@mindrot.org>
5384Date: Tue Dec 31 12:25:40 2013 +1100
5385
5386 - djm@cvs.openbsd.org 2013/12/30 23:52:28
5387 [auth2-hostbased.c auth2-pubkey.c compat.c compat.h ssh-rsa.c]
5388 [sshconnect.c sshconnect2.c sshd.c]
5389 refuse RSA keys from old proprietary clients/servers that use the
5390 obsolete RSA+MD5 signature scheme. it will still be possible to connect
5391 with these clients/servers but only DSA keys will be accepted, and we'll
5392 deprecate them entirely in a future release. ok markus@
5393
5394commit 9f4c8e797ea002a883307ca906f1f1f815010e78
5395Author: Damien Miller <djm@mindrot.org>
5396Date: Sun Dec 29 17:57:46 2013 +1100
5397
5398 - (djm) [regress/Makefile] Add some generated files for cleaning
5399
5400commit 106bf1ca3c7a5fdc34f9fd7a1fe651ca53085bc5
5401Author: Damien Miller <djm@mindrot.org>
5402Date: Sun Dec 29 17:54:03 2013 +1100
5403
5404 - djm@cvs.openbsd.org 2013/12/29 05:57:02
5405 [sshconnect.c]
5406 when showing other hostkeys, don't forget Ed25519 keys
5407
5408commit 0fa47cfb32c239117632cab41e4db7d3e6de5e91
5409Author: Damien Miller <djm@mindrot.org>
5410Date: Sun Dec 29 17:53:39 2013 +1100
5411
5412 - djm@cvs.openbsd.org 2013/12/29 05:42:16
5413 [ssh.c]
5414 don't forget to load Ed25519 certs too
5415
5416commit b9a95490daa04cc307589897f95bfaff324ad2c9
5417Author: Damien Miller <djm@mindrot.org>
5418Date: Sun Dec 29 17:50:15 2013 +1100
5419
5420 - djm@cvs.openbsd.org 2013/12/29 04:35:50
5421 [authfile.c]
5422 don't refuse to load Ed25519 certificates
5423
5424commit f72cdde6e6fabc51d2a62f4e75b8b926d9d7ee89
5425Author: Damien Miller <djm@mindrot.org>
5426Date: Sun Dec 29 17:49:55 2013 +1100
5427
5428 - djm@cvs.openbsd.org 2013/12/29 04:29:25
5429 [authfd.c]
5430 allow deletion of ed25519 keys from the agent
5431
5432commit 29ace1cb68cc378a464c72c0fd67aa5f9acd6b5b
5433Author: Damien Miller <djm@mindrot.org>
5434Date: Sun Dec 29 17:49:31 2013 +1100
5435
5436 - djm@cvs.openbsd.org 2013/12/29 04:20:04
5437 [key.c]
5438 to make sure we don't omit any key types as valid CA keys again,
5439 factor the valid key type check into a key_type_is_valid_ca()
5440 function
5441
5442commit 9de4fcdc5a9cff48d49a3e2f6194d3fb2d7ae34d
5443Author: Damien Miller <djm@mindrot.org>
5444Date: Sun Dec 29 17:49:13 2013 +1100
5445
5446 - djm@cvs.openbsd.org 2013/12/29 02:49:52
5447 [key.c]
5448 correct comment for key_drop_cert()
5449
5450commit 5baeacf8a80f054af40731c6f92435f9164b8e02
5451Author: Damien Miller <djm@mindrot.org>
5452Date: Sun Dec 29 17:48:55 2013 +1100
5453
5454 - djm@cvs.openbsd.org 2013/12/29 02:37:04
5455 [key.c]
5456 correct comment for key_to_certified()
5457
5458commit 83f2fe26cb19330712c952eddbd3c0b621674adc
5459Author: Damien Miller <djm@mindrot.org>
5460Date: Sun Dec 29 17:48:38 2013 +1100
5461
5462 - djm@cvs.openbsd.org 2013/12/29 02:28:10
5463 [key.c]
5464 allow ed25519 keys to appear as certificate authorities
5465
5466commit 06122e9a74bb488b0fe0a8f64e1135de870f9cc0
5467Author: Damien Miller <djm@mindrot.org>
5468Date: Sun Dec 29 17:48:15 2013 +1100
5469
5470 - djm@cvs.openbsd.org 2013/12/27 22:37:18
5471 [ssh-rsa.c]
5472 correct comment
5473
5474commit 3e19295c3a253c8dc8660cf45baad7f45fccb969
5475Author: Damien Miller <djm@mindrot.org>
5476Date: Sun Dec 29 17:47:50 2013 +1100
5477
5478 - djm@cvs.openbsd.org 2013/12/27 22:30:17
5479 [ssh-dss.c ssh-ecdsa.c ssh-rsa.c]
5480 make the original RSA and DSA signing/verification code look more like
5481 the ECDSA/Ed25519 ones: use key_type_plain() when checking the key type
5482 rather than tediously listing all variants, use __func__ for debug/
5483 error messages
5484
5485commit 137977180be6254639e2c90245763e6965f8d815
5486Author: Damien Miller <djm@mindrot.org>
5487Date: Sun Dec 29 17:47:14 2013 +1100
5488
5489 - tedu@cvs.openbsd.org 2013/12/21 07:10:47
5490 [ssh-keygen.1]
5491 small typo
5492
5493commit 339a48fe7ffb3186d22bbaa9efbbc3a053e602fd
5494Author: Damien Miller <djm@mindrot.org>
5495Date: Sun Dec 29 17:46:49 2013 +1100
5496
5497 - djm@cvs.openbsd.org 2013/12/19 22:57:13
5498 [poly1305.c poly1305.h]
5499 use full name for author, with his permission
5500
5501commit 0b36c83148976c7c8268f4f41497359e2fb26251
5502Author: Damien Miller <djm@mindrot.org>
5503Date: Sun Dec 29 17:45:51 2013 +1100
5504
5505 - djm@cvs.openbsd.org 2013/12/19 01:19:41
5506 [ssh-agent.c]
5507 bz#2186: don't crash (NULL deref) when deleting PKCS#11 keys from an agent
5508 that has a mix of normal and PKCS#11 keys; fix from jay AT slushpupie.com;
5509 ok dtucker
5510
5511commit 4def184e9b6c36be6d965a9705632fc4c0c2a8af
5512Author: Damien Miller <djm@mindrot.org>
5513Date: Sun Dec 29 17:45:26 2013 +1100
5514
5515 - djm@cvs.openbsd.org 2013/12/19 01:04:36
5516 [channels.c]
5517 bz#2147: fix multiple remote forwardings with dynamically assigned
5518 listen ports. In the s->c message to open the channel we were sending
5519 zero (the magic number to request a dynamic port) instead of the actual
5520 listen port. The client therefore had no way of discriminating between
5521 them.
5522
5523 Diagnosis and fix by ronf AT timeheart.net
5524
5525commit bf25d114e23a803f8feca8926281b1aaedb6191b
5526Author: Damien Miller <djm@mindrot.org>
5527Date: Sun Dec 29 17:44:56 2013 +1100
5528
5529 - djm@cvs.openbsd.org 2013/12/19 00:27:57
5530 [auth-options.c]
5531 simplify freeing of source-address certificate restriction
5532
5533commit bb3dafe7024a5b4e851252e65ee35d45b965e4a8
5534Author: Damien Miller <djm@mindrot.org>
5535Date: Sun Dec 29 17:44:29 2013 +1100
5536
5537 - dtucker@cvs.openbsd.org 2013/12/19 00:19:12
5538 [serverloop.c]
5539 Cast client_alive_interval to u_int64_t before assinging to
5540 max_time_milliseconds to avoid potential integer overflow in the timeout.
5541 bz#2170, patch from Loganaden Velvindron, ok djm@
5542
5543commit ef275ead3dcadde4db1efe7a0aa02b5e618ed40c
5544Author: Damien Miller <djm@mindrot.org>
5545Date: Sun Dec 29 17:44:07 2013 +1100
5546
5547 - djm@cvs.openbsd.org 2013/12/19 00:10:30
5548 [ssh-add.c]
5549 skip requesting smartcard PIN when removing keys from agent; bz#2187
5550 patch from jay AT slushpupie.com; ok dtucker
5551
5552commit 7d97fd9a1cae778c3eacf16e09f5da3689d616c6
5553Author: Damien Miller <djm@mindrot.org>
5554Date: Sun Dec 29 17:40:18 2013 +1100
5555
5556 - (djm) [loginrec.c] Check for username truncation when looking up lastlog
5557 entries
5558
5559commit 77244afe3b6d013b485e0952eaab89b9db83380f
5560Author: Darren Tucker <dtucker@zip.com.au>
5561Date: Sat Dec 21 17:02:39 2013 +1100
5562
5563 20131221
5564 - (dtucker) [regress/keytype.sh] Actually test ecdsa key types.
5565
5566commit 53f8e784dc431a82d31c9b0e95b144507f9330e9
5567Author: Darren Tucker <dtucker@zip.com.au>
5568Date: Thu Dec 19 11:31:44 2013 +1100
5569
5570 - (dtucker) [auth-pam.c] bz#2163: check return value from pam_get_item().
5571 Patch from Loganaden Velvindron.
5572
5573commit 1fcec9d4f265e38af248c4c845986ca8c174bd68
5574Author: Darren Tucker <dtucker@zip.com.au>
5575Date: Thu Dec 19 11:00:12 2013 +1100
5576
5577 - (dtucker) [configure.ac] bz#2178: Don't try to use BSM on Solaris versions
5578 greater than 11 either rather than just 11. Patch from Tomas Kuthan.
5579
5580commit 6674eb9683afd1ea4eb35670b5e66815543a759e
5581Author: Damien Miller <djm@mindrot.org>
5582Date: Wed Dec 18 17:50:39 2013 +1100
5583
5584 - markus@cvs.openbsd.org 2013/12/17 10:36:38
5585 [crypto_api.h]
5586 I've assempled the header file by cut&pasting from generated headers
5587 and the source files.
5588
5589commit d58a5964426ee014384d67d775d16712e93057f3
5590Author: Damien Miller <djm@mindrot.org>
5591Date: Wed Dec 18 17:50:13 2013 +1100
5592
5593 - djm@cvs.openbsd.org 2013/12/15 21:42:35
5594 [cipher-chachapoly.c]
5595 add some comments and constify a constant
5596
5597commit 059321d19af24d87420de3193f79dfab23556078
5598Author: Damien Miller <djm@mindrot.org>
5599Date: Wed Dec 18 17:49:48 2013 +1100
5600
5601 - pascal@cvs.openbsd.org 2013/12/15 18:17:26
5602 [ssh-add.c]
5603 Make ssh-add also add .ssh/id_ed25519; fixes lie in manual page.
5604 ok markus@
5605
5606commit 155b5a5bf158767f989215479ded2a57f331e1c6
5607Author: Damien Miller <djm@mindrot.org>
5608Date: Wed Dec 18 17:48:32 2013 +1100
5609
5610 - markus@cvs.openbsd.org 2013/12/09 11:08:17
5611 [crypto_api.h]
5612 remove unused defines
5613
5614commit 8a56dc2b6b48b05590810e7f4c3567508410000c
5615Author: Damien Miller <djm@mindrot.org>
5616Date: Wed Dec 18 17:48:11 2013 +1100
5617
5618 - markus@cvs.openbsd.org 2013/12/09 11:03:45
5619 [blocks.c ed25519.c fe25519.c fe25519.h ge25519.c ge25519.h]
5620 [ge25519_base.data hash.c sc25519.c sc25519.h verify.c]
5621 Add Authors for the public domain ed25519/nacl code.
5622 see also http://nacl.cr.yp.to/features.html
5623 All of the NaCl software is in the public domain.
5624 and http://ed25519.cr.yp.to/software.html
5625 The Ed25519 software is in the public domain.
5626
5627commit 6575c3acf31fca117352f31f37b16ae46e664837
5628Author: Damien Miller <djm@mindrot.org>
5629Date: Wed Dec 18 17:47:02 2013 +1100
5630
5631 - dtucker@cvs.openbsd.org 2013/12/08 09:53:27
5632 [sshd_config.5]
5633 Use a literal for the default value of KEXAlgorithms. ok deraadt jmc
5634
5635commit 8ba0ead6985ea14999265136b14ffd5aeec516f9
5636Author: Damien Miller <djm@mindrot.org>
5637Date: Wed Dec 18 17:46:27 2013 +1100
5638
5639 - naddy@cvs.openbsd.org 2013/12/07 11:58:46
5640 [ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh-keysign.8 ssh.1]
5641 [ssh_config.5 sshd.8 sshd_config.5]
5642 add missing mentions of ed25519; ok djm@
5643
5644commit 4f752cf71cf44bf4bc777541156c2bf56daf9ce9
5645Author: Damien Miller <djm@mindrot.org>
5646Date: Wed Dec 18 17:45:35 2013 +1100
5647
5648 - djm@cvs.openbsd.org 2013/12/07 08:08:26
5649 [ssh-keygen.1]
5650 document -a and -o wrt new key format
5651
5652commit 6d6fcd14e23a9053198342bb379815b15e504084
5653Author: Damien Miller <djm@mindrot.org>
5654Date: Sun Dec 8 15:53:28 2013 +1100
5655
5656 - (djm) [Makefile.in regress/Makefile regress/agent-ptrace.sh]
5657 [regress/setuid-allowed.c] Check that ssh-agent is not on a no-setuid
5658 filesystem before running agent-ptrace.sh; ok dtucker
5659
5660commit 7e6e42fb532c7dafd7078ef5e9e2d3e47fcf6752
5661Author: Damien Miller <djm@mindrot.org>
5662Date: Sun Dec 8 08:23:08 2013 +1100
5663
5664 - (djm) [openbsd-compat/bsd-setres_id.c] Missing header; from Corinna
5665 Vinschen
5666
5667commit da3ca351b49d52ae85db2e3998265dc3c6617068
5668Author: Damien Miller <djm@mindrot.org>
5669Date: Sat Dec 7 21:43:46 2013 +1100
5670
5671 - (djm) [Makefile.in] PATHSUBS and keygen bits for Ed25519; from
5672 Loganaden Velvindron @ AfriNIC in bz#2179
5673
5674commit eb401585bb8336cbf81fe4fc58eb9f7cac3ab874
5675Author: Damien Miller <djm@mindrot.org>
5676Date: Sat Dec 7 17:07:15 2013 +1100
5677
5678 - (djm) [regress/cert-hostkey.sh] Fix merge botch
5679
5680commit f54542af3ad07532188b10136ae302314ec69ed6
5681Author: Damien Miller <djm@mindrot.org>
5682Date: Sat Dec 7 16:32:44 2013 +1100
5683
5684 - markus@cvs.openbsd.org 2013/12/06 13:52:46
5685 [regress/Makefile regress/agent.sh regress/cert-hostkey.sh]
5686 [regress/cert-userkey.sh regress/keytype.sh]
5687 test ed25519 support; from djm@
5688
5689commit f104da263de995f66b6861b4f3368264ee483d7f
5690Author: Damien Miller <djm@mindrot.org>
5691Date: Sat Dec 7 12:37:53 2013 +1100
5692
5693 - (djm) [ed25519.c ssh-ed25519.c openbsd-compat/Makefile.in]
5694 [openbsd-compat/bcrypt_pbkdf.c] Make ed25519/new key format compile on
5695 Linux
5696
5697commit 1ff130dac9b7aea0628f4ad30683431fe35e0020
5698Author: Damien Miller <djm@mindrot.org>
5699Date: Sat Dec 7 11:51:51 2013 +1100
5700
5701 - [configure.ac openbsd-compat/Makefile.in openbsd-compat/bcrypt_pbkdf.c]
5702 [openbsd-compat/blf.h openbsd-compat/blowfish.c]
5703 [openbsd-compat/openbsd-compat.h] Start at supporting bcrypt_pbkdf in
5704 portable.
5705
5706commit 4260828a2958ebe8c96f66d8301dac53f4cde556
5707Author: Damien Miller <djm@mindrot.org>
5708Date: Sat Dec 7 11:38:03 2013 +1100
5709
5710 - [authfile.c] Conditionalise inclusion of util.h
5711
5712commit a913442bac8a26fd296a3add51293f8f6f9b3b4c
5713Author: Damien Miller <djm@mindrot.org>
5714Date: Sat Dec 7 11:35:36 2013 +1100
5715
5716 - [Makefile.in] Add ed25519 sources
5717
5718commit ca570a519cb846da61d002c7f46fa92e39c83e45
5719Author: Damien Miller <djm@mindrot.org>
5720Date: Sat Dec 7 11:29:09 2013 +1100
5721
5722 - djm@cvs.openbsd.org 2013/12/07 00:19:15
5723 [key.c]
5724 set k->cert = NULL after freeing it
5725
5726commit 3cccc0e155229a2f2d86b6df40bd4559b4f960ff
5727Author: Damien Miller <djm@mindrot.org>
5728Date: Sat Dec 7 11:27:47 2013 +1100
5729
5730 - [blocks.c ed25519.c fe25519.c fe25519.h ge25519.c ge25519.h]
5731 [ge25519_base.data hash.c sc25519.c sc25519.h verify.c] Fix RCS idents
5732
5733commit a7827c11b3f0380b7e593664bd62013ff9c131db
5734Author: Damien Miller <djm@mindrot.org>
5735Date: Sat Dec 7 11:24:30 2013 +1100
5736
5737 - jmc@cvs.openbsd.org 2013/12/06 15:29:07
5738 [sshd.8]
5739 missing comma;
5740
5741commit 5be9d9e3cbd9c66f24745d25bf2e809c1d158ee0
5742Author: Damien Miller <djm@mindrot.org>
5743Date: Sat Dec 7 11:24:01 2013 +1100
5744
5745 - markus@cvs.openbsd.org 2013/12/06 13:39:49
5746 [authfd.c authfile.c key.c key.h myproposal.h pathnames.h readconf.c]
5747 [servconf.c ssh-agent.c ssh-keygen.c ssh-keyscan.1 ssh-keyscan.c]
5748 [ssh-keysign.c ssh.c ssh_config.5 sshd.8 sshd.c verify.c ssh-ed25519.c]
5749 [sc25519.h sc25519.c hash.c ge25519_base.data ge25519.h ge25519.c]
5750 [fe25519.h fe25519.c ed25519.c crypto_api.h blocks.c]
5751 support ed25519 keys (hostkeys and user identities) using the public
5752 domain ed25519 reference code from SUPERCOP, see
5753 http://ed25519.cr.yp.to/software.html
5754 feedback, help & ok djm@
5755
5756commit bcd00abd8451f36142ae2ee10cc657202149201e
5757Author: Damien Miller <djm@mindrot.org>
5758Date: Sat Dec 7 10:41:55 2013 +1100
5759
5760 - markus@cvs.openbsd.org 2013/12/06 13:34:54
5761 [authfile.c authfile.h cipher.c cipher.h key.c packet.c ssh-agent.c]
5762 [ssh-keygen.c PROTOCOL.key] new private key format, bcrypt as KDF by
5763 default; details in PROTOCOL.key; feedback and lots help from djm;
5764 ok djm@
5765
5766commit f0e9060d236c0e38bec2fa1c6579fb0a2ea6458d
5767Author: Damien Miller <djm@mindrot.org>
5768Date: Sat Dec 7 10:40:26 2013 +1100
5769
5770 - markus@cvs.openbsd.org 2013/12/06 13:30:08
5771 [authfd.c key.c key.h ssh-agent.c]
5772 move private key (de)serialization to key.c; ok djm
5773
5774commit 0f8536da23a6ef26e6495177c0d8a4242b710289
5775Author: Damien Miller <djm@mindrot.org>
5776Date: Sat Dec 7 10:31:37 2013 +1100
5777
5778 - djm@cvs.openbsd.org 2013/12/06 03:40:51
5779 [ssh-keygen.c]
5780 remove duplicated character ('g') in getopt() string;
5781 document the (few) remaining option characters so we don't have to
5782 rummage next time.
5783
5784commit 393920745fd328d3fe07f739a3cf7e1e6db45b60
5785Author: Damien Miller <djm@mindrot.org>
5786Date: Sat Dec 7 10:31:08 2013 +1100
5787
5788 - djm@cvs.openbsd.org 2013/12/05 22:59:45
5789 [sftp-client.c]
5790 fix memory leak in error path in do_readdir(); pointed out by
5791 Loganaden Velvindron @ AfriNIC in bz#2163
5792
5793commit 534b2ccadea5e5e9a8b27226e6faac3ed5552e97
5794Author: Damien Miller <djm@mindrot.org>
5795Date: Thu Dec 5 14:07:27 2013 +1100
5796
5797 - djm@cvs.openbsd.org 2013/12/05 01:16:41
5798 [servconf.c servconf.h]
5799 bz#2161 - fix AuthorizedKeysCommand inside a Match block and
5800 rearrange things so the same error is harder to make next time;
5801 with and ok dtucker@
5802
5803commit 8369c8e61a3408ec6bb75755fad4ffce29b5fdbe
5804Author: Darren Tucker <dtucker@zip.com.au>
5805Date: Thu Dec 5 11:00:16 2013 +1100
5806
5807 - (dtucker) [configure.ac] bz#2173: use pkg-config --libs to include correct
5808 -L location for libedit. Patch from Serge van den Boom.
5809
5810commit 9275df3e0a2a3bc3897f7d664ea86a425c8a092d
5811Author: Damien Miller <djm@mindrot.org>
5812Date: Thu Dec 5 10:26:32 2013 +1100
5813
5814 - djm@cvs.openbsd.org 2013/12/04 04:20:01
5815 [sftp-client.c]
5816 bz#2171: don't leak local_fd on error; from Loganaden Velvindron @
5817 AfriNIC
5818
5819commit 960f6a2b5254e4da082d8aa3700302ed12dc769a
5820Author: Damien Miller <djm@mindrot.org>
5821Date: Thu Dec 5 10:26:14 2013 +1100
5822
5823 - djm@cvs.openbsd.org 2013/12/02 03:13:14
5824 [cipher.c]
5825 correct bzero of chacha20+poly1305 key context. bz#2177 from
5826 Loganaden Velvindron @ AfriNIC
5827
5828 Also make it a memset for consistency with the rest of cipher.c
5829
5830commit f7e8a8796d661c9d6692ab837e1effd4f5ada1c2
5831Author: Damien Miller <djm@mindrot.org>
5832Date: Thu Dec 5 10:25:51 2013 +1100
5833
5834 - djm@cvs.openbsd.org 2013/12/02 03:09:22
5835 [key.c]
5836 make key_to_blob() return a NULL blob on failure; part of
5837 bz#2175 from Loganaden Velvindron @ AfriNIC
5838
5839commit f1e44ea9d9a6d4c1a95a0024132e603bd1778c9c
5840Author: Damien Miller <djm@mindrot.org>
5841Date: Thu Dec 5 10:23:21 2013 +1100
5842
5843 - djm@cvs.openbsd.org 2013/12/02 02:56:17
5844 [ssh-pkcs11-helper.c]
5845 use-after-free; bz#2175 patch from Loganaden Velvindron @ AfriNIC
5846
5847commit 114e540b15d57618f9ebf624264298f80bbd8c77
5848Author: Damien Miller <djm@mindrot.org>
5849Date: Thu Dec 5 10:22:57 2013 +1100
5850
5851 - djm@cvs.openbsd.org 2013/12/02 02:50:27
5852 [PROTOCOL.chacha20poly1305]
5853 typo; from Jon Cave
5854
5855commit e4870c090629e32f2cb649dc16d575eeb693f4a8
5856Author: Damien Miller <djm@mindrot.org>
5857Date: Thu Dec 5 10:22:39 2013 +1100
5858
5859 - djm@cvs.openbsd.org 2013/12/01 23:19:05
5860 [PROTOCOL]
5861 mention curve25519-sha256@libssh.org key exchange algorithm
5862
5863commit 1d2f8804a6d33a4e908b876b2e1266b8260ec76b
5864Author: Damien Miller <djm@mindrot.org>
5865Date: Thu Dec 5 10:22:03 2013 +1100
5866
5867 - deraadt@cvs.openbsd.org 2013/11/26 19:15:09
5868 [pkcs11.h]
5869 cleanup 1 << 31 idioms. Resurrection of this issue pointed out by
5870 Eitan Adler ok markus for ssh, implies same change in kerberosV
5871
5872commit bdb352a54f82df94a548e3874b22f2d6ae90328d
5873Author: Damien Miller <djm@mindrot.org>
5874Date: Thu Dec 5 10:20:52 2013 +1100
5875
5876 - jmc@cvs.openbsd.org 2013/11/26 12:14:54
5877 [ssh.1 ssh.c]
5878 - put -Q in the right place
5879 - Ar was a poor choice for the arguments to -Q. i've chosen an
5880 admittedly equally poor Cm, at least consistent with the rest
5881 of the docs. also no need for multiple instances
5882 - zap a now redundant Nm
5883 - usage() sync
5884
5885commit d937dc084a087090f1cf5395822c3ac958d33759
5886Author: Damien Miller <djm@mindrot.org>
5887Date: Thu Dec 5 10:19:54 2013 +1100
5888
5889 - deraadt@cvs.openbsd.org 2013/11/25 18:04:21
5890 [ssh.1 ssh.c]
5891 improve -Q usage and such. One usage change is that the option is now
5892 case-sensitive
5893 ok dtucker markus djm
5894
5895commit dec0393f7ee8aabc7d9d0fc2c5fddb4bc649112e
5896Author: Damien Miller <djm@mindrot.org>
5897Date: Thu Dec 5 10:18:43 2013 +1100
5898
5899 - jmc@cvs.openbsd.org 2013/11/21 08:05:09
5900 [ssh_config.5 sshd_config.5]
5901 no need for .Pp before displays;
5902
5903commit 8a073cf57940aabf85e49799f89f5d5e9b072c1b
5904Author: Damien Miller <djm@mindrot.org>
5905Date: Thu Nov 21 14:26:18 2013 +1100
5906
5907 - djm@cvs.openbsd.org 2013/11/21 03:18:51
5908 [regress/cipher-speed.sh regress/integrity.sh regress/rekey.sh]
5909 [regress/try-ciphers.sh]
5910 use new "ssh -Q cipher-auth" query to obtain lists of authenticated
5911 encryption ciphers instead of specifying them manually; ensures that
5912 the new chacha20poly1305@openssh.com mode is tested;
5913
5914 ok markus@ and naddy@ as part of the diff to add
5915 chacha20poly1305@openssh.com
5916
5917commit ea61b2179f63d48968dd2c9617621002bb658bfe
5918Author: Damien Miller <djm@mindrot.org>
5919Date: Thu Nov 21 14:25:15 2013 +1100
5920
5921 - djm@cvs.openbsd.org 2013/11/21 03:16:47
5922 [regress/modpipe.c]
5923 use unsigned long long instead of u_int64_t here to avoid warnings
5924 on some systems portable OpenSSH is built on.
5925
5926commit 36aba25b0409d2db6afc84d54bc47a2532d38424
5927Author: Damien Miller <djm@mindrot.org>
5928Date: Thu Nov 21 14:24:42 2013 +1100
5929
5930 - djm@cvs.openbsd.org 2013/11/21 03:15:46
5931 [regress/krl.sh]
5932 add some reminders for additional tests that I'd like to implement
5933
5934commit fa7a20bc289f09b334808d988746bc260a2f60c9
5935Author: Damien Miller <djm@mindrot.org>
5936Date: Thu Nov 21 14:24:08 2013 +1100
5937
5938 - naddy@cvs.openbsd.org 2013/11/18 05:09:32
5939 [regress/forward-control.sh]
5940 bump timeout to 10 seconds to allow slow machines (e.g. Alpha PC164)
5941 to successfully run this; ok djm@
5942 (ID sync only; our timeouts are already longer)
5943
5944commit 0fde8acdad78a4d20cadae974376cc0165f645ee
5945Author: Damien Miller <djm@mindrot.org>
5946Date: Thu Nov 21 14:12:23 2013 +1100
5947
5948 - djm@cvs.openbsd.org 2013/11/21 00:45:44
5949 [Makefile.in PROTOCOL PROTOCOL.chacha20poly1305 authfile.c chacha.c]
5950 [chacha.h cipher-chachapoly.c cipher-chachapoly.h cipher.c cipher.h]
5951 [dh.c myproposal.h packet.c poly1305.c poly1305.h servconf.c ssh.1]
5952 [ssh.c ssh_config.5 sshd_config.5] Add a new protocol 2 transport
5953 cipher "chacha20-poly1305@openssh.com" that combines Daniel
5954 Bernstein's ChaCha20 stream cipher and Poly1305 MAC to build an
5955 authenticated encryption mode.
5956
5957 Inspired by and similar to Adam Langley's proposal for TLS:
5958 http://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-03
5959 but differs in layout used for the MAC calculation and the use of a
5960 second ChaCha20 instance to separately encrypt packet lengths.
5961 Details are in the PROTOCOL.chacha20poly1305 file.
5962
5963 Feedback markus@, naddy@; manpage bits Loganden Velvindron @ AfriNIC
5964 ok markus@ naddy@
5965
5966commit fdb2306acdc3eb2bc46b6dfdaaf6005c650af22a
5967Author: Damien Miller <djm@mindrot.org>
5968Date: Thu Nov 21 13:57:15 2013 +1100
5969
5970 - deraadt@cvs.openbsd.org 2013/11/20 20:54:10
5971 [canohost.c clientloop.c match.c readconf.c sftp.c]
5972 unsigned casts for ctype macros where neccessary
5973 ok guenther millert markus
5974
5975commit e00167307e4d3692695441e9bd712f25950cb894
5976Author: Damien Miller <djm@mindrot.org>
5977Date: Thu Nov 21 13:56:49 2013 +1100
5978
5979 - deraadt@cvs.openbsd.org 2013/11/20 20:53:10
5980 [scp.c]
5981 unsigned casts for ctype macros where neccessary
5982 ok guenther millert markus
5983
5984commit 23e00aa6ba9eee0e0c218f2026bf405ad4625832
5985Author: Damien Miller <djm@mindrot.org>
5986Date: Thu Nov 21 13:56:28 2013 +1100
5987
5988 - djm@cvs.openbsd.org 2013/11/20 02:19:01
5989 [sshd.c]
5990 delay closure of in/out fds until after "Bad protocol version
5991 identification..." message, as get_remote_ipaddr/get_remote_port
5992 require them open.
5993
5994commit 867e6934be6521f87f04a5ab86702e2d1b314245
5995Author: Damien Miller <djm@mindrot.org>
5996Date: Thu Nov 21 13:56:06 2013 +1100
5997
5998 - markus@cvs.openbsd.org 2013/11/13 13:48:20
5999 [ssh-pkcs11.c]
6000 add missing braces found by pedro
6001
6002commit 0600c7020f4fe68a780bd7cf21ff541a8d4b568a
6003Author: Damien Miller <djm@mindrot.org>
6004Date: Thu Nov 21 13:55:43 2013 +1100
6005
6006 - dtucker@cvs.openbsd.org 2013/11/08 11:15:19
6007 [bufaux.c bufbn.c buffer.c sftp-client.c sftp-common.c sftp-glob.c]
6008 [uidswap.c] Include stdlib.h for free() as per the man page.
6009
6010commit b6a75b0b93b8faa6f79c3a395ab6c71f3f880b80
6011Author: Darren Tucker <dtucker@zip.com.au>
6012Date: Sun Nov 10 20:25:22 2013 +1100
6013
6014 - (dtucker) [regress/keytype.sh] Populate ECDSA key types to be tested by
6015 querying the ones that are compiled in.
6016
6017commit 2c89430119367eb1bc96ea5ee55de83357e4c926
6018Author: Darren Tucker <dtucker@zip.com.au>
6019Date: Sun Nov 10 12:38:42 2013 +1100
6020
6021 - (dtucker) [key.c] Check for the correct defines for NID_secp521r1.
6022
6023commit dd5264db5f641dbd03186f9e5e83e4b14b3d0003
6024Author: Darren Tucker <dtucker@zip.com.au>
6025Date: Sat Nov 9 22:32:51 2013 +1100
6026
6027 - (dtucker) [configure.ac] Add missing "test".
6028
6029commit 95cb2d4eb08117be061f3ff076adef3e9a5372c3
6030Author: Darren Tucker <dtucker@zip.com.au>
6031Date: Sat Nov 9 22:02:31 2013 +1100
6032
6033 - (dtucker) [configure.ac] Fix brackets in NID_secp521r1 test.
6034
6035commit 37bcef51b3d9d496caecea6394814d2f49a1357f
6036Author: Darren Tucker <dtucker@zip.com.au>
6037Date: Sat Nov 9 18:39:25 2013 +1100
6038
6039 - (dtucker) [configure.ac kex.c key.c myproposal.h] Test for the presence of
6040 NID_X9_62_prime256v1, NID_secp384r1 and NID_secp521r1 and test that the
6041 latter actually works before using it. Fedora (at least) has NID_secp521r1
6042 that doesn't work (see https://bugzilla.redhat.com/show_bug.cgi?id=1021897).
6043
6044commit 6e2fe81f926d995bae4be4a6b5b3c88c1c525187
6045Author: Darren Tucker <dtucker@zip.com.au>
6046Date: Sat Nov 9 16:55:03 2013 +1100
6047
6048 - dtucker@cvs.openbsd.org 2013/11/09 05:41:34
6049 [regress/test-exec.sh regress/rekey.sh]
6050 Use smaller test data files to speed up tests. Grow test datafiles
6051 where necessary for a specific test.
6052
6053commit aff7ef1bb8b7c1eeb1f4812129091c5adbf51848
6054Author: Darren Tucker <dtucker@zip.com.au>
6055Date: Sat Nov 9 00:19:22 2013 +1100
6056
6057 - (dtucker) [contrib/cygwin/ssh-host-config] Simplify host key generation:
6058 rather than testing and generating each key, call ssh-keygen -A.
6059 Patch from vinschen at redhat.com.
6060
6061commit 882abfd3fb3c98cfe70b4fc79224770468b570a5
6062Author: Darren Tucker <dtucker@zip.com.au>
6063Date: Sat Nov 9 00:17:41 2013 +1100
6064
6065 - (dtucker) [Makefile.in configure.ac] Set MALLOC_OPTIONS per platform
6066 and pass in TEST_ENV. Unknown options cause stderr to get polluted
6067 and the stderr-data test to fail.
6068
6069commit 8c333ec23bdf7da917aa20ac6803a2cdd79182c5
6070Author: Darren Tucker <dtucker@zip.com.au>
6071Date: Fri Nov 8 21:12:58 2013 +1100
6072
6073 - (dtucker) [openbsd-compat/bsd-poll.c] Add headers to prevent compile
6074 warnings.
6075
6076commit d94240b2f6b376b6e9de187e4a0cd4b89dfc48cb
6077Author: Darren Tucker <dtucker@zip.com.au>
6078Date: Fri Nov 8 21:10:04 2013 +1100
6079
6080 - (dtucker) [myproposal.h] Conditionally enable CURVE25519_SHA256.
6081
6082commit 1c8ce34909886288a3932dce770deec5449f7bb5
6083Author: Darren Tucker <dtucker@zip.com.au>
6084Date: Fri Nov 8 19:50:32 2013 +1100
6085
6086 - (dtucker) [kex.c] Only enable CURVE25519_SHA256 if we actually have
6087 EVP_sha256.
6088
6089commit ccdb9bec46bcc88549b26a94aa0bae2b9f51031c
6090Author: Darren Tucker <dtucker@zip.com.au>
6091Date: Fri Nov 8 18:54:38 2013 +1100
6092
6093 - (dtucker) [openbsd-compat/openbsd-compat.h] Add null implementation of
6094 arc4random_stir for platforms that have arc4random but don't have
6095 arc4random_stir (right now this is only OpenBSD -current).
6096
6097commit 3420a50169b52cc8d2775d51316f9f866c73398f
6098Author: Damien Miller <djm@mindrot.org>
6099Date: Fri Nov 8 16:48:13 2013 +1100
6100
6101 - (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
6102 [contrib/suse/openssh.spec] Update version numbers following release.
6103
6104commit 3ac4a234df842fd8c94d9cb0ad198e1fe84b895b
6105Author: Damien Miller <djm@mindrot.org>
6106Date: Fri Nov 8 12:39:49 2013 +1100
6107
6108 - djm@cvs.openbsd.org 2013/11/08 01:38:11
6109 [version.h]
6110 openssh-6.4
6111
6112commit 6c81fee693038de7d4a5559043350391db2a2761
6113Author: Damien Miller <djm@mindrot.org>
6114Date: Fri Nov 8 12:19:55 2013 +1100
6115
6116 - djm@cvs.openbsd.org 2013/11/08 00:39:15
6117 [auth-options.c auth2-chall.c authfd.c channels.c cipher-3des1.c]
6118 [clientloop.c gss-genr.c monitor_mm.c packet.c schnorr.c umac.c]
6119 [sftp-client.c sftp-glob.c]
6120 use calloc for all structure allocations; from markus@
6121
6122commit 690d989008e18af3603a5e03f1276c9bad090370
6123Author: Damien Miller <djm@mindrot.org>
6124Date: Fri Nov 8 12:16:49 2013 +1100
6125
6126 - dtucker@cvs.openbsd.org 2013/11/07 11:58:27
6127 [cipher.c cipher.h kex.c kex.h mac.c mac.h servconf.c ssh.c]
6128 Output the effective values of Ciphers, MACs and KexAlgorithms when
6129 the default has not been overridden. ok markus@
6130
6131commit 08998c5fb9c7c1d248caa73b76e02ca0482e6d85
6132Author: Darren Tucker <dtucker@zip.com.au>
6133Date: Fri Nov 8 12:11:46 2013 +1100
6134
6135 - dtucker@cvs.openbsd.org 2013/11/08 01:06:14
6136 [regress/rekey.sh]
6137 Rekey less frequently during tests to speed them up
6138
6139commit 4bf7e50e533aa956366df7402c132f202e841a48
6140Author: Darren Tucker <dtucker@zip.com.au>
6141Date: Thu Nov 7 22:33:48 2013 +1100
6142
6143 - (dtucker) [Makefile.in configure.ac] Remove TEST_SSH_SHA256 environment
6144 variable. It's no longer used now that we get the supported MACs from
6145 ssh -Q.
6146
6147commit 6e9d6f411288374d1dee4b7debbfa90bc7e73035
6148Author: Darren Tucker <dtucker@zip.com.au>
6149Date: Thu Nov 7 15:32:37 2013 +1100
6150
6151 - dtucker@cvs.openbsd.org 2013/11/07 04:26:56
6152 [regress/kextype.sh]
6153 trailing space
6154
6155commit 74cbc22529f3e5de756e1b7677b7624efb28f62c
6156Author: Darren Tucker <dtucker@zip.com.au>
6157Date: Thu Nov 7 15:26:12 2013 +1100
6158
6159 - dtucker@cvs.openbsd.org 2013/11/07 03:55:41
6160 [regress/kextype.sh]
6161 Use ssh -Q to get kex types instead of a static list.
6162
6163commit a955041c930e63405159ff7d25ef14272f36eab3
6164Author: Darren Tucker <dtucker@zip.com.au>
6165Date: Thu Nov 7 15:21:19 2013 +1100
6166
6167 - dtucker@cvs.openbsd.org 2013/11/07 02:48:38
6168 [regress/integrity.sh regress/cipher-speed.sh regress/try-ciphers.sh]
6169 Use ssh -Q instead of hardcoding lists of ciphers or MACs.
6170
6171commit 06595d639577577bc15d359e037a31eb83563269
6172Author: Darren Tucker <dtucker@zip.com.au>
6173Date: Thu Nov 7 15:08:02 2013 +1100
6174
6175 - dtucker@cvs.openbsd.org 2013/11/07 01:12:51
6176 [regress/rekey.sh]
6177 Factor out the data transfer rekey tests
6178
6179commit 651dc8b2592202dac6b16ee3b82ce5b331be7da3
6180Author: Darren Tucker <dtucker@zip.com.au>
6181Date: Thu Nov 7 15:04:44 2013 +1100
6182
6183 - dtucker@cvs.openbsd.org 2013/11/07 00:12:05
6184 [regress/rekey.sh]
6185 Test rekeying for every Cipher, MAC and KEX, plus test every KEX with
6186 the GCM ciphers.
6187
6188commit 234557762ba1096a867ca6ebdec07efebddb5153
6189Author: Darren Tucker <dtucker@zip.com.au>
6190Date: Thu Nov 7 15:00:51 2013 +1100
6191
6192 - dtucker@cvs.openbsd.org 2013/11/04 12:27:42
6193 [regress/rekey.sh]
6194 Test rekeying with all KexAlgorithms.
6195
6196commit bbfb9b0f386aab0c3e19d11f136199ef1b9ad0ef
6197Author: Darren Tucker <dtucker@zip.com.au>
6198Date: Thu Nov 7 14:56:43 2013 +1100
6199
6200 - markus@cvs.openbsd.org 2013/11/02 22:39:53
6201 [regress/kextype.sh]
6202 add curve25519-sha256@libssh.org
6203
6204commit aa19548a98c0f89283ebd7354abd746ca6bc4fdf
6205Author: Darren Tucker <dtucker@zip.com.au>
6206Date: Thu Nov 7 14:50:09 2013 +1100
6207
6208 - djm@cvs.openbsd.org 2013/10/09 23:44:14
6209 [regress/Makefile] (ID sync only)
6210 regression test for sftp request white/blacklisting and readonly mode.
6211
6212commit c8908aabff252f5da772d4e679479c2b7d18cac1
6213Author: Damien Miller <djm@mindrot.org>
6214Date: Thu Nov 7 13:38:35 2013 +1100
6215
6216 - djm@cvs.openbsd.org 2013/11/06 23:05:59
6217 [ssh-pkcs11.c]
6218 from portable: s/true/true_val/ to avoid name collisions on dump platforms
6219 RCSID sync only
6220
6221commit 49c145c5e89b9d7d48e84328d6347d5ad640b567
6222Author: Damien Miller <djm@mindrot.org>
6223Date: Thu Nov 7 13:35:39 2013 +1100
6224
6225 - markus@cvs.openbsd.org 2013/11/06 16:52:11
6226 [monitor_wrap.c]
6227 fix rekeying for AES-GCM modes; ok deraadt
6228
6229commit 67a8800f290b39fd60e379988c700656ae3f2539
6230Author: Damien Miller <djm@mindrot.org>
6231Date: Thu Nov 7 13:32:51 2013 +1100
6232
6233 - markus@cvs.openbsd.org 2013/11/04 11:51:16
6234 [monitor.c]
6235 fix rekeying for KEX_C25519_SHA256; noted by dtucker@
6236 RCSID sync only; I thought this was a merge botch and fixed it already
6237
6238commit df8b030b15fcec7baf38ec7944f309f9ca8cc9a7
6239Author: Damien Miller <djm@mindrot.org>
6240Date: Thu Nov 7 13:28:16 2013 +1100
6241
6242 - (djm) [configure.ac defines.h] Skip arc4random_stir() calls on platforms
6243 that lack it but have arc4random_uniform()
6244
6245commit a6fd1d3c38a562709374a70fa76423859160aa90
6246Author: Damien Miller <djm@mindrot.org>
6247Date: Thu Nov 7 12:03:26 2013 +1100
6248
6249 - (djm) [regress/modpipe.c regress/rekey.sh] Never intended to commit these
6250
6251commit c98319750b0bbdd0d1794420ec97d65dd9244613
6252Author: Damien Miller <djm@mindrot.org>
6253Date: Thu Nov 7 12:00:23 2013 +1100
6254
6255 - (djm) [Makefile.in monitor.c] Missed chunks of curve25519 KEX diff
6256
6257commit 61c5c2319e84a58210810d39b062c8b8e3321160
6258Author: Damien Miller <djm@mindrot.org>
6259Date: Thu Nov 7 11:34:14 2013 +1100
6260
6261 - (djm) [ssh-pkcs11.c] Bring back "non-constant initialiser" fix (rev 1.5)
6262 that got lost in recent merge.
6263
6264commit 094003f5454a9f5a607674b2739824a7e91835f4
6265Author: Damien Miller <djm@mindrot.org>
6266Date: Mon Nov 4 22:59:27 2013 +1100
6267
6268 - (djm) [kexc25519.c kexc25519c.c kexc25519s.c] Import missed files from
6269 KEX/curve25519 change
6270
6271commit ca67a7eaf8766499ba67801d0be8cdaa550b9a50
6272Author: Damien Miller <djm@mindrot.org>
6273Date: Mon Nov 4 09:05:17 2013 +1100
6274
6275 - djm@cvs.openbsd.org 2013/11/03 10:37:19
6276 [roaming_common.c]
6277 fix a couple of function definitions foo() -> foo(void)
6278 (-Wold-style-definition)
6279
6280commit 0bd8f1519d51af8d4229be81e8f2f4903a1d440b
6281Author: Damien Miller <djm@mindrot.org>
6282Date: Mon Nov 4 08:55:43 2013 +1100
6283
6284 - markus@cvs.openbsd.org 2013/11/02 22:39:19
6285 [ssh_config.5 sshd_config.5]
6286 the default kex is now curve25519-sha256@libssh.org
6287
6288commit 4c3ba0767fbe4a8a2a748df4035aaf86651f6b30
6289Author: Damien Miller <djm@mindrot.org>
6290Date: Mon Nov 4 08:40:13 2013 +1100
6291
6292 - markus@cvs.openbsd.org 2013/11/02 22:34:01
6293 [auth-options.c]
6294 no need to include monitor_wrap.h and ssh-gss.h
6295
6296commit 660621b2106b987b874c2f120218bec249d0f6ba
6297Author: Damien Miller <djm@mindrot.org>
6298Date: Mon Nov 4 08:37:51 2013 +1100
6299
6300 - markus@cvs.openbsd.org 2013/11/02 22:24:24
6301 [kexdhs.c kexecdhs.c]
6302 no need to include ssh-gss.h
6303
6304commit abdca986decfbbc008c895195b85e879ed460ada
6305Author: Damien Miller <djm@mindrot.org>
6306Date: Mon Nov 4 08:30:05 2013 +1100
6307
6308 - markus@cvs.openbsd.org 2013/11/02 22:10:15
6309 [kexdhs.c kexecdhs.c]
6310 no need to include monitor_wrap.h
6311
6312commit 1e1242604eb0fd510fe93f81245c529237ffc513
6313Author: Damien Miller <djm@mindrot.org>
6314Date: Mon Nov 4 08:26:52 2013 +1100
6315
6316 - markus@cvs.openbsd.org 2013/11/02 21:59:15
6317 [kex.c kex.h myproposal.h ssh-keyscan.c sshconnect2.c sshd.c]
6318 use curve25519 for default key exchange (curve25519-sha256@libssh.org);
6319 initial patch from Aris Adamantiadis; ok djm@
6320
6321commit d2252c79191d069372ed6effce7c7a2de93448cd
6322Author: Damien Miller <djm@mindrot.org>
6323Date: Mon Nov 4 07:41:48 2013 +1100
6324
6325 - markus@cvs.openbsd.org 2013/11/02 20:03:54
6326 [ssh-pkcs11.c]
6327 support pkcs#11 tokes that only provide x509 zerts instead of raw pubkeys;
6328 fixes bz#1908; based on patch from Laurent Barbe; ok djm
6329
6330commit 007e3b357e880caa974d5adf9669298ba0751c78
6331Author: Darren Tucker <dtucker@zip.com.au>
6332Date: Sun Nov 3 18:43:55 2013 +1100
6333
6334 - (dtucker) [configure.ac defines.h] Add typedefs for intmax_t and uintmax_t
6335 for platforms that don't have them.
6336
6337commit 710f3747352fb93a63e5b69b12379da37f5b3fa9
6338Author: Darren Tucker <dtucker@zip.com.au>
6339Date: Sun Nov 3 17:20:34 2013 +1100
6340
6341 - (dtucker) [openbsd-compat/setproctitle.c] Handle error case form the 2nd
6342 vsnprintf. From eric at openbsd via chl@.
6343
6344commit d52770452308e5c2e99f4da6edaaa77ef078b610
6345Author: Darren Tucker <dtucker@zip.com.au>
6346Date: Sun Nov 3 16:30:46 2013 +1100
6347
6348 - (dtucker) [openbsd-compat/bsd-misc.c] Include time.h for nanosleep.
6349 From OpenSMTPD where it prevents "implicit declaration" warnings (it's
6350 a no-op in OpenSSH). From chl at openbsd.
6351
6352commit 63857c9340d3482746a5622ffdacc756751f6448
6353Author: Damien Miller <djm@mindrot.org>
6354Date: Wed Oct 30 22:31:06 2013 +1100
6355
6356 - jmc@cvs.openbsd.org 2013/10/29 18:49:32
6357 [sshd_config.5]
6358 pty(4), not pty(7);
6359
6360commit 5ff30c6b68adeee767dd29bf2369763c6a13c0b3
6361Author: Damien Miller <djm@mindrot.org>
6362Date: Wed Oct 30 22:21:50 2013 +1100
6363
6364 - djm@cvs.openbsd.org 2013/10/29 09:48:02
6365 [servconf.c servconf.h session.c sshd_config sshd_config.5]
6366 shd_config PermitTTY to disallow TTY allocation, mirroring the
6367 longstanding no-pty authorized_keys option;
6368 bz#2070, patch from Teran McKinney; ok markus@
6369
6370commit 4a3a9d4bbf8048473f5cc202cd8db7164d5e6b8d
6371Author: Damien Miller <djm@mindrot.org>
6372Date: Wed Oct 30 22:19:47 2013 +1100
6373
6374 - djm@cvs.openbsd.org 2013/10/29 09:42:11
6375 [key.c key.h]
6376 fix potential stack exhaustion caused by nested certificates;
6377 report by Mateusz Kocielski; ok dtucker@ markus@
6378
6379commit 28631ceaa7acd9bc500f924614431542893c6a21
6380Author: Damien Miller <djm@mindrot.org>
6381Date: Sat Oct 26 10:07:56 2013 +1100
6382
6383 - djm@cvs.openbsd.org 2013/10/25 23:04:51
6384 [ssh.c]
6385 fix crash when using ProxyCommand caused by previous commit - was calling
6386 freeaddrinfo(NULL); spotted by sthen@ and Tim Ruehsen, patch by sthen@
6387
6388commit 26506ad29350c5681815745cc90b3952a84cf118
6389Author: Damien Miller <djm@mindrot.org>
6390Date: Sat Oct 26 10:05:46 2013 +1100
6391
6392 - (djm) [ssh-keygen.c ssh-keysign.c sshconnect1.c sshd.c] Remove
6393 unnecessary arc4random_stir() calls. The only ones left are to ensure
6394 that the PRNG gets a different state after fork() for platforms that
6395 have broken the API.
6396
6397commit bd43e8872325e9bbb3319c89da593614709f317c
6398Author: Tim Rice <tim@multitalents.net>
6399Date: Thu Oct 24 12:22:49 2013 -0700
6400
6401 - (tim) [regress/sftp-perm.sh] We need a shell that understands "! somecmd"
6402
6403commit a90c0338083ee0e4064c4bdf61f497293a699be0
6404Author: Damien Miller <djm@mindrot.org>
6405Date: Thu Oct 24 21:03:17 2013 +1100
6406
6407 - djm@cvs.openbsd.org 2013/10/24 08:19:36
6408 [ssh.c]
6409 fix bug introduced in hostname canonicalisation commit: don't try to
6410 resolve hostnames when a ProxyCommand is set unless the user has forced
6411 canonicalisation; spotted by Iain Morgan
6412
6413commit cf31f3863425453ffcda540fbefa9df80088c8d1
6414Author: Damien Miller <djm@mindrot.org>
6415Date: Thu Oct 24 21:02:56 2013 +1100
6416
6417 - dtucker@cvs.openbsd.org 2013/10/24 00:51:48
6418 [readconf.c servconf.c ssh_config.5 sshd_config.5]
6419 Disallow empty Match statements and add "Match all" which matches
6420 everything. ok djm, man page help jmc@
6421
6422commit 4bedd4032a09ce87322ae5ea80f193f109e5c607
6423Author: Damien Miller <djm@mindrot.org>
6424Date: Thu Oct 24 21:02:26 2013 +1100
6425
6426 - dtucker@cvs.openbsd.org 2013/10/24 00:49:49
6427 [moduli.c]
6428 Periodically print progress and, if possible, expected time to completion
6429 when screening moduli for DH groups. ok deraadt djm
6430
6431commit 5ecb41629860687b145be63b8877fabb6bae5eda
6432Author: Damien Miller <djm@mindrot.org>
6433Date: Thu Oct 24 21:02:02 2013 +1100
6434
6435 - djm@cvs.openbsd.org 2013/10/23 23:35:32
6436 [sshd.c]
6437 include local address and port in "Connection from ..." message (only
6438 shown at loglevel>=verbose)
6439
6440commit 03bf2e61ad6ac59a362a1f11b105586cb755c147
6441Author: Damien Miller <djm@mindrot.org>
6442Date: Thu Oct 24 21:01:26 2013 +1100
6443
6444 - dtucker@cvs.openbsd.org 2013/10/23 05:40:58
6445 [servconf.c]
6446 fix comment
6447
6448commit 8f1873191478847773906af961c8984d02a49dd6
6449Author: Damien Miller <djm@mindrot.org>
6450Date: Thu Oct 24 10:53:02 2013 +1100
6451
6452 - (djm) [auth-krb5.c] bz#2032 - use local username in krb5_kuserok check
6453 rather than full client name which may be of form user@REALM;
6454 patch from Miguel Sanders; ok dtucker@
6455
6456commit 5b01b0dcb417eb615df77e7ce1b59319bf04342c
6457Author: Damien Miller <djm@mindrot.org>
6458Date: Wed Oct 23 16:31:31 2013 +1100
6459
6460 - djm@cvs.openbsd.org 2013/10/23 04:16:22
6461 [ssh-keygen.c]
6462 Make code match documentation: relative-specified certificate expiry time
6463 should be relative to current time and not the validity start time.
6464 Reported by Petr Lautrbach; ok deraadt@
6465
6466commit eff5cada589f25793dbe63a76aba9da39837a148
6467Author: Damien Miller <djm@mindrot.org>
6468Date: Wed Oct 23 16:31:10 2013 +1100
6469
6470 - djm@cvs.openbsd.org 2013/10/23 03:05:19
6471 [readconf.c ssh.c]
6472 comment
6473
6474commit 084bcd24e9fe874020e4df4e073e7408e1b17fb7
6475Author: Damien Miller <djm@mindrot.org>
6476Date: Wed Oct 23 16:30:51 2013 +1100
6477
6478 - djm@cvs.openbsd.org 2013/10/23 03:03:07
6479 [readconf.c]
6480 Hostname may have %h sequences that should be expanded prior to Match
6481 evaluation; spotted by Iain Morgan
6482
6483commit 8e5a67f46916def40b2758bb7755350dd2eee843
6484Author: Damien Miller <djm@mindrot.org>
6485Date: Wed Oct 23 16:30:25 2013 +1100
6486
6487 - jmc@cvs.openbsd.org 2013/10/20 18:00:13
6488 [ssh_config.5]
6489 tweak the "exec" description, as worded by djm;
6490
6491commit c0049bd0bca02890cd792babc594771c563f91f2
6492Author: Damien Miller <djm@mindrot.org>
6493Date: Wed Oct 23 16:29:59 2013 +1100
6494
6495 - djm@cvs.openbsd.org 2013/10/20 09:51:26
6496 [scp.1 sftp.1]
6497 add canonicalisation options to -o lists
6498
6499commit 8a04be795fc28514a09e55a54b2e67968f2e1b3a
6500Author: Damien Miller <djm@mindrot.org>
6501Date: Wed Oct 23 16:29:40 2013 +1100
6502
6503 - djm@cvs.openbsd.org 2013/10/20 06:19:28
6504 [readconf.c ssh_config.5]
6505 rename "command" subclause of the recently-added "Match" keyword to
6506 "exec"; it's shorter, clearer in intent and we might want to add the
6507 ability to match against the command being executed at the remote end in
6508 the future.
6509
6510commit 5c86ebdf83b636b6741db4b03569ef4a53b89a58
6511Author: Damien Miller <djm@mindrot.org>
6512Date: Wed Oct 23 16:29:12 2013 +1100
6513
6514 - djm@cvs.openbsd.org 2013/10/20 04:39:28
6515 [ssh_config.5]
6516 document % expansions performed by "Match command ..."
6517
6518commit 4502f88774edc56194707167443f94026d3c7cfa
6519Author: Damien Miller <djm@mindrot.org>
6520Date: Fri Oct 18 10:17:36 2013 +1100
6521
6522 - djm@cvs.openbsd.org 2013/10/17 22:08:04
6523 [sshd.c]
6524 include remote port in bad banner message; bz#2162
6525
6526commit 1edcbf65ebd2febeaf10a836468f35e519eed7ca
6527Author: Damien Miller <djm@mindrot.org>
6528Date: Fri Oct 18 10:17:17 2013 +1100
6529
6530 - jmc@cvs.openbsd.org 2013/10/17 07:35:48
6531 [sftp.1 sftp.c]
6532 tweak previous;
6533
6534commit a176e1823013dd8533a20235b3a5131f0626f46b
6535Author: Damien Miller <djm@mindrot.org>
6536Date: Fri Oct 18 09:05:41 2013 +1100
6537
6538 - djm@cvs.openbsd.org 2013/10/09 23:44:14
6539 [regress/Makefile regress/sftp-perm.sh]
6540 regression test for sftp request white/blacklisting and readonly mode.
6541
6542commit e3ea09494dcfe7ba76536e95765c8328ecfc18fb
6543Author: Damien Miller <djm@mindrot.org>
6544Date: Thu Oct 17 11:57:23 2013 +1100
6545
6546 - djm@cvs.openbsd.org 2013/10/17 00:46:49
6547 [ssh.c]
6548 rearrange check to reduce diff against -portable
6549 (Id sync only)
6550
6551commit f29238e67471a7f1088a99c3c3dbafce76b790cf
6552Author: Damien Miller <djm@mindrot.org>
6553Date: Thu Oct 17 11:48:52 2013 +1100
6554
6555 - djm@cvs.openbsd.org 2013/10/17 00:30:13
6556 [PROTOCOL sftp-client.c sftp-client.h sftp-server.c sftp.1 sftp.c]
6557 fsync@openssh.com protocol extension for sftp-server
6558 client support to allow calling fsync() faster successful transfer
6559 patch mostly by imorgan AT nas.nasa.gov; bz#1798
6560 "fine" markus@ "grumble OK" deraadt@ "doesn't sound bad to me" millert@
6561
6562commit 51682faa599550a69d8120e5e2bdbdc0625ef4be
6563Author: Damien Miller <djm@mindrot.org>
6564Date: Thu Oct 17 11:48:31 2013 +1100
6565
6566 - djm@cvs.openbsd.org 2013/10/16 22:58:01
6567 [ssh.c ssh_config.5]
6568 one I missed in previous: s/isation/ization/
6569
6570commit 3850559be93f1a442ae9ed370e8c389889dd5f72
6571Author: Damien Miller <djm@mindrot.org>
6572Date: Thu Oct 17 11:48:13 2013 +1100
6573
6574 - djm@cvs.openbsd.org 2013/10/16 22:49:39
6575 [readconf.c readconf.h ssh.1 ssh.c ssh_config.5]
6576 s/canonicalise/canonicalize/ for consistency with existing spelling,
6577 e.g. authorized_keys; pointed out by naddy@
6578
6579commit 607af3434b75acc7199a5d99d5a9c11068c01f27
6580Author: Damien Miller <djm@mindrot.org>
6581Date: Thu Oct 17 11:47:51 2013 +1100
6582
6583 - jmc@cvs.openbsd.org 2013/10/16 06:42:25
6584 [ssh_config.5]
6585 tweak previous;
6586
6587commit 0faf747e2f77f0f7083bcd59cbed30c4b5448444
6588Author: Damien Miller <djm@mindrot.org>
6589Date: Thu Oct 17 11:47:23 2013 +1100
6590
6591 - djm@cvs.openbsd.org 2013/10/16 02:31:47
6592 [readconf.c readconf.h roaming_client.c ssh.1 ssh.c ssh_config.5]
6593 [sshconnect.c sshconnect.h]
6594 Implement client-side hostname canonicalisation to allow an explicit
6595 search path of domain suffixes to use to convert unqualified host names
6596 to fully-qualified ones for host key matching.
6597 This is particularly useful for host certificates, which would otherwise
6598 need to list unqualified names alongside fully-qualified ones (and this
6599 causes a number of problems).
6600 "looks fine" markus@
6601
6602commit d77b81f856e078714ec6b0f86f61c20249b7ead4
6603Author: Damien Miller <djm@mindrot.org>
6604Date: Thu Oct 17 11:39:00 2013 +1100
6605
6606 - jmc@cvs.openbsd.org 2013/10/15 14:10:25
6607 [ssh.1 ssh_config.5]
6608 tweak previous;
6609
6610commit dcd39f29ce3308dc74a0ff27a9056205a932ce05
6611Author: Damien Miller <djm@mindrot.org>
6612Date: Thu Oct 17 11:31:40 2013 +1100
6613
6614 - [ssh.c] g/c unused variable.
6615
6616commit 5359a628ce3763408da25d83271a8eddec597a0c
6617Author: Damien Miller <djm@mindrot.org>
6618Date: Tue Oct 15 12:20:37 2013 +1100
6619
6620 - [ssh.c] g/c unused variable.
6621
6622commit 386feab0c4736b054585ee8ee372865d5cde8d69
6623Author: Damien Miller <djm@mindrot.org>
6624Date: Tue Oct 15 12:14:49 2013 +1100
6625
6626 - djm@cvs.openbsd.org 2013/10/14 23:31:01
6627 [ssh.c]
6628 whitespace at EOL; pointed out by markus@
6629
6630commit e9fc72edd6c313b670558cd5219601c38a949b67
6631Author: Damien Miller <djm@mindrot.org>
6632Date: Tue Oct 15 12:14:12 2013 +1100
6633
6634 - djm@cvs.openbsd.org 2013/10/14 23:28:23
6635 [canohost.c misc.c misc.h readconf.c sftp-server.c ssh.c]
6636 refactor client config code a little:
6637 add multistate option partsing to readconf.c, similar to servconf.c's
6638 existing code.
6639 move checking of options that accept "none" as an argument to readconf.c
6640 add a lowercase() function and use it instead of explicit tolower() in
6641 loops
6642 part of a larger diff that was ok markus@
6643
6644commit 194fd904d8597a274b93e075b2047afdf5a175d4
6645Author: Damien Miller <djm@mindrot.org>
6646Date: Tue Oct 15 12:13:05 2013 +1100
6647
6648 - djm@cvs.openbsd.org 2013/10/14 22:22:05
6649 [readconf.c readconf.h ssh-keysign.c ssh.c ssh_config.5]
6650 add a "Match" keyword to ssh_config that allows matching on hostname,
6651 user and result of arbitrary commands. "nice work" markus@
6652
6653commit 71df752de2a04f423b1cd18d961a79f4fbccbcee
6654Author: Damien Miller <djm@mindrot.org>
6655Date: Tue Oct 15 12:12:02 2013 +1100
6656
6657 - djm@cvs.openbsd.org 2013/10/14 21:20:52
6658 [session.c session.h]
6659 Add logging of session starts in a useful format; ok markus@ feedback and
6660 ok dtucker@
6661
6662commit 6efab27109b82820e8d32a5d811adb7bfc354f65
6663Author: Damien Miller <djm@mindrot.org>
6664Date: Tue Oct 15 12:07:05 2013 +1100
6665
6666 - jmc@cvs.openbsd.org 2013/10/14 14:18:56
6667 [sftp-server.8 sftp-server.c]
6668 tweak previous;
6669 ok djm
6670
6671commit 61c7de8a94156f6d7e9718ded9be8c65bb902b66
6672Author: Damien Miller <djm@mindrot.org>
6673Date: Tue Oct 15 12:06:45 2013 +1100
6674
6675 - djm@cvs.openbsd.org 2013/10/11 02:53:45
6676 [sftp-client.h]
6677 obsolete comment
6678
6679commit 2f93d0556e4892208c9b072624caa8cc5ddd839d
6680Author: Damien Miller <djm@mindrot.org>
6681Date: Tue Oct 15 12:06:27 2013 +1100
6682
6683 - djm@cvs.openbsd.org 2013/10/11 02:52:23
6684 [sftp-client.c]
6685 missed one arg reorder
6686
6687commit bda5c8445713ae592d969a5105ed1a65da22bc96
6688Author: Damien Miller <djm@mindrot.org>
6689Date: Tue Oct 15 12:05:58 2013 +1100
6690
6691 - djm@cvs.openbsd.org 2013/10/11 02:45:36
6692 [sftp-client.c]
6693 rename flag arguments to be more clear and consistent.
6694 reorder some internal function arguments to make adding additional flags
6695 easier.
6696 no functional change
6697
6698commit 61ee4d68ca0fcc793a826fc7ec70f3b8ffd12ab6
6699Author: Damien Miller <djm@mindrot.org>
6700Date: Tue Oct 15 11:56:47 2013 +1100
6701
6702 - djm@cvs.openbsd.org 2013/10/10 01:43:03
6703 [sshd.c]
6704 bz#2139: fix re-exec fallback by ensuring that startup_pipe is correctly
6705 updated; ok dtucker@
6706
6707commit 73600e51af9ee734a19767e0c084bbbc5eb5b8da
6708Author: Damien Miller <djm@mindrot.org>
6709Date: Tue Oct 15 11:56:25 2013 +1100
6710
6711 - djm@cvs.openbsd.org 2013/10/10 00:53:25
6712 [sftp-server.c]
6713 add -Q, -P and -p to usage() before jmc@ catches me
6714
6715commit 6eaeebf27d92f39a38c772aa3f20c2250af2dd29
6716Author: Damien Miller <djm@mindrot.org>
6717Date: Tue Oct 15 11:55:57 2013 +1100
6718
6719 - djm@cvs.openbsd.org 2013/10/09 23:42:17
6720 [sftp-server.8 sftp-server.c]
6721 Add ability to whitelist and/or blacklist sftp protocol requests by name.
6722 Refactor dispatch loop and consolidate read-only mode checks.
6723 Make global variables static, since sftp-server is linked into sshd(8).
6724 ok dtucker@
6725
6726commit df62d71e64d29d1054e7a53d1a801075ef70335f
6727Author: Darren Tucker <dtucker@zip.com.au>
6728Date: Thu Oct 10 10:32:39 2013 +1100
6729
6730 - dtucker@cvs.openbsd.org 2013/10/08 11:42:13
6731 [dh.c dh.h]
6732 Increase the size of the Diffie-Hellman groups requested for a each
6733 symmetric key size. New values from NIST Special Publication 800-57 with
6734 the upper limit specified by RFC4419. Pointed out by Peter Backes, ok
6735 djm@.
6736
6737commit e6e52f8c5dc89a6767702e65bb595aaf7bc8991c
6738Author: Darren Tucker <dtucker@zip.com.au>
6739Date: Thu Oct 10 10:28:07 2013 +1100
6740
6741 - djm@cvs.openbsd.org 2013/09/19 01:26:29
6742 [sshconnect.c]
6743 bz#1211: make BindAddress work with UsePrivilegedPort=yes; patch from
6744 swp AT swp.pp.ru; ok dtucker@
6745
6746commit 71152bc9911bc34a98810b2398dac20df3fe8de3
6747Author: Darren Tucker <dtucker@zip.com.au>
6748Date: Thu Oct 10 10:27:21 2013 +1100
6749
6750 - djm@cvs.openbsd.org 2013/09/19 01:24:46
6751 [channels.c]
6752 bz#1297 - tell the client (via packet_send_debug) when their preferred
6753 listen address has been overridden by the server's GatewayPorts;
6754 ok dtucker@
6755
6756commit b59aaf3c4f3f449a4b86d8528668bd979be9aa5f
6757Author: Darren Tucker <dtucker@zip.com.au>
6758Date: Thu Oct 10 10:26:21 2013 +1100
6759
6760 - djm@cvs.openbsd.org 2013/09/19 00:49:12
6761 [sftp-client.c]
6762 fix swapped pflag and printflag in sftp upload_dir; from Iain Morgan
6763
6764commit 5d80e4522d6238bdefe9d0c634f0e6d35a241e41
6765Author: Darren Tucker <dtucker@zip.com.au>
6766Date: Thu Oct 10 10:25:09 2013 +1100
6767
6768 - djm@cvs.openbsd.org 2013/09/19 00:24:52
6769 [progressmeter.c]
6770 store the initial file offset so the progress meter doesn't freak out
6771 when resuming sftp transfers. bz#2137; patch from Iain Morgan; ok dtucker@
6772
6773commit ad92df7e5ed26fea85adfb3f95352d6cd8e86344
6774Author: Darren Tucker <dtucker@zip.com.au>
6775Date: Thu Oct 10 10:24:11 2013 +1100
6776
6777 - sthen@cvs.openbsd.org 2013/09/16 11:35:43
6778 [ssh_config]
6779 Remove gssapi config parts from ssh_config, as was already done for
6780 sshd_config. Req by/ok ajacoutot@
6781 ID SYNC ONLY for portable; kerberos/gssapi is still pretty popular
6782
6783commit 720711960b130d36dfdd3d50eb25ef482bdd000e
6784Author: Damien Miller <djm@mindrot.org>
6785Date: Wed Oct 9 10:44:47 2013 +1100
6786
6787 - (djm) [openbsd-compat/Makefile.in openbsd-compat/arc4random.c]
6788 [openbsd-compat/bsd-arc4random.c] Replace old RC4-based arc4random
6789 implementation with recent OpenBSD's ChaCha-based PRNG. ok dtucker@,
6790 tested tim@
6791
6792commit 9159310087a218e28940a592896808b8eb76a039
6793Author: Damien Miller <djm@mindrot.org>
6794Date: Wed Oct 9 10:42:32 2013 +1100
6795
6796 - (djm) [openbsd-compat/arc4random.c openbsd-compat/chacha_private.h] Pull
6797 in OpenBSD implementation of arc4random, shortly to replace the existing
6798 bsd-arc4random.c
6799
6800commit 67f1d557a68d6fa8966a327d7b6dee3408cf0e72
6801Author: Damien Miller <djm@mindrot.org>
6802Date: Wed Oct 9 09:33:08 2013 +1100
6803
6804 correct incorrect years in datestamps; from des
6805
6806commit f2bf36c3eb4d969f85ec8aa342e9aecb61cc8bb1
6807Author: Darren Tucker <dtucker@zip.com.au>
6808Date: Sun Sep 22 19:02:40 2013 +1000
6809
6810 - (dtucker) [platform.c platform.h sshd.c] bz#2156: restore Linux oom_adj
6811 setting when handling SIGHUP to maintain behaviour over retart. Patch
6812 from Matthew Ife.
6813
6814commit e90a06ae570fd259a2f5ced873c7f17390f535a5
6815Author: Darren Tucker <dtucker@zip.com.au>
6816Date: Wed Sep 18 15:09:38 2013 +1000
6817
6818 - (dtucker) [sshd_config] Trailing whitespace; from jstjohn at purdue edu.
6819
6820commit 13840e0103946982cee2a05c40697be7e57dca41
6821Author: Damien Miller <djm@mindrot.org>
6822Date: Sat Sep 14 09:49:43 2013 +1000
6823
6824 - djm@cvs.openbsd.org 2013/09/13 06:54:34
6825 [channels.c]
6826 avoid unaligned access in code that reused a buffer to send a
6827 struct in_addr in a reply; simpler just use use buffer_put_int();
6828 from portable; spotted by and ok dtucker@
6829
6830commit 70182522a47d283513a010338cd028cb80dac2ab
6831Author: Damien Miller <djm@mindrot.org>
6832Date: Sat Sep 14 09:49:19 2013 +1000
6833
6834 - djm@cvs.openbsd.org 2013/09/12 01:41:12
6835 [clientloop.c]
6836 fix connection crash when sending break (~B) on ControlPersist'd session;
6837 ok dtucker@
6838
6839commit ff9d6c2a4171ee32e8fe28fc3b86eb33bd5c845b
6840Author: Damien Miller <djm@mindrot.org>
6841Date: Sat Sep 14 09:48:55 2013 +1000
6842
6843 - sthen@cvs.openbsd.org 2013/09/07 13:53:11
6844 [sshd_config]
6845 Remove commented-out kerberos/gssapi config options from sample config,
6846 kerberos support is currently not enabled in ssh in OpenBSD. Discussed with
6847 various people; ok deraadt@
6848 ID SYNC ONLY for portable; kerberos/gssapi is still pretty popular
6849
6850commit 8bab5e7b5ff6721d926b5ebf05a3a24489889c58
6851Author: Damien Miller <djm@mindrot.org>
6852Date: Sat Sep 14 09:47:00 2013 +1000
6853
6854 - deraadt@cvs.openbsd.org 2013/09/02 22:00:34
6855 [ssh-keygen.c sshconnect1.c sshd.c]
6856 All the instances of arc4random_stir() are bogus, since arc4random()
6857 does this itself, inside itself, and has for a very long time.. Actually,
6858 this was probably reducing the entropy available.
6859 ok djm
6860 ID SYNC ONLY for portable; we don't trust other arc4random implementations
6861 to do this right.
6862
6863commit 61353b3208d548fab863e0e0ac5d2400ee5bb340
6864Author: Damien Miller <djm@mindrot.org>
6865Date: Sat Sep 14 09:45:32 2013 +1000
6866
6867 - djm@cvs.openbsd.org 2013/08/31 00:13:54
6868 [sftp.c]
6869 make ^w match ksh behaviour (delete previous word instead of entire line)
6870
6871commit 660854859cad31d234edb9353fb7ca2780df8128
6872Author: Damien Miller <djm@mindrot.org>
6873Date: Sat Sep 14 09:45:03 2013 +1000
6874
6875 - mikeb@cvs.openbsd.org 2013/08/28 12:34:27
6876 [ssh-keygen.c]
6877 improve batch processing a bit by making use of the quite flag a bit
6878 more often and exit with a non zero code if asked to find a hostname
6879 in a known_hosts file and it wasn't there;
6880 originally from reyk@, ok djm
6881
6882commit 045bda5cb8acf0eb9d71c275ee1247e3154fc9e5
6883Author: Damien Miller <djm@mindrot.org>
6884Date: Sat Sep 14 09:44:37 2013 +1000
6885
6886 - djm@cvs.openbsd.org 2013/08/22 19:02:21
6887 [sshd.c]
6888 Stir PRNG after post-accept fork. The child gets a different PRNG state
6889 anyway via rexec and explicit privsep reseeds, but it's good to be sure.
6890 ok markus@
6891
6892commit ed4af412da60a084891b20412433a27966613fb8
6893Author: Damien Miller <djm@mindrot.org>
6894Date: Sat Sep 14 09:40:51 2013 +1000
6895
6896 add marker for 6.3p1 release at the point of the last included change
6897
6898commit 43968a8e66a0aa1afefb11665bf96f86b113f5d9
6899Author: Damien Miller <djm@mindrot.org>
6900Date: Wed Aug 28 14:00:54 2013 +1000
6901
6902 - (djm) [openbsd-compat/bsd-snprintf.c] #ifdef noytet for intmax_t bits
6903 until we have configure support.
6904
6905commit 04be8b9e53f8388c94b531ebc5d1bd6e10e930d1
6906Author: Damien Miller <djm@mindrot.org>
6907Date: Wed Aug 28 12:49:43 2013 +1000
6908
6909 - (djm) [openbsd-compat/bsd-snprintf.c] teach our local snprintf code the
6910 'j' (intmax_t/uintmax_t) and 'z' (size_t/ssize_t) conversions in case we
6911 start to use them in the future.
6912
6913commit f2f6c315a920a256937e1b6a3702757f3195a592
6914Author: Damien Miller <djm@mindrot.org>
6915Date: Wed Aug 21 02:44:58 2013 +1000
6916
6917 - jmc@cvs.openbsd.org 2013/08/20 06:56:07
6918 [ssh.1 ssh_config.5]
6919 some proxyusefdpass tweaks;
6920
6921commit 1262b6638f7d01ab110fd373dd90d915c882fe1a
6922Author: Damien Miller <djm@mindrot.org>
6923Date: Wed Aug 21 02:44:24 2013 +1000
6924
6925 - djm@cvs.openbsd.org 2013/08/20 00:11:38
6926 [readconf.c readconf.h ssh_config.5 sshconnect.c]
6927 Add a ssh_config ProxyUseFDPass option that supports the use of
6928 ProxyCommands that establish a connection and then pass a connected
6929 file descriptor back to ssh(1). This allows the ProxyCommand to exit
6930 rather than have to shuffle data back and forth and enables ssh to use
6931 getpeername, etc. to obtain address information just like it does with
6932 regular directly-connected sockets. ok markus@
6933
6934commit b7727df37efde4dbe4f5a33b19cbf42022aabf66
6935Author: Damien Miller <djm@mindrot.org>
6936Date: Wed Aug 21 02:43:49 2013 +1000
6937
6938 - jmc@cvs.openbsd.org 2013/08/14 08:39:27
6939 [scp.1 ssh.1]
6940 some Bx/Ox conversion;
6941 From: Jan Stary
6942
6943commit d5d9d7b1fdacf0551de4c747728bd159be40590a
6944Author: Damien Miller <djm@mindrot.org>
6945Date: Wed Aug 21 02:43:27 2013 +1000
6946
6947 - djm@cvs.openbsd.org 2013/08/13 18:33:08
6948 [ssh-keygen.c]
6949 another of the same typo
6950
6951commit d234afb0b3a8de1be78cbeafed5fc86912594c3c
6952Author: Damien Miller <djm@mindrot.org>
6953Date: Wed Aug 21 02:42:58 2013 +1000
6954
6955 - djm@cvs.openbsd.org 2013/08/13 18:32:08
6956 [ssh-keygen.c]
6957 typo in error message; from Stephan Rickauer
6958
6959commit e0ee727b8281a7c2ae20630ce83f6b200b404059
6960Author: Damien Miller <djm@mindrot.org>
6961Date: Wed Aug 21 02:42:35 2013 +1000
6962
6963 - djm@cvs.openbsd.org 2013/08/09 03:56:42
6964 [sftp.c]
6965 enable ctrl-left-arrow and ctrl-right-arrow to move forward/back a word;
6966 matching ksh's relatively recent change.
6967
6968commit fec029f1dc2c338f3fae3fa82aabc988dc07868c
6969Author: Damien Miller <djm@mindrot.org>
6970Date: Wed Aug 21 02:42:12 2013 +1000
6971
6972 - djm@cvs.openbsd.org 2013/08/09 03:39:13
6973 [sftp-client.c]
6974 two problems found by a to-be-committed regress test: 1) msg_id was not
6975 being initialised so was starting at a random value from the heap
6976 (harmless, but confusing). 2) some error conditions were not being
6977 propagated back to the caller
6978
6979commit 036d30743fc914089f9849ca52d615891d47e616
6980Author: Damien Miller <djm@mindrot.org>
6981Date: Wed Aug 21 02:41:46 2013 +1000
6982
6983 - djm@cvs.openbsd.org 2013/08/09 03:37:25
6984 [sftp.c]
6985 do getopt parsing for all sftp commands (with an empty optstring for
6986 commands without arguments) to ensure consistent behaviour
6987
6988commit c7dba12bf95eb1d69711881a153cc286c1987663
6989Author: Damien Miller <djm@mindrot.org>
6990Date: Wed Aug 21 02:41:15 2013 +1000
6991
6992 - djm@cvs.openbsd.org 2013/08/08 05:04:03
6993 [sftp-client.c sftp-client.h sftp.c]
6994 add a "-l" flag for the rename command to force it to use the silly
6995 standard SSH_FXP_RENAME command instead of the POSIX-rename- like
6996 posix-rename@openssh.com extension.
6997
6998 intended for use in regress tests, so no documentation.
6999
7000commit 034f27a0c09e69fe3589045b41f03f6e345b63f5
7001Author: Damien Miller <djm@mindrot.org>
7002Date: Wed Aug 21 02:40:44 2013 +1000
7003
7004 - djm@cvs.openbsd.org 2013/08/08 04:52:04
7005 [sftp.c]
7006 fix two year old regression: symlinking a file would incorrectly
7007 canonicalise the target path. bz#2129 report from delphij AT freebsd.org
7008
7009commit c6895c5c67492144dd28589e5788f783be9152ed
7010Author: Damien Miller <djm@mindrot.org>
7011Date: Wed Aug 21 02:40:21 2013 +1000
7012
7013 - jmc@cvs.openbsd.org 2013/08/07 06:24:51
7014 [sftp.1 sftp.c]
7015 sort -a;
7016
7017commit a6d6c1f38ac9b4a5e1bd4df889e1020a8370ed55
7018Author: Damien Miller <djm@mindrot.org>
7019Date: Wed Aug 21 02:40:01 2013 +1000
7020
7021 - djm@cvs.openbsd.org 2013/08/06 23:06:01
7022 [servconf.c]
7023 add cast to avoid format warning; from portable
7024
7025commit eec840673bce3f69ad269672fba7ed8ff05f154f
7026Author: Damien Miller <djm@mindrot.org>
7027Date: Wed Aug 21 02:39:39 2013 +1000
7028
7029 - djm@cvs.openbsd.org 2013/08/06 23:05:01
7030 [sftp.1]
7031 document top-level -a option (the -a option to 'get' was already
7032 documented)
7033
7034commit 02e878070d0eddad4e11f2c82644b275418eb112
7035Author: Damien Miller <djm@mindrot.org>
7036Date: Wed Aug 21 02:38:51 2013 +1000
7037
7038 - djm@cvs.openbsd.org 2013/08/06 23:03:49
7039 [sftp.c]
7040 fix some whitespace at EOL
7041 make list of commands an enum rather than a long list of defines
7042 add -a to usage()
7043
7044commit acd2060f750c16d48b87b92a10b5a833227baf9d
7045Author: Darren Tucker <dtucker@zip.com.au>
7046Date: Thu Aug 8 17:02:12 2013 +1000
7047
7048 - (dtucker) [regress/Makefile regress/test-exec.sh] Roll back the -nt
7049 removal. The "make clean" removes modpipe which is built by the top-level
7050 directory before running the tests. Spotted by tim@
7051
7052commit 9542de4547beebf707f3640082d471f1a85534c9
7053Author: Darren Tucker <dtucker@zip.com.au>
7054Date: Thu Aug 8 12:50:06 2013 +1000
7055
7056 - (dtucker) [misc.c] Remove define added for fallback testing that was
7057 mistakenly included in the previous commit.
7058
7059commit 94396b7f06f512a0acb230640d7f703fb802a9ee
7060Author: Darren Tucker <dtucker@zip.com.au>
7061Date: Thu Aug 8 11:52:37 2013 +1000
7062
7063 - (dtucker) [misc.c] Fall back to time(2) at runtime if clock_gettime(
7064 CLOCK_MONOTONIC...) fails. Some older versions of RHEL have the
7065 CLOCK_MONOTONIC define but don't actually support it. Found and tested
7066 by Kevin Brott, ok djm.
7067
7068commit a5a3cbfa0fb8ef011d3e7b38910a13f6ebbb8818
7069Author: Darren Tucker <dtucker@zip.com.au>
7070Date: Thu Aug 8 10:58:49 2013 +1000
7071
7072 - (dtucker) [regress/Makefile regress/test-exec.sh] Don't try to use test -nt
7073 since some platforms (eg really old FreeBSD) don't have it. Instead,
7074 run "make clean" before a complete regress run. ok djm.
7075
7076commit f3ab2c5f9cf4aed44971eded3ac9eeb1344b2be5
7077Author: Darren Tucker <dtucker@zip.com.au>
7078Date: Sun Aug 4 21:48:41 2013 +1000
7079
7080 - (dtucker) [auth-krb5.c configure.ac openbsd-compat/bsd-misc.h] Add support
7081 for building with older Heimdal versions. ok djm.
7082
7083commit ab3575c055adfbce70fa7405345cf0f80b07c827
7084Author: Damien Miller <djm@mindrot.org>
7085Date: Thu Aug 1 14:34:16 2013 +1000
7086
7087 - (djm) [sshlogin.h] Fix prototype merge botch from 2006; bz#2134
7088
7089commit c192a4c4f6da907dc0e67a3ca61d806f9a92c931
7090Author: Damien Miller <djm@mindrot.org>
7091Date: Thu Aug 1 14:29:20 2013 +1000
7092
7093 - (djm) [channels.c channels.h] bz#2135: On Solaris, isatty() on a non-
7094 blocking connecting socket will clear any stored errno that might
7095 otherwise have been retrievable via getsockopt(). A hack to limit writes
7096 to TTYs on AIX was triggering this. Since only AIX needs the hack, wrap
7097 it in an #ifdef. Diagnosis and patch from Ivo Raisr.
7098
7099commit 81f7cf1ec5bc2fd202eda05abc2e5361c54633c5
7100Author: Tim Rice <tim@multitalents.net>
7101Date: Thu Jul 25 18:41:40 2013 -0700
7102
7103 more correct comment for last commit
7104
7105commit 0553ad76ffdff35fb31b9e6df935a71a1cc6daa2
7106Author: Tim Rice <tim@multitalents.net>
7107Date: Thu Jul 25 16:03:16 2013 -0700
7108
7109 - (tim) [regress/forwarding.sh] Fix for building outside read only source tree.
7110
7111commit ed899eb597a8901ff7322cba809660515ec0d601
7112Author: Tim Rice <tim@multitalents.net>
7113Date: Thu Jul 25 15:40:00 2013 -0700
7114
7115 - (tim) [sftp-client.c] Use of a gcc extension trips up native compilers on
7116 Solaris and UnixWare. Feedback and OK djm@
7117
7118commit e9e936d33b4b1d77ffbaace9438cb2f1469c1dc7
7119Author: Damien Miller <djm@mindrot.org>
7120Date: Thu Jul 25 12:34:00 2013 +1000
7121
7122 - (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec]
7123 [contrib/suse/openssh.spec] Update version numbers
7124
7125commit d1e26cf391de31128b4edde118bff5fed98a90ea
7126Author: Damien Miller <djm@mindrot.org>
7127Date: Thu Jul 25 12:11:18 2013 +1000
7128
7129 - djm@cvs.openbsd.org 2013/06/21 02:26:26
7130 [regress/sftp-cmds.sh regress/test-exec.sh]
7131 unbreak sftp-cmds for renamed test data (s/ls/data/)
7132
7133commit 78d47b7c5b182e44552913de2b4b7e0363c8e3cc
7134Author: Damien Miller <djm@mindrot.org>
7135Date: Thu Jul 25 12:08:46 2013 +1000
7136
7137 - dtucker@cvs.openbsd.org 2013/06/10 21:56:43
7138 [regress/forwarding.sh]
7139 Add test for forward config parsing
7140
7141commit fea440639e04cea9f2605375a41d654390369402
7142Author: Damien Miller <djm@mindrot.org>
7143Date: Thu Jul 25 12:08:07 2013 +1000
7144
7145 - dtucker@cvs.openbsd.org 2013/05/30 20:12:32
7146 [regress/test-exec.sh]
7147 use ssh and sshd as testdata since it needs to be >256k for the rekey test
7148
7149commit 53435b2d8773a5d7c78359e9f7bf9df2d93b9ef5
7150Author: Damien Miller <djm@mindrot.org>
7151Date: Thu Jul 25 11:57:15 2013 +1000
7152
7153 - djm@cvs.openbsd.org 2013/07/25 00:57:37
7154 [version.h]
7155 openssh-6.3 for release
7156
7157commit 0d032419ee6e1968fc1cb187af63bf3b77b506ea
7158Author: Damien Miller <djm@mindrot.org>
7159Date: Thu Jul 25 11:56:52 2013 +1000
7160
7161 - djm@cvs.openbsd.org 2013/07/25 00:56:52
7162 [sftp-client.c sftp-client.h sftp.1 sftp.c]
7163 sftp support for resuming partial downloads; patch mostly by Loganaden
7164 Velvindron/AfriNIC with some tweaks by me; feedback and ok dtucker@
7165
7166commit 98e27dcf581647b5bbe9780e8f59685d942d8ea3
7167Author: Damien Miller <djm@mindrot.org>
7168Date: Thu Jul 25 11:55:52 2013 +1000
7169
7170 - djm@cvs.openbsd.org 2013/07/25 00:29:10
7171 [ssh.c]
7172 daemonise backgrounded (ControlPersist'ed) multiplexing master to ensure
7173 it is fully detached from its controlling terminal. based on debugging
7174
7175commit 94c9cd34d1590ea1d4bf76919a15b5688fa90ed1
7176Author: Damien Miller <djm@mindrot.org>
7177Date: Thu Jul 25 11:55:39 2013 +1000
7178
7179 - djm@cvs.openbsd.org 2013/07/22 12:20:02
7180 [umac.h]
7181 oops, forgot to commit corresponding header change;
7182 spotted by jsg and jasper
7183
7184commit c331dbd22297ab9bf351abee659893d139c9f28a
7185Author: Damien Miller <djm@mindrot.org>
7186Date: Thu Jul 25 11:55:20 2013 +1000
7187
7188 - djm@cvs.openbsd.org 2013/07/22 05:00:17
7189 [umac.c]
7190 make MAC key, data to be hashed and nonce for final hash const;
7191 checked with -Wcast-qual
7192
7193commit c8669a8cd24952b3f16a44eac63d2b6ce8a6343a
7194Author: Damien Miller <djm@mindrot.org>
7195Date: Thu Jul 25 11:52:48 2013 +1000
7196
7197 - djm@cvs.openbsd.org 2013/07/20 22:20:42
7198 [krl.c]
7199 fix verification error in (as-yet usused) KRL signature checking path
7200
7201commit 63ddc899d28cf60045b560891894b9fbf6f822e9
7202Author: Damien Miller <djm@mindrot.org>
7203Date: Sat Jul 20 13:35:45 2013 +1000
7204
7205 - djm@cvs.openbsd.org 2013/07/20 01:55:13
7206 [auth-krb5.c gss-serv-krb5.c gss-serv.c]
7207 fix kerberos/GSSAPI deprecation warnings and linking; "looks okay" millert@
7208
7209commit 1f0e86f23fcebb026371c0888402a981df2a61c4
7210Author: Damien Miller <djm@mindrot.org>
7211Date: Sat Jul 20 13:22:49 2013 +1000
7212
7213 - djm@cvs.openbsd.org 2013/07/20 01:50:20
7214 [ssh-agent.c]
7215 call cleanup_handler on SIGINT when in debug mode to ensure sockets
7216 are cleaned up on manual exit; bz#2120
7217
7218commit 3009d3cbb89316b1294fb5cedb54770b5d114d04
7219Author: Damien Miller <djm@mindrot.org>
7220Date: Sat Jul 20 13:22:31 2013 +1000
7221
7222 - djm@cvs.openbsd.org 2013/07/20 01:44:37
7223 [ssh-keygen.c ssh.c]
7224 More useful error message on missing current user in /etc/passwd
7225
7226commit 32ecfa0f7920db31471ca8c1f4adc20ae38ed9d6
7227Author: Damien Miller <djm@mindrot.org>
7228Date: Sat Jul 20 13:22:13 2013 +1000
7229
7230 - djm@cvs.openbsd.org 2013/07/20 01:43:46
7231 [umac.c]
7232 use a union to ensure correct alignment; ok deraadt
7233
7234commit 85b45e09188e7a7fc8f0a900a4c6a0f04a5720a7
7235Author: Damien Miller <djm@mindrot.org>
7236Date: Sat Jul 20 13:21:52 2013 +1000
7237
7238 - markus@cvs.openbsd.org 2013/07/19 07:37:48
7239 [auth.h kex.h kexdhs.c kexecdhs.c kexgexs.c monitor.c servconf.c]
7240 [servconf.h session.c sshd.c sshd_config.5]
7241 add ssh-agent(1) support to sshd(8); allows encrypted hostkeys,
7242 or hostkeys on smartcards; most of the work by Zev Weiss; bz #1974
7243 ok djm@
7244
7245commit d93340cbb6bc0fc0dbd4427e0cec6d994a494dd9
7246Author: Damien Miller <djm@mindrot.org>
7247Date: Thu Jul 18 16:14:34 2013 +1000
7248
7249 - djm@cvs.openbsd.org 2013/07/18 01:12:26
7250 [ssh.1]
7251 be more exact wrt perms for ~/.ssh/config; bz#2078
7252
7253commit bf836e535dc3a8050c1756423539bac127ee5098
7254Author: Damien Miller <djm@mindrot.org>
7255Date: Thu Jul 18 16:14:13 2013 +1000
7256
7257 - schwarze@cvs.openbsd.org 2013/07/16 00:07:52
7258 [scp.1 sftp-server.8 ssh-keyscan.1 ssh-keysign.8 ssh-pkcs11-helper.8]
7259 use .Mt for email addresses; from Jan Stary <hans at stare dot cz>; ok jmc@
7260
7261commit 649fe025a409d0ce88c60a068f3f211193c35873
7262Author: Damien Miller <djm@mindrot.org>
7263Date: Thu Jul 18 16:13:55 2013 +1000
7264
7265 - djm@cvs.openbsd.org 2013/07/12 05:48:55
7266 [ssh.c]
7267 set TCP nodelay for connections started with -N; bz#2124 ok dtucker@
7268
7269commit 5bb8833e809d827496dffca0dc2c223052c93931
7270Author: Damien Miller <djm@mindrot.org>
7271Date: Thu Jul 18 16:13:37 2013 +1000
7272
7273 - djm@cvs.openbsd.org 2013/07/12 05:42:03
7274 [ssh-keygen.c]
7275 do_print_resource_record() can never be called with a NULL filename, so
7276 don't attempt (and bungle) asking for one if it has not been specified
7277 bz#2127 ok dtucker@
7278
7279commit 7313fc9222785d0c54a7ffcaf2067f4db02c8d72
7280Author: Damien Miller <djm@mindrot.org>
7281Date: Thu Jul 18 16:13:19 2013 +1000
7282
7283 - djm@cvs.openbsd.org 2013/07/12 00:43:50
7284 [misc.c]
7285 in ssh_gai_strerror() don't fallback to strerror for EAI_SYSTEM when
7286 errno == 0. Avoids confusing error message in some broken resolver
7287 cases. bz#2122 patch from plautrba AT redhat.com; ok dtucker
7288
7289commit 746d1a6c524d2e90ebe98cc29e42573a3e1c3c1b
7290Author: Damien Miller <djm@mindrot.org>
7291Date: Thu Jul 18 16:13:02 2013 +1000
7292
7293 - djm@cvs.openbsd.org 2013/07/12 00:20:00
7294 [sftp.c ssh-keygen.c ssh-pkcs11.c]
7295 fix pointer-signedness warnings from clang/llvm-3.3; "seems nice" deraadt@
7296
7297commit ce98654674648fb7d58f73edf6aa398656a2dba4
7298Author: Damien Miller <djm@mindrot.org>
7299Date: Thu Jul 18 16:12:44 2013 +1000
7300
7301 - djm@cvs.openbsd.org 2013/07/12 00:19:59
7302 [auth-options.c auth-rsa.c bufaux.c buffer.h channels.c hostfile.c]
7303 [hostfile.h mux.c packet.c packet.h roaming_common.c serverloop.c]
7304 fix pointer-signedness warnings from clang/llvm-3.3; "seems nice" deraadt@
7305
7306commit 0d02c3e10e1ed16d6396748375a133d348127a2a
7307Author: Damien Miller <djm@mindrot.org>
7308Date: Thu Jul 18 16:12:06 2013 +1000
7309
7310 - markus@cvs.openbsd.org 2013/07/02 12:31:43
7311 [dh.c]
7312 remove extra whitespace
7313
7314commit fecfd118d6c90df4fcd3cec7b14e4d3ce69a41d5
7315Author: Damien Miller <djm@mindrot.org>
7316Date: Thu Jul 18 16:11:50 2013 +1000
7317
7318 - jmc@cvs.openbsd.org 2013/06/27 14:05:37
7319 [ssh-keygen.1 ssh.1 ssh_config.5 sshd.8 sshd_config.5]
7320 do not use Sx for sections outwith the man page - ingo informs me that
7321 stuff like html will render with broken links;
7322
7323 issue reported by Eric S. Raymond, via djm
7324
7325commit bc35d92e78fd53c3f32cbdbdf89d8b1919788c50
7326Author: Damien Miller <djm@mindrot.org>
7327Date: Thu Jul 18 16:11:25 2013 +1000
7328
7329 - djm@cvs.openbsd.org 2013/06/22 06:31:57
7330 [scp.c]
7331 improved time_t overflow check suggested by guenther@
7332
7333commit 8158441d01ab84f33a7e70e27f87c02cbf67e709
7334Author: Damien Miller <djm@mindrot.org>
7335Date: Thu Jul 18 16:11:07 2013 +1000
7336
7337 - djm@cvs.openbsd.org 2013/06/21 05:43:10
7338 [scp.c]
7339 make this -Wsign-compare clean after time_t conversion
7340
7341commit bbeb1dac550bad8e6aff9bd27113c6bd5ebb7413
7342Author: Damien Miller <djm@mindrot.org>
7343Date: Thu Jul 18 16:10:49 2013 +1000
7344
7345 - djm@cvs.openbsd.org 2013/06/21 05:42:32
7346 [dh.c]
7347 sprinkle in some error() to explain moduli(5) parse failures
7348
7349commit 7f2b438ca0b7c3b9684a03d7bf3eaf379da16de9
7350Author: Damien Miller <djm@mindrot.org>
7351Date: Thu Jul 18 16:10:29 2013 +1000
7352
7353 - djm@cvs.openbsd.org 2013/06/21 00:37:49
7354 [ssh_config.5]
7355 explicitly mention that IdentitiesOnly can be used with IdentityFile
7356 to control which keys are offered from an agent.
7357
7358commit 20bdcd72365e8b3d51261993928cc47c5f0d7c8a
7359Author: Damien Miller <djm@mindrot.org>
7360Date: Thu Jul 18 16:10:09 2013 +1000
7361
7362 - djm@cvs.openbsd.org 2013/06/21 00:34:49
7363 [auth-rsa.c auth.h auth2-hostbased.c auth2-pubkey.c monitor.c]
7364 for hostbased authentication, print the client host and user on
7365 the auth success/failure line; bz#2064, ok dtucker@
7366
7367commit 3071070b39e6d1722151c754cdc2b26640eaf45e
7368Author: Damien Miller <djm@mindrot.org>
7369Date: Thu Jul 18 16:09:44 2013 +1000
7370
7371 - markus@cvs.openbsd.org 2013/06/20 19:15:06
7372 [krl.c]
7373 don't leak the rdata blob on errors; ok djm@
7374
7375commit 044bd2a7ddb0b6f6b716c87e57261572e2b89028
7376Author: Damien Miller <djm@mindrot.org>
7377Date: Thu Jul 18 16:09:25 2013 +1000
7378
7379 - guenther@cvs.openbsd.org 2013/06/17 04:48:42
7380 [scp.c]
7381 Handle time_t values as long long's when formatting them and when
7382 parsing them from remote servers.
7383 Improve error checking in parsing of 'T' lines.
7384
7385 ok dtucker@ deraadt@
7386
7387commit 9a6615542108118582f64b7161ca0e12176e3712
7388Author: Damien Miller <djm@mindrot.org>
7389Date: Thu Jul 18 16:09:04 2013 +1000
7390
7391 - dtucker@cvs.openbsd.org 2013/06/10 19:19:44
7392 [readconf.c]
7393 revert 1.203 while we investigate crashes reported by okan@
7394
7395commit b7482cff46e7e76bfb3cda86c365a08f58d4fca0
7396Author: Darren Tucker <dtucker@zip.com.au>
7397Date: Tue Jul 2 20:06:46 2013 +1000
7398
7399 - (dtucker) [contrib/cygwin/README contrib/cygwin/ssh-host-config
7400 contrib/cygwin/ssh-user-config] Modernizes and improve readability of
7401 the Cygwin README file (which hasn't been updated for ages), drop
7402 unsupported OSes from the ssh-host-config help text, and drop an
7403 unneeded option from ssh-user-config. Patch from vinschen at redhat com.
7404
7405commit b8ae92d08b91beaef34232c6ef34b9941473fdd6
7406Author: Darren Tucker <dtucker@zip.com.au>
7407Date: Tue Jun 11 12:10:02 2013 +1000
7408
7409 - (dtucker) [myproposal.h] Make the conditional algorithm support consistent
7410 and add some comments so it's clear what goes where.
7411
7412commit 97b62f41adcb0dcbeff142d0540793a7ea17c910
7413Author: Darren Tucker <dtucker@zip.com.au>
7414Date: Tue Jun 11 11:47:24 2013 +1000
7415
7416 - (dtucker) [myproposal.h] Do not advertise AES GSM ciphers if we don't have
7417 the required OpenSSL support. Patch from naddy at freebsd.
7418
7419commit 6d8bd57448b45b42809da32857d7804444349ee7
7420Author: Darren Tucker <dtucker@zip.com.au>
7421Date: Tue Jun 11 11:26:10 2013 +1000
7422
7423 - (dtucker) [Makefile.in configure.ac fixalgorithms] Remove unsupported
7424 algorithms (Ciphers, MACs and HostKeyAlgorithms) from man pages.
7425
7426commit 36187093ea0b2d2240c043417b8949611687e105
7427Author: Damien Miller <djm@mindrot.org>
7428Date: Mon Jun 10 13:07:11 2013 +1000
7429
7430 - dtucker@cvs.openbsd.org 2013/06/07 15:37:52
7431 [channels.c channels.h clientloop.c]
7432 Add an "ABANDONED" channel state and use for mux sessions that are
7433 disconnected via the ~. escape sequence. Channels in this state will
7434 be able to close if the server responds, but do not count as active channels.
7435 This means that if you ~. all of the mux clients when using ControlPersist
7436 on a broken network, the backgrounded mux master will exit when the
7437 Control Persist time expires rather than hanging around indefinitely.
7438 bz#1917, also reported and tested by tedu@. ok djm@ markus@.
7439
7440commit ae133d4b31af05bb232d797419f498f3ae7e9f2d
7441Author: Darren Tucker <dtucker@zip.com.au>
7442Date: Thu Jun 6 08:30:20 2013 +1000
7443
7444 - (dtucker) [configure.ac sftp.c openbsd-compat/openbsd-compat.h] Cater for
7445 platforms that don't have multibyte character support (specifically,
7446 mblen).
7447
7448commit 408eaf3ab716096f8faf30f091bd54a2c7a17a09
7449Author: Darren Tucker <dtucker@zip.com.au>
7450Date: Thu Jun 6 08:22:46 2013 +1000
7451
7452 - dtucker@cvs.openbsd.org 2013/06/05 22:00:28
7453 [readconf.c]
7454 plug another memleak. bz#1967, from Zhenbo Xu, detected by Melton, ok djm
7455
7456commit e52a260f16888ca75390f97de4606943e61785e8
7457Author: Darren Tucker <dtucker@zip.com.au>
7458Date: Thu Jun 6 08:22:05 2013 +1000
7459
7460 - dtucker@cvs.openbsd.org 2013/06/05 12:52:38
7461 [sshconnect2.c]
7462 Fix memory leaks found by Zhenbo Xu and the Melton tool. bz#1967, ok djm
7463
7464commit 0cca17fa1819d3a0ba06a6db41ab3eaa8d769587
7465Author: Darren Tucker <dtucker@zip.com.au>
7466Date: Thu Jun 6 08:21:14 2013 +1000
7467
7468 - dtucker@cvs.openbsd.org 2013/06/05 02:27:50
7469 [sshd.c]
7470 When running sshd -D, close stderr unless we have explicitly requesting
7471 logging to stderr. From james.hunt at ubuntu.com via bz#1976, djm's patch
7472 so, err, ok dtucker.
7473
7474commit 746e9067bd9b3501876e1c86f38f3c510a12f895
7475Author: Darren Tucker <dtucker@zip.com.au>
7476Date: Thu Jun 6 08:20:13 2013 +1000
7477
7478 - dtucker@cvs.openbsd.org 2013/06/05 02:07:29
7479 [mux.c]
7480 fix leaks in mux error paths, from Zhenbo Xu, found by Melton. bz#1967,
7481 ok djm
7482
7483commit ea64721275a81c4788af36294d94bf4f74012e06
7484Author: Darren Tucker <dtucker@zip.com.au>
7485Date: Thu Jun 6 08:19:09 2013 +1000
7486
7487 - dtucker@cvs.openbsd.org 2013/06/04 20:42:36
7488 [sftp.c]
7489 Make sftp's libedit interface marginally multibyte aware by building up
7490 the quoted string by character instead of by byte. Prevents failures
7491 when linked against a libedit built with wide character support (bz#1990).
7492 "looks ok" djm
7493
7494commit 194454d7a8f8cb8ac55f2b9d0199ef9445788bee
7495Author: Darren Tucker <dtucker@zip.com.au>
7496Date: Thu Jun 6 08:16:04 2013 +1000
7497
7498 - dtucker@cvs.openbsd.org 2013/06/04 19:12:23
7499 [scp.c]
7500 use MAXPATHLEN for buffer size instead of fixed value. ok markus
7501
7502commit 4ac66af091cf6db5a42c18e43738ca9c41e338e5
7503Author: Darren Tucker <dtucker@zip.com.au>
7504Date: Thu Jun 6 08:12:37 2013 +1000
7505
7506 - dtucker@cvs.openbsd.org 2013/06/03 00:03:18
7507 [mac.c]
7508 force the MAC output to be 64-bit aligned so umac won't see unaligned
7509 accesses on strict-alignment architectures. bz#2101, patch from
7510 tomas.kuthan at oracle.com, ok djm@
7511
7512commit ea8342c248ad6c0a4fe1a70de133f954973bd2b2
7513Author: Darren Tucker <dtucker@zip.com.au>
7514Date: Thu Jun 6 08:11:40 2013 +1000
7515
7516 - dtucker@cvs.openbsd.org 2013/06/02 23:36:29
7517 [clientloop.h clientloop.c mux.c]
7518 No need for the mux cleanup callback to be visible so restore it to static
7519 and call it through the detach_user function pointer. ok djm@
7520
7521commit 5d12b8f05d79ba89d0807910a664fa80f6f3bf8c
7522Author: Darren Tucker <dtucker@zip.com.au>
7523Date: Thu Jun 6 08:09:10 2013 +1000
7524
7525 - dtucker@cvs.openbsd.org 2013/06/02 21:01:51
7526 [channels.h]
7527 typo in comment
7528
7529commit dc62edbf121c41e8b5270904091039450206d98a
7530Author: Darren Tucker <dtucker@zip.com.au>
7531Date: Thu Jun 6 05:12:35 2013 +1000
7532
7533 - (dtucker) [Makefile.in] append $CFLAGS to compiler options when building
7534 modpipe in case there's anything in there we need.
7535
7536commit 2a22873cd869679415104bc9f6bb154811ee604c
7537Author: Darren Tucker <dtucker@zip.com.au>
7538Date: Thu Jun 6 01:59:13 2013 +1000
7539
7540 - (dtucker) [regress/forwarding.sh] For (as yet unknown) reason, the
7541 forwarding test is extremely slow copying data on some machines so switch
7542 back to copying the much smaller ls binary until we can figure out why
7543 this is.
7544
7545commit b4e00949f01176cd4fae3e0cef5ffa8dea379042
7546Author: Darren Tucker <dtucker@zip.com.au>
7547Date: Wed Jun 5 22:48:44 2013 +1000
7548
7549 - (dtucker) [contrib/ssh-copy-id] bz#2117: Use portable operator in test.
7550 Patch from cjwatson at debian.
7551
7552commit 2ea9eb77a7fcab3190564ef5a6a5377a600aa391
7553Author: Darren Tucker <dtucker@zip.com.au>
7554Date: Wed Jun 5 15:04:00 2013 +1000
7555
7556 - (dtucker) Enable sha256 kex methods based on the presence of the necessary
7557 functions, not from the openssl version.
7558
7559commit 16cac190ebb9b5612cccea63a7c22ac33bc9a07a
7560Author: Darren Tucker <dtucker@zip.com.au>
7561Date: Tue Jun 4 12:55:24 2013 +1000
7562
7563 - (dtucker) [configure.ac] Some other platforms need sys/types.h before
7564 sys/socket.h.
7565
7566commit 0b43ffe143a5843703c3755fa040b8684fb04134
7567Author: Darren Tucker <dtucker@zip.com.au>
7568Date: Mon Jun 3 09:30:44 2013 +1000
7569
7570 - (dtucker) [configure.ac] Some platforms need sys/types.h before sys/un.h.
7571
7572commit 3f3064c82238c486706471d300217d73dd0f125e
7573Author: Tim Rice <tim@multitalents.net>
7574Date: Sun Jun 2 15:13:09 2013 -0700
7575
7576 - (tim) [regress/sftp-chroot.sh] skip if no sudo. ok dtucker
7577
7578commit 01ec0af301f60fefdd0079647f13ef9abadd2db5
7579Author: Tim Rice <tim@multitalents.net>
7580Date: Sun Jun 2 14:31:27 2013 -0700
7581
7582 - (tim) [aclocal.m4] Enhance OSSH_CHECK_CFLAG_COMPILE to check stderr.
7583 feedback and ok dtucker
7584
7585commit 5ab9b63468100757479534edeb53f788a61fe08b
7586Author: Tim Rice <tim@multitalents.net>
7587Date: Sun Jun 2 14:05:48 2013 -0700
7588
7589 - (tim) [configure.ac regress/Makefile] With rev 1.47 of test-exec.sh we
7590 need a shell that can handle "[ file1 -nt file2 ]". Rather than keep
7591 dealing with shell portability issues in regression tests, we let
7592 configure find us a capable shell on those platforms with an old /bin/sh.
7593
7594commit 898ac935e56a7ac5d8b686c590fdb8b7aca27e59
7595Author: Darren Tucker <dtucker@zip.com.au>
7596Date: Mon Jun 3 02:03:25 2013 +1000
7597
7598 - (dtucker) [configure.ac] bz#2111: don't try to use lastlog on Android.
7599 Patch from Nathan Osman.
7600
7601commit ef4901c3eb98c7ab1342c3cd8f2638da1f4b0678
7602Author: Darren Tucker <dtucker@zip.com.au>
7603Date: Mon Jun 3 01:59:13 2013 +1000
7604
7605 - (dtucker) [configure.ac] sys/un.h needs sys/socket.h on some platforms
7606 to prevent noise from configure. Patch from Nathan Osman.
7607
7608commit 073f795bc1c7728c320e5982c0d417376b0907f5
7609Author: Darren Tucker <dtucker@zip.com.au>
7610Date: Sun Jun 2 23:47:11 2013 +1000
7611
7612 - dtucker@cvs.openbsd.org 2013/06/02 13:35:58
7613 [ssh-agent.c]
7614 Make parent_alive_interval time_t to avoid signed/unsigned comparison
7615
7616commit 00e1abb1ebe13ab24e812f68715f46e65e7c5271
7617Author: Darren Tucker <dtucker@zip.com.au>
7618Date: Sun Jun 2 23:46:24 2013 +1000
7619
7620 - dtucker@cvs.openbsd.org 2013/06/02 13:33:05
7621 [progressmeter.c]
7622 Add misc.h for monotime prototype. (id sync only)
7623
7624commit 86211d1738695e63b2a68f0c3a4f60e1a9d9bda3
7625Author: Tim Rice <tim@multitalents.net>
7626Date: Sat Jun 1 18:38:23 2013 -0700
7627
7628 20130602
7629 - (tim) [Makefile.in] Make Solaris, UnixWare, & OpenServer linkers happy
7630 linking regress/modpipe.
7631
7632commit e9887d1c37940b9d6c72d55cfad7a40de4c6e28d
7633Author: Darren Tucker <dtucker@zip.com.au>
7634Date: Sun Jun 2 09:17:09 2013 +1000
7635
7636 - (dtucker) [sandbox-seccomp-filter.c] Allow clock_gettimeofday.
7637
7638commit 65cf74079a2d563c4ede649116a13ca78c8cc2a4
7639Author: Darren Tucker <dtucker@zip.com.au>
7640Date: Sun Jun 2 09:11:19 2013 +1000
7641
7642 fix typo
7643
7644commit c9a1991b95a4c9f04f9dcef299a8110d2ec80d3e
7645Author: Darren Tucker <dtucker@zip.com.au>
7646Date: Sun Jun 2 08:37:05 2013 +1000
7647
7648 - dtucker@cvs.openbsd.org 2013/06/01 22:34:50
7649 [sftp-client.c]
7650 Update progressmeter when data is acked, not when it's sent. bz#2108, from
7651 Debian via Colin Watson, ok djm@
7652
7653commit a710891659202c82545e84725d4e5cd77aef567c
7654Author: Darren Tucker <dtucker@zip.com.au>
7655Date: Sun Jun 2 08:18:31 2013 +1000
7656
7657 - (dtucker) [configure.ac misc.c] Look for clock_gettime in librt and fall
7658 back to time(NULL) if we can't find it anywhere.
7659
7660commit f60845fde29cead9d75e812db1c04916b4c58ffd
7661Author: Darren Tucker <dtucker@zip.com.au>
7662Date: Sun Jun 2 08:07:31 2013 +1000
7663
7664 - (dtucker) [M auth-chall.c auth-krb5.c auth-pam.c cipher-aes.c cipher-ctr.c
7665 groupaccess.c loginrec.c monitor.c monitor_wrap.c session.c sshd.c
7666 sshlogin.c uidswap.c openbsd-compat/bsd-cygwin_util.c
7667 openbsd-compat/getrrsetbyname-ldns.c openbsd-compat/port-aix.c
7668 openbsd-compat/port-linux.c] Replace portable-specific instances of xfree
7669 with the equivalent calls to free.
7670
7671commit 12f6533215c0a36ab29d11ff52a853fce45573b4
7672Author: Darren Tucker <dtucker@zip.com.au>
7673Date: Sun Jun 2 08:01:24 2013 +1000
7674
7675 Remove stray '+' accidentally introduced in sync
7676
7677commit 3750fce6ac6b287f62584ac55a4406df95c71b92
7678Author: Darren Tucker <dtucker@zip.com.au>
7679Date: Sun Jun 2 07:52:21 2013 +1000
7680
7681 - dtucker@cvs.openbsd.org 2013/06/01 20:59:25
7682 [scp.c sftp-client.c]
7683 Replace S_IWRITE, which isn't standardized, with S_IWUSR, which is. Patch
7684 from Nathan Osman via bz#2113. ok deraadt.
7685
7686 (note: corrected bug number from 2085)
7687
7688commit b759c9c2efebe7b416ab81093ca8eb17836b6933
7689Author: Darren Tucker <dtucker@zip.com.au>
7690Date: Sun Jun 2 07:46:16 2013 +1000
7691
7692 - dtucker@cvs.openbsd.org 2013/06/01 13:15:52
7693 [ssh-agent.c clientloop.c misc.h packet.c progressmeter.c misc.c
7694 channels.c sandbox-systrace.c]
7695 Use clock_gettime(CLOCK_MONOTONIC ...) for ssh timers so that things like
7696 keepalives and rekeying will work properly over clock steps. Suggested by
7697 markus@, "looks good" djm@.
7698
7699commit 55119253c64808b0d3b2ab5d2bc67ee9dac3430b
7700Author: Darren Tucker <dtucker@zip.com.au>
7701Date: Sun Jun 2 07:43:59 2013 +1000
7702
7703 - dtucker@cvs.openbsd.org 2013/05/31 12:28:10
7704 [ssh-agent.c]
7705 Use time_t where appropriate. ok djm
7706
7707commit 0acca3797d53d958d240c69a5f222f2aa8444858
7708Author: Darren Tucker <dtucker@zip.com.au>
7709Date: Sun Jun 2 07:41:51 2013 +1000
7710
7711 - djm@cvs.openbsd.org 2013/05/19 02:42:42
7712 [auth.h auth.c key.c monitor.c auth-rsa.c auth2.c auth1.c key.h]
7713 Standardise logging of supplemental information during userauth. Keys
7714 and ruser is now logged in the auth success/failure message alongside
7715 the local username, remote host/port and protocol in use. Certificates
7716 contents and CA are logged too.
7717 Pushing all logging onto a single line simplifies log analysis as it is
7718 no longer necessary to relate information scattered across multiple log
7719 entries. "I like it" markus@
7720
7721commit 74836ae0fabcc1a76b9d9eacd1629c88a054b2d0
7722Author: Darren Tucker <dtucker@zip.com.au>
7723Date: Sun Jun 2 07:32:00 2013 +1000
7724
7725 - djm@cvs.openbsd.org 2013/05/19 02:38:28
7726 [auth2-pubkey.c]
7727 fix failure to recognise cert-authority keys if a key of a different type
7728 appeared in authorized_keys before it; ok markus@
7729
7730commit a627d42e51ffa71e014d7b2d2c07118122fd3ec3
7731Author: Darren Tucker <dtucker@zip.com.au>
7732Date: Sun Jun 2 07:31:17 2013 +1000
7733
7734 - djm@cvs.openbsd.org 2013/05/17 00:13:13
7735 [xmalloc.h cipher.c sftp-glob.c ssh-keyscan.c ssh.c sftp-common.c
7736 ssh-ecdsa.c auth2-chall.c compat.c readconf.c kexgexs.c monitor.c
7737 gss-genr.c cipher-3des1.c kex.c monitor_wrap.c ssh-pkcs11-client.c
7738 auth-options.c rsa.c auth2-pubkey.c sftp.c hostfile.c auth2.c
7739 servconf.c auth.c authfile.c xmalloc.c uuencode.c sftp-client.c
7740 auth2-gss.c sftp-server.c bufaux.c mac.c session.c jpake.c kexgexc.c
7741 sshconnect.c auth-chall.c auth2-passwd.c sshconnect1.c buffer.c
7742 kexecdhs.c kexdhs.c ssh-rsa.c auth1.c ssh-pkcs11.c auth2-kbdint.c
7743 kexdhc.c sshd.c umac.c ssh-dss.c auth2-jpake.c bufbn.c clientloop.c
7744 monitor_mm.c scp.c roaming_client.c serverloop.c key.c auth-rsa.c
7745 ssh-pkcs11-helper.c ssh-keysign.c ssh-keygen.c match.c channels.c
7746 sshconnect2.c addrmatch.c mux.c canohost.c kexecdhc.c schnorr.c
7747 ssh-add.c misc.c auth2-hostbased.c ssh-agent.c bufec.c groupaccess.c
7748 dns.c packet.c readpass.c authfd.c moduli.c]
7749 bye, bye xfree(); ok markus@
7750
7751commit c7aad0058c957afeb26a3f703e8cb0eddeb62365
7752Author: Darren Tucker <dtucker@zip.com.au>
7753Date: Sun Jun 2 07:18:47 2013 +1000
7754
7755 - (dtucker) [configure.ac defines.h] Test for fd_mask, howmany and NFDBITS
7756 rather than trying to enumerate the plaforms that don't have them.
7757 Based on a patch from Nathan Osman, with help from tim@.
7758
7759commit c0c3373216801797053e123b5f62d35bf41b3611
7760Author: Darren Tucker <dtucker@zip.com.au>
7761Date: Sun Jun 2 06:28:03 2013 +1000
7762
7763 - (dtucker) [configure.ac openbsd-compat/xcrypt.c] bz#2112: fall back to
7764 using openssl's DES_crpyt function on platorms that don't have a native
7765 one, eg Android. Based on a patch from Nathan Osman.
7766
7767commit efdf5342143a887013a1daae583167dadf6752a7
7768Author: Darren Tucker <dtucker@zip.com.au>
7769Date: Thu May 30 08:29:08 2013 +1000
7770
7771 - (dtucker) [configure.ac openbsd-compat/bsd-misc.h] bz#2087: Add a null
7772 implementation of endgrent for platforms that don't have it (eg Android).
7773 Loosely based on a patch from Nathan Osman, ok djm
7774
7775commit 9b42d327380e5cd04efde6fb70e1535fecedf0d7
7776Author: Darren Tucker <dtucker@zip.com.au>
7777Date: Fri May 17 20:48:59 2013 +1000
7778
7779 - dtucker@cvs.openbsd.org 2013/05/17 10:35:43
7780 [regress/scp.sh]
7781 use a file extention that's not special on some platforms. from portable
7782 (id sync only)
7783
7784commit 0a404b0ed79ba45ccaf7ed5528a8f5004c3698cb
7785Author: Darren Tucker <dtucker@zip.com.au>
7786Date: Fri May 17 20:47:29 2013 +1000
7787
7788 - dtucker@cvs.openbsd.org 2013/05/17 10:34:30
7789 [regress/portnum.sh]
7790 use a more portable negated if structure. from portable (id sync only)
7791
7792commit 62ee222e6f3f5ee288434f58b5136ae3d56f5164
7793Author: Darren Tucker <dtucker@zip.com.au>
7794Date: Fri May 17 20:46:00 2013 +1000
7795
7796 - dtucker@cvs.openbsd.org 2013/05/17 10:33:09
7797 [regress/agent-getpeereid.sh]
7798 don't redirect stdout from sudo. from portable (id sync only)
7799
7800commit 00478d30cb4bcc18dc1ced8144d16b03cdf790f6
7801Author: Darren Tucker <dtucker@zip.com.au>
7802Date: Fri May 17 20:45:06 2013 +1000
7803
7804 - dtucker@cvs.openbsd.org 2013/05/17 10:30:07
7805 [regress/test-exec.sh]
7806 wait a bit longer for startup and use case for absolute path.
7807 from portable (id sync only)
7808
7809commit 98989eb95eef0aefed7e9fb4e65c2f625be946f6
7810Author: Darren Tucker <dtucker@zip.com.au>
7811Date: Fri May 17 20:44:09 2013 +1000
7812
7813 - dtucker@cvs.openbsd.org 2013/05/17 10:28:11
7814 [regress/sftp.sh]
7815 only compare copied data if sftp succeeds. from portable (id sync only)
7816
7817commit 438f60eb9a5f7cd40bb242cfec865e4fde71b07c
7818Author: Darren Tucker <dtucker@zip.com.au>
7819Date: Fri May 17 20:43:13 2013 +1000
7820
7821 - dtucker@cvs.openbsd.org 2013/05/17 10:26:26
7822 [regress/sftp-badcmds.sh]
7823 remove unused BATCH variable. (id sync only)
7824
7825commit 1466bd25a8d1ff7ae455a795d2d7d52dc17d2938
7826Author: Darren Tucker <dtucker@zip.com.au>
7827Date: Fri May 17 20:42:05 2013 +1000
7828
7829 - dtucker@cvs.openbsd.org 2013/05/17 10:24:48
7830 [localcommand.sh]
7831 use backticks for portability. (id sync only)
7832
7833commit 05b5e518c9969d63471f2ccfd85b1de6e724d30b
7834Author: Darren Tucker <dtucker@zip.com.au>
7835Date: Fri May 17 20:41:07 2013 +1000
7836
7837 - dtucker@cvs.openbsd.org 2013/05/17 10:23:52
7838 [regress/login-timeout.sh regress/reexec.sh regress/test-exec.sh]
7839 Use SUDO when cat'ing pid files and running the sshd log wrapper so that
7840 it works with a restrictive umask and the pid files are not world readable.
7841 Changes from -portable. (id sync only)
7842
7843commit dd669173f93ea8c8397e0af758eaf13ab4f1c591
7844Author: Darren Tucker <dtucker@zip.com.au>
7845Date: Fri May 17 20:39:57 2013 +1000
7846
7847 - dtucker@cvs.openbsd.org 2013/05/17 10:16:26
7848 [regress/try-ciphers.sh]
7849 use expr for math to keep diffs vs portable down
7850 (id sync only)
7851
7852commit 044f32f4c6fd342f9f5949bb0ca77624c0db4494
7853Author: Darren Tucker <dtucker@zip.com.au>
7854Date: Fri May 17 20:12:57 2013 +1000
7855
7856 - (dtucker) [regress/cfgmatch.sh] Remove unneeded sleep renderd obsolete by
7857 rev 1.6 which calls wait.
7858
7859commit 9cc8ff7b63f175661c8807006f6d2649d56ac402
7860Author: Darren Tucker <dtucker@zip.com.au>
7861Date: Fri May 17 20:01:52 2013 +1000
7862
7863 - (dtucker) [regress/runtests.sh] Remove obsolete test driver script.
7864
7865commit f8d5b3451726530a864b172c556c311370c244e1
7866Author: Darren Tucker <dtucker@zip.com.au>
7867Date: Fri May 17 19:53:25 2013 +1000
7868
7869 - (dtucker) [regress/stderr-after-eof.sh regress/test-exec.sh] Move the md5
7870 helper function to the portable part of test-exec.sh.
7871
7872commit 6f66981ed3c6bb83b937959f329323975e356c33
7873Author: Darren Tucker <dtucker@zip.com.au>
7874Date: Fri May 17 19:28:51 2013 +1000
7875
7876 - (dtucker) [regress/test-exec.sh] Move the portable-specific functions
7877 together and add a couple of missing lines from openbsd.
7878
7879commit 5f1a89a3b67264f4aa83e057cd4f74fd60b9ffa4
7880Author: Darren Tucker <dtucker@zip.com.au>
7881Date: Fri May 17 19:17:58 2013 +1000
7882
7883 - (dtucker) [regress/integrity.sh regress/krl.sh regress/test-exec.sh]
7884 Move the jot helper function to portable-specific part of test-exec.sh.
7885
7886commit 96457a54d05dea81f34ecb4e059d2f8b98382b85
7887Author: Darren Tucker <dtucker@zip.com.au>
7888Date: Fri May 17 19:03:38 2013 +1000
7889
7890 - (dtucker) [regress/agent-getpeereid.sh] Resync spaces with openbsd.
7891
7892commit 7f193236594e8328ad133ea05eded31f837b45b5
7893Author: Darren Tucker <dtucker@zip.com.au>
7894Date: Fri May 17 19:02:28 2013 +1000
7895
7896 - (dtucker) [regress/cfgmatch.sh] Resync config file setup with openbsd.
7897
7898commit 8654dd2d737800d09e7730b3dfc2a54411f4cf90
7899Author: Darren Tucker <dtucker@zip.com.au>
7900Date: Fri May 17 16:03:48 2013 +1000
7901
7902 - (dtucker) [openbsd-compat/getopt.h] Remove unneeded bits.
7903
7904commit 59d928d3b47e8298f4a8b4b3fb37fb8c8ce1b098
7905Author: Darren Tucker <dtucker@zip.com.au>
7906Date: Fri May 17 15:32:29 2013 +1000
7907
7908 - dtucker@cvs.openbsd.org 2013/05/17 04:29:14
7909 [regress/sftp.sh regress/putty-ciphers.sh regress/cipher-speed.sh
7910 regress/test-exec.sh regress/sftp-batch.sh regress/dynamic-forward.sh
7911 regress/putty-transfer.sh regress/conch-ciphers.sh regress/sftp-cmds.sh
7912 regress/scp.sh regress/ssh-com-sftp.sh regress/rekey.sh
7913 regress/putty-kex.sh regress/stderr-data.sh regress/stderr-after-eof.sh
7914 regress/sftp-badcmds.sh regress/reexec.sh regress/ssh-com-client.sh
7915 regress/sftp-chroot.sh regress/forwarding.sh regress/transfer.sh
7916 regress/multiplex.sh]
7917 Move the setting of DATA and COPY into test-exec.sh
7918
7919commit 34035be27b7ddd84706fe95c39d37cba7d5c9572
7920Author: Darren Tucker <dtucker@zip.com.au>
7921Date: Fri May 17 14:47:51 2013 +1000
7922
7923 - dtucker@cvs.openbsd.org 2013/05/17 01:32:11
7924 [regress/integrity.sh]
7925 don't print output from ssh before getting it (it's available in ssh.log)
7926
7927commit b8b96b0aa634d440feba4331c80ae4de9dda2081
7928Author: Darren Tucker <dtucker@zip.com.au>
7929Date: Fri May 17 14:46:20 2013 +1000
7930
7931 - dtucker@cvs.openbsd.org 2013/05/17 01:16:09
7932 [regress/agent-timeout.sh]
7933 Pull back some portability changes from -portable:
7934 - TIMEOUT is a read-only variable in some shells
7935 - not all greps have -q so redirect to /dev/null instead.
7936 (ID sync only)
7937
7938commit a40d97ff46831c9081a6a4472036689360847fb1
7939Author: Darren Tucker <dtucker@zip.com.au>
7940Date: Fri May 17 14:44:53 2013 +1000
7941
7942 sync missing ID
7943
7944commit 56347efe796a0506e846621ae65562b978e45f1d
7945Author: Darren Tucker <dtucker@zip.com.au>
7946Date: Fri May 17 13:28:36 2013 +1000
7947
7948 - dtucker@cvs.openbsd.org 2013/05/17 00:37:40
7949 [regress/agent.sh regress/keytype.sh regress/cfgmatch.sh
7950 regress/forcecommand.sh regress/proto-version.sh regress/test-exec.sh
7951 regress/cipher-speed.sh regress/cert-hostkey.sh regress/cert-userkey.sh
7952 regress/ssh-com.sh]
7953 replace 'echo -n' with 'printf' since it's more portable
7954 also remove "echon" hack.
7955
7956commit 91af05c5167fe0aa5bd41d2e4a83757d9f627c18
7957Author: Darren Tucker <dtucker@zip.com.au>
7958Date: Fri May 17 13:16:59 2013 +1000
7959
7960 - (dtucker) [regress/integrity.sh]. Force fixed Diffie-Hellman key exchange
7961 methods. When the openssl version doesn't support ECDH then next one on
7962 the list is DH group exchange, but that causes a bit more traffic which can
7963 mean that the tests flip bits in the initial exchange rather than the MACed
7964 traffic and we get different errors to what the tests look for.
7965
7966commit 6e1e60c3c2e16c32bb7ca0876caaa6182a4e4b2c
7967Author: Darren Tucker <dtucker@zip.com.au>
7968Date: Fri May 17 11:23:41 2013 +1000
7969
7970 - (dtucker) [regress/bsd.regress.mk] Remove unused file. We've never used it
7971 in portable and it's long gone in openbsd.
7972
7973commit 982b0cbc4c2b5ea14725f4b339393cdf343dd0fe
7974Author: Darren Tucker <dtucker@zip.com.au>
7975Date: Fri May 17 09:45:12 2013 +1000
7976
7977 - dtucker@cvs.openbsd.org 2013/05/16 05:48:31
7978 [regress/rekey.sh]
7979 add tests for RekeyLimit parsing
7980
7981commit 14490fe7b0f45b1b19f8a3dc10eb3d214f27f5bd
7982Author: Darren Tucker <dtucker@zip.com.au>
7983Date: Fri May 17 09:44:20 2013 +1000
7984
7985 - dtucker@cvs.openbsd.org 2013/05/16 04:26:10
7986 [regress/rekey.sh]
7987 add server-side rekey test
7988
7989commit c31c8729c15f83fba14ef9da0d66bda6215ff69a
7990Author: Darren Tucker <dtucker@zip.com.au>
7991Date: Fri May 17 09:43:33 2013 +1000
7992
7993 - dtucker@cvs.openbsd.org 2013/05/16 03:33:30
7994 [regress/rekey.sh]
7995 test rekeying when there's no data being transferred
7996
7997commit a8a62fcc46c19997797846197a6256ed9a777a47
7998Author: Darren Tucker <dtucker@zip.com.au>
7999Date: Fri May 17 09:42:34 2013 +1000
8000
8001 - dtucker@cvs.openbsd.org 2013/05/16 02:10:35
8002 [rekey.sh]
8003 Add test for time-based rekeying
8004
8005commit 5e95173715d516e6014485e2b6def1fb3db84036
8006Author: Darren Tucker <dtucker@zip.com.au>
8007Date: Fri May 17 09:41:33 2013 +1000
8008
8009 - djm@cvs.openbsd.org 2013/05/10 03:46:14
8010 [modpipe.c]
8011 sync some portability changes from portable OpenSSH (id sync only)
8012
8013commit a4df65b9fc68a555a7d8781700475fb03ed6e694
8014Author: Darren Tucker <dtucker@zip.com.au>
8015Date: Fri May 17 09:37:31 2013 +1000
8016
8017 - dtucker@cvs.openbsd.org 2013/04/22 07:28:53
8018 [multiplex.sh]
8019 Add tests for -Oforward and -Ocancel for local and remote forwards
8020
8021commit 40aaff7e4bcb05b05e3d24938b6d34885be817da
8022Author: Darren Tucker <dtucker@zip.com.au>
8023Date: Fri May 17 09:36:20 2013 +1000
8024
8025 - dtucker@cvs.openbsd.org 2013/04/22 07:23:08
8026 [multiplex.sh]
8027 Write mux master logs to regress.log instead of ssh.log to keep separate
8028
8029commit f3568fc62b73b50a0a3c8447e4a00f4892cab25e
8030Author: Darren Tucker <dtucker@zip.com.au>
8031Date: Fri May 17 09:35:26 2013 +1000
8032
8033 - djm@cvs.openbsd.org 2013/04/18 02:46:12
8034 [Makefile regress/sftp-chroot.sh]
8035 test sshd ChrootDirectory+internal-sftp; feedback & ok dtucker@
8036
8037commit dfea3bcdd7c980c2335402464b7dd8d8721e426d
8038Author: Darren Tucker <dtucker@zip.com.au>
8039Date: Fri May 17 09:31:39 2013 +1000
8040
8041 - dtucker@cvs.openbsd.org 2013/04/07 02:16:03
8042 [regress/Makefile regress/rekey.sh regress/integrity.sh
8043 regress/sshd-log-wrapper.sh regress/forwarding.sh regress/test-exec.sh]
8044 use -E option for ssh and sshd to write debuging logs to ssh{,d}.log and
8045 save the output from any failing tests. If a test fails the debug output
8046 from ssh and sshd for the failing tests (and only the failing tests) should
8047 be available in failed-ssh{,d}.log.
8048
8049commit 75129025a2d504b630d1718fef0da002f5662f63
8050Author: Darren Tucker <dtucker@zip.com.au>
8051Date: Fri May 17 09:19:10 2013 +1000
8052
8053 - dtucker@cvs.openbsd.org 2013/04/06 06:00:22
8054 [regress/rekey.sh regress/test-exec.sh regress/integrity.sh
8055 regress/multiplex.sh Makefile regress/cfgmatch.sh]
8056 Split the regress log into 3 parts: the debug output from ssh, the debug
8057 log from sshd and the output from the client command (ssh, scp or sftp).
8058 Somewhat functional now, will become more useful when ssh/sshd -E is added.
8059
8060commit 7c8b1e72331293b4707dc6f7f68a69e975a3fa70
8061Author: Darren Tucker <dtucker@zip.com.au>
8062Date: Fri May 17 09:10:20 2013 +1000
8063
8064 - dtucker@cvs.openbsd.org 2013/03/23 11:09:43
8065 [test-exec.sh]
8066 Only regenerate host keys if they don't exist or if ssh-keygen has changed
8067 since they were. Reduces test runtime by 5-30% depending on machine
8068 speed.
8069
8070commit 712de4d1100963b11bc618472f95ce36bf7e2ae3
8071Author: Darren Tucker <dtucker@zip.com.au>
8072Date: Fri May 17 09:07:12 2013 +1000
8073
8074 - djm@cvs.openbsd.org 2013/03/07 00:20:34
8075 [regress/proxy-connect.sh]
8076 repeat test with a style appended to the username
8077
8078commit 09c0f0325b2f538de9a1073e03b8ef26dece4c16
8079Author: Darren Tucker <dtucker@zip.com.au>
8080Date: Thu May 16 20:48:57 2013 +1000
8081
8082 - dtucker@cvs.openbsd.org 2013/05/16 10:44:06
8083 [servconf.c]
8084 remove another now-unused variable
8085
8086commit 9113d0c2381202412c912a20c8083ab7d6824ec9
8087Author: Darren Tucker <dtucker@zip.com.au>
8088Date: Thu May 16 20:48:14 2013 +1000
8089
8090 - dtucker@cvs.openbsd.org 2013/05/16 10:43:34
8091 [servconf.c readconf.c]
8092 remove now-unused variables
8093
8094commit e194ba4111ffd47cd1f4c8be1ddc8a4cb673d005
8095Author: Darren Tucker <dtucker@zip.com.au>
8096Date: Thu May 16 20:47:31 2013 +1000
8097
8098 - (dtucker) [configure.ac readconf.c servconf.c
8099 openbsd-compat/openbsd-compat.h] Add compat bits for scan_scaled.
8100
8101commit b7ee8521448100e5b268111ff90feb017e657e44
8102Author: Darren Tucker <dtucker@zip.com.au>
8103Date: Thu May 16 20:33:10 2013 +1000
8104
8105 - dtucker@cvs.openbsd.org 2013/05/16 09:12:31
8106 [readconf.c servconf.c]
8107 switch RekeyLimit traffic volume parsing to scan_scaled. ok djm@
8108
8109commit dbee308253931f8c1aeebf781d7e7730ff6a0dc1
8110Author: Darren Tucker <dtucker@zip.com.au>
8111Date: Thu May 16 20:32:29 2013 +1000
8112
8113 - dtucker@cvs.openbsd.org 2013/05/16 09:08:41
8114 [log.c scp.c sshd.c serverloop.c schnorr.c sftp.c]
8115 Fix some "unused result" warnings found via clang and -portable.
8116 ok markus@
8117
8118commit 64d22946d664dad8165f1fae9e78b53831ed728d
8119Author: Darren Tucker <dtucker@zip.com.au>
8120Date: Thu May 16 20:31:29 2013 +1000
8121
8122 - jmc@cvs.openbsd.org 2013/05/16 06:30:06
8123 [sshd_config.5]
8124 oops! avoid Xr to self;
8125
8126commit 63e0df2b936770baadc8844617b99e5174b476d0
8127Author: Darren Tucker <dtucker@zip.com.au>
8128Date: Thu May 16 20:30:31 2013 +1000
8129
8130 - jmc@cvs.openbsd.org 2013/05/16 06:28:45
8131 [ssh_config.5]
8132 put IgnoreUnknown in the right place;
8133
8134commit 0763698f71efef8b3f8460c5700758359219eb7c
8135Author: Darren Tucker <dtucker@zip.com.au>
8136Date: Thu May 16 20:30:03 2013 +1000
8137
8138 - djm@cvs.openbsd.org 2013/05/16 04:27:50
8139 [ssh_config.5 readconf.h readconf.c]
8140 add the ability to ignore specific unrecognised ssh_config options;
8141 bz#866; ok markus@
8142
8143commit 5f96f3b4bee11ae2b9b32ff9b881c3693e210f96
8144Author: Darren Tucker <dtucker@zip.com.au>
8145Date: Thu May 16 20:29:28 2013 +1000
8146
8147 - dtucker@cvs.openbsd.org 2013/05/16 04:09:14
8148 [sshd_config.5 servconf.c servconf.h packet.c serverloop.c monitor.c sshd_config
8149 sshd.c] Add RekeyLimit to sshd with the same syntax as the client allowing
8150 rekeying based on traffic volume or time. ok djm@, help & ok jmc@ for the man
8151 page.
8152
8153commit c53c2af173cf67fd1c26f98e7900299b1b65b6ec
8154Author: Darren Tucker <dtucker@zip.com.au>
8155Date: Thu May 16 20:28:16 2013 +1000
8156
8157 - dtucker@cvs.openbsd.org 2013/05/16 02:00:34
8158 [ssh_config sshconnect2.c packet.c readconf.h readconf.c clientloop.c
8159 ssh_config.5 packet.h]
8160 Add an optional second argument to RekeyLimit in the client to allow
8161 rekeying based on elapsed time in addition to amount of traffic.
8162 with djm@ jmc@, ok djm
8163
8164commit 64c6fceecd27e1739040b42de8f3759454260b39
8165Author: Darren Tucker <dtucker@zip.com.au>
8166Date: Thu May 16 20:27:14 2013 +1000
8167
8168 - dtucker@cvs.openbsd.org 2013/05/10 10:13:50
8169 [ssh-pkcs11-helper.c]
8170 remove unused extern optarg. ok markus@
8171
8172commit caf00109346e4ab6bb495b0e22bc5b1e7ee22f26
8173Author: Darren Tucker <dtucker@zip.com.au>
8174Date: Thu May 16 20:26:18 2013 +1000
8175
8176 - djm@cvs.openbsd.org 2013/05/10 04:08:01
8177 [key.c]
8178 memleak in cert_free(), wasn't actually freeing the struct;
8179 bz#2096 from shm AT digitalsun.pl
8180
8181commit 7e831edbf7a1b0b9aeeb08328b9fceafaad1bf22
8182Author: Darren Tucker <dtucker@zip.com.au>
8183Date: Thu May 16 20:25:40 2013 +1000
8184
8185 add missing attribution
8186
8187commit 54da6be320495604ddf65d10ac4cc8cf7849c533
8188Author: Darren Tucker <dtucker@zip.com.au>
8189Date: Thu May 16 20:25:04 2013 +1000
8190
8191 - djm@cvs.openbsd.org 2013/05/10 03:40:07
8192 [sshconnect2.c]
8193 fix bzero(ptr_to_struct, sizeof(ptr_to_struct)); bz#2100 from
8194
8195commit 5d8b702d95c0dfc338726fecfbb709695afd1377
8196Author: Darren Tucker <dtucker@zip.com.au>
8197Date: Thu May 16 20:24:23 2013 +1000
8198
8199 - dtucker@cvs.openbsd.org 2013/05/06 07:35:12
8200 [sftp-server.8]
8201 Reference the version of the sftp draft we actually implement. ok djm@
8202
8203commit 026d9db3fbe311b5a7e98d62472cb666aa559648
8204Author: Darren Tucker <dtucker@zip.com.au>
8205Date: Thu May 16 20:23:52 2013 +1000
8206
8207 - tedu@cvs.openbsd.org 2013/04/24 16:01:46
8208 [misc.c]
8209 remove extra parens noticed by nicm
8210
8211commit 2ca51bf140ef2c2409fd220778529dc17c11d8fa
8212Author: Darren Tucker <dtucker@zip.com.au>
8213Date: Thu May 16 20:22:46 2013 +1000
8214
8215 - tedu@cvs.openbsd.org 2013/04/23 17:49:45
8216 [misc.c]
8217 use xasprintf instead of a series of strlcats and strdup. ok djm
8218
8219commit 6aa3eacc5e5f39702b6dd5b27970d9fd97bc2383
8220Author: Damien Miller <djm@mindrot.org>
8221Date: Thu May 16 11:10:17 2013 +1000
8222
8223 - (djm) [contrib/ssh-copy-id] Fix bug that could cause "rm *" to be
8224 executed if mktemp failed; bz#2105 ok dtucker@
8225
8226commit c54e3e0741a27119b3badd8ff92b1988b7e9bd50
8227Author: Darren Tucker <dtucker@zip.com.au>
8228Date: Fri May 10 18:53:14 2013 +1000
8229
8230 - (dtucker) [configure.ac] Add -Werror to the -Qunused-arguments test so
8231 we don't get a warning on compilers that *don't* support it. Add
8232 -Wno-unknown-warning-option. Move both to the start of the list for
8233 maximum noise suppression. Tested with gcc 4.6.3, gcc 2.95.4 and clang 2.9.
8234
8235commit a75d247a18a5099c60226395354eb252c097ac86
8236Author: Darren Tucker <dtucker@zip.com.au>
8237Date: Fri May 10 18:11:55 2013 +1000
8238
8239 - (dtucker) [kex.c] Only include sha256 and ECC key exchange methods when the
8240 underlying libraries support them.
8241
8242commit 0abfb559e3f79d1f217773510d7626c3722aa3c1
8243Author: Darren Tucker <dtucker@zip.com.au>
8244Date: Fri May 10 18:08:49 2013 +1000
8245
8246 - (dtucker) [openbsd-compat/getopt.h openbsd-compat/getopt_long.c
8247 openbsd-compat/openbsd-compat.h] pull in getopt.h from openbsd and plumb
8248 in to use it when we're using our own getopt.
8249
8250commit ccfdfceacb7e23d1479ed4cc91976c5ac6e23c56
8251Author: Darren Tucker <dtucker@zip.com.au>
8252Date: Fri May 10 16:28:55 2013 +1000
8253
8254 - (dtucker) [openbsd-compat/Makefile.in openbsd-compat/getopt.c
8255 openbsd-compat/getopt_long.c regress/modpipe.c] Remove getopt.c, add
8256 portability code to getopt_long.c and switch over Makefile and the ugly
8257 hack in modpipe.c. Fixes bz#1448.
8258
8259commit 39332020078aa8fd4fc28e00b336438dc64b0f5a
8260Author: Darren Tucker <dtucker@zip.com.au>
8261Date: Fri May 10 15:38:11 2013 +1000
8262
8263 - (dtucker) [openbsd-compat/getopt_long.c] Import from OpenBSD. No
8264 portability changes yet.
8265
8266commit 35b2fe99bee4f332d1c1efa49107cdb3c67da07a
8267Author: Darren Tucker <dtucker@zip.com.au>
8268Date: Fri May 10 15:35:26 2013 +1000
8269
8270 - (dtucker) [openbsd-compat/getopt.c] Factor out portibility changes to
8271 getopt.c. Preprocessed source is identical other than line numbers.
8272
8273commit abbc7a7c02e45787d023f50a30f62d7a3e14fe9e
8274Author: Darren Tucker <dtucker@zip.com.au>
8275Date: Fri May 10 13:54:23 2013 +1000
8276
8277 - (dtucker) [configure.ac] Enable -Wsizeof-pointer-memaccess if the compiler
8278 supports it. Mentioned by Colin Watson in bz#2100, ok djm.
8279
8280commit bc02f163f6e882d390abfb925b47b41e13ae523b
8281Author: Damien Miller <djm@mindrot.org>
8282Date: Tue Apr 23 19:25:49 2013 +1000
8283
8284 - dtucker@cvs.openbsd.org 2013/04/22 01:17:18
8285 [mux.c]
8286 typo in debug output: evitval->exitval
8287
8288commit f8b894e31dc3530c7eb6d0a378848260d54f74c4
8289Author: Damien Miller <djm@mindrot.org>
8290Date: Tue Apr 23 19:25:29 2013 +1000
8291
8292 - djm@cvs.openbsd.org 2013/04/19 12:07:08
8293 [kex.c]
8294 remove duplicated list entry pointed out by naddy@
8295
8296commit 34bd20a1e53b63ceb01f06c1654d9112e6784b0a
8297Author: Damien Miller <djm@mindrot.org>
8298Date: Tue Apr 23 19:25:00 2013 +1000
8299
8300 - djm@cvs.openbsd.org 2013/04/19 11:10:18
8301 [ssh.c]
8302 add -Q to usage; reminded by jmc@
8303
8304commit ea11119eee3c5e2429b1f5f8688b25b028fa991a
8305Author: Damien Miller <djm@mindrot.org>
8306Date: Tue Apr 23 19:24:32 2013 +1000
8307
8308 - djm@cvs.openbsd.org 2013/04/19 01:06:50
8309 [authfile.c cipher.c cipher.h kex.c kex.h kexecdh.c kexecdhc.c kexecdhs.c]
8310 [key.c key.h mac.c mac.h packet.c ssh.1 ssh.c]
8311 add the ability to query supported ciphers, MACs, key type and KEX
8312 algorithms to ssh. Includes some refactoring of KEX and key type handling
8313 to be table-driven; ok markus@
8314
8315commit a56086b9903b62c1c4fdedf01b68338fe4dc90e4
8316Author: Damien Miller <djm@mindrot.org>
8317Date: Tue Apr 23 15:24:18 2013 +1000
8318
8319 - djm@cvs.openbsd.org 2013/04/19 01:03:01
8320 [session.c]
8321 reintroduce 1.262 without the connection-killing bug:
8322 fatal() when ChrootDirectory specified by running without root privileges;
8323 ok markus@
8324
8325commit 0d6771b4648889ae5bc4235f9e3fc6cd82b710bd
8326Author: Damien Miller <djm@mindrot.org>
8327Date: Tue Apr 23 15:23:24 2013 +1000
8328
8329 - djm@cvs.openbsd.org 2013/04/19 01:01:00
8330 [ssh-keygen.c]
8331 fix some memory leaks; bz#2088 ok dtucker@
8332
8333commit 467b00c38ba244f9966466e57a89d003f3afb159
8334Author: Damien Miller <djm@mindrot.org>
8335Date: Tue Apr 23 15:23:07 2013 +1000
8336
8337 - djm@cvs.openbsd.org 2013/04/19 01:00:10
8338 [sshd_config.5]
8339 document the requirment that the AuthorizedKeysCommand be owned by root;
8340 ok dtucker@ markus@
8341
8342commit 9303e6527bb5ca7630c765f28624702c212bfd6c
8343Author: Damien Miller <djm@mindrot.org>
8344Date: Tue Apr 23 15:22:40 2013 +1000
8345
8346 - djm@cvs.openbsd.org 2013/04/18 02:16:07
8347 [sftp.c]
8348 make "sftp -q" do what it says on the sticker: hush everything but errors;
8349
8350commit f1a02aea35504e8bef2ed9eef6f9ddeab12bacb3
8351Author: Damien Miller <djm@mindrot.org>
8352Date: Tue Apr 23 15:22:13 2013 +1000
8353
8354 - dtucker@cvs.openbsd.org 2013/04/17 09:04:09
8355 [session.c]
8356 revert rev 1.262; it fails because uid is already set here. ok djm@
8357
8358commit d5edefd27a30768cc7a4817302e964b6cb2f9be7
8359Author: Damien Miller <djm@mindrot.org>
8360Date: Tue Apr 23 15:21:39 2013 +1000
8361
8362 - djm@cvs.openbsd.org 2013/04/11 02:27:50
8363 [packet.c]
8364 quiet disconnect notifications on the server from error() back to logit()
8365 if it is a normal client closure; bz#2057 ok+feedback dtucker@
8366
8367commit 6901032b05291fc5d2bd4067fc47904de3506fda
8368Author: Damien Miller <djm@mindrot.org>
8369Date: Tue Apr 23 15:21:24 2013 +1000
8370
8371 - dtucker@cvs.openbsd.org 2013/04/07 09:40:27
8372 [sshd.8]
8373 clarify -e text. suggested by & ok jmc@
8374
8375commit 03d4d7e60b16f913c75382e32e136ddfa8d6485f
8376Author: Damien Miller <djm@mindrot.org>
8377Date: Tue Apr 23 15:21:06 2013 +1000
8378
8379 - dtucker@cvs.openbsd.org 2013/04/07 02:10:33
8380 [log.c log.h ssh.1 ssh.c sshd.8 sshd.c]
8381 Add -E option to ssh and sshd to append debugging logs to a specified file
8382 instead of stderr or syslog. ok markus@, man page help jmc@
8383
8384commit 37f1c08473b1ef2a188ee178ce2e11e841f88563
8385Author: Damien Miller <djm@mindrot.org>
8386Date: Tue Apr 23 15:20:43 2013 +1000
8387
8388 - markus@cvs.openbsd.org 2013/04/06 16:07:00
8389 [channels.c sshd.c]
8390 handle ECONNABORTED for accept(); ok deraadt some time ago...
8391
8392commit 172859cff7df9fd8a29a1f0a4de568f644bbda50
8393Author: Damien Miller <djm@mindrot.org>
8394Date: Tue Apr 23 15:19:27 2013 +1000
8395
8396 - djm@cvs.openbsd.org 2013/04/05 00:58:51
8397 [mux.c]
8398 cleanup mux-created channels that are in SSH_CHANNEL_OPENING state too
8399 (in addition to ones already in OPEN); bz#2079, ok dtucker@
8400
8401commit 9f12b5dcd5f7772e633fb2786c63bfcbea1f1aea
8402Author: Damien Miller <djm@mindrot.org>
8403Date: Tue Apr 23 15:19:11 2013 +1000
8404
8405 - djm@cvs.openbsd.org 2013/04/05 00:31:49
8406 [pathnames.h]
8407 use the existing _PATH_SSH_USER_RC define to construct the other
8408 pathnames; bz#2077, ok dtucker@ (no binary change)
8409
8410commit d677ad14ff7efedf21745ee1694058350e758e18
8411Author: Damien Miller <djm@mindrot.org>
8412Date: Tue Apr 23 15:18:51 2013 +1000
8413
8414 - djm@cvs.openbsd.org 2013/04/05 00:14:00
8415 [auth2-gss.c krl.c sshconnect2.c]
8416 hush some {unused, printf type} warnings
8417
8418commit 508b6c3d3b95c8ec078fd4801368597ab29b2db9
8419Author: Damien Miller <djm@mindrot.org>
8420Date: Tue Apr 23 15:18:28 2013 +1000
8421
8422 - djm@cvs.openbsd.org 2013/03/08 06:32:58
8423 [ssh.c]
8424 allow "ssh -f none ..." ok markus@
8425
8426commit 91a55f28f35431f9000b95815c343b5a18fda712
8427Author: Damien Miller <djm@mindrot.org>
8428Date: Tue Apr 23 15:18:10 2013 +1000
8429
8430 - markus@cvs.openbsd.org 2013/03/07 19:27:25
8431 [auth.h auth2-chall.c auth2.c monitor.c sshd_config.5]
8432 add submethod support to AuthenticationMethods; ok and freedback djm@
8433
8434commit 4ce189d9108c62090a0dd5dea973d175328440db
8435Author: Damien Miller <djm@mindrot.org>
8436Date: Tue Apr 23 15:17:52 2013 +1000
8437
8438 - djm@cvs.openbsd.org 2013/03/07 00:19:59
8439 [auth2-pubkey.c monitor.c]
8440 reconstruct the original username that was sent by the client, which may
8441 have included a style (e.g. "root:skey") when checking public key
8442 signatures. Fixes public key and hostbased auth when the client specified
8443 a style; ok markus@
8444
8445commit 5cbec4c25954b184e43bf3d3ac09e65eb474f5f9
8446Author: Damien Miller <djm@mindrot.org>
8447Date: Tue Apr 23 15:17:12 2013 +1000
8448
8449 - djm@cvs.openbsd.org 2013/03/06 23:36:53
8450 [readconf.c]
8451 g/c unused variable (-Wunused)
8452
8453commit 998cc56b65682d490c9bbf5977dceb1aa84a0233
8454Author: Damien Miller <djm@mindrot.org>
8455Date: Tue Apr 23 15:16:43 2013 +1000
8456
8457 - djm@cvs.openbsd.org 2013/03/06 23:35:23
8458 [session.c]
8459 fatal() when ChrootDirectory specified by running without root privileges;
8460 ok markus@
8461
8462commit 62e9c4f9b6027620f9091a2f43328e057bdb33f1
8463Author: Damien Miller <djm@mindrot.org>
8464Date: Tue Apr 23 15:15:49 2013 +1000
8465
8466 - (djm) OpenBSD CVS Sync
8467 - markus@cvs.openbsd.org 2013/03/05 20:16:09
8468 [sshconnect2.c]
8469 reset pubkey order on partial success; ok djm@
8470
8471commit 6332da2ae88db623d7da8070dd807efa26d9dfe8
8472Author: Damien Miller <djm@mindrot.org>
8473Date: Tue Apr 23 14:25:52 2013 +1000
8474
8475 - (djm) [auth.c configure.ac misc.c monitor.c monitor_wrap.c] Support
8476 platforms, such as Android, that lack struct passwd.pw_gecos. Report
8477 and initial patch from Nathan Osman bz#2086; feedback tim@ ok dtucker@
8478
8479commit ce1c9574fcfaf753a062276867335c1e237f725c
8480Author: Darren Tucker <dtucker@zip.com.au>
8481Date: Thu Apr 18 21:36:19 2013 +1000
8482
8483 - (dtucker) [configure.ac] Use -Qunused-arguments to suppress warnings from
8484 unused argument warnings (in particular, -fno-builtin-memset) from clang.
8485
8486commit bc68f2451b836e6a3fa65df8774a8b1f10049ded
8487Author: Damien Miller <djm@mindrot.org>
8488Date: Thu Apr 18 11:26:25 2013 +1000
8489
8490 - (djm) [config.guess config.sub] Update to last versions before they switch
8491 to GPL3. ok dtucker@
8492
8493commit 15fd19c4c9943cf02bc6f462d52c86ee6a8f422e
8494Author: Darren Tucker <dtucker@zip.com.au>
8495Date: Fri Apr 5 11:22:26 2013 +1100
8496
8497 - djm@cvs.openbsd.org 2013/02/22 22:09:01
8498 [ssh.c]
8499 Allow IdenityFile=none; ok markus deraadt (and dtucker for an earlier
8500 version)
8501
8502commit 5d1d9541a7c83963cd887b6b36e25b46463a05d4
8503Author: Darren Tucker <dtucker@zip.com.au>
8504Date: Fri Apr 5 11:20:00 2013 +1100
8505
8506 - markus@cvs.openbsd.org 2013/02/22 19:13:56
8507 [sshconnect.c]
8508 support ProxyCommand=- (stdin/out already point to the proxy); ok djm@
8509
8510commit aefa3682431f59cf1ad9a0f624114b135135aa44
8511Author: Darren Tucker <dtucker@zip.com.au>
8512Date: Fri Apr 5 11:18:35 2013 +1100
8513
8514 - dtucker@cvs.openbsd.org 2013/02/22 04:45:09
8515 [ssh.c readconf.c readconf.h]
8516 Don't complain if IdentityFiles specified in system-wide configs are
8517 missing. ok djm, deraadt
8518
8519commit f3c38142435622d056582e851579d8647a233c7f
8520Author: Darren Tucker <dtucker@zip.com.au>
8521Date: Fri Apr 5 11:16:52 2013 +1100
8522
8523 - dtucker@cvs.openbsd.org 2013/02/19 02:12:47
8524 [krl.c]
8525 Remove bogus include. ok djm
8526 (id sync only)
8527
8528commit 1910478c2d2c3d0e1edacaeff21ed388d70759e9
8529Author: Darren Tucker <dtucker@zip.com.au>
8530Date: Fri Apr 5 11:13:08 2013 +1100
8531
8532 - dtucker@cvs.openbsd.org 2013/02/17 23:16:57
8533 [readconf.c ssh.c readconf.h sshconnect2.c]
8534 Keep track of which IndentityFile options were manually supplied and which
8535 were default options, and don't warn if the latter are missing.
8536 ok markus@
8537
8538commit c9627cdbc65b25da943f24e6a953da899f08eefc
8539Author: Darren Tucker <dtucker@zip.com.au>
8540Date: Mon Apr 1 12:40:48 2013 +1100
8541
8542 - (dtucker) [openbsd-compat/bsd-cygwin_util.{c,h}] Don't include windows.h
8543 to avoid conflicting definitions of __int64, adding the required bits.
8544 Patch from Corinna Vinschen.
8545
8546commit 75db01d2ce29a85f8e5a2aff2011446896cf3f8a
8547Author: Tim Rice <tim@multitalents.net>
8548Date: Fri Mar 22 10:14:32 2013 -0700
8549
8550 - (tim) [Makefile.in] remove some duplication introduced in 20130220 commit.
8551
8552commit 221b4b2436ac78a65c3b775c25ccd396a1fed208
8553Author: Darren Tucker <dtucker@zip.com.au>
8554Date: Fri Mar 22 12:51:09 2013 +1100
8555
8556 - (dtucker) [includes.h] Check if _GNU_SOURCE is already defined before
8557 defining it again. Prevents warnings if someone, eg, sets it in CFLAGS.
8558
8559commit c8a0f27c6d761d1335d13ed84d773e9ddf1d95c8
8560Author: Darren Tucker <dtucker@zip.com.au>
8561Date: Fri Mar 22 12:49:14 2013 +1100
8562
8563 - (dtucker) [configure.ac] Add stdlib.h to zlib check for exit() prototype.
8564
8565commit eed8dc261018aea4d6b8606ca3addc9f8cf9ed1e
8566Author: Damien Miller <djm@mindrot.org>
8567Date: Fri Mar 22 10:25:22 2013 +1100
8568
8569 - (djm) Release 6.2p1
8570
8571commit 83efe7c86168cc07b8e6cc6df6b54f7ace3b64a3
8572Author: Damien Miller <djm@mindrot.org>
8573Date: Fri Mar 22 10:17:36 2013 +1100
8574
8575 - (djm) [contrib/ssh-copy-id contrib/ssh-copy-id.1] Updated to Phil
8576 Hands' greatly revised version.
8577
8578commit 63b4bcd04e1c57b77eabb4e4d359508a4b2af685
8579Author: Damien Miller <djm@mindrot.org>
8580Date: Wed Mar 20 12:55:14 2013 +1100
8581
8582 - (djm) [configure.ac log.c scp.c sshconnect2.c openbsd-compat/vis.c]
8583 [openbsd-compat/vis.h] FreeBSD's strnvis isn't compatible with OpenBSD's
8584 so mark it as broken. Patch from des AT des.no
diff --git a/Makefile.in b/Makefile.in
index 06be3d5d5..40cc7aae1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -65,28 +65,33 @@ MANFMT=@MANFMT@
65TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT) 65TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT)
66 66
67LIBOPENSSH_OBJS=\ 67LIBOPENSSH_OBJS=\
68 ssh_api.o \
68 ssherr.o \ 69 ssherr.o \
69 sshbuf.o \ 70 sshbuf.o \
70 sshkey.o \ 71 sshkey.o \
71 sshbuf-getput-basic.o \ 72 sshbuf-getput-basic.o \
72 sshbuf-misc.o \ 73 sshbuf-misc.o \
73 sshbuf-getput-crypto.o 74 sshbuf-getput-crypto.o \
75 krl.o \
76 bitmap.o
74 77
75LIBSSH_OBJS=${LIBOPENSSH_OBJS} \ 78LIBSSH_OBJS=${LIBOPENSSH_OBJS} \
76 authfd.o authfile.o bufaux.o bufbn.o buffer.o \ 79 authfd.o authfile.o bufaux.o bufbn.o bufec.o buffer.o \
77 canohost.o channels.o cipher.o cipher-aes.o \ 80 canohost.o channels.o cipher.o cipher-aes.o cipher-aesctr.o \
78 cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \ 81 cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \
79 compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \ 82 compat.o crc32.o deattack.o fatal.o hostfile.o \
80 log.o match.o md-sha256.o moduli.o nchan.o packet.o \ 83 log.o match.o md-sha256.o moduli.o nchan.o packet.o opacket.o \
81 readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o \ 84 readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o \
82 atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \ 85 atomicio.o key.o dispatch.o mac.o uidswap.o uuencode.o misc.o \
83 monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \ 86 monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \
84 kexdh.o kexgex.o kexdhc.o kexgexc.o bufec.o kexecdh.o kexecdhc.o \
85 msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o umac128.o \ 87 msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o umac128.o \
86 ssh-pkcs11.o krl.o smult_curve25519_ref.o \ 88 ssh-pkcs11.o smult_curve25519_ref.o \
87 kexc25519.o kexc25519c.o poly1305.o chacha.o cipher-chachapoly.o \ 89 poly1305.o chacha.o cipher-chachapoly.o \
88 ssh-ed25519.o digest-openssl.o hmac.o \ 90 ssh-ed25519.o digest-openssl.o digest-libc.o hmac.o \
89 sc25519.o ge25519.o fe25519.o ed25519.o verify.o hash.o blocks.o 91 sc25519.o ge25519.o fe25519.o ed25519.o verify.o hash.o blocks.o \
92 kex.o kexdh.o kexgex.o kexecdh.o kexc25519.o \
93 kexdhc.o kexgexc.o kexecdhc.o kexc25519c.o \
94 kexdhs.o kexgexs.o kexecdhs.o kexc25519s.o
90 95
91SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \ 96SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
92 sshconnect.o sshconnect1.o sshconnect2.o mux.o \ 97 sshconnect.o sshconnect1.o sshconnect2.o mux.o \
@@ -99,8 +104,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
99 auth-chall.o auth2-chall.o groupaccess.o \ 104 auth-chall.o auth2-chall.o groupaccess.o \
100 auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \ 105 auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \
101 auth2-none.o auth2-passwd.o auth2-pubkey.o \ 106 auth2-none.o auth2-passwd.o auth2-pubkey.o \
102 monitor_mm.o monitor.o monitor_wrap.o kexdhs.o kexgexs.o kexecdhs.o \ 107 monitor_mm.o monitor.o monitor_wrap.o auth-krb5.o \
103 kexc25519s.o auth-krb5.o \
104 auth2-gss.o gss-serv.o gss-serv-krb5.o \ 108 auth2-gss.o gss-serv.o gss-serv-krb5.o \
105 loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \ 109 loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
106 sftp-server.o sftp-common.o \ 110 sftp-server.o sftp-common.o \
@@ -230,6 +234,12 @@ clean: regressclean
230 rm -f regress/unittests/sshbuf/test_sshbuf 234 rm -f regress/unittests/sshbuf/test_sshbuf
231 rm -f regress/unittests/sshkey/*.o 235 rm -f regress/unittests/sshkey/*.o
232 rm -f regress/unittests/sshkey/test_sshkey 236 rm -f regress/unittests/sshkey/test_sshkey
237 rm -f regress/unittests/bitmap/*.o
238 rm -f regress/unittests/bitmap/test_bitmap
239 rm -f regress/unittests/hostkeys/*.o
240 rm -f regress/unittests/hostkeys/test_hostkeys
241 rm -f regress/unittests/kex/*.o
242 rm -f regress/unittests/kex/test_kex
233 (cd openbsd-compat && $(MAKE) clean) 243 (cd openbsd-compat && $(MAKE) clean)
234 244
235distclean: regressclean 245distclean: regressclean
@@ -244,6 +254,12 @@ distclean: regressclean
244 rm -f regress/unittests/sshbuf/test_sshbuf 254 rm -f regress/unittests/sshbuf/test_sshbuf
245 rm -f regress/unittests/sshkey/*.o 255 rm -f regress/unittests/sshkey/*.o
246 rm -f regress/unittests/sshkey/test_sshkey 256 rm -f regress/unittests/sshkey/test_sshkey
257 rm -f regress/unittests/bitmap/*.o
258 rm -f regress/unittests/bitmap/test_bitmap
259 rm -f regress/unittests/hostkeys/*.o
260 rm -f regress/unittests/hostkeys/test_hostkeys
261 rm -f regress/unittests/kex/*.o
262 rm -f regress/unittests/kex/test_kex
247 (cd openbsd-compat && $(MAKE) distclean) 263 (cd openbsd-compat && $(MAKE) distclean)
248 if test -d pkg ; then \ 264 if test -d pkg ; then \
249 rm -fr pkg ; \ 265 rm -fr pkg ; \
@@ -417,15 +433,21 @@ uninstall:
417 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1 433 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
418 434
419regress-prep: 435regress-prep:
420 [ -d `pwd`/regress ] || mkdir -p `pwd`/regress 436 [ -d `pwd`/regress ] || mkdir -p `pwd`/regress
421 [ -d `pwd`/regress/unittests ] || mkdir -p `pwd`/regress/unittests 437 [ -d `pwd`/regress/unittests ] || mkdir -p `pwd`/regress/unittests
422 [ -d `pwd`/regress/unittests/test_helper ] || \ 438 [ -d `pwd`/regress/unittests/test_helper ] || \
423 mkdir -p `pwd`/regress/unittests/test_helper 439 mkdir -p `pwd`/regress/unittests/test_helper
424 [ -d `pwd`/regress/unittests/sshbuf ] || \ 440 [ -d `pwd`/regress/unittests/sshbuf ] || \
425 mkdir -p `pwd`/regress/unittests/sshbuf 441 mkdir -p `pwd`/regress/unittests/sshbuf
426 [ -d `pwd`/regress/unittests/sshkey ] || \ 442 [ -d `pwd`/regress/unittests/sshkey ] || \
427 mkdir -p `pwd`/regress/unittests/sshkey 443 mkdir -p `pwd`/regress/unittests/sshkey
428 [ -f `pwd`/regress/Makefile ] || \ 444 [ -d `pwd`/regress/unittests/bitmap ] || \
445 mkdir -p `pwd`/regress/unittests/bitmap
446 [ -d `pwd`/regress/unittests/hostkeys ] || \
447 mkdir -p `pwd`/regress/unittests/hostkeys
448 [ -d `pwd`/regress/unittests/kex ] || \
449 mkdir -p `pwd`/regress/unittests/kex
450 [ -f `pwd`/regress/Makefile ] || \
429 ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile 451 ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
430 452
431regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c 453regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c
@@ -436,6 +458,10 @@ regress/setuid-allowed$(EXEEXT): $(srcdir)/regress/setuid-allowed.c
436 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \ 458 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
437 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) 459 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
438 460
461regress/netcat$(EXEEXT): $(srcdir)/regress/netcat.c
462 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
463 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
464
439UNITTESTS_TEST_HELPER_OBJS=\ 465UNITTESTS_TEST_HELPER_OBJS=\
440 regress/unittests/test_helper/test_helper.o \ 466 regress/unittests/test_helper/test_helper.o \
441 regress/unittests/test_helper/fuzz.o 467 regress/unittests/test_helper/fuzz.o
@@ -473,11 +499,46 @@ regress/unittests/sshkey/test_sshkey$(EXEEXT): ${UNITTESTS_TEST_SSHKEY_OBJS} \
473 regress/unittests/test_helper/libtest_helper.a \ 499 regress/unittests/test_helper/libtest_helper.a \
474 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) 500 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
475 501
502UNITTESTS_TEST_BITMAP_OBJS=\
503 regress/unittests/bitmap/tests.o
504
505regress/unittests/bitmap/test_bitmap$(EXEEXT): ${UNITTESTS_TEST_BITMAP_OBJS} \
506 regress/unittests/test_helper/libtest_helper.a libssh.a
507 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_BITMAP_OBJS) \
508 regress/unittests/test_helper/libtest_helper.a \
509 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
510
511UNITTESTS_TEST_KEX_OBJS=\
512 regress/unittests/kex/tests.o \
513 regress/unittests/kex/test_kex.o \
514 roaming_dummy.o
515
516regress/unittests/kex/test_kex$(EXEEXT): ${UNITTESTS_TEST_KEX_OBJS} \
517 regress/unittests/test_helper/libtest_helper.a libssh.a
518 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_KEX_OBJS) \
519 regress/unittests/test_helper/libtest_helper.a \
520 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
521
522UNITTESTS_TEST_HOSTKEYS_OBJS=\
523 regress/unittests/hostkeys/tests.o \
524 regress/unittests/hostkeys/test_iterate.o
525
526regress/unittests/hostkeys/test_hostkeys$(EXEEXT): \
527 ${UNITTESTS_TEST_HOSTKEYS_OBJS} \
528 regress/unittests/test_helper/libtest_helper.a libssh.a
529 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_HOSTKEYS_OBJS) \
530 regress/unittests/test_helper/libtest_helper.a \
531 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
532
476REGRESS_BINARIES=\ 533REGRESS_BINARIES=\
477 regress/modpipe$(EXEEXT) \ 534 regress/modpipe$(EXEEXT) \
478 regress/setuid-allowed$(EXEEXT) \ 535 regress/setuid-allowed$(EXEEXT) \
536 regress/netcat$(EXEEXT) \
479 regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \ 537 regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \
480 regress/unittests/sshkey/test_sshkey$(EXEEXT) 538 regress/unittests/sshkey/test_sshkey$(EXEEXT) \
539 regress/unittests/bitmap/test_bitmap$(EXEEXT) \
540 regress/unittests/hostkeys/test_hostkeys$(EXEEXT) \
541 regress/unittests/kex/test_kex$(EXEEXT)
481 542
482tests interop-tests t-exec: regress-prep $(TARGETS) $(REGRESS_BINARIES) 543tests interop-tests t-exec: regress-prep $(TARGETS) $(REGRESS_BINARIES)
483 BUILDDIR=`pwd`; \ 544 BUILDDIR=`pwd`; \
diff --git a/PROTOCOL b/PROTOCOL
index aa59f584e..91bfe270d 100644
--- a/PROTOCOL
+++ b/PROTOCOL
@@ -40,8 +40,8 @@ http://www.openssh.com/txt/draft-miller-secsh-compression-delayed-00.txt
40 "ecdsa-sha2-nistp521-cert-v01@openssh.com" 40 "ecdsa-sha2-nistp521-cert-v01@openssh.com"
41 41
42OpenSSH introduces new public key algorithms to support certificate 42OpenSSH introduces new public key algorithms to support certificate
43authentication for users and hostkeys. These methods are documented in 43authentication for users and host keys. These methods are documented
44the file PROTOCOL.certkeys 44in the file PROTOCOL.certkeys
45 45
461.4. transport: Elliptic Curve cryptography 461.4. transport: Elliptic Curve cryptography
47 47
@@ -282,6 +282,53 @@ by the client cancel the forwarding of a Unix domain socket.
282 boolean FALSE 282 boolean FALSE
283 string socket path 283 string socket path
284 284
2852.5. connection: hostkey update and rotation "hostkeys-00@openssh.com"
286and "hostkeys-prove-00@openssh.com"
287
288OpenSSH supports a protocol extension allowing a server to inform
289a client of all its protocol v.2 host keys after user-authentication
290has completed.
291
292 byte SSH_MSG_GLOBAL_REQUEST
293 string "hostkeys-00@openssh.com"
294 string[] hostkeys
295
296Upon receiving this message, a client should check which of the
297supplied host keys are present in known_hosts. For keys that are
298not present, it should send a "hostkeys-prove@openssh.com" message
299to request the server prove ownership of the private half of the
300key.
301
302 byte SSH_MSG_GLOBAL_REQUEST
303 string "hostkeys-prove-00@openssh.com"
304 char 1 /* want-reply */
305 string[] hostkeys
306
307When a server receives this message, it should generate a signature
308using each requested key over the following:
309
310 string "hostkeys-prove-00@openssh.com"
311 string session identifier
312 string hostkey
313
314These signatures should be included in the reply, in the order matching
315the hostkeys in the request:
316
317 byte SSH_MSG_REQUEST_SUCCESS
318 string[] signatures
319
320When the client receives this reply (and not a failure), it should
321validate the signatures and may update its known_hosts file, adding keys
322that it has not seen before and deleting keys for the server host that
323are no longer offered.
324
325These extensions let a client learn key types that it had not previously
326encountered, thereby allowing it to potentially upgrade from weaker
327key algorithms to better ones. It also supports graceful key rotation:
328a server may offer multiple keys of the same type for a period (to
329give clients an opportunity to learn them using this extension) before
330removing the deprecated key from those offered.
331
2853. SFTP protocol changes 3323. SFTP protocol changes
286 333
2873.1. sftp: Reversal of arguments to SSH_FXP_SYMLINK 3343.1. sftp: Reversal of arguments to SSH_FXP_SYMLINK
@@ -406,4 +453,4 @@ respond with a SSH_FXP_STATUS message.
406This extension is advertised in the SSH_FXP_VERSION hello with version 453This extension is advertised in the SSH_FXP_VERSION hello with version
407"1". 454"1".
408 455
409$OpenBSD: PROTOCOL,v 1.24 2014/07/15 15:54:14 millert Exp $ 456$OpenBSD: PROTOCOL,v 1.27 2015/02/20 22:17:21 djm Exp $
diff --git a/PROTOCOL.krl b/PROTOCOL.krl
index e8caa4527..b9695107b 100644
--- a/PROTOCOL.krl
+++ b/PROTOCOL.krl
@@ -37,7 +37,7 @@ The available section types are:
37#define KRL_SECTION_FINGERPRINT_SHA1 3 37#define KRL_SECTION_FINGERPRINT_SHA1 3
38#define KRL_SECTION_SIGNATURE 4 38#define KRL_SECTION_SIGNATURE 4
39 39
403. Certificate serial section 402. Certificate section
41 41
42These sections use type KRL_SECTION_CERTIFICATES to revoke certificates by 42These sections use type KRL_SECTION_CERTIFICATES to revoke certificates by
43serial number or key ID. The consist of the CA key that issued the 43serial number or key ID. The consist of the CA key that issued the
@@ -47,6 +47,11 @@ ignored.
47 string ca_key 47 string ca_key
48 string reserved 48 string reserved
49 49
50Where "ca_key" is the standard SSH wire serialisation of the CA's
51public key. Alternately, "ca_key" may be an empty string to indicate
52the certificate section applies to all CAs (this is most useful when
53revoking key IDs).
54
50Followed by one or more sections: 55Followed by one or more sections:
51 56
52 byte cert_section_type 57 byte cert_section_type
@@ -161,4 +166,4 @@ Implementations that retrieve KRLs over untrusted channels must verify
161signatures. Signature sections are optional for KRLs distributed by 166signatures. Signature sections are optional for KRLs distributed by
162trusted means. 167trusted means.
163 168
164$OpenBSD: PROTOCOL.krl,v 1.2 2013/01/18 00:24:58 djm Exp $ 169$OpenBSD: PROTOCOL.krl,v 1.3 2015/01/30 01:10:33 djm Exp $
diff --git a/README b/README
index b21441ae0..f1f7e7fc0 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
1See http://www.openssh.com/txt/release-6.7 for the release notes. 1See http://www.openssh.com/txt/release-6.8 for the release notes.
2 2
3- A Japanese translation of this document and of the OpenSSH FAQ is 3- A Japanese translation of this document and of the OpenSSH FAQ is
4- available at http://www.unixuser.org/~haruyama/security/openssh/index.html 4- available at http://www.unixuser.org/~haruyama/security/openssh/index.html
diff --git a/atomicio.c b/atomicio.c
index 2bac36c91..b1ec234f5 100644
--- a/atomicio.c
+++ b/atomicio.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: atomicio.c,v 1.26 2010/09/22 22:58:51 djm Exp $ */ 1/* $OpenBSD: atomicio.c,v 1.27 2015/01/16 06:40:12 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2006 Damien Miller. All rights reserved. 3 * Copyright (c) 2006 Damien Miller. All rights reserved.
4 * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved. 4 * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved.
@@ -41,6 +41,7 @@
41#endif 41#endif
42#include <string.h> 42#include <string.h>
43#include <unistd.h> 43#include <unistd.h>
44#include <limits.h>
44 45
45#include "atomicio.h" 46#include "atomicio.h"
46 47
diff --git a/auth-options.c b/auth-options.c
index f3d9c9df8..4f0da9c04 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-options.c,v 1.64 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: auth-options.c,v 1.65 2015/01/14 10:30:34 markus Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -21,15 +21,19 @@
21#include <stdarg.h> 21#include <stdarg.h>
22 22
23#include "openbsd-compat/sys-queue.h" 23#include "openbsd-compat/sys-queue.h"
24
25#include "key.h" /* XXX for typedef */
26#include "buffer.h" /* XXX for typedef */
24#include "xmalloc.h" 27#include "xmalloc.h"
25#include "match.h" 28#include "match.h"
29#include "ssherr.h"
26#include "log.h" 30#include "log.h"
27#include "canohost.h" 31#include "canohost.h"
28#include "buffer.h" 32#include "sshbuf.h"
29#include "misc.h" 33#include "misc.h"
30#include "channels.h" 34#include "channels.h"
31#include "servconf.h" 35#include "servconf.h"
32#include "key.h" 36#include "sshkey.h"
33#include "auth-options.h" 37#include "auth-options.h"
34#include "hostfile.h" 38#include "hostfile.h"
35#include "auth.h" 39#include "auth.h"
@@ -417,7 +421,7 @@ bad_option:
417#define OPTIONS_CRITICAL 1 421#define OPTIONS_CRITICAL 1
418#define OPTIONS_EXTENSIONS 2 422#define OPTIONS_EXTENSIONS 2
419static int 423static int
420parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw, 424parse_option_list(struct sshbuf *oblob, struct passwd *pw,
421 u_int which, int crit, 425 u_int which, int crit,
422 int *cert_no_port_forwarding_flag, 426 int *cert_no_port_forwarding_flag,
423 int *cert_no_agent_forwarding_flag, 427 int *cert_no_agent_forwarding_flag,
@@ -430,26 +434,25 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
430 char *command, *allowed; 434 char *command, *allowed;
431 const char *remote_ip; 435 const char *remote_ip;
432 char *name = NULL; 436 char *name = NULL;
433 u_char *data_blob = NULL; 437 struct sshbuf *c = NULL, *data = NULL;
434 u_int nlen, dlen, clen; 438 int r, ret = -1, result, found;
435 Buffer c, data;
436 int ret = -1, result, found;
437
438 buffer_init(&data);
439 439
440 /* Make copy to avoid altering original */ 440 if ((c = sshbuf_fromb(oblob)) == NULL) {
441 buffer_init(&c); 441 error("%s: sshbuf_fromb failed", __func__);
442 buffer_append(&c, optblob, optblob_len); 442 goto out;
443 }
443 444
444 while (buffer_len(&c) > 0) { 445 while (sshbuf_len(c) > 0) {
445 if ((name = buffer_get_cstring_ret(&c, &nlen)) == NULL || 446 sshbuf_free(data);
446 (data_blob = buffer_get_string_ret(&c, &dlen)) == NULL) { 447 data = NULL;
447 error("Certificate options corrupt"); 448 if ((r = sshbuf_get_cstring(c, &name, NULL)) != 0 ||
449 (r = sshbuf_froms(c, &data)) != 0) {
450 error("Unable to parse certificate options: %s",
451 ssh_err(r));
448 goto out; 452 goto out;
449 } 453 }
450 buffer_append(&data, data_blob, dlen); 454 debug3("found certificate option \"%.100s\" len %zu",
451 debug3("found certificate option \"%.100s\" len %u", 455 name, sshbuf_len(data));
452 name, dlen);
453 found = 0; 456 found = 0;
454 if ((which & OPTIONS_EXTENSIONS) != 0) { 457 if ((which & OPTIONS_EXTENSIONS) != 0) {
455 if (strcmp(name, "permit-X11-forwarding") == 0) { 458 if (strcmp(name, "permit-X11-forwarding") == 0) {
@@ -473,10 +476,10 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
473 } 476 }
474 if (!found && (which & OPTIONS_CRITICAL) != 0) { 477 if (!found && (which & OPTIONS_CRITICAL) != 0) {
475 if (strcmp(name, "force-command") == 0) { 478 if (strcmp(name, "force-command") == 0) {
476 if ((command = buffer_get_cstring_ret(&data, 479 if ((r = sshbuf_get_cstring(data, &command,
477 &clen)) == NULL) { 480 NULL)) != 0) {
478 error("Certificate constraint \"%s\" " 481 error("Unable to parse \"%s\" "
479 "corrupt", name); 482 "section: %s", name, ssh_err(r));
480 goto out; 483 goto out;
481 } 484 }
482 if (*cert_forced_command != NULL) { 485 if (*cert_forced_command != NULL) {
@@ -489,10 +492,10 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
489 found = 1; 492 found = 1;
490 } 493 }
491 if (strcmp(name, "source-address") == 0) { 494 if (strcmp(name, "source-address") == 0) {
492 if ((allowed = buffer_get_cstring_ret(&data, 495 if ((r = sshbuf_get_cstring(data, &allowed,
493 &clen)) == NULL) { 496 NULL)) != 0) {
494 error("Certificate constraint " 497 error("Unable to parse \"%s\" "
495 "\"%s\" corrupt", name); 498 "section: %s", name, ssh_err(r));
496 goto out; 499 goto out;
497 } 500 }
498 if ((*cert_source_address_done)++) { 501 if ((*cert_source_address_done)++) {
@@ -540,16 +543,13 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
540 logit("Certificate extension \"%s\" " 543 logit("Certificate extension \"%s\" "
541 "is not supported", name); 544 "is not supported", name);
542 } 545 }
543 } else if (buffer_len(&data) != 0) { 546 } else if (sshbuf_len(data) != 0) {
544 error("Certificate option \"%s\" corrupt " 547 error("Certificate option \"%s\" corrupt "
545 "(extra data)", name); 548 "(extra data)", name);
546 goto out; 549 goto out;
547 } 550 }
548 buffer_clear(&data);
549 free(name); 551 free(name);
550 free(data_blob);
551 name = NULL; 552 name = NULL;
552 data_blob = NULL;
553 } 553 }
554 /* successfully parsed all options */ 554 /* successfully parsed all options */
555 ret = 0; 555 ret = 0;
@@ -563,10 +563,8 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
563 } 563 }
564 if (name != NULL) 564 if (name != NULL)
565 free(name); 565 free(name);
566 if (data_blob != NULL) 566 sshbuf_free(data);
567 free(data_blob); 567 sshbuf_free(c);
568 buffer_free(&data);
569 buffer_free(&c);
570 return ret; 568 return ret;
571} 569}
572 570
@@ -575,7 +573,7 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
575 * options so this must be called after auth_parse_options(). 573 * options so this must be called after auth_parse_options().
576 */ 574 */
577int 575int
578auth_cert_options(Key *k, struct passwd *pw) 576auth_cert_options(struct sshkey *k, struct passwd *pw)
579{ 577{
580 int cert_no_port_forwarding_flag = 1; 578 int cert_no_port_forwarding_flag = 1;
581 int cert_no_agent_forwarding_flag = 1; 579 int cert_no_agent_forwarding_flag = 1;
@@ -585,10 +583,9 @@ auth_cert_options(Key *k, struct passwd *pw)
585 char *cert_forced_command = NULL; 583 char *cert_forced_command = NULL;
586 int cert_source_address_done = 0; 584 int cert_source_address_done = 0;
587 585
588 if (key_cert_is_legacy(k)) { 586 if (sshkey_cert_is_legacy(k)) {
589 /* All options are in the one field for v00 certs */ 587 /* All options are in the one field for v00 certs */
590 if (parse_option_list(buffer_ptr(k->cert->critical), 588 if (parse_option_list(k->cert->critical, pw,
591 buffer_len(k->cert->critical), pw,
592 OPTIONS_CRITICAL|OPTIONS_EXTENSIONS, 1, 589 OPTIONS_CRITICAL|OPTIONS_EXTENSIONS, 1,
593 &cert_no_port_forwarding_flag, 590 &cert_no_port_forwarding_flag,
594 &cert_no_agent_forwarding_flag, 591 &cert_no_agent_forwarding_flag,
@@ -600,14 +597,12 @@ auth_cert_options(Key *k, struct passwd *pw)
600 return -1; 597 return -1;
601 } else { 598 } else {
602 /* Separate options and extensions for v01 certs */ 599 /* Separate options and extensions for v01 certs */
603 if (parse_option_list(buffer_ptr(k->cert->critical), 600 if (parse_option_list(k->cert->critical, pw,
604 buffer_len(k->cert->critical), pw,
605 OPTIONS_CRITICAL, 1, NULL, NULL, NULL, NULL, NULL, 601 OPTIONS_CRITICAL, 1, NULL, NULL, NULL, NULL, NULL,
606 &cert_forced_command, 602 &cert_forced_command,
607 &cert_source_address_done) == -1) 603 &cert_source_address_done) == -1)
608 return -1; 604 return -1;
609 if (parse_option_list(buffer_ptr(k->cert->extensions), 605 if (parse_option_list(k->cert->extensions, pw,
610 buffer_len(k->cert->extensions), pw,
611 OPTIONS_EXTENSIONS, 1, 606 OPTIONS_EXTENSIONS, 1,
612 &cert_no_port_forwarding_flag, 607 &cert_no_port_forwarding_flag,
613 &cert_no_agent_forwarding_flag, 608 &cert_no_agent_forwarding_flag,
diff --git a/auth-options.h b/auth-options.h
index 7455c9454..34852e5c0 100644
--- a/auth-options.h
+++ b/auth-options.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-options.h,v 1.20 2010/05/07 11:30:29 djm Exp $ */ 1/* $OpenBSD: auth-options.h,v 1.21 2015/01/14 10:30:34 markus Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -35,6 +35,6 @@ extern char *authorized_principals;
35 35
36int auth_parse_options(struct passwd *, char *, char *, u_long); 36int auth_parse_options(struct passwd *, char *, char *, u_long);
37void auth_clear_options(void); 37void auth_clear_options(void);
38int auth_cert_options(Key *, struct passwd *); 38int auth_cert_options(struct sshkey *, struct passwd *);
39 39
40#endif 40#endif
diff --git a/auth-rh-rsa.c b/auth-rh-rsa.c
index b7fd064e7..2e20396ea 100644
--- a/auth-rh-rsa.c
+++ b/auth-rh-rsa.c
@@ -15,6 +15,8 @@
15 15
16#include "includes.h" 16#include "includes.h"
17 17
18#ifdef WITH_SSH1
19
18#include <sys/types.h> 20#include <sys/types.h>
19 21
20#include <pwd.h> 22#include <pwd.h>
@@ -102,3 +104,5 @@ auth_rhosts_rsa(Authctxt *authctxt, char *cuser, Key *client_host_key)
102 packet_send_debug("Rhosts with RSA host authentication accepted."); 104 packet_send_debug("Rhosts with RSA host authentication accepted.");
103 return 1; 105 return 1;
104} 106}
107
108#endif /* WITH_SSH1 */
diff --git a/auth-rhosts.c b/auth-rhosts.c
index b5bedee8d..ee9e827af 100644
--- a/auth-rhosts.c
+++ b/auth-rhosts.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-rhosts.c,v 1.45 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: auth-rhosts.c,v 1.46 2014/12/23 22:42:48 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -57,7 +57,8 @@ check_rhosts_file(const char *filename, const char *hostname,
57 const char *server_user) 57 const char *server_user)
58{ 58{
59 FILE *f; 59 FILE *f;
60 char buf[1024]; /* Must not be larger than host, user, dummy below. */ 60#define RBUFLN 1024
61 char buf[RBUFLN];/* Must not be larger than host, user, dummy below. */
61 int fd; 62 int fd;
62 struct stat st; 63 struct stat st;
63 64
@@ -80,8 +81,9 @@ check_rhosts_file(const char *filename, const char *hostname,
80 return 0; 81 return 0;
81 } 82 }
82 while (fgets(buf, sizeof(buf), f)) { 83 while (fgets(buf, sizeof(buf), f)) {
83 /* All three must be at least as big as buf to avoid overflows. */ 84 /* All three must have length >= buf to avoid overflows. */
84 char hostbuf[1024], userbuf[1024], dummy[1024], *host, *user, *cp; 85 char hostbuf[RBUFLN], userbuf[RBUFLN], dummy[RBUFLN];
86 char *host, *user, *cp;
85 int negated; 87 int negated;
86 88
87 for (cp = buf; *cp == ' ' || *cp == '\t'; cp++) 89 for (cp = buf; *cp == ' ' || *cp == '\t'; cp++)
@@ -140,8 +142,8 @@ check_rhosts_file(const char *filename, const char *hostname,
140 /* Check for empty host/user names (particularly '+'). */ 142 /* Check for empty host/user names (particularly '+'). */
141 if (!host[0] || !user[0]) { 143 if (!host[0] || !user[0]) {
142 /* We come here if either was '+' or '-'. */ 144 /* We come here if either was '+' or '-'. */
143 auth_debug_add("Ignoring wild host/user names in %.100s.", 145 auth_debug_add("Ignoring wild host/user names "
144 filename); 146 "in %.100s.", filename);
145 continue; 147 continue;
146 } 148 }
147 /* Verify that host name matches. */ 149 /* Verify that host name matches. */
@@ -149,7 +151,8 @@ check_rhosts_file(const char *filename, const char *hostname,
149 if (!innetgr(host + 1, hostname, NULL, NULL) && 151 if (!innetgr(host + 1, hostname, NULL, NULL) &&
150 !innetgr(host + 1, ipaddr, NULL, NULL)) 152 !innetgr(host + 1, ipaddr, NULL, NULL))
151 continue; 153 continue;
152 } else if (strcasecmp(host, hostname) && strcmp(host, ipaddr) != 0) 154 } else if (strcasecmp(host, hostname) &&
155 strcmp(host, ipaddr) != 0)
153 continue; /* Different hostname. */ 156 continue; /* Different hostname. */
154 157
155 /* Verify that user name matches. */ 158 /* Verify that user name matches. */
@@ -208,7 +211,8 @@ auth_rhosts2_raw(struct passwd *pw, const char *client_user, const char *hostnam
208 /* Switch to the user's uid. */ 211 /* Switch to the user's uid. */
209 temporarily_use_uid(pw); 212 temporarily_use_uid(pw);
210 /* 213 /*
211 * Quick check: if the user has no .shosts or .rhosts files, return 214 * Quick check: if the user has no .shosts or .rhosts files and
215 * no system hosts.equiv/shosts.equiv files exist then return
212 * failure immediately without doing costly lookups from name 216 * failure immediately without doing costly lookups from name
213 * servers. 217 * servers.
214 */ 218 */
@@ -223,27 +227,38 @@ auth_rhosts2_raw(struct passwd *pw, const char *client_user, const char *hostnam
223 /* Switch back to privileged uid. */ 227 /* Switch back to privileged uid. */
224 restore_uid(); 228 restore_uid();
225 229
226 /* Deny if The user has no .shosts or .rhosts file and there are no system-wide files. */ 230 /*
231 * Deny if The user has no .shosts or .rhosts file and there
232 * are no system-wide files.
233 */
227 if (!rhosts_files[rhosts_file_index] && 234 if (!rhosts_files[rhosts_file_index] &&
228 stat(_PATH_RHOSTS_EQUIV, &st) < 0 && 235 stat(_PATH_RHOSTS_EQUIV, &st) < 0 &&
229 stat(_PATH_SSH_HOSTS_EQUIV, &st) < 0) 236 stat(_PATH_SSH_HOSTS_EQUIV, &st) < 0) {
237 debug3("%s: no hosts access files exist", __func__);
230 return 0; 238 return 0;
239 }
231 240
232 /* If not logging in as superuser, try /etc/hosts.equiv and shosts.equiv. */ 241 /*
233 if (pw->pw_uid != 0) { 242 * If not logging in as superuser, try /etc/hosts.equiv and
243 * shosts.equiv.
244 */
245 if (pw->pw_uid == 0)
246 debug3("%s: root user, ignoring system hosts files", __func__);
247 else {
234 if (check_rhosts_file(_PATH_RHOSTS_EQUIV, hostname, ipaddr, 248 if (check_rhosts_file(_PATH_RHOSTS_EQUIV, hostname, ipaddr,
235 client_user, pw->pw_name)) { 249 client_user, pw->pw_name)) {
236 auth_debug_add("Accepted for %.100s [%.100s] by /etc/hosts.equiv.", 250 auth_debug_add("Accepted for %.100s [%.100s] by "
237 hostname, ipaddr); 251 "/etc/hosts.equiv.", hostname, ipaddr);
238 return 1; 252 return 1;
239 } 253 }
240 if (check_rhosts_file(_PATH_SSH_HOSTS_EQUIV, hostname, ipaddr, 254 if (check_rhosts_file(_PATH_SSH_HOSTS_EQUIV, hostname, ipaddr,
241 client_user, pw->pw_name)) { 255 client_user, pw->pw_name)) {
242 auth_debug_add("Accepted for %.100s [%.100s] by %.100s.", 256 auth_debug_add("Accepted for %.100s [%.100s] by "
243 hostname, ipaddr, _PATH_SSH_HOSTS_EQUIV); 257 "%.100s.", hostname, ipaddr, _PATH_SSH_HOSTS_EQUIV);
244 return 1; 258 return 1;
245 } 259 }
246 } 260 }
261
247 /* 262 /*
248 * Check that the home directory is owned by root or the user, and is 263 * Check that the home directory is owned by root or the user, and is
249 * not group or world writable. 264 * not group or world writable.
@@ -290,20 +305,25 @@ auth_rhosts2_raw(struct passwd *pw, const char *client_user, const char *hostnam
290 auth_debug_add("Bad file modes for %.200s", buf); 305 auth_debug_add("Bad file modes for %.200s", buf);
291 continue; 306 continue;
292 } 307 }
293 /* Check if we have been configured to ignore .rhosts and .shosts files. */ 308 /*
309 * Check if we have been configured to ignore .rhosts
310 * and .shosts files.
311 */
294 if (options.ignore_rhosts) { 312 if (options.ignore_rhosts) {
295 auth_debug_add("Server has been configured to ignore %.100s.", 313 auth_debug_add("Server has been configured to "
296 rhosts_files[rhosts_file_index]); 314 "ignore %.100s.", rhosts_files[rhosts_file_index]);
297 continue; 315 continue;
298 } 316 }
299 /* Check if authentication is permitted by the file. */ 317 /* Check if authentication is permitted by the file. */
300 if (check_rhosts_file(buf, hostname, ipaddr, client_user, pw->pw_name)) { 318 if (check_rhosts_file(buf, hostname, ipaddr,
319 client_user, pw->pw_name)) {
301 auth_debug_add("Accepted by %.100s.", 320 auth_debug_add("Accepted by %.100s.",
302 rhosts_files[rhosts_file_index]); 321 rhosts_files[rhosts_file_index]);
303 /* Restore the privileged uid. */ 322 /* Restore the privileged uid. */
304 restore_uid(); 323 restore_uid();
305 auth_debug_add("Accepted host %s ip %s client_user %s server_user %s", 324 auth_debug_add("Accepted host %s ip %s client_user "
306 hostname, ipaddr, client_user, pw->pw_name); 325 "%s server_user %s", hostname, ipaddr,
326 client_user, pw->pw_name);
307 return 1; 327 return 1;
308 } 328 }
309 } 329 }
diff --git a/auth-rsa.c b/auth-rsa.c
index e9f4ede26..cbd971be1 100644
--- a/auth-rsa.c
+++ b/auth-rsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-rsa.c,v 1.88 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: auth-rsa.c,v 1.90 2015/01/28 22:36:00 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -16,6 +16,8 @@
16 16
17#include "includes.h" 17#include "includes.h"
18 18
19#ifdef WITH_SSH1
20
19#include <sys/types.h> 21#include <sys/types.h>
20#include <sys/stat.h> 22#include <sys/stat.h>
21 23
@@ -236,7 +238,9 @@ rsa_key_allowed_in_file(struct passwd *pw, char *file,
236 "actual %d vs. announced %d.", 238 "actual %d vs. announced %d.",
237 file, linenum, BN_num_bits(key->rsa->n), bits); 239 file, linenum, BN_num_bits(key->rsa->n), bits);
238 240
239 fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); 241 if ((fp = sshkey_fingerprint(key, options.fingerprint_hash,
242 SSH_FP_DEFAULT)) == NULL)
243 continue;
240 debug("matching key found: file %s, line %lu %s %s", 244 debug("matching key found: file %s, line %lu %s %s",
241 file, linenum, key_type(key), fp); 245 file, linenum, key_type(key), fp);
242 free(fp); 246 free(fp);
@@ -341,3 +345,5 @@ auth_rsa(Authctxt *authctxt, BIGNUM *client_n)
341 packet_send_debug("RSA authentication accepted."); 345 packet_send_debug("RSA authentication accepted.");
342 return (1); 346 return (1);
343} 347}
348
349#endif /* WITH_SSH1 */
diff --git a/auth.c b/auth.c
index 5e60682ce..f9b767301 100644
--- a/auth.c
+++ b/auth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth.c,v 1.106 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: auth.c,v 1.110 2015/02/25 17:29:38 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -27,7 +27,6 @@
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <sys/param.h>
31 30
32#include <netinet/in.h> 31#include <netinet/in.h>
33 32
@@ -50,6 +49,7 @@
50#include <stdio.h> 49#include <stdio.h>
51#include <string.h> 50#include <string.h>
52#include <unistd.h> 51#include <unistd.h>
52#include <limits.h>
53 53
54#include "xmalloc.h" 54#include "xmalloc.h"
55#include "match.h" 55#include "match.h"
@@ -71,7 +71,8 @@
71#endif 71#endif
72#include "authfile.h" 72#include "authfile.h"
73#include "monitor_wrap.h" 73#include "monitor_wrap.h"
74#include "krl.h" 74#include "authfile.h"
75#include "ssherr.h"
75#include "compat.h" 76#include "compat.h"
76 77
77/* import */ 78/* import */
@@ -330,13 +331,14 @@ auth_log(Authctxt *authctxt, int authenticated, int partial,
330void 331void
331auth_maxtries_exceeded(Authctxt *authctxt) 332auth_maxtries_exceeded(Authctxt *authctxt)
332{ 333{
333 packet_disconnect("Too many authentication failures for " 334 error("maximum authentication attempts exceeded for "
334 "%s%.100s from %.200s port %d %s", 335 "%s%.100s from %.200s port %d %s",
335 authctxt->valid ? "" : "invalid user ", 336 authctxt->valid ? "" : "invalid user ",
336 authctxt->user, 337 authctxt->user,
337 get_remote_ipaddr(), 338 get_remote_ipaddr(),
338 get_remote_port(), 339 get_remote_port(),
339 compat20 ? "ssh2" : "ssh1"); 340 compat20 ? "ssh2" : "ssh1");
341 packet_disconnect("Too many authentication failures");
340 /* NOTREACHED */ 342 /* NOTREACHED */
341} 343}
342 344
@@ -375,7 +377,7 @@ auth_root_allowed(const char *method)
375char * 377char *
376expand_authorized_keys(const char *filename, struct passwd *pw) 378expand_authorized_keys(const char *filename, struct passwd *pw)
377{ 379{
378 char *file, ret[MAXPATHLEN]; 380 char *file, ret[PATH_MAX];
379 int i; 381 int i;
380 382
381 file = percent_expand(filename, "h", pw->pw_dir, 383 file = percent_expand(filename, "h", pw->pw_dir,
@@ -467,7 +469,7 @@ int
467auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, 469auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
468 uid_t uid, char *err, size_t errlen) 470 uid_t uid, char *err, size_t errlen)
469{ 471{
470 char buf[MAXPATHLEN], homedir[MAXPATHLEN]; 472 char buf[PATH_MAX], homedir[PATH_MAX];
471 char *cp; 473 char *cp;
472 int comparehome = 0; 474 int comparehome = 0;
473 struct stat st; 475 struct stat st;
@@ -673,43 +675,39 @@ getpwnamallow(const char *user)
673int 675int
674auth_key_is_revoked(Key *key) 676auth_key_is_revoked(Key *key)
675{ 677{
676#ifdef WITH_OPENSSL 678 char *fp = NULL;
677 char *key_fp; 679 int r;
678 680
679 if (options.revoked_keys_file == NULL) 681 if (options.revoked_keys_file == NULL)
680 return 0; 682 return 0;
681 switch (ssh_krl_file_contains_key(options.revoked_keys_file, key)) { 683 if ((fp = sshkey_fingerprint(key, options.fingerprint_hash,
682 case 0: 684 SSH_FP_DEFAULT)) == NULL) {
683 return 0; /* Not revoked */ 685 r = SSH_ERR_ALLOC_FAIL;
684 case -2: 686 error("%s: fingerprint key: %s", __func__, ssh_err(r));
685 break; /* Not a KRL */ 687 goto out;
686 default:
687 goto revoked;
688 } 688 }
689#endif 689
690 debug3("%s: treating %s as a key list", __func__, 690 r = sshkey_check_revoked(key, options.revoked_keys_file);
691 options.revoked_keys_file); 691 switch (r) {
692 switch (key_in_file(key, options.revoked_keys_file, 0)) {
693 case 0: 692 case 0:
694 /* key not revoked */ 693 break; /* not revoked */
695 return 0; 694 case SSH_ERR_KEY_REVOKED:
696 case -1: 695 error("Authentication key %s %s revoked by file %s",
697 /* Error opening revoked_keys_file: refuse all keys */ 696 sshkey_type(key), fp, options.revoked_keys_file);
698 error("Revoked keys file is unreadable: refusing public key " 697 goto out;
699 "authentication"); 698 default:
700 return 1; 699 error("Error checking authentication key %s %s in "
701#ifdef WITH_OPENSSL 700 "revoked keys file %s: %s", sshkey_type(key), fp,
702 case 1: 701 options.revoked_keys_file, ssh_err(r));
703 revoked: 702 goto out;
704 /* Key revoked */
705 key_fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
706 error("WARNING: authentication attempt with a revoked "
707 "%s key %s ", key_type(key), key_fp);
708 free(key_fp);
709 return 1;
710#endif
711 } 703 }
712 fatal("key_in_file returned junk"); 704
705 /* Success */
706 r = 0;
707
708 out:
709 free(fp);
710 return r == 0 ? 0 : 1;
713} 711}
714 712
715void 713void
diff --git a/auth.h b/auth.h
index d081c94a6..db8603760 100644
--- a/auth.h
+++ b/auth.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth.h,v 1.78 2014/07/03 11:16:55 djm Exp $ */ 1/* $OpenBSD: auth.h,v 1.82 2015/02/16 22:13:32 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -42,6 +42,9 @@
42#include <krb5.h> 42#include <krb5.h>
43#endif 43#endif
44 44
45struct ssh;
46struct sshkey;
47
45typedef struct Authctxt Authctxt; 48typedef struct Authctxt Authctxt;
46typedef struct Authmethod Authmethod; 49typedef struct Authmethod Authmethod;
47typedef struct KbdintDevice KbdintDevice; 50typedef struct KbdintDevice KbdintDevice;
@@ -75,6 +78,9 @@ struct Authctxt {
75#endif 78#endif
76 Buffer *loginmsg; 79 Buffer *loginmsg;
77 void *methoddata; 80 void *methoddata;
81
82 struct sshkey **prev_userkeys;
83 u_int nprev_userkeys;
78}; 84};
79/* 85/*
80 * Every authentication method has to handle authentication requests for 86 * Every authentication method has to handle authentication requests for
@@ -123,6 +129,8 @@ int hostbased_key_allowed(struct passwd *, const char *, char *, Key *);
123int user_key_allowed(struct passwd *, Key *); 129int user_key_allowed(struct passwd *, Key *);
124void pubkey_auth_info(Authctxt *, const Key *, const char *, ...) 130void pubkey_auth_info(Authctxt *, const Key *, const char *, ...)
125 __attribute__((__format__ (printf, 3, 4))); 131 __attribute__((__format__ (printf, 3, 4)));
132void auth2_record_userkey(Authctxt *, struct sshkey *);
133int auth2_userkey_already_used(Authctxt *, struct sshkey *);
126 134
127struct stat; 135struct stat;
128int auth_secure_path(const char *, struct stat *, const char *, uid_t, 136int auth_secure_path(const char *, struct stat *, const char *, uid_t,
@@ -195,12 +203,13 @@ check_key_in_hostfiles(struct passwd *, Key *, const char *,
195 203
196/* hostkey handling */ 204/* hostkey handling */
197Key *get_hostkey_by_index(int); 205Key *get_hostkey_by_index(int);
198Key *get_hostkey_public_by_index(int); 206Key *get_hostkey_public_by_index(int, struct ssh *);
199Key *get_hostkey_public_by_type(int); 207Key *get_hostkey_public_by_type(int, int, struct ssh *);
200Key *get_hostkey_private_by_type(int); 208Key *get_hostkey_private_by_type(int, int, struct ssh *);
201int get_hostkey_index(Key *); 209int get_hostkey_index(Key *, int, struct ssh *);
202int ssh1_session_key(BIGNUM *); 210int ssh1_session_key(BIGNUM *);
203void sshd_hostkey_sign(Key *, Key *, u_char **, u_int *, u_char *, u_int); 211int sshd_hostkey_sign(Key *, Key *, u_char **, size_t *,
212 const u_char *, size_t, u_int);
204 213
205/* debug messages during authentication */ 214/* debug messages during authentication */
206void auth_debug_add(const char *fmt,...) __attribute__((format(printf, 1, 2))); 215void auth_debug_add(const char *fmt,...) __attribute__((format(printf, 1, 2)));
diff --git a/auth1.c b/auth1.c
index 50388285c..5073c49bb 100644
--- a/auth1.c
+++ b/auth1.c
@@ -12,6 +12,8 @@
12 12
13#include "includes.h" 13#include "includes.h"
14 14
15#ifdef WITH_SSH1
16
15#include <sys/types.h> 17#include <sys/types.h>
16 18
17#include <stdarg.h> 19#include <stdarg.h>
@@ -438,3 +440,5 @@ do_authentication(Authctxt *authctxt)
438 packet_send(); 440 packet_send();
439 packet_write_wait(); 441 packet_write_wait();
440} 442}
443
444#endif /* WITH_SSH1 */
diff --git a/auth2-chall.c b/auth2-chall.c
index ea4eb6952..ddabe1a90 100644
--- a/auth2-chall.c
+++ b/auth2-chall.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2-chall.c,v 1.41 2014/02/02 03:44:31 djm Exp $ */ 1/* $OpenBSD: auth2-chall.c,v 1.42 2015/01/19 20:07:45 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2001 Per Allansson. All rights reserved. 4 * Copyright (c) 2001 Per Allansson. All rights reserved.
@@ -49,7 +49,7 @@ extern ServerOptions options;
49 49
50static int auth2_challenge_start(Authctxt *); 50static int auth2_challenge_start(Authctxt *);
51static int send_userauth_info_request(Authctxt *); 51static int send_userauth_info_request(Authctxt *);
52static void input_userauth_info_response(int, u_int32_t, void *); 52static int input_userauth_info_response(int, u_int32_t, void *);
53 53
54#ifdef BSD_AUTH 54#ifdef BSD_AUTH
55extern KbdintDevice bsdauth_device; 55extern KbdintDevice bsdauth_device;
@@ -279,7 +279,7 @@ send_userauth_info_request(Authctxt *authctxt)
279 return 1; 279 return 1;
280} 280}
281 281
282static void 282static int
283input_userauth_info_response(int type, u_int32_t seq, void *ctxt) 283input_userauth_info_response(int type, u_int32_t seq, void *ctxt)
284{ 284{
285 Authctxt *authctxt = ctxt; 285 Authctxt *authctxt = ctxt;
@@ -344,6 +344,7 @@ input_userauth_info_response(int type, u_int32_t seq, void *ctxt)
344 } 344 }
345 userauth_finish(authctxt, authenticated, "keyboard-interactive", 345 userauth_finish(authctxt, authenticated, "keyboard-interactive",
346 devicename); 346 devicename);
347 return 0;
347} 348}
348 349
349void 350void
diff --git a/auth2-gss.c b/auth2-gss.c
index 447f896f2..1ca835773 100644
--- a/auth2-gss.c
+++ b/auth2-gss.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2-gss.c,v 1.21 2014/02/26 20:28:44 djm Exp $ */ 1/* $OpenBSD: auth2-gss.c,v 1.22 2015/01/19 20:07:45 markus Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -48,10 +48,10 @@
48 48
49extern ServerOptions options; 49extern ServerOptions options;
50 50
51static void input_gssapi_token(int type, u_int32_t plen, void *ctxt); 51static int input_gssapi_token(int type, u_int32_t plen, void *ctxt);
52static void input_gssapi_mic(int type, u_int32_t plen, void *ctxt); 52static int input_gssapi_mic(int type, u_int32_t plen, void *ctxt);
53static void input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt); 53static int input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt);
54static void input_gssapi_errtok(int, u_int32_t, void *); 54static int input_gssapi_errtok(int, u_int32_t, void *);
55 55
56/* 56/*
57 * We only support those mechanisms that we know about (ie ones that we know 57 * We only support those mechanisms that we know about (ie ones that we know
@@ -126,7 +126,7 @@ userauth_gssapi(Authctxt *authctxt)
126 return (0); 126 return (0);
127} 127}
128 128
129static void 129static int
130input_gssapi_token(int type, u_int32_t plen, void *ctxt) 130input_gssapi_token(int type, u_int32_t plen, void *ctxt)
131{ 131{
132 Authctxt *authctxt = ctxt; 132 Authctxt *authctxt = ctxt;
@@ -178,9 +178,10 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt)
178 } 178 }
179 179
180 gss_release_buffer(&min_status, &send_tok); 180 gss_release_buffer(&min_status, &send_tok);
181 return 0;
181} 182}
182 183
183static void 184static int
184input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) 185input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
185{ 186{
186 Authctxt *authctxt = ctxt; 187 Authctxt *authctxt = ctxt;
@@ -212,6 +213,7 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
212 /* The client will have already moved on to the next auth */ 213 /* The client will have already moved on to the next auth */
213 214
214 gss_release_buffer(&maj_status, &send_tok); 215 gss_release_buffer(&maj_status, &send_tok);
216 return 0;
215} 217}
216 218
217/* 219/*
@@ -220,7 +222,7 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
220 * which only enables it once the GSSAPI exchange is complete. 222 * which only enables it once the GSSAPI exchange is complete.
221 */ 223 */
222 224
223static void 225static int
224input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt) 226input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt)
225{ 227{
226 Authctxt *authctxt = ctxt; 228 Authctxt *authctxt = ctxt;
@@ -244,9 +246,10 @@ input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt)
244 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL); 246 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL);
245 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); 247 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
246 userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL); 248 userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL);
249 return 0;
247} 250}
248 251
249static void 252static int
250input_gssapi_mic(int type, u_int32_t plen, void *ctxt) 253input_gssapi_mic(int type, u_int32_t plen, void *ctxt)
251{ 254{
252 Authctxt *authctxt = ctxt; 255 Authctxt *authctxt = ctxt;
@@ -284,6 +287,7 @@ input_gssapi_mic(int type, u_int32_t plen, void *ctxt)
284 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL); 287 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL);
285 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); 288 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
286 userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL); 289 userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL);
290 return 0;
287} 291}
288 292
289Authmethod method_gssapi = { 293Authmethod method_gssapi = {
diff --git a/auth2-hostbased.c b/auth2-hostbased.c
index 6787e4ca4..eebfe8fc3 100644
--- a/auth2-hostbased.c
+++ b/auth2-hostbased.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2-hostbased.c,v 1.18 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: auth2-hostbased.c,v 1.24 2015/01/28 22:36:00 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -48,6 +48,7 @@
48#endif 48#endif
49#include "monitor_wrap.h" 49#include "monitor_wrap.h"
50#include "pathnames.h" 50#include "pathnames.h"
51#include "match.h"
51 52
52/* import */ 53/* import */
53extern ServerOptions options; 54extern ServerOptions options;
@@ -107,6 +108,14 @@ userauth_hostbased(Authctxt *authctxt)
107 "signature format"); 108 "signature format");
108 goto done; 109 goto done;
109 } 110 }
111 if (match_pattern_list(sshkey_ssh_name(key),
112 options.hostbased_key_types,
113 strlen(options.hostbased_key_types), 0) != 1) {
114 logit("%s: key type %s not in HostbasedAcceptedKeyTypes",
115 __func__, sshkey_type(key));
116 goto done;
117 }
118
110 service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" : 119 service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" :
111 authctxt->service; 120 authctxt->service;
112 buffer_init(&b); 121 buffer_init(&b);
@@ -163,7 +172,7 @@ hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost,
163 resolvedname = get_canonical_hostname(options.use_dns); 172 resolvedname = get_canonical_hostname(options.use_dns);
164 ipaddr = get_remote_ipaddr(); 173 ipaddr = get_remote_ipaddr();
165 174
166 debug2("userauth_hostbased: chost %s resolvedname %s ipaddr %s", 175 debug2("%s: chost %s resolvedname %s ipaddr %s", __func__,
167 chost, resolvedname, ipaddr); 176 chost, resolvedname, ipaddr);
168 177
169 if (((len = strlen(chost)) > 0) && chost[len - 1] == '.') { 178 if (((len = strlen(chost)) > 0) && chost[len - 1] == '.') {
@@ -172,19 +181,27 @@ hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost,
172 } 181 }
173 182
174 if (options.hostbased_uses_name_from_packet_only) { 183 if (options.hostbased_uses_name_from_packet_only) {
175 if (auth_rhosts2(pw, cuser, chost, chost) == 0) 184 if (auth_rhosts2(pw, cuser, chost, chost) == 0) {
185 debug2("%s: auth_rhosts2 refused "
186 "user \"%.100s\" host \"%.100s\" (from packet)",
187 __func__, cuser, chost);
176 return 0; 188 return 0;
189 }
177 lookup = chost; 190 lookup = chost;
178 } else { 191 } else {
179 if (strcasecmp(resolvedname, chost) != 0) 192 if (strcasecmp(resolvedname, chost) != 0)
180 logit("userauth_hostbased mismatch: " 193 logit("userauth_hostbased mismatch: "
181 "client sends %s, but we resolve %s to %s", 194 "client sends %s, but we resolve %s to %s",
182 chost, ipaddr, resolvedname); 195 chost, ipaddr, resolvedname);
183 if (auth_rhosts2(pw, cuser, resolvedname, ipaddr) == 0) 196 if (auth_rhosts2(pw, cuser, resolvedname, ipaddr) == 0) {
197 debug2("%s: auth_rhosts2 refused "
198 "user \"%.100s\" host \"%.100s\" addr \"%.100s\"",
199 __func__, cuser, resolvedname, ipaddr);
184 return 0; 200 return 0;
201 }
185 lookup = resolvedname; 202 lookup = resolvedname;
186 } 203 }
187 debug2("userauth_hostbased: access allowed by auth_rhosts2"); 204 debug2("%s: access allowed by auth_rhosts2", __func__);
188 205
189 if (key_is_cert(key) && 206 if (key_is_cert(key) &&
190 key_cert_check_authority(key, 1, 0, lookup, &reason)) { 207 key_cert_check_authority(key, 1, 0, lookup, &reason)) {
@@ -207,14 +224,17 @@ hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost,
207 224
208 if (host_status == HOST_OK) { 225 if (host_status == HOST_OK) {
209 if (key_is_cert(key)) { 226 if (key_is_cert(key)) {
210 fp = key_fingerprint(key->cert->signature_key, 227 if ((fp = sshkey_fingerprint(key->cert->signature_key,
211 SSH_FP_MD5, SSH_FP_HEX); 228 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
229 fatal("%s: sshkey_fingerprint fail", __func__);
212 verbose("Accepted certificate ID \"%s\" signed by " 230 verbose("Accepted certificate ID \"%s\" signed by "
213 "%s CA %s from %s@%s", key->cert->key_id, 231 "%s CA %s from %s@%s", key->cert->key_id,
214 key_type(key->cert->signature_key), fp, 232 key_type(key->cert->signature_key), fp,
215 cuser, lookup); 233 cuser, lookup);
216 } else { 234 } else {
217 fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); 235 if ((fp = sshkey_fingerprint(key,
236 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
237 fatal("%s: sshkey_fingerprint fail", __func__);
218 verbose("Accepted %s public key %s from %s@%s", 238 verbose("Accepted %s public key %s from %s@%s",
219 key_type(key), fp, cuser, lookup); 239 key_type(key), fp, cuser, lookup);
220 } 240 }
diff --git a/auth2-pubkey.c b/auth2-pubkey.c
index f3ca96592..d943efa1e 100644
--- a/auth2-pubkey.c
+++ b/auth2-pubkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2-pubkey.c,v 1.41 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: auth2-pubkey.c,v 1.47 2015/02/17 00:14:05 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -41,6 +41,7 @@
41#include <string.h> 41#include <string.h>
42#include <time.h> 42#include <time.h>
43#include <unistd.h> 43#include <unistd.h>
44#include <limits.h>
44 45
45#include "xmalloc.h" 46#include "xmalloc.h"
46#include "ssh.h" 47#include "ssh.h"
@@ -122,6 +123,17 @@ userauth_pubkey(Authctxt *authctxt)
122 "signature scheme"); 123 "signature scheme");
123 goto done; 124 goto done;
124 } 125 }
126 if (auth2_userkey_already_used(authctxt, key)) {
127 logit("refusing previously-used %s key", key_type(key));
128 goto done;
129 }
130 if (match_pattern_list(sshkey_ssh_name(key), options.pubkey_key_types,
131 strlen(options.pubkey_key_types), 0) != 1) {
132 logit("%s: key type %s not in PubkeyAcceptedKeyTypes",
133 __func__, sshkey_ssh_name(key));
134 goto done;
135 }
136
125 if (have_sig) { 137 if (have_sig) {
126 sig = packet_get_string(&slen); 138 sig = packet_get_string(&slen);
127 packet_check_eom(); 139 packet_check_eom();
@@ -159,8 +171,12 @@ userauth_pubkey(Authctxt *authctxt)
159 authenticated = 0; 171 authenticated = 0;
160 if (PRIVSEP(user_key_allowed(authctxt->pw, key)) && 172 if (PRIVSEP(user_key_allowed(authctxt->pw, key)) &&
161 PRIVSEP(key_verify(key, sig, slen, buffer_ptr(&b), 173 PRIVSEP(key_verify(key, sig, slen, buffer_ptr(&b),
162 buffer_len(&b))) == 1) 174 buffer_len(&b))) == 1) {
163 authenticated = 1; 175 authenticated = 1;
176 /* Record the successful key to prevent reuse */
177 auth2_record_userkey(authctxt, key);
178 key = NULL; /* Don't free below */
179 }
164 buffer_free(&b); 180 buffer_free(&b);
165 free(sig); 181 free(sig);
166 } else { 182 } else {
@@ -212,17 +228,20 @@ pubkey_auth_info(Authctxt *authctxt, const Key *key, const char *fmt, ...)
212 } 228 }
213 229
214 if (key_is_cert(key)) { 230 if (key_is_cert(key)) {
215 fp = key_fingerprint(key->cert->signature_key, 231 fp = sshkey_fingerprint(key->cert->signature_key,
216 SSH_FP_MD5, SSH_FP_HEX); 232 options.fingerprint_hash, SSH_FP_DEFAULT);
217 auth_info(authctxt, "%s ID %s (serial %llu) CA %s %s%s%s", 233 auth_info(authctxt, "%s ID %s (serial %llu) CA %s %s%s%s",
218 key_type(key), key->cert->key_id, 234 key_type(key), key->cert->key_id,
219 (unsigned long long)key->cert->serial, 235 (unsigned long long)key->cert->serial,
220 key_type(key->cert->signature_key), fp, 236 key_type(key->cert->signature_key),
237 fp == NULL ? "(null)" : fp,
221 extra == NULL ? "" : ", ", extra == NULL ? "" : extra); 238 extra == NULL ? "" : ", ", extra == NULL ? "" : extra);
222 free(fp); 239 free(fp);
223 } else { 240 } else {
224 fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); 241 fp = sshkey_fingerprint(key, options.fingerprint_hash,
225 auth_info(authctxt, "%s %s%s%s", key_type(key), fp, 242 SSH_FP_DEFAULT);
243 auth_info(authctxt, "%s %s%s%s", key_type(key),
244 fp == NULL ? "(null)" : fp,
226 extra == NULL ? "" : ", ", extra == NULL ? "" : extra); 245 extra == NULL ? "" : ", ", extra == NULL ? "" : extra);
227 free(fp); 246 free(fp);
228 } 247 }
@@ -365,8 +384,9 @@ check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
365 continue; 384 continue;
366 if (!key_is_cert_authority) 385 if (!key_is_cert_authority)
367 continue; 386 continue;
368 fp = key_fingerprint(found, SSH_FP_MD5, 387 if ((fp = sshkey_fingerprint(found,
369 SSH_FP_HEX); 388 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
389 continue;
370 debug("matching CA found: file %s, line %lu, %s %s", 390 debug("matching CA found: file %s, line %lu, %s %s",
371 file, linenum, key_type(found), fp); 391 file, linenum, key_type(found), fp);
372 /* 392 /*
@@ -405,11 +425,13 @@ check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
405 continue; 425 continue;
406 if (key_is_cert_authority) 426 if (key_is_cert_authority)
407 continue; 427 continue;
408 found_key = 1; 428 if ((fp = sshkey_fingerprint(found,
409 fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX); 429 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
430 continue;
410 debug("matching key found: file %s, line %lu %s %s", 431 debug("matching key found: file %s, line %lu %s %s",
411 file, linenum, key_type(found), fp); 432 file, linenum, key_type(found), fp);
412 free(fp); 433 free(fp);
434 found_key = 1;
413 break; 435 break;
414 } 436 }
415 } 437 }
@@ -431,11 +453,12 @@ user_cert_trusted_ca(struct passwd *pw, Key *key)
431 if (!key_is_cert(key) || options.trusted_user_ca_keys == NULL) 453 if (!key_is_cert(key) || options.trusted_user_ca_keys == NULL)
432 return 0; 454 return 0;
433 455
434 ca_fp = key_fingerprint(key->cert->signature_key, 456 if ((ca_fp = sshkey_fingerprint(key->cert->signature_key,
435 SSH_FP_MD5, SSH_FP_HEX); 457 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
458 return 0;
436 459
437 if (key_in_file(key->cert->signature_key, 460 if (sshkey_in_file(key->cert->signature_key,
438 options.trusted_user_ca_keys, 1) != 1) { 461 options.trusted_user_ca_keys, 1, 0) != 0) {
439 debug2("%s: CA %s %s is not listed in %s", __func__, 462 debug2("%s: CA %s %s is not listed in %s", __func__,
440 key_type(key->cert->signature_key), ca_fp, 463 key_type(key->cert->signature_key), ca_fp,
441 options.trusted_user_ca_keys); 464 options.trusted_user_ca_keys);
@@ -680,6 +703,35 @@ user_key_allowed(struct passwd *pw, Key *key)
680 return success; 703 return success;
681} 704}
682 705
706/* Records a public key in the list of previously-successful keys */
707void
708auth2_record_userkey(Authctxt *authctxt, struct sshkey *key)
709{
710 struct sshkey **tmp;
711
712 if (authctxt->nprev_userkeys >= INT_MAX ||
713 (tmp = reallocarray(authctxt->prev_userkeys,
714 authctxt->nprev_userkeys + 1, sizeof(*tmp))) == NULL)
715 fatal("%s: reallocarray failed", __func__);
716 authctxt->prev_userkeys = tmp;
717 authctxt->prev_userkeys[authctxt->nprev_userkeys] = key;
718 authctxt->nprev_userkeys++;
719}
720
721/* Checks whether a key has already been used successfully for authentication */
722int
723auth2_userkey_already_used(Authctxt *authctxt, struct sshkey *key)
724{
725 u_int i;
726
727 for (i = 0; i < authctxt->nprev_userkeys; i++) {
728 if (sshkey_equal_public(key, authctxt->prev_userkeys[i])) {
729 return 1;
730 }
731 }
732 return 0;
733}
734
683Authmethod method_pubkey = { 735Authmethod method_pubkey = {
684 "publickey", 736 "publickey",
685 userauth_pubkey, 737 userauth_pubkey,
diff --git a/auth2.c b/auth2.c
index d9b440ae3..717796228 100644
--- a/auth2.c
+++ b/auth2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2.c,v 1.132 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: auth2.c,v 1.135 2015/01/19 20:07:45 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -87,8 +87,8 @@ Authmethod *authmethods[] = {
87 87
88/* protocol */ 88/* protocol */
89 89
90static void input_service_request(int, u_int32_t, void *); 90static int input_service_request(int, u_int32_t, void *);
91static void input_userauth_request(int, u_int32_t, void *); 91static int input_userauth_request(int, u_int32_t, void *);
92 92
93/* helper */ 93/* helper */
94static Authmethod *authmethod_lookup(Authctxt *, const char *); 94static Authmethod *authmethod_lookup(Authctxt *, const char *);
@@ -151,9 +151,7 @@ userauth_banner(void)
151{ 151{
152 char *banner = NULL; 152 char *banner = NULL;
153 153
154 if (options.banner == NULL || 154 if (options.banner == NULL || (datafellows & SSH_BUG_BANNER) != 0)
155 strcasecmp(options.banner, "none") == 0 ||
156 (datafellows & SSH_BUG_BANNER) != 0)
157 return; 155 return;
158 156
159 if ((banner = PRIVSEP(auth2_read_banner())) == NULL) 157 if ((banner = PRIVSEP(auth2_read_banner())) == NULL)
@@ -176,7 +174,7 @@ do_authentication2(Authctxt *authctxt)
176} 174}
177 175
178/*ARGSUSED*/ 176/*ARGSUSED*/
179static void 177static int
180input_service_request(int type, u_int32_t seq, void *ctxt) 178input_service_request(int type, u_int32_t seq, void *ctxt)
181{ 179{
182 Authctxt *authctxt = ctxt; 180 Authctxt *authctxt = ctxt;
@@ -207,10 +205,11 @@ input_service_request(int type, u_int32_t seq, void *ctxt)
207 packet_disconnect("bad service request %s", service); 205 packet_disconnect("bad service request %s", service);
208 } 206 }
209 free(service); 207 free(service);
208 return 0;
210} 209}
211 210
212/*ARGSUSED*/ 211/*ARGSUSED*/
213static void 212static int
214input_userauth_request(int type, u_int32_t seq, void *ctxt) 213input_userauth_request(int type, u_int32_t seq, void *ctxt)
215{ 214{
216 Authctxt *authctxt = ctxt; 215 Authctxt *authctxt = ctxt;
@@ -286,6 +285,7 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt)
286 free(service); 285 free(service);
287 free(user); 286 free(user);
288 free(method); 287 free(method);
288 return 0;
289} 289}
290 290
291void 291void
@@ -356,7 +356,7 @@ userauth_finish(Authctxt *authctxt, int authenticated, const char *method,
356 } else { 356 } else {
357 357
358 /* Allow initial try of "none" auth without failure penalty */ 358 /* Allow initial try of "none" auth without failure penalty */
359 if (!authctxt->server_caused_failure && 359 if (!partial && !authctxt->server_caused_failure &&
360 (authctxt->attempt > 1 || strcmp(method, "none") != 0)) 360 (authctxt->attempt > 1 || strcmp(method, "none") != 0))
361 authctxt->failures++; 361 authctxt->failures++;
362 if (authctxt->failures >= options.max_authtries) { 362 if (authctxt->failures >= options.max_authtries) {
diff --git a/authfd.c b/authfd.c
index 2d5a8dd5b..5d9414faf 100644
--- a/authfd.c
+++ b/authfd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfd.c,v 1.93 2014/04/29 18:01:49 markus Exp $ */ 1/* $OpenBSD: authfd.c,v 1.94 2015/01/14 20:05:27 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -47,124 +47,121 @@
47#include <stdarg.h> 47#include <stdarg.h>
48#include <string.h> 48#include <string.h>
49#include <unistd.h> 49#include <unistd.h>
50#include <errno.h>
50 51
51#include "xmalloc.h" 52#include "xmalloc.h"
52#include "ssh.h" 53#include "ssh.h"
53#include "rsa.h" 54#include "rsa.h"
54#include "buffer.h" 55#include "sshbuf.h"
55#include "key.h" 56#include "sshkey.h"
56#include "authfd.h" 57#include "authfd.h"
57#include "cipher.h" 58#include "cipher.h"
58#include "kex.h"
59#include "compat.h" 59#include "compat.h"
60#include "log.h" 60#include "log.h"
61#include "atomicio.h" 61#include "atomicio.h"
62#include "misc.h" 62#include "misc.h"
63#include "ssherr.h"
63 64
64static int agent_present = 0; 65#define MAX_AGENT_IDENTITIES 2048 /* Max keys in agent reply */
65 66#define MAX_AGENT_REPLY_LEN (256 * 1024) /* Max bytes in agent reply */
66/* helper */
67int decode_reply(int type);
68 67
69/* macro to check for "agent failure" message */ 68/* macro to check for "agent failure" message */
70#define agent_failed(x) \ 69#define agent_failed(x) \
71 ((x == SSH_AGENT_FAILURE) || (x == SSH_COM_AGENT2_FAILURE) || \ 70 ((x == SSH_AGENT_FAILURE) || \
71 (x == SSH_COM_AGENT2_FAILURE) || \
72 (x == SSH2_AGENT_FAILURE)) 72 (x == SSH2_AGENT_FAILURE))
73 73
74int 74/* Convert success/failure response from agent to a err.h status */
75ssh_agent_present(void) 75static int
76decode_reply(u_char type)
76{ 77{
77 int authfd; 78 if (agent_failed(type))
78 79 return SSH_ERR_AGENT_FAILURE;
79 if (agent_present) 80 else if (type == SSH_AGENT_SUCCESS)
80 return 1;
81 if ((authfd = ssh_get_authentication_socket()) == -1)
82 return 0; 81 return 0;
83 else { 82 else
84 ssh_close_authentication_socket(authfd); 83 return SSH_ERR_INVALID_FORMAT;
85 return 1;
86 }
87} 84}
88 85
89/* Returns the number of the authentication fd, or -1 if there is none. */ 86/* Returns the number of the authentication fd, or -1 if there is none. */
90
91int 87int
92ssh_get_authentication_socket(void) 88ssh_get_authentication_socket(int *fdp)
93{ 89{
94 const char *authsocket; 90 const char *authsocket;
95 int sock; 91 int sock, oerrno;
96 struct sockaddr_un sunaddr; 92 struct sockaddr_un sunaddr;
97 93
94 if (fdp != NULL)
95 *fdp = -1;
96
98 authsocket = getenv(SSH_AUTHSOCKET_ENV_NAME); 97 authsocket = getenv(SSH_AUTHSOCKET_ENV_NAME);
99 if (!authsocket) 98 if (!authsocket)
100 return -1; 99 return SSH_ERR_AGENT_NOT_PRESENT;
101 100
102 memset(&sunaddr, 0, sizeof(sunaddr)); 101 memset(&sunaddr, 0, sizeof(sunaddr));
103 sunaddr.sun_family = AF_UNIX; 102 sunaddr.sun_family = AF_UNIX;
104 strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path)); 103 strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path));
105 104
106 sock = socket(AF_UNIX, SOCK_STREAM, 0); 105 if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
107 if (sock < 0) 106 return SSH_ERR_SYSTEM_ERROR;
108 return -1;
109 107
110 /* close on exec */ 108 /* close on exec */
111 if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1) { 109 if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1 ||
110 connect(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0) {
111 oerrno = errno;
112 close(sock); 112 close(sock);
113 return -1; 113 errno = oerrno;
114 return SSH_ERR_SYSTEM_ERROR;
114 } 115 }
115 if (connect(sock, (struct sockaddr *)&sunaddr, sizeof sunaddr) < 0) { 116 if (fdp != NULL)
117 *fdp = sock;
118 else
116 close(sock); 119 close(sock);
117 return -1; 120 return 0;
118 }
119 agent_present = 1;
120 return sock;
121} 121}
122 122
123/* Communicate with agent: send request and read reply */
123static int 124static int
124ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply) 125ssh_request_reply(int sock, struct sshbuf *request, struct sshbuf *reply)
125{ 126{
126 u_int l, len; 127 int r;
128 size_t l, len;
127 char buf[1024]; 129 char buf[1024];
128 130
129 /* Get the length of the message, and format it in the buffer. */ 131 /* Get the length of the message, and format it in the buffer. */
130 len = buffer_len(request); 132 len = sshbuf_len(request);
131 put_u32(buf, len); 133 put_u32(buf, len);
132 134
133 /* Send the length and then the packet to the agent. */ 135 /* Send the length and then the packet to the agent. */
134 if (atomicio(vwrite, auth->fd, buf, 4) != 4 || 136 if (atomicio(vwrite, sock, buf, 4) != 4 ||
135 atomicio(vwrite, auth->fd, buffer_ptr(request), 137 atomicio(vwrite, sock, (u_char *)sshbuf_ptr(request),
136 buffer_len(request)) != buffer_len(request)) { 138 sshbuf_len(request)) != sshbuf_len(request))
137 error("Error writing to authentication socket."); 139 return SSH_ERR_AGENT_COMMUNICATION;
138 return 0;
139 }
140 /* 140 /*
141 * Wait for response from the agent. First read the length of the 141 * Wait for response from the agent. First read the length of the
142 * response packet. 142 * response packet.
143 */ 143 */
144 if (atomicio(read, auth->fd, buf, 4) != 4) { 144 if (atomicio(read, sock, buf, 4) != 4)
145 error("Error reading response length from authentication socket."); 145 return SSH_ERR_AGENT_COMMUNICATION;
146 return 0;
147 }
148 146
149 /* Extract the length, and check it for sanity. */ 147 /* Extract the length, and check it for sanity. */
150 len = get_u32(buf); 148 len = get_u32(buf);
151 if (len > 256 * 1024) 149 if (len > MAX_AGENT_REPLY_LEN)
152 fatal("Authentication response too long: %u", len); 150 return SSH_ERR_INVALID_FORMAT;
153 151
154 /* Read the rest of the response in to the buffer. */ 152 /* Read the rest of the response in to the buffer. */
155 buffer_clear(reply); 153 sshbuf_reset(reply);
156 while (len > 0) { 154 while (len > 0) {
157 l = len; 155 l = len;
158 if (l > sizeof(buf)) 156 if (l > sizeof(buf))
159 l = sizeof(buf); 157 l = sizeof(buf);
160 if (atomicio(read, auth->fd, buf, l) != l) { 158 if (atomicio(read, sock, buf, l) != l)
161 error("Error reading response from authentication socket."); 159 return SSH_ERR_AGENT_COMMUNICATION;
162 return 0; 160 if ((r = sshbuf_put(reply, buf, l)) != 0)
163 } 161 return r;
164 buffer_append(reply, buf, l);
165 len -= l; 162 len -= l;
166 } 163 }
167 return 1; 164 return 0;
168} 165}
169 166
170/* 167/*
@@ -172,7 +169,6 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply
172 * obtained). The argument must have been returned by 169 * obtained). The argument must have been returned by
173 * ssh_get_authentication_socket(). 170 * ssh_get_authentication_socket().
174 */ 171 */
175
176void 172void
177ssh_close_authentication_socket(int sock) 173ssh_close_authentication_socket(int sock)
178{ 174{
@@ -180,80 +176,103 @@ ssh_close_authentication_socket(int sock)
180 close(sock); 176 close(sock);
181} 177}
182 178
183/* 179/* Lock/unlock agent */
184 * Opens and connects a private socket for communication with the 180int
185 * authentication agent. Returns the file descriptor (which must be 181ssh_lock_agent(int sock, int lock, const char *password)
186 * shut down and closed by the caller when no longer needed).
187 * Returns NULL if an error occurred and the connection could not be
188 * opened.
189 */
190
191AuthenticationConnection *
192ssh_get_authentication_connection(void)
193{ 182{
194 AuthenticationConnection *auth; 183 int r;
195 int sock; 184 u_char type = lock ? SSH_AGENTC_LOCK : SSH_AGENTC_UNLOCK;
196 185 struct sshbuf *msg;
197 sock = ssh_get_authentication_socket(); 186
198 187 if ((msg = sshbuf_new()) == NULL)
199 /* 188 return SSH_ERR_ALLOC_FAIL;
200 * Fail if we couldn't obtain a connection. This happens if we 189 if ((r = sshbuf_put_u8(msg, type)) != 0 ||
201 * exited due to a timeout. 190 (r = sshbuf_put_cstring(msg, password)) != 0)
202 */ 191 goto out;
203 if (sock < 0) 192 if ((r = ssh_request_reply(sock, msg, msg)) != 0)
204 return NULL; 193 goto out;
205 194 if ((r = sshbuf_get_u8(msg, &type)) != 0)
206 auth = xcalloc(1, sizeof(*auth)); 195 goto out;
207 auth->fd = sock; 196 r = decode_reply(type);
208 buffer_init(&auth->identities); 197 out:
209 auth->howmany = 0; 198 sshbuf_free(msg);
210 199 return r;
211 return auth;
212} 200}
213 201
214/* 202#ifdef WITH_SSH1
215 * Closes the connection to the authentication agent and frees any associated 203static int
216 * memory. 204deserialise_identity1(struct sshbuf *ids, struct sshkey **keyp, char **commentp)
217 */
218
219void
220ssh_close_authentication_connection(AuthenticationConnection *auth)
221{ 205{
222 buffer_free(&auth->identities); 206 struct sshkey *key;
223 close(auth->fd); 207 int r, keybits;
224 free(auth); 208 u_int32_t bits;
209 char *comment = NULL;
210
211 if ((key = sshkey_new(KEY_RSA1)) == NULL)
212 return SSH_ERR_ALLOC_FAIL;
213 if ((r = sshbuf_get_u32(ids, &bits)) != 0 ||
214 (r = sshbuf_get_bignum1(ids, key->rsa->e)) != 0 ||
215 (r = sshbuf_get_bignum1(ids, key->rsa->n)) != 0 ||
216 (r = sshbuf_get_cstring(ids, &comment, NULL)) != 0)
217 goto out;
218 keybits = BN_num_bits(key->rsa->n);
219 /* XXX previously we just warned here. I think we should be strict */
220 if (keybits < 0 || bits != (u_int)keybits) {
221 r = SSH_ERR_KEY_BITS_MISMATCH;
222 goto out;
223 }
224 if (keyp != NULL) {
225 *keyp = key;
226 key = NULL;
227 }
228 if (commentp != NULL) {
229 *commentp = comment;
230 comment = NULL;
231 }
232 r = 0;
233 out:
234 sshkey_free(key);
235 free(comment);
236 return r;
225} 237}
238#endif
226 239
227/* Lock/unlock agent */ 240static int
228int 241deserialise_identity2(struct sshbuf *ids, struct sshkey **keyp, char **commentp)
229ssh_lock_agent(AuthenticationConnection *auth, int lock, const char *password)
230{ 242{
231 int type; 243 int r;
232 Buffer msg; 244 char *comment = NULL;
233 245 const u_char *blob;
234 buffer_init(&msg); 246 size_t blen;
235 buffer_put_char(&msg, lock ? SSH_AGENTC_LOCK : SSH_AGENTC_UNLOCK); 247
236 buffer_put_cstring(&msg, password); 248 if ((r = sshbuf_get_string_direct(ids, &blob, &blen)) != 0 ||
237 249 (r = sshbuf_get_cstring(ids, &comment, NULL)) != 0)
238 if (ssh_request_reply(auth, &msg, &msg) == 0) { 250 goto out;
239 buffer_free(&msg); 251 if ((r = sshkey_from_blob(blob, blen, keyp)) != 0)
240 return 0; 252 goto out;
253 if (commentp != NULL) {
254 *commentp = comment;
255 comment = NULL;
241 } 256 }
242 type = buffer_get_char(&msg); 257 r = 0;
243 buffer_free(&msg); 258 out:
244 return decode_reply(type); 259 free(comment);
260 return r;
245} 261}
246 262
247/* 263/*
248 * Returns the first authentication identity held by the agent. 264 * Fetch list of identities held by the agent.
249 */ 265 */
250
251int 266int
252ssh_get_num_identities(AuthenticationConnection *auth, int version) 267ssh_fetch_identitylist(int sock, int version, struct ssh_identitylist **idlp)
253{ 268{
254 int type, code1 = 0, code2 = 0; 269 u_char type, code1 = 0, code2 = 0;
255 Buffer request; 270 u_int32_t num, i;
271 struct sshbuf *msg;
272 struct ssh_identitylist *idl = NULL;
273 int r;
256 274
275 /* Determine request and expected response types */
257 switch (version) { 276 switch (version) {
258 case 1: 277 case 1:
259 code1 = SSH_AGENTC_REQUEST_RSA_IDENTITIES; 278 code1 = SSH_AGENTC_REQUEST_RSA_IDENTITIES;
@@ -264,238 +283,270 @@ ssh_get_num_identities(AuthenticationConnection *auth, int version)
264 code2 = SSH2_AGENT_IDENTITIES_ANSWER; 283 code2 = SSH2_AGENT_IDENTITIES_ANSWER;
265 break; 284 break;
266 default: 285 default:
267 return 0; 286 return SSH_ERR_INVALID_ARGUMENT;
268 } 287 }
269 288
270 /* 289 /*
271 * Send a message to the agent requesting for a list of the 290 * Send a message to the agent requesting for a list of the
272 * identities it can represent. 291 * identities it can represent.
273 */ 292 */
274 buffer_init(&request); 293 if ((msg = sshbuf_new()) == NULL)
275 buffer_put_char(&request, code1); 294 return SSH_ERR_ALLOC_FAIL;
295 if ((r = sshbuf_put_u8(msg, code1)) != 0)
296 goto out;
276 297
277 buffer_clear(&auth->identities); 298 if ((r = ssh_request_reply(sock, msg, msg)) != 0)
278 if (ssh_request_reply(auth, &request, &auth->identities) == 0) { 299 goto out;
279 buffer_free(&request);
280 return 0;
281 }
282 buffer_free(&request);
283 300
284 /* Get message type, and verify that we got a proper answer. */ 301 /* Get message type, and verify that we got a proper answer. */
285 type = buffer_get_char(&auth->identities); 302 if ((r = sshbuf_get_u8(msg, &type)) != 0)
303 goto out;
286 if (agent_failed(type)) { 304 if (agent_failed(type)) {
287 return 0; 305 r = SSH_ERR_AGENT_FAILURE;
306 goto out;
288 } else if (type != code2) { 307 } else if (type != code2) {
289 fatal("Bad authentication reply message type: %d", type); 308 r = SSH_ERR_INVALID_FORMAT;
309 goto out;
290 } 310 }
291 311
292 /* Get the number of entries in the response and check it for sanity. */ 312 /* Get the number of entries in the response and check it for sanity. */
293 auth->howmany = buffer_get_int(&auth->identities); 313 if ((r = sshbuf_get_u32(msg, &num)) != 0)
294 if ((u_int)auth->howmany > 1024) 314 goto out;
295 fatal("Too many identities in authentication reply: %d", 315 if (num > MAX_AGENT_IDENTITIES) {
296 auth->howmany); 316 r = SSH_ERR_INVALID_FORMAT;
297 317 goto out;
298 return auth->howmany; 318 }
299} 319 if (num == 0) {
300 320 r = SSH_ERR_AGENT_NO_IDENTITIES;
301Key * 321 goto out;
302ssh_get_first_identity(AuthenticationConnection *auth, char **comment, int version) 322 }
303{
304 /* get number of identities and return the first entry (if any). */
305 if (ssh_get_num_identities(auth, version) > 0)
306 return ssh_get_next_identity(auth, comment, version);
307 return NULL;
308}
309 323
310Key * 324 /* Deserialise the response into a list of keys/comments */
311ssh_get_next_identity(AuthenticationConnection *auth, char **comment, int version) 325 if ((idl = calloc(1, sizeof(*idl))) == NULL ||
312{ 326 (idl->keys = calloc(num, sizeof(*idl->keys))) == NULL ||
327 (idl->comments = calloc(num, sizeof(*idl->comments))) == NULL) {
328 r = SSH_ERR_ALLOC_FAIL;
329 goto out;
330 }
331 for (i = 0; i < num;) {
332 switch (version) {
333 case 1:
313#ifdef WITH_SSH1 334#ifdef WITH_SSH1
314 int keybits; 335 if ((r = deserialise_identity1(msg,
315 u_int bits; 336 &(idl->keys[i]), &(idl->comments[i]))) != 0)
337 goto out;
316#endif 338#endif
317 u_char *blob; 339 break;
318 u_int blen; 340 case 2:
319 Key *key = NULL; 341 if ((r = deserialise_identity2(msg,
320 342 &(idl->keys[i]), &(idl->comments[i]))) != 0) {
321 /* Return failure if no more entries. */ 343 if (r == SSH_ERR_KEY_TYPE_UNKNOWN) {
322 if (auth->howmany <= 0) 344 /* Gracefully skip unknown key types */
323 return NULL; 345 num--;
346 continue;
347 } else
348 goto out;
349 }
350 break;
351 }
352 i++;
353 }
354 idl->nkeys = num;
355 *idlp = idl;
356 idl = NULL;
357 r = 0;
358 out:
359 sshbuf_free(msg);
360 if (idl != NULL)
361 ssh_free_identitylist(idl);
362 return r;
363}
324 364
325 /* 365void
326 * Get the next entry from the packet. These will abort with a fatal 366ssh_free_identitylist(struct ssh_identitylist *idl)
327 * error if the packet is too short or contains corrupt data. 367{
328 */ 368 size_t i;
329 switch (version) { 369
330#ifdef WITH_SSH1 370 if (idl == NULL)
331 case 1: 371 return;
332 key = key_new(KEY_RSA1); 372 for (i = 0; i < idl->nkeys; i++) {
333 bits = buffer_get_int(&auth->identities); 373 if (idl->keys != NULL)
334 buffer_get_bignum(&auth->identities, key->rsa->e); 374 sshkey_free(idl->keys[i]);
335 buffer_get_bignum(&auth->identities, key->rsa->n); 375 if (idl->comments != NULL)
336 *comment = buffer_get_string(&auth->identities, NULL); 376 free(idl->comments[i]);
337 keybits = BN_num_bits(key->rsa->n);
338 if (keybits < 0 || bits != (u_int)keybits)
339 logit("Warning: identity keysize mismatch: actual %d, announced %u",
340 BN_num_bits(key->rsa->n), bits);
341 break;
342#endif
343 case 2:
344 blob = buffer_get_string(&auth->identities, &blen);
345 *comment = buffer_get_string(&auth->identities, NULL);
346 key = key_from_blob(blob, blen);
347 free(blob);
348 break;
349 default:
350 return NULL;
351 } 377 }
352 /* Decrement the number of remaining entries. */ 378 free(idl);
353 auth->howmany--;
354 return key;
355} 379}
356 380
357/* 381/*
358 * Generates a random challenge, sends it to the agent, and waits for 382 * Sends a challenge (typically from a server via ssh(1)) to the agent,
359 * response from the agent. Returns true (non-zero) if the agent gave the 383 * and waits for a response from the agent.
360 * correct answer, zero otherwise. Response type selects the style of 384 * Returns true (non-zero) if the agent gave the correct answer, zero
361 * response desired, with 0 corresponding to protocol version 1.0 (no longer 385 * otherwise.
362 * supported) and 1 corresponding to protocol version 1.1.
363 */ 386 */
364 387
365#ifdef WITH_SSH1 388#ifdef WITH_SSH1
366int 389int
367ssh_decrypt_challenge(AuthenticationConnection *auth, 390ssh_decrypt_challenge(int sock, struct sshkey* key, BIGNUM *challenge,
368 Key* key, BIGNUM *challenge, 391 u_char session_id[16], u_char response[16])
369 u_char session_id[16],
370 u_int response_type,
371 u_char response[16])
372{ 392{
373 Buffer buffer; 393 struct sshbuf *msg;
374 int success = 0; 394 int r;
375 int i; 395 u_char type;
376 int type;
377 396
378 if (key->type != KEY_RSA1) 397 if (key->type != KEY_RSA1)
379 return 0; 398 return SSH_ERR_INVALID_ARGUMENT;
380 if (response_type == 0) { 399 if ((msg = sshbuf_new()) == NULL)
381 logit("Compatibility with ssh protocol version 1.0 no longer supported."); 400 return SSH_ERR_ALLOC_FAIL;
382 return 0; 401 if ((r = sshbuf_put_u8(msg, SSH_AGENTC_RSA_CHALLENGE)) != 0 ||
383 } 402 (r = sshbuf_put_u32(msg, BN_num_bits(key->rsa->n))) != 0 ||
384 buffer_init(&buffer); 403 (r = sshbuf_put_bignum1(msg, key->rsa->e)) != 0 ||
385 buffer_put_char(&buffer, SSH_AGENTC_RSA_CHALLENGE); 404 (r = sshbuf_put_bignum1(msg, key->rsa->n)) != 0 ||
386 buffer_put_int(&buffer, BN_num_bits(key->rsa->n)); 405 (r = sshbuf_put_bignum1(msg, challenge)) != 0 ||
387 buffer_put_bignum(&buffer, key->rsa->e); 406 (r = sshbuf_put(msg, session_id, 16)) != 0 ||
388 buffer_put_bignum(&buffer, key->rsa->n); 407 (r = sshbuf_put_u32(msg, 1)) != 0) /* Response type for proto 1.1 */
389 buffer_put_bignum(&buffer, challenge); 408 goto out;
390 buffer_append(&buffer, session_id, 16); 409 if ((r = ssh_request_reply(sock, msg, msg)) != 0)
391 buffer_put_int(&buffer, response_type); 410 goto out;
392 411 if ((r = sshbuf_get_u8(msg, &type)) != 0)
393 if (ssh_request_reply(auth, &buffer, &buffer) == 0) { 412 goto out;
394 buffer_free(&buffer);
395 return 0;
396 }
397 type = buffer_get_char(&buffer);
398
399 if (agent_failed(type)) { 413 if (agent_failed(type)) {
400 logit("Agent admitted failure to authenticate using the key."); 414 r = SSH_ERR_AGENT_FAILURE;
415 goto out;
401 } else if (type != SSH_AGENT_RSA_RESPONSE) { 416 } else if (type != SSH_AGENT_RSA_RESPONSE) {
402 fatal("Bad authentication response: %d", type); 417 r = SSH_ERR_INVALID_FORMAT;
403 } else { 418 goto out;
404 success = 1;
405 /*
406 * Get the response from the packet. This will abort with a
407 * fatal error if the packet is corrupt.
408 */
409 for (i = 0; i < 16; i++)
410 response[i] = (u_char)buffer_get_char(&buffer);
411 } 419 }
412 buffer_free(&buffer); 420 if ((r = sshbuf_get(msg, response, 16)) != 0)
413 return success; 421 goto out;
422 r = 0;
423 out:
424 sshbuf_free(msg);
425 return r;
414} 426}
415#endif 427#endif
416 428
417/* ask agent to sign data, returns -1 on error, 0 on success */ 429/* ask agent to sign data, returns err.h code on error, 0 on success */
418int 430int
419ssh_agent_sign(AuthenticationConnection *auth, 431ssh_agent_sign(int sock, struct sshkey *key,
420 Key *key, 432 u_char **sigp, size_t *lenp,
421 u_char **sigp, u_int *lenp, 433 const u_char *data, size_t datalen, u_int compat)
422 u_char *data, u_int datalen)
423{ 434{
424 extern int datafellows; 435 struct sshbuf *msg;
425 Buffer msg; 436 u_char *blob = NULL, type;
426 u_char *blob; 437 size_t blen = 0, len = 0;
427 u_int blen; 438 u_int flags = 0;
428 int type, flags = 0; 439 int r = SSH_ERR_INTERNAL_ERROR;
429 int ret = -1; 440
430 441 if (sigp != NULL)
431 if (key_to_blob(key, &blob, &blen) == 0) 442 *sigp = NULL;
432 return -1; 443 if (lenp != NULL)
433 444 *lenp = 0;
434 if (datafellows & SSH_BUG_SIGBLOB) 445
435 flags = SSH_AGENT_OLD_SIGNATURE; 446 if (datalen > SSH_KEY_MAX_SIGN_DATA_SIZE)
436 447 return SSH_ERR_INVALID_ARGUMENT;
437 buffer_init(&msg); 448 if (compat & SSH_BUG_SIGBLOB)
438 buffer_put_char(&msg, SSH2_AGENTC_SIGN_REQUEST); 449 flags |= SSH_AGENT_OLD_SIGNATURE;
439 buffer_put_string(&msg, blob, blen); 450 if ((msg = sshbuf_new()) == NULL)
440 buffer_put_string(&msg, data, datalen); 451 return SSH_ERR_ALLOC_FAIL;
441 buffer_put_int(&msg, flags); 452 if ((r = sshkey_to_blob(key, &blob, &blen)) != 0)
442 free(blob); 453 goto out;
443 454 if ((r = sshbuf_put_u8(msg, SSH2_AGENTC_SIGN_REQUEST)) != 0 ||
444 if (ssh_request_reply(auth, &msg, &msg) == 0) { 455 (r = sshbuf_put_string(msg, blob, blen)) != 0 ||
445 buffer_free(&msg); 456 (r = sshbuf_put_string(msg, data, datalen)) != 0 ||
446 return -1; 457 (r = sshbuf_put_u32(msg, flags)) != 0)
447 } 458 goto out;
448 type = buffer_get_char(&msg); 459 if ((r = ssh_request_reply(sock, msg, msg) != 0))
460 goto out;
461 if ((r = sshbuf_get_u8(msg, &type)) != 0)
462 goto out;
449 if (agent_failed(type)) { 463 if (agent_failed(type)) {
450 logit("Agent admitted failure to sign using the key."); 464 r = SSH_ERR_AGENT_FAILURE;
465 goto out;
451 } else if (type != SSH2_AGENT_SIGN_RESPONSE) { 466 } else if (type != SSH2_AGENT_SIGN_RESPONSE) {
452 fatal("Bad authentication response: %d", type); 467 r = SSH_ERR_INVALID_FORMAT;
453 } else { 468 goto out;
454 ret = 0; 469 }
455 *sigp = buffer_get_string(&msg, lenp); 470 if ((r = sshbuf_get_string(msg, sigp, &len)) != 0)
471 goto out;
472 *lenp = len;
473 r = 0;
474 out:
475 if (blob != NULL) {
476 explicit_bzero(blob, blen);
477 free(blob);
456 } 478 }
457 buffer_free(&msg); 479 sshbuf_free(msg);
458 return ret; 480 return r;
459} 481}
460 482
461/* Encode key for a message to the agent. */ 483/* Encode key for a message to the agent. */
462 484
463#ifdef WITH_SSH1 485#ifdef WITH_SSH1
464static void 486static int
465ssh_encode_identity_rsa1(Buffer *b, RSA *key, const char *comment) 487ssh_encode_identity_rsa1(struct sshbuf *b, RSA *key, const char *comment)
466{ 488{
467 buffer_put_int(b, BN_num_bits(key->n)); 489 int r;
468 buffer_put_bignum(b, key->n); 490
469 buffer_put_bignum(b, key->e);
470 buffer_put_bignum(b, key->d);
471 /* To keep within the protocol: p < q for ssh. in SSL p > q */ 491 /* To keep within the protocol: p < q for ssh. in SSL p > q */
472 buffer_put_bignum(b, key->iqmp); /* ssh key->u */ 492 if ((r = sshbuf_put_u32(b, BN_num_bits(key->n))) != 0 ||
473 buffer_put_bignum(b, key->q); /* ssh key->p, SSL key->q */ 493 (r = sshbuf_put_bignum1(b, key->n)) != 0 ||
474 buffer_put_bignum(b, key->p); /* ssh key->q, SSL key->p */ 494 (r = sshbuf_put_bignum1(b, key->e)) != 0 ||
475 buffer_put_cstring(b, comment); 495 (r = sshbuf_put_bignum1(b, key->d)) != 0 ||
496 (r = sshbuf_put_bignum1(b, key->iqmp)) != 0 ||
497 (r = sshbuf_put_bignum1(b, key->q)) != 0 ||
498 (r = sshbuf_put_bignum1(b, key->p)) != 0 ||
499 (r = sshbuf_put_cstring(b, comment)) != 0)
500 return r;
501 return 0;
476} 502}
477#endif 503#endif
478 504
479static void 505static int
480ssh_encode_identity_ssh2(Buffer *b, Key *key, const char *comment) 506ssh_encode_identity_ssh2(struct sshbuf *b, struct sshkey *key,
507 const char *comment)
508{
509 int r;
510
511 if ((r = sshkey_private_serialize(key, b)) != 0 ||
512 (r = sshbuf_put_cstring(b, comment)) != 0)
513 return r;
514 return 0;
515}
516
517static int
518encode_constraints(struct sshbuf *m, u_int life, u_int confirm)
481{ 519{
482 key_private_serialize(key, b); 520 int r;
483 buffer_put_cstring(b, comment); 521
522 if (life != 0) {
523 if ((r = sshbuf_put_u8(m, SSH_AGENT_CONSTRAIN_LIFETIME)) != 0 ||
524 (r = sshbuf_put_u32(m, life)) != 0)
525 goto out;
526 }
527 if (confirm != 0) {
528 if ((r = sshbuf_put_u8(m, SSH_AGENT_CONSTRAIN_CONFIRM)) != 0)
529 goto out;
530 }
531 r = 0;
532 out:
533 return r;
484} 534}
485 535
486/* 536/*
487 * Adds an identity to the authentication server. This call is not meant to 537 * Adds an identity to the authentication server.
488 * be used by normal applications. 538 * This call is intended only for use by ssh-add(1) and like applications.
489 */ 539 */
490
491int 540int
492ssh_add_identity_constrained(AuthenticationConnection *auth, Key *key, 541ssh_add_identity_constrained(int sock, struct sshkey *key, const char *comment,
493 const char *comment, u_int life, u_int confirm) 542 u_int life, u_int confirm)
494{ 543{
495 Buffer msg; 544 struct sshbuf *msg;
496 int type, constrained = (life || confirm); 545 int r, constrained = (life || confirm);
546 u_char type;
497 547
498 buffer_init(&msg); 548 if ((msg = sshbuf_new()) == NULL)
549 return SSH_ERR_ALLOC_FAIL;
499 550
500 switch (key->type) { 551 switch (key->type) {
501#ifdef WITH_SSH1 552#ifdef WITH_SSH1
@@ -503,8 +554,9 @@ ssh_add_identity_constrained(AuthenticationConnection *auth, Key *key,
503 type = constrained ? 554 type = constrained ?
504 SSH_AGENTC_ADD_RSA_ID_CONSTRAINED : 555 SSH_AGENTC_ADD_RSA_ID_CONSTRAINED :
505 SSH_AGENTC_ADD_RSA_IDENTITY; 556 SSH_AGENTC_ADD_RSA_IDENTITY;
506 buffer_put_char(&msg, type); 557 if ((r = sshbuf_put_u8(msg, type)) != 0 ||
507 ssh_encode_identity_rsa1(&msg, key->rsa, comment); 558 (r = ssh_encode_identity_rsa1(msg, key->rsa, comment)) != 0)
559 goto out;
508 break; 560 break;
509#endif 561#endif
510#ifdef WITH_OPENSSL 562#ifdef WITH_OPENSSL
@@ -522,77 +574,88 @@ ssh_add_identity_constrained(AuthenticationConnection *auth, Key *key,
522 type = constrained ? 574 type = constrained ?
523 SSH2_AGENTC_ADD_ID_CONSTRAINED : 575 SSH2_AGENTC_ADD_ID_CONSTRAINED :
524 SSH2_AGENTC_ADD_IDENTITY; 576 SSH2_AGENTC_ADD_IDENTITY;
525 buffer_put_char(&msg, type); 577 if ((r = sshbuf_put_u8(msg, type)) != 0 ||
526 ssh_encode_identity_ssh2(&msg, key, comment); 578 (r = ssh_encode_identity_ssh2(msg, key, comment)) != 0)
579 goto out;
527 break; 580 break;
528 default: 581 default:
529 buffer_free(&msg); 582 r = SSH_ERR_INVALID_ARGUMENT;
530 return 0; 583 goto out;
531 }
532 if (constrained) {
533 if (life != 0) {
534 buffer_put_char(&msg, SSH_AGENT_CONSTRAIN_LIFETIME);
535 buffer_put_int(&msg, life);
536 }
537 if (confirm != 0)
538 buffer_put_char(&msg, SSH_AGENT_CONSTRAIN_CONFIRM);
539 } 584 }
540 if (ssh_request_reply(auth, &msg, &msg) == 0) { 585 if (constrained &&
541 buffer_free(&msg); 586 (r = encode_constraints(msg, life, confirm)) != 0)
542 return 0; 587 goto out;
543 } 588 if ((r = ssh_request_reply(sock, msg, msg)) != 0)
544 type = buffer_get_char(&msg); 589 goto out;
545 buffer_free(&msg); 590 if ((r = sshbuf_get_u8(msg, &type)) != 0)
546 return decode_reply(type); 591 goto out;
592 r = decode_reply(type);
593 out:
594 sshbuf_free(msg);
595 return r;
547} 596}
548 597
549/* 598/*
550 * Removes an identity from the authentication server. This call is not 599 * Removes an identity from the authentication server.
551 * meant to be used by normal applications. 600 * This call is intended only for use by ssh-add(1) and like applications.
552 */ 601 */
553
554int 602int
555ssh_remove_identity(AuthenticationConnection *auth, Key *key) 603ssh_remove_identity(int sock, struct sshkey *key)
556{ 604{
557 Buffer msg; 605 struct sshbuf *msg;
558 int type; 606 int r;
559 u_char *blob; 607 u_char type, *blob = NULL;
560 u_int blen; 608 size_t blen;
561 609
562 buffer_init(&msg); 610 if ((msg = sshbuf_new()) == NULL)
611 return SSH_ERR_ALLOC_FAIL;
563 612
564#ifdef WITH_SSH1 613#ifdef WITH_SSH1
565 if (key->type == KEY_RSA1) { 614 if (key->type == KEY_RSA1) {
566 buffer_put_char(&msg, SSH_AGENTC_REMOVE_RSA_IDENTITY); 615 if ((r = sshbuf_put_u8(msg,
567 buffer_put_int(&msg, BN_num_bits(key->rsa->n)); 616 SSH_AGENTC_REMOVE_RSA_IDENTITY)) != 0 ||
568 buffer_put_bignum(&msg, key->rsa->e); 617 (r = sshbuf_put_u32(msg, BN_num_bits(key->rsa->n))) != 0 ||
569 buffer_put_bignum(&msg, key->rsa->n); 618 (r = sshbuf_put_bignum1(msg, key->rsa->e)) != 0 ||
619 (r = sshbuf_put_bignum1(msg, key->rsa->n)) != 0)
620 goto out;
570 } else 621 } else
571#endif 622#endif
572 if (key->type != KEY_UNSPEC) { 623 if (key->type != KEY_UNSPEC) {
573 key_to_blob(key, &blob, &blen); 624 if ((r = sshkey_to_blob(key, &blob, &blen)) != 0)
574 buffer_put_char(&msg, SSH2_AGENTC_REMOVE_IDENTITY); 625 goto out;
575 buffer_put_string(&msg, blob, blen); 626 if ((r = sshbuf_put_u8(msg,
576 free(blob); 627 SSH2_AGENTC_REMOVE_IDENTITY)) != 0 ||
628 (r = sshbuf_put_string(msg, blob, blen)) != 0)
629 goto out;
577 } else { 630 } else {
578 buffer_free(&msg); 631 r = SSH_ERR_INVALID_ARGUMENT;
579 return 0; 632 goto out;
580 } 633 }
581 if (ssh_request_reply(auth, &msg, &msg) == 0) { 634 if ((r = ssh_request_reply(sock, msg, msg)) != 0)
582 buffer_free(&msg); 635 goto out;
583 return 0; 636 if ((r = sshbuf_get_u8(msg, &type)) != 0)
637 goto out;
638 r = decode_reply(type);
639 out:
640 if (blob != NULL) {
641 explicit_bzero(blob, blen);
642 free(blob);
584 } 643 }
585 type = buffer_get_char(&msg); 644 sshbuf_free(msg);
586 buffer_free(&msg); 645 return r;
587 return decode_reply(type);
588} 646}
589 647
648/*
649 * Add/remove an token-based identity from the authentication server.
650 * This call is intended only for use by ssh-add(1) and like applications.
651 */
590int 652int
591ssh_update_card(AuthenticationConnection *auth, int add, 653ssh_update_card(int sock, int add, const char *reader_id, const char *pin,
592 const char *reader_id, const char *pin, u_int life, u_int confirm) 654 u_int life, u_int confirm)
593{ 655{
594 Buffer msg; 656 struct sshbuf *msg;
595 int type, constrained = (life || confirm); 657 int r, constrained = (life || confirm);
658 u_char type;
596 659
597 if (add) { 660 if (add) {
598 type = constrained ? 661 type = constrained ?
@@ -601,69 +664,48 @@ ssh_update_card(AuthenticationConnection *auth, int add,
601 } else 664 } else
602 type = SSH_AGENTC_REMOVE_SMARTCARD_KEY; 665 type = SSH_AGENTC_REMOVE_SMARTCARD_KEY;
603 666
604 buffer_init(&msg); 667 if ((msg = sshbuf_new()) == NULL)
605 buffer_put_char(&msg, type); 668 return SSH_ERR_ALLOC_FAIL;
606 buffer_put_cstring(&msg, reader_id); 669 if ((r = sshbuf_put_u8(msg, type)) != 0 ||
607 buffer_put_cstring(&msg, pin); 670 (r = sshbuf_put_cstring(msg, reader_id)) != 0 ||
608 671 (r = sshbuf_put_cstring(msg, pin)) != 0)
609 if (constrained) { 672 goto out;
610 if (life != 0) { 673 if (constrained &&
611 buffer_put_char(&msg, SSH_AGENT_CONSTRAIN_LIFETIME); 674 (r = encode_constraints(msg, life, confirm)) != 0)
612 buffer_put_int(&msg, life); 675 goto out;
613 } 676 if ((r = ssh_request_reply(sock, msg, msg)) != 0)
614 if (confirm != 0) 677 goto out;
615 buffer_put_char(&msg, SSH_AGENT_CONSTRAIN_CONFIRM); 678 if ((r = sshbuf_get_u8(msg, &type)) != 0)
616 } 679 goto out;
617 680 r = decode_reply(type);
618 if (ssh_request_reply(auth, &msg, &msg) == 0) { 681 out:
619 buffer_free(&msg); 682 sshbuf_free(msg);
620 return 0; 683 return r;
621 }
622 type = buffer_get_char(&msg);
623 buffer_free(&msg);
624 return decode_reply(type);
625} 684}
626 685
627/* 686/*
628 * Removes all identities from the agent. This call is not meant to be used 687 * Removes all identities from the agent.
629 * by normal applications. 688 * This call is intended only for use by ssh-add(1) and like applications.
630 */ 689 */
631
632int
633ssh_remove_all_identities(AuthenticationConnection *auth, int version)
634{
635 Buffer msg;
636 int type;
637 int code = (version==1) ?
638 SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES :
639 SSH2_AGENTC_REMOVE_ALL_IDENTITIES;
640
641 buffer_init(&msg);
642 buffer_put_char(&msg, code);
643
644 if (ssh_request_reply(auth, &msg, &msg) == 0) {
645 buffer_free(&msg);
646 return 0;
647 }
648 type = buffer_get_char(&msg);
649 buffer_free(&msg);
650 return decode_reply(type);
651}
652
653int 690int
654decode_reply(int type) 691ssh_remove_all_identities(int sock, int version)
655{ 692{
656 switch (type) { 693 struct sshbuf *msg;
657 case SSH_AGENT_FAILURE: 694 u_char type = (version == 1) ?
658 case SSH_COM_AGENT2_FAILURE: 695 SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES :
659 case SSH2_AGENT_FAILURE: 696 SSH2_AGENTC_REMOVE_ALL_IDENTITIES;
660 logit("SSH_AGENT_FAILURE"); 697 int r;
661 return 0; 698
662 case SSH_AGENT_SUCCESS: 699 if ((msg = sshbuf_new()) == NULL)
663 return 1; 700 return SSH_ERR_ALLOC_FAIL;
664 default: 701 if ((r = sshbuf_put_u8(msg, type)) != 0)
665 fatal("Bad response from authentication agent: %d", type); 702 goto out;
666 } 703 if ((r = ssh_request_reply(sock, msg, msg)) != 0)
667 /* NOTREACHED */ 704 goto out;
668 return 0; 705 if ((r = sshbuf_get_u8(msg, &type)) != 0)
706 goto out;
707 r = decode_reply(type);
708 out:
709 sshbuf_free(msg);
710 return r;
669} 711}
diff --git a/authfd.h b/authfd.h
index 2582a27aa..bea20c26b 100644
--- a/authfd.h
+++ b/authfd.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfd.h,v 1.37 2009/08/27 17:44:52 djm Exp $ */ 1/* $OpenBSD: authfd.h,v 1.38 2015/01/14 20:05:27 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -16,6 +16,33 @@
16#ifndef AUTHFD_H 16#ifndef AUTHFD_H
17#define AUTHFD_H 17#define AUTHFD_H
18 18
19/* List of identities returned by ssh_fetch_identitylist() */
20struct ssh_identitylist {
21 size_t nkeys;
22 struct sshkey **keys;
23 char **comments;
24};
25
26int ssh_get_authentication_socket(int *fdp);
27void ssh_close_authentication_socket(int sock);
28
29int ssh_lock_agent(int sock, int lock, const char *password);
30int ssh_fetch_identitylist(int sock, int version,
31 struct ssh_identitylist **idlp);
32void ssh_free_identitylist(struct ssh_identitylist *idl);
33int ssh_add_identity_constrained(int sock, struct sshkey *key,
34 const char *comment, u_int life, u_int confirm);
35int ssh_remove_identity(int sock, struct sshkey *key);
36int ssh_update_card(int sock, int add, const char *reader_id,
37 const char *pin, u_int life, u_int confirm);
38int ssh_remove_all_identities(int sock, int version);
39
40int ssh_decrypt_challenge(int sock, struct sshkey* key, BIGNUM *challenge,
41 u_char session_id[16], u_char response[16]);
42int ssh_agent_sign(int sock, struct sshkey *key,
43 u_char **sigp, size_t *lenp,
44 const u_char *data, size_t datalen, u_int compat);
45
19/* Messages for the authentication agent connection. */ 46/* Messages for the authentication agent connection. */
20#define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1 47#define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1
21#define SSH_AGENT_RSA_IDENTITIES_ANSWER 2 48#define SSH_AGENT_RSA_IDENTITIES_ANSWER 2
@@ -60,35 +87,4 @@
60 87
61#define SSH_AGENT_OLD_SIGNATURE 0x01 88#define SSH_AGENT_OLD_SIGNATURE 0x01
62 89
63typedef struct {
64 int fd;
65 Buffer identities;
66 int howmany;
67} AuthenticationConnection;
68
69int ssh_agent_present(void);
70int ssh_get_authentication_socket(void);
71void ssh_close_authentication_socket(int);
72
73AuthenticationConnection *ssh_get_authentication_connection(void);
74void ssh_close_authentication_connection(AuthenticationConnection *);
75int ssh_get_num_identities(AuthenticationConnection *, int);
76Key *ssh_get_first_identity(AuthenticationConnection *, char **, int);
77Key *ssh_get_next_identity(AuthenticationConnection *, char **, int);
78int ssh_add_identity_constrained(AuthenticationConnection *, Key *,
79 const char *, u_int, u_int);
80int ssh_remove_identity(AuthenticationConnection *, Key *);
81int ssh_remove_all_identities(AuthenticationConnection *, int);
82int ssh_lock_agent(AuthenticationConnection *, int, const char *);
83int ssh_update_card(AuthenticationConnection *, int, const char *,
84 const char *, u_int, u_int);
85
86int
87ssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16],
88 u_int, u_char[16]);
89
90int
91ssh_agent_sign(AuthenticationConnection *, Key *, u_char **, u_int *, u_char *,
92 u_int);
93
94#endif /* AUTHFD_H */ 90#endif /* AUTHFD_H */
diff --git a/authfile.c b/authfile.c
index e93d86738..3a81786c7 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfile.c,v 1.107 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: authfile.c,v 1.111 2015/02/23 16:55:51 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
4 * 4 *
@@ -27,7 +27,6 @@
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <sys/param.h>
31#include <sys/uio.h> 30#include <sys/uio.h>
32 31
33#include <errno.h> 32#include <errno.h>
@@ -37,6 +36,7 @@
37#include <stdlib.h> 36#include <stdlib.h>
38#include <string.h> 37#include <string.h>
39#include <unistd.h> 38#include <unistd.h>
39#include <limits.h>
40 40
41#include "cipher.h" 41#include "cipher.h"
42#include "key.h" 42#include "key.h"
@@ -48,6 +48,7 @@
48#include "atomicio.h" 48#include "atomicio.h"
49#include "sshbuf.h" 49#include "sshbuf.h"
50#include "ssherr.h" 50#include "ssherr.h"
51#include "krl.h"
51 52
52#define MAX_KEY_FILE_SIZE (1024 * 1024) 53#define MAX_KEY_FILE_SIZE (1024 * 1024)
53 54
@@ -94,7 +95,7 @@ sshkey_save_private(struct sshkey *key, const char *filename,
94 95
95/* Load a key from a fd into a buffer */ 96/* Load a key from a fd into a buffer */
96int 97int
97sshkey_load_file(int fd, const char *filename, struct sshbuf *blob) 98sshkey_load_file(int fd, struct sshbuf *blob)
98{ 99{
99 u_char buf[1024]; 100 u_char buf[1024];
100 size_t len; 101 size_t len;
@@ -141,8 +142,7 @@ sshkey_load_file(int fd, const char *filename, struct sshbuf *blob)
141 * otherwise. 142 * otherwise.
142 */ 143 */
143static int 144static int
144sshkey_load_public_rsa1(int fd, const char *filename, 145sshkey_load_public_rsa1(int fd, struct sshkey **keyp, char **commentp)
145 struct sshkey **keyp, char **commentp)
146{ 146{
147 struct sshbuf *b = NULL; 147 struct sshbuf *b = NULL;
148 int r; 148 int r;
@@ -153,7 +153,7 @@ sshkey_load_public_rsa1(int fd, const char *filename,
153 153
154 if ((b = sshbuf_new()) == NULL) 154 if ((b = sshbuf_new()) == NULL)
155 return SSH_ERR_ALLOC_FAIL; 155 return SSH_ERR_ALLOC_FAIL;
156 if ((r = sshkey_load_file(fd, filename, b)) != 0) 156 if ((r = sshkey_load_file(fd, b)) != 0)
157 goto out; 157 goto out;
158 if ((r = sshkey_parse_public_rsa1_fileblob(b, keyp, commentp)) != 0) 158 if ((r = sshkey_parse_public_rsa1_fileblob(b, keyp, commentp)) != 0)
159 goto out; 159 goto out;
@@ -164,33 +164,6 @@ sshkey_load_public_rsa1(int fd, const char *filename,
164} 164}
165#endif /* WITH_SSH1 */ 165#endif /* WITH_SSH1 */
166 166
167#ifdef WITH_OPENSSL
168/* XXX Deprecate? */
169int
170sshkey_load_private_pem(int fd, int type, const char *passphrase,
171 struct sshkey **keyp, char **commentp)
172{
173 struct sshbuf *buffer = NULL;
174 int r;
175
176 *keyp = NULL;
177 if (commentp != NULL)
178 *commentp = NULL;
179
180 if ((buffer = sshbuf_new()) == NULL)
181 return SSH_ERR_ALLOC_FAIL;
182 if ((r = sshkey_load_file(fd, NULL, buffer)) != 0)
183 goto out;
184 if ((r = sshkey_parse_private_pem_fileblob(buffer, type, passphrase,
185 keyp, commentp)) != 0)
186 goto out;
187 r = 0;
188 out:
189 sshbuf_free(buffer);
190 return r;
191}
192#endif /* WITH_OPENSSL */
193
194/* XXX remove error() calls from here? */ 167/* XXX remove error() calls from here? */
195int 168int
196sshkey_perm_ok(int fd, const char *filename) 169sshkey_perm_ok(int fd, const char *filename)
@@ -226,7 +199,6 @@ sshkey_load_private_type(int type, const char *filename, const char *passphrase,
226 struct sshkey **keyp, char **commentp, int *perm_ok) 199 struct sshkey **keyp, char **commentp, int *perm_ok)
227{ 200{
228 int fd, r; 201 int fd, r;
229 struct sshbuf *buffer = NULL;
230 202
231 *keyp = NULL; 203 *keyp = NULL;
232 if (commentp != NULL) 204 if (commentp != NULL)
@@ -246,18 +218,31 @@ sshkey_load_private_type(int type, const char *filename, const char *passphrase,
246 if (perm_ok != NULL) 218 if (perm_ok != NULL)
247 *perm_ok = 1; 219 *perm_ok = 1;
248 220
221 r = sshkey_load_private_type_fd(fd, type, passphrase, keyp, commentp);
222 out:
223 close(fd);
224 return r;
225}
226
227int
228sshkey_load_private_type_fd(int fd, int type, const char *passphrase,
229 struct sshkey **keyp, char **commentp)
230{
231 struct sshbuf *buffer = NULL;
232 int r;
233
249 if ((buffer = sshbuf_new()) == NULL) { 234 if ((buffer = sshbuf_new()) == NULL) {
250 r = SSH_ERR_ALLOC_FAIL; 235 r = SSH_ERR_ALLOC_FAIL;
251 goto out; 236 goto out;
252 } 237 }
253 if ((r = sshkey_load_file(fd, filename, buffer)) != 0) 238 if ((r = sshkey_load_file(fd, buffer)) != 0 ||
254 goto out; 239 (r = sshkey_parse_private_fileblob_type(buffer, type,
255 if ((r = sshkey_parse_private_fileblob_type(buffer, type, passphrase, 240 passphrase, keyp, commentp)) != 0)
256 keyp, commentp)) != 0)
257 goto out; 241 goto out;
242
243 /* success */
258 r = 0; 244 r = 0;
259 out: 245 out:
260 close(fd);
261 if (buffer != NULL) 246 if (buffer != NULL)
262 sshbuf_free(buffer); 247 sshbuf_free(buffer);
263 return r; 248 return r;
@@ -286,7 +271,7 @@ sshkey_load_private(const char *filename, const char *passphrase,
286 r = SSH_ERR_ALLOC_FAIL; 271 r = SSH_ERR_ALLOC_FAIL;
287 goto out; 272 goto out;
288 } 273 }
289 if ((r = sshkey_load_file(fd, filename, buffer)) != 0 || 274 if ((r = sshkey_load_file(fd, buffer)) != 0 ||
290 (r = sshkey_parse_private_fileblob(buffer, passphrase, filename, 275 (r = sshkey_parse_private_fileblob(buffer, passphrase, filename,
291 keyp, commentp)) != 0) 276 keyp, commentp)) != 0)
292 goto out; 277 goto out;
@@ -350,7 +335,7 @@ int
350sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp) 335sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
351{ 336{
352 struct sshkey *pub = NULL; 337 struct sshkey *pub = NULL;
353 char file[MAXPATHLEN]; 338 char file[PATH_MAX];
354 int r, fd; 339 int r, fd;
355 340
356 if (keyp != NULL) 341 if (keyp != NULL)
@@ -358,11 +343,13 @@ sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
358 if (commentp != NULL) 343 if (commentp != NULL)
359 *commentp = NULL; 344 *commentp = NULL;
360 345
346 /* XXX should load file once and attempt to parse each format */
347
361 if ((fd = open(filename, O_RDONLY)) < 0) 348 if ((fd = open(filename, O_RDONLY)) < 0)
362 goto skip; 349 goto skip;
363#ifdef WITH_SSH1 350#ifdef WITH_SSH1
364 /* try rsa1 private key */ 351 /* try rsa1 private key */
365 r = sshkey_load_public_rsa1(fd, filename, keyp, commentp); 352 r = sshkey_load_public_rsa1(fd, keyp, commentp);
366 close(fd); 353 close(fd);
367 switch (r) { 354 switch (r) {
368 case SSH_ERR_INTERNAL_ERROR: 355 case SSH_ERR_INTERNAL_ERROR:
@@ -409,6 +396,7 @@ sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
409 return 0; 396 return 0;
410 } 397 }
411 sshkey_free(pub); 398 sshkey_free(pub);
399
412 return r; 400 return r;
413} 401}
414 402
@@ -494,11 +482,14 @@ sshkey_load_private_cert(int type, const char *filename, const char *passphrase,
494/* 482/*
495 * Returns success if the specified "key" is listed in the file "filename", 483 * Returns success if the specified "key" is listed in the file "filename",
496 * SSH_ERR_KEY_NOT_FOUND: if the key is not listed or another error. 484 * SSH_ERR_KEY_NOT_FOUND: if the key is not listed or another error.
497 * If strict_type is set then the key type must match exactly, 485 * If "strict_type" is set then the key type must match exactly,
498 * otherwise a comparison that ignores certficiate data is performed. 486 * otherwise a comparison that ignores certficiate data is performed.
487 * If "check_ca" is set and "key" is a certificate, then its CA key is
488 * also checked and sshkey_in_file() will return success if either is found.
499 */ 489 */
500int 490int
501sshkey_in_file(struct sshkey *key, const char *filename, int strict_type) 491sshkey_in_file(struct sshkey *key, const char *filename, int strict_type,
492 int check_ca)
502{ 493{
503 FILE *f; 494 FILE *f;
504 char line[SSH_MAX_PUBKEY_BYTES]; 495 char line[SSH_MAX_PUBKEY_BYTES];
@@ -509,12 +500,8 @@ sshkey_in_file(struct sshkey *key, const char *filename, int strict_type)
509 int (*sshkey_compare)(const struct sshkey *, const struct sshkey *) = 500 int (*sshkey_compare)(const struct sshkey *, const struct sshkey *) =
510 strict_type ? sshkey_equal : sshkey_equal_public; 501 strict_type ? sshkey_equal : sshkey_equal_public;
511 502
512 if ((f = fopen(filename, "r")) == NULL) { 503 if ((f = fopen(filename, "r")) == NULL)
513 if (errno == ENOENT) 504 return SSH_ERR_SYSTEM_ERROR;
514 return SSH_ERR_KEY_NOT_FOUND;
515 else
516 return SSH_ERR_SYSTEM_ERROR;
517 }
518 505
519 while (read_keyfile_line(f, filename, line, sizeof(line), 506 while (read_keyfile_line(f, filename, line, sizeof(line),
520 &linenum) != -1) { 507 &linenum) != -1) {
@@ -538,7 +525,9 @@ sshkey_in_file(struct sshkey *key, const char *filename, int strict_type)
538 } 525 }
539 if ((r = sshkey_read(pub, &cp)) != 0) 526 if ((r = sshkey_read(pub, &cp)) != 0)
540 goto out; 527 goto out;
541 if (sshkey_compare(key, pub)) { 528 if (sshkey_compare(key, pub) ||
529 (check_ca && sshkey_is_cert(key) &&
530 sshkey_compare(key->cert->signature_key, pub))) {
542 r = 0; 531 r = 0;
543 goto out; 532 goto out;
544 } 533 }
@@ -553,3 +542,37 @@ sshkey_in_file(struct sshkey *key, const char *filename, int strict_type)
553 return r; 542 return r;
554} 543}
555 544
545/*
546 * Checks whether the specified key is revoked, returning 0 if not,
547 * SSH_ERR_KEY_REVOKED if it is or another error code if something
548 * unexpected happened.
549 * This will check both the key and, if it is a certificate, its CA key too.
550 * "revoked_keys_file" may be a KRL or a one-per-line list of public keys.
551 */
552int
553sshkey_check_revoked(struct sshkey *key, const char *revoked_keys_file)
554{
555 int r;
556
557 r = ssh_krl_file_contains_key(revoked_keys_file, key);
558 /* If this was not a KRL to begin with then continue below */
559 if (r != SSH_ERR_KRL_BAD_MAGIC)
560 return r;
561
562 /*
563 * If the file is not a KRL or we can't handle KRLs then attempt to
564 * parse the file as a flat list of keys.
565 */
566 switch ((r = sshkey_in_file(key, revoked_keys_file, 0, 1))) {
567 case 0:
568 /* Key found => revoked */
569 return SSH_ERR_KEY_REVOKED;
570 case SSH_ERR_KEY_NOT_FOUND:
571 /* Key not found => not revoked */
572 return 0;
573 default:
574 /* Some other error occurred */
575 return r;
576 }
577}
578
diff --git a/authfile.h b/authfile.h
index 03bc3958c..624d269f1 100644
--- a/authfile.h
+++ b/authfile.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfile.h,v 1.19 2014/07/03 23:18:35 djm Exp $ */ 1/* $OpenBSD: authfile.h,v 1.21 2015/01/08 10:14:08 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
@@ -30,9 +30,12 @@
30struct sshbuf; 30struct sshbuf;
31struct sshkey; 31struct sshkey;
32 32
33/* XXX document these */
34/* XXX some of these could probably be merged/retired */
35
33int sshkey_save_private(struct sshkey *, const char *, 36int sshkey_save_private(struct sshkey *, const char *,
34 const char *, const char *, int, const char *, int); 37 const char *, const char *, int, const char *, int);
35int sshkey_load_file(int, const char *, struct sshbuf *); 38int sshkey_load_file(int, struct sshbuf *);
36int sshkey_load_cert(const char *, struct sshkey **); 39int sshkey_load_cert(const char *, struct sshkey **);
37int sshkey_load_public(const char *, struct sshkey **, char **); 40int sshkey_load_public(const char *, struct sshkey **, char **);
38int sshkey_load_private(const char *, const char *, struct sshkey **, char **); 41int sshkey_load_private(const char *, const char *, struct sshkey **, char **);
@@ -40,8 +43,10 @@ int sshkey_load_private_cert(int, const char *, const char *,
40 struct sshkey **, int *); 43 struct sshkey **, int *);
41int sshkey_load_private_type(int, const char *, const char *, 44int sshkey_load_private_type(int, const char *, const char *,
42 struct sshkey **, char **, int *); 45 struct sshkey **, char **, int *);
43int sshkey_load_private_pem(int, int, const char *, struct sshkey **, char **); 46int sshkey_load_private_type_fd(int fd, int type, const char *passphrase,
47 struct sshkey **keyp, char **commentp);
44int sshkey_perm_ok(int, const char *); 48int sshkey_perm_ok(int, const char *);
45int sshkey_in_file(struct sshkey *, const char *, int); 49int sshkey_in_file(struct sshkey *, const char *, int, int);
50int sshkey_check_revoked(struct sshkey *key, const char *revoked_keys_file);
46 51
47#endif 52#endif
diff --git a/bitmap.c b/bitmap.c
new file mode 100644
index 000000000..19cd2e8e3
--- /dev/null
+++ b/bitmap.c
@@ -0,0 +1,212 @@
1/*
2 * Copyright (c) 2015 Damien Miller <djm@mindrot.org>
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 "includes.h"
18
19#include <sys/types.h>
20#include <string.h>
21#include <stdlib.h>
22
23#include "bitmap.h"
24
25#define BITMAP_WTYPE u_int
26#define BITMAP_MAX (1<<24)
27#define BITMAP_BYTES (sizeof(BITMAP_WTYPE))
28#define BITMAP_BITS (sizeof(BITMAP_WTYPE) * 8)
29#define BITMAP_WMASK ((BITMAP_WTYPE)BITMAP_BITS - 1)
30struct bitmap {
31 BITMAP_WTYPE *d;
32 size_t len; /* number of words allocated */
33 size_t top; /* index of top word allocated */
34};
35
36struct bitmap *
37bitmap_new(void)
38{
39 struct bitmap *ret;
40
41 if ((ret = calloc(1, sizeof(*ret))) == NULL)
42 return NULL;
43 if ((ret->d = calloc(1, BITMAP_BYTES)) == NULL) {
44 free(ret);
45 return NULL;
46 }
47 ret->len = 1;
48 ret->top = 0;
49 return ret;
50}
51
52void
53bitmap_free(struct bitmap *b)
54{
55 if (b != NULL && b->d != NULL) {
56 memset(b->d, 0, b->len);
57 free(b->d);
58 }
59 free(b);
60}
61
62void
63bitmap_zero(struct bitmap *b)
64{
65 memset(b->d, 0, b->len * BITMAP_BYTES);
66 b->top = 0;
67}
68
69int
70bitmap_test_bit(struct bitmap *b, u_int n)
71{
72 if (b->top >= b->len)
73 return 0; /* invalid */
74 if (b->len == 0 || (n / BITMAP_BITS) > b->top)
75 return 0;
76 return (b->d[n / BITMAP_BITS] >> (n & BITMAP_WMASK)) & 1;
77}
78
79static int
80reserve(struct bitmap *b, u_int n)
81{
82 BITMAP_WTYPE *tmp;
83 size_t nlen;
84
85 if (b->top >= b->len || n > BITMAP_MAX)
86 return -1; /* invalid */
87 nlen = (n / BITMAP_BITS) + 1;
88 if (b->len < nlen) {
89 if ((tmp = reallocarray(b->d, nlen, BITMAP_BYTES)) == NULL)
90 return -1;
91 b->d = tmp;
92 memset(b->d + b->len, 0, (nlen - b->len) * BITMAP_BYTES);
93 b->len = nlen;
94 }
95 return 0;
96}
97
98int
99bitmap_set_bit(struct bitmap *b, u_int n)
100{
101 int r;
102 size_t offset;
103
104 if ((r = reserve(b, n)) != 0)
105 return r;
106 offset = n / BITMAP_BITS;
107 if (offset > b->top)
108 b->top = offset;
109 b->d[offset] |= (BITMAP_WTYPE)1 << (n & BITMAP_WMASK);
110 return 0;
111}
112
113/* Resets b->top to point to the most significant bit set in b->d */
114static void
115retop(struct bitmap *b)
116{
117 if (b->top >= b->len)
118 return;
119 while (b->top > 0 && b->d[b->top] == 0)
120 b->top--;
121}
122
123void
124bitmap_clear_bit(struct bitmap *b, u_int n)
125{
126 size_t offset;
127
128 if (b->top >= b->len || n > BITMAP_MAX)
129 return; /* invalid */
130 offset = n / BITMAP_BITS;
131 if (offset > b->top)
132 return;
133 b->d[offset] &= ~((BITMAP_WTYPE)1 << (n & BITMAP_WMASK));
134 /* The top may have changed as a result of the clear */
135 retop(b);
136}
137
138size_t
139bitmap_nbits(struct bitmap *b)
140{
141 size_t bits;
142 BITMAP_WTYPE w;
143
144 retop(b);
145 if (b->top >= b->len)
146 return 0; /* invalid */
147 if (b->len == 0 || (b->top == 0 && b->d[0] == 0))
148 return 0;
149 /* Find MSB set */
150 w = b->d[b->top];
151 bits = (b->top + 1) * BITMAP_BITS;
152 while (!(w & ((BITMAP_WTYPE)1 << (BITMAP_BITS - 1)))) {
153 w <<= 1;
154 bits--;
155 }
156 return bits;
157}
158
159size_t
160bitmap_nbytes(struct bitmap *b)
161{
162 return (bitmap_nbits(b) + 7) / 8;
163}
164
165int
166bitmap_to_string(struct bitmap *b, void *p, size_t l)
167{
168 u_char *s = (u_char *)p;
169 size_t i, j, k, need = bitmap_nbytes(b);
170
171 if (l < need || b->top >= b->len)
172 return -1;
173 if (l > need)
174 l = need;
175 /* Put the bytes from LSB backwards */
176 for (i = k = 0; i < b->top + 1; i++) {
177 for (j = 0; j < BITMAP_BYTES; j++) {
178 if (k >= l)
179 break;
180 s[need - 1 - k++] = (b->d[i] >> (j * 8)) & 0xff;
181 }
182 }
183 return 0;
184}
185
186int
187bitmap_from_string(struct bitmap *b, const void *p, size_t l)
188{
189 int r;
190 size_t i, offset, shift;
191 u_char *s = (u_char *)p;
192
193 if (l > BITMAP_MAX / 8)
194 return -1;
195 if ((r = reserve(b, l * 8)) != 0)
196 return r;
197 bitmap_zero(b);
198 if (l == 0)
199 return 0;
200 b->top = offset = ((l + (BITMAP_BYTES - 1)) / BITMAP_BYTES) - 1;
201 shift = ((l + (BITMAP_BYTES - 1)) % BITMAP_BYTES) * 8;
202 for (i = 0; i < l; i++) {
203 b->d[offset] |= (BITMAP_WTYPE)s[i] << shift;
204 if (shift == 0) {
205 offset--;
206 shift = BITMAP_BITS - 8;
207 } else
208 shift -= 8;
209 }
210 retop(b);
211 return 0;
212}
diff --git a/bitmap.h b/bitmap.h
new file mode 100644
index 000000000..c1bb1741a
--- /dev/null
+++ b/bitmap.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (c) 2015 Damien Miller <djm@mindrot.org>
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#ifndef _BITMAP_H
18#define _BITMAP_H
19
20#include <sys/types.h>
21
22/* Simple bit vector routines */
23
24struct bitmap;
25
26/* Allocate a new bitmap. Returns NULL on allocation failure. */
27struct bitmap *bitmap_new(void);
28
29/* Free a bitmap */
30void bitmap_free(struct bitmap *b);
31
32/* Zero an existing bitmap */
33void bitmap_zero(struct bitmap *b);
34
35/* Test whether a bit is set in a bitmap. */
36int bitmap_test_bit(struct bitmap *b, u_int n);
37
38/* Set a bit in a bitmap. Returns 0 on success or -1 on error */
39int bitmap_set_bit(struct bitmap *b, u_int n);
40
41/* Clear a bit in a bitmap */
42void bitmap_clear_bit(struct bitmap *b, u_int n);
43
44/* Return the number of bits in a bitmap (i.e. the position of the MSB) */
45size_t bitmap_nbits(struct bitmap *b);
46
47/* Return the number of bytes needed to represent a bitmap */
48size_t bitmap_nbytes(struct bitmap *b);
49
50/* Convert a bitmap to a big endian byte string */
51int bitmap_to_string(struct bitmap *b, void *p, size_t l);
52
53/* Convert a big endian byte string to a bitmap */
54int bitmap_from_string(struct bitmap *b, const void *p, size_t l);
55
56#endif /* _BITMAP_H */
diff --git a/bufbn.c b/bufbn.c
index b7f7cb122..33ae7f73f 100644
--- a/bufbn.c
+++ b/bufbn.c
@@ -20,12 +20,15 @@
20 20
21#include "includes.h" 21#include "includes.h"
22 22
23#ifdef WITH_OPENSSL
24
23#include <sys/types.h> 25#include <sys/types.h>
24 26
25#include "buffer.h" 27#include "buffer.h"
26#include "log.h" 28#include "log.h"
27#include "ssherr.h" 29#include "ssherr.h"
28 30
31#ifdef WITH_SSH1
29int 32int
30buffer_put_bignum_ret(Buffer *buffer, const BIGNUM *value) 33buffer_put_bignum_ret(Buffer *buffer, const BIGNUM *value)
31{ 34{
@@ -63,6 +66,7 @@ buffer_get_bignum(Buffer *buffer, BIGNUM *value)
63 if (buffer_get_bignum_ret(buffer, value) == -1) 66 if (buffer_get_bignum_ret(buffer, value) == -1)
64 fatal("%s: buffer error", __func__); 67 fatal("%s: buffer error", __func__);
65} 68}
69#endif /* WITH_SSH1 */
66 70
67int 71int
68buffer_put_bignum2_ret(Buffer *buffer, const BIGNUM *value) 72buffer_put_bignum2_ret(Buffer *buffer, const BIGNUM *value)
@@ -101,3 +105,5 @@ buffer_get_bignum2(Buffer *buffer, BIGNUM *value)
101 if (buffer_get_bignum2_ret(buffer, value) == -1) 105 if (buffer_get_bignum2_ret(buffer, value) == -1)
102 fatal("%s: buffer error", __func__); 106 fatal("%s: buffer error", __func__);
103} 107}
108
109#endif /* WITH_OPENSSL */
diff --git a/buffer.h b/buffer.h
index 9d853edf2..df1aebc02 100644
--- a/buffer.h
+++ b/buffer.h
@@ -47,6 +47,7 @@ int buffer_get_ret(Buffer *, void *, u_int);
47int buffer_consume_ret(Buffer *, u_int); 47int buffer_consume_ret(Buffer *, u_int);
48int buffer_consume_end_ret(Buffer *, u_int); 48int buffer_consume_end_ret(Buffer *, u_int);
49 49
50#include <openssl/objects.h>
50#include <openssl/bn.h> 51#include <openssl/bn.h>
51void buffer_put_bignum(Buffer *, const BIGNUM *); 52void buffer_put_bignum(Buffer *, const BIGNUM *);
52void buffer_put_bignum2(Buffer *, const BIGNUM *); 53void buffer_put_bignum2(Buffer *, const BIGNUM *);
diff --git a/canohost.c b/canohost.c
index a3e3bbff8..223964ea3 100644
--- a/canohost.c
+++ b/canohost.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: canohost.c,v 1.71 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: canohost.c,v 1.72 2015/03/01 15:44:40 millert Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -260,24 +260,29 @@ get_socket_address(int sock, int remote, int flags)
260 } 260 }
261 261
262 /* Work around Linux IPv6 weirdness */ 262 /* Work around Linux IPv6 weirdness */
263 if (addr.ss_family == AF_INET6) 263 if (addr.ss_family == AF_INET6) {
264 addrlen = sizeof(struct sockaddr_in6); 264 addrlen = sizeof(struct sockaddr_in6);
265 ipv64_normalise_mapped(&addr, &addrlen);
266 }
265 267
266 if (addr.ss_family == AF_UNIX) { 268 switch (addr.ss_family) {
269 case AF_INET:
270 case AF_INET6:
271 /* Get the address in ascii. */
272 if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop,
273 sizeof(ntop), NULL, 0, flags)) != 0) {
274 error("get_socket_address: getnameinfo %d failed: %s",
275 flags, ssh_gai_strerror(r));
276 return NULL;
277 }
278 return xstrdup(ntop);
279 case AF_UNIX:
267 /* Get the Unix domain socket path. */ 280 /* Get the Unix domain socket path. */
268 return xstrdup(((struct sockaddr_un *)&addr)->sun_path); 281 return xstrdup(((struct sockaddr_un *)&addr)->sun_path);
269 } 282 default:
270 283 /* We can't look up remote Unix domain sockets. */
271 ipv64_normalise_mapped(&addr, &addrlen);
272
273 /* Get the address in ascii. */
274 if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop,
275 sizeof(ntop), NULL, 0, flags)) != 0) {
276 error("get_socket_address: getnameinfo %d failed: %s", flags,
277 ssh_gai_strerror(r));
278 return NULL; 284 return NULL;
279 } 285 }
280 return xstrdup(ntop);
281} 286}
282 287
283char * 288char *
@@ -390,8 +395,8 @@ get_sock_port(int sock, int local)
390 if (from.ss_family == AF_INET6) 395 if (from.ss_family == AF_INET6)
391 fromlen = sizeof(struct sockaddr_in6); 396 fromlen = sizeof(struct sockaddr_in6);
392 397
393 /* Unix domain sockets don't have a port number. */ 398 /* Non-inet sockets don't have a port number. */
394 if (from.ss_family == AF_UNIX) 399 if (from.ss_family != AF_INET && from.ss_family != AF_INET6)
395 return 0; 400 return 0;
396 401
397 /* Return port number. */ 402 /* Return port number. */
diff --git a/channels.c b/channels.c
index d67fdf48b..9486c1cff 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.336 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: channels.c,v 1.341 2015/02/06 23:21:59 millert Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -42,6 +42,7 @@
42#include "includes.h" 42#include "includes.h"
43 43
44#include <sys/types.h> 44#include <sys/types.h>
45#include <sys/param.h> /* MIN MAX */
45#include <sys/stat.h> 46#include <sys/stat.h>
46#include <sys/ioctl.h> 47#include <sys/ioctl.h>
47#include <sys/un.h> 48#include <sys/un.h>
@@ -56,6 +57,9 @@
56#include <errno.h> 57#include <errno.h>
57#include <fcntl.h> 58#include <fcntl.h>
58#include <netdb.h> 59#include <netdb.h>
60#ifdef HAVE_STDINT_H
61#include <stdint.h>
62#endif
59#include <stdio.h> 63#include <stdio.h>
60#include <stdlib.h> 64#include <stdlib.h>
61#include <string.h> 65#include <string.h>
@@ -669,7 +673,7 @@ channel_open_message(void)
669 } 673 }
670 } 674 }
671 buffer_append(&buffer, "\0", 1); 675 buffer_append(&buffer, "\0", 1);
672 cp = xstrdup(buffer_ptr(&buffer)); 676 cp = xstrdup((char *)buffer_ptr(&buffer));
673 buffer_free(&buffer); 677 buffer_free(&buffer);
674 return cp; 678 return cp;
675} 679}
@@ -1055,7 +1059,7 @@ channel_decode_socks4(Channel *c, fd_set *readset, fd_set *writeset)
1055 len = sizeof(s4_req); 1059 len = sizeof(s4_req);
1056 if (have < len) 1060 if (have < len)
1057 return 0; 1061 return 0;
1058 p = buffer_ptr(&c->input); 1062 p = (char *)buffer_ptr(&c->input);
1059 1063
1060 need = 1; 1064 need = 1;
1061 /* SOCKS4A uses an invalid IP address 0.0.0.x */ 1065 /* SOCKS4A uses an invalid IP address 0.0.0.x */
@@ -1085,7 +1089,7 @@ channel_decode_socks4(Channel *c, fd_set *readset, fd_set *writeset)
1085 buffer_get(&c->input, (char *)&s4_req.dest_port, 2); 1089 buffer_get(&c->input, (char *)&s4_req.dest_port, 2);
1086 buffer_get(&c->input, (char *)&s4_req.dest_addr, 4); 1090 buffer_get(&c->input, (char *)&s4_req.dest_addr, 4);
1087 have = buffer_len(&c->input); 1091 have = buffer_len(&c->input);
1088 p = buffer_ptr(&c->input); 1092 p = (char *)buffer_ptr(&c->input);
1089 if (memchr(p, '\0', have) == NULL) 1093 if (memchr(p, '\0', have) == NULL)
1090 fatal("channel %d: decode socks4: user not nul terminated", 1094 fatal("channel %d: decode socks4: user not nul terminated",
1091 c->self); 1095 c->self);
@@ -1105,7 +1109,7 @@ channel_decode_socks4(Channel *c, fd_set *readset, fd_set *writeset)
1105 c->path = xstrdup(host); 1109 c->path = xstrdup(host);
1106 } else { /* SOCKS4A: two strings */ 1110 } else { /* SOCKS4A: two strings */
1107 have = buffer_len(&c->input); 1111 have = buffer_len(&c->input);
1108 p = buffer_ptr(&c->input); 1112 p = (char *)buffer_ptr(&c->input);
1109 len = strlen(p); 1113 len = strlen(p);
1110 debug2("channel %d: decode socks4a: host %s/%d", 1114 debug2("channel %d: decode socks4a: host %s/%d",
1111 c->self, p, len); 1115 c->self, p, len);
@@ -2182,7 +2186,7 @@ channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
2182 2186
2183 nfdset = howmany(n+1, NFDBITS); 2187 nfdset = howmany(n+1, NFDBITS);
2184 /* Explicitly test here, because xrealloc isn't always called */ 2188 /* Explicitly test here, because xrealloc isn't always called */
2185 if (nfdset && SIZE_T_MAX / nfdset < sizeof(fd_mask)) 2189 if (nfdset && SIZE_MAX / nfdset < sizeof(fd_mask))
2186 fatal("channel_prepare_select: max_fd (%d) is too large", n); 2190 fatal("channel_prepare_select: max_fd (%d) is too large", n);
2187 sz = nfdset * sizeof(fd_mask); 2191 sz = nfdset * sizeof(fd_mask);
2188 2192
@@ -2342,7 +2346,7 @@ channel_output_poll(void)
2342/* -- protocol input */ 2346/* -- protocol input */
2343 2347
2344/* ARGSUSED */ 2348/* ARGSUSED */
2345void 2349int
2346channel_input_data(int type, u_int32_t seq, void *ctxt) 2350channel_input_data(int type, u_int32_t seq, void *ctxt)
2347{ 2351{
2348 int id; 2352 int id;
@@ -2359,7 +2363,7 @@ channel_input_data(int type, u_int32_t seq, void *ctxt)
2359 /* Ignore any data for non-open channels (might happen on close) */ 2363 /* Ignore any data for non-open channels (might happen on close) */
2360 if (c->type != SSH_CHANNEL_OPEN && 2364 if (c->type != SSH_CHANNEL_OPEN &&
2361 c->type != SSH_CHANNEL_X11_OPEN) 2365 c->type != SSH_CHANNEL_X11_OPEN)
2362 return; 2366 return 0;
2363 2367
2364 /* Get the data. */ 2368 /* Get the data. */
2365 data = packet_get_string_ptr(&data_len); 2369 data = packet_get_string_ptr(&data_len);
@@ -2379,7 +2383,7 @@ channel_input_data(int type, u_int32_t seq, void *ctxt)
2379 c->local_window -= win_len; 2383 c->local_window -= win_len;
2380 c->local_consumed += win_len; 2384 c->local_consumed += win_len;
2381 } 2385 }
2382 return; 2386 return 0;
2383 } 2387 }
2384 2388
2385 if (compat20) { 2389 if (compat20) {
@@ -2390,7 +2394,7 @@ channel_input_data(int type, u_int32_t seq, void *ctxt)
2390 if (win_len > c->local_window) { 2394 if (win_len > c->local_window) {
2391 logit("channel %d: rcvd too much data %d, win %d", 2395 logit("channel %d: rcvd too much data %d, win %d",
2392 c->self, win_len, c->local_window); 2396 c->self, win_len, c->local_window);
2393 return; 2397 return 0;
2394 } 2398 }
2395 c->local_window -= win_len; 2399 c->local_window -= win_len;
2396 } 2400 }
@@ -2399,10 +2403,11 @@ channel_input_data(int type, u_int32_t seq, void *ctxt)
2399 else 2403 else
2400 buffer_append(&c->output, data, data_len); 2404 buffer_append(&c->output, data, data_len);
2401 packet_check_eom(); 2405 packet_check_eom();
2406 return 0;
2402} 2407}
2403 2408
2404/* ARGSUSED */ 2409/* ARGSUSED */
2405void 2410int
2406channel_input_extended_data(int type, u_int32_t seq, void *ctxt) 2411channel_input_extended_data(int type, u_int32_t seq, void *ctxt)
2407{ 2412{
2408 int id; 2413 int id;
@@ -2418,7 +2423,7 @@ channel_input_extended_data(int type, u_int32_t seq, void *ctxt)
2418 packet_disconnect("Received extended_data for bad channel %d.", id); 2423 packet_disconnect("Received extended_data for bad channel %d.", id);
2419 if (c->type != SSH_CHANNEL_OPEN) { 2424 if (c->type != SSH_CHANNEL_OPEN) {
2420 logit("channel %d: ext data for non open", id); 2425 logit("channel %d: ext data for non open", id);
2421 return; 2426 return 0;
2422 } 2427 }
2423 if (c->flags & CHAN_EOF_RCVD) { 2428 if (c->flags & CHAN_EOF_RCVD) {
2424 if (datafellows & SSH_BUG_EXTEOF) 2429 if (datafellows & SSH_BUG_EXTEOF)
@@ -2432,7 +2437,7 @@ channel_input_extended_data(int type, u_int32_t seq, void *ctxt)
2432 c->extended_usage != CHAN_EXTENDED_WRITE || 2437 c->extended_usage != CHAN_EXTENDED_WRITE ||
2433 tcode != SSH2_EXTENDED_DATA_STDERR) { 2438 tcode != SSH2_EXTENDED_DATA_STDERR) {
2434 logit("channel %d: bad ext data", c->self); 2439 logit("channel %d: bad ext data", c->self);
2435 return; 2440 return 0;
2436 } 2441 }
2437 data = packet_get_string(&data_len); 2442 data = packet_get_string(&data_len);
2438 packet_check_eom(); 2443 packet_check_eom();
@@ -2440,16 +2445,17 @@ channel_input_extended_data(int type, u_int32_t seq, void *ctxt)
2440 logit("channel %d: rcvd too much extended_data %d, win %d", 2445 logit("channel %d: rcvd too much extended_data %d, win %d",
2441 c->self, data_len, c->local_window); 2446 c->self, data_len, c->local_window);
2442 free(data); 2447 free(data);
2443 return; 2448 return 0;
2444 } 2449 }
2445 debug2("channel %d: rcvd ext data %d", c->self, data_len); 2450 debug2("channel %d: rcvd ext data %d", c->self, data_len);
2446 c->local_window -= data_len; 2451 c->local_window -= data_len;
2447 buffer_append(&c->extended, data, data_len); 2452 buffer_append(&c->extended, data, data_len);
2448 free(data); 2453 free(data);
2454 return 0;
2449} 2455}
2450 2456
2451/* ARGSUSED */ 2457/* ARGSUSED */
2452void 2458int
2453channel_input_ieof(int type, u_int32_t seq, void *ctxt) 2459channel_input_ieof(int type, u_int32_t seq, void *ctxt)
2454{ 2460{
2455 int id; 2461 int id;
@@ -2469,11 +2475,11 @@ channel_input_ieof(int type, u_int32_t seq, void *ctxt)
2469 if (buffer_len(&c->input) == 0) 2475 if (buffer_len(&c->input) == 0)
2470 chan_ibuf_empty(c); 2476 chan_ibuf_empty(c);
2471 } 2477 }
2472 2478 return 0;
2473} 2479}
2474 2480
2475/* ARGSUSED */ 2481/* ARGSUSED */
2476void 2482int
2477channel_input_close(int type, u_int32_t seq, void *ctxt) 2483channel_input_close(int type, u_int32_t seq, void *ctxt)
2478{ 2484{
2479 int id; 2485 int id;
@@ -2508,11 +2514,12 @@ channel_input_close(int type, u_int32_t seq, void *ctxt)
2508 buffer_clear(&c->input); 2514 buffer_clear(&c->input);
2509 c->type = SSH_CHANNEL_OUTPUT_DRAINING; 2515 c->type = SSH_CHANNEL_OUTPUT_DRAINING;
2510 } 2516 }
2517 return 0;
2511} 2518}
2512 2519
2513/* proto version 1.5 overloads CLOSE_CONFIRMATION with OCLOSE */ 2520/* proto version 1.5 overloads CLOSE_CONFIRMATION with OCLOSE */
2514/* ARGSUSED */ 2521/* ARGSUSED */
2515void 2522int
2516channel_input_oclose(int type, u_int32_t seq, void *ctxt) 2523channel_input_oclose(int type, u_int32_t seq, void *ctxt)
2517{ 2524{
2518 int id = packet_get_int(); 2525 int id = packet_get_int();
@@ -2522,10 +2529,11 @@ channel_input_oclose(int type, u_int32_t seq, void *ctxt)
2522 if (c == NULL) 2529 if (c == NULL)
2523 packet_disconnect("Received oclose for nonexistent channel %d.", id); 2530 packet_disconnect("Received oclose for nonexistent channel %d.", id);
2524 chan_rcvd_oclose(c); 2531 chan_rcvd_oclose(c);
2532 return 0;
2525} 2533}
2526 2534
2527/* ARGSUSED */ 2535/* ARGSUSED */
2528void 2536int
2529channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt) 2537channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt)
2530{ 2538{
2531 int id = packet_get_int(); 2539 int id = packet_get_int();
@@ -2539,10 +2547,11 @@ channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt)
2539 packet_disconnect("Received close confirmation for " 2547 packet_disconnect("Received close confirmation for "
2540 "non-closed channel %d (type %d).", id, c->type); 2548 "non-closed channel %d (type %d).", id, c->type);
2541 channel_free(c); 2549 channel_free(c);
2550 return 0;
2542} 2551}
2543 2552
2544/* ARGSUSED */ 2553/* ARGSUSED */
2545void 2554int
2546channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) 2555channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt)
2547{ 2556{
2548 int id, remote_id; 2557 int id, remote_id;
@@ -2571,6 +2580,7 @@ channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt)
2571 c->remote_window, c->remote_maxpacket); 2580 c->remote_window, c->remote_maxpacket);
2572 } 2581 }
2573 packet_check_eom(); 2582 packet_check_eom();
2583 return 0;
2574} 2584}
2575 2585
2576static char * 2586static char *
@@ -2590,7 +2600,7 @@ reason2txt(int reason)
2590} 2600}
2591 2601
2592/* ARGSUSED */ 2602/* ARGSUSED */
2593void 2603int
2594channel_input_open_failure(int type, u_int32_t seq, void *ctxt) 2604channel_input_open_failure(int type, u_int32_t seq, void *ctxt)
2595{ 2605{
2596 int id, reason; 2606 int id, reason;
@@ -2622,10 +2632,11 @@ channel_input_open_failure(int type, u_int32_t seq, void *ctxt)
2622 packet_check_eom(); 2632 packet_check_eom();
2623 /* Schedule the channel for cleanup/deletion. */ 2633 /* Schedule the channel for cleanup/deletion. */
2624 chan_mark_dead(c); 2634 chan_mark_dead(c);
2635 return 0;
2625} 2636}
2626 2637
2627/* ARGSUSED */ 2638/* ARGSUSED */
2628void 2639int
2629channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) 2640channel_input_window_adjust(int type, u_int32_t seq, void *ctxt)
2630{ 2641{
2631 Channel *c; 2642 Channel *c;
@@ -2633,7 +2644,7 @@ channel_input_window_adjust(int type, u_int32_t seq, void *ctxt)
2633 u_int adjust; 2644 u_int adjust;
2634 2645
2635 if (!compat20) 2646 if (!compat20)
2636 return; 2647 return 0;
2637 2648
2638 /* Get the channel number and verify it. */ 2649 /* Get the channel number and verify it. */
2639 id = packet_get_int(); 2650 id = packet_get_int();
@@ -2641,16 +2652,17 @@ channel_input_window_adjust(int type, u_int32_t seq, void *ctxt)
2641 2652
2642 if (c == NULL) { 2653 if (c == NULL) {
2643 logit("Received window adjust for non-open channel %d.", id); 2654 logit("Received window adjust for non-open channel %d.", id);
2644 return; 2655 return 0;
2645 } 2656 }
2646 adjust = packet_get_int(); 2657 adjust = packet_get_int();
2647 packet_check_eom(); 2658 packet_check_eom();
2648 debug2("channel %d: rcvd adjust %u", id, adjust); 2659 debug2("channel %d: rcvd adjust %u", id, adjust);
2649 c->remote_window += adjust; 2660 c->remote_window += adjust;
2661 return 0;
2650} 2662}
2651 2663
2652/* ARGSUSED */ 2664/* ARGSUSED */
2653void 2665int
2654channel_input_port_open(int type, u_int32_t seq, void *ctxt) 2666channel_input_port_open(int type, u_int32_t seq, void *ctxt)
2655{ 2667{
2656 Channel *c = NULL; 2668 Channel *c = NULL;
@@ -2678,10 +2690,11 @@ channel_input_port_open(int type, u_int32_t seq, void *ctxt)
2678 packet_send(); 2690 packet_send();
2679 } else 2691 } else
2680 c->remote_id = remote_id; 2692 c->remote_id = remote_id;
2693 return 0;
2681} 2694}
2682 2695
2683/* ARGSUSED */ 2696/* ARGSUSED */
2684void 2697int
2685channel_input_status_confirm(int type, u_int32_t seq, void *ctxt) 2698channel_input_status_confirm(int type, u_int32_t seq, void *ctxt)
2686{ 2699{
2687 Channel *c; 2700 Channel *c;
@@ -2698,15 +2711,15 @@ channel_input_status_confirm(int type, u_int32_t seq, void *ctxt)
2698 2711
2699 if ((c = channel_lookup(id)) == NULL) { 2712 if ((c = channel_lookup(id)) == NULL) {
2700 logit("channel_input_status_confirm: %d: unknown", id); 2713 logit("channel_input_status_confirm: %d: unknown", id);
2701 return; 2714 return 0;
2702 } 2715 }
2703 ;
2704 if ((cc = TAILQ_FIRST(&c->status_confirms)) == NULL) 2716 if ((cc = TAILQ_FIRST(&c->status_confirms)) == NULL)
2705 return; 2717 return 0;
2706 cc->cb(type, c, cc->ctx); 2718 cc->cb(type, c, cc->ctx);
2707 TAILQ_REMOVE(&c->status_confirms, cc, entry); 2719 TAILQ_REMOVE(&c->status_confirms, cc, entry);
2708 explicit_bzero(cc, sizeof(*cc)); 2720 explicit_bzero(cc, sizeof(*cc));
2709 free(cc); 2721 free(cc);
2722 return 0;
2710} 2723}
2711 2724
2712/* -- tcp forwarding */ 2725/* -- tcp forwarding */
@@ -4094,7 +4107,7 @@ x11_connect_display(void)
4094 */ 4107 */
4095 4108
4096/* ARGSUSED */ 4109/* ARGSUSED */
4097void 4110int
4098x11_input_open(int type, u_int32_t seq, void *ctxt) 4111x11_input_open(int type, u_int32_t seq, void *ctxt)
4099{ 4112{
4100 Channel *c = NULL; 4113 Channel *c = NULL;
@@ -4134,11 +4147,12 @@ x11_input_open(int type, u_int32_t seq, void *ctxt)
4134 packet_put_int(c->self); 4147 packet_put_int(c->self);
4135 } 4148 }
4136 packet_send(); 4149 packet_send();
4150 return 0;
4137} 4151}
4138 4152
4139/* dummy protocol handler that denies SSH-1 requests (agent/x11) */ 4153/* dummy protocol handler that denies SSH-1 requests (agent/x11) */
4140/* ARGSUSED */ 4154/* ARGSUSED */
4141void 4155int
4142deny_input_open(int type, u_int32_t seq, void *ctxt) 4156deny_input_open(int type, u_int32_t seq, void *ctxt)
4143{ 4157{
4144 int rchan = packet_get_int(); 4158 int rchan = packet_get_int();
@@ -4158,6 +4172,7 @@ deny_input_open(int type, u_int32_t seq, void *ctxt)
4158 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); 4172 packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE);
4159 packet_put_int(rchan); 4173 packet_put_int(rchan);
4160 packet_send(); 4174 packet_send();
4175 return 0;
4161} 4176}
4162 4177
4163/* 4178/*
diff --git a/channels.h b/channels.h
index a000c98e5..5a672f22e 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.h,v 1.115 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: channels.h,v 1.116 2015/01/19 20:07:45 markus Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -230,17 +230,17 @@ void channel_send_window_changes(void);
230 230
231/* protocol handler */ 231/* protocol handler */
232 232
233void channel_input_close(int, u_int32_t, void *); 233int channel_input_close(int, u_int32_t, void *);
234void channel_input_close_confirmation(int, u_int32_t, void *); 234int channel_input_close_confirmation(int, u_int32_t, void *);
235void channel_input_data(int, u_int32_t, void *); 235int channel_input_data(int, u_int32_t, void *);
236void channel_input_extended_data(int, u_int32_t, void *); 236int channel_input_extended_data(int, u_int32_t, void *);
237void channel_input_ieof(int, u_int32_t, void *); 237int channel_input_ieof(int, u_int32_t, void *);
238void channel_input_oclose(int, u_int32_t, void *); 238int channel_input_oclose(int, u_int32_t, void *);
239void channel_input_open_confirmation(int, u_int32_t, void *); 239int channel_input_open_confirmation(int, u_int32_t, void *);
240void channel_input_open_failure(int, u_int32_t, void *); 240int channel_input_open_failure(int, u_int32_t, void *);
241void channel_input_port_open(int, u_int32_t, void *); 241int channel_input_port_open(int, u_int32_t, void *);
242void channel_input_window_adjust(int, u_int32_t, void *); 242int channel_input_window_adjust(int, u_int32_t, void *);
243void channel_input_status_confirm(int, u_int32_t, void *); 243int channel_input_status_confirm(int, u_int32_t, void *);
244 244
245/* file descriptor handling (read/write) */ 245/* file descriptor handling (read/write) */
246 246
@@ -286,10 +286,10 @@ int permitopen_port(const char *);
286 286
287int x11_connect_display(void); 287int x11_connect_display(void);
288int x11_create_display_inet(int, int, int, u_int *, int **); 288int x11_create_display_inet(int, int, int, u_int *, int **);
289void x11_input_open(int, u_int32_t, void *); 289int x11_input_open(int, u_int32_t, void *);
290void x11_request_forwarding_with_spoofing(int, const char *, const char *, 290void x11_request_forwarding_with_spoofing(int, const char *, const char *,
291 const char *, int); 291 const char *, int);
292void deny_input_open(int, u_int32_t, void *); 292int deny_input_open(int, u_int32_t, void *);
293 293
294/* agent forwarding */ 294/* agent forwarding */
295 295
diff --git a/cipher-3des1.c b/cipher-3des1.c
index 2753f9a0e..6a0f1f37b 100644
--- a/cipher-3des1.c
+++ b/cipher-3des1.c
@@ -1,15 +1,10 @@
1/* $OpenBSD: cipher-3des1.c,v 1.11 2014/07/02 04:59:06 djm Exp $ */ 1/* $OpenBSD: cipher-3des1.c,v 1.12 2015/01/14 10:24:42 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2003 Markus Friedl. All rights reserved. 3 * Copyright (c) 2003 Markus Friedl. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Permission to use, copy, modify, and distribute this software for any
6 * modification, are permitted provided that the following conditions 6 * purpose with or without fee is hereby granted, provided that the above
7 * are met: 7 * copyright notice and this permission notice appear in all copies.
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 8 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 9 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 10 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -26,13 +21,9 @@
26#include "includes.h" 21#include "includes.h"
27 22
28#include <sys/types.h> 23#include <sys/types.h>
29
30#include <openssl/evp.h>
31
32#include <string.h> 24#include <string.h>
25#include <openssl/evp.h>
33 26
34#include "xmalloc.h"
35#include "log.h"
36#include "ssherr.h" 27#include "ssherr.h"
37 28
38/* 29/*
@@ -151,7 +142,7 @@ evp_ssh1_3des(void)
151{ 142{
152 static EVP_CIPHER ssh1_3des; 143 static EVP_CIPHER ssh1_3des;
153 144
154 memset(&ssh1_3des, 0, sizeof(EVP_CIPHER)); 145 memset(&ssh1_3des, 0, sizeof(ssh1_3des));
155 ssh1_3des.nid = NID_undef; 146 ssh1_3des.nid = NID_undef;
156 ssh1_3des.block_size = 8; 147 ssh1_3des.block_size = 8;
157 ssh1_3des.iv_len = 0; 148 ssh1_3des.iv_len = 0;
diff --git a/cipher-aesctr.c b/cipher-aesctr.c
index a4cf61e41..eed95c3e6 100644
--- a/cipher-aesctr.c
+++ b/cipher-aesctr.c
@@ -1,6 +1,6 @@
1/* $OpenBSD: cipher-aesctr.c,v 1.1 2014/04/29 15:39:33 markus Exp $ */ 1/* $OpenBSD: cipher-aesctr.c,v 1.2 2015/01/14 10:24:42 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2003 Markus Friedl <markus@openbsd.org> 3 * Copyright (c) 2003 Markus Friedl. All rights reserved.
4 * 4 *
5 * Permission to use, copy, modify, and distribute this software for any 5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above 6 * purpose with or without fee is hereby granted, provided that the above
@@ -15,9 +15,13 @@
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 16 */
17 17
18#include "includes.h"
19
18#include <sys/types.h> 20#include <sys/types.h>
19#include <string.h> 21#include <string.h>
20 22
23#ifndef WITH_OPENSSL
24
21#include "cipher-aesctr.h" 25#include "cipher-aesctr.h"
22 26
23/* 27/*
@@ -25,7 +29,7 @@
25 * the counter is of size 'len' bytes and stored in network-byte-order. 29 * the counter is of size 'len' bytes and stored in network-byte-order.
26 * (LSB at ctr[len-1], MSB at ctr[0]) 30 * (LSB at ctr[len-1], MSB at ctr[0])
27 */ 31 */
28static __inline__ void 32static inline void
29aesctr_inc(u8 *ctr, u32 len) 33aesctr_inc(u8 *ctr, u32 len)
30{ 34{
31 ssize_t i; 35 ssize_t i;
@@ -76,3 +80,4 @@ aesctr_encrypt_bytes(aesctr_ctx *x,const u8 *m,u8 *c,u32 bytes)
76 n = (n + 1) % AES_BLOCK_SIZE; 80 n = (n + 1) % AES_BLOCK_SIZE;
77 } 81 }
78} 82}
83#endif /* !WITH_OPENSSL */
diff --git a/cipher-bf1.c b/cipher-bf1.c
index 309509dd7..ee72ac085 100644
--- a/cipher-bf1.c
+++ b/cipher-bf1.c
@@ -1,15 +1,10 @@
1/* $OpenBSD: cipher-bf1.c,v 1.6 2010/10/01 23:05:32 djm Exp $ */ 1/* $OpenBSD: cipher-bf1.c,v 1.7 2015/01/14 10:24:42 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2003 Markus Friedl. All rights reserved. 3 * Copyright (c) 2003 Markus Friedl. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Permission to use, copy, modify, and distribute this software for any
6 * modification, are permitted provided that the following conditions 6 * purpose with or without fee is hereby granted, provided that the above
7 * are met: 7 * copyright notice and this permission notice appear in all copies.
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 8 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 9 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 10 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -25,15 +20,14 @@
25 20
26#include "includes.h" 21#include "includes.h"
27 22
28#include <sys/types.h> 23#ifdef WITH_OPENSSL
29 24
30#include <openssl/evp.h> 25#include <sys/types.h>
31 26
32#include <stdarg.h> 27#include <stdarg.h>
33#include <string.h> 28#include <string.h>
34 29
35#include "xmalloc.h" 30#include <openssl/evp.h>
36#include "log.h"
37 31
38#include "openbsd-compat/openssl-compat.h" 32#include "openbsd-compat/openssl-compat.h"
39 33
@@ -106,3 +100,4 @@ evp_ssh1_bf(void)
106 ssh1_bf.key_len = 32; 100 ssh1_bf.key_len = 32;
107 return (&ssh1_bf); 101 return (&ssh1_bf);
108} 102}
103#endif /* WITH_OPENSSL */
diff --git a/cipher-chachapoly.c b/cipher-chachapoly.c
index 8665b41a3..7f31ff4ce 100644
--- a/cipher-chachapoly.c
+++ b/cipher-chachapoly.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17/* $OpenBSD: cipher-chachapoly.c,v 1.6 2014/07/03 12:42:16 jsing Exp $ */ 17/* $OpenBSD: cipher-chachapoly.c,v 1.7 2015/01/14 10:24:42 markus Exp $ */
18 18
19#include "includes.h" 19#include "includes.h"
20 20
@@ -116,4 +116,3 @@ chachapoly_get_length(struct chachapoly_ctx *ctx,
116 *plenp = PEEK_U32(buf); 116 *plenp = PEEK_U32(buf);
117 return 0; 117 return 0;
118} 118}
119
diff --git a/cipher-ctr.c b/cipher-ctr.c
index ea0f9b3b7..32771f287 100644
--- a/cipher-ctr.c
+++ b/cipher-ctr.c
@@ -16,7 +16,7 @@
16 */ 16 */
17#include "includes.h" 17#include "includes.h"
18 18
19#ifndef OPENSSL_HAVE_EVPCTR 19#if defined(WITH_OPENSSL) && !defined(OPENSSL_HAVE_EVPCTR)
20#include <sys/types.h> 20#include <sys/types.h>
21 21
22#include <stdarg.h> 22#include <stdarg.h>
@@ -143,4 +143,4 @@ evp_aes_128_ctr(void)
143 return (&aes_ctr); 143 return (&aes_ctr);
144} 144}
145 145
146#endif /* OPENSSL_HAVE_EVPCTR */ 146#endif /* defined(WITH_OPENSSL) && !defined(OPENSSL_HAVE_EVPCTR) */
diff --git a/cipher.c b/cipher.c
index 638ca2d97..02dae6f9f 100644
--- a/cipher.c
+++ b/cipher.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cipher.c,v 1.99 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: cipher.c,v 1.100 2015/01/14 10:29:45 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -512,6 +512,8 @@ cipher_get_keyiv_len(const struct sshcipher_ctx *cc)
512 ivlen = 24; 512 ivlen = 24;
513 else if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) 513 else if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0)
514 ivlen = 0; 514 ivlen = 0;
515 else if ((cc->cipher->flags & CFLAG_AESCTR) != 0)
516 ivlen = sizeof(cc->ac_ctx.ctr);
515#ifdef WITH_OPENSSL 517#ifdef WITH_OPENSSL
516 else 518 else
517 ivlen = EVP_CIPHER_CTX_iv_length(&cc->evp); 519 ivlen = EVP_CIPHER_CTX_iv_length(&cc->evp);
@@ -532,6 +534,12 @@ cipher_get_keyiv(struct sshcipher_ctx *cc, u_char *iv, u_int len)
532 return SSH_ERR_INVALID_ARGUMENT; 534 return SSH_ERR_INVALID_ARGUMENT;
533 return 0; 535 return 0;
534 } 536 }
537 if ((cc->cipher->flags & CFLAG_AESCTR) != 0) {
538 if (len != sizeof(cc->ac_ctx.ctr))
539 return SSH_ERR_INVALID_ARGUMENT;
540 memcpy(iv, cc->ac_ctx.ctr, len);
541 return 0;
542 }
535 if ((cc->cipher->flags & CFLAG_NONE) != 0) 543 if ((cc->cipher->flags & CFLAG_NONE) != 0)
536 return 0; 544 return 0;
537 545
diff --git a/cipher.h b/cipher.h
index de74c1e3b..62a88b42e 100644
--- a/cipher.h
+++ b/cipher.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: cipher.h,v 1.46 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: cipher.h,v 1.47 2015/01/14 10:24:42 markus Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -72,19 +72,19 @@ struct sshcipher_ctx {
72 const struct sshcipher *cipher; 72 const struct sshcipher *cipher;
73}; 73};
74 74
75typedef struct sshcipher Cipher ; 75typedef struct sshcipher Cipher;
76typedef struct sshcipher_ctx CipherContext ; 76typedef struct sshcipher_ctx CipherContext;
77 77
78u_int cipher_mask_ssh1(int); 78u_int cipher_mask_ssh1(int);
79const struct sshcipher *cipher_by_name(const char *); 79const struct sshcipher *cipher_by_name(const char *);
80const struct sshcipher *cipher_by_number(int); 80const struct sshcipher *cipher_by_number(int);
81int cipher_number(const char *); 81int cipher_number(const char *);
82char *cipher_name(int); 82char *cipher_name(int);
83const char *cipher_warning_message(const struct sshcipher_ctx *);
83int ciphers_valid(const char *); 84int ciphers_valid(const char *);
84char *cipher_alg_list(char, int); 85char *cipher_alg_list(char, int);
85int cipher_init(struct sshcipher_ctx *, const struct sshcipher *, 86int cipher_init(struct sshcipher_ctx *, const struct sshcipher *,
86 const u_char *, u_int, const u_char *, u_int, int); 87 const u_char *, u_int, const u_char *, u_int, int);
87const char* cipher_warning_message(const struct sshcipher_ctx *);
88int cipher_crypt(struct sshcipher_ctx *, u_int, u_char *, const u_char *, 88int cipher_crypt(struct sshcipher_ctx *, u_int, u_char *, const u_char *,
89 u_int, u_int, u_int); 89 u_int, u_int, u_int);
90int cipher_get_length(struct sshcipher_ctx *, u_int *, u_int, 90int cipher_get_length(struct sshcipher_ctx *, u_int *, u_int,
diff --git a/clientloop.c b/clientloop.c
index 397c96532..a9c8a90f0 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.261 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.272 2015/02/25 19:54:02 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -61,9 +61,9 @@
61 61
62#include "includes.h" 62#include "includes.h"
63 63
64#include <sys/param.h> /* MIN MAX */
64#include <sys/types.h> 65#include <sys/types.h>
65#include <sys/ioctl.h> 66#include <sys/ioctl.h>
66#include <sys/param.h>
67#ifdef HAVE_SYS_STAT_H 67#ifdef HAVE_SYS_STAT_H
68# include <sys/stat.h> 68# include <sys/stat.h>
69#endif 69#endif
@@ -85,6 +85,7 @@
85#include <termios.h> 85#include <termios.h>
86#include <pwd.h> 86#include <pwd.h>
87#include <unistd.h> 87#include <unistd.h>
88#include <limits.h>
88 89
89#include "openbsd-compat/sys-queue.h" 90#include "openbsd-compat/sys-queue.h"
90#include "xmalloc.h" 91#include "xmalloc.h"
@@ -110,6 +111,8 @@
110#include "match.h" 111#include "match.h"
111#include "msg.h" 112#include "msg.h"
112#include "roaming.h" 113#include "roaming.h"
114#include "ssherr.h"
115#include "hostfile.h"
113 116
114/* import options */ 117/* import options */
115extern Options options; 118extern Options options;
@@ -191,9 +194,6 @@ TAILQ_HEAD(global_confirms, global_confirm);
191static struct global_confirms global_confirms = 194static struct global_confirms global_confirms =
192 TAILQ_HEAD_INITIALIZER(global_confirms); 195 TAILQ_HEAD_INITIALIZER(global_confirms);
193 196
194/*XXX*/
195extern Kex *xxx_kex;
196
197void ssh_process_session2_setup(int, int, int, Buffer *); 197void ssh_process_session2_setup(int, int, int, Buffer *);
198 198
199/* Restores stdin to blocking mode. */ 199/* Restores stdin to blocking mode. */
@@ -341,12 +341,12 @@ client_x11_get_proto(const char *display, const char *xauth_path,
341 display = xdisplay; 341 display = xdisplay;
342 } 342 }
343 if (trusted == 0) { 343 if (trusted == 0) {
344 xauthdir = xmalloc(MAXPATHLEN); 344 xauthdir = xmalloc(PATH_MAX);
345 xauthfile = xmalloc(MAXPATHLEN); 345 xauthfile = xmalloc(PATH_MAX);
346 mktemp_proto(xauthdir, MAXPATHLEN); 346 mktemp_proto(xauthdir, PATH_MAX);
347 if (mkdtemp(xauthdir) != NULL) { 347 if (mkdtemp(xauthdir) != NULL) {
348 do_unlink = 1; 348 do_unlink = 1;
349 snprintf(xauthfile, MAXPATHLEN, "%s/xauthfile", 349 snprintf(xauthfile, PATH_MAX, "%s/xauthfile",
350 xauthdir); 350 xauthdir);
351 snprintf(cmd, sizeof(cmd), 351 snprintf(cmd, sizeof(cmd),
352 "%s -f %s generate %s " SSH_X11_PROTO 352 "%s -f %s generate %s " SSH_X11_PROTO
@@ -538,13 +538,13 @@ client_check_window_change(void)
538 } 538 }
539} 539}
540 540
541static void 541static int
542client_global_request_reply(int type, u_int32_t seq, void *ctxt) 542client_global_request_reply(int type, u_int32_t seq, void *ctxt)
543{ 543{
544 struct global_confirm *gc; 544 struct global_confirm *gc;
545 545
546 if ((gc = TAILQ_FIRST(&global_confirms)) == NULL) 546 if ((gc = TAILQ_FIRST(&global_confirms)) == NULL)
547 return; 547 return 0;
548 if (gc->cb != NULL) 548 if (gc->cb != NULL)
549 gc->cb(type, seq, gc->ctx); 549 gc->cb(type, seq, gc->ctx);
550 if (--gc->ref_count <= 0) { 550 if (--gc->ref_count <= 0) {
@@ -554,6 +554,7 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt)
554 } 554 }
555 555
556 packet_set_alive_timeouts(0); 556 packet_set_alive_timeouts(0);
557 return 0;
557} 558}
558 559
559static void 560static void
@@ -1414,8 +1415,7 @@ client_process_output(fd_set *writeset)
1414static void 1415static void
1415client_process_buffered_input_packets(void) 1416client_process_buffered_input_packets(void)
1416{ 1417{
1417 dispatch_run(DISPATCH_NONBLOCK, &quit_pending, 1418 dispatch_run(DISPATCH_NONBLOCK, &quit_pending, active_state);
1418 compat20 ? xxx_kex : NULL);
1419} 1419}
1420 1420
1421/* scan buf[] for '~' before sending data to the peer */ 1421/* scan buf[] for '~' before sending data to the peer */
@@ -1469,7 +1469,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1469{ 1469{
1470 fd_set *readset = NULL, *writeset = NULL; 1470 fd_set *readset = NULL, *writeset = NULL;
1471 double start_time, total_time; 1471 double start_time, total_time;
1472 int max_fd = 0, max_fd2 = 0, len, rekeying = 0; 1472 int r, max_fd = 0, max_fd2 = 0, len, rekeying = 0;
1473 u_int64_t ibytes, obytes; 1473 u_int64_t ibytes, obytes;
1474 u_int nalloc = 0; 1474 u_int nalloc = 0;
1475 char buf[100]; 1475 char buf[100];
@@ -1554,7 +1554,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1554 if (compat20 && session_closed && !channel_still_open()) 1554 if (compat20 && session_closed && !channel_still_open())
1555 break; 1555 break;
1556 1556
1557 rekeying = (xxx_kex != NULL && !xxx_kex->done); 1557 rekeying = (active_state->kex != NULL && !active_state->kex->done);
1558 1558
1559 if (rekeying) { 1559 if (rekeying) {
1560 debug("rekeying in progress"); 1560 debug("rekeying in progress");
@@ -1598,8 +1598,10 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1598 channel_after_select(readset, writeset); 1598 channel_after_select(readset, writeset);
1599 if (need_rekeying || packet_need_rekeying()) { 1599 if (need_rekeying || packet_need_rekeying()) {
1600 debug("need rekeying"); 1600 debug("need rekeying");
1601 xxx_kex->done = 0; 1601 active_state->kex->done = 0;
1602 kex_send_kexinit(xxx_kex); 1602 if ((r = kex_send_kexinit(active_state)) != 0)
1603 fatal("%s: kex_send_kexinit: %s",
1604 __func__, ssh_err(r));
1603 need_rekeying = 0; 1605 need_rekeying = 0;
1604 } 1606 }
1605 } 1607 }
@@ -1728,8 +1730,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1728 1730
1729 /* Report bytes transferred, and transfer rates. */ 1731 /* Report bytes transferred, and transfer rates. */
1730 total_time = get_current_time() - start_time; 1732 total_time = get_current_time() - start_time;
1731 packet_get_state(MODE_IN, NULL, NULL, NULL, &ibytes); 1733 packet_get_bytes(&ibytes, &obytes);
1732 packet_get_state(MODE_OUT, NULL, NULL, NULL, &obytes);
1733 verbose("Transferred: sent %llu, received %llu bytes, in %.1f seconds", 1734 verbose("Transferred: sent %llu, received %llu bytes, in %.1f seconds",
1734 (unsigned long long)obytes, (unsigned long long)ibytes, total_time); 1735 (unsigned long long)obytes, (unsigned long long)ibytes, total_time);
1735 if (total_time > 0) 1736 if (total_time > 0)
@@ -1742,7 +1743,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1742 1743
1743/*********/ 1744/*********/
1744 1745
1745static void 1746static int
1746client_input_stdout_data(int type, u_int32_t seq, void *ctxt) 1747client_input_stdout_data(int type, u_int32_t seq, void *ctxt)
1747{ 1748{
1748 u_int data_len; 1749 u_int data_len;
@@ -1751,8 +1752,9 @@ client_input_stdout_data(int type, u_int32_t seq, void *ctxt)
1751 buffer_append(&stdout_buffer, data, data_len); 1752 buffer_append(&stdout_buffer, data, data_len);
1752 explicit_bzero(data, data_len); 1753 explicit_bzero(data, data_len);
1753 free(data); 1754 free(data);
1755 return 0;
1754} 1756}
1755static void 1757static int
1756client_input_stderr_data(int type, u_int32_t seq, void *ctxt) 1758client_input_stderr_data(int type, u_int32_t seq, void *ctxt)
1757{ 1759{
1758 u_int data_len; 1760 u_int data_len;
@@ -1761,8 +1763,9 @@ client_input_stderr_data(int type, u_int32_t seq, void *ctxt)
1761 buffer_append(&stderr_buffer, data, data_len); 1763 buffer_append(&stderr_buffer, data, data_len);
1762 explicit_bzero(data, data_len); 1764 explicit_bzero(data, data_len);
1763 free(data); 1765 free(data);
1766 return 0;
1764} 1767}
1765static void 1768static int
1766client_input_exit_status(int type, u_int32_t seq, void *ctxt) 1769client_input_exit_status(int type, u_int32_t seq, void *ctxt)
1767{ 1770{
1768 exit_status = packet_get_int(); 1771 exit_status = packet_get_int();
@@ -1777,12 +1780,14 @@ client_input_exit_status(int type, u_int32_t seq, void *ctxt)
1777 packet_write_wait(); 1780 packet_write_wait();
1778 /* Flag that we want to exit. */ 1781 /* Flag that we want to exit. */
1779 quit_pending = 1; 1782 quit_pending = 1;
1783 return 0;
1780} 1784}
1781static void 1785
1786static int
1782client_input_agent_open(int type, u_int32_t seq, void *ctxt) 1787client_input_agent_open(int type, u_int32_t seq, void *ctxt)
1783{ 1788{
1784 Channel *c = NULL; 1789 Channel *c = NULL;
1785 int remote_id, sock; 1790 int r, remote_id, sock;
1786 1791
1787 /* Read the remote channel number from the message. */ 1792 /* Read the remote channel number from the message. */
1788 remote_id = packet_get_int(); 1793 remote_id = packet_get_int();
@@ -1792,7 +1797,11 @@ client_input_agent_open(int type, u_int32_t seq, void *ctxt)
1792 * Get a connection to the local authentication agent (this may again 1797 * Get a connection to the local authentication agent (this may again
1793 * get forwarded). 1798 * get forwarded).
1794 */ 1799 */
1795 sock = ssh_get_authentication_socket(); 1800 if ((r = ssh_get_authentication_socket(&sock)) != 0 &&
1801 r != SSH_ERR_AGENT_NOT_PRESENT)
1802 debug("%s: ssh_get_authentication_socket: %s",
1803 __func__, ssh_err(r));
1804
1796 1805
1797 /* 1806 /*
1798 * If we could not connect the agent, send an error message back to 1807 * If we could not connect the agent, send an error message back to
@@ -1817,6 +1826,7 @@ client_input_agent_open(int type, u_int32_t seq, void *ctxt)
1817 packet_put_int(c->self); 1826 packet_put_int(c->self);
1818 } 1827 }
1819 packet_send(); 1828 packet_send();
1829 return 0;
1820} 1830}
1821 1831
1822static Channel * 1832static Channel *
@@ -1910,7 +1920,7 @@ static Channel *
1910client_request_agent(const char *request_type, int rchan) 1920client_request_agent(const char *request_type, int rchan)
1911{ 1921{
1912 Channel *c = NULL; 1922 Channel *c = NULL;
1913 int sock; 1923 int r, sock;
1914 1924
1915 if (!options.forward_agent) { 1925 if (!options.forward_agent) {
1916 error("Warning: ssh server tried agent forwarding."); 1926 error("Warning: ssh server tried agent forwarding.");
@@ -1918,9 +1928,12 @@ client_request_agent(const char *request_type, int rchan)
1918 "malicious server."); 1928 "malicious server.");
1919 return NULL; 1929 return NULL;
1920 } 1930 }
1921 sock = ssh_get_authentication_socket(); 1931 if ((r = ssh_get_authentication_socket(&sock)) != 0) {
1922 if (sock < 0) 1932 if (r != SSH_ERR_AGENT_NOT_PRESENT)
1933 debug("%s: ssh_get_authentication_socket: %s",
1934 __func__, ssh_err(r));
1923 return NULL; 1935 return NULL;
1936 }
1924 c = channel_new("authentication agent connection", 1937 c = channel_new("authentication agent connection",
1925 SSH_CHANNEL_OPEN, sock, sock, -1, 1938 SSH_CHANNEL_OPEN, sock, sock, -1,
1926 CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, 1939 CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0,
@@ -1974,7 +1987,7 @@ client_request_tun_fwd(int tun_mode, int local_tun, int remote_tun)
1974} 1987}
1975 1988
1976/* XXXX move to generic input handler */ 1989/* XXXX move to generic input handler */
1977static void 1990static int
1978client_input_channel_open(int type, u_int32_t seq, void *ctxt) 1991client_input_channel_open(int type, u_int32_t seq, void *ctxt)
1979{ 1992{
1980 Channel *c = NULL; 1993 Channel *c = NULL;
@@ -2025,8 +2038,10 @@ client_input_channel_open(int type, u_int32_t seq, void *ctxt)
2025 packet_send(); 2038 packet_send();
2026 } 2039 }
2027 free(ctype); 2040 free(ctype);
2041 return 0;
2028} 2042}
2029static void 2043
2044static int
2030client_input_channel_req(int type, u_int32_t seq, void *ctxt) 2045client_input_channel_req(int type, u_int32_t seq, void *ctxt)
2031{ 2046{
2032 Channel *c = NULL; 2047 Channel *c = NULL;
@@ -2071,18 +2086,395 @@ client_input_channel_req(int type, u_int32_t seq, void *ctxt)
2071 packet_send(); 2086 packet_send();
2072 } 2087 }
2073 free(rtype); 2088 free(rtype);
2089 return 0;
2090}
2091
2092struct hostkeys_update_ctx {
2093 /* The hostname and (optionally) IP address string for the server */
2094 char *host_str, *ip_str;
2095
2096 /*
2097 * Keys received from the server and a flag for each indicating
2098 * whether they already exist in known_hosts.
2099 * keys_seen is filled in by hostkeys_find() and later (for new
2100 * keys) by client_global_hostkeys_private_confirm().
2101 */
2102 struct sshkey **keys;
2103 int *keys_seen;
2104 size_t nkeys;
2105
2106 size_t nnew;
2107
2108 /*
2109 * Keys that are in known_hosts, but were not present in the update
2110 * from the server (i.e. scheduled to be deleted).
2111 * Filled in by hostkeys_find().
2112 */
2113 struct sshkey **old_keys;
2114 size_t nold;
2115};
2116
2117static void
2118hostkeys_update_ctx_free(struct hostkeys_update_ctx *ctx)
2119{
2120 size_t i;
2121
2122 if (ctx == NULL)
2123 return;
2124 for (i = 0; i < ctx->nkeys; i++)
2125 sshkey_free(ctx->keys[i]);
2126 free(ctx->keys);
2127 free(ctx->keys_seen);
2128 for (i = 0; i < ctx->nold; i++)
2129 sshkey_free(ctx->old_keys[i]);
2130 free(ctx->old_keys);
2131 free(ctx->host_str);
2132 free(ctx->ip_str);
2133 free(ctx);
2134}
2135
2136static int
2137hostkeys_find(struct hostkey_foreach_line *l, void *_ctx)
2138{
2139 struct hostkeys_update_ctx *ctx = (struct hostkeys_update_ctx *)_ctx;
2140 size_t i;
2141 struct sshkey **tmp;
2142
2143 if (l->status != HKF_STATUS_MATCHED || l->key == NULL ||
2144 l->key->type == KEY_RSA1)
2145 return 0;
2146
2147 /* Mark off keys we've already seen for this host */
2148 for (i = 0; i < ctx->nkeys; i++) {
2149 if (sshkey_equal(l->key, ctx->keys[i])) {
2150 debug3("%s: found %s key at %s:%ld", __func__,
2151 sshkey_ssh_name(ctx->keys[i]), l->path, l->linenum);
2152 ctx->keys_seen[i] = 1;
2153 return 0;
2154 }
2155 }
2156 /* This line contained a key that not offered by the server */
2157 debug3("%s: deprecated %s key at %s:%ld", __func__,
2158 sshkey_ssh_name(l->key), l->path, l->linenum);
2159 if ((tmp = reallocarray(ctx->old_keys, ctx->nold + 1,
2160 sizeof(*ctx->old_keys))) == NULL)
2161 fatal("%s: reallocarray failed nold = %zu",
2162 __func__, ctx->nold);
2163 ctx->old_keys = tmp;
2164 ctx->old_keys[ctx->nold++] = l->key;
2165 l->key = NULL;
2166
2167 return 0;
2168}
2169
2170static void
2171update_known_hosts(struct hostkeys_update_ctx *ctx)
2172{
2173 int r, was_raw = 0;
2174 int loglevel = options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK ?
2175 SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_VERBOSE;
2176 char *fp, *response;
2177 size_t i;
2178
2179 for (i = 0; i < ctx->nkeys; i++) {
2180 if (ctx->keys_seen[i] != 2)
2181 continue;
2182 if ((fp = sshkey_fingerprint(ctx->keys[i],
2183 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
2184 fatal("%s: sshkey_fingerprint failed", __func__);
2185 do_log2(loglevel, "Learned new hostkey: %s %s",
2186 sshkey_type(ctx->keys[i]), fp);
2187 free(fp);
2188 }
2189 for (i = 0; i < ctx->nold; i++) {
2190 if ((fp = sshkey_fingerprint(ctx->old_keys[i],
2191 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
2192 fatal("%s: sshkey_fingerprint failed", __func__);
2193 do_log2(loglevel, "Deprecating obsolete hostkey: %s %s",
2194 sshkey_type(ctx->old_keys[i]), fp);
2195 free(fp);
2196 }
2197 if (options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK) {
2198 if (get_saved_tio() != NULL) {
2199 leave_raw_mode(1);
2200 was_raw = 1;
2201 }
2202 response = NULL;
2203 for (i = 0; !quit_pending && i < 3; i++) {
2204 free(response);
2205 response = read_passphrase("Accept updated hostkeys? "
2206 "(yes/no): ", RP_ECHO);
2207 if (strcasecmp(response, "yes") == 0)
2208 break;
2209 else if (quit_pending || response == NULL ||
2210 strcasecmp(response, "no") == 0) {
2211 options.update_hostkeys = 0;
2212 break;
2213 } else {
2214 do_log2(loglevel, "Please enter "
2215 "\"yes\" or \"no\"");
2216 }
2217 }
2218 if (quit_pending || i >= 3 || response == NULL)
2219 options.update_hostkeys = 0;
2220 free(response);
2221 if (was_raw)
2222 enter_raw_mode(1);
2223 }
2224
2225 /*
2226 * Now that all the keys are verified, we can go ahead and replace
2227 * them in known_hosts (assuming SSH_UPDATE_HOSTKEYS_ASK didn't
2228 * cancel the operation).
2229 */
2230 if (options.update_hostkeys != 0 &&
2231 (r = hostfile_replace_entries(options.user_hostfiles[0],
2232 ctx->host_str, ctx->ip_str, ctx->keys, ctx->nkeys,
2233 options.hash_known_hosts, 0,
2234 options.fingerprint_hash)) != 0)
2235 error("%s: hostfile_replace_entries failed: %s",
2236 __func__, ssh_err(r));
2074} 2237}
2238
2075static void 2239static void
2240client_global_hostkeys_private_confirm(int type, u_int32_t seq, void *_ctx)
2241{
2242 struct ssh *ssh = active_state; /* XXX */
2243 struct hostkeys_update_ctx *ctx = (struct hostkeys_update_ctx *)_ctx;
2244 size_t i, ndone;
2245 struct sshbuf *signdata;
2246 int r;
2247 const u_char *sig;
2248 size_t siglen;
2249
2250 if (ctx->nnew == 0)
2251 fatal("%s: ctx->nnew == 0", __func__); /* sanity */
2252 if (type != SSH2_MSG_REQUEST_SUCCESS) {
2253 error("Server failed to confirm ownership of "
2254 "private host keys");
2255 hostkeys_update_ctx_free(ctx);
2256 return;
2257 }
2258 if ((signdata = sshbuf_new()) == NULL)
2259 fatal("%s: sshbuf_new failed", __func__);
2260 /* Don't want to accidentally accept an unbound signature */
2261 if (ssh->kex->session_id_len == 0)
2262 fatal("%s: ssh->kex->session_id_len == 0", __func__);
2263 /*
2264 * Expect a signature for each of the ctx->nnew private keys we
2265 * haven't seen before. They will be in the same order as the
2266 * ctx->keys where the corresponding ctx->keys_seen[i] == 0.
2267 */
2268 for (ndone = i = 0; i < ctx->nkeys; i++) {
2269 if (ctx->keys_seen[i])
2270 continue;
2271 /* Prepare data to be signed: session ID, unique string, key */
2272 sshbuf_reset(signdata);
2273 if ( (r = sshbuf_put_cstring(signdata,
2274 "hostkeys-prove-00@openssh.com")) != 0 ||
2275 (r = sshbuf_put_string(signdata, ssh->kex->session_id,
2276 ssh->kex->session_id_len)) != 0 ||
2277 (r = sshkey_puts(ctx->keys[i], signdata)) != 0)
2278 fatal("%s: failed to prepare signature: %s",
2279 __func__, ssh_err(r));
2280 /* Extract and verify signature */
2281 if ((r = sshpkt_get_string_direct(ssh, &sig, &siglen)) != 0) {
2282 error("%s: couldn't parse message: %s",
2283 __func__, ssh_err(r));
2284 goto out;
2285 }
2286 if ((r = sshkey_verify(ctx->keys[i], sig, siglen,
2287 sshbuf_ptr(signdata), sshbuf_len(signdata), 0)) != 0) {
2288 error("%s: server gave bad signature for %s key %zu",
2289 __func__, sshkey_type(ctx->keys[i]), i);
2290 goto out;
2291 }
2292 /* Key is good. Mark it as 'seen' */
2293 ctx->keys_seen[i] = 2;
2294 ndone++;
2295 }
2296 if (ndone != ctx->nnew)
2297 fatal("%s: ndone != ctx->nnew (%zu / %zu)", __func__,
2298 ndone, ctx->nnew); /* Shouldn't happen */
2299 ssh_packet_check_eom(ssh);
2300
2301 /* Make the edits to known_hosts */
2302 update_known_hosts(ctx);
2303 out:
2304 hostkeys_update_ctx_free(ctx);
2305}
2306
2307/*
2308 * Handle hostkeys-00@openssh.com global request to inform the client of all
2309 * the server's hostkeys. The keys are checked against the user's
2310 * HostkeyAlgorithms preference before they are accepted.
2311 */
2312static int
2313client_input_hostkeys(void)
2314{
2315 struct ssh *ssh = active_state; /* XXX */
2316 const u_char *blob = NULL;
2317 size_t i, len = 0;
2318 struct sshbuf *buf = NULL;
2319 struct sshkey *key = NULL, **tmp;
2320 int r;
2321 char *fp;
2322 static int hostkeys_seen = 0; /* XXX use struct ssh */
2323 extern struct sockaddr_storage hostaddr; /* XXX from ssh.c */
2324 struct hostkeys_update_ctx *ctx = NULL;
2325
2326 if (hostkeys_seen)
2327 fatal("%s: server already sent hostkeys", __func__);
2328 if (options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK &&
2329 options.batch_mode)
2330 return 1; /* won't ask in batchmode, so don't even try */
2331 if (!options.update_hostkeys || options.num_user_hostfiles <= 0)
2332 return 1;
2333
2334 ctx = xcalloc(1, sizeof(*ctx));
2335 while (ssh_packet_remaining(ssh) > 0) {
2336 sshkey_free(key);
2337 key = NULL;
2338 if ((r = sshpkt_get_string_direct(ssh, &blob, &len)) != 0) {
2339 error("%s: couldn't parse message: %s",
2340 __func__, ssh_err(r));
2341 goto out;
2342 }
2343 if ((r = sshkey_from_blob(blob, len, &key)) != 0) {
2344 error("%s: parse key: %s", __func__, ssh_err(r));
2345 goto out;
2346 }
2347 fp = sshkey_fingerprint(key, options.fingerprint_hash,
2348 SSH_FP_DEFAULT);
2349 debug3("%s: received %s key %s", __func__,
2350 sshkey_type(key), fp);
2351 free(fp);
2352 /* Check that the key is accepted in HostkeyAlgorithms */
2353 if (options.hostkeyalgorithms != NULL &&
2354 match_pattern_list(sshkey_ssh_name(key),
2355 options.hostkeyalgorithms,
2356 strlen(options.hostkeyalgorithms), 0) != 1) {
2357 debug3("%s: %s key not permitted by HostkeyAlgorithms",
2358 __func__, sshkey_ssh_name(key));
2359 continue;
2360 }
2361 /* Skip certs */
2362 if (sshkey_is_cert(key)) {
2363 debug3("%s: %s key is a certificate; skipping",
2364 __func__, sshkey_ssh_name(key));
2365 continue;
2366 }
2367 /* Ensure keys are unique */
2368 for (i = 0; i < ctx->nkeys; i++) {
2369 if (sshkey_equal(key, ctx->keys[i])) {
2370 error("%s: received duplicated %s host key",
2371 __func__, sshkey_ssh_name(key));
2372 goto out;
2373 }
2374 }
2375 /* Key is good, record it */
2376 if ((tmp = reallocarray(ctx->keys, ctx->nkeys + 1,
2377 sizeof(*ctx->keys))) == NULL)
2378 fatal("%s: reallocarray failed nkeys = %zu",
2379 __func__, ctx->nkeys);
2380 ctx->keys = tmp;
2381 ctx->keys[ctx->nkeys++] = key;
2382 key = NULL;
2383 }
2384
2385 if (ctx->nkeys == 0) {
2386 debug("%s: server sent no hostkeys", __func__);
2387 goto out;
2388 }
2389
2390 if ((ctx->keys_seen = calloc(ctx->nkeys,
2391 sizeof(*ctx->keys_seen))) == NULL)
2392 fatal("%s: calloc failed", __func__);
2393
2394 get_hostfile_hostname_ipaddr(host,
2395 options.check_host_ip ? (struct sockaddr *)&hostaddr : NULL,
2396 options.port, &ctx->host_str,
2397 options.check_host_ip ? &ctx->ip_str : NULL);
2398
2399 /* Find which keys we already know about. */
2400 if ((r = hostkeys_foreach(options.user_hostfiles[0], hostkeys_find,
2401 ctx, ctx->host_str, ctx->ip_str,
2402 HKF_WANT_PARSE_KEY|HKF_WANT_MATCH)) != 0) {
2403 error("%s: hostkeys_foreach failed: %s", __func__, ssh_err(r));
2404 goto out;
2405 }
2406
2407 /* Figure out if we have any new keys to add */
2408 ctx->nnew = 0;
2409 for (i = 0; i < ctx->nkeys; i++) {
2410 if (!ctx->keys_seen[i])
2411 ctx->nnew++;
2412 }
2413
2414 debug3("%s: %zu keys from server: %zu new, %zu retained. %zu to remove",
2415 __func__, ctx->nkeys, ctx->nnew, ctx->nkeys - ctx->nnew, ctx->nold);
2416
2417 if (ctx->nnew == 0 && ctx->nold != 0) {
2418 /* We have some keys to remove. Just do it. */
2419 update_known_hosts(ctx);
2420 } else if (ctx->nnew != 0) {
2421 /*
2422 * We have received hitherto-unseen keys from the server.
2423 * Ask the server to confirm ownership of the private halves.
2424 */
2425 debug3("%s: asking server to prove ownership for %zu keys",
2426 __func__, ctx->nnew);
2427 if ((r = sshpkt_start(ssh, SSH2_MSG_GLOBAL_REQUEST)) != 0 ||
2428 (r = sshpkt_put_cstring(ssh,
2429 "hostkeys-prove-00@openssh.com")) != 0 ||
2430 (r = sshpkt_put_u8(ssh, 1)) != 0) /* bool: want reply */
2431 fatal("%s: cannot prepare packet: %s",
2432 __func__, ssh_err(r));
2433 if ((buf = sshbuf_new()) == NULL)
2434 fatal("%s: sshbuf_new", __func__);
2435 for (i = 0; i < ctx->nkeys; i++) {
2436 if (ctx->keys_seen[i])
2437 continue;
2438 sshbuf_reset(buf);
2439 if ((r = sshkey_putb(ctx->keys[i], buf)) != 0)
2440 fatal("%s: sshkey_putb: %s",
2441 __func__, ssh_err(r));
2442 if ((r = sshpkt_put_stringb(ssh, buf)) != 0)
2443 fatal("%s: sshpkt_put_string: %s",
2444 __func__, ssh_err(r));
2445 }
2446 if ((r = sshpkt_send(ssh)) != 0)
2447 fatal("%s: sshpkt_send: %s", __func__, ssh_err(r));
2448 client_register_global_confirm(
2449 client_global_hostkeys_private_confirm, ctx);
2450 ctx = NULL; /* will be freed in callback */
2451 }
2452
2453 /* Success */
2454 out:
2455 hostkeys_update_ctx_free(ctx);
2456 sshkey_free(key);
2457 sshbuf_free(buf);
2458 /*
2459 * NB. Return success for all cases. The server doesn't need to know
2460 * what the client does with its hosts file.
2461 */
2462 return 1;
2463}
2464
2465static int
2076client_input_global_request(int type, u_int32_t seq, void *ctxt) 2466client_input_global_request(int type, u_int32_t seq, void *ctxt)
2077{ 2467{
2078 char *rtype; 2468 char *rtype;
2079 int want_reply; 2469 int want_reply;
2080 int success = 0; 2470 int success = 0;
2081 2471
2082 rtype = packet_get_string(NULL); 2472 rtype = packet_get_cstring(NULL);
2083 want_reply = packet_get_char(); 2473 want_reply = packet_get_char();
2084 debug("client_input_global_request: rtype %s want_reply %d", 2474 debug("client_input_global_request: rtype %s want_reply %d",
2085 rtype, want_reply); 2475 rtype, want_reply);
2476 if (strcmp(rtype, "hostkeys-00@openssh.com") == 0)
2477 success = client_input_hostkeys();
2086 if (want_reply) { 2478 if (want_reply) {
2087 packet_start(success ? 2479 packet_start(success ?
2088 SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE); 2480 SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE);
@@ -2090,6 +2482,7 @@ client_input_global_request(int type, u_int32_t seq, void *ctxt)
2090 packet_write_wait(); 2482 packet_write_wait();
2091 } 2483 }
2092 free(rtype); 2484 free(rtype);
2485 return 0;
2093} 2486}
2094 2487
2095void 2488void
diff --git a/compat.c b/compat.c
index 4d286e8e9..4852fb709 100644
--- a/compat.c
+++ b/compat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: compat.c,v 1.85 2014/04/20 02:49:32 djm Exp $ */ 1/* $OpenBSD: compat.c,v 1.87 2015/01/19 20:20:20 markus Exp $ */
2/* 2/*
3 * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. 3 * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved.
4 * 4 *
@@ -57,7 +57,7 @@ enable_compat13(void)
57 compat13 = 1; 57 compat13 = 1;
58} 58}
59/* datafellows bug compatibility */ 59/* datafellows bug compatibility */
60void 60u_int
61compat_datafellows(const char *version) 61compat_datafellows(const char *version)
62{ 62{
63 int i; 63 int i;
@@ -174,13 +174,14 @@ compat_datafellows(const char *version)
174 for (i = 0; check[i].pat; i++) { 174 for (i = 0; check[i].pat; i++) {
175 if (match_pattern_list(version, check[i].pat, 175 if (match_pattern_list(version, check[i].pat,
176 strlen(check[i].pat), 0) == 1) { 176 strlen(check[i].pat), 0) == 1) {
177 datafellows = check[i].bugs;
178 debug("match: %s pat %s compat 0x%08x", 177 debug("match: %s pat %s compat 0x%08x",
179 version, check[i].pat, datafellows); 178 version, check[i].pat, check[i].bugs);
180 return; 179 datafellows = check[i].bugs; /* XXX for now */
180 return check[i].bugs;
181 } 181 }
182 } 182 }
183 debug("no match: %s", version); 183 debug("no match: %s", version);
184 return 0;
184} 185}
185 186
186#define SEP "," 187#define SEP ","
@@ -192,7 +193,9 @@ proto_spec(const char *spec)
192 193
193 if (spec == NULL) 194 if (spec == NULL)
194 return ret; 195 return ret;
195 q = s = xstrdup(spec); 196 q = s = strdup(spec);
197 if (s == NULL)
198 return ret;
196 for ((p = strsep(&q, SEP)); p && *p != '\0'; (p = strsep(&q, SEP))) { 199 for ((p = strsep(&q, SEP)); p && *p != '\0'; (p = strsep(&q, SEP))) {
197 switch (atoi(p)) { 200 switch (atoi(p)) {
198 case 1: 201 case 1:
@@ -234,7 +237,7 @@ filter_proposal(char *proposal, const char *filter)
234 debug2("Compat: skipping algorithm \"%s\"", cp); 237 debug2("Compat: skipping algorithm \"%s\"", cp);
235 } 238 }
236 buffer_append(&b, "\0", 1); 239 buffer_append(&b, "\0", 1);
237 fix_prop = xstrdup(buffer_ptr(&b)); 240 fix_prop = xstrdup((char *)buffer_ptr(&b));
238 buffer_free(&b); 241 buffer_free(&b);
239 free(orig_prop); 242 free(orig_prop);
240 243
diff --git a/compat.h b/compat.h
index 2e25d5ba9..af2f0073f 100644
--- a/compat.h
+++ b/compat.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: compat.h,v 1.45 2014/04/18 23:52:25 djm Exp $ */ 1/* $OpenBSD: compat.h,v 1.46 2015/01/19 20:20:20 markus Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999, 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 1999, 2000, 2001 Markus Friedl. All rights reserved.
@@ -63,7 +63,7 @@
63 63
64void enable_compat13(void); 64void enable_compat13(void);
65void enable_compat20(void); 65void enable_compat20(void);
66void compat_datafellows(const char *); 66u_int compat_datafellows(const char *);
67int proto_spec(const char *); 67int proto_spec(const char *);
68char *compat_cipher_proposal(char *); 68char *compat_cipher_proposal(char *);
69char *compat_pkalg_proposal(char *); 69char *compat_pkalg_proposal(char *);
diff --git a/compress.c b/compress.c
deleted file mode 100644
index 24778e524..000000000
--- a/compress.c
+++ /dev/null
@@ -1,167 +0,0 @@
1/* $OpenBSD: compress.c,v 1.26 2010/09/08 04:13:31 deraadt Exp $ */
2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * All rights reserved
6 * Interface to packet compression for ssh.
7 *
8 * As far as I am concerned, the code I have written for this software
9 * can be used freely for any purpose. Any derived versions of this
10 * software must be clearly marked as such, and if the derived work is
11 * incompatible with the protocol description in the RFC file, it must be
12 * called by a name other than "ssh" or "Secure Shell".
13 */
14
15#include "includes.h"
16
17#include <sys/types.h>
18
19#include <stdarg.h>
20
21#include "log.h"
22#include "buffer.h"
23#include "compress.h"
24
25#include <zlib.h>
26
27z_stream incoming_stream;
28z_stream outgoing_stream;
29static int compress_init_send_called = 0;
30static int compress_init_recv_called = 0;
31static int inflate_failed = 0;
32static int deflate_failed = 0;
33
34/*
35 * Initializes compression; level is compression level from 1 to 9
36 * (as in gzip).
37 */
38
39void
40buffer_compress_init_send(int level)
41{
42 if (compress_init_send_called == 1)
43 deflateEnd(&outgoing_stream);
44 compress_init_send_called = 1;
45 debug("Enabling compression at level %d.", level);
46 if (level < 1 || level > 9)
47 fatal("Bad compression level %d.", level);
48 deflateInit(&outgoing_stream, level);
49}
50void
51buffer_compress_init_recv(void)
52{
53 if (compress_init_recv_called == 1)
54 inflateEnd(&incoming_stream);
55 compress_init_recv_called = 1;
56 inflateInit(&incoming_stream);
57}
58
59/* Frees any data structures allocated for compression. */
60
61void
62buffer_compress_uninit(void)
63{
64 debug("compress outgoing: raw data %llu, compressed %llu, factor %.2f",
65 (unsigned long long)outgoing_stream.total_in,
66 (unsigned long long)outgoing_stream.total_out,
67 outgoing_stream.total_in == 0 ? 0.0 :
68 (double) outgoing_stream.total_out / outgoing_stream.total_in);
69 debug("compress incoming: raw data %llu, compressed %llu, factor %.2f",
70 (unsigned long long)incoming_stream.total_out,
71 (unsigned long long)incoming_stream.total_in,
72 incoming_stream.total_out == 0 ? 0.0 :
73 (double) incoming_stream.total_in / incoming_stream.total_out);
74 if (compress_init_recv_called == 1 && inflate_failed == 0)
75 inflateEnd(&incoming_stream);
76 if (compress_init_send_called == 1 && deflate_failed == 0)
77 deflateEnd(&outgoing_stream);
78}
79
80/*
81 * Compresses the contents of input_buffer into output_buffer. All packets
82 * compressed using this function will form a single compressed data stream;
83 * however, data will be flushed at the end of every call so that each
84 * output_buffer can be decompressed independently (but in the appropriate
85 * order since they together form a single compression stream) by the
86 * receiver. This appends the compressed data to the output buffer.
87 */
88
89void
90buffer_compress(Buffer * input_buffer, Buffer * output_buffer)
91{
92 u_char buf[4096];
93 int status;
94
95 /* This case is not handled below. */
96 if (buffer_len(input_buffer) == 0)
97 return;
98
99 /* Input is the contents of the input buffer. */
100 outgoing_stream.next_in = buffer_ptr(input_buffer);
101 outgoing_stream.avail_in = buffer_len(input_buffer);
102
103 /* Loop compressing until deflate() returns with avail_out != 0. */
104 do {
105 /* Set up fixed-size output buffer. */
106 outgoing_stream.next_out = buf;
107 outgoing_stream.avail_out = sizeof(buf);
108
109 /* Compress as much data into the buffer as possible. */
110 status = deflate(&outgoing_stream, Z_PARTIAL_FLUSH);
111 switch (status) {
112 case Z_OK:
113 /* Append compressed data to output_buffer. */
114 buffer_append(output_buffer, buf,
115 sizeof(buf) - outgoing_stream.avail_out);
116 break;
117 default:
118 deflate_failed = 1;
119 fatal("buffer_compress: deflate returned %d", status);
120 /* NOTREACHED */
121 }
122 } while (outgoing_stream.avail_out == 0);
123}
124
125/*
126 * Uncompresses the contents of input_buffer into output_buffer. All packets
127 * uncompressed using this function will form a single compressed data
128 * stream; however, data will be flushed at the end of every call so that
129 * each output_buffer. This must be called for the same size units that the
130 * buffer_compress was called, and in the same order that buffers compressed
131 * with that. This appends the uncompressed data to the output buffer.
132 */
133
134void
135buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer)
136{
137 u_char buf[4096];
138 int status;
139
140 incoming_stream.next_in = buffer_ptr(input_buffer);
141 incoming_stream.avail_in = buffer_len(input_buffer);
142
143 for (;;) {
144 /* Set up fixed-size output buffer. */
145 incoming_stream.next_out = buf;
146 incoming_stream.avail_out = sizeof(buf);
147
148 status = inflate(&incoming_stream, Z_PARTIAL_FLUSH);
149 switch (status) {
150 case Z_OK:
151 buffer_append(output_buffer, buf,
152 sizeof(buf) - incoming_stream.avail_out);
153 break;
154 case Z_BUF_ERROR:
155 /*
156 * Comments in zlib.h say that we should keep calling
157 * inflate() until we get an error. This appears to
158 * be the error that we get.
159 */
160 return;
161 default:
162 inflate_failed = 1;
163 fatal("buffer_uncompress: inflate returned %d", status);
164 /* NOTREACHED */
165 }
166 }
167}
diff --git a/compress.h b/compress.h
deleted file mode 100644
index 418d6fd2c..000000000
--- a/compress.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/* $OpenBSD: compress.h,v 1.12 2006/03/25 22:22:43 djm Exp $ */
2
3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
5 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
6 * All rights reserved
7 * Interface to packet compression for ssh.
8 *
9 * As far as I am concerned, the code I have written for this software
10 * can be used freely for any purpose. Any derived versions of this
11 * software must be clearly marked as such, and if the derived work is
12 * incompatible with the protocol description in the RFC file, it must be
13 * called by a name other than "ssh" or "Secure Shell".
14 */
15
16#ifndef COMPRESS_H
17#define COMPRESS_H
18
19void buffer_compress_init_send(int);
20void buffer_compress_init_recv(void);
21void buffer_compress_uninit(void);
22void buffer_compress(Buffer *, Buffer *);
23void buffer_uncompress(Buffer *, Buffer *);
24
25#endif /* COMPRESS_H */
diff --git a/config.h.in b/config.h.in
index 16d620615..7e7e38ec2 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,8 +1,5 @@
1/* config.h.in. Generated from configure.ac by autoheader. */ 1/* config.h.in. Generated from configure.ac by autoheader. */
2 2
3/* Define if building universal (internal helper macro) */
4#undef AC_APPLE_UNIVERSAL_BUILD
5
6/* Define if you have a getaddrinfo that fails for the all-zeros IPv6 address 3/* Define if you have a getaddrinfo that fails for the all-zeros IPv6 address
7 */ 4 */
8#undef AIX_GETNAMEINFO_HACK 5#undef AIX_GETNAMEINFO_HACK
@@ -291,6 +288,10 @@
291/* Define if your libraries define daemon() */ 288/* Define if your libraries define daemon() */
292#undef HAVE_DAEMON 289#undef HAVE_DAEMON
293 290
291/* Define to 1 if you have the declaration of `AI_NUMERICSERV', and to 0 if
292 you don't. */
293#undef HAVE_DECL_AI_NUMERICSERV
294
294/* Define to 1 if you have the declaration of `authenticate', and to 0 if you 295/* Define to 1 if you have the declaration of `authenticate', and to 0 if you
295 don't. */ 296 don't. */
296#undef HAVE_DECL_AUTHENTICATE 297#undef HAVE_DECL_AUTHENTICATE
@@ -874,6 +875,9 @@
874/* Define to 1 if you have the <readpassphrase.h> header file. */ 875/* Define to 1 if you have the <readpassphrase.h> header file. */
875#undef HAVE_READPASSPHRASE_H 876#undef HAVE_READPASSPHRASE_H
876 877
878/* Define to 1 if you have the `reallocarray' function. */
879#undef HAVE_REALLOCARRAY
880
877/* Define to 1 if you have the `realpath' function. */ 881/* Define to 1 if you have the `realpath' function. */
878#undef HAVE_REALPATH 882#undef HAVE_REALPATH
879 883
@@ -1096,28 +1100,28 @@
1096/* define if you have struct in6_addr data type */ 1100/* define if you have struct in6_addr data type */
1097#undef HAVE_STRUCT_IN6_ADDR 1101#undef HAVE_STRUCT_IN6_ADDR
1098 1102
1099/* Define to 1 if `pw_change' is a member of `struct passwd'. */ 1103/* Define to 1 if `pw_change' is member of `struct passwd'. */
1100#undef HAVE_STRUCT_PASSWD_PW_CHANGE 1104#undef HAVE_STRUCT_PASSWD_PW_CHANGE
1101 1105
1102/* Define to 1 if `pw_class' is a member of `struct passwd'. */ 1106/* Define to 1 if `pw_class' is member of `struct passwd'. */
1103#undef HAVE_STRUCT_PASSWD_PW_CLASS 1107#undef HAVE_STRUCT_PASSWD_PW_CLASS
1104 1108
1105/* Define to 1 if `pw_expire' is a member of `struct passwd'. */ 1109/* Define to 1 if `pw_expire' is member of `struct passwd'. */
1106#undef HAVE_STRUCT_PASSWD_PW_EXPIRE 1110#undef HAVE_STRUCT_PASSWD_PW_EXPIRE
1107 1111
1108/* Define to 1 if `pw_gecos' is a member of `struct passwd'. */ 1112/* Define to 1 if `pw_gecos' is member of `struct passwd'. */
1109#undef HAVE_STRUCT_PASSWD_PW_GECOS 1113#undef HAVE_STRUCT_PASSWD_PW_GECOS
1110 1114
1111/* define if you have struct sockaddr_in6 data type */ 1115/* define if you have struct sockaddr_in6 data type */
1112#undef HAVE_STRUCT_SOCKADDR_IN6 1116#undef HAVE_STRUCT_SOCKADDR_IN6
1113 1117
1114/* Define to 1 if `sin6_scope_id' is a member of `struct sockaddr_in6'. */ 1118/* Define to 1 if `sin6_scope_id' is member of `struct sockaddr_in6'. */
1115#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1119#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
1116 1120
1117/* define if you have struct sockaddr_storage data type */ 1121/* define if you have struct sockaddr_storage data type */
1118#undef HAVE_STRUCT_SOCKADDR_STORAGE 1122#undef HAVE_STRUCT_SOCKADDR_STORAGE
1119 1123
1120/* Define to 1 if `st_blksize' is a member of `struct stat'. */ 1124/* Define to 1 if `st_blksize' is member of `struct stat'. */
1121#undef HAVE_STRUCT_STAT_ST_BLKSIZE 1125#undef HAVE_STRUCT_STAT_ST_BLKSIZE
1122 1126
1123/* Define to 1 if the system has the type `struct timespec'. */ 1127/* Define to 1 if the system has the type `struct timespec'. */
@@ -1467,7 +1471,7 @@
1467/* libcrypto is missing AES 192 and 256 bit functions */ 1471/* libcrypto is missing AES 192 and 256 bit functions */
1468#undef OPENSSL_LOBOTOMISED_AES 1472#undef OPENSSL_LOBOTOMISED_AES
1469 1473
1470/* Define if you want OpenSSL's internally seeded PRNG only */ 1474/* Define if you want the OpenSSL internally seeded PRNG only */
1471#undef OPENSSL_PRNG_ONLY 1475#undef OPENSSL_PRNG_ONLY
1472 1476
1473/* Define to the address where bug reports for this package should be sent. */ 1477/* Define to the address where bug reports for this package should be sent. */
@@ -1482,9 +1486,6 @@
1482/* Define to the one symbol short name of this package. */ 1486/* Define to the one symbol short name of this package. */
1483#undef PACKAGE_TARNAME 1487#undef PACKAGE_TARNAME
1484 1488
1485/* Define to the home page for this package. */
1486#undef PACKAGE_URL
1487
1488/* Define to the version of this package. */ 1489/* Define to the version of this package. */
1489#undef PACKAGE_VERSION 1490#undef PACKAGE_VERSION
1490 1491
@@ -1671,17 +1672,9 @@
1671/* include SSH protocol version 1 support */ 1672/* include SSH protocol version 1 support */
1672#undef WITH_SSH1 1673#undef WITH_SSH1
1673 1674
1674/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most 1675/* Define to 1 if your processor stores words with the most significant byte
1675 significant byte first (like Motorola and SPARC, unlike Intel). */ 1676 first (like Motorola and SPARC, unlike Intel and VAX). */
1676#if defined AC_APPLE_UNIVERSAL_BUILD 1677#undef WORDS_BIGENDIAN
1677# if defined __BIG_ENDIAN__
1678# define WORDS_BIGENDIAN 1
1679# endif
1680#else
1681# ifndef WORDS_BIGENDIAN
1682# undef WORDS_BIGENDIAN
1683# endif
1684#endif
1685 1678
1686/* Define if xauth is found in your path */ 1679/* Define if xauth is found in your path */
1687#undef XAUTH_PATH 1680#undef XAUTH_PATH
diff --git a/configure b/configure
index 6815388cc..10267f663 100755
--- a/configure
+++ b/configure
@@ -1,86 +1,63 @@
1#! /bin/sh 1#! /bin/sh
2# From configure.ac Revision: 1.583 . 2# From configure.ac Revision: 1.583 .
3# Guess values for system-dependent variables and create Makefiles. 3# Guess values for system-dependent variables and create Makefiles.
4# Generated by GNU Autoconf 2.68 for OpenSSH Portable. 4# Generated by GNU Autoconf 2.61 for OpenSSH Portable.
5# 5#
6# Report bugs to <openssh-unix-dev@mindrot.org>. 6# Report bugs to <openssh-unix-dev@mindrot.org>.
7# 7#
8#
9# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 8# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
10# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 9# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
11# Foundation, Inc.
12#
13#
14# This configure script is free software; the Free Software Foundation 10# This configure script is free software; the Free Software Foundation
15# gives unlimited permission to copy, distribute and modify it. 11# gives unlimited permission to copy, distribute and modify it.
16## -------------------- ## 12## --------------------- ##
17## M4sh Initialization. ## 13## M4sh Initialization. ##
18## -------------------- ## 14## --------------------- ##
19 15
20# Be more Bourne compatible 16# Be more Bourne compatible
21DUALCASE=1; export DUALCASE # for MKS sh 17DUALCASE=1; export DUALCASE # for MKS sh
22if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : 18if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
23 emulate sh 19 emulate sh
24 NULLCMD=: 20 NULLCMD=:
25 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which 21 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
26 # is contrary to our usage. Disable this feature. 22 # is contrary to our usage. Disable this feature.
27 alias -g '${1+"$@"}'='"$@"' 23 alias -g '${1+"$@"}'='"$@"'
28 setopt NO_GLOB_SUBST 24 setopt NO_GLOB_SUBST
29else 25else
30 case `(set -o) 2>/dev/null` in #( 26 case `(set -o) 2>/dev/null` in
31 *posix*) : 27 *posix*) set -o posix ;;
32 set -o posix ;; #(
33 *) :
34 ;;
35esac 28esac
29
36fi 30fi
37 31
38 32
39as_nl=' 33
40' 34
41export as_nl 35# PATH needs CR
42# Printing a long string crashes Solaris 7 /usr/bin/printf. 36# Avoid depending upon Character Ranges.
43as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' 37as_cr_letters='abcdefghijklmnopqrstuvwxyz'
44as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo 38as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
45as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo 39as_cr_Letters=$as_cr_letters$as_cr_LETTERS
46# Prefer a ksh shell builtin over an external printf program on Solaris, 40as_cr_digits='0123456789'
47# but without wasting forks for bash or zsh. 41as_cr_alnum=$as_cr_Letters$as_cr_digits
48if test -z "$BASH_VERSION$ZSH_VERSION" \ 42
49 && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then 43# The user is always right.
50 as_echo='print -r --' 44if test "${PATH_SEPARATOR+set}" != set; then
51 as_echo_n='print -rn --' 45 echo "#! /bin/sh" >conf$$.sh
52elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then 46 echo "exit 0" >>conf$$.sh
53 as_echo='printf %s\n' 47 chmod +x conf$$.sh
54 as_echo_n='printf %s' 48 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
55else 49 PATH_SEPARATOR=';'
56 if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
57 as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
58 as_echo_n='/usr/ucb/echo -n'
59 else 50 else
60 as_echo_body='eval expr "X$1" : "X\\(.*\\)"' 51 PATH_SEPARATOR=:
61 as_echo_n_body='eval
62 arg=$1;
63 case $arg in #(
64 *"$as_nl"*)
65 expr "X$arg" : "X\\(.*\\)$as_nl";
66 arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
67 esac;
68 expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
69 '
70 export as_echo_n_body
71 as_echo_n='sh -c $as_echo_n_body as_echo'
72 fi 52 fi
73 export as_echo_body 53 rm -f conf$$.sh
74 as_echo='sh -c $as_echo_body as_echo'
75fi 54fi
76 55
77# The user is always right. 56# Support unset when possible.
78if test "${PATH_SEPARATOR+set}" != set; then 57if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
79 PATH_SEPARATOR=: 58 as_unset=unset
80 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { 59else
81 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || 60 as_unset=false
82 PATH_SEPARATOR=';'
83 }
84fi 61fi
85 62
86 63
@@ -89,19 +66,20 @@ fi
89# there to prevent editors from complaining about space-tab. 66# there to prevent editors from complaining about space-tab.
90# (If _AS_PATH_WALK were called with IFS unset, it would disable word 67# (If _AS_PATH_WALK were called with IFS unset, it would disable word
91# splitting by setting IFS to empty value.) 68# splitting by setting IFS to empty value.)
69as_nl='
70'
92IFS=" "" $as_nl" 71IFS=" "" $as_nl"
93 72
94# Find who we are. Look in the path if we contain no directory separator. 73# Find who we are. Look in the path if we contain no directory separator.
95as_myself= 74case $0 in
96case $0 in #((
97 *[\\/]* ) as_myself=$0 ;; 75 *[\\/]* ) as_myself=$0 ;;
98 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 76 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
99for as_dir in $PATH 77for as_dir in $PATH
100do 78do
101 IFS=$as_save_IFS 79 IFS=$as_save_IFS
102 test -z "$as_dir" && as_dir=. 80 test -z "$as_dir" && as_dir=.
103 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break 81 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
104 done 82done
105IFS=$as_save_IFS 83IFS=$as_save_IFS
106 84
107 ;; 85 ;;
@@ -112,329 +90,354 @@ if test "x$as_myself" = x; then
112 as_myself=$0 90 as_myself=$0
113fi 91fi
114if test ! -f "$as_myself"; then 92if test ! -f "$as_myself"; then
115 $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 93 echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
116 exit 1 94 { (exit 1); exit 1; }
117fi 95fi
118 96
119# Unset variables that we do not need and which cause bugs (e.g. in 97# Work around bugs in pre-3.0 UWIN ksh.
120# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" 98for as_var in ENV MAIL MAILPATH
121# suppresses any "Segmentation fault" message there. '((' could 99do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
122# trigger a bug in pdksh 5.2.14.
123for as_var in BASH_ENV ENV MAIL MAILPATH
124do eval test x\${$as_var+set} = xset \
125 && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
126done 100done
127PS1='$ ' 101PS1='$ '
128PS2='> ' 102PS2='> '
129PS4='+ ' 103PS4='+ '
130 104
131# NLS nuisances. 105# NLS nuisances.
132LC_ALL=C 106for as_var in \
133export LC_ALL 107 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
134LANGUAGE=C 108 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
135export LANGUAGE 109 LC_TELEPHONE LC_TIME
110do
111 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
112 eval $as_var=C; export $as_var
113 else
114 ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
115 fi
116done
117
118# Required to use basename.
119if expr a : '\(a\)' >/dev/null 2>&1 &&
120 test "X`expr 00001 : '.*\(...\)'`" = X001; then
121 as_expr=expr
122else
123 as_expr=false
124fi
125
126if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
127 as_basename=basename
128else
129 as_basename=false
130fi
131
132
133# Name of the executable.
134as_me=`$as_basename -- "$0" ||
135$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
136 X"$0" : 'X\(//\)$' \| \
137 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
138echo X/"$0" |
139 sed '/^.*\/\([^/][^/]*\)\/*$/{
140 s//\1/
141 q
142 }
143 /^X\/\(\/\/\)$/{
144 s//\1/
145 q
146 }
147 /^X\/\(\/\).*/{
148 s//\1/
149 q
150 }
151 s/.*/./; q'`
136 152
137# CDPATH. 153# CDPATH.
138(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 154$as_unset CDPATH
155
139 156
140if test "x$CONFIG_SHELL" = x; then 157if test "x$CONFIG_SHELL" = x; then
141 as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : 158 if (eval ":") 2>/dev/null; then
142 emulate sh 159 as_have_required=yes
143 NULLCMD=:
144 # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
145 # is contrary to our usage. Disable this feature.
146 alias -g '\${1+\"\$@\"}'='\"\$@\"'
147 setopt NO_GLOB_SUBST
148else 160else
149 case \`(set -o) 2>/dev/null\` in #( 161 as_have_required=no
150 *posix*) :
151 set -o posix ;; #(
152 *) :
153 ;;
154esac
155fi 162fi
156" 163
157 as_required="as_fn_return () { (exit \$1); } 164 if test $as_have_required = yes && (eval ":
158as_fn_success () { as_fn_return 0; } 165(as_func_return () {
159as_fn_failure () { as_fn_return 1; } 166 (exit \$1)
160as_fn_ret_success () { return 0; } 167}
161as_fn_ret_failure () { return 1; } 168as_func_success () {
169 as_func_return 0
170}
171as_func_failure () {
172 as_func_return 1
173}
174as_func_ret_success () {
175 return 0
176}
177as_func_ret_failure () {
178 return 1
179}
162 180
163exitcode=0 181exitcode=0
164as_fn_success || { exitcode=1; echo as_fn_success failed.; } 182if as_func_success; then
165as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } 183 :
166as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
167as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
168if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
169
170else
171 exitcode=1; echo positional parameters were not saved.
172fi
173test x\$exitcode = x0 || exit 1"
174 as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
175 as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
176 eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
177 test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
178test \$(( 1 + 1 )) = 2 || exit 1"
179 if (eval "$as_required") 2>/dev/null; then :
180 as_have_required=yes
181else 184else
182 as_have_required=no 185 exitcode=1
186 echo as_func_success failed.
183fi 187fi
184 if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
185 188
189if as_func_failure; then
190 exitcode=1
191 echo as_func_failure succeeded.
192fi
193
194if as_func_ret_success; then
195 :
186else 196else
187 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 197 exitcode=1
188as_found=false 198 echo as_func_ret_success failed.
199fi
200
201if as_func_ret_failure; then
202 exitcode=1
203 echo as_func_ret_failure succeeded.
204fi
205
206if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
207 :
208else
209 exitcode=1
210 echo positional parameters were not saved.
211fi
212
213test \$exitcode = 0) || { (exit 1); exit 1; }
214
215(
216 as_lineno_1=\$LINENO
217 as_lineno_2=\$LINENO
218 test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
219 test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
220") 2> /dev/null; then
221 :
222else
223 as_candidate_shells=
224 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
189for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH 225for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
190do 226do
191 IFS=$as_save_IFS 227 IFS=$as_save_IFS
192 test -z "$as_dir" && as_dir=. 228 test -z "$as_dir" && as_dir=.
193 as_found=: 229 case $as_dir in
194 case $as_dir in #(
195 /*) 230 /*)
196 for as_base in sh bash ksh sh5; do 231 for as_base in sh bash ksh sh5; do
197 # Try only shells that exist, to save several forks. 232 as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
198 as_shell=$as_dir/$as_base
199 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
200 { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
201 CONFIG_SHELL=$as_shell as_have_required=yes
202 if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
203 break 2
204fi
205fi
206 done;; 233 done;;
207 esac 234 esac
208 as_found=false
209done 235done
210$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
211 { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
212 CONFIG_SHELL=$SHELL as_have_required=yes
213fi; }
214IFS=$as_save_IFS 236IFS=$as_save_IFS
215 237
216 238
217 if test "x$CONFIG_SHELL" != x; then : 239 for as_shell in $as_candidate_shells $SHELL; do
218 # We cannot yet assume a decent shell, so we have to provide a 240 # Try only shells that exist, to save several forks.
219 # neutralization value for shells without unset; and this also 241 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
220 # works around shells that cannot unset nonexistent variables. 242 { ("$as_shell") 2> /dev/null <<\_ASEOF
221 # Preserve -v and -x to the replacement shell. 243if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
222 BASH_ENV=/dev/null 244 emulate sh
223 ENV=/dev/null 245 NULLCMD=:
224 (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV 246 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
225 export CONFIG_SHELL 247 # is contrary to our usage. Disable this feature.
226 case $- in # (((( 248 alias -g '${1+"$@"}'='"$@"'
227 *v*x* | *x*v* ) as_opts=-vx ;; 249 setopt NO_GLOB_SUBST
228 *v* ) as_opts=-v ;; 250else
229 *x* ) as_opts=-x ;; 251 case `(set -o) 2>/dev/null` in
230 * ) as_opts= ;; 252 *posix*) set -o posix ;;
231 esac 253esac
232 exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
233fi
234 254
235 if test x$as_have_required = xno; then :
236 $as_echo "$0: This script requires a shell more modern than all"
237 $as_echo "$0: the shells that I found on your system."
238 if test x${ZSH_VERSION+set} = xset ; then
239 $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
240 $as_echo "$0: be upgraded to zsh 4.3.4 or later."
241 else
242 $as_echo "$0: Please tell bug-autoconf@gnu.org and
243$0: openssh-unix-dev@mindrot.org about your system,
244$0: including any error possibly output before this
245$0: message. Then install a modern shell, or manually run
246$0: the script under such a shell if you do have one."
247 fi
248 exit 1
249fi
250fi 255fi
256
257
258:
259_ASEOF
260}; then
261 CONFIG_SHELL=$as_shell
262 as_have_required=yes
263 if { "$as_shell" 2> /dev/null <<\_ASEOF
264if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
265 emulate sh
266 NULLCMD=:
267 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
268 # is contrary to our usage. Disable this feature.
269 alias -g '${1+"$@"}'='"$@"'
270 setopt NO_GLOB_SUBST
271else
272 case `(set -o) 2>/dev/null` in
273 *posix*) set -o posix ;;
274esac
275
251fi 276fi
252SHELL=${CONFIG_SHELL-/bin/sh}
253export SHELL
254# Unset more variables known to interfere with behavior of common tools.
255CLICOLOR_FORCE= GREP_OPTIONS=
256unset CLICOLOR_FORCE GREP_OPTIONS
257 277
258## --------------------- ##
259## M4sh Shell Functions. ##
260## --------------------- ##
261# as_fn_unset VAR
262# ---------------
263# Portably unset VAR.
264as_fn_unset ()
265{
266 { eval $1=; unset $1;}
267}
268as_unset=as_fn_unset
269 278
270# as_fn_set_status STATUS 279:
271# ----------------------- 280(as_func_return () {
272# Set $? to STATUS, without forking. 281 (exit $1)
273as_fn_set_status () 282}
274{ 283as_func_success () {
275 return $1 284 as_func_return 0
276} # as_fn_set_status 285}
286as_func_failure () {
287 as_func_return 1
288}
289as_func_ret_success () {
290 return 0
291}
292as_func_ret_failure () {
293 return 1
294}
277 295
278# as_fn_exit STATUS 296exitcode=0
279# ----------------- 297if as_func_success; then
280# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. 298 :
281as_fn_exit () 299else
282{ 300 exitcode=1
283 set +e 301 echo as_func_success failed.
284 as_fn_set_status $1 302fi
285 exit $1
286} # as_fn_exit
287 303
288# as_fn_mkdir_p 304if as_func_failure; then
289# ------------- 305 exitcode=1
290# Create "$as_dir" as a directory, including parents if necessary. 306 echo as_func_failure succeeded.
291as_fn_mkdir_p () 307fi
292{
293 308
294 case $as_dir in #( 309if as_func_ret_success; then
295 -*) as_dir=./$as_dir;; 310 :
296 esac
297 test -d "$as_dir" || eval $as_mkdir_p || {
298 as_dirs=
299 while :; do
300 case $as_dir in #(
301 *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
302 *) as_qdir=$as_dir;;
303 esac
304 as_dirs="'$as_qdir' $as_dirs"
305 as_dir=`$as_dirname -- "$as_dir" ||
306$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
307 X"$as_dir" : 'X\(//\)[^/]' \| \
308 X"$as_dir" : 'X\(//\)$' \| \
309 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
310$as_echo X"$as_dir" |
311 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
312 s//\1/
313 q
314 }
315 /^X\(\/\/\)[^/].*/{
316 s//\1/
317 q
318 }
319 /^X\(\/\/\)$/{
320 s//\1/
321 q
322 }
323 /^X\(\/\).*/{
324 s//\1/
325 q
326 }
327 s/.*/./; q'`
328 test -d "$as_dir" && break
329 done
330 test -z "$as_dirs" || eval "mkdir $as_dirs"
331 } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
332
333
334} # as_fn_mkdir_p
335# as_fn_append VAR VALUE
336# ----------------------
337# Append the text in VALUE to the end of the definition contained in VAR. Take
338# advantage of any shell optimizations that allow amortized linear growth over
339# repeated appends, instead of the typical quadratic growth present in naive
340# implementations.
341if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
342 eval 'as_fn_append ()
343 {
344 eval $1+=\$2
345 }'
346else 311else
347 as_fn_append () 312 exitcode=1
348 { 313 echo as_func_ret_success failed.
349 eval $1=\$$1\$2 314fi
350 } 315
351fi # as_fn_append 316if as_func_ret_failure; then
352 317 exitcode=1
353# as_fn_arith ARG... 318 echo as_func_ret_failure succeeded.
354# ------------------ 319fi
355# Perform arithmetic evaluation on the ARGs, and store the result in the 320
356# global $as_val. Take advantage of shells that can avoid forks. The arguments 321if ( set x; as_func_ret_success y && test x = "$1" ); then
357# must be portable across $(()) and expr. 322 :
358if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
359 eval 'as_fn_arith ()
360 {
361 as_val=$(( $* ))
362 }'
363else 323else
364 as_fn_arith () 324 exitcode=1
365 { 325 echo positional parameters were not saved.
366 as_val=`expr "$@" || test $? -eq 1` 326fi
367 }
368fi # as_fn_arith
369
370
371# as_fn_error STATUS ERROR [LINENO LOG_FD]
372# ----------------------------------------
373# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
374# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
375# script with STATUS, using 1 if that was 0.
376as_fn_error ()
377{
378 as_status=$1; test $as_status -eq 0 && as_status=1
379 if test "$4"; then
380 as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
381 $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
382 fi
383 $as_echo "$as_me: error: $2" >&2
384 as_fn_exit $as_status
385} # as_fn_error
386 327
387if expr a : '\(a\)' >/dev/null 2>&1 && 328test $exitcode = 0) || { (exit 1); exit 1; }
388 test "X`expr 00001 : '.*\(...\)'`" = X001; then 329
389 as_expr=expr 330(
331 as_lineno_1=$LINENO
332 as_lineno_2=$LINENO
333 test "x$as_lineno_1" != "x$as_lineno_2" &&
334 test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
335
336_ASEOF
337}; then
338 break
339fi
340
341fi
342
343 done
344
345 if test "x$CONFIG_SHELL" != x; then
346 for as_var in BASH_ENV ENV
347 do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
348 done
349 export CONFIG_SHELL
350 exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
351fi
352
353
354 if test $as_have_required = no; then
355 echo This script requires a shell more modern than all the
356 echo shells that I found on your system. Please install a
357 echo modern shell, or manually run the script under such a
358 echo shell if you do have one.
359 { (exit 1); exit 1; }
360fi
361
362
363fi
364
365fi
366
367
368
369(eval "as_func_return () {
370 (exit \$1)
371}
372as_func_success () {
373 as_func_return 0
374}
375as_func_failure () {
376 as_func_return 1
377}
378as_func_ret_success () {
379 return 0
380}
381as_func_ret_failure () {
382 return 1
383}
384
385exitcode=0
386if as_func_success; then
387 :
390else 388else
391 as_expr=false 389 exitcode=1
390 echo as_func_success failed.
392fi 391fi
393 392
394if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then 393if as_func_failure; then
395 as_basename=basename 394 exitcode=1
395 echo as_func_failure succeeded.
396fi
397
398if as_func_ret_success; then
399 :
396else 400else
397 as_basename=false 401 exitcode=1
402 echo as_func_ret_success failed.
398fi 403fi
399 404
400if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then 405if as_func_ret_failure; then
401 as_dirname=dirname 406 exitcode=1
407 echo as_func_ret_failure succeeded.
408fi
409
410if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
411 :
402else 412else
403 as_dirname=false 413 exitcode=1
414 echo positional parameters were not saved.
404fi 415fi
405 416
406as_me=`$as_basename -- "$0" || 417test \$exitcode = 0") || {
407$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ 418 echo No shell found that supports shell functions.
408 X"$0" : 'X\(//\)$' \| \ 419 echo Please tell autoconf@gnu.org about your system,
409 X"$0" : 'X\(/\)' \| . 2>/dev/null || 420 echo including any error possibly output before this
410$as_echo X/"$0" | 421 echo message
411 sed '/^.*\/\([^/][^/]*\)\/*$/{ 422}
412 s//\1/
413 q
414 }
415 /^X\/\(\/\/\)$/{
416 s//\1/
417 q
418 }
419 /^X\/\(\/\).*/{
420 s//\1/
421 q
422 }
423 s/.*/./; q'`
424 423
425# Avoid depending upon Character Ranges.
426as_cr_letters='abcdefghijklmnopqrstuvwxyz'
427as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
428as_cr_Letters=$as_cr_letters$as_cr_LETTERS
429as_cr_digits='0123456789'
430as_cr_alnum=$as_cr_Letters$as_cr_digits
431 424
432 425
433 as_lineno_1=$LINENO as_lineno_1a=$LINENO 426 as_lineno_1=$LINENO
434 as_lineno_2=$LINENO as_lineno_2a=$LINENO 427 as_lineno_2=$LINENO
435 eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && 428 test "x$as_lineno_1" != "x$as_lineno_2" &&
436 test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { 429 test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
437 # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) 430
431 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
432 # uniformly replaced by the line number. The first 'sed' inserts a
433 # line-number line after each line using $LINENO; the second 'sed'
434 # does the real work. The second script uses 'N' to pair each
435 # line-number line with the line containing $LINENO, and appends
436 # trailing '-' during substitution so that $LINENO is not a special
437 # case at line end.
438 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
439 # scripts with optimization help from Paolo Bonzini. Blame Lee
440 # E. McMahon (1931-1989) for sed's syntax. :-)
438 sed -n ' 441 sed -n '
439 p 442 p
440 /[$]LINENO/= 443 /[$]LINENO/=
@@ -451,7 +454,8 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
451 s/-\n.*// 454 s/-\n.*//
452 ' >$as_me.lineno && 455 ' >$as_me.lineno &&
453 chmod +x "$as_me.lineno" || 456 chmod +x "$as_me.lineno" ||
454 { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } 457 { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
458 { (exit 1); exit 1; }; }
455 459
456 # Don't try to exec as it changes $[0], causing all sort of problems 460 # Don't try to exec as it changes $[0], causing all sort of problems
457 # (the dirname of $[0] is not the place where we might find the 461 # (the dirname of $[0] is not the place where we might find the
@@ -461,40 +465,49 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
461 exit 465 exit
462} 466}
463 467
468
469if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
470 as_dirname=dirname
471else
472 as_dirname=false
473fi
474
464ECHO_C= ECHO_N= ECHO_T= 475ECHO_C= ECHO_N= ECHO_T=
465case `echo -n x` in #((((( 476case `echo -n x` in
466-n*) 477-n*)
467 case `echo 'xy\c'` in 478 case `echo 'x\c'` in
468 *c*) ECHO_T=' ';; # ECHO_T is single tab character. 479 *c*) ECHO_T=' ';; # ECHO_T is single tab character.
469 xy) ECHO_C='\c';; 480 *) ECHO_C='\c';;
470 *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
471 ECHO_T=' ';;
472 esac;; 481 esac;;
473*) 482*)
474 ECHO_N='-n';; 483 ECHO_N='-n';;
475esac 484esac
476 485
486if expr a : '\(a\)' >/dev/null 2>&1 &&
487 test "X`expr 00001 : '.*\(...\)'`" = X001; then
488 as_expr=expr
489else
490 as_expr=false
491fi
492
477rm -f conf$$ conf$$.exe conf$$.file 493rm -f conf$$ conf$$.exe conf$$.file
478if test -d conf$$.dir; then 494if test -d conf$$.dir; then
479 rm -f conf$$.dir/conf$$.file 495 rm -f conf$$.dir/conf$$.file
480else 496else
481 rm -f conf$$.dir 497 rm -f conf$$.dir
482 mkdir conf$$.dir 2>/dev/null 498 mkdir conf$$.dir
483fi 499fi
484if (echo >conf$$.file) 2>/dev/null; then 500echo >conf$$.file
485 if ln -s conf$$.file conf$$ 2>/dev/null; then 501if ln -s conf$$.file conf$$ 2>/dev/null; then
486 as_ln_s='ln -s' 502 as_ln_s='ln -s'
487 # ... but there are two gotchas: 503 # ... but there are two gotchas:
488 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. 504 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
489 # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. 505 # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
490 # In both cases, we have to default to `cp -p'. 506 # In both cases, we have to default to `cp -p'.
491 ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || 507 ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
492 as_ln_s='cp -p'
493 elif ln conf$$.file conf$$ 2>/dev/null; then
494 as_ln_s=ln
495 else
496 as_ln_s='cp -p' 508 as_ln_s='cp -p'
497 fi 509elif ln conf$$.file conf$$ 2>/dev/null; then
510 as_ln_s=ln
498else 511else
499 as_ln_s='cp -p' 512 as_ln_s='cp -p'
500fi 513fi
@@ -502,7 +515,7 @@ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
502rmdir conf$$.dir 2>/dev/null 515rmdir conf$$.dir 2>/dev/null
503 516
504if mkdir -p . 2>/dev/null; then 517if mkdir -p . 2>/dev/null; then
505 as_mkdir_p='mkdir -p "$as_dir"' 518 as_mkdir_p=:
506else 519else
507 test -d ./-p && rmdir ./-p 520 test -d ./-p && rmdir ./-p
508 as_mkdir_p=false 521 as_mkdir_p=false
@@ -519,12 +532,12 @@ else
519 as_test_x=' 532 as_test_x='
520 eval sh -c '\'' 533 eval sh -c '\''
521 if test -d "$1"; then 534 if test -d "$1"; then
522 test -d "$1/."; 535 test -d "$1/.";
523 else 536 else
524 case $1 in #( 537 case $1 in
525 -*)set "./$1";; 538 -*)set "./$1";;
526 esac; 539 esac;
527 case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( 540 case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
528 ???[sx]*):;;*)false;;esac;fi 541 ???[sx]*):;;*)false;;esac;fi
529 '\'' sh 542 '\'' sh
530 ' 543 '
@@ -538,11 +551,11 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
538as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" 551as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
539 552
540 553
541test -n "$DJDIR" || exec 7<&0 </dev/null 554
542exec 6>&1 555exec 7<&0 </dev/null 6>&1
543 556
544# Name of the host. 557# Name of the host.
545# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, 558# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
546# so uname gets run too. 559# so uname gets run too.
547ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` 560ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
548 561
@@ -557,6 +570,7 @@ cross_compiling=no
557subdirs= 570subdirs=
558MFLAGS= 571MFLAGS=
559MAKEFLAGS= 572MAKEFLAGS=
573SHELL=${CONFIG_SHELL-/bin/sh}
560 574
561# Identity of this package. 575# Identity of this package.
562PACKAGE_NAME='OpenSSH' 576PACKAGE_NAME='OpenSSH'
@@ -564,7 +578,6 @@ PACKAGE_TARNAME='openssh'
564PACKAGE_VERSION='Portable' 578PACKAGE_VERSION='Portable'
565PACKAGE_STRING='OpenSSH Portable' 579PACKAGE_STRING='OpenSSH Portable'
566PACKAGE_BUGREPORT='openssh-unix-dev@mindrot.org' 580PACKAGE_BUGREPORT='openssh-unix-dev@mindrot.org'
567PACKAGE_URL=''
568 581
569ac_unique_file="ssh.c" 582ac_unique_file="ssh.c"
570# Factoring default headers for most tests. 583# Factoring default headers for most tests.
@@ -603,166 +616,110 @@ ac_includes_default="\
603# include <unistd.h> 616# include <unistd.h>
604#endif" 617#endif"
605 618
606ac_subst_vars='LTLIBOBJS 619ac_subst_vars='SHELL
607LIBOBJS
608UNSUPPORTED_ALGORITHMS
609TEST_MALLOC_OPTIONS
610TEST_SSH_IPV6
611piddir
612user_path
613mansubdir
614MANTYPE
615XAUTH_PATH
616STRIP_OPT
617xauth_path
618PRIVSEP_PATH
619K5LIBS
620GSSLIBS
621KRB5CONF
622SSHDLIBS
623SSHLIBS
624SSH_PRIVSEP_USER
625COMMENT_OUT_ECC
626TEST_SSH_ECC
627LIBEDIT
628PKGCONFIG
629LD
630PATH_PASSWD_PROG
631LOGIN_PROGRAM_FALLBACK
632STARTUP_SCRIPT_SHELL
633MAKE_PACKAGE_SUPPORTED
634PATH_USERADD_PROG
635PATH_GROUPADD_PROG
636MANFMT
637TEST_SHELL
638MANDOC
639NROFF
640GROFF
641SH
642TEST_MINUS_S_SH
643ENT
644SED
645PERL
646KILL
647CAT
648AR
649INSTALL_DATA
650INSTALL_SCRIPT
651INSTALL_PROGRAM
652RANLIB
653AWK
654EGREP
655GREP
656CPP
657host_os
658host_vendor
659host_cpu
660host
661build_os
662build_vendor
663build_cpu
664build
665OBJEXT
666EXEEXT
667ac_ct_CC
668CPPFLAGS
669LDFLAGS
670CFLAGS
671CC
672target_alias
673host_alias
674build_alias
675LIBS
676ECHO_T
677ECHO_N
678ECHO_C
679DEFS
680mandir
681localedir
682libdir
683psdir
684pdfdir
685dvidir
686htmldir
687infodir
688docdir
689oldincludedir
690includedir
691localstatedir
692sharedstatedir
693sysconfdir
694datadir
695datarootdir
696libexecdir
697sbindir
698bindir
699program_transform_name
700prefix
701exec_prefix
702PACKAGE_URL
703PACKAGE_BUGREPORT
704PACKAGE_STRING
705PACKAGE_VERSION
706PACKAGE_TARNAME
707PACKAGE_NAME
708PATH_SEPARATOR 620PATH_SEPARATOR
709SHELL' 621PACKAGE_NAME
622PACKAGE_TARNAME
623PACKAGE_VERSION
624PACKAGE_STRING
625PACKAGE_BUGREPORT
626exec_prefix
627prefix
628program_transform_name
629bindir
630sbindir
631libexecdir
632datarootdir
633datadir
634sysconfdir
635sharedstatedir
636localstatedir
637includedir
638oldincludedir
639docdir
640infodir
641htmldir
642dvidir
643pdfdir
644psdir
645libdir
646localedir
647mandir
648DEFS
649ECHO_C
650ECHO_N
651ECHO_T
652LIBS
653build_alias
654host_alias
655target_alias
656CC
657CFLAGS
658LDFLAGS
659CPPFLAGS
660ac_ct_CC
661EXEEXT
662OBJEXT
663build
664build_cpu
665build_vendor
666build_os
667host
668host_cpu
669host_vendor
670host_os
671CPP
672GREP
673EGREP
674AWK
675RANLIB
676INSTALL_PROGRAM
677INSTALL_SCRIPT
678INSTALL_DATA
679AR
680CAT
681KILL
682PERL
683SED
684ENT
685TEST_MINUS_S_SH
686SH
687GROFF
688NROFF
689MANDOC
690TEST_SHELL
691MANFMT
692PATH_GROUPADD_PROG
693PATH_USERADD_PROG
694MAKE_PACKAGE_SUPPORTED
695STARTUP_SCRIPT_SHELL
696LOGIN_PROGRAM_FALLBACK
697PATH_PASSWD_PROG
698LD
699PKGCONFIG
700LIBEDIT
701TEST_SSH_ECC
702COMMENT_OUT_ECC
703SSH_PRIVSEP_USER
704SSHLIBS
705SSHDLIBS
706KRB5CONF
707GSSLIBS
708K5LIBS
709PRIVSEP_PATH
710xauth_path
711STRIP_OPT
712XAUTH_PATH
713MANTYPE
714mansubdir
715user_path
716piddir
717TEST_SSH_IPV6
718TEST_MALLOC_OPTIONS
719UNSUPPORTED_ALGORITHMS
720LIBOBJS
721LTLIBOBJS'
710ac_subst_files='' 722ac_subst_files=''
711ac_user_opts='
712enable_option_checking
713enable_largefile
714with_stackprotect
715with_hardening
716with_rpath
717with_cflags
718with_cppflags
719with_ldflags
720with_libs
721with_Werror
722with_solaris_contracts
723with_solaris_projects
724with_osfsia
725with_zlib
726with_zlib_version_check
727with_skey
728with_ldns
729with_libedit
730with_audit
731with_pie
732with_ssl_dir
733with_openssl_header_check
734with_ssl_engine
735with_prngd_port
736with_prngd_socket
737with_pam
738with_privsep_user
739with_sandbox
740with_selinux
741with_kerberos5
742with_privsep_path
743with_xauth
744enable_strip
745with_maildir
746with_mantype
747with_md5_passwords
748with_shadow
749with_ipaddr_display
750enable_etc_default_login
751with_default_path
752with_superuser_path
753with_4in6
754with_bsd_auth
755with_pid_dir
756enable_lastlog
757enable_utmp
758enable_utmpx
759enable_wtmp
760enable_wtmpx
761enable_libutil
762enable_pututline
763enable_pututxline
764with_lastlog
765'
766 ac_precious_vars='build_alias 723 ac_precious_vars='build_alias
767host_alias 724host_alias
768target_alias 725target_alias
@@ -777,8 +734,6 @@ CPP'
777# Initialize some variables set by options. 734# Initialize some variables set by options.
778ac_init_help= 735ac_init_help=
779ac_init_version=false 736ac_init_version=false
780ac_unrecognized_opts=
781ac_unrecognized_sep=
782# The variables have the same names as the options, with 737# The variables have the same names as the options, with
783# dashes changed to underlines. 738# dashes changed to underlines.
784cache_file=/dev/null 739cache_file=/dev/null
@@ -834,9 +789,8 @@ do
834 fi 789 fi
835 790
836 case $ac_option in 791 case $ac_option in
837 *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; 792 *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
838 *=) ac_optarg= ;; 793 *) ac_optarg=yes ;;
839 *) ac_optarg=yes ;;
840 esac 794 esac
841 795
842 # Accept the important Cygnus configure options, so we can diagnose typos. 796 # Accept the important Cygnus configure options, so we can diagnose typos.
@@ -878,20 +832,13 @@ do
878 datarootdir=$ac_optarg ;; 832 datarootdir=$ac_optarg ;;
879 833
880 -disable-* | --disable-*) 834 -disable-* | --disable-*)
881 ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` 835 ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
882 # Reject names that are not valid shell variable names. 836 # Reject names that are not valid shell variable names.
883 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && 837 expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
884 as_fn_error $? "invalid feature name: $ac_useropt" 838 { echo "$as_me: error: invalid feature name: $ac_feature" >&2
885 ac_useropt_orig=$ac_useropt 839 { (exit 1); exit 1; }; }
886 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` 840 ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
887 case $ac_user_opts in 841 eval enable_$ac_feature=no ;;
888 *"
889"enable_$ac_useropt"
890"*) ;;
891 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
892 ac_unrecognized_sep=', ';;
893 esac
894 eval enable_$ac_useropt=no ;;
895 842
896 -docdir | --docdir | --docdi | --doc | --do) 843 -docdir | --docdir | --docdi | --doc | --do)
897 ac_prev=docdir ;; 844 ac_prev=docdir ;;
@@ -904,20 +851,13 @@ do
904 dvidir=$ac_optarg ;; 851 dvidir=$ac_optarg ;;
905 852
906 -enable-* | --enable-*) 853 -enable-* | --enable-*)
907 ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` 854 ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
908 # Reject names that are not valid shell variable names. 855 # Reject names that are not valid shell variable names.
909 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && 856 expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
910 as_fn_error $? "invalid feature name: $ac_useropt" 857 { echo "$as_me: error: invalid feature name: $ac_feature" >&2
911 ac_useropt_orig=$ac_useropt 858 { (exit 1); exit 1; }; }
912 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` 859 ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
913 case $ac_user_opts in 860 eval enable_$ac_feature=\$ac_optarg ;;
914 *"
915"enable_$ac_useropt"
916"*) ;;
917 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
918 ac_unrecognized_sep=', ';;
919 esac
920 eval enable_$ac_useropt=\$ac_optarg ;;
921 861
922 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ 862 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
923 | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ 863 | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1108,36 +1048,22 @@ do
1108 ac_init_version=: ;; 1048 ac_init_version=: ;;
1109 1049
1110 -with-* | --with-*) 1050 -with-* | --with-*)
1111 ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` 1051 ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
1112 # Reject names that are not valid shell variable names. 1052 # Reject names that are not valid shell variable names.
1113 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && 1053 expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
1114 as_fn_error $? "invalid package name: $ac_useropt" 1054 { echo "$as_me: error: invalid package name: $ac_package" >&2
1115 ac_useropt_orig=$ac_useropt 1055 { (exit 1); exit 1; }; }
1116 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` 1056 ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
1117 case $ac_user_opts in 1057 eval with_$ac_package=\$ac_optarg ;;
1118 *"
1119"with_$ac_useropt"
1120"*) ;;
1121 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
1122 ac_unrecognized_sep=', ';;
1123 esac
1124 eval with_$ac_useropt=\$ac_optarg ;;
1125 1058
1126 -without-* | --without-*) 1059 -without-* | --without-*)
1127 ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` 1060 ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
1128 # Reject names that are not valid shell variable names. 1061 # Reject names that are not valid shell variable names.
1129 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && 1062 expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
1130 as_fn_error $? "invalid package name: $ac_useropt" 1063 { echo "$as_me: error: invalid package name: $ac_package" >&2
1131 ac_useropt_orig=$ac_useropt 1064 { (exit 1); exit 1; }; }
1132 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` 1065 ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
1133 case $ac_user_opts in 1066 eval with_$ac_package=no ;;
1134 *"
1135"with_$ac_useropt"
1136"*) ;;
1137 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
1138 ac_unrecognized_sep=', ';;
1139 esac
1140 eval with_$ac_useropt=no ;;
1141 1067
1142 --x) 1068 --x)
1143 # Obsolete; use --with-x. 1069 # Obsolete; use --with-x.
@@ -1157,26 +1083,26 @@ do
1157 | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) 1083 | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
1158 x_libraries=$ac_optarg ;; 1084 x_libraries=$ac_optarg ;;
1159 1085
1160 -*) as_fn_error $? "unrecognized option: \`$ac_option' 1086 -*) { echo "$as_me: error: unrecognized option: $ac_option
1161Try \`$0 --help' for more information" 1087Try \`$0 --help' for more information." >&2
1088 { (exit 1); exit 1; }; }
1162 ;; 1089 ;;
1163 1090
1164 *=*) 1091 *=*)
1165 ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` 1092 ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
1166 # Reject names that are not valid shell variable names. 1093 # Reject names that are not valid shell variable names.
1167 case $ac_envvar in #( 1094 expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
1168 '' | [0-9]* | *[!_$as_cr_alnum]* ) 1095 { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
1169 as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; 1096 { (exit 1); exit 1; }; }
1170 esac
1171 eval $ac_envvar=\$ac_optarg 1097 eval $ac_envvar=\$ac_optarg
1172 export $ac_envvar ;; 1098 export $ac_envvar ;;
1173 1099
1174 *) 1100 *)
1175 # FIXME: should be removed in autoconf 3.0. 1101 # FIXME: should be removed in autoconf 3.0.
1176 $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 1102 echo "$as_me: WARNING: you should use --build, --host, --target" >&2
1177 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && 1103 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
1178 $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 1104 echo "$as_me: WARNING: invalid host type: $ac_option" >&2
1179 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" 1105 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
1180 ;; 1106 ;;
1181 1107
1182 esac 1108 esac
@@ -1184,36 +1110,23 @@ done
1184 1110
1185if test -n "$ac_prev"; then 1111if test -n "$ac_prev"; then
1186 ac_option=--`echo $ac_prev | sed 's/_/-/g'` 1112 ac_option=--`echo $ac_prev | sed 's/_/-/g'`
1187 as_fn_error $? "missing argument to $ac_option" 1113 { echo "$as_me: error: missing argument to $ac_option" >&2
1114 { (exit 1); exit 1; }; }
1188fi 1115fi
1189 1116
1190if test -n "$ac_unrecognized_opts"; then 1117# Be sure to have absolute directory names.
1191 case $enable_option_checking in
1192 no) ;;
1193 fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
1194 *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
1195 esac
1196fi
1197
1198# Check all directory arguments for consistency.
1199for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ 1118for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
1200 datadir sysconfdir sharedstatedir localstatedir includedir \ 1119 datadir sysconfdir sharedstatedir localstatedir includedir \
1201 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ 1120 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1202 libdir localedir mandir 1121 libdir localedir mandir
1203do 1122do
1204 eval ac_val=\$$ac_var 1123 eval ac_val=\$$ac_var
1205 # Remove trailing slashes.
1206 case $ac_val in
1207 */ )
1208 ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
1209 eval $ac_var=\$ac_val;;
1210 esac
1211 # Be sure to have absolute directory names.
1212 case $ac_val in 1124 case $ac_val in
1213 [\\/$]* | ?:[\\/]* ) continue;; 1125 [\\/$]* | ?:[\\/]* ) continue;;
1214 NONE | '' ) case $ac_var in *prefix ) continue;; esac;; 1126 NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
1215 esac 1127 esac
1216 as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" 1128 { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
1129 { (exit 1); exit 1; }; }
1217done 1130done
1218 1131
1219# There might be people who depend on the old broken behavior: `$host' 1132# There might be people who depend on the old broken behavior: `$host'
@@ -1227,8 +1140,8 @@ target=$target_alias
1227if test "x$host_alias" != x; then 1140if test "x$host_alias" != x; then
1228 if test "x$build_alias" = x; then 1141 if test "x$build_alias" = x; then
1229 cross_compiling=maybe 1142 cross_compiling=maybe
1230 $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. 1143 echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
1231 If a cross compiler is detected then cross compile mode will be used" >&2 1144 If a cross compiler is detected then cross compile mode will be used." >&2
1232 elif test "x$build_alias" != "x$host_alias"; then 1145 elif test "x$build_alias" != "x$host_alias"; then
1233 cross_compiling=yes 1146 cross_compiling=yes
1234 fi 1147 fi
@@ -1243,21 +1156,23 @@ test "$silent" = yes && exec 6>/dev/null
1243ac_pwd=`pwd` && test -n "$ac_pwd" && 1156ac_pwd=`pwd` && test -n "$ac_pwd" &&
1244ac_ls_di=`ls -di .` && 1157ac_ls_di=`ls -di .` &&
1245ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || 1158ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
1246 as_fn_error $? "working directory cannot be determined" 1159 { echo "$as_me: error: Working directory cannot be determined" >&2
1160 { (exit 1); exit 1; }; }
1247test "X$ac_ls_di" = "X$ac_pwd_ls_di" || 1161test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
1248 as_fn_error $? "pwd does not report name of working directory" 1162 { echo "$as_me: error: pwd does not report name of working directory" >&2
1163 { (exit 1); exit 1; }; }
1249 1164
1250 1165
1251# Find the source files, if location was not specified. 1166# Find the source files, if location was not specified.
1252if test -z "$srcdir"; then 1167if test -z "$srcdir"; then
1253 ac_srcdir_defaulted=yes 1168 ac_srcdir_defaulted=yes
1254 # Try the directory containing this script, then the parent directory. 1169 # Try the directory containing this script, then the parent directory.
1255 ac_confdir=`$as_dirname -- "$as_myself" || 1170 ac_confdir=`$as_dirname -- "$0" ||
1256$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 1171$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
1257 X"$as_myself" : 'X\(//\)[^/]' \| \ 1172 X"$0" : 'X\(//\)[^/]' \| \
1258 X"$as_myself" : 'X\(//\)$' \| \ 1173 X"$0" : 'X\(//\)$' \| \
1259 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || 1174 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
1260$as_echo X"$as_myself" | 1175echo X"$0" |
1261 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ 1176 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
1262 s//\1/ 1177 s//\1/
1263 q 1178 q
@@ -1284,11 +1199,13 @@ else
1284fi 1199fi
1285if test ! -r "$srcdir/$ac_unique_file"; then 1200if test ! -r "$srcdir/$ac_unique_file"; then
1286 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." 1201 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
1287 as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" 1202 { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
1203 { (exit 1); exit 1; }; }
1288fi 1204fi
1289ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" 1205ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
1290ac_abs_confdir=`( 1206ac_abs_confdir=`(
1291 cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" 1207 cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
1208 { (exit 1); exit 1; }; }
1292 pwd)` 1209 pwd)`
1293# When building in place, set srcdir=. 1210# When building in place, set srcdir=.
1294if test "$ac_abs_confdir" = "$ac_pwd"; then 1211if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1328,7 +1245,7 @@ Configuration:
1328 --help=short display options specific to this package 1245 --help=short display options specific to this package
1329 --help=recursive display the short help of all the included packages 1246 --help=recursive display the short help of all the included packages
1330 -V, --version display version information and exit 1247 -V, --version display version information and exit
1331 -q, --quiet, --silent do not print \`checking ...' messages 1248 -q, --quiet, --silent do not print \`checking...' messages
1332 --cache-file=FILE cache test results in FILE [disabled] 1249 --cache-file=FILE cache test results in FILE [disabled]
1333 -C, --config-cache alias for \`--cache-file=config.cache' 1250 -C, --config-cache alias for \`--cache-file=config.cache'
1334 -n, --no-create do not create output files 1251 -n, --no-create do not create output files
@@ -1336,9 +1253,9 @@ Configuration:
1336 1253
1337Installation directories: 1254Installation directories:
1338 --prefix=PREFIX install architecture-independent files in PREFIX 1255 --prefix=PREFIX install architecture-independent files in PREFIX
1339 [$ac_default_prefix] 1256 [$ac_default_prefix]
1340 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX 1257 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
1341 [PREFIX] 1258 [PREFIX]
1342 1259
1343By default, \`make install' will install all the files in 1260By default, \`make install' will install all the files in
1344\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify 1261\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
@@ -1348,25 +1265,25 @@ for instance \`--prefix=\$HOME'.
1348For better control, use the options below. 1265For better control, use the options below.
1349 1266
1350Fine tuning of the installation directories: 1267Fine tuning of the installation directories:
1351 --bindir=DIR user executables [EPREFIX/bin] 1268 --bindir=DIR user executables [EPREFIX/bin]
1352 --sbindir=DIR system admin executables [EPREFIX/sbin] 1269 --sbindir=DIR system admin executables [EPREFIX/sbin]
1353 --libexecdir=DIR program executables [EPREFIX/libexec] 1270 --libexecdir=DIR program executables [EPREFIX/libexec]
1354 --sysconfdir=DIR read-only single-machine data [PREFIX/etc] 1271 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
1355 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] 1272 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
1356 --localstatedir=DIR modifiable single-machine data [PREFIX/var] 1273 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
1357 --libdir=DIR object code libraries [EPREFIX/lib] 1274 --libdir=DIR object code libraries [EPREFIX/lib]
1358 --includedir=DIR C header files [PREFIX/include] 1275 --includedir=DIR C header files [PREFIX/include]
1359 --oldincludedir=DIR C header files for non-gcc [/usr/include] 1276 --oldincludedir=DIR C header files for non-gcc [/usr/include]
1360 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] 1277 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
1361 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] 1278 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
1362 --infodir=DIR info documentation [DATAROOTDIR/info] 1279 --infodir=DIR info documentation [DATAROOTDIR/info]
1363 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] 1280 --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
1364 --mandir=DIR man documentation [DATAROOTDIR/man] 1281 --mandir=DIR man documentation [DATAROOTDIR/man]
1365 --docdir=DIR documentation root [DATAROOTDIR/doc/openssh] 1282 --docdir=DIR documentation root [DATAROOTDIR/doc/openssh]
1366 --htmldir=DIR html documentation [DOCDIR] 1283 --htmldir=DIR html documentation [DOCDIR]
1367 --dvidir=DIR dvi documentation [DOCDIR] 1284 --dvidir=DIR dvi documentation [DOCDIR]
1368 --pdfdir=DIR pdf documentation [DOCDIR] 1285 --pdfdir=DIR pdf documentation [DOCDIR]
1369 --psdir=DIR ps documentation [DOCDIR] 1286 --psdir=DIR ps documentation [DOCDIR]
1370_ACEOF 1287_ACEOF
1371 1288
1372 cat <<\_ACEOF 1289 cat <<\_ACEOF
@@ -1384,7 +1301,6 @@ if test -n "$ac_init_help"; then
1384 cat <<\_ACEOF 1301 cat <<\_ACEOF
1385 1302
1386Optional Features: 1303Optional Features:
1387 --disable-option-checking ignore unrecognized --enable/--with options
1388 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) 1304 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
1389 --enable-FEATURE[=ARG] include FEATURE [ARG=yes] 1305 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
1390 --disable-largefile omit support for large files 1306 --disable-largefile omit support for large files
@@ -1402,6 +1318,8 @@ Optional Features:
1402Optional Packages: 1318Optional Packages:
1403 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] 1319 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
1404 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) 1320 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
1321 --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL**
1322 --without-ssh1 Disable support for SSH protocol 1
1405 --without-stackprotect Don't use compiler's stack protection 1323 --without-stackprotect Don't use compiler's stack protection
1406 --without-hardening Don't use toolchain hardening flags 1324 --without-hardening Don't use toolchain hardening flags
1407 --without-rpath Disable auto-added -R linker paths 1325 --without-rpath Disable auto-added -R linker paths
@@ -1419,7 +1337,7 @@ Optional Packages:
1419 --with-ldns[=PATH] Use ldns for DNSSEC support (optionally in PATH) 1337 --with-ldns[=PATH] Use ldns for DNSSEC support (optionally in PATH)
1420 --with-libedit[=PATH] Enable libedit support for sftp 1338 --with-libedit[=PATH] Enable libedit support for sftp
1421 --with-audit=module Enable audit support (modules=debug,bsm,linux) 1339 --with-audit=module Enable audit support (modules=debug,bsm,linux)
1422 --with-pie Build Position Independent Executables if possible 1340 --with-pie Build Position Independent Executables if possible
1423 --with-ssl-dir=PATH Specify path to OpenSSL installation 1341 --with-ssl-dir=PATH Specify path to OpenSSL installation
1424 --without-openssl-header-check Disable OpenSSL version consistency check 1342 --without-openssl-header-check Disable OpenSSL version consistency check
1425 --with-ssl-engine Enable OpenSSL (hardware) ENGINE support 1343 --with-ssl-engine Enable OpenSSL (hardware) ENGINE support
@@ -1450,7 +1368,7 @@ Some influential environment variables:
1450 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a 1368 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
1451 nonstandard directory <lib dir> 1369 nonstandard directory <lib dir>
1452 LIBS libraries to pass to the linker, e.g. -l<library> 1370 LIBS libraries to pass to the linker, e.g. -l<library>
1453 CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if 1371 CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
1454 you have headers in a nonstandard directory <include dir> 1372 you have headers in a nonstandard directory <include dir>
1455 CPP C preprocessor 1373 CPP C preprocessor
1456 1374
@@ -1465,17 +1383,15 @@ fi
1465if test "$ac_init_help" = "recursive"; then 1383if test "$ac_init_help" = "recursive"; then
1466 # If there are subdirs, report their specific --help. 1384 # If there are subdirs, report their specific --help.
1467 for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue 1385 for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
1468 test -d "$ac_dir" || 1386 test -d "$ac_dir" || continue
1469 { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
1470 continue
1471 ac_builddir=. 1387 ac_builddir=.
1472 1388
1473case "$ac_dir" in 1389case "$ac_dir" in
1474.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; 1390.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
1475*) 1391*)
1476 ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` 1392 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
1477 # A ".." for each directory in $ac_dir_suffix. 1393 # A ".." for each directory in $ac_dir_suffix.
1478 ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` 1394 ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
1479 case $ac_top_builddir_sub in 1395 case $ac_top_builddir_sub in
1480 "") ac_top_builddir_sub=. ac_top_build_prefix= ;; 1396 "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
1481 *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; 1397 *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -1511,7 +1427,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
1511 echo && 1427 echo &&
1512 $SHELL "$ac_srcdir/configure" --help=recursive 1428 $SHELL "$ac_srcdir/configure" --help=recursive
1513 else 1429 else
1514 $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 1430 echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
1515 fi || ac_status=$? 1431 fi || ac_status=$?
1516 cd "$ac_pwd" || { ac_status=$?; break; } 1432 cd "$ac_pwd" || { ac_status=$?; break; }
1517 done 1433 done
@@ -1521,711 +1437,21 @@ test -n "$ac_init_help" && exit $ac_status
1521if $ac_init_version; then 1437if $ac_init_version; then
1522 cat <<\_ACEOF 1438 cat <<\_ACEOF
1523OpenSSH configure Portable 1439OpenSSH configure Portable
1524generated by GNU Autoconf 2.68 1440generated by GNU Autoconf 2.61
1525 1441
1526Copyright (C) 2010 Free Software Foundation, Inc. 1442Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
14432002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
1527This configure script is free software; the Free Software Foundation 1444This configure script is free software; the Free Software Foundation
1528gives unlimited permission to copy, distribute and modify it. 1445gives unlimited permission to copy, distribute and modify it.
1529_ACEOF 1446_ACEOF
1530 exit 1447 exit
1531fi 1448fi
1532
1533## ------------------------ ##
1534## Autoconf initialization. ##
1535## ------------------------ ##
1536
1537# ac_fn_c_try_compile LINENO
1538# --------------------------
1539# Try to compile conftest.$ac_ext, and return whether this succeeded.
1540ac_fn_c_try_compile ()
1541{
1542 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1543 rm -f conftest.$ac_objext
1544 if { { ac_try="$ac_compile"
1545case "(($ac_try" in
1546 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1547 *) ac_try_echo=$ac_try;;
1548esac
1549eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1550$as_echo "$ac_try_echo"; } >&5
1551 (eval "$ac_compile") 2>conftest.err
1552 ac_status=$?
1553 if test -s conftest.err; then
1554 grep -v '^ *+' conftest.err >conftest.er1
1555 cat conftest.er1 >&5
1556 mv -f conftest.er1 conftest.err
1557 fi
1558 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1559 test $ac_status = 0; } && {
1560 test -z "$ac_c_werror_flag" ||
1561 test ! -s conftest.err
1562 } && test -s conftest.$ac_objext; then :
1563 ac_retval=0
1564else
1565 $as_echo "$as_me: failed program was:" >&5
1566sed 's/^/| /' conftest.$ac_ext >&5
1567
1568 ac_retval=1
1569fi
1570 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1571 as_fn_set_status $ac_retval
1572
1573} # ac_fn_c_try_compile
1574
1575# ac_fn_c_try_run LINENO
1576# ----------------------
1577# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
1578# that executables *can* be run.
1579ac_fn_c_try_run ()
1580{
1581 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1582 if { { ac_try="$ac_link"
1583case "(($ac_try" in
1584 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1585 *) ac_try_echo=$ac_try;;
1586esac
1587eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1588$as_echo "$ac_try_echo"; } >&5
1589 (eval "$ac_link") 2>&5
1590 ac_status=$?
1591 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1592 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
1593 { { case "(($ac_try" in
1594 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1595 *) ac_try_echo=$ac_try;;
1596esac
1597eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1598$as_echo "$ac_try_echo"; } >&5
1599 (eval "$ac_try") 2>&5
1600 ac_status=$?
1601 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1602 test $ac_status = 0; }; }; then :
1603 ac_retval=0
1604else
1605 $as_echo "$as_me: program exited with status $ac_status" >&5
1606 $as_echo "$as_me: failed program was:" >&5
1607sed 's/^/| /' conftest.$ac_ext >&5
1608
1609 ac_retval=$ac_status
1610fi
1611 rm -rf conftest.dSYM conftest_ipa8_conftest.oo
1612 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1613 as_fn_set_status $ac_retval
1614
1615} # ac_fn_c_try_run
1616
1617# ac_fn_c_try_cpp LINENO
1618# ----------------------
1619# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
1620ac_fn_c_try_cpp ()
1621{
1622 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1623 if { { ac_try="$ac_cpp conftest.$ac_ext"
1624case "(($ac_try" in
1625 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1626 *) ac_try_echo=$ac_try;;
1627esac
1628eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1629$as_echo "$ac_try_echo"; } >&5
1630 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
1631 ac_status=$?
1632 if test -s conftest.err; then
1633 grep -v '^ *+' conftest.err >conftest.er1
1634 cat conftest.er1 >&5
1635 mv -f conftest.er1 conftest.err
1636 fi
1637 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1638 test $ac_status = 0; } > conftest.i && {
1639 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
1640 test ! -s conftest.err
1641 }; then :
1642 ac_retval=0
1643else
1644 $as_echo "$as_me: failed program was:" >&5
1645sed 's/^/| /' conftest.$ac_ext >&5
1646
1647 ac_retval=1
1648fi
1649 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1650 as_fn_set_status $ac_retval
1651
1652} # ac_fn_c_try_cpp
1653
1654# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
1655# -------------------------------------------------------
1656# Tests whether HEADER exists and can be compiled using the include files in
1657# INCLUDES, setting the cache variable VAR accordingly.
1658ac_fn_c_check_header_compile ()
1659{
1660 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1661 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1662$as_echo_n "checking for $2... " >&6; }
1663if eval \${$3+:} false; then :
1664 $as_echo_n "(cached) " >&6
1665else
1666 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1667/* end confdefs.h. */
1668$4
1669#include <$2>
1670_ACEOF
1671if ac_fn_c_try_compile "$LINENO"; then :
1672 eval "$3=yes"
1673else
1674 eval "$3=no"
1675fi
1676rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1677fi
1678eval ac_res=\$$3
1679 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1680$as_echo "$ac_res" >&6; }
1681 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1682
1683} # ac_fn_c_check_header_compile
1684
1685# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
1686# ---------------------------------------------
1687# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
1688# accordingly.
1689ac_fn_c_check_decl ()
1690{
1691 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1692 as_decl_name=`echo $2|sed 's/ *(.*//'`
1693 as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
1694 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
1695$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
1696if eval \${$3+:} false; then :
1697 $as_echo_n "(cached) " >&6
1698else
1699 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1700/* end confdefs.h. */
1701$4
1702int
1703main ()
1704{
1705#ifndef $as_decl_name
1706#ifdef __cplusplus
1707 (void) $as_decl_use;
1708#else
1709 (void) $as_decl_name;
1710#endif
1711#endif
1712
1713 ;
1714 return 0;
1715}
1716_ACEOF
1717if ac_fn_c_try_compile "$LINENO"; then :
1718 eval "$3=yes"
1719else
1720 eval "$3=no"
1721fi
1722rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1723fi
1724eval ac_res=\$$3
1725 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1726$as_echo "$ac_res" >&6; }
1727 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1728
1729} # ac_fn_c_check_decl
1730
1731# ac_fn_c_try_link LINENO
1732# -----------------------
1733# Try to link conftest.$ac_ext, and return whether this succeeded.
1734ac_fn_c_try_link ()
1735{
1736 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1737 rm -f conftest.$ac_objext conftest$ac_exeext
1738 if { { ac_try="$ac_link"
1739case "(($ac_try" in
1740 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1741 *) ac_try_echo=$ac_try;;
1742esac
1743eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1744$as_echo "$ac_try_echo"; } >&5
1745 (eval "$ac_link") 2>conftest.err
1746 ac_status=$?
1747 if test -s conftest.err; then
1748 grep -v '^ *+' conftest.err >conftest.er1
1749 cat conftest.er1 >&5
1750 mv -f conftest.er1 conftest.err
1751 fi
1752 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1753 test $ac_status = 0; } && {
1754 test -z "$ac_c_werror_flag" ||
1755 test ! -s conftest.err
1756 } && test -s conftest$ac_exeext && {
1757 test "$cross_compiling" = yes ||
1758 $as_test_x conftest$ac_exeext
1759 }; then :
1760 ac_retval=0
1761else
1762 $as_echo "$as_me: failed program was:" >&5
1763sed 's/^/| /' conftest.$ac_ext >&5
1764
1765 ac_retval=1
1766fi
1767 # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
1768 # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
1769 # interfere with the next link command; also delete a directory that is
1770 # left behind by Apple's compiler. We do this before executing the actions.
1771 rm -rf conftest.dSYM conftest_ipa8_conftest.oo
1772 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1773 as_fn_set_status $ac_retval
1774
1775} # ac_fn_c_try_link
1776
1777# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
1778# -------------------------------------------------------
1779# Tests whether HEADER exists, giving a warning if it cannot be compiled using
1780# the include files in INCLUDES and setting the cache variable VAR
1781# accordingly.
1782ac_fn_c_check_header_mongrel ()
1783{
1784 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1785 if eval \${$3+:} false; then :
1786 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1787$as_echo_n "checking for $2... " >&6; }
1788if eval \${$3+:} false; then :
1789 $as_echo_n "(cached) " >&6
1790fi
1791eval ac_res=\$$3
1792 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1793$as_echo "$ac_res" >&6; }
1794else
1795 # Is the header compilable?
1796{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
1797$as_echo_n "checking $2 usability... " >&6; }
1798cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1799/* end confdefs.h. */
1800$4
1801#include <$2>
1802_ACEOF
1803if ac_fn_c_try_compile "$LINENO"; then :
1804 ac_header_compiler=yes
1805else
1806 ac_header_compiler=no
1807fi
1808rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1809{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
1810$as_echo "$ac_header_compiler" >&6; }
1811
1812# Is the header present?
1813{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
1814$as_echo_n "checking $2 presence... " >&6; }
1815cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1816/* end confdefs.h. */
1817#include <$2>
1818_ACEOF
1819if ac_fn_c_try_cpp "$LINENO"; then :
1820 ac_header_preproc=yes
1821else
1822 ac_header_preproc=no
1823fi
1824rm -f conftest.err conftest.i conftest.$ac_ext
1825{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
1826$as_echo "$ac_header_preproc" >&6; }
1827
1828# So? What about this header?
1829case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
1830 yes:no: )
1831 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
1832$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
1833 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
1834$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
1835 ;;
1836 no:yes:* )
1837 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
1838$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
1839 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
1840$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
1841 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
1842$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
1843 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
1844$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
1845 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
1846$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
1847( $as_echo "## ------------------------------------------- ##
1848## Report this to openssh-unix-dev@mindrot.org ##
1849## ------------------------------------------- ##"
1850 ) | sed "s/^/$as_me: WARNING: /" >&2
1851 ;;
1852esac
1853 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1854$as_echo_n "checking for $2... " >&6; }
1855if eval \${$3+:} false; then :
1856 $as_echo_n "(cached) " >&6
1857else
1858 eval "$3=\$ac_header_compiler"
1859fi
1860eval ac_res=\$$3
1861 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1862$as_echo "$ac_res" >&6; }
1863fi
1864 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1865
1866} # ac_fn_c_check_header_mongrel
1867
1868# ac_fn_c_check_func LINENO FUNC VAR
1869# ----------------------------------
1870# Tests whether FUNC exists, setting the cache variable VAR accordingly
1871ac_fn_c_check_func ()
1872{
1873 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1874 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1875$as_echo_n "checking for $2... " >&6; }
1876if eval \${$3+:} false; then :
1877 $as_echo_n "(cached) " >&6
1878else
1879 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1880/* end confdefs.h. */
1881/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
1882 For example, HP-UX 11i <limits.h> declares gettimeofday. */
1883#define $2 innocuous_$2
1884
1885/* System header to define __stub macros and hopefully few prototypes,
1886 which can conflict with char $2 (); below.
1887 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
1888 <limits.h> exists even on freestanding compilers. */
1889
1890#ifdef __STDC__
1891# include <limits.h>
1892#else
1893# include <assert.h>
1894#endif
1895
1896#undef $2
1897
1898/* Override any GCC internal prototype to avoid an error.
1899 Use char because int might match the return type of a GCC
1900 builtin and then its argument prototype would still apply. */
1901#ifdef __cplusplus
1902extern "C"
1903#endif
1904char $2 ();
1905/* The GNU C library defines this for functions which it implements
1906 to always fail with ENOSYS. Some functions are actually named
1907 something starting with __ and the normal name is an alias. */
1908#if defined __stub_$2 || defined __stub___$2
1909choke me
1910#endif
1911
1912int
1913main ()
1914{
1915return $2 ();
1916 ;
1917 return 0;
1918}
1919_ACEOF
1920if ac_fn_c_try_link "$LINENO"; then :
1921 eval "$3=yes"
1922else
1923 eval "$3=no"
1924fi
1925rm -f core conftest.err conftest.$ac_objext \
1926 conftest$ac_exeext conftest.$ac_ext
1927fi
1928eval ac_res=\$$3
1929 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1930$as_echo "$ac_res" >&6; }
1931 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1932
1933} # ac_fn_c_check_func
1934
1935# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
1936# -------------------------------------------
1937# Tests whether TYPE exists after having included INCLUDES, setting cache
1938# variable VAR accordingly.
1939ac_fn_c_check_type ()
1940{
1941 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1942 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1943$as_echo_n "checking for $2... " >&6; }
1944if eval \${$3+:} false; then :
1945 $as_echo_n "(cached) " >&6
1946else
1947 eval "$3=no"
1948 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1949/* end confdefs.h. */
1950$4
1951int
1952main ()
1953{
1954if (sizeof ($2))
1955 return 0;
1956 ;
1957 return 0;
1958}
1959_ACEOF
1960if ac_fn_c_try_compile "$LINENO"; then :
1961 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1962/* end confdefs.h. */
1963$4
1964int
1965main ()
1966{
1967if (sizeof (($2)))
1968 return 0;
1969 ;
1970 return 0;
1971}
1972_ACEOF
1973if ac_fn_c_try_compile "$LINENO"; then :
1974
1975else
1976 eval "$3=yes"
1977fi
1978rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1979fi
1980rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1981fi
1982eval ac_res=\$$3
1983 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1984$as_echo "$ac_res" >&6; }
1985 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1986
1987} # ac_fn_c_check_type
1988
1989# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
1990# --------------------------------------------
1991# Tries to find the compile-time value of EXPR in a program that includes
1992# INCLUDES, setting VAR accordingly. Returns whether the value could be
1993# computed
1994ac_fn_c_compute_int ()
1995{
1996 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1997 if test "$cross_compiling" = yes; then
1998 # Depending upon the size, compute the lo and hi bounds.
1999cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2000/* end confdefs.h. */
2001$4
2002int
2003main ()
2004{
2005static int test_array [1 - 2 * !(($2) >= 0)];
2006test_array [0] = 0
2007
2008 ;
2009 return 0;
2010}
2011_ACEOF
2012if ac_fn_c_try_compile "$LINENO"; then :
2013 ac_lo=0 ac_mid=0
2014 while :; do
2015 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2016/* end confdefs.h. */
2017$4
2018int
2019main ()
2020{
2021static int test_array [1 - 2 * !(($2) <= $ac_mid)];
2022test_array [0] = 0
2023
2024 ;
2025 return 0;
2026}
2027_ACEOF
2028if ac_fn_c_try_compile "$LINENO"; then :
2029 ac_hi=$ac_mid; break
2030else
2031 as_fn_arith $ac_mid + 1 && ac_lo=$as_val
2032 if test $ac_lo -le $ac_mid; then
2033 ac_lo= ac_hi=
2034 break
2035 fi
2036 as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
2037fi
2038rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2039 done
2040else
2041 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2042/* end confdefs.h. */
2043$4
2044int
2045main ()
2046{
2047static int test_array [1 - 2 * !(($2) < 0)];
2048test_array [0] = 0
2049
2050 ;
2051 return 0;
2052}
2053_ACEOF
2054if ac_fn_c_try_compile "$LINENO"; then :
2055 ac_hi=-1 ac_mid=-1
2056 while :; do
2057 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2058/* end confdefs.h. */
2059$4
2060int
2061main ()
2062{
2063static int test_array [1 - 2 * !(($2) >= $ac_mid)];
2064test_array [0] = 0
2065
2066 ;
2067 return 0;
2068}
2069_ACEOF
2070if ac_fn_c_try_compile "$LINENO"; then :
2071 ac_lo=$ac_mid; break
2072else
2073 as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
2074 if test $ac_mid -le $ac_hi; then
2075 ac_lo= ac_hi=
2076 break
2077 fi
2078 as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
2079fi
2080rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2081 done
2082else
2083 ac_lo= ac_hi=
2084fi
2085rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2086fi
2087rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2088# Binary search between lo and hi bounds.
2089while test "x$ac_lo" != "x$ac_hi"; do
2090 as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
2091 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2092/* end confdefs.h. */
2093$4
2094int
2095main ()
2096{
2097static int test_array [1 - 2 * !(($2) <= $ac_mid)];
2098test_array [0] = 0
2099
2100 ;
2101 return 0;
2102}
2103_ACEOF
2104if ac_fn_c_try_compile "$LINENO"; then :
2105 ac_hi=$ac_mid
2106else
2107 as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
2108fi
2109rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2110done
2111case $ac_lo in #((
2112?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
2113'') ac_retval=1 ;;
2114esac
2115 else
2116 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2117/* end confdefs.h. */
2118$4
2119static long int longval () { return $2; }
2120static unsigned long int ulongval () { return $2; }
2121#include <stdio.h>
2122#include <stdlib.h>
2123int
2124main ()
2125{
2126
2127 FILE *f = fopen ("conftest.val", "w");
2128 if (! f)
2129 return 1;
2130 if (($2) < 0)
2131 {
2132 long int i = longval ();
2133 if (i != ($2))
2134 return 1;
2135 fprintf (f, "%ld", i);
2136 }
2137 else
2138 {
2139 unsigned long int i = ulongval ();
2140 if (i != ($2))
2141 return 1;
2142 fprintf (f, "%lu", i);
2143 }
2144 /* Do not output a trailing newline, as this causes \r\n confusion
2145 on some platforms. */
2146 return ferror (f) || fclose (f) != 0;
2147
2148 ;
2149 return 0;
2150}
2151_ACEOF
2152if ac_fn_c_try_run "$LINENO"; then :
2153 echo >>conftest.val; read $3 <conftest.val; ac_retval=0
2154else
2155 ac_retval=1
2156fi
2157rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
2158 conftest.$ac_objext conftest.beam conftest.$ac_ext
2159rm -f conftest.val
2160
2161 fi
2162 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
2163 as_fn_set_status $ac_retval
2164
2165} # ac_fn_c_compute_int
2166
2167# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
2168# ----------------------------------------------------
2169# Tries to find if the field MEMBER exists in type AGGR, after including
2170# INCLUDES, setting cache variable VAR accordingly.
2171ac_fn_c_check_member ()
2172{
2173 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
2174 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
2175$as_echo_n "checking for $2.$3... " >&6; }
2176if eval \${$4+:} false; then :
2177 $as_echo_n "(cached) " >&6
2178else
2179 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2180/* end confdefs.h. */
2181$5
2182int
2183main ()
2184{
2185static $2 ac_aggr;
2186if (ac_aggr.$3)
2187return 0;
2188 ;
2189 return 0;
2190}
2191_ACEOF
2192if ac_fn_c_try_compile "$LINENO"; then :
2193 eval "$4=yes"
2194else
2195 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2196/* end confdefs.h. */
2197$5
2198int
2199main ()
2200{
2201static $2 ac_aggr;
2202if (sizeof ac_aggr.$3)
2203return 0;
2204 ;
2205 return 0;
2206}
2207_ACEOF
2208if ac_fn_c_try_compile "$LINENO"; then :
2209 eval "$4=yes"
2210else
2211 eval "$4=no"
2212fi
2213rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2214fi
2215rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2216fi
2217eval ac_res=\$$4
2218 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
2219$as_echo "$ac_res" >&6; }
2220 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
2221
2222} # ac_fn_c_check_member
2223cat >config.log <<_ACEOF 1449cat >config.log <<_ACEOF
2224This file contains any messages produced by compilers while 1450This file contains any messages produced by compilers while
2225running configure, to aid debugging if configure makes a mistake. 1451running configure, to aid debugging if configure makes a mistake.
2226 1452
2227It was created by OpenSSH $as_me Portable, which was 1453It was created by OpenSSH $as_me Portable, which was
2228generated by GNU Autoconf 2.68. Invocation command line was 1454generated by GNU Autoconf 2.61. Invocation command line was
2229 1455
2230 $ $0 $@ 1456 $ $0 $@
2231 1457
@@ -2261,8 +1487,8 @@ for as_dir in $PATH
2261do 1487do
2262 IFS=$as_save_IFS 1488 IFS=$as_save_IFS
2263 test -z "$as_dir" && as_dir=. 1489 test -z "$as_dir" && as_dir=.
2264 $as_echo "PATH: $as_dir" 1490 echo "PATH: $as_dir"
2265 done 1491done
2266IFS=$as_save_IFS 1492IFS=$as_save_IFS
2267 1493
2268} >&5 1494} >&5
@@ -2296,12 +1522,12 @@ do
2296 | -silent | --silent | --silen | --sile | --sil) 1522 | -silent | --silent | --silen | --sile | --sil)
2297 continue ;; 1523 continue ;;
2298 *\'*) 1524 *\'*)
2299 ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; 1525 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
2300 esac 1526 esac
2301 case $ac_pass in 1527 case $ac_pass in
2302 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 1528 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
2303 2) 1529 2)
2304 as_fn_append ac_configure_args1 " '$ac_arg'" 1530 ac_configure_args1="$ac_configure_args1 '$ac_arg'"
2305 if test $ac_must_keep_next = true; then 1531 if test $ac_must_keep_next = true; then
2306 ac_must_keep_next=false # Got value, back to normal. 1532 ac_must_keep_next=false # Got value, back to normal.
2307 else 1533 else
@@ -2317,13 +1543,13 @@ do
2317 -* ) ac_must_keep_next=true ;; 1543 -* ) ac_must_keep_next=true ;;
2318 esac 1544 esac
2319 fi 1545 fi
2320 as_fn_append ac_configure_args " '$ac_arg'" 1546 ac_configure_args="$ac_configure_args '$ac_arg'"
2321 ;; 1547 ;;
2322 esac 1548 esac
2323 done 1549 done
2324done 1550done
2325{ ac_configure_args0=; unset ac_configure_args0;} 1551$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
2326{ ac_configure_args1=; unset ac_configure_args1;} 1552$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
2327 1553
2328# When interrupted or exit'd, cleanup temporary files, and complete 1554# When interrupted or exit'd, cleanup temporary files, and complete
2329# config.log. We remove comments because anyway the quotes in there 1555# config.log. We remove comments because anyway the quotes in there
@@ -2335,9 +1561,11 @@ trap 'exit_status=$?
2335 { 1561 {
2336 echo 1562 echo
2337 1563
2338 $as_echo "## ---------------- ## 1564 cat <<\_ASBOX
1565## ---------------- ##
2339## Cache variables. ## 1566## Cache variables. ##
2340## ---------------- ##" 1567## ---------------- ##
1568_ASBOX
2341 echo 1569 echo
2342 # The following way of writing the cache mishandles newlines in values, 1570 # The following way of writing the cache mishandles newlines in values,
2343( 1571(
@@ -2346,13 +1574,12 @@ trap 'exit_status=$?
2346 case $ac_val in #( 1574 case $ac_val in #(
2347 *${as_nl}*) 1575 *${as_nl}*)
2348 case $ac_var in #( 1576 case $ac_var in #(
2349 *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 1577 *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
2350$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; 1578echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
2351 esac 1579 esac
2352 case $ac_var in #( 1580 case $ac_var in #(
2353 _ | IFS | as_nl) ;; #( 1581 _ | IFS | as_nl) ;; #(
2354 BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( 1582 *) $as_unset $ac_var ;;
2355 *) { eval $ac_var=; unset $ac_var;} ;;
2356 esac ;; 1583 esac ;;
2357 esac 1584 esac
2358 done 1585 done
@@ -2371,136 +1598,128 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
2371) 1598)
2372 echo 1599 echo
2373 1600
2374 $as_echo "## ----------------- ## 1601 cat <<\_ASBOX
1602## ----------------- ##
2375## Output variables. ## 1603## Output variables. ##
2376## ----------------- ##" 1604## ----------------- ##
1605_ASBOX
2377 echo 1606 echo
2378 for ac_var in $ac_subst_vars 1607 for ac_var in $ac_subst_vars
2379 do 1608 do
2380 eval ac_val=\$$ac_var 1609 eval ac_val=\$$ac_var
2381 case $ac_val in 1610 case $ac_val in
2382 *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; 1611 *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
2383 esac 1612 esac
2384 $as_echo "$ac_var='\''$ac_val'\''" 1613 echo "$ac_var='\''$ac_val'\''"
2385 done | sort 1614 done | sort
2386 echo 1615 echo
2387 1616
2388 if test -n "$ac_subst_files"; then 1617 if test -n "$ac_subst_files"; then
2389 $as_echo "## ------------------- ## 1618 cat <<\_ASBOX
1619## ------------------- ##
2390## File substitutions. ## 1620## File substitutions. ##
2391## ------------------- ##" 1621## ------------------- ##
1622_ASBOX
2392 echo 1623 echo
2393 for ac_var in $ac_subst_files 1624 for ac_var in $ac_subst_files
2394 do 1625 do
2395 eval ac_val=\$$ac_var 1626 eval ac_val=\$$ac_var
2396 case $ac_val in 1627 case $ac_val in
2397 *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; 1628 *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
2398 esac 1629 esac
2399 $as_echo "$ac_var='\''$ac_val'\''" 1630 echo "$ac_var='\''$ac_val'\''"
2400 done | sort 1631 done | sort
2401 echo 1632 echo
2402 fi 1633 fi
2403 1634
2404 if test -s confdefs.h; then 1635 if test -s confdefs.h; then
2405 $as_echo "## ----------- ## 1636 cat <<\_ASBOX
1637## ----------- ##
2406## confdefs.h. ## 1638## confdefs.h. ##
2407## ----------- ##" 1639## ----------- ##
1640_ASBOX
2408 echo 1641 echo
2409 cat confdefs.h 1642 cat confdefs.h
2410 echo 1643 echo
2411 fi 1644 fi
2412 test "$ac_signal" != 0 && 1645 test "$ac_signal" != 0 &&
2413 $as_echo "$as_me: caught signal $ac_signal" 1646 echo "$as_me: caught signal $ac_signal"
2414 $as_echo "$as_me: exit $exit_status" 1647 echo "$as_me: exit $exit_status"
2415 } >&5 1648 } >&5
2416 rm -f core *.core core.conftest.* && 1649 rm -f core *.core core.conftest.* &&
2417 rm -f -r conftest* confdefs* conf$$* $ac_clean_files && 1650 rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
2418 exit $exit_status 1651 exit $exit_status
2419' 0 1652' 0
2420for ac_signal in 1 2 13 15; do 1653for ac_signal in 1 2 13 15; do
2421 trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal 1654 trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
2422done 1655done
2423ac_signal=0 1656ac_signal=0
2424 1657
2425# confdefs.h avoids OS command line length limits that DEFS can exceed. 1658# confdefs.h avoids OS command line length limits that DEFS can exceed.
2426rm -f -r conftest* confdefs.h 1659rm -f -r conftest* confdefs.h
2427 1660
2428$as_echo "/* confdefs.h */" > confdefs.h
2429
2430# Predefined preprocessor variables. 1661# Predefined preprocessor variables.
2431 1662
2432cat >>confdefs.h <<_ACEOF 1663cat >>confdefs.h <<_ACEOF
2433#define PACKAGE_NAME "$PACKAGE_NAME" 1664#define PACKAGE_NAME "$PACKAGE_NAME"
2434_ACEOF 1665_ACEOF
2435 1666
1667
2436cat >>confdefs.h <<_ACEOF 1668cat >>confdefs.h <<_ACEOF
2437#define PACKAGE_TARNAME "$PACKAGE_TARNAME" 1669#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
2438_ACEOF 1670_ACEOF
2439 1671
1672
2440cat >>confdefs.h <<_ACEOF 1673cat >>confdefs.h <<_ACEOF
2441#define PACKAGE_VERSION "$PACKAGE_VERSION" 1674#define PACKAGE_VERSION "$PACKAGE_VERSION"
2442_ACEOF 1675_ACEOF
2443 1676
1677
2444cat >>confdefs.h <<_ACEOF 1678cat >>confdefs.h <<_ACEOF
2445#define PACKAGE_STRING "$PACKAGE_STRING" 1679#define PACKAGE_STRING "$PACKAGE_STRING"
2446_ACEOF 1680_ACEOF
2447 1681
2448cat >>confdefs.h <<_ACEOF
2449#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
2450_ACEOF
2451 1682
2452cat >>confdefs.h <<_ACEOF 1683cat >>confdefs.h <<_ACEOF
2453#define PACKAGE_URL "$PACKAGE_URL" 1684#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
2454_ACEOF 1685_ACEOF
2455 1686
2456 1687
2457# Let the site file select an alternate cache file if it wants to. 1688# Let the site file select an alternate cache file if it wants to.
2458# Prefer an explicitly selected file to automatically selected ones. 1689# Prefer explicitly selected file to automatically selected ones.
2459ac_site_file1=NONE
2460ac_site_file2=NONE
2461if test -n "$CONFIG_SITE"; then 1690if test -n "$CONFIG_SITE"; then
2462 # We do not want a PATH search for config.site. 1691 set x "$CONFIG_SITE"
2463 case $CONFIG_SITE in #((
2464 -*) ac_site_file1=./$CONFIG_SITE;;
2465 */*) ac_site_file1=$CONFIG_SITE;;
2466 *) ac_site_file1=./$CONFIG_SITE;;
2467 esac
2468elif test "x$prefix" != xNONE; then 1692elif test "x$prefix" != xNONE; then
2469 ac_site_file1=$prefix/share/config.site 1693 set x "$prefix/share/config.site" "$prefix/etc/config.site"
2470 ac_site_file2=$prefix/etc/config.site
2471else 1694else
2472 ac_site_file1=$ac_default_prefix/share/config.site 1695 set x "$ac_default_prefix/share/config.site" \
2473 ac_site_file2=$ac_default_prefix/etc/config.site 1696 "$ac_default_prefix/etc/config.site"
2474fi 1697fi
2475for ac_site_file in "$ac_site_file1" "$ac_site_file2" 1698shift
1699for ac_site_file
2476do 1700do
2477 test "x$ac_site_file" = xNONE && continue 1701 if test -r "$ac_site_file"; then
2478 if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then 1702 { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
2479 { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 1703echo "$as_me: loading site script $ac_site_file" >&6;}
2480$as_echo "$as_me: loading site script $ac_site_file" >&6;}
2481 sed 's/^/| /' "$ac_site_file" >&5 1704 sed 's/^/| /' "$ac_site_file" >&5
2482 . "$ac_site_file" \ 1705 . "$ac_site_file"
2483 || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
2484$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2485as_fn_error $? "failed to load site script $ac_site_file
2486See \`config.log' for more details" "$LINENO" 5; }
2487 fi 1706 fi
2488done 1707done
2489 1708
2490if test -r "$cache_file"; then 1709if test -r "$cache_file"; then
2491 # Some versions of bash will fail to source /dev/null (special files 1710 # Some versions of bash will fail to source /dev/null (special
2492 # actually), so we avoid doing that. DJGPP emulates it as a regular file. 1711 # files actually), so we avoid doing that.
2493 if test /dev/null != "$cache_file" && test -f "$cache_file"; then 1712 if test -f "$cache_file"; then
2494 { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 1713 { echo "$as_me:$LINENO: loading cache $cache_file" >&5
2495$as_echo "$as_me: loading cache $cache_file" >&6;} 1714echo "$as_me: loading cache $cache_file" >&6;}
2496 case $cache_file in 1715 case $cache_file in
2497 [\\/]* | ?:[\\/]* ) . "$cache_file";; 1716 [\\/]* | ?:[\\/]* ) . "$cache_file";;
2498 *) . "./$cache_file";; 1717 *) . "./$cache_file";;
2499 esac 1718 esac
2500 fi 1719 fi
2501else 1720else
2502 { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 1721 { echo "$as_me:$LINENO: creating cache $cache_file" >&5
2503$as_echo "$as_me: creating cache $cache_file" >&6;} 1722echo "$as_me: creating cache $cache_file" >&6;}
2504 >$cache_file 1723 >$cache_file
2505fi 1724fi
2506 1725
@@ -2514,56 +1733,68 @@ for ac_var in $ac_precious_vars; do
2514 eval ac_new_val=\$ac_env_${ac_var}_value 1733 eval ac_new_val=\$ac_env_${ac_var}_value
2515 case $ac_old_set,$ac_new_set in 1734 case $ac_old_set,$ac_new_set in
2516 set,) 1735 set,)
2517 { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 1736 { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
2518$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} 1737echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
2519 ac_cache_corrupted=: ;; 1738 ac_cache_corrupted=: ;;
2520 ,set) 1739 ,set)
2521 { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 1740 { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
2522$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} 1741echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
2523 ac_cache_corrupted=: ;; 1742 ac_cache_corrupted=: ;;
2524 ,);; 1743 ,);;
2525 *) 1744 *)
2526 if test "x$ac_old_val" != "x$ac_new_val"; then 1745 if test "x$ac_old_val" != "x$ac_new_val"; then
2527 # differences in whitespace do not lead to failure. 1746 { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
2528 ac_old_val_w=`echo x $ac_old_val` 1747echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
2529 ac_new_val_w=`echo x $ac_new_val` 1748 { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
2530 if test "$ac_old_val_w" != "$ac_new_val_w"; then 1749echo "$as_me: former value: $ac_old_val" >&2;}
2531 { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 1750 { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
2532$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} 1751echo "$as_me: current value: $ac_new_val" >&2;}
2533 ac_cache_corrupted=: 1752 ac_cache_corrupted=:
2534 else
2535 { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
2536$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
2537 eval $ac_var=\$ac_old_val
2538 fi
2539 { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
2540$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
2541 { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
2542$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
2543 fi;; 1753 fi;;
2544 esac 1754 esac
2545 # Pass precious variables to config.status. 1755 # Pass precious variables to config.status.
2546 if test "$ac_new_set" = set; then 1756 if test "$ac_new_set" = set; then
2547 case $ac_new_val in 1757 case $ac_new_val in
2548 *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; 1758 *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
2549 *) ac_arg=$ac_var=$ac_new_val ;; 1759 *) ac_arg=$ac_var=$ac_new_val ;;
2550 esac 1760 esac
2551 case " $ac_configure_args " in 1761 case " $ac_configure_args " in
2552 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. 1762 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
2553 *) as_fn_append ac_configure_args " '$ac_arg'" ;; 1763 *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
2554 esac 1764 esac
2555 fi 1765 fi
2556done 1766done
2557if $ac_cache_corrupted; then 1767if $ac_cache_corrupted; then
2558 { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 1768 { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
2559$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 1769echo "$as_me: error: changes in the environment can compromise the build" >&2;}
2560 { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 1770 { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
2561$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} 1771echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
2562 as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 1772 { (exit 1); exit 1; }; }
2563fi 1773fi
2564## -------------------- ## 1774
2565## Main body of script. ## 1775
2566## -------------------- ## 1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
2567 1798
2568ac_ext=c 1799ac_ext=c
2569ac_cpp='$CPP $CPPFLAGS' 1800ac_cpp='$CPP $CPPFLAGS'
@@ -2591,10 +1822,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
2591if test -n "$ac_tool_prefix"; then 1822if test -n "$ac_tool_prefix"; then
2592 # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. 1823 # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
2593set dummy ${ac_tool_prefix}gcc; ac_word=$2 1824set dummy ${ac_tool_prefix}gcc; ac_word=$2
2594{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 1825{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2595$as_echo_n "checking for $ac_word... " >&6; } 1826echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2596if ${ac_cv_prog_CC+:} false; then : 1827if test "${ac_cv_prog_CC+set}" = set; then
2597 $as_echo_n "(cached) " >&6 1828 echo $ECHO_N "(cached) $ECHO_C" >&6
2598else 1829else
2599 if test -n "$CC"; then 1830 if test -n "$CC"; then
2600 ac_cv_prog_CC="$CC" # Let the user override the test. 1831 ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2604,25 +1835,25 @@ for as_dir in $PATH
2604do 1835do
2605 IFS=$as_save_IFS 1836 IFS=$as_save_IFS
2606 test -z "$as_dir" && as_dir=. 1837 test -z "$as_dir" && as_dir=.
2607 for ac_exec_ext in '' $ac_executable_extensions; do 1838 for ac_exec_ext in '' $ac_executable_extensions; do
2608 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 1839 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2609 ac_cv_prog_CC="${ac_tool_prefix}gcc" 1840 ac_cv_prog_CC="${ac_tool_prefix}gcc"
2610 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 1841 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2611 break 2 1842 break 2
2612 fi 1843 fi
2613done 1844done
2614 done 1845done
2615IFS=$as_save_IFS 1846IFS=$as_save_IFS
2616 1847
2617fi 1848fi
2618fi 1849fi
2619CC=$ac_cv_prog_CC 1850CC=$ac_cv_prog_CC
2620if test -n "$CC"; then 1851if test -n "$CC"; then
2621 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 1852 { echo "$as_me:$LINENO: result: $CC" >&5
2622$as_echo "$CC" >&6; } 1853echo "${ECHO_T}$CC" >&6; }
2623else 1854else
2624 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 1855 { echo "$as_me:$LINENO: result: no" >&5
2625$as_echo "no" >&6; } 1856echo "${ECHO_T}no" >&6; }
2626fi 1857fi
2627 1858
2628 1859
@@ -2631,10 +1862,10 @@ if test -z "$ac_cv_prog_CC"; then
2631 ac_ct_CC=$CC 1862 ac_ct_CC=$CC
2632 # Extract the first word of "gcc", so it can be a program name with args. 1863 # Extract the first word of "gcc", so it can be a program name with args.
2633set dummy gcc; ac_word=$2 1864set dummy gcc; ac_word=$2
2634{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 1865{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2635$as_echo_n "checking for $ac_word... " >&6; } 1866echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2636if ${ac_cv_prog_ac_ct_CC+:} false; then : 1867if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
2637 $as_echo_n "(cached) " >&6 1868 echo $ECHO_N "(cached) $ECHO_C" >&6
2638else 1869else
2639 if test -n "$ac_ct_CC"; then 1870 if test -n "$ac_ct_CC"; then
2640 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. 1871 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -2644,25 +1875,25 @@ for as_dir in $PATH
2644do 1875do
2645 IFS=$as_save_IFS 1876 IFS=$as_save_IFS
2646 test -z "$as_dir" && as_dir=. 1877 test -z "$as_dir" && as_dir=.
2647 for ac_exec_ext in '' $ac_executable_extensions; do 1878 for ac_exec_ext in '' $ac_executable_extensions; do
2648 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 1879 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2649 ac_cv_prog_ac_ct_CC="gcc" 1880 ac_cv_prog_ac_ct_CC="gcc"
2650 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 1881 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2651 break 2 1882 break 2
2652 fi 1883 fi
2653done 1884done
2654 done 1885done
2655IFS=$as_save_IFS 1886IFS=$as_save_IFS
2656 1887
2657fi 1888fi
2658fi 1889fi
2659ac_ct_CC=$ac_cv_prog_ac_ct_CC 1890ac_ct_CC=$ac_cv_prog_ac_ct_CC
2660if test -n "$ac_ct_CC"; then 1891if test -n "$ac_ct_CC"; then
2661 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 1892 { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
2662$as_echo "$ac_ct_CC" >&6; } 1893echo "${ECHO_T}$ac_ct_CC" >&6; }
2663else 1894else
2664 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 1895 { echo "$as_me:$LINENO: result: no" >&5
2665$as_echo "no" >&6; } 1896echo "${ECHO_T}no" >&6; }
2666fi 1897fi
2667 1898
2668 if test "x$ac_ct_CC" = x; then 1899 if test "x$ac_ct_CC" = x; then
@@ -2670,8 +1901,12 @@ fi
2670 else 1901 else
2671 case $cross_compiling:$ac_tool_warned in 1902 case $cross_compiling:$ac_tool_warned in
2672yes:) 1903yes:)
2673{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 1904{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
2674$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} 1905whose name does not start with the host triplet. If you think this
1906configuration is useful to you, please write to autoconf@gnu.org." >&5
1907echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
1908whose name does not start with the host triplet. If you think this
1909configuration is useful to you, please write to autoconf@gnu.org." >&2;}
2675ac_tool_warned=yes ;; 1910ac_tool_warned=yes ;;
2676esac 1911esac
2677 CC=$ac_ct_CC 1912 CC=$ac_ct_CC
@@ -2684,10 +1919,10 @@ if test -z "$CC"; then
2684 if test -n "$ac_tool_prefix"; then 1919 if test -n "$ac_tool_prefix"; then
2685 # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. 1920 # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
2686set dummy ${ac_tool_prefix}cc; ac_word=$2 1921set dummy ${ac_tool_prefix}cc; ac_word=$2
2687{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 1922{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2688$as_echo_n "checking for $ac_word... " >&6; } 1923echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2689if ${ac_cv_prog_CC+:} false; then : 1924if test "${ac_cv_prog_CC+set}" = set; then
2690 $as_echo_n "(cached) " >&6 1925 echo $ECHO_N "(cached) $ECHO_C" >&6
2691else 1926else
2692 if test -n "$CC"; then 1927 if test -n "$CC"; then
2693 ac_cv_prog_CC="$CC" # Let the user override the test. 1928 ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2697,25 +1932,25 @@ for as_dir in $PATH
2697do 1932do
2698 IFS=$as_save_IFS 1933 IFS=$as_save_IFS
2699 test -z "$as_dir" && as_dir=. 1934 test -z "$as_dir" && as_dir=.
2700 for ac_exec_ext in '' $ac_executable_extensions; do 1935 for ac_exec_ext in '' $ac_executable_extensions; do
2701 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 1936 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2702 ac_cv_prog_CC="${ac_tool_prefix}cc" 1937 ac_cv_prog_CC="${ac_tool_prefix}cc"
2703 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 1938 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2704 break 2 1939 break 2
2705 fi 1940 fi
2706done 1941done
2707 done 1942done
2708IFS=$as_save_IFS 1943IFS=$as_save_IFS
2709 1944
2710fi 1945fi
2711fi 1946fi
2712CC=$ac_cv_prog_CC 1947CC=$ac_cv_prog_CC
2713if test -n "$CC"; then 1948if test -n "$CC"; then
2714 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 1949 { echo "$as_me:$LINENO: result: $CC" >&5
2715$as_echo "$CC" >&6; } 1950echo "${ECHO_T}$CC" >&6; }
2716else 1951else
2717 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 1952 { echo "$as_me:$LINENO: result: no" >&5
2718$as_echo "no" >&6; } 1953echo "${ECHO_T}no" >&6; }
2719fi 1954fi
2720 1955
2721 1956
@@ -2724,10 +1959,10 @@ fi
2724if test -z "$CC"; then 1959if test -z "$CC"; then
2725 # Extract the first word of "cc", so it can be a program name with args. 1960 # Extract the first word of "cc", so it can be a program name with args.
2726set dummy cc; ac_word=$2 1961set dummy cc; ac_word=$2
2727{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 1962{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2728$as_echo_n "checking for $ac_word... " >&6; } 1963echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2729if ${ac_cv_prog_CC+:} false; then : 1964if test "${ac_cv_prog_CC+set}" = set; then
2730 $as_echo_n "(cached) " >&6 1965 echo $ECHO_N "(cached) $ECHO_C" >&6
2731else 1966else
2732 if test -n "$CC"; then 1967 if test -n "$CC"; then
2733 ac_cv_prog_CC="$CC" # Let the user override the test. 1968 ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2738,18 +1973,18 @@ for as_dir in $PATH
2738do 1973do
2739 IFS=$as_save_IFS 1974 IFS=$as_save_IFS
2740 test -z "$as_dir" && as_dir=. 1975 test -z "$as_dir" && as_dir=.
2741 for ac_exec_ext in '' $ac_executable_extensions; do 1976 for ac_exec_ext in '' $ac_executable_extensions; do
2742 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 1977 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2743 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then 1978 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
2744 ac_prog_rejected=yes 1979 ac_prog_rejected=yes
2745 continue 1980 continue
2746 fi 1981 fi
2747 ac_cv_prog_CC="cc" 1982 ac_cv_prog_CC="cc"
2748 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 1983 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2749 break 2 1984 break 2
2750 fi 1985 fi
2751done 1986done
2752 done 1987done
2753IFS=$as_save_IFS 1988IFS=$as_save_IFS
2754 1989
2755if test $ac_prog_rejected = yes; then 1990if test $ac_prog_rejected = yes; then
@@ -2768,11 +2003,11 @@ fi
2768fi 2003fi
2769CC=$ac_cv_prog_CC 2004CC=$ac_cv_prog_CC
2770if test -n "$CC"; then 2005if test -n "$CC"; then
2771 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 2006 { echo "$as_me:$LINENO: result: $CC" >&5
2772$as_echo "$CC" >&6; } 2007echo "${ECHO_T}$CC" >&6; }
2773else 2008else
2774 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 2009 { echo "$as_me:$LINENO: result: no" >&5
2775$as_echo "no" >&6; } 2010echo "${ECHO_T}no" >&6; }
2776fi 2011fi
2777 2012
2778 2013
@@ -2783,10 +2018,10 @@ if test -z "$CC"; then
2783 do 2018 do
2784 # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. 2019 # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
2785set dummy $ac_tool_prefix$ac_prog; ac_word=$2 2020set dummy $ac_tool_prefix$ac_prog; ac_word=$2
2786{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 2021{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2787$as_echo_n "checking for $ac_word... " >&6; } 2022echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2788if ${ac_cv_prog_CC+:} false; then : 2023if test "${ac_cv_prog_CC+set}" = set; then
2789 $as_echo_n "(cached) " >&6 2024 echo $ECHO_N "(cached) $ECHO_C" >&6
2790else 2025else
2791 if test -n "$CC"; then 2026 if test -n "$CC"; then
2792 ac_cv_prog_CC="$CC" # Let the user override the test. 2027 ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2796,25 +2031,25 @@ for as_dir in $PATH
2796do 2031do
2797 IFS=$as_save_IFS 2032 IFS=$as_save_IFS
2798 test -z "$as_dir" && as_dir=. 2033 test -z "$as_dir" && as_dir=.
2799 for ac_exec_ext in '' $ac_executable_extensions; do 2034 for ac_exec_ext in '' $ac_executable_extensions; do
2800 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 2035 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2801 ac_cv_prog_CC="$ac_tool_prefix$ac_prog" 2036 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
2802 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 2037 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2803 break 2 2038 break 2
2804 fi 2039 fi
2805done 2040done
2806 done 2041done
2807IFS=$as_save_IFS 2042IFS=$as_save_IFS
2808 2043
2809fi 2044fi
2810fi 2045fi
2811CC=$ac_cv_prog_CC 2046CC=$ac_cv_prog_CC
2812if test -n "$CC"; then 2047if test -n "$CC"; then
2813 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 2048 { echo "$as_me:$LINENO: result: $CC" >&5
2814$as_echo "$CC" >&6; } 2049echo "${ECHO_T}$CC" >&6; }
2815else 2050else
2816 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 2051 { echo "$as_me:$LINENO: result: no" >&5
2817$as_echo "no" >&6; } 2052echo "${ECHO_T}no" >&6; }
2818fi 2053fi
2819 2054
2820 2055
@@ -2827,10 +2062,10 @@ if test -z "$CC"; then
2827do 2062do
2828 # Extract the first word of "$ac_prog", so it can be a program name with args. 2063 # Extract the first word of "$ac_prog", so it can be a program name with args.
2829set dummy $ac_prog; ac_word=$2 2064set dummy $ac_prog; ac_word=$2
2830{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 2065{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2831$as_echo_n "checking for $ac_word... " >&6; } 2066echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2832if ${ac_cv_prog_ac_ct_CC+:} false; then : 2067if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
2833 $as_echo_n "(cached) " >&6 2068 echo $ECHO_N "(cached) $ECHO_C" >&6
2834else 2069else
2835 if test -n "$ac_ct_CC"; then 2070 if test -n "$ac_ct_CC"; then
2836 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. 2071 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -2840,25 +2075,25 @@ for as_dir in $PATH
2840do 2075do
2841 IFS=$as_save_IFS 2076 IFS=$as_save_IFS
2842 test -z "$as_dir" && as_dir=. 2077 test -z "$as_dir" && as_dir=.
2843 for ac_exec_ext in '' $ac_executable_extensions; do 2078 for ac_exec_ext in '' $ac_executable_extensions; do
2844 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 2079 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
2845 ac_cv_prog_ac_ct_CC="$ac_prog" 2080 ac_cv_prog_ac_ct_CC="$ac_prog"
2846 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 2081 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2847 break 2 2082 break 2
2848 fi 2083 fi
2849done 2084done
2850 done 2085done
2851IFS=$as_save_IFS 2086IFS=$as_save_IFS
2852 2087
2853fi 2088fi
2854fi 2089fi
2855ac_ct_CC=$ac_cv_prog_ac_ct_CC 2090ac_ct_CC=$ac_cv_prog_ac_ct_CC
2856if test -n "$ac_ct_CC"; then 2091if test -n "$ac_ct_CC"; then
2857 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 2092 { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
2858$as_echo "$ac_ct_CC" >&6; } 2093echo "${ECHO_T}$ac_ct_CC" >&6; }
2859else 2094else
2860 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 2095 { echo "$as_me:$LINENO: result: no" >&5
2861$as_echo "no" >&6; } 2096echo "${ECHO_T}no" >&6; }
2862fi 2097fi
2863 2098
2864 2099
@@ -2870,8 +2105,12 @@ done
2870 else 2105 else
2871 case $cross_compiling:$ac_tool_warned in 2106 case $cross_compiling:$ac_tool_warned in
2872yes:) 2107yes:)
2873{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 2108{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
2874$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} 2109whose name does not start with the host triplet. If you think this
2110configuration is useful to you, please write to autoconf@gnu.org." >&5
2111echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
2112whose name does not start with the host triplet. If you think this
2113configuration is useful to you, please write to autoconf@gnu.org." >&2;}
2875ac_tool_warned=yes ;; 2114ac_tool_warned=yes ;;
2876esac 2115esac
2877 CC=$ac_ct_CC 2116 CC=$ac_ct_CC
@@ -2881,37 +2120,51 @@ fi
2881fi 2120fi
2882 2121
2883 2122
2884test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 2123test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
2885$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 2124See \`config.log' for more details." >&5
2886as_fn_error $? "no acceptable C compiler found in \$PATH 2125echo "$as_me: error: no acceptable C compiler found in \$PATH
2887See \`config.log' for more details" "$LINENO" 5; } 2126See \`config.log' for more details." >&2;}
2127 { (exit 1); exit 1; }; }
2888 2128
2889# Provide some information about the compiler. 2129# Provide some information about the compiler.
2890$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 2130echo "$as_me:$LINENO: checking for C compiler version" >&5
2891set X $ac_compile 2131ac_compiler=`set X $ac_compile; echo $2`
2892ac_compiler=$2 2132{ (ac_try="$ac_compiler --version >&5"
2893for ac_option in --version -v -V -qversion; do
2894 { { ac_try="$ac_compiler $ac_option >&5"
2895case "(($ac_try" in 2133case "(($ac_try" in
2896 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2134 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2897 *) ac_try_echo=$ac_try;; 2135 *) ac_try_echo=$ac_try;;
2898esac 2136esac
2899eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" 2137eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2900$as_echo "$ac_try_echo"; } >&5 2138 (eval "$ac_compiler --version >&5") 2>&5
2901 (eval "$ac_compiler $ac_option >&5") 2>conftest.err
2902 ac_status=$? 2139 ac_status=$?
2903 if test -s conftest.err; then 2140 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2904 sed '10a\ 2141 (exit $ac_status); }
2905... rest of stderr output deleted ... 2142{ (ac_try="$ac_compiler -v >&5"
2906 10q' conftest.err >conftest.er1 2143case "(($ac_try" in
2907 cat conftest.er1 >&5 2144 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2908 fi 2145 *) ac_try_echo=$ac_try;;
2909 rm -f conftest.er1 conftest.err 2146esac
2910 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 2147eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2911 test $ac_status = 0; } 2148 (eval "$ac_compiler -v >&5") 2>&5
2912done 2149 ac_status=$?
2150 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2151 (exit $ac_status); }
2152{ (ac_try="$ac_compiler -V >&5"
2153case "(($ac_try" in
2154 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2155 *) ac_try_echo=$ac_try;;
2156esac
2157eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2158 (eval "$ac_compiler -V >&5") 2>&5
2159 ac_status=$?
2160 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2161 (exit $ac_status); }
2913 2162
2914cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2163cat >conftest.$ac_ext <<_ACEOF
2164/* confdefs.h. */
2165_ACEOF
2166cat confdefs.h >>conftest.$ac_ext
2167cat >>conftest.$ac_ext <<_ACEOF
2915/* end confdefs.h. */ 2168/* end confdefs.h. */
2916 2169
2917int 2170int
@@ -2923,38 +2176,42 @@ main ()
2923} 2176}
2924_ACEOF 2177_ACEOF
2925ac_clean_files_save=$ac_clean_files 2178ac_clean_files_save=$ac_clean_files
2926ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" 2179ac_clean_files="$ac_clean_files a.out a.exe b.out"
2927# Try to create an executable without -o first, disregard a.out. 2180# Try to create an executable without -o first, disregard a.out.
2928# It will help us diagnose broken compilers, and finding out an intuition 2181# It will help us diagnose broken compilers, and finding out an intuition
2929# of exeext. 2182# of exeext.
2930{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 2183{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
2931$as_echo_n "checking whether the C compiler works... " >&6; } 2184echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
2932ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` 2185ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
2933 2186#
2934# The possible output files: 2187# List of possible output files, starting from the most likely.
2935ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" 2188# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
2936 2189# only as a last resort. b.out is created by i960 compilers.
2190ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
2191#
2192# The IRIX 6 linker writes into existing files which may not be
2193# executable, retaining their permissions. Remove them first so a
2194# subsequent execution test works.
2937ac_rmfiles= 2195ac_rmfiles=
2938for ac_file in $ac_files 2196for ac_file in $ac_files
2939do 2197do
2940 case $ac_file in 2198 case $ac_file in
2941 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; 2199 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
2942 * ) ac_rmfiles="$ac_rmfiles $ac_file";; 2200 * ) ac_rmfiles="$ac_rmfiles $ac_file";;
2943 esac 2201 esac
2944done 2202done
2945rm -f $ac_rmfiles 2203rm -f $ac_rmfiles
2946 2204
2947if { { ac_try="$ac_link_default" 2205if { (ac_try="$ac_link_default"
2948case "(($ac_try" in 2206case "(($ac_try" in
2949 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2207 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2950 *) ac_try_echo=$ac_try;; 2208 *) ac_try_echo=$ac_try;;
2951esac 2209esac
2952eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" 2210eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2953$as_echo "$ac_try_echo"; } >&5
2954 (eval "$ac_link_default") 2>&5 2211 (eval "$ac_link_default") 2>&5
2955 ac_status=$? 2212 ac_status=$?
2956 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 2213 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2957 test $ac_status = 0; }; then : 2214 (exit $ac_status); }; then
2958 # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. 2215 # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
2959# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' 2216# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
2960# in a Makefile. We should not override ac_cv_exeext if it was cached, 2217# in a Makefile. We should not override ac_cv_exeext if it was cached,
@@ -2964,14 +2221,14 @@ for ac_file in $ac_files ''
2964do 2221do
2965 test -f "$ac_file" || continue 2222 test -f "$ac_file" || continue
2966 case $ac_file in 2223 case $ac_file in
2967 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) 2224 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
2968 ;; 2225 ;;
2969 [ab].out ) 2226 [ab].out )
2970 # We found the default executable, but exeext='' is most 2227 # We found the default executable, but exeext='' is most
2971 # certainly right. 2228 # certainly right.
2972 break;; 2229 break;;
2973 *.* ) 2230 *.* )
2974 if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; 2231 if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
2975 then :; else 2232 then :; else
2976 ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 2233 ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
2977 fi 2234 fi
@@ -2990,41 +2247,78 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
2990else 2247else
2991 ac_file='' 2248 ac_file=''
2992fi 2249fi
2993if test -z "$ac_file"; then : 2250
2994 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 2251{ echo "$as_me:$LINENO: result: $ac_file" >&5
2995$as_echo "no" >&6; } 2252echo "${ECHO_T}$ac_file" >&6; }
2996$as_echo "$as_me: failed program was:" >&5 2253if test -z "$ac_file"; then
2254 echo "$as_me: failed program was:" >&5
2997sed 's/^/| /' conftest.$ac_ext >&5 2255sed 's/^/| /' conftest.$ac_ext >&5
2998 2256
2999{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 2257{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
3000$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 2258See \`config.log' for more details." >&5
3001as_fn_error 77 "C compiler cannot create executables 2259echo "$as_me: error: C compiler cannot create executables
3002See \`config.log' for more details" "$LINENO" 5; } 2260See \`config.log' for more details." >&2;}
3003else 2261 { (exit 77); exit 77; }; }
3004 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
3005$as_echo "yes" >&6; }
3006fi 2262fi
3007{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 2263
3008$as_echo_n "checking for C compiler default output file name... " >&6; }
3009{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
3010$as_echo "$ac_file" >&6; }
3011ac_exeext=$ac_cv_exeext 2264ac_exeext=$ac_cv_exeext
3012 2265
3013rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out 2266# Check that the compiler produces executables we can run. If not, either
2267# the compiler is broken, or we cross compile.
2268{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
2269echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
2270# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
2271# If not cross compiling, check that we can run a simple program.
2272if test "$cross_compiling" != yes; then
2273 if { ac_try='./$ac_file'
2274 { (case "(($ac_try" in
2275 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2276 *) ac_try_echo=$ac_try;;
2277esac
2278eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2279 (eval "$ac_try") 2>&5
2280 ac_status=$?
2281 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2282 (exit $ac_status); }; }; then
2283 cross_compiling=no
2284 else
2285 if test "$cross_compiling" = maybe; then
2286 cross_compiling=yes
2287 else
2288 { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
2289If you meant to cross compile, use \`--host'.
2290See \`config.log' for more details." >&5
2291echo "$as_me: error: cannot run C compiled programs.
2292If you meant to cross compile, use \`--host'.
2293See \`config.log' for more details." >&2;}
2294 { (exit 1); exit 1; }; }
2295 fi
2296 fi
2297fi
2298{ echo "$as_me:$LINENO: result: yes" >&5
2299echo "${ECHO_T}yes" >&6; }
2300
2301rm -f a.out a.exe conftest$ac_cv_exeext b.out
3014ac_clean_files=$ac_clean_files_save 2302ac_clean_files=$ac_clean_files_save
3015{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 2303# Check that the compiler produces executables we can run. If not, either
3016$as_echo_n "checking for suffix of executables... " >&6; } 2304# the compiler is broken, or we cross compile.
3017if { { ac_try="$ac_link" 2305{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
2306echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
2307{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
2308echo "${ECHO_T}$cross_compiling" >&6; }
2309
2310{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
2311echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
2312if { (ac_try="$ac_link"
3018case "(($ac_try" in 2313case "(($ac_try" in
3019 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2314 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3020 *) ac_try_echo=$ac_try;; 2315 *) ac_try_echo=$ac_try;;
3021esac 2316esac
3022eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" 2317eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3023$as_echo "$ac_try_echo"; } >&5
3024 (eval "$ac_link") 2>&5 2318 (eval "$ac_link") 2>&5
3025 ac_status=$? 2319 ac_status=$?
3026 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 2320 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3027 test $ac_status = 0; }; then : 2321 (exit $ac_status); }; then
3028 # If both `conftest.exe' and `conftest' are `present' (well, observable) 2322 # If both `conftest.exe' and `conftest' are `present' (well, observable)
3029# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will 2323# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
3030# work properly (i.e., refer to `conftest.exe'), while it won't with 2324# work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -3032,90 +2326,37 @@ $as_echo "$ac_try_echo"; } >&5
3032for ac_file in conftest.exe conftest conftest.*; do 2326for ac_file in conftest.exe conftest conftest.*; do
3033 test -f "$ac_file" || continue 2327 test -f "$ac_file" || continue
3034 case $ac_file in 2328 case $ac_file in
3035 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; 2329 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
3036 *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 2330 *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
3037 break;; 2331 break;;
3038 * ) break;; 2332 * ) break;;
3039 esac 2333 esac
3040done 2334done
3041else 2335else
3042 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 2336 { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
3043$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 2337See \`config.log' for more details." >&5
3044as_fn_error $? "cannot compute suffix of executables: cannot compile and link 2338echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
3045See \`config.log' for more details" "$LINENO" 5; } 2339See \`config.log' for more details." >&2;}
2340 { (exit 1); exit 1; }; }
3046fi 2341fi
3047rm -f conftest conftest$ac_cv_exeext 2342
3048{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 2343rm -f conftest$ac_cv_exeext
3049$as_echo "$ac_cv_exeext" >&6; } 2344{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
2345echo "${ECHO_T}$ac_cv_exeext" >&6; }
3050 2346
3051rm -f conftest.$ac_ext 2347rm -f conftest.$ac_ext
3052EXEEXT=$ac_cv_exeext 2348EXEEXT=$ac_cv_exeext
3053ac_exeext=$EXEEXT 2349ac_exeext=$EXEEXT
3054cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2350{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
3055/* end confdefs.h. */ 2351echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
3056#include <stdio.h> 2352if test "${ac_cv_objext+set}" = set; then
3057int 2353 echo $ECHO_N "(cached) $ECHO_C" >&6
3058main ()
3059{
3060FILE *f = fopen ("conftest.out", "w");
3061 return ferror (f) || fclose (f) != 0;
3062
3063 ;
3064 return 0;
3065}
3066_ACEOF
3067ac_clean_files="$ac_clean_files conftest.out"
3068# Check that the compiler produces executables we can run. If not, either
3069# the compiler is broken, or we cross compile.
3070{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
3071$as_echo_n "checking whether we are cross compiling... " >&6; }
3072if test "$cross_compiling" != yes; then
3073 { { ac_try="$ac_link"
3074case "(($ac_try" in
3075 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3076 *) ac_try_echo=$ac_try;;
3077esac
3078eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3079$as_echo "$ac_try_echo"; } >&5
3080 (eval "$ac_link") 2>&5
3081 ac_status=$?
3082 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3083 test $ac_status = 0; }
3084 if { ac_try='./conftest$ac_cv_exeext'
3085 { { case "(($ac_try" in
3086 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3087 *) ac_try_echo=$ac_try;;
3088esac
3089eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3090$as_echo "$ac_try_echo"; } >&5
3091 (eval "$ac_try") 2>&5
3092 ac_status=$?
3093 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3094 test $ac_status = 0; }; }; then
3095 cross_compiling=no
3096 else
3097 if test "$cross_compiling" = maybe; then
3098 cross_compiling=yes
3099 else
3100 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
3101$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
3102as_fn_error $? "cannot run C compiled programs.
3103If you meant to cross compile, use \`--host'.
3104See \`config.log' for more details" "$LINENO" 5; }
3105 fi
3106 fi
3107fi
3108{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
3109$as_echo "$cross_compiling" >&6; }
3110
3111rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
3112ac_clean_files=$ac_clean_files_save
3113{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
3114$as_echo_n "checking for suffix of object files... " >&6; }
3115if ${ac_cv_objext+:} false; then :
3116 $as_echo_n "(cached) " >&6
3117else 2354else
3118 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2355 cat >conftest.$ac_ext <<_ACEOF
2356/* confdefs.h. */
2357_ACEOF
2358cat confdefs.h >>conftest.$ac_ext
2359cat >>conftest.$ac_ext <<_ACEOF
3119/* end confdefs.h. */ 2360/* end confdefs.h. */
3120 2361
3121int 2362int
@@ -3127,46 +2368,51 @@ main ()
3127} 2368}
3128_ACEOF 2369_ACEOF
3129rm -f conftest.o conftest.obj 2370rm -f conftest.o conftest.obj
3130if { { ac_try="$ac_compile" 2371if { (ac_try="$ac_compile"
3131case "(($ac_try" in 2372case "(($ac_try" in
3132 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2373 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3133 *) ac_try_echo=$ac_try;; 2374 *) ac_try_echo=$ac_try;;
3134esac 2375esac
3135eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" 2376eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3136$as_echo "$ac_try_echo"; } >&5
3137 (eval "$ac_compile") 2>&5 2377 (eval "$ac_compile") 2>&5
3138 ac_status=$? 2378 ac_status=$?
3139 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 2379 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3140 test $ac_status = 0; }; then : 2380 (exit $ac_status); }; then
3141 for ac_file in conftest.o conftest.obj conftest.*; do 2381 for ac_file in conftest.o conftest.obj conftest.*; do
3142 test -f "$ac_file" || continue; 2382 test -f "$ac_file" || continue;
3143 case $ac_file in 2383 case $ac_file in
3144 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; 2384 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
3145 *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` 2385 *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
3146 break;; 2386 break;;
3147 esac 2387 esac
3148done 2388done
3149else 2389else
3150 $as_echo "$as_me: failed program was:" >&5 2390 echo "$as_me: failed program was:" >&5
3151sed 's/^/| /' conftest.$ac_ext >&5 2391sed 's/^/| /' conftest.$ac_ext >&5
3152 2392
3153{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 2393{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
3154$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 2394See \`config.log' for more details." >&5
3155as_fn_error $? "cannot compute suffix of object files: cannot compile 2395echo "$as_me: error: cannot compute suffix of object files: cannot compile
3156See \`config.log' for more details" "$LINENO" 5; } 2396See \`config.log' for more details." >&2;}
2397 { (exit 1); exit 1; }; }
3157fi 2398fi
2399
3158rm -f conftest.$ac_cv_objext conftest.$ac_ext 2400rm -f conftest.$ac_cv_objext conftest.$ac_ext
3159fi 2401fi
3160{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 2402{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
3161$as_echo "$ac_cv_objext" >&6; } 2403echo "${ECHO_T}$ac_cv_objext" >&6; }
3162OBJEXT=$ac_cv_objext 2404OBJEXT=$ac_cv_objext
3163ac_objext=$OBJEXT 2405ac_objext=$OBJEXT
3164{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 2406{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
3165$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } 2407echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
3166if ${ac_cv_c_compiler_gnu+:} false; then : 2408if test "${ac_cv_c_compiler_gnu+set}" = set; then
3167 $as_echo_n "(cached) " >&6 2409 echo $ECHO_N "(cached) $ECHO_C" >&6
3168else 2410else
3169 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2411 cat >conftest.$ac_ext <<_ACEOF
2412/* confdefs.h. */
2413_ACEOF
2414cat confdefs.h >>conftest.$ac_ext
2415cat >>conftest.$ac_ext <<_ACEOF
3170/* end confdefs.h. */ 2416/* end confdefs.h. */
3171 2417
3172int 2418int
@@ -3180,34 +2426,54 @@ main ()
3180 return 0; 2426 return 0;
3181} 2427}
3182_ACEOF 2428_ACEOF
3183if ac_fn_c_try_compile "$LINENO"; then : 2429rm -f conftest.$ac_objext
2430if { (ac_try="$ac_compile"
2431case "(($ac_try" in
2432 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2433 *) ac_try_echo=$ac_try;;
2434esac
2435eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2436 (eval "$ac_compile") 2>conftest.er1
2437 ac_status=$?
2438 grep -v '^ *+' conftest.er1 >conftest.err
2439 rm -f conftest.er1
2440 cat conftest.err >&5
2441 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2442 (exit $ac_status); } && {
2443 test -z "$ac_c_werror_flag" ||
2444 test ! -s conftest.err
2445 } && test -s conftest.$ac_objext; then
3184 ac_compiler_gnu=yes 2446 ac_compiler_gnu=yes
3185else 2447else
3186 ac_compiler_gnu=no 2448 echo "$as_me: failed program was:" >&5
2449sed 's/^/| /' conftest.$ac_ext >&5
2450
2451 ac_compiler_gnu=no
3187fi 2452fi
2453
3188rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 2454rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3189ac_cv_c_compiler_gnu=$ac_compiler_gnu 2455ac_cv_c_compiler_gnu=$ac_compiler_gnu
3190 2456
3191fi 2457fi
3192{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 2458{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
3193$as_echo "$ac_cv_c_compiler_gnu" >&6; } 2459echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
3194if test $ac_compiler_gnu = yes; then 2460GCC=`test $ac_compiler_gnu = yes && echo yes`
3195 GCC=yes
3196else
3197 GCC=
3198fi
3199ac_test_CFLAGS=${CFLAGS+set} 2461ac_test_CFLAGS=${CFLAGS+set}
3200ac_save_CFLAGS=$CFLAGS 2462ac_save_CFLAGS=$CFLAGS
3201{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 2463{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
3202$as_echo_n "checking whether $CC accepts -g... " >&6; } 2464echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
3203if ${ac_cv_prog_cc_g+:} false; then : 2465if test "${ac_cv_prog_cc_g+set}" = set; then
3204 $as_echo_n "(cached) " >&6 2466 echo $ECHO_N "(cached) $ECHO_C" >&6
3205else 2467else
3206 ac_save_c_werror_flag=$ac_c_werror_flag 2468 ac_save_c_werror_flag=$ac_c_werror_flag
3207 ac_c_werror_flag=yes 2469 ac_c_werror_flag=yes
3208 ac_cv_prog_cc_g=no 2470 ac_cv_prog_cc_g=no
3209 CFLAGS="-g" 2471 CFLAGS="-g"
3210 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2472 cat >conftest.$ac_ext <<_ACEOF
2473/* confdefs.h. */
2474_ACEOF
2475cat confdefs.h >>conftest.$ac_ext
2476cat >>conftest.$ac_ext <<_ACEOF
3211/* end confdefs.h. */ 2477/* end confdefs.h. */
3212 2478
3213int 2479int
@@ -3218,11 +2484,34 @@ main ()
3218 return 0; 2484 return 0;
3219} 2485}
3220_ACEOF 2486_ACEOF
3221if ac_fn_c_try_compile "$LINENO"; then : 2487rm -f conftest.$ac_objext
2488if { (ac_try="$ac_compile"
2489case "(($ac_try" in
2490 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2491 *) ac_try_echo=$ac_try;;
2492esac
2493eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2494 (eval "$ac_compile") 2>conftest.er1
2495 ac_status=$?
2496 grep -v '^ *+' conftest.er1 >conftest.err
2497 rm -f conftest.er1
2498 cat conftest.err >&5
2499 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2500 (exit $ac_status); } && {
2501 test -z "$ac_c_werror_flag" ||
2502 test ! -s conftest.err
2503 } && test -s conftest.$ac_objext; then
3222 ac_cv_prog_cc_g=yes 2504 ac_cv_prog_cc_g=yes
3223else 2505else
3224 CFLAGS="" 2506 echo "$as_me: failed program was:" >&5
3225 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2507sed 's/^/| /' conftest.$ac_ext >&5
2508
2509 CFLAGS=""
2510 cat >conftest.$ac_ext <<_ACEOF
2511/* confdefs.h. */
2512_ACEOF
2513cat confdefs.h >>conftest.$ac_ext
2514cat >>conftest.$ac_ext <<_ACEOF
3226/* end confdefs.h. */ 2515/* end confdefs.h. */
3227 2516
3228int 2517int
@@ -3233,12 +2522,35 @@ main ()
3233 return 0; 2522 return 0;
3234} 2523}
3235_ACEOF 2524_ACEOF
3236if ac_fn_c_try_compile "$LINENO"; then : 2525rm -f conftest.$ac_objext
3237 2526if { (ac_try="$ac_compile"
2527case "(($ac_try" in
2528 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2529 *) ac_try_echo=$ac_try;;
2530esac
2531eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2532 (eval "$ac_compile") 2>conftest.er1
2533 ac_status=$?
2534 grep -v '^ *+' conftest.er1 >conftest.err
2535 rm -f conftest.er1
2536 cat conftest.err >&5
2537 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2538 (exit $ac_status); } && {
2539 test -z "$ac_c_werror_flag" ||
2540 test ! -s conftest.err
2541 } && test -s conftest.$ac_objext; then
2542 :
3238else 2543else
3239 ac_c_werror_flag=$ac_save_c_werror_flag 2544 echo "$as_me: failed program was:" >&5
2545sed 's/^/| /' conftest.$ac_ext >&5
2546
2547 ac_c_werror_flag=$ac_save_c_werror_flag
3240 CFLAGS="-g" 2548 CFLAGS="-g"
3241 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2549 cat >conftest.$ac_ext <<_ACEOF
2550/* confdefs.h. */
2551_ACEOF
2552cat confdefs.h >>conftest.$ac_ext
2553cat >>conftest.$ac_ext <<_ACEOF
3242/* end confdefs.h. */ 2554/* end confdefs.h. */
3243 2555
3244int 2556int
@@ -3249,18 +2561,42 @@ main ()
3249 return 0; 2561 return 0;
3250} 2562}
3251_ACEOF 2563_ACEOF
3252if ac_fn_c_try_compile "$LINENO"; then : 2564rm -f conftest.$ac_objext
2565if { (ac_try="$ac_compile"
2566case "(($ac_try" in
2567 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2568 *) ac_try_echo=$ac_try;;
2569esac
2570eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2571 (eval "$ac_compile") 2>conftest.er1
2572 ac_status=$?
2573 grep -v '^ *+' conftest.er1 >conftest.err
2574 rm -f conftest.er1
2575 cat conftest.err >&5
2576 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2577 (exit $ac_status); } && {
2578 test -z "$ac_c_werror_flag" ||
2579 test ! -s conftest.err
2580 } && test -s conftest.$ac_objext; then
3253 ac_cv_prog_cc_g=yes 2581 ac_cv_prog_cc_g=yes
2582else
2583 echo "$as_me: failed program was:" >&5
2584sed 's/^/| /' conftest.$ac_ext >&5
2585
2586
3254fi 2587fi
2588
3255rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 2589rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3256fi 2590fi
2591
3257rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 2592rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3258fi 2593fi
2594
3259rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 2595rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3260 ac_c_werror_flag=$ac_save_c_werror_flag 2596 ac_c_werror_flag=$ac_save_c_werror_flag
3261fi 2597fi
3262{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 2598{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
3263$as_echo "$ac_cv_prog_cc_g" >&6; } 2599echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
3264if test "$ac_test_CFLAGS" = set; then 2600if test "$ac_test_CFLAGS" = set; then
3265 CFLAGS=$ac_save_CFLAGS 2601 CFLAGS=$ac_save_CFLAGS
3266elif test $ac_cv_prog_cc_g = yes; then 2602elif test $ac_cv_prog_cc_g = yes; then
@@ -3276,14 +2612,18 @@ else
3276 CFLAGS= 2612 CFLAGS=
3277 fi 2613 fi
3278fi 2614fi
3279{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 2615{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
3280$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } 2616echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
3281if ${ac_cv_prog_cc_c89+:} false; then : 2617if test "${ac_cv_prog_cc_c89+set}" = set; then
3282 $as_echo_n "(cached) " >&6 2618 echo $ECHO_N "(cached) $ECHO_C" >&6
3283else 2619else
3284 ac_cv_prog_cc_c89=no 2620 ac_cv_prog_cc_c89=no
3285ac_save_CC=$CC 2621ac_save_CC=$CC
3286cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2622cat >conftest.$ac_ext <<_ACEOF
2623/* confdefs.h. */
2624_ACEOF
2625cat confdefs.h >>conftest.$ac_ext
2626cat >>conftest.$ac_ext <<_ACEOF
3287/* end confdefs.h. */ 2627/* end confdefs.h. */
3288#include <stdarg.h> 2628#include <stdarg.h>
3289#include <stdio.h> 2629#include <stdio.h>
@@ -3340,9 +2680,31 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
3340 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" 2680 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
3341do 2681do
3342 CC="$ac_save_CC $ac_arg" 2682 CC="$ac_save_CC $ac_arg"
3343 if ac_fn_c_try_compile "$LINENO"; then : 2683 rm -f conftest.$ac_objext
2684if { (ac_try="$ac_compile"
2685case "(($ac_try" in
2686 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2687 *) ac_try_echo=$ac_try;;
2688esac
2689eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2690 (eval "$ac_compile") 2>conftest.er1
2691 ac_status=$?
2692 grep -v '^ *+' conftest.er1 >conftest.err
2693 rm -f conftest.er1
2694 cat conftest.err >&5
2695 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2696 (exit $ac_status); } && {
2697 test -z "$ac_c_werror_flag" ||
2698 test ! -s conftest.err
2699 } && test -s conftest.$ac_objext; then
3344 ac_cv_prog_cc_c89=$ac_arg 2700 ac_cv_prog_cc_c89=$ac_arg
2701else
2702 echo "$as_me: failed program was:" >&5
2703sed 's/^/| /' conftest.$ac_ext >&5
2704
2705
3345fi 2706fi
2707
3346rm -f core conftest.err conftest.$ac_objext 2708rm -f core conftest.err conftest.$ac_objext
3347 test "x$ac_cv_prog_cc_c89" != "xno" && break 2709 test "x$ac_cv_prog_cc_c89" != "xno" && break
3348done 2710done
@@ -3353,19 +2715,17 @@ fi
3353# AC_CACHE_VAL 2715# AC_CACHE_VAL
3354case "x$ac_cv_prog_cc_c89" in 2716case "x$ac_cv_prog_cc_c89" in
3355 x) 2717 x)
3356 { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 2718 { echo "$as_me:$LINENO: result: none needed" >&5
3357$as_echo "none needed" >&6; } ;; 2719echo "${ECHO_T}none needed" >&6; } ;;
3358 xno) 2720 xno)
3359 { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 2721 { echo "$as_me:$LINENO: result: unsupported" >&5
3360$as_echo "unsupported" >&6; } ;; 2722echo "${ECHO_T}unsupported" >&6; } ;;
3361 *) 2723 *)
3362 CC="$CC $ac_cv_prog_cc_c89" 2724 CC="$CC $ac_cv_prog_cc_c89"
3363 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 2725 { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
3364$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; 2726echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
3365esac 2727esac
3366if test "x$ac_cv_prog_cc_c89" != xno; then :
3367 2728
3368fi
3369 2729
3370ac_ext=c 2730ac_ext=c
3371ac_cpp='$CPP $CPPFLAGS' 2731ac_cpp='$CPP $CPPFLAGS'
@@ -3390,7 +2750,9 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
3390 fi 2750 fi
3391done 2751done
3392if test -z "$ac_aux_dir"; then 2752if test -z "$ac_aux_dir"; then
3393 as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 2753 { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
2754echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
2755 { (exit 1); exit 1; }; }
3394fi 2756fi
3395 2757
3396# These three variables are undocumented and unsupported, 2758# These three variables are undocumented and unsupported,
@@ -3404,27 +2766,35 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
3404 2766
3405# Make sure we can run config.sub. 2767# Make sure we can run config.sub.
3406$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || 2768$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
3407 as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 2769 { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
2770echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
2771 { (exit 1); exit 1; }; }
3408 2772
3409{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 2773{ echo "$as_me:$LINENO: checking build system type" >&5
3410$as_echo_n "checking build system type... " >&6; } 2774echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
3411if ${ac_cv_build+:} false; then : 2775if test "${ac_cv_build+set}" = set; then
3412 $as_echo_n "(cached) " >&6 2776 echo $ECHO_N "(cached) $ECHO_C" >&6
3413else 2777else
3414 ac_build_alias=$build_alias 2778 ac_build_alias=$build_alias
3415test "x$ac_build_alias" = x && 2779test "x$ac_build_alias" = x &&
3416 ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` 2780 ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
3417test "x$ac_build_alias" = x && 2781test "x$ac_build_alias" = x &&
3418 as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 2782 { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
2783echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
2784 { (exit 1); exit 1; }; }
3419ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || 2785ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
3420 as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 2786 { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
2787echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
2788 { (exit 1); exit 1; }; }
3421 2789
3422fi 2790fi
3423{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 2791{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
3424$as_echo "$ac_cv_build" >&6; } 2792echo "${ECHO_T}$ac_cv_build" >&6; }
3425case $ac_cv_build in 2793case $ac_cv_build in
3426*-*-*) ;; 2794*-*-*) ;;
3427*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; 2795*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
2796echo "$as_me: error: invalid value of canonical build" >&2;}
2797 { (exit 1); exit 1; }; };;
3428esac 2798esac
3429build=$ac_cv_build 2799build=$ac_cv_build
3430ac_save_IFS=$IFS; IFS='-' 2800ac_save_IFS=$IFS; IFS='-'
@@ -3440,24 +2810,28 @@ IFS=$ac_save_IFS
3440case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac 2810case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
3441 2811
3442 2812
3443{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 2813{ echo "$as_me:$LINENO: checking host system type" >&5
3444$as_echo_n "checking host system type... " >&6; } 2814echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
3445if ${ac_cv_host+:} false; then : 2815if test "${ac_cv_host+set}" = set; then
3446 $as_echo_n "(cached) " >&6 2816 echo $ECHO_N "(cached) $ECHO_C" >&6
3447else 2817else
3448 if test "x$host_alias" = x; then 2818 if test "x$host_alias" = x; then
3449 ac_cv_host=$ac_cv_build 2819 ac_cv_host=$ac_cv_build
3450else 2820else
3451 ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || 2821 ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
3452 as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 2822 { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
2823echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
2824 { (exit 1); exit 1; }; }
3453fi 2825fi
3454 2826
3455fi 2827fi
3456{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 2828{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
3457$as_echo "$ac_cv_host" >&6; } 2829echo "${ECHO_T}$ac_cv_host" >&6; }
3458case $ac_cv_host in 2830case $ac_cv_host in
3459*-*-*) ;; 2831*-*-*) ;;
3460*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; 2832*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
2833echo "$as_me: error: invalid value of canonical host" >&2;}
2834 { (exit 1); exit 1; }; };;
3461esac 2835esac
3462host=$ac_cv_host 2836host=$ac_cv_host
3463ac_save_IFS=$IFS; IFS='-' 2837ac_save_IFS=$IFS; IFS='-'
@@ -3479,15 +2853,15 @@ ac_cpp='$CPP $CPPFLAGS'
3479ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' 2853ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3480ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' 2854ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
3481ac_compiler_gnu=$ac_cv_c_compiler_gnu 2855ac_compiler_gnu=$ac_cv_c_compiler_gnu
3482{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 2856{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
3483$as_echo_n "checking how to run the C preprocessor... " >&6; } 2857echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
3484# On Suns, sometimes $CPP names a directory. 2858# On Suns, sometimes $CPP names a directory.
3485if test -n "$CPP" && test -d "$CPP"; then 2859if test -n "$CPP" && test -d "$CPP"; then
3486 CPP= 2860 CPP=
3487fi 2861fi
3488if test -z "$CPP"; then 2862if test -z "$CPP"; then
3489 if ${ac_cv_prog_CPP+:} false; then : 2863 if test "${ac_cv_prog_CPP+set}" = set; then
3490 $as_echo_n "(cached) " >&6 2864 echo $ECHO_N "(cached) $ECHO_C" >&6
3491else 2865else
3492 # Double quotes because CPP needs to be expanded 2866 # Double quotes because CPP needs to be expanded
3493 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" 2867 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
@@ -3501,7 +2875,11 @@ do
3501 # <limits.h> exists even on freestanding compilers. 2875 # <limits.h> exists even on freestanding compilers.
3502 # On the NeXT, cc -E runs the code through the compiler's parser, 2876 # On the NeXT, cc -E runs the code through the compiler's parser,
3503 # not just through cpp. "Syntax error" is here to catch this case. 2877 # not just through cpp. "Syntax error" is here to catch this case.
3504 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2878 cat >conftest.$ac_ext <<_ACEOF
2879/* confdefs.h. */
2880_ACEOF
2881cat confdefs.h >>conftest.$ac_ext
2882cat >>conftest.$ac_ext <<_ACEOF
3505/* end confdefs.h. */ 2883/* end confdefs.h. */
3506#ifdef __STDC__ 2884#ifdef __STDC__
3507# include <limits.h> 2885# include <limits.h>
@@ -3510,34 +2888,76 @@ do
3510#endif 2888#endif
3511 Syntax error 2889 Syntax error
3512_ACEOF 2890_ACEOF
3513if ac_fn_c_try_cpp "$LINENO"; then : 2891if { (ac_try="$ac_cpp conftest.$ac_ext"
3514 2892case "(($ac_try" in
2893 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2894 *) ac_try_echo=$ac_try;;
2895esac
2896eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2897 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
2898 ac_status=$?
2899 grep -v '^ *+' conftest.er1 >conftest.err
2900 rm -f conftest.er1
2901 cat conftest.err >&5
2902 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2903 (exit $ac_status); } >/dev/null && {
2904 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
2905 test ! -s conftest.err
2906 }; then
2907 :
3515else 2908else
2909 echo "$as_me: failed program was:" >&5
2910sed 's/^/| /' conftest.$ac_ext >&5
2911
3516 # Broken: fails on valid input. 2912 # Broken: fails on valid input.
3517continue 2913continue
3518fi 2914fi
3519rm -f conftest.err conftest.i conftest.$ac_ext 2915
2916rm -f conftest.err conftest.$ac_ext
3520 2917
3521 # OK, works on sane cases. Now check whether nonexistent headers 2918 # OK, works on sane cases. Now check whether nonexistent headers
3522 # can be detected and how. 2919 # can be detected and how.
3523 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2920 cat >conftest.$ac_ext <<_ACEOF
2921/* confdefs.h. */
2922_ACEOF
2923cat confdefs.h >>conftest.$ac_ext
2924cat >>conftest.$ac_ext <<_ACEOF
3524/* end confdefs.h. */ 2925/* end confdefs.h. */
3525#include <ac_nonexistent.h> 2926#include <ac_nonexistent.h>
3526_ACEOF 2927_ACEOF
3527if ac_fn_c_try_cpp "$LINENO"; then : 2928if { (ac_try="$ac_cpp conftest.$ac_ext"
2929case "(($ac_try" in
2930 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2931 *) ac_try_echo=$ac_try;;
2932esac
2933eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2934 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
2935 ac_status=$?
2936 grep -v '^ *+' conftest.er1 >conftest.err
2937 rm -f conftest.er1
2938 cat conftest.err >&5
2939 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2940 (exit $ac_status); } >/dev/null && {
2941 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
2942 test ! -s conftest.err
2943 }; then
3528 # Broken: success on invalid input. 2944 # Broken: success on invalid input.
3529continue 2945continue
3530else 2946else
2947 echo "$as_me: failed program was:" >&5
2948sed 's/^/| /' conftest.$ac_ext >&5
2949
3531 # Passes both tests. 2950 # Passes both tests.
3532ac_preproc_ok=: 2951ac_preproc_ok=:
3533break 2952break
3534fi 2953fi
3535rm -f conftest.err conftest.i conftest.$ac_ext 2954
2955rm -f conftest.err conftest.$ac_ext
3536 2956
3537done 2957done
3538# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. 2958# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
3539rm -f conftest.i conftest.err conftest.$ac_ext 2959rm -f conftest.err conftest.$ac_ext
3540if $ac_preproc_ok; then : 2960if $ac_preproc_ok; then
3541 break 2961 break
3542fi 2962fi
3543 2963
@@ -3549,8 +2969,8 @@ fi
3549else 2969else
3550 ac_cv_prog_CPP=$CPP 2970 ac_cv_prog_CPP=$CPP
3551fi 2971fi
3552{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 2972{ echo "$as_me:$LINENO: result: $CPP" >&5
3553$as_echo "$CPP" >&6; } 2973echo "${ECHO_T}$CPP" >&6; }
3554ac_preproc_ok=false 2974ac_preproc_ok=false
3555for ac_c_preproc_warn_flag in '' yes 2975for ac_c_preproc_warn_flag in '' yes
3556do 2976do
@@ -3560,7 +2980,11 @@ do
3560 # <limits.h> exists even on freestanding compilers. 2980 # <limits.h> exists even on freestanding compilers.
3561 # On the NeXT, cc -E runs the code through the compiler's parser, 2981 # On the NeXT, cc -E runs the code through the compiler's parser,
3562 # not just through cpp. "Syntax error" is here to catch this case. 2982 # not just through cpp. "Syntax error" is here to catch this case.
3563 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2983 cat >conftest.$ac_ext <<_ACEOF
2984/* confdefs.h. */
2985_ACEOF
2986cat confdefs.h >>conftest.$ac_ext
2987cat >>conftest.$ac_ext <<_ACEOF
3564/* end confdefs.h. */ 2988/* end confdefs.h. */
3565#ifdef __STDC__ 2989#ifdef __STDC__
3566# include <limits.h> 2990# include <limits.h>
@@ -3569,40 +2993,83 @@ do
3569#endif 2993#endif
3570 Syntax error 2994 Syntax error
3571_ACEOF 2995_ACEOF
3572if ac_fn_c_try_cpp "$LINENO"; then : 2996if { (ac_try="$ac_cpp conftest.$ac_ext"
3573 2997case "(($ac_try" in
2998 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2999 *) ac_try_echo=$ac_try;;
3000esac
3001eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3002 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
3003 ac_status=$?
3004 grep -v '^ *+' conftest.er1 >conftest.err
3005 rm -f conftest.er1
3006 cat conftest.err >&5
3007 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3008 (exit $ac_status); } >/dev/null && {
3009 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
3010 test ! -s conftest.err
3011 }; then
3012 :
3574else 3013else
3014 echo "$as_me: failed program was:" >&5
3015sed 's/^/| /' conftest.$ac_ext >&5
3016
3575 # Broken: fails on valid input. 3017 # Broken: fails on valid input.
3576continue 3018continue
3577fi 3019fi
3578rm -f conftest.err conftest.i conftest.$ac_ext 3020
3021rm -f conftest.err conftest.$ac_ext
3579 3022
3580 # OK, works on sane cases. Now check whether nonexistent headers 3023 # OK, works on sane cases. Now check whether nonexistent headers
3581 # can be detected and how. 3024 # can be detected and how.
3582 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3025 cat >conftest.$ac_ext <<_ACEOF
3026/* confdefs.h. */
3027_ACEOF
3028cat confdefs.h >>conftest.$ac_ext
3029cat >>conftest.$ac_ext <<_ACEOF
3583/* end confdefs.h. */ 3030/* end confdefs.h. */
3584#include <ac_nonexistent.h> 3031#include <ac_nonexistent.h>
3585_ACEOF 3032_ACEOF
3586if ac_fn_c_try_cpp "$LINENO"; then : 3033if { (ac_try="$ac_cpp conftest.$ac_ext"
3034case "(($ac_try" in
3035 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3036 *) ac_try_echo=$ac_try;;
3037esac
3038eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3039 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
3040 ac_status=$?
3041 grep -v '^ *+' conftest.er1 >conftest.err
3042 rm -f conftest.er1
3043 cat conftest.err >&5
3044 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3045 (exit $ac_status); } >/dev/null && {
3046 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
3047 test ! -s conftest.err
3048 }; then
3587 # Broken: success on invalid input. 3049 # Broken: success on invalid input.
3588continue 3050continue
3589else 3051else
3052 echo "$as_me: failed program was:" >&5
3053sed 's/^/| /' conftest.$ac_ext >&5
3054
3590 # Passes both tests. 3055 # Passes both tests.
3591ac_preproc_ok=: 3056ac_preproc_ok=:
3592break 3057break
3593fi 3058fi
3594rm -f conftest.err conftest.i conftest.$ac_ext 3059
3060rm -f conftest.err conftest.$ac_ext
3595 3061
3596done 3062done
3597# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. 3063# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
3598rm -f conftest.i conftest.err conftest.$ac_ext 3064rm -f conftest.err conftest.$ac_ext
3599if $ac_preproc_ok; then : 3065if $ac_preproc_ok; then
3600 3066 :
3601else 3067else
3602 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 3068 { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
3603$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 3069See \`config.log' for more details." >&5
3604as_fn_error $? "C preprocessor \"$CPP\" fails sanity check 3070echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
3605See \`config.log' for more details" "$LINENO" 5; } 3071See \`config.log' for more details." >&2;}
3072 { (exit 1); exit 1; }; }
3606fi 3073fi
3607 3074
3608ac_ext=c 3075ac_ext=c
@@ -3612,40 +3079,45 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
3612ac_compiler_gnu=$ac_cv_c_compiler_gnu 3079ac_compiler_gnu=$ac_cv_c_compiler_gnu
3613 3080
3614 3081
3615{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 3082{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
3616$as_echo_n "checking for grep that handles long lines and -e... " >&6; } 3083echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
3617if ${ac_cv_path_GREP+:} false; then : 3084if test "${ac_cv_path_GREP+set}" = set; then
3618 $as_echo_n "(cached) " >&6 3085 echo $ECHO_N "(cached) $ECHO_C" >&6
3086else
3087 # Extract the first word of "grep ggrep" to use in msg output
3088if test -z "$GREP"; then
3089set dummy grep ggrep; ac_prog_name=$2
3090if test "${ac_cv_path_GREP+set}" = set; then
3091 echo $ECHO_N "(cached) $ECHO_C" >&6
3619else 3092else
3620 if test -z "$GREP"; then
3621 ac_path_GREP_found=false 3093 ac_path_GREP_found=false
3622 # Loop through the user's path and test for each of PROGNAME-LIST 3094# Loop through the user's path and test for each of PROGNAME-LIST
3623 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 3095as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3624for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin 3096for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
3625do 3097do
3626 IFS=$as_save_IFS 3098 IFS=$as_save_IFS
3627 test -z "$as_dir" && as_dir=. 3099 test -z "$as_dir" && as_dir=.
3628 for ac_prog in grep ggrep; do 3100 for ac_prog in grep ggrep; do
3629 for ac_exec_ext in '' $ac_executable_extensions; do 3101 for ac_exec_ext in '' $ac_executable_extensions; do
3630 ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" 3102 ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
3631 { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue 3103 { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
3632# Check for GNU ac_path_GREP and select it if it is found. 3104 # Check for GNU ac_path_GREP and select it if it is found.
3633 # Check for GNU $ac_path_GREP 3105 # Check for GNU $ac_path_GREP
3634case `"$ac_path_GREP" --version 2>&1` in 3106case `"$ac_path_GREP" --version 2>&1` in
3635*GNU*) 3107*GNU*)
3636 ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; 3108 ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
3637*) 3109*)
3638 ac_count=0 3110 ac_count=0
3639 $as_echo_n 0123456789 >"conftest.in" 3111 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
3640 while : 3112 while :
3641 do 3113 do
3642 cat "conftest.in" "conftest.in" >"conftest.tmp" 3114 cat "conftest.in" "conftest.in" >"conftest.tmp"
3643 mv "conftest.tmp" "conftest.in" 3115 mv "conftest.tmp" "conftest.in"
3644 cp "conftest.in" "conftest.nl" 3116 cp "conftest.in" "conftest.nl"
3645 $as_echo 'GREP' >> "conftest.nl" 3117 echo 'GREP' >> "conftest.nl"
3646 "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break 3118 "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
3647 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break 3119 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
3648 as_fn_arith $ac_count + 1 && ac_count=$as_val 3120 ac_count=`expr $ac_count + 1`
3649 if test $ac_count -gt ${ac_path_GREP_max-0}; then 3121 if test $ac_count -gt ${ac_path_GREP_max-0}; then
3650 # Best one so far, save it but keep looking for a better one 3122 # Best one so far, save it but keep looking for a better one
3651 ac_cv_path_GREP="$ac_path_GREP" 3123 ac_cv_path_GREP="$ac_path_GREP"
@@ -3657,61 +3129,77 @@ case `"$ac_path_GREP" --version 2>&1` in
3657 rm -f conftest.in conftest.tmp conftest.nl conftest.out;; 3129 rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
3658esac 3130esac
3659 3131
3660 $ac_path_GREP_found && break 3 3132
3661 done 3133 $ac_path_GREP_found && break 3
3662 done
3663 done 3134 done
3135done
3136
3137done
3664IFS=$as_save_IFS 3138IFS=$as_save_IFS
3665 if test -z "$ac_cv_path_GREP"; then 3139
3666 as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 3140
3667 fi 3141fi
3142
3143GREP="$ac_cv_path_GREP"
3144if test -z "$GREP"; then
3145 { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
3146echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
3147 { (exit 1); exit 1; }; }
3148fi
3149
3668else 3150else
3669 ac_cv_path_GREP=$GREP 3151 ac_cv_path_GREP=$GREP
3670fi 3152fi
3671 3153
3154
3672fi 3155fi
3673{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 3156{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
3674$as_echo "$ac_cv_path_GREP" >&6; } 3157echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
3675 GREP="$ac_cv_path_GREP" 3158 GREP="$ac_cv_path_GREP"
3676 3159
3677 3160
3678{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 3161{ echo "$as_me:$LINENO: checking for egrep" >&5
3679$as_echo_n "checking for egrep... " >&6; } 3162echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
3680if ${ac_cv_path_EGREP+:} false; then : 3163if test "${ac_cv_path_EGREP+set}" = set; then
3681 $as_echo_n "(cached) " >&6 3164 echo $ECHO_N "(cached) $ECHO_C" >&6
3682else 3165else
3683 if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 3166 if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
3684 then ac_cv_path_EGREP="$GREP -E" 3167 then ac_cv_path_EGREP="$GREP -E"
3685 else 3168 else
3686 if test -z "$EGREP"; then 3169 # Extract the first word of "egrep" to use in msg output
3170if test -z "$EGREP"; then
3171set dummy egrep; ac_prog_name=$2
3172if test "${ac_cv_path_EGREP+set}" = set; then
3173 echo $ECHO_N "(cached) $ECHO_C" >&6
3174else
3687 ac_path_EGREP_found=false 3175 ac_path_EGREP_found=false
3688 # Loop through the user's path and test for each of PROGNAME-LIST 3176# Loop through the user's path and test for each of PROGNAME-LIST
3689 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 3177as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3690for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin 3178for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
3691do 3179do
3692 IFS=$as_save_IFS 3180 IFS=$as_save_IFS
3693 test -z "$as_dir" && as_dir=. 3181 test -z "$as_dir" && as_dir=.
3694 for ac_prog in egrep; do 3182 for ac_prog in egrep; do
3695 for ac_exec_ext in '' $ac_executable_extensions; do 3183 for ac_exec_ext in '' $ac_executable_extensions; do
3696 ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" 3184 ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
3697 { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue 3185 { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
3698# Check for GNU ac_path_EGREP and select it if it is found. 3186 # Check for GNU ac_path_EGREP and select it if it is found.
3699 # Check for GNU $ac_path_EGREP 3187 # Check for GNU $ac_path_EGREP
3700case `"$ac_path_EGREP" --version 2>&1` in 3188case `"$ac_path_EGREP" --version 2>&1` in
3701*GNU*) 3189*GNU*)
3702 ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; 3190 ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
3703*) 3191*)
3704 ac_count=0 3192 ac_count=0
3705 $as_echo_n 0123456789 >"conftest.in" 3193 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
3706 while : 3194 while :
3707 do 3195 do
3708 cat "conftest.in" "conftest.in" >"conftest.tmp" 3196 cat "conftest.in" "conftest.in" >"conftest.tmp"
3709 mv "conftest.tmp" "conftest.in" 3197 mv "conftest.tmp" "conftest.in"
3710 cp "conftest.in" "conftest.nl" 3198 cp "conftest.in" "conftest.nl"
3711 $as_echo 'EGREP' >> "conftest.nl" 3199 echo 'EGREP' >> "conftest.nl"
3712 "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break 3200 "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
3713 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break 3201 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
3714 as_fn_arith $ac_count + 1 && ac_count=$as_val 3202 ac_count=`expr $ac_count + 1`
3715 if test $ac_count -gt ${ac_path_EGREP_max-0}; then 3203 if test $ac_count -gt ${ac_path_EGREP_max-0}; then
3716 # Best one so far, save it but keep looking for a better one 3204 # Best one so far, save it but keep looking for a better one
3717 ac_cv_path_EGREP="$ac_path_EGREP" 3205 ac_cv_path_EGREP="$ac_path_EGREP"
@@ -3723,31 +3211,46 @@ case `"$ac_path_EGREP" --version 2>&1` in
3723 rm -f conftest.in conftest.tmp conftest.nl conftest.out;; 3211 rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
3724esac 3212esac
3725 3213
3726 $ac_path_EGREP_found && break 3 3214
3727 done 3215 $ac_path_EGREP_found && break 3
3728 done
3729 done 3216 done
3217done
3218
3219done
3730IFS=$as_save_IFS 3220IFS=$as_save_IFS
3731 if test -z "$ac_cv_path_EGREP"; then 3221
3732 as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 3222
3733 fi 3223fi
3224
3225EGREP="$ac_cv_path_EGREP"
3226if test -z "$EGREP"; then
3227 { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
3228echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
3229 { (exit 1); exit 1; }; }
3230fi
3231
3734else 3232else
3735 ac_cv_path_EGREP=$EGREP 3233 ac_cv_path_EGREP=$EGREP
3736fi 3234fi
3737 3235
3236
3738 fi 3237 fi
3739fi 3238fi
3740{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 3239{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
3741$as_echo "$ac_cv_path_EGREP" >&6; } 3240echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
3742 EGREP="$ac_cv_path_EGREP" 3241 EGREP="$ac_cv_path_EGREP"
3743 3242
3744 3243
3745{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 3244{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
3746$as_echo_n "checking for ANSI C header files... " >&6; } 3245echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
3747if ${ac_cv_header_stdc+:} false; then : 3246if test "${ac_cv_header_stdc+set}" = set; then
3748 $as_echo_n "(cached) " >&6 3247 echo $ECHO_N "(cached) $ECHO_C" >&6
3749else 3248else
3750 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3249 cat >conftest.$ac_ext <<_ACEOF
3250/* confdefs.h. */
3251_ACEOF
3252cat confdefs.h >>conftest.$ac_ext
3253cat >>conftest.$ac_ext <<_ACEOF
3751/* end confdefs.h. */ 3254/* end confdefs.h. */
3752#include <stdlib.h> 3255#include <stdlib.h>
3753#include <stdarg.h> 3256#include <stdarg.h>
@@ -3762,23 +3265,47 @@ main ()
3762 return 0; 3265 return 0;
3763} 3266}
3764_ACEOF 3267_ACEOF
3765if ac_fn_c_try_compile "$LINENO"; then : 3268rm -f conftest.$ac_objext
3269if { (ac_try="$ac_compile"
3270case "(($ac_try" in
3271 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3272 *) ac_try_echo=$ac_try;;
3273esac
3274eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3275 (eval "$ac_compile") 2>conftest.er1
3276 ac_status=$?
3277 grep -v '^ *+' conftest.er1 >conftest.err
3278 rm -f conftest.er1
3279 cat conftest.err >&5
3280 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3281 (exit $ac_status); } && {
3282 test -z "$ac_c_werror_flag" ||
3283 test ! -s conftest.err
3284 } && test -s conftest.$ac_objext; then
3766 ac_cv_header_stdc=yes 3285 ac_cv_header_stdc=yes
3767else 3286else
3768 ac_cv_header_stdc=no 3287 echo "$as_me: failed program was:" >&5
3288sed 's/^/| /' conftest.$ac_ext >&5
3289
3290 ac_cv_header_stdc=no
3769fi 3291fi
3292
3770rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3293rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3771 3294
3772if test $ac_cv_header_stdc = yes; then 3295if test $ac_cv_header_stdc = yes; then
3773 # SunOS 4.x string.h does not declare mem*, contrary to ANSI. 3296 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
3774 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3297 cat >conftest.$ac_ext <<_ACEOF
3298/* confdefs.h. */
3299_ACEOF
3300cat confdefs.h >>conftest.$ac_ext
3301cat >>conftest.$ac_ext <<_ACEOF
3775/* end confdefs.h. */ 3302/* end confdefs.h. */
3776#include <string.h> 3303#include <string.h>
3777 3304
3778_ACEOF 3305_ACEOF
3779if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 3306if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3780 $EGREP "memchr" >/dev/null 2>&1; then : 3307 $EGREP "memchr" >/dev/null 2>&1; then
3781 3308 :
3782else 3309else
3783 ac_cv_header_stdc=no 3310 ac_cv_header_stdc=no
3784fi 3311fi
@@ -3788,14 +3315,18 @@ fi
3788 3315
3789if test $ac_cv_header_stdc = yes; then 3316if test $ac_cv_header_stdc = yes; then
3790 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. 3317 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
3791 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3318 cat >conftest.$ac_ext <<_ACEOF
3319/* confdefs.h. */
3320_ACEOF
3321cat confdefs.h >>conftest.$ac_ext
3322cat >>conftest.$ac_ext <<_ACEOF
3792/* end confdefs.h. */ 3323/* end confdefs.h. */
3793#include <stdlib.h> 3324#include <stdlib.h>
3794 3325
3795_ACEOF 3326_ACEOF
3796if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 3327if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3797 $EGREP "free" >/dev/null 2>&1; then : 3328 $EGREP "free" >/dev/null 2>&1; then
3798 3329 :
3799else 3330else
3800 ac_cv_header_stdc=no 3331 ac_cv_header_stdc=no
3801fi 3332fi
@@ -3805,10 +3336,14 @@ fi
3805 3336
3806if test $ac_cv_header_stdc = yes; then 3337if test $ac_cv_header_stdc = yes; then
3807 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. 3338 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
3808 if test "$cross_compiling" = yes; then : 3339 if test "$cross_compiling" = yes; then
3809 : 3340 :
3810else 3341else
3811 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3342 cat >conftest.$ac_ext <<_ACEOF
3343/* confdefs.h. */
3344_ACEOF
3345cat confdefs.h >>conftest.$ac_ext
3346cat >>conftest.$ac_ext <<_ACEOF
3812/* end confdefs.h. */ 3347/* end confdefs.h. */
3813#include <ctype.h> 3348#include <ctype.h>
3814#include <stdlib.h> 3349#include <stdlib.h>
@@ -3835,35 +3370,113 @@ main ()
3835 return 0; 3370 return 0;
3836} 3371}
3837_ACEOF 3372_ACEOF
3838if ac_fn_c_try_run "$LINENO"; then : 3373rm -f conftest$ac_exeext
3839 3374if { (ac_try="$ac_link"
3375case "(($ac_try" in
3376 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3377 *) ac_try_echo=$ac_try;;
3378esac
3379eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3380 (eval "$ac_link") 2>&5
3381 ac_status=$?
3382 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3383 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
3384 { (case "(($ac_try" in
3385 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3386 *) ac_try_echo=$ac_try;;
3387esac
3388eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3389 (eval "$ac_try") 2>&5
3390 ac_status=$?
3391 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3392 (exit $ac_status); }; }; then
3393 :
3840else 3394else
3841 ac_cv_header_stdc=no 3395 echo "$as_me: program exited with status $ac_status" >&5
3396echo "$as_me: failed program was:" >&5
3397sed 's/^/| /' conftest.$ac_ext >&5
3398
3399( exit $ac_status )
3400ac_cv_header_stdc=no
3842fi 3401fi
3843rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 3402rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
3844 conftest.$ac_objext conftest.beam conftest.$ac_ext
3845fi 3403fi
3846 3404
3405
3847fi 3406fi
3848fi 3407fi
3849{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 3408{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
3850$as_echo "$ac_cv_header_stdc" >&6; } 3409echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
3851if test $ac_cv_header_stdc = yes; then 3410if test $ac_cv_header_stdc = yes; then
3852 3411
3853$as_echo "#define STDC_HEADERS 1" >>confdefs.h 3412cat >>confdefs.h <<\_ACEOF
3413#define STDC_HEADERS 1
3414_ACEOF
3854 3415
3855fi 3416fi
3856 3417
3857# On IRIX 5.3, sys/types and inttypes.h are conflicting. 3418# On IRIX 5.3, sys/types and inttypes.h are conflicting.
3419
3420
3421
3422
3423
3424
3425
3426
3427
3858for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ 3428for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
3859 inttypes.h stdint.h unistd.h 3429 inttypes.h stdint.h unistd.h
3860do : 3430do
3861 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 3431as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
3862ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default 3432{ echo "$as_me:$LINENO: checking for $ac_header" >&5
3863" 3433echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
3864if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : 3434if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
3435 echo $ECHO_N "(cached) $ECHO_C" >&6
3436else
3437 cat >conftest.$ac_ext <<_ACEOF
3438/* confdefs.h. */
3439_ACEOF
3440cat confdefs.h >>conftest.$ac_ext
3441cat >>conftest.$ac_ext <<_ACEOF
3442/* end confdefs.h. */
3443$ac_includes_default
3444
3445#include <$ac_header>
3446_ACEOF
3447rm -f conftest.$ac_objext
3448if { (ac_try="$ac_compile"
3449case "(($ac_try" in
3450 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3451 *) ac_try_echo=$ac_try;;
3452esac
3453eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3454 (eval "$ac_compile") 2>conftest.er1
3455 ac_status=$?
3456 grep -v '^ *+' conftest.er1 >conftest.err
3457 rm -f conftest.er1
3458 cat conftest.err >&5
3459 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3460 (exit $ac_status); } && {
3461 test -z "$ac_c_werror_flag" ||
3462 test ! -s conftest.err
3463 } && test -s conftest.$ac_objext; then
3464 eval "$as_ac_Header=yes"
3465else
3466 echo "$as_me: failed program was:" >&5
3467sed 's/^/| /' conftest.$ac_ext >&5
3468
3469 eval "$as_ac_Header=no"
3470fi
3471
3472rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3473fi
3474ac_res=`eval echo '${'$as_ac_Header'}'`
3475 { echo "$as_me:$LINENO: result: $ac_res" >&5
3476echo "${ECHO_T}$ac_res" >&6; }
3477if test `eval echo '${'$as_ac_Header'}'` = yes; then
3865 cat >>confdefs.h <<_ACEOF 3478 cat >>confdefs.h <<_ACEOF
3866#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 3479#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
3867_ACEOF 3480_ACEOF
3868 3481
3869fi 3482fi
@@ -3871,229 +3484,241 @@ fi
3871done 3484done
3872 3485
3873 3486
3874 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 3487{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
3875$as_echo_n "checking whether byte ordering is bigendian... " >&6; } 3488echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
3876if ${ac_cv_c_bigendian+:} false; then : 3489if test "${ac_cv_c_bigendian+set}" = set; then
3877 $as_echo_n "(cached) " >&6 3490 echo $ECHO_N "(cached) $ECHO_C" >&6
3878else 3491else
3879 ac_cv_c_bigendian=unknown 3492 # See if sys/param.h defines the BYTE_ORDER macro.
3880 # See if we're dealing with a universal compiler. 3493cat >conftest.$ac_ext <<_ACEOF
3881 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3494/* confdefs.h. */
3882/* end confdefs.h. */ 3495_ACEOF
3883#ifndef __APPLE_CC__ 3496cat confdefs.h >>conftest.$ac_ext
3884 not a universal capable compiler 3497cat >>conftest.$ac_ext <<_ACEOF
3885 #endif
3886 typedef int dummy;
3887
3888_ACEOF
3889if ac_fn_c_try_compile "$LINENO"; then :
3890
3891 # Check for potential -arch flags. It is not universal unless
3892 # there are at least two -arch flags with different values.
3893 ac_arch=
3894 ac_prev=
3895 for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
3896 if test -n "$ac_prev"; then
3897 case $ac_word in
3898 i?86 | x86_64 | ppc | ppc64)
3899 if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
3900 ac_arch=$ac_word
3901 else
3902 ac_cv_c_bigendian=universal
3903 break
3904 fi
3905 ;;
3906 esac
3907 ac_prev=
3908 elif test "x$ac_word" = "x-arch"; then
3909 ac_prev=arch
3910 fi
3911 done
3912fi
3913rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3914 if test $ac_cv_c_bigendian = unknown; then
3915 # See if sys/param.h defines the BYTE_ORDER macro.
3916 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3917/* end confdefs.h. */ 3498/* end confdefs.h. */
3918#include <sys/types.h> 3499#include <sys/types.h>
3919 #include <sys/param.h> 3500#include <sys/param.h>
3920 3501
3921int 3502int
3922main () 3503main ()
3923{ 3504{
3924#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ 3505#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
3925 && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ 3506 && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
3926 && LITTLE_ENDIAN) 3507 bogus endian macros
3927 bogus endian macros 3508#endif
3928 #endif
3929 3509
3930 ; 3510 ;
3931 return 0; 3511 return 0;
3932} 3512}
3933_ACEOF 3513_ACEOF
3934if ac_fn_c_try_compile "$LINENO"; then : 3514rm -f conftest.$ac_objext
3515if { (ac_try="$ac_compile"
3516case "(($ac_try" in
3517 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3518 *) ac_try_echo=$ac_try;;
3519esac
3520eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3521 (eval "$ac_compile") 2>conftest.er1
3522 ac_status=$?
3523 grep -v '^ *+' conftest.er1 >conftest.err
3524 rm -f conftest.er1
3525 cat conftest.err >&5
3526 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3527 (exit $ac_status); } && {
3528 test -z "$ac_c_werror_flag" ||
3529 test ! -s conftest.err
3530 } && test -s conftest.$ac_objext; then
3935 # It does; now see whether it defined to BIG_ENDIAN or not. 3531 # It does; now see whether it defined to BIG_ENDIAN or not.
3936 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3532cat >conftest.$ac_ext <<_ACEOF
3533/* confdefs.h. */
3534_ACEOF
3535cat confdefs.h >>conftest.$ac_ext
3536cat >>conftest.$ac_ext <<_ACEOF
3937/* end confdefs.h. */ 3537/* end confdefs.h. */
3938#include <sys/types.h> 3538#include <sys/types.h>
3939 #include <sys/param.h> 3539#include <sys/param.h>
3940 3540
3941int 3541int
3942main () 3542main ()
3943{ 3543{
3944#if BYTE_ORDER != BIG_ENDIAN 3544#if BYTE_ORDER != BIG_ENDIAN
3945 not big endian 3545 not big endian
3946 #endif 3546#endif
3947 3547
3948 ; 3548 ;
3949 return 0; 3549 return 0;
3950} 3550}
3951_ACEOF 3551_ACEOF
3952if ac_fn_c_try_compile "$LINENO"; then : 3552rm -f conftest.$ac_objext
3553if { (ac_try="$ac_compile"
3554case "(($ac_try" in
3555 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3556 *) ac_try_echo=$ac_try;;
3557esac
3558eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3559 (eval "$ac_compile") 2>conftest.er1
3560 ac_status=$?
3561 grep -v '^ *+' conftest.er1 >conftest.err
3562 rm -f conftest.er1
3563 cat conftest.err >&5
3564 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3565 (exit $ac_status); } && {
3566 test -z "$ac_c_werror_flag" ||
3567 test ! -s conftest.err
3568 } && test -s conftest.$ac_objext; then
3953 ac_cv_c_bigendian=yes 3569 ac_cv_c_bigendian=yes
3954else 3570else
3955 ac_cv_c_bigendian=no 3571 echo "$as_me: failed program was:" >&5
3956fi 3572sed 's/^/| /' conftest.$ac_ext >&5
3957rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3573
3574 ac_cv_c_bigendian=no
3958fi 3575fi
3959rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3960 fi
3961 if test $ac_cv_c_bigendian = unknown; then
3962 # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
3963 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3964/* end confdefs.h. */
3965#include <limits.h>
3966 3576
3967int 3577rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3968main () 3578else
3969{ 3579 echo "$as_me: failed program was:" >&5
3970#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) 3580sed 's/^/| /' conftest.$ac_ext >&5
3971 bogus endian macros
3972 #endif
3973 3581
3974 ; 3582 # It does not; compile a test program.
3975 return 0; 3583if test "$cross_compiling" = yes; then
3976} 3584 # try to guess the endianness by grepping values into an object file
3585 ac_cv_c_bigendian=unknown
3586 cat >conftest.$ac_ext <<_ACEOF
3587/* confdefs.h. */
3977_ACEOF 3588_ACEOF
3978if ac_fn_c_try_compile "$LINENO"; then : 3589cat confdefs.h >>conftest.$ac_ext
3979 # It does; now see whether it defined to _BIG_ENDIAN or not. 3590cat >>conftest.$ac_ext <<_ACEOF
3980 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3981/* end confdefs.h. */ 3591/* end confdefs.h. */
3982#include <limits.h> 3592short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
3983 3593short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
3594void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
3595short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
3596short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
3597void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
3984int 3598int
3985main () 3599main ()
3986{ 3600{
3987#ifndef _BIG_ENDIAN 3601 _ascii (); _ebcdic ();
3988 not big endian
3989 #endif
3990
3991 ; 3602 ;
3992 return 0; 3603 return 0;
3993} 3604}
3994_ACEOF 3605_ACEOF
3995if ac_fn_c_try_compile "$LINENO"; then : 3606rm -f conftest.$ac_objext
3607if { (ac_try="$ac_compile"
3608case "(($ac_try" in
3609 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3610 *) ac_try_echo=$ac_try;;
3611esac
3612eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3613 (eval "$ac_compile") 2>conftest.er1
3614 ac_status=$?
3615 grep -v '^ *+' conftest.er1 >conftest.err
3616 rm -f conftest.er1
3617 cat conftest.err >&5
3618 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3619 (exit $ac_status); } && {
3620 test -z "$ac_c_werror_flag" ||
3621 test ! -s conftest.err
3622 } && test -s conftest.$ac_objext; then
3623 if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
3996 ac_cv_c_bigendian=yes 3624 ac_cv_c_bigendian=yes
3997else
3998 ac_cv_c_bigendian=no
3999fi 3625fi
4000rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3626if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
3627 if test "$ac_cv_c_bigendian" = unknown; then
3628 ac_cv_c_bigendian=no
3629 else
3630 # finding both strings is unlikely to happen, but who knows?
3631 ac_cv_c_bigendian=unknown
3632 fi
4001fi 3633fi
4002rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3634else
4003 fi 3635 echo "$as_me: failed program was:" >&5
4004 if test $ac_cv_c_bigendian = unknown; then 3636sed 's/^/| /' conftest.$ac_ext >&5
4005 # Compile a test program. 3637
4006 if test "$cross_compiling" = yes; then :
4007 # Try to guess by grepping values from an object file.
4008 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4009/* end confdefs.h. */
4010short int ascii_mm[] =
4011 { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
4012 short int ascii_ii[] =
4013 { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
4014 int use_ascii (int i) {
4015 return ascii_mm[i] + ascii_ii[i];
4016 }
4017 short int ebcdic_ii[] =
4018 { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
4019 short int ebcdic_mm[] =
4020 { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
4021 int use_ebcdic (int i) {
4022 return ebcdic_mm[i] + ebcdic_ii[i];
4023 }
4024 extern int foo;
4025 3638
4026int
4027main ()
4028{
4029return use_ascii (foo) == use_ebcdic (foo);
4030 ;
4031 return 0;
4032}
4033_ACEOF
4034if ac_fn_c_try_compile "$LINENO"; then :
4035 if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
4036 ac_cv_c_bigendian=yes
4037 fi
4038 if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
4039 if test "$ac_cv_c_bigendian" = unknown; then
4040 ac_cv_c_bigendian=no
4041 else
4042 # finding both strings is unlikely to happen, but who knows?
4043 ac_cv_c_bigendian=unknown
4044 fi
4045 fi
4046fi 3639fi
3640
4047rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3641rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4048else 3642else
4049 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3643 cat >conftest.$ac_ext <<_ACEOF
3644/* confdefs.h. */
3645_ACEOF
3646cat confdefs.h >>conftest.$ac_ext
3647cat >>conftest.$ac_ext <<_ACEOF
4050/* end confdefs.h. */ 3648/* end confdefs.h. */
4051$ac_includes_default 3649$ac_includes_default
4052int 3650int
4053main () 3651main ()
4054{ 3652{
4055 3653
4056 /* Are we little or big endian? From Harbison&Steele. */ 3654 /* Are we little or big endian? From Harbison&Steele. */
4057 union 3655 union
4058 { 3656 {
4059 long int l; 3657 long int l;
4060 char c[sizeof (long int)]; 3658 char c[sizeof (long int)];
4061 } u; 3659 } u;
4062 u.l = 1; 3660 u.l = 1;
4063 return u.c[sizeof (long int) - 1] == 1; 3661 return u.c[sizeof (long int) - 1] == 1;
4064 3662
4065 ; 3663 ;
4066 return 0; 3664 return 0;
4067} 3665}
4068_ACEOF 3666_ACEOF
4069if ac_fn_c_try_run "$LINENO"; then : 3667rm -f conftest$ac_exeext
3668if { (ac_try="$ac_link"
3669case "(($ac_try" in
3670 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3671 *) ac_try_echo=$ac_try;;
3672esac
3673eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3674 (eval "$ac_link") 2>&5
3675 ac_status=$?
3676 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3677 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
3678 { (case "(($ac_try" in
3679 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3680 *) ac_try_echo=$ac_try;;
3681esac
3682eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3683 (eval "$ac_try") 2>&5
3684 ac_status=$?
3685 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3686 (exit $ac_status); }; }; then
4070 ac_cv_c_bigendian=no 3687 ac_cv_c_bigendian=no
4071else 3688else
4072 ac_cv_c_bigendian=yes 3689 echo "$as_me: program exited with status $ac_status" >&5
3690echo "$as_me: failed program was:" >&5
3691sed 's/^/| /' conftest.$ac_ext >&5
3692
3693( exit $ac_status )
3694ac_cv_c_bigendian=yes
4073fi 3695fi
4074rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 3696rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
4075 conftest.$ac_objext conftest.beam conftest.$ac_ext
4076fi 3697fi
4077 3698
4078 fi 3699
4079fi 3700fi
4080{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
4081$as_echo "$ac_cv_c_bigendian" >&6; }
4082 case $ac_cv_c_bigendian in #(
4083 yes)
4084 $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
4085;; #(
4086 no)
4087 ;; #(
4088 universal)
4089 3701
4090$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h 3702rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3703fi
3704{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
3705echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
3706case $ac_cv_c_bigendian in
3707 yes)
4091 3708
4092 ;; #( 3709cat >>confdefs.h <<\_ACEOF
4093 *) 3710#define WORDS_BIGENDIAN 1
4094 as_fn_error $? "unknown endianness 3711_ACEOF
4095 presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; 3712 ;;
4096 esac 3713 no)
3714 ;;
3715 *)
3716 { { echo "$as_me:$LINENO: error: unknown endianness
3717presetting ac_cv_c_bigendian=no (or yes) will help" >&5
3718echo "$as_me: error: unknown endianness
3719presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
3720 { (exit 1); exit 1; }; } ;;
3721esac
4097 3722
4098 3723
4099# Checks for programs. 3724# Checks for programs.
@@ -4101,10 +3726,10 @@ for ac_prog in gawk mawk nawk awk
4101do 3726do
4102 # Extract the first word of "$ac_prog", so it can be a program name with args. 3727 # Extract the first word of "$ac_prog", so it can be a program name with args.
4103set dummy $ac_prog; ac_word=$2 3728set dummy $ac_prog; ac_word=$2
4104{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 3729{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4105$as_echo_n "checking for $ac_word... " >&6; } 3730echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4106if ${ac_cv_prog_AWK+:} false; then : 3731if test "${ac_cv_prog_AWK+set}" = set; then
4107 $as_echo_n "(cached) " >&6 3732 echo $ECHO_N "(cached) $ECHO_C" >&6
4108else 3733else
4109 if test -n "$AWK"; then 3734 if test -n "$AWK"; then
4110 ac_cv_prog_AWK="$AWK" # Let the user override the test. 3735 ac_cv_prog_AWK="$AWK" # Let the user override the test.
@@ -4114,25 +3739,25 @@ for as_dir in $PATH
4114do 3739do
4115 IFS=$as_save_IFS 3740 IFS=$as_save_IFS
4116 test -z "$as_dir" && as_dir=. 3741 test -z "$as_dir" && as_dir=.
4117 for ac_exec_ext in '' $ac_executable_extensions; do 3742 for ac_exec_ext in '' $ac_executable_extensions; do
4118 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 3743 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4119 ac_cv_prog_AWK="$ac_prog" 3744 ac_cv_prog_AWK="$ac_prog"
4120 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 3745 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4121 break 2 3746 break 2
4122 fi 3747 fi
4123done 3748done
4124 done 3749done
4125IFS=$as_save_IFS 3750IFS=$as_save_IFS
4126 3751
4127fi 3752fi
4128fi 3753fi
4129AWK=$ac_cv_prog_AWK 3754AWK=$ac_cv_prog_AWK
4130if test -n "$AWK"; then 3755if test -n "$AWK"; then
4131 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 3756 { echo "$as_me:$LINENO: result: $AWK" >&5
4132$as_echo "$AWK" >&6; } 3757echo "${ECHO_T}$AWK" >&6; }
4133else 3758else
4134 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 3759 { echo "$as_me:$LINENO: result: no" >&5
4135$as_echo "no" >&6; } 3760echo "${ECHO_T}no" >&6; }
4136fi 3761fi
4137 3762
4138 3763
@@ -4144,15 +3769,15 @@ ac_cpp='$CPP $CPPFLAGS'
4144ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' 3769ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4145ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' 3770ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
4146ac_compiler_gnu=$ac_cv_c_compiler_gnu 3771ac_compiler_gnu=$ac_cv_c_compiler_gnu
4147{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 3772{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
4148$as_echo_n "checking how to run the C preprocessor... " >&6; } 3773echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
4149# On Suns, sometimes $CPP names a directory. 3774# On Suns, sometimes $CPP names a directory.
4150if test -n "$CPP" && test -d "$CPP"; then 3775if test -n "$CPP" && test -d "$CPP"; then
4151 CPP= 3776 CPP=
4152fi 3777fi
4153if test -z "$CPP"; then 3778if test -z "$CPP"; then
4154 if ${ac_cv_prog_CPP+:} false; then : 3779 if test "${ac_cv_prog_CPP+set}" = set; then
4155 $as_echo_n "(cached) " >&6 3780 echo $ECHO_N "(cached) $ECHO_C" >&6
4156else 3781else
4157 # Double quotes because CPP needs to be expanded 3782 # Double quotes because CPP needs to be expanded
4158 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" 3783 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
@@ -4166,7 +3791,11 @@ do
4166 # <limits.h> exists even on freestanding compilers. 3791 # <limits.h> exists even on freestanding compilers.
4167 # On the NeXT, cc -E runs the code through the compiler's parser, 3792 # On the NeXT, cc -E runs the code through the compiler's parser,
4168 # not just through cpp. "Syntax error" is here to catch this case. 3793 # not just through cpp. "Syntax error" is here to catch this case.
4169 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3794 cat >conftest.$ac_ext <<_ACEOF
3795/* confdefs.h. */
3796_ACEOF
3797cat confdefs.h >>conftest.$ac_ext
3798cat >>conftest.$ac_ext <<_ACEOF
4170/* end confdefs.h. */ 3799/* end confdefs.h. */
4171#ifdef __STDC__ 3800#ifdef __STDC__
4172# include <limits.h> 3801# include <limits.h>
@@ -4175,34 +3804,76 @@ do
4175#endif 3804#endif
4176 Syntax error 3805 Syntax error
4177_ACEOF 3806_ACEOF
4178if ac_fn_c_try_cpp "$LINENO"; then : 3807if { (ac_try="$ac_cpp conftest.$ac_ext"
4179 3808case "(($ac_try" in
3809 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3810 *) ac_try_echo=$ac_try;;
3811esac
3812eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3813 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
3814 ac_status=$?
3815 grep -v '^ *+' conftest.er1 >conftest.err
3816 rm -f conftest.er1
3817 cat conftest.err >&5
3818 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3819 (exit $ac_status); } >/dev/null && {
3820 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
3821 test ! -s conftest.err
3822 }; then
3823 :
4180else 3824else
3825 echo "$as_me: failed program was:" >&5
3826sed 's/^/| /' conftest.$ac_ext >&5
3827
4181 # Broken: fails on valid input. 3828 # Broken: fails on valid input.
4182continue 3829continue
4183fi 3830fi
4184rm -f conftest.err conftest.i conftest.$ac_ext 3831
3832rm -f conftest.err conftest.$ac_ext
4185 3833
4186 # OK, works on sane cases. Now check whether nonexistent headers 3834 # OK, works on sane cases. Now check whether nonexistent headers
4187 # can be detected and how. 3835 # can be detected and how.
4188 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3836 cat >conftest.$ac_ext <<_ACEOF
3837/* confdefs.h. */
3838_ACEOF
3839cat confdefs.h >>conftest.$ac_ext
3840cat >>conftest.$ac_ext <<_ACEOF
4189/* end confdefs.h. */ 3841/* end confdefs.h. */
4190#include <ac_nonexistent.h> 3842#include <ac_nonexistent.h>
4191_ACEOF 3843_ACEOF
4192if ac_fn_c_try_cpp "$LINENO"; then : 3844if { (ac_try="$ac_cpp conftest.$ac_ext"
3845case "(($ac_try" in
3846 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3847 *) ac_try_echo=$ac_try;;
3848esac
3849eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3850 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
3851 ac_status=$?
3852 grep -v '^ *+' conftest.er1 >conftest.err
3853 rm -f conftest.er1
3854 cat conftest.err >&5
3855 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3856 (exit $ac_status); } >/dev/null && {
3857 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
3858 test ! -s conftest.err
3859 }; then
4193 # Broken: success on invalid input. 3860 # Broken: success on invalid input.
4194continue 3861continue
4195else 3862else
3863 echo "$as_me: failed program was:" >&5
3864sed 's/^/| /' conftest.$ac_ext >&5
3865
4196 # Passes both tests. 3866 # Passes both tests.
4197ac_preproc_ok=: 3867ac_preproc_ok=:
4198break 3868break
4199fi 3869fi
4200rm -f conftest.err conftest.i conftest.$ac_ext 3870
3871rm -f conftest.err conftest.$ac_ext
4201 3872
4202done 3873done
4203# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. 3874# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
4204rm -f conftest.i conftest.err conftest.$ac_ext 3875rm -f conftest.err conftest.$ac_ext
4205if $ac_preproc_ok; then : 3876if $ac_preproc_ok; then
4206 break 3877 break
4207fi 3878fi
4208 3879
@@ -4214,8 +3885,8 @@ fi
4214else 3885else
4215 ac_cv_prog_CPP=$CPP 3886 ac_cv_prog_CPP=$CPP
4216fi 3887fi
4217{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 3888{ echo "$as_me:$LINENO: result: $CPP" >&5
4218$as_echo "$CPP" >&6; } 3889echo "${ECHO_T}$CPP" >&6; }
4219ac_preproc_ok=false 3890ac_preproc_ok=false
4220for ac_c_preproc_warn_flag in '' yes 3891for ac_c_preproc_warn_flag in '' yes
4221do 3892do
@@ -4225,7 +3896,11 @@ do
4225 # <limits.h> exists even on freestanding compilers. 3896 # <limits.h> exists even on freestanding compilers.
4226 # On the NeXT, cc -E runs the code through the compiler's parser, 3897 # On the NeXT, cc -E runs the code through the compiler's parser,
4227 # not just through cpp. "Syntax error" is here to catch this case. 3898 # not just through cpp. "Syntax error" is here to catch this case.
4228 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3899 cat >conftest.$ac_ext <<_ACEOF
3900/* confdefs.h. */
3901_ACEOF
3902cat confdefs.h >>conftest.$ac_ext
3903cat >>conftest.$ac_ext <<_ACEOF
4229/* end confdefs.h. */ 3904/* end confdefs.h. */
4230#ifdef __STDC__ 3905#ifdef __STDC__
4231# include <limits.h> 3906# include <limits.h>
@@ -4234,40 +3909,83 @@ do
4234#endif 3909#endif
4235 Syntax error 3910 Syntax error
4236_ACEOF 3911_ACEOF
4237if ac_fn_c_try_cpp "$LINENO"; then : 3912if { (ac_try="$ac_cpp conftest.$ac_ext"
4238 3913case "(($ac_try" in
3914 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3915 *) ac_try_echo=$ac_try;;
3916esac
3917eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3918 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
3919 ac_status=$?
3920 grep -v '^ *+' conftest.er1 >conftest.err
3921 rm -f conftest.er1
3922 cat conftest.err >&5
3923 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3924 (exit $ac_status); } >/dev/null && {
3925 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
3926 test ! -s conftest.err
3927 }; then
3928 :
4239else 3929else
3930 echo "$as_me: failed program was:" >&5
3931sed 's/^/| /' conftest.$ac_ext >&5
3932
4240 # Broken: fails on valid input. 3933 # Broken: fails on valid input.
4241continue 3934continue
4242fi 3935fi
4243rm -f conftest.err conftest.i conftest.$ac_ext 3936
3937rm -f conftest.err conftest.$ac_ext
4244 3938
4245 # OK, works on sane cases. Now check whether nonexistent headers 3939 # OK, works on sane cases. Now check whether nonexistent headers
4246 # can be detected and how. 3940 # can be detected and how.
4247 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3941 cat >conftest.$ac_ext <<_ACEOF
3942/* confdefs.h. */
3943_ACEOF
3944cat confdefs.h >>conftest.$ac_ext
3945cat >>conftest.$ac_ext <<_ACEOF
4248/* end confdefs.h. */ 3946/* end confdefs.h. */
4249#include <ac_nonexistent.h> 3947#include <ac_nonexistent.h>
4250_ACEOF 3948_ACEOF
4251if ac_fn_c_try_cpp "$LINENO"; then : 3949if { (ac_try="$ac_cpp conftest.$ac_ext"
3950case "(($ac_try" in
3951 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3952 *) ac_try_echo=$ac_try;;
3953esac
3954eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3955 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
3956 ac_status=$?
3957 grep -v '^ *+' conftest.er1 >conftest.err
3958 rm -f conftest.er1
3959 cat conftest.err >&5
3960 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3961 (exit $ac_status); } >/dev/null && {
3962 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
3963 test ! -s conftest.err
3964 }; then
4252 # Broken: success on invalid input. 3965 # Broken: success on invalid input.
4253continue 3966continue
4254else 3967else
3968 echo "$as_me: failed program was:" >&5
3969sed 's/^/| /' conftest.$ac_ext >&5
3970
4255 # Passes both tests. 3971 # Passes both tests.
4256ac_preproc_ok=: 3972ac_preproc_ok=:
4257break 3973break
4258fi 3974fi
4259rm -f conftest.err conftest.i conftest.$ac_ext 3975
3976rm -f conftest.err conftest.$ac_ext
4260 3977
4261done 3978done
4262# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. 3979# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
4263rm -f conftest.i conftest.err conftest.$ac_ext 3980rm -f conftest.err conftest.$ac_ext
4264if $ac_preproc_ok; then : 3981if $ac_preproc_ok; then
4265 3982 :
4266else 3983else
4267 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 3984 { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
4268$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 3985See \`config.log' for more details." >&5
4269as_fn_error $? "C preprocessor \"$CPP\" fails sanity check 3986echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
4270See \`config.log' for more details" "$LINENO" 5; } 3987See \`config.log' for more details." >&2;}
3988 { (exit 1); exit 1; }; }
4271fi 3989fi
4272 3990
4273ac_ext=c 3991ac_ext=c
@@ -4279,10 +3997,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
4279if test -n "$ac_tool_prefix"; then 3997if test -n "$ac_tool_prefix"; then
4280 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. 3998 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
4281set dummy ${ac_tool_prefix}ranlib; ac_word=$2 3999set dummy ${ac_tool_prefix}ranlib; ac_word=$2
4282{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4000{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4283$as_echo_n "checking for $ac_word... " >&6; } 4001echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4284if ${ac_cv_prog_RANLIB+:} false; then : 4002if test "${ac_cv_prog_RANLIB+set}" = set; then
4285 $as_echo_n "(cached) " >&6 4003 echo $ECHO_N "(cached) $ECHO_C" >&6
4286else 4004else
4287 if test -n "$RANLIB"; then 4005 if test -n "$RANLIB"; then
4288 ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. 4006 ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
@@ -4292,25 +4010,25 @@ for as_dir in $PATH
4292do 4010do
4293 IFS=$as_save_IFS 4011 IFS=$as_save_IFS
4294 test -z "$as_dir" && as_dir=. 4012 test -z "$as_dir" && as_dir=.
4295 for ac_exec_ext in '' $ac_executable_extensions; do 4013 for ac_exec_ext in '' $ac_executable_extensions; do
4296 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4014 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4297 ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" 4015 ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
4298 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4016 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4299 break 2 4017 break 2
4300 fi 4018 fi
4301done 4019done
4302 done 4020done
4303IFS=$as_save_IFS 4021IFS=$as_save_IFS
4304 4022
4305fi 4023fi
4306fi 4024fi
4307RANLIB=$ac_cv_prog_RANLIB 4025RANLIB=$ac_cv_prog_RANLIB
4308if test -n "$RANLIB"; then 4026if test -n "$RANLIB"; then
4309 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 4027 { echo "$as_me:$LINENO: result: $RANLIB" >&5
4310$as_echo "$RANLIB" >&6; } 4028echo "${ECHO_T}$RANLIB" >&6; }
4311else 4029else
4312 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4030 { echo "$as_me:$LINENO: result: no" >&5
4313$as_echo "no" >&6; } 4031echo "${ECHO_T}no" >&6; }
4314fi 4032fi
4315 4033
4316 4034
@@ -4319,10 +4037,10 @@ if test -z "$ac_cv_prog_RANLIB"; then
4319 ac_ct_RANLIB=$RANLIB 4037 ac_ct_RANLIB=$RANLIB
4320 # Extract the first word of "ranlib", so it can be a program name with args. 4038 # Extract the first word of "ranlib", so it can be a program name with args.
4321set dummy ranlib; ac_word=$2 4039set dummy ranlib; ac_word=$2
4322{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4040{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4323$as_echo_n "checking for $ac_word... " >&6; } 4041echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4324if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : 4042if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
4325 $as_echo_n "(cached) " >&6 4043 echo $ECHO_N "(cached) $ECHO_C" >&6
4326else 4044else
4327 if test -n "$ac_ct_RANLIB"; then 4045 if test -n "$ac_ct_RANLIB"; then
4328 ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. 4046 ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
@@ -4332,25 +4050,25 @@ for as_dir in $PATH
4332do 4050do
4333 IFS=$as_save_IFS 4051 IFS=$as_save_IFS
4334 test -z "$as_dir" && as_dir=. 4052 test -z "$as_dir" && as_dir=.
4335 for ac_exec_ext in '' $ac_executable_extensions; do 4053 for ac_exec_ext in '' $ac_executable_extensions; do
4336 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4054 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4337 ac_cv_prog_ac_ct_RANLIB="ranlib" 4055 ac_cv_prog_ac_ct_RANLIB="ranlib"
4338 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4056 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4339 break 2 4057 break 2
4340 fi 4058 fi
4341done 4059done
4342 done 4060done
4343IFS=$as_save_IFS 4061IFS=$as_save_IFS
4344 4062
4345fi 4063fi
4346fi 4064fi
4347ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB 4065ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
4348if test -n "$ac_ct_RANLIB"; then 4066if test -n "$ac_ct_RANLIB"; then
4349 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 4067 { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
4350$as_echo "$ac_ct_RANLIB" >&6; } 4068echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
4351else 4069else
4352 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4070 { echo "$as_me:$LINENO: result: no" >&5
4353$as_echo "no" >&6; } 4071echo "${ECHO_T}no" >&6; }
4354fi 4072fi
4355 4073
4356 if test "x$ac_ct_RANLIB" = x; then 4074 if test "x$ac_ct_RANLIB" = x; then
@@ -4358,8 +4076,12 @@ fi
4358 else 4076 else
4359 case $cross_compiling:$ac_tool_warned in 4077 case $cross_compiling:$ac_tool_warned in
4360yes:) 4078yes:)
4361{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 4079{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
4362$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} 4080whose name does not start with the host triplet. If you think this
4081configuration is useful to you, please write to autoconf@gnu.org." >&5
4082echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
4083whose name does not start with the host triplet. If you think this
4084configuration is useful to you, please write to autoconf@gnu.org." >&2;}
4363ac_tool_warned=yes ;; 4085ac_tool_warned=yes ;;
4364esac 4086esac
4365 RANLIB=$ac_ct_RANLIB 4087 RANLIB=$ac_ct_RANLIB
@@ -4381,23 +4103,22 @@ fi
4381# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" 4103# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
4382# OS/2's system install, which has a completely different semantic 4104# OS/2's system install, which has a completely different semantic
4383# ./install, which can be erroneously created by make from ./install.sh. 4105# ./install, which can be erroneously created by make from ./install.sh.
4384# Reject install programs that cannot install multiple files. 4106{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
4385{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 4107echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
4386$as_echo_n "checking for a BSD-compatible install... " >&6; }
4387if test -z "$INSTALL"; then 4108if test -z "$INSTALL"; then
4388if ${ac_cv_path_install+:} false; then : 4109if test "${ac_cv_path_install+set}" = set; then
4389 $as_echo_n "(cached) " >&6 4110 echo $ECHO_N "(cached) $ECHO_C" >&6
4390else 4111else
4391 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 4112 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4392for as_dir in $PATH 4113for as_dir in $PATH
4393do 4114do
4394 IFS=$as_save_IFS 4115 IFS=$as_save_IFS
4395 test -z "$as_dir" && as_dir=. 4116 test -z "$as_dir" && as_dir=.
4396 # Account for people who put trailing slashes in PATH elements. 4117 # Account for people who put trailing slashes in PATH elements.
4397case $as_dir/ in #(( 4118case $as_dir/ in
4398 ./ | .// | /[cC]/* | \ 4119 ./ | .// | /cC/* | \
4399 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ 4120 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
4400 ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ 4121 ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
4401 /usr/ucb/* ) ;; 4122 /usr/ucb/* ) ;;
4402 *) 4123 *)
4403 # OSF1 and SCO ODT 3.0 have their own names for install. 4124 # OSF1 and SCO ODT 3.0 have their own names for install.
@@ -4415,29 +4136,17 @@ case $as_dir/ in #((
4415 # program-specific install script used by HP pwplus--don't use. 4136 # program-specific install script used by HP pwplus--don't use.
4416 : 4137 :
4417 else 4138 else
4418 rm -rf conftest.one conftest.two conftest.dir 4139 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
4419 echo one > conftest.one 4140 break 3
4420 echo two > conftest.two
4421 mkdir conftest.dir
4422 if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
4423 test -s conftest.one && test -s conftest.two &&
4424 test -s conftest.dir/conftest.one &&
4425 test -s conftest.dir/conftest.two
4426 then
4427 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
4428 break 3
4429 fi
4430 fi 4141 fi
4431 fi 4142 fi
4432 done 4143 done
4433 done 4144 done
4434 ;; 4145 ;;
4435esac 4146esac
4436 4147done
4437 done
4438IFS=$as_save_IFS 4148IFS=$as_save_IFS
4439 4149
4440rm -rf conftest.one conftest.two conftest.dir
4441 4150
4442fi 4151fi
4443 if test "${ac_cv_path_install+set}" = set; then 4152 if test "${ac_cv_path_install+set}" = set; then
@@ -4450,8 +4159,8 @@ fi
4450 INSTALL=$ac_install_sh 4159 INSTALL=$ac_install_sh
4451 fi 4160 fi
4452fi 4161fi
4453{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 4162{ echo "$as_me:$LINENO: result: $INSTALL" >&5
4454$as_echo "$INSTALL" >&6; } 4163echo "${ECHO_T}$INSTALL" >&6; }
4455 4164
4456# Use test -z because SunOS4 sh mishandles braces in ${var-val}. 4165# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
4457# It thinks the first close brace ends the variable substitution. 4166# It thinks the first close brace ends the variable substitution.
@@ -4461,43 +4170,48 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
4461 4170
4462test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' 4171test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
4463 4172
4464{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 4173{ echo "$as_me:$LINENO: checking for egrep" >&5
4465$as_echo_n "checking for egrep... " >&6; } 4174echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
4466if ${ac_cv_path_EGREP+:} false; then : 4175if test "${ac_cv_path_EGREP+set}" = set; then
4467 $as_echo_n "(cached) " >&6 4176 echo $ECHO_N "(cached) $ECHO_C" >&6
4468else 4177else
4469 if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 4178 if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
4470 then ac_cv_path_EGREP="$GREP -E" 4179 then ac_cv_path_EGREP="$GREP -E"
4471 else 4180 else
4472 if test -z "$EGREP"; then 4181 # Extract the first word of "egrep" to use in msg output
4182if test -z "$EGREP"; then
4183set dummy egrep; ac_prog_name=$2
4184if test "${ac_cv_path_EGREP+set}" = set; then
4185 echo $ECHO_N "(cached) $ECHO_C" >&6
4186else
4473 ac_path_EGREP_found=false 4187 ac_path_EGREP_found=false
4474 # Loop through the user's path and test for each of PROGNAME-LIST 4188# Loop through the user's path and test for each of PROGNAME-LIST
4475 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 4189as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4476for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin 4190for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
4477do 4191do
4478 IFS=$as_save_IFS 4192 IFS=$as_save_IFS
4479 test -z "$as_dir" && as_dir=. 4193 test -z "$as_dir" && as_dir=.
4480 for ac_prog in egrep; do 4194 for ac_prog in egrep; do
4481 for ac_exec_ext in '' $ac_executable_extensions; do 4195 for ac_exec_ext in '' $ac_executable_extensions; do
4482 ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" 4196 ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
4483 { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue 4197 { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
4484# Check for GNU ac_path_EGREP and select it if it is found. 4198 # Check for GNU ac_path_EGREP and select it if it is found.
4485 # Check for GNU $ac_path_EGREP 4199 # Check for GNU $ac_path_EGREP
4486case `"$ac_path_EGREP" --version 2>&1` in 4200case `"$ac_path_EGREP" --version 2>&1` in
4487*GNU*) 4201*GNU*)
4488 ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; 4202 ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
4489*) 4203*)
4490 ac_count=0 4204 ac_count=0
4491 $as_echo_n 0123456789 >"conftest.in" 4205 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
4492 while : 4206 while :
4493 do 4207 do
4494 cat "conftest.in" "conftest.in" >"conftest.tmp" 4208 cat "conftest.in" "conftest.in" >"conftest.tmp"
4495 mv "conftest.tmp" "conftest.in" 4209 mv "conftest.tmp" "conftest.in"
4496 cp "conftest.in" "conftest.nl" 4210 cp "conftest.in" "conftest.nl"
4497 $as_echo 'EGREP' >> "conftest.nl" 4211 echo 'EGREP' >> "conftest.nl"
4498 "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break 4212 "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
4499 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break 4213 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
4500 as_fn_arith $ac_count + 1 && ac_count=$as_val 4214 ac_count=`expr $ac_count + 1`
4501 if test $ac_count -gt ${ac_path_EGREP_max-0}; then 4215 if test $ac_count -gt ${ac_path_EGREP_max-0}; then
4502 # Best one so far, save it but keep looking for a better one 4216 # Best one so far, save it but keep looking for a better one
4503 ac_cv_path_EGREP="$ac_path_EGREP" 4217 ac_cv_path_EGREP="$ac_path_EGREP"
@@ -4509,31 +4223,42 @@ case `"$ac_path_EGREP" --version 2>&1` in
4509 rm -f conftest.in conftest.tmp conftest.nl conftest.out;; 4223 rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
4510esac 4224esac
4511 4225
4512 $ac_path_EGREP_found && break 3 4226
4513 done 4227 $ac_path_EGREP_found && break 3
4514 done
4515 done 4228 done
4229done
4230
4231done
4516IFS=$as_save_IFS 4232IFS=$as_save_IFS
4517 if test -z "$ac_cv_path_EGREP"; then 4233
4518 as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 4234
4519 fi 4235fi
4236
4237EGREP="$ac_cv_path_EGREP"
4238if test -z "$EGREP"; then
4239 { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
4240echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
4241 { (exit 1); exit 1; }; }
4242fi
4243
4520else 4244else
4521 ac_cv_path_EGREP=$EGREP 4245 ac_cv_path_EGREP=$EGREP
4522fi 4246fi
4523 4247
4248
4524 fi 4249 fi
4525fi 4250fi
4526{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 4251{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
4527$as_echo "$ac_cv_path_EGREP" >&6; } 4252echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
4528 EGREP="$ac_cv_path_EGREP" 4253 EGREP="$ac_cv_path_EGREP"
4529 4254
4530 4255
4531# Extract the first word of "ar", so it can be a program name with args. 4256# Extract the first word of "ar", so it can be a program name with args.
4532set dummy ar; ac_word=$2 4257set dummy ar; ac_word=$2
4533{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4258{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4534$as_echo_n "checking for $ac_word... " >&6; } 4259echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4535if ${ac_cv_path_AR+:} false; then : 4260if test "${ac_cv_path_AR+set}" = set; then
4536 $as_echo_n "(cached) " >&6 4261 echo $ECHO_N "(cached) $ECHO_C" >&6
4537else 4262else
4538 case $AR in 4263 case $AR in
4539 [\\/]* | ?:[\\/]*) 4264 [\\/]* | ?:[\\/]*)
@@ -4545,14 +4270,14 @@ for as_dir in $PATH
4545do 4270do
4546 IFS=$as_save_IFS 4271 IFS=$as_save_IFS
4547 test -z "$as_dir" && as_dir=. 4272 test -z "$as_dir" && as_dir=.
4548 for ac_exec_ext in '' $ac_executable_extensions; do 4273 for ac_exec_ext in '' $ac_executable_extensions; do
4549 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4274 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4550 ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" 4275 ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
4551 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4276 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4552 break 2 4277 break 2
4553 fi 4278 fi
4554done 4279done
4555 done 4280done
4556IFS=$as_save_IFS 4281IFS=$as_save_IFS
4557 4282
4558 ;; 4283 ;;
@@ -4560,20 +4285,20 @@ esac
4560fi 4285fi
4561AR=$ac_cv_path_AR 4286AR=$ac_cv_path_AR
4562if test -n "$AR"; then 4287if test -n "$AR"; then
4563 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 4288 { echo "$as_me:$LINENO: result: $AR" >&5
4564$as_echo "$AR" >&6; } 4289echo "${ECHO_T}$AR" >&6; }
4565else 4290else
4566 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4291 { echo "$as_me:$LINENO: result: no" >&5
4567$as_echo "no" >&6; } 4292echo "${ECHO_T}no" >&6; }
4568fi 4293fi
4569 4294
4570 4295
4571# Extract the first word of "cat", so it can be a program name with args. 4296# Extract the first word of "cat", so it can be a program name with args.
4572set dummy cat; ac_word=$2 4297set dummy cat; ac_word=$2
4573{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4298{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4574$as_echo_n "checking for $ac_word... " >&6; } 4299echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4575if ${ac_cv_path_CAT+:} false; then : 4300if test "${ac_cv_path_CAT+set}" = set; then
4576 $as_echo_n "(cached) " >&6 4301 echo $ECHO_N "(cached) $ECHO_C" >&6
4577else 4302else
4578 case $CAT in 4303 case $CAT in
4579 [\\/]* | ?:[\\/]*) 4304 [\\/]* | ?:[\\/]*)
@@ -4585,14 +4310,14 @@ for as_dir in $PATH
4585do 4310do
4586 IFS=$as_save_IFS 4311 IFS=$as_save_IFS
4587 test -z "$as_dir" && as_dir=. 4312 test -z "$as_dir" && as_dir=.
4588 for ac_exec_ext in '' $ac_executable_extensions; do 4313 for ac_exec_ext in '' $ac_executable_extensions; do
4589 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4314 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4590 ac_cv_path_CAT="$as_dir/$ac_word$ac_exec_ext" 4315 ac_cv_path_CAT="$as_dir/$ac_word$ac_exec_ext"
4591 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4316 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4592 break 2 4317 break 2
4593 fi 4318 fi
4594done 4319done
4595 done 4320done
4596IFS=$as_save_IFS 4321IFS=$as_save_IFS
4597 4322
4598 ;; 4323 ;;
@@ -4600,20 +4325,20 @@ esac
4600fi 4325fi
4601CAT=$ac_cv_path_CAT 4326CAT=$ac_cv_path_CAT
4602if test -n "$CAT"; then 4327if test -n "$CAT"; then
4603 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAT" >&5 4328 { echo "$as_me:$LINENO: result: $CAT" >&5
4604$as_echo "$CAT" >&6; } 4329echo "${ECHO_T}$CAT" >&6; }
4605else 4330else
4606 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4331 { echo "$as_me:$LINENO: result: no" >&5
4607$as_echo "no" >&6; } 4332echo "${ECHO_T}no" >&6; }
4608fi 4333fi
4609 4334
4610 4335
4611# Extract the first word of "kill", so it can be a program name with args. 4336# Extract the first word of "kill", so it can be a program name with args.
4612set dummy kill; ac_word=$2 4337set dummy kill; ac_word=$2
4613{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4338{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4614$as_echo_n "checking for $ac_word... " >&6; } 4339echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4615if ${ac_cv_path_KILL+:} false; then : 4340if test "${ac_cv_path_KILL+set}" = set; then
4616 $as_echo_n "(cached) " >&6 4341 echo $ECHO_N "(cached) $ECHO_C" >&6
4617else 4342else
4618 case $KILL in 4343 case $KILL in
4619 [\\/]* | ?:[\\/]*) 4344 [\\/]* | ?:[\\/]*)
@@ -4625,14 +4350,14 @@ for as_dir in $PATH
4625do 4350do
4626 IFS=$as_save_IFS 4351 IFS=$as_save_IFS
4627 test -z "$as_dir" && as_dir=. 4352 test -z "$as_dir" && as_dir=.
4628 for ac_exec_ext in '' $ac_executable_extensions; do 4353 for ac_exec_ext in '' $ac_executable_extensions; do
4629 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4354 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4630 ac_cv_path_KILL="$as_dir/$ac_word$ac_exec_ext" 4355 ac_cv_path_KILL="$as_dir/$ac_word$ac_exec_ext"
4631 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4356 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4632 break 2 4357 break 2
4633 fi 4358 fi
4634done 4359done
4635 done 4360done
4636IFS=$as_save_IFS 4361IFS=$as_save_IFS
4637 4362
4638 ;; 4363 ;;
@@ -4640,11 +4365,11 @@ esac
4640fi 4365fi
4641KILL=$ac_cv_path_KILL 4366KILL=$ac_cv_path_KILL
4642if test -n "$KILL"; then 4367if test -n "$KILL"; then
4643 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $KILL" >&5 4368 { echo "$as_me:$LINENO: result: $KILL" >&5
4644$as_echo "$KILL" >&6; } 4369echo "${ECHO_T}$KILL" >&6; }
4645else 4370else
4646 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4371 { echo "$as_me:$LINENO: result: no" >&5
4647$as_echo "no" >&6; } 4372echo "${ECHO_T}no" >&6; }
4648fi 4373fi
4649 4374
4650 4375
@@ -4652,10 +4377,10 @@ for ac_prog in perl5 perl
4652do 4377do
4653 # Extract the first word of "$ac_prog", so it can be a program name with args. 4378 # Extract the first word of "$ac_prog", so it can be a program name with args.
4654set dummy $ac_prog; ac_word=$2 4379set dummy $ac_prog; ac_word=$2
4655{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4380{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4656$as_echo_n "checking for $ac_word... " >&6; } 4381echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4657if ${ac_cv_path_PERL+:} false; then : 4382if test "${ac_cv_path_PERL+set}" = set; then
4658 $as_echo_n "(cached) " >&6 4383 echo $ECHO_N "(cached) $ECHO_C" >&6
4659else 4384else
4660 case $PERL in 4385 case $PERL in
4661 [\\/]* | ?:[\\/]*) 4386 [\\/]* | ?:[\\/]*)
@@ -4667,14 +4392,14 @@ for as_dir in $PATH
4667do 4392do
4668 IFS=$as_save_IFS 4393 IFS=$as_save_IFS
4669 test -z "$as_dir" && as_dir=. 4394 test -z "$as_dir" && as_dir=.
4670 for ac_exec_ext in '' $ac_executable_extensions; do 4395 for ac_exec_ext in '' $ac_executable_extensions; do
4671 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4396 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4672 ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" 4397 ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
4673 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4398 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4674 break 2 4399 break 2
4675 fi 4400 fi
4676done 4401done
4677 done 4402done
4678IFS=$as_save_IFS 4403IFS=$as_save_IFS
4679 4404
4680 ;; 4405 ;;
@@ -4682,11 +4407,11 @@ esac
4682fi 4407fi
4683PERL=$ac_cv_path_PERL 4408PERL=$ac_cv_path_PERL
4684if test -n "$PERL"; then 4409if test -n "$PERL"; then
4685 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 4410 { echo "$as_me:$LINENO: result: $PERL" >&5
4686$as_echo "$PERL" >&6; } 4411echo "${ECHO_T}$PERL" >&6; }
4687else 4412else
4688 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4413 { echo "$as_me:$LINENO: result: no" >&5
4689$as_echo "no" >&6; } 4414echo "${ECHO_T}no" >&6; }
4690fi 4415fi
4691 4416
4692 4417
@@ -4695,10 +4420,10 @@ done
4695 4420
4696# Extract the first word of "sed", so it can be a program name with args. 4421# Extract the first word of "sed", so it can be a program name with args.
4697set dummy sed; ac_word=$2 4422set dummy sed; ac_word=$2
4698{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4423{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4699$as_echo_n "checking for $ac_word... " >&6; } 4424echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4700if ${ac_cv_path_SED+:} false; then : 4425if test "${ac_cv_path_SED+set}" = set; then
4701 $as_echo_n "(cached) " >&6 4426 echo $ECHO_N "(cached) $ECHO_C" >&6
4702else 4427else
4703 case $SED in 4428 case $SED in
4704 [\\/]* | ?:[\\/]*) 4429 [\\/]* | ?:[\\/]*)
@@ -4710,14 +4435,14 @@ for as_dir in $PATH
4710do 4435do
4711 IFS=$as_save_IFS 4436 IFS=$as_save_IFS
4712 test -z "$as_dir" && as_dir=. 4437 test -z "$as_dir" && as_dir=.
4713 for ac_exec_ext in '' $ac_executable_extensions; do 4438 for ac_exec_ext in '' $ac_executable_extensions; do
4714 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4439 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4715 ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" 4440 ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
4716 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4441 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4717 break 2 4442 break 2
4718 fi 4443 fi
4719done 4444done
4720 done 4445done
4721IFS=$as_save_IFS 4446IFS=$as_save_IFS
4722 4447
4723 ;; 4448 ;;
@@ -4725,21 +4450,21 @@ esac
4725fi 4450fi
4726SED=$ac_cv_path_SED 4451SED=$ac_cv_path_SED
4727if test -n "$SED"; then 4452if test -n "$SED"; then
4728 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 4453 { echo "$as_me:$LINENO: result: $SED" >&5
4729$as_echo "$SED" >&6; } 4454echo "${ECHO_T}$SED" >&6; }
4730else 4455else
4731 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4456 { echo "$as_me:$LINENO: result: no" >&5
4732$as_echo "no" >&6; } 4457echo "${ECHO_T}no" >&6; }
4733fi 4458fi
4734 4459
4735 4460
4736 4461
4737# Extract the first word of "ent", so it can be a program name with args. 4462# Extract the first word of "ent", so it can be a program name with args.
4738set dummy ent; ac_word=$2 4463set dummy ent; ac_word=$2
4739{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4464{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4740$as_echo_n "checking for $ac_word... " >&6; } 4465echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4741if ${ac_cv_path_ENT+:} false; then : 4466if test "${ac_cv_path_ENT+set}" = set; then
4742 $as_echo_n "(cached) " >&6 4467 echo $ECHO_N "(cached) $ECHO_C" >&6
4743else 4468else
4744 case $ENT in 4469 case $ENT in
4745 [\\/]* | ?:[\\/]*) 4470 [\\/]* | ?:[\\/]*)
@@ -4751,14 +4476,14 @@ for as_dir in $PATH
4751do 4476do
4752 IFS=$as_save_IFS 4477 IFS=$as_save_IFS
4753 test -z "$as_dir" && as_dir=. 4478 test -z "$as_dir" && as_dir=.
4754 for ac_exec_ext in '' $ac_executable_extensions; do 4479 for ac_exec_ext in '' $ac_executable_extensions; do
4755 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4480 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4756 ac_cv_path_ENT="$as_dir/$ac_word$ac_exec_ext" 4481 ac_cv_path_ENT="$as_dir/$ac_word$ac_exec_ext"
4757 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4482 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4758 break 2 4483 break 2
4759 fi 4484 fi
4760done 4485done
4761 done 4486done
4762IFS=$as_save_IFS 4487IFS=$as_save_IFS
4763 4488
4764 ;; 4489 ;;
@@ -4766,21 +4491,21 @@ esac
4766fi 4491fi
4767ENT=$ac_cv_path_ENT 4492ENT=$ac_cv_path_ENT
4768if test -n "$ENT"; then 4493if test -n "$ENT"; then
4769 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ENT" >&5 4494 { echo "$as_me:$LINENO: result: $ENT" >&5
4770$as_echo "$ENT" >&6; } 4495echo "${ECHO_T}$ENT" >&6; }
4771else 4496else
4772 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4497 { echo "$as_me:$LINENO: result: no" >&5
4773$as_echo "no" >&6; } 4498echo "${ECHO_T}no" >&6; }
4774fi 4499fi
4775 4500
4776 4501
4777 4502
4778# Extract the first word of "bash", so it can be a program name with args. 4503# Extract the first word of "bash", so it can be a program name with args.
4779set dummy bash; ac_word=$2 4504set dummy bash; ac_word=$2
4780{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4505{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4781$as_echo_n "checking for $ac_word... " >&6; } 4506echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4782if ${ac_cv_path_TEST_MINUS_S_SH+:} false; then : 4507if test "${ac_cv_path_TEST_MINUS_S_SH+set}" = set; then
4783 $as_echo_n "(cached) " >&6 4508 echo $ECHO_N "(cached) $ECHO_C" >&6
4784else 4509else
4785 case $TEST_MINUS_S_SH in 4510 case $TEST_MINUS_S_SH in
4786 [\\/]* | ?:[\\/]*) 4511 [\\/]* | ?:[\\/]*)
@@ -4792,14 +4517,14 @@ for as_dir in $PATH
4792do 4517do
4793 IFS=$as_save_IFS 4518 IFS=$as_save_IFS
4794 test -z "$as_dir" && as_dir=. 4519 test -z "$as_dir" && as_dir=.
4795 for ac_exec_ext in '' $ac_executable_extensions; do 4520 for ac_exec_ext in '' $ac_executable_extensions; do
4796 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4521 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4797 ac_cv_path_TEST_MINUS_S_SH="$as_dir/$ac_word$ac_exec_ext" 4522 ac_cv_path_TEST_MINUS_S_SH="$as_dir/$ac_word$ac_exec_ext"
4798 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4523 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4799 break 2 4524 break 2
4800 fi 4525 fi
4801done 4526done
4802 done 4527done
4803IFS=$as_save_IFS 4528IFS=$as_save_IFS
4804 4529
4805 ;; 4530 ;;
@@ -4807,20 +4532,20 @@ esac
4807fi 4532fi
4808TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH 4533TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH
4809if test -n "$TEST_MINUS_S_SH"; then 4534if test -n "$TEST_MINUS_S_SH"; then
4810 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEST_MINUS_S_SH" >&5 4535 { echo "$as_me:$LINENO: result: $TEST_MINUS_S_SH" >&5
4811$as_echo "$TEST_MINUS_S_SH" >&6; } 4536echo "${ECHO_T}$TEST_MINUS_S_SH" >&6; }
4812else 4537else
4813 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4538 { echo "$as_me:$LINENO: result: no" >&5
4814$as_echo "no" >&6; } 4539echo "${ECHO_T}no" >&6; }
4815fi 4540fi
4816 4541
4817 4542
4818# Extract the first word of "ksh", so it can be a program name with args. 4543# Extract the first word of "ksh", so it can be a program name with args.
4819set dummy ksh; ac_word=$2 4544set dummy ksh; ac_word=$2
4820{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4545{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4821$as_echo_n "checking for $ac_word... " >&6; } 4546echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4822if ${ac_cv_path_TEST_MINUS_S_SH+:} false; then : 4547if test "${ac_cv_path_TEST_MINUS_S_SH+set}" = set; then
4823 $as_echo_n "(cached) " >&6 4548 echo $ECHO_N "(cached) $ECHO_C" >&6
4824else 4549else
4825 case $TEST_MINUS_S_SH in 4550 case $TEST_MINUS_S_SH in
4826 [\\/]* | ?:[\\/]*) 4551 [\\/]* | ?:[\\/]*)
@@ -4832,14 +4557,14 @@ for as_dir in $PATH
4832do 4557do
4833 IFS=$as_save_IFS 4558 IFS=$as_save_IFS
4834 test -z "$as_dir" && as_dir=. 4559 test -z "$as_dir" && as_dir=.
4835 for ac_exec_ext in '' $ac_executable_extensions; do 4560 for ac_exec_ext in '' $ac_executable_extensions; do
4836 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4561 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4837 ac_cv_path_TEST_MINUS_S_SH="$as_dir/$ac_word$ac_exec_ext" 4562 ac_cv_path_TEST_MINUS_S_SH="$as_dir/$ac_word$ac_exec_ext"
4838 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4563 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4839 break 2 4564 break 2
4840 fi 4565 fi
4841done 4566done
4842 done 4567done
4843IFS=$as_save_IFS 4568IFS=$as_save_IFS
4844 4569
4845 ;; 4570 ;;
@@ -4847,20 +4572,20 @@ esac
4847fi 4572fi
4848TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH 4573TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH
4849if test -n "$TEST_MINUS_S_SH"; then 4574if test -n "$TEST_MINUS_S_SH"; then
4850 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEST_MINUS_S_SH" >&5 4575 { echo "$as_me:$LINENO: result: $TEST_MINUS_S_SH" >&5
4851$as_echo "$TEST_MINUS_S_SH" >&6; } 4576echo "${ECHO_T}$TEST_MINUS_S_SH" >&6; }
4852else 4577else
4853 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4578 { echo "$as_me:$LINENO: result: no" >&5
4854$as_echo "no" >&6; } 4579echo "${ECHO_T}no" >&6; }
4855fi 4580fi
4856 4581
4857 4582
4858# Extract the first word of "sh", so it can be a program name with args. 4583# Extract the first word of "sh", so it can be a program name with args.
4859set dummy sh; ac_word=$2 4584set dummy sh; ac_word=$2
4860{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4585{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4861$as_echo_n "checking for $ac_word... " >&6; } 4586echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4862if ${ac_cv_path_TEST_MINUS_S_SH+:} false; then : 4587if test "${ac_cv_path_TEST_MINUS_S_SH+set}" = set; then
4863 $as_echo_n "(cached) " >&6 4588 echo $ECHO_N "(cached) $ECHO_C" >&6
4864else 4589else
4865 case $TEST_MINUS_S_SH in 4590 case $TEST_MINUS_S_SH in
4866 [\\/]* | ?:[\\/]*) 4591 [\\/]* | ?:[\\/]*)
@@ -4872,14 +4597,14 @@ for as_dir in $PATH
4872do 4597do
4873 IFS=$as_save_IFS 4598 IFS=$as_save_IFS
4874 test -z "$as_dir" && as_dir=. 4599 test -z "$as_dir" && as_dir=.
4875 for ac_exec_ext in '' $ac_executable_extensions; do 4600 for ac_exec_ext in '' $ac_executable_extensions; do
4876 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4601 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4877 ac_cv_path_TEST_MINUS_S_SH="$as_dir/$ac_word$ac_exec_ext" 4602 ac_cv_path_TEST_MINUS_S_SH="$as_dir/$ac_word$ac_exec_ext"
4878 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4603 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4879 break 2 4604 break 2
4880 fi 4605 fi
4881done 4606done
4882 done 4607done
4883IFS=$as_save_IFS 4608IFS=$as_save_IFS
4884 4609
4885 ;; 4610 ;;
@@ -4887,20 +4612,20 @@ esac
4887fi 4612fi
4888TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH 4613TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH
4889if test -n "$TEST_MINUS_S_SH"; then 4614if test -n "$TEST_MINUS_S_SH"; then
4890 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEST_MINUS_S_SH" >&5 4615 { echo "$as_me:$LINENO: result: $TEST_MINUS_S_SH" >&5
4891$as_echo "$TEST_MINUS_S_SH" >&6; } 4616echo "${ECHO_T}$TEST_MINUS_S_SH" >&6; }
4892else 4617else
4893 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4618 { echo "$as_me:$LINENO: result: no" >&5
4894$as_echo "no" >&6; } 4619echo "${ECHO_T}no" >&6; }
4895fi 4620fi
4896 4621
4897 4622
4898# Extract the first word of "sh", so it can be a program name with args. 4623# Extract the first word of "sh", so it can be a program name with args.
4899set dummy sh; ac_word=$2 4624set dummy sh; ac_word=$2
4900{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4625{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4901$as_echo_n "checking for $ac_word... " >&6; } 4626echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4902if ${ac_cv_path_SH+:} false; then : 4627if test "${ac_cv_path_SH+set}" = set; then
4903 $as_echo_n "(cached) " >&6 4628 echo $ECHO_N "(cached) $ECHO_C" >&6
4904else 4629else
4905 case $SH in 4630 case $SH in
4906 [\\/]* | ?:[\\/]*) 4631 [\\/]* | ?:[\\/]*)
@@ -4912,14 +4637,14 @@ for as_dir in $PATH
4912do 4637do
4913 IFS=$as_save_IFS 4638 IFS=$as_save_IFS
4914 test -z "$as_dir" && as_dir=. 4639 test -z "$as_dir" && as_dir=.
4915 for ac_exec_ext in '' $ac_executable_extensions; do 4640 for ac_exec_ext in '' $ac_executable_extensions; do
4916 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4641 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4917 ac_cv_path_SH="$as_dir/$ac_word$ac_exec_ext" 4642 ac_cv_path_SH="$as_dir/$ac_word$ac_exec_ext"
4918 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4643 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4919 break 2 4644 break 2
4920 fi 4645 fi
4921done 4646done
4922 done 4647done
4923IFS=$as_save_IFS 4648IFS=$as_save_IFS
4924 4649
4925 ;; 4650 ;;
@@ -4927,20 +4652,20 @@ esac
4927fi 4652fi
4928SH=$ac_cv_path_SH 4653SH=$ac_cv_path_SH
4929if test -n "$SH"; then 4654if test -n "$SH"; then
4930 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SH" >&5 4655 { echo "$as_me:$LINENO: result: $SH" >&5
4931$as_echo "$SH" >&6; } 4656echo "${ECHO_T}$SH" >&6; }
4932else 4657else
4933 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4658 { echo "$as_me:$LINENO: result: no" >&5
4934$as_echo "no" >&6; } 4659echo "${ECHO_T}no" >&6; }
4935fi 4660fi
4936 4661
4937 4662
4938# Extract the first word of "groff", so it can be a program name with args. 4663# Extract the first word of "groff", so it can be a program name with args.
4939set dummy groff; ac_word=$2 4664set dummy groff; ac_word=$2
4940{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4665{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4941$as_echo_n "checking for $ac_word... " >&6; } 4666echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4942if ${ac_cv_path_GROFF+:} false; then : 4667if test "${ac_cv_path_GROFF+set}" = set; then
4943 $as_echo_n "(cached) " >&6 4668 echo $ECHO_N "(cached) $ECHO_C" >&6
4944else 4669else
4945 case $GROFF in 4670 case $GROFF in
4946 [\\/]* | ?:[\\/]*) 4671 [\\/]* | ?:[\\/]*)
@@ -4952,14 +4677,14 @@ for as_dir in $PATH
4952do 4677do
4953 IFS=$as_save_IFS 4678 IFS=$as_save_IFS
4954 test -z "$as_dir" && as_dir=. 4679 test -z "$as_dir" && as_dir=.
4955 for ac_exec_ext in '' $ac_executable_extensions; do 4680 for ac_exec_ext in '' $ac_executable_extensions; do
4956 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4681 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4957 ac_cv_path_GROFF="$as_dir/$ac_word$ac_exec_ext" 4682 ac_cv_path_GROFF="$as_dir/$ac_word$ac_exec_ext"
4958 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4683 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4959 break 2 4684 break 2
4960 fi 4685 fi
4961done 4686done
4962 done 4687done
4963IFS=$as_save_IFS 4688IFS=$as_save_IFS
4964 4689
4965 ;; 4690 ;;
@@ -4967,20 +4692,20 @@ esac
4967fi 4692fi
4968GROFF=$ac_cv_path_GROFF 4693GROFF=$ac_cv_path_GROFF
4969if test -n "$GROFF"; then 4694if test -n "$GROFF"; then
4970 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GROFF" >&5 4695 { echo "$as_me:$LINENO: result: $GROFF" >&5
4971$as_echo "$GROFF" >&6; } 4696echo "${ECHO_T}$GROFF" >&6; }
4972else 4697else
4973 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4698 { echo "$as_me:$LINENO: result: no" >&5
4974$as_echo "no" >&6; } 4699echo "${ECHO_T}no" >&6; }
4975fi 4700fi
4976 4701
4977 4702
4978# Extract the first word of "nroff", so it can be a program name with args. 4703# Extract the first word of "nroff", so it can be a program name with args.
4979set dummy nroff; ac_word=$2 4704set dummy nroff; ac_word=$2
4980{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4705{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4981$as_echo_n "checking for $ac_word... " >&6; } 4706echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4982if ${ac_cv_path_NROFF+:} false; then : 4707if test "${ac_cv_path_NROFF+set}" = set; then
4983 $as_echo_n "(cached) " >&6 4708 echo $ECHO_N "(cached) $ECHO_C" >&6
4984else 4709else
4985 case $NROFF in 4710 case $NROFF in
4986 [\\/]* | ?:[\\/]*) 4711 [\\/]* | ?:[\\/]*)
@@ -4992,14 +4717,14 @@ for as_dir in $PATH
4992do 4717do
4993 IFS=$as_save_IFS 4718 IFS=$as_save_IFS
4994 test -z "$as_dir" && as_dir=. 4719 test -z "$as_dir" && as_dir=.
4995 for ac_exec_ext in '' $ac_executable_extensions; do 4720 for ac_exec_ext in '' $ac_executable_extensions; do
4996 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4721 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4997 ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext" 4722 ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext"
4998 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4723 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4999 break 2 4724 break 2
5000 fi 4725 fi
5001done 4726done
5002 done 4727done
5003IFS=$as_save_IFS 4728IFS=$as_save_IFS
5004 4729
5005 ;; 4730 ;;
@@ -5007,20 +4732,20 @@ esac
5007fi 4732fi
5008NROFF=$ac_cv_path_NROFF 4733NROFF=$ac_cv_path_NROFF
5009if test -n "$NROFF"; then 4734if test -n "$NROFF"; then
5010 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NROFF" >&5 4735 { echo "$as_me:$LINENO: result: $NROFF" >&5
5011$as_echo "$NROFF" >&6; } 4736echo "${ECHO_T}$NROFF" >&6; }
5012else 4737else
5013 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4738 { echo "$as_me:$LINENO: result: no" >&5
5014$as_echo "no" >&6; } 4739echo "${ECHO_T}no" >&6; }
5015fi 4740fi
5016 4741
5017 4742
5018# Extract the first word of "mandoc", so it can be a program name with args. 4743# Extract the first word of "mandoc", so it can be a program name with args.
5019set dummy mandoc; ac_word=$2 4744set dummy mandoc; ac_word=$2
5020{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4745{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5021$as_echo_n "checking for $ac_word... " >&6; } 4746echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5022if ${ac_cv_path_MANDOC+:} false; then : 4747if test "${ac_cv_path_MANDOC+set}" = set; then
5023 $as_echo_n "(cached) " >&6 4748 echo $ECHO_N "(cached) $ECHO_C" >&6
5024else 4749else
5025 case $MANDOC in 4750 case $MANDOC in
5026 [\\/]* | ?:[\\/]*) 4751 [\\/]* | ?:[\\/]*)
@@ -5032,14 +4757,14 @@ for as_dir in $PATH
5032do 4757do
5033 IFS=$as_save_IFS 4758 IFS=$as_save_IFS
5034 test -z "$as_dir" && as_dir=. 4759 test -z "$as_dir" && as_dir=.
5035 for ac_exec_ext in '' $ac_executable_extensions; do 4760 for ac_exec_ext in '' $ac_executable_extensions; do
5036 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4761 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5037 ac_cv_path_MANDOC="$as_dir/$ac_word$ac_exec_ext" 4762 ac_cv_path_MANDOC="$as_dir/$ac_word$ac_exec_ext"
5038 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4763 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
5039 break 2 4764 break 2
5040 fi 4765 fi
5041done 4766done
5042 done 4767done
5043IFS=$as_save_IFS 4768IFS=$as_save_IFS
5044 4769
5045 ;; 4770 ;;
@@ -5047,11 +4772,11 @@ esac
5047fi 4772fi
5048MANDOC=$ac_cv_path_MANDOC 4773MANDOC=$ac_cv_path_MANDOC
5049if test -n "$MANDOC"; then 4774if test -n "$MANDOC"; then
5050 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANDOC" >&5 4775 { echo "$as_me:$LINENO: result: $MANDOC" >&5
5051$as_echo "$MANDOC" >&6; } 4776echo "${ECHO_T}$MANDOC" >&6; }
5052else 4777else
5053 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4778 { echo "$as_me:$LINENO: result: no" >&5
5054$as_echo "no" >&6; } 4779echo "${ECHO_T}no" >&6; }
5055fi 4780fi
5056 4781
5057 4782
@@ -5065,18 +4790,18 @@ elif test "x$NROFF" != "x" ; then
5065elif test "x$GROFF" != "x" ; then 4790elif test "x$GROFF" != "x" ; then
5066 MANFMT="$GROFF -mandoc -Tascii" 4791 MANFMT="$GROFF -mandoc -Tascii"
5067else 4792else
5068 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no manpage formatted found" >&5 4793 { echo "$as_me:$LINENO: WARNING: no manpage formatted found" >&5
5069$as_echo "$as_me: WARNING: no manpage formatted found" >&2;} 4794echo "$as_me: WARNING: no manpage formatted found" >&2;}
5070 MANFMT="false" 4795 MANFMT="false"
5071fi 4796fi
5072 4797
5073 4798
5074# Extract the first word of "groupadd", so it can be a program name with args. 4799# Extract the first word of "groupadd", so it can be a program name with args.
5075set dummy groupadd; ac_word=$2 4800set dummy groupadd; ac_word=$2
5076{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4801{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5077$as_echo_n "checking for $ac_word... " >&6; } 4802echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5078if ${ac_cv_path_PATH_GROUPADD_PROG+:} false; then : 4803if test "${ac_cv_path_PATH_GROUPADD_PROG+set}" = set; then
5079 $as_echo_n "(cached) " >&6 4804 echo $ECHO_N "(cached) $ECHO_C" >&6
5080else 4805else
5081 case $PATH_GROUPADD_PROG in 4806 case $PATH_GROUPADD_PROG in
5082 [\\/]* | ?:[\\/]*) 4807 [\\/]* | ?:[\\/]*)
@@ -5088,14 +4813,14 @@ for as_dir in /usr/sbin${PATH_SEPARATOR}/etc
5088do 4813do
5089 IFS=$as_save_IFS 4814 IFS=$as_save_IFS
5090 test -z "$as_dir" && as_dir=. 4815 test -z "$as_dir" && as_dir=.
5091 for ac_exec_ext in '' $ac_executable_extensions; do 4816 for ac_exec_ext in '' $ac_executable_extensions; do
5092 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4817 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5093 ac_cv_path_PATH_GROUPADD_PROG="$as_dir/$ac_word$ac_exec_ext" 4818 ac_cv_path_PATH_GROUPADD_PROG="$as_dir/$ac_word$ac_exec_ext"
5094 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4819 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
5095 break 2 4820 break 2
5096 fi 4821 fi
5097done 4822done
5098 done 4823done
5099IFS=$as_save_IFS 4824IFS=$as_save_IFS
5100 4825
5101 test -z "$ac_cv_path_PATH_GROUPADD_PROG" && ac_cv_path_PATH_GROUPADD_PROG="groupadd" 4826 test -z "$ac_cv_path_PATH_GROUPADD_PROG" && ac_cv_path_PATH_GROUPADD_PROG="groupadd"
@@ -5104,20 +4829,20 @@ esac
5104fi 4829fi
5105PATH_GROUPADD_PROG=$ac_cv_path_PATH_GROUPADD_PROG 4830PATH_GROUPADD_PROG=$ac_cv_path_PATH_GROUPADD_PROG
5106if test -n "$PATH_GROUPADD_PROG"; then 4831if test -n "$PATH_GROUPADD_PROG"; then
5107 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATH_GROUPADD_PROG" >&5 4832 { echo "$as_me:$LINENO: result: $PATH_GROUPADD_PROG" >&5
5108$as_echo "$PATH_GROUPADD_PROG" >&6; } 4833echo "${ECHO_T}$PATH_GROUPADD_PROG" >&6; }
5109else 4834else
5110 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4835 { echo "$as_me:$LINENO: result: no" >&5
5111$as_echo "no" >&6; } 4836echo "${ECHO_T}no" >&6; }
5112fi 4837fi
5113 4838
5114 4839
5115# Extract the first word of "useradd", so it can be a program name with args. 4840# Extract the first word of "useradd", so it can be a program name with args.
5116set dummy useradd; ac_word=$2 4841set dummy useradd; ac_word=$2
5117{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4842{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5118$as_echo_n "checking for $ac_word... " >&6; } 4843echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5119if ${ac_cv_path_PATH_USERADD_PROG+:} false; then : 4844if test "${ac_cv_path_PATH_USERADD_PROG+set}" = set; then
5120 $as_echo_n "(cached) " >&6 4845 echo $ECHO_N "(cached) $ECHO_C" >&6
5121else 4846else
5122 case $PATH_USERADD_PROG in 4847 case $PATH_USERADD_PROG in
5123 [\\/]* | ?:[\\/]*) 4848 [\\/]* | ?:[\\/]*)
@@ -5129,14 +4854,14 @@ for as_dir in /usr/sbin${PATH_SEPARATOR}/etc
5129do 4854do
5130 IFS=$as_save_IFS 4855 IFS=$as_save_IFS
5131 test -z "$as_dir" && as_dir=. 4856 test -z "$as_dir" && as_dir=.
5132 for ac_exec_ext in '' $ac_executable_extensions; do 4857 for ac_exec_ext in '' $ac_executable_extensions; do
5133 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4858 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5134 ac_cv_path_PATH_USERADD_PROG="$as_dir/$ac_word$ac_exec_ext" 4859 ac_cv_path_PATH_USERADD_PROG="$as_dir/$ac_word$ac_exec_ext"
5135 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4860 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
5136 break 2 4861 break 2
5137 fi 4862 fi
5138done 4863done
5139 done 4864done
5140IFS=$as_save_IFS 4865IFS=$as_save_IFS
5141 4866
5142 test -z "$ac_cv_path_PATH_USERADD_PROG" && ac_cv_path_PATH_USERADD_PROG="useradd" 4867 test -z "$ac_cv_path_PATH_USERADD_PROG" && ac_cv_path_PATH_USERADD_PROG="useradd"
@@ -5145,20 +4870,20 @@ esac
5145fi 4870fi
5146PATH_USERADD_PROG=$ac_cv_path_PATH_USERADD_PROG 4871PATH_USERADD_PROG=$ac_cv_path_PATH_USERADD_PROG
5147if test -n "$PATH_USERADD_PROG"; then 4872if test -n "$PATH_USERADD_PROG"; then
5148 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATH_USERADD_PROG" >&5 4873 { echo "$as_me:$LINENO: result: $PATH_USERADD_PROG" >&5
5149$as_echo "$PATH_USERADD_PROG" >&6; } 4874echo "${ECHO_T}$PATH_USERADD_PROG" >&6; }
5150else 4875else
5151 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4876 { echo "$as_me:$LINENO: result: no" >&5
5152$as_echo "no" >&6; } 4877echo "${ECHO_T}no" >&6; }
5153fi 4878fi
5154 4879
5155 4880
5156# Extract the first word of "pkgmk", so it can be a program name with args. 4881# Extract the first word of "pkgmk", so it can be a program name with args.
5157set dummy pkgmk; ac_word=$2 4882set dummy pkgmk; ac_word=$2
5158{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4883{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5159$as_echo_n "checking for $ac_word... " >&6; } 4884echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5160if ${ac_cv_prog_MAKE_PACKAGE_SUPPORTED+:} false; then : 4885if test "${ac_cv_prog_MAKE_PACKAGE_SUPPORTED+set}" = set; then
5161 $as_echo_n "(cached) " >&6 4886 echo $ECHO_N "(cached) $ECHO_C" >&6
5162else 4887else
5163 if test -n "$MAKE_PACKAGE_SUPPORTED"; then 4888 if test -n "$MAKE_PACKAGE_SUPPORTED"; then
5164 ac_cv_prog_MAKE_PACKAGE_SUPPORTED="$MAKE_PACKAGE_SUPPORTED" # Let the user override the test. 4889 ac_cv_prog_MAKE_PACKAGE_SUPPORTED="$MAKE_PACKAGE_SUPPORTED" # Let the user override the test.
@@ -5168,14 +4893,14 @@ for as_dir in $PATH
5168do 4893do
5169 IFS=$as_save_IFS 4894 IFS=$as_save_IFS
5170 test -z "$as_dir" && as_dir=. 4895 test -z "$as_dir" && as_dir=.
5171 for ac_exec_ext in '' $ac_executable_extensions; do 4896 for ac_exec_ext in '' $ac_executable_extensions; do
5172 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 4897 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5173 ac_cv_prog_MAKE_PACKAGE_SUPPORTED="yes" 4898 ac_cv_prog_MAKE_PACKAGE_SUPPORTED="yes"
5174 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 4899 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
5175 break 2 4900 break 2
5176 fi 4901 fi
5177done 4902done
5178 done 4903done
5179IFS=$as_save_IFS 4904IFS=$as_save_IFS
5180 4905
5181 test -z "$ac_cv_prog_MAKE_PACKAGE_SUPPORTED" && ac_cv_prog_MAKE_PACKAGE_SUPPORTED="no" 4906 test -z "$ac_cv_prog_MAKE_PACKAGE_SUPPORTED" && ac_cv_prog_MAKE_PACKAGE_SUPPORTED="no"
@@ -5183,11 +4908,11 @@ fi
5183fi 4908fi
5184MAKE_PACKAGE_SUPPORTED=$ac_cv_prog_MAKE_PACKAGE_SUPPORTED 4909MAKE_PACKAGE_SUPPORTED=$ac_cv_prog_MAKE_PACKAGE_SUPPORTED
5185if test -n "$MAKE_PACKAGE_SUPPORTED"; then 4910if test -n "$MAKE_PACKAGE_SUPPORTED"; then
5186 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKE_PACKAGE_SUPPORTED" >&5 4911 { echo "$as_me:$LINENO: result: $MAKE_PACKAGE_SUPPORTED" >&5
5187$as_echo "$MAKE_PACKAGE_SUPPORTED" >&6; } 4912echo "${ECHO_T}$MAKE_PACKAGE_SUPPORTED" >&6; }
5188else 4913else
5189 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4914 { echo "$as_me:$LINENO: result: no" >&5
5190$as_echo "no" >&6; } 4915echo "${ECHO_T}no" >&6; }
5191fi 4916fi
5192 4917
5193 4918
@@ -5201,16 +4926,16 @@ fi
5201 4926
5202# System features 4927# System features
5203# Check whether --enable-largefile was given. 4928# Check whether --enable-largefile was given.
5204if test "${enable_largefile+set}" = set; then : 4929if test "${enable_largefile+set}" = set; then
5205 enableval=$enable_largefile; 4930 enableval=$enable_largefile;
5206fi 4931fi
5207 4932
5208if test "$enable_largefile" != no; then 4933if test "$enable_largefile" != no; then
5209 4934
5210 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 4935 { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
5211$as_echo_n "checking for special C compiler options needed for large files... " >&6; } 4936echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; }
5212if ${ac_cv_sys_largefile_CC+:} false; then : 4937if test "${ac_cv_sys_largefile_CC+set}" = set; then
5213 $as_echo_n "(cached) " >&6 4938 echo $ECHO_N "(cached) $ECHO_C" >&6
5214else 4939else
5215 ac_cv_sys_largefile_CC=no 4940 ac_cv_sys_largefile_CC=no
5216 if test "$GCC" != yes; then 4941 if test "$GCC" != yes; then
@@ -5218,7 +4943,11 @@ else
5218 while :; do 4943 while :; do
5219 # IRIX 6.2 and later do not support large files by default, 4944 # IRIX 6.2 and later do not support large files by default,
5220 # so use the C compiler's -n32 option if that helps. 4945 # so use the C compiler's -n32 option if that helps.
5221 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 4946 cat >conftest.$ac_ext <<_ACEOF
4947/* confdefs.h. */
4948_ACEOF
4949cat confdefs.h >>conftest.$ac_ext
4950cat >>conftest.$ac_ext <<_ACEOF
5222/* end confdefs.h. */ 4951/* end confdefs.h. */
5223#include <sys/types.h> 4952#include <sys/types.h>
5224 /* Check that off_t can represent 2**63 - 1 correctly. 4953 /* Check that off_t can represent 2**63 - 1 correctly.
@@ -5237,14 +4966,58 @@ main ()
5237 return 0; 4966 return 0;
5238} 4967}
5239_ACEOF 4968_ACEOF
5240 if ac_fn_c_try_compile "$LINENO"; then : 4969 rm -f conftest.$ac_objext
4970if { (ac_try="$ac_compile"
4971case "(($ac_try" in
4972 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4973 *) ac_try_echo=$ac_try;;
4974esac
4975eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
4976 (eval "$ac_compile") 2>conftest.er1
4977 ac_status=$?
4978 grep -v '^ *+' conftest.er1 >conftest.err
4979 rm -f conftest.er1
4980 cat conftest.err >&5
4981 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4982 (exit $ac_status); } && {
4983 test -z "$ac_c_werror_flag" ||
4984 test ! -s conftest.err
4985 } && test -s conftest.$ac_objext; then
5241 break 4986 break
4987else
4988 echo "$as_me: failed program was:" >&5
4989sed 's/^/| /' conftest.$ac_ext >&5
4990
4991
5242fi 4992fi
4993
5243rm -f core conftest.err conftest.$ac_objext 4994rm -f core conftest.err conftest.$ac_objext
5244 CC="$CC -n32" 4995 CC="$CC -n32"
5245 if ac_fn_c_try_compile "$LINENO"; then : 4996 rm -f conftest.$ac_objext
4997if { (ac_try="$ac_compile"
4998case "(($ac_try" in
4999 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5000 *) ac_try_echo=$ac_try;;
5001esac
5002eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5003 (eval "$ac_compile") 2>conftest.er1
5004 ac_status=$?
5005 grep -v '^ *+' conftest.er1 >conftest.err
5006 rm -f conftest.er1
5007 cat conftest.err >&5
5008 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5009 (exit $ac_status); } && {
5010 test -z "$ac_c_werror_flag" ||
5011 test ! -s conftest.err
5012 } && test -s conftest.$ac_objext; then
5246 ac_cv_sys_largefile_CC=' -n32'; break 5013 ac_cv_sys_largefile_CC=' -n32'; break
5014else
5015 echo "$as_me: failed program was:" >&5
5016sed 's/^/| /' conftest.$ac_ext >&5
5017
5018
5247fi 5019fi
5020
5248rm -f core conftest.err conftest.$ac_objext 5021rm -f core conftest.err conftest.$ac_objext
5249 break 5022 break
5250 done 5023 done
@@ -5252,19 +5025,23 @@ rm -f core conftest.err conftest.$ac_objext
5252 rm -f conftest.$ac_ext 5025 rm -f conftest.$ac_ext
5253 fi 5026 fi
5254fi 5027fi
5255{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 5028{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
5256$as_echo "$ac_cv_sys_largefile_CC" >&6; } 5029echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; }
5257 if test "$ac_cv_sys_largefile_CC" != no; then 5030 if test "$ac_cv_sys_largefile_CC" != no; then
5258 CC=$CC$ac_cv_sys_largefile_CC 5031 CC=$CC$ac_cv_sys_largefile_CC
5259 fi 5032 fi
5260 5033
5261 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 5034 { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
5262$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } 5035echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; }
5263if ${ac_cv_sys_file_offset_bits+:} false; then : 5036if test "${ac_cv_sys_file_offset_bits+set}" = set; then
5264 $as_echo_n "(cached) " >&6 5037 echo $ECHO_N "(cached) $ECHO_C" >&6
5265else 5038else
5266 while :; do 5039 while :; do
5267 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 5040 cat >conftest.$ac_ext <<_ACEOF
5041/* confdefs.h. */
5042_ACEOF
5043cat confdefs.h >>conftest.$ac_ext
5044cat >>conftest.$ac_ext <<_ACEOF
5268/* end confdefs.h. */ 5045/* end confdefs.h. */
5269#include <sys/types.h> 5046#include <sys/types.h>
5270 /* Check that off_t can represent 2**63 - 1 correctly. 5047 /* Check that off_t can represent 2**63 - 1 correctly.
@@ -5283,11 +5060,37 @@ main ()
5283 return 0; 5060 return 0;
5284} 5061}
5285_ACEOF 5062_ACEOF
5286if ac_fn_c_try_compile "$LINENO"; then : 5063rm -f conftest.$ac_objext
5064if { (ac_try="$ac_compile"
5065case "(($ac_try" in
5066 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5067 *) ac_try_echo=$ac_try;;
5068esac
5069eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5070 (eval "$ac_compile") 2>conftest.er1
5071 ac_status=$?
5072 grep -v '^ *+' conftest.er1 >conftest.err
5073 rm -f conftest.er1
5074 cat conftest.err >&5
5075 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5076 (exit $ac_status); } && {
5077 test -z "$ac_c_werror_flag" ||
5078 test ! -s conftest.err
5079 } && test -s conftest.$ac_objext; then
5287 ac_cv_sys_file_offset_bits=no; break 5080 ac_cv_sys_file_offset_bits=no; break
5081else
5082 echo "$as_me: failed program was:" >&5
5083sed 's/^/| /' conftest.$ac_ext >&5
5084
5085
5288fi 5086fi
5087
5289rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5088rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5290 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 5089 cat >conftest.$ac_ext <<_ACEOF
5090/* confdefs.h. */
5091_ACEOF
5092cat confdefs.h >>conftest.$ac_ext
5093cat >>conftest.$ac_ext <<_ACEOF
5291/* end confdefs.h. */ 5094/* end confdefs.h. */
5292#define _FILE_OFFSET_BITS 64 5095#define _FILE_OFFSET_BITS 64
5293#include <sys/types.h> 5096#include <sys/types.h>
@@ -5307,16 +5110,38 @@ main ()
5307 return 0; 5110 return 0;
5308} 5111}
5309_ACEOF 5112_ACEOF
5310if ac_fn_c_try_compile "$LINENO"; then : 5113rm -f conftest.$ac_objext
5114if { (ac_try="$ac_compile"
5115case "(($ac_try" in
5116 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5117 *) ac_try_echo=$ac_try;;
5118esac
5119eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5120 (eval "$ac_compile") 2>conftest.er1
5121 ac_status=$?
5122 grep -v '^ *+' conftest.er1 >conftest.err
5123 rm -f conftest.er1
5124 cat conftest.err >&5
5125 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5126 (exit $ac_status); } && {
5127 test -z "$ac_c_werror_flag" ||
5128 test ! -s conftest.err
5129 } && test -s conftest.$ac_objext; then
5311 ac_cv_sys_file_offset_bits=64; break 5130 ac_cv_sys_file_offset_bits=64; break
5131else
5132 echo "$as_me: failed program was:" >&5
5133sed 's/^/| /' conftest.$ac_ext >&5
5134
5135
5312fi 5136fi
5137
5313rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5138rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5314 ac_cv_sys_file_offset_bits=unknown 5139 ac_cv_sys_file_offset_bits=unknown
5315 break 5140 break
5316done 5141done
5317fi 5142fi
5318{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 5143{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
5319$as_echo "$ac_cv_sys_file_offset_bits" >&6; } 5144echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; }
5320case $ac_cv_sys_file_offset_bits in #( 5145case $ac_cv_sys_file_offset_bits in #(
5321 no | unknown) ;; 5146 no | unknown) ;;
5322 *) 5147 *)
@@ -5325,15 +5150,19 @@ cat >>confdefs.h <<_ACEOF
5325_ACEOF 5150_ACEOF
5326;; 5151;;
5327esac 5152esac
5328rm -rf conftest* 5153rm -f conftest*
5329 if test $ac_cv_sys_file_offset_bits = unknown; then 5154 if test $ac_cv_sys_file_offset_bits = unknown; then
5330 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 5155 { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
5331$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } 5156echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; }
5332if ${ac_cv_sys_large_files+:} false; then : 5157if test "${ac_cv_sys_large_files+set}" = set; then
5333 $as_echo_n "(cached) " >&6 5158 echo $ECHO_N "(cached) $ECHO_C" >&6
5334else 5159else
5335 while :; do 5160 while :; do
5336 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 5161 cat >conftest.$ac_ext <<_ACEOF
5162/* confdefs.h. */
5163_ACEOF
5164cat confdefs.h >>conftest.$ac_ext
5165cat >>conftest.$ac_ext <<_ACEOF
5337/* end confdefs.h. */ 5166/* end confdefs.h. */
5338#include <sys/types.h> 5167#include <sys/types.h>
5339 /* Check that off_t can represent 2**63 - 1 correctly. 5168 /* Check that off_t can represent 2**63 - 1 correctly.
@@ -5352,11 +5181,37 @@ main ()
5352 return 0; 5181 return 0;
5353} 5182}
5354_ACEOF 5183_ACEOF
5355if ac_fn_c_try_compile "$LINENO"; then : 5184rm -f conftest.$ac_objext
5185if { (ac_try="$ac_compile"
5186case "(($ac_try" in
5187 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5188 *) ac_try_echo=$ac_try;;
5189esac
5190eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5191 (eval "$ac_compile") 2>conftest.er1
5192 ac_status=$?
5193 grep -v '^ *+' conftest.er1 >conftest.err
5194 rm -f conftest.er1
5195 cat conftest.err >&5
5196 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5197 (exit $ac_status); } && {
5198 test -z "$ac_c_werror_flag" ||
5199 test ! -s conftest.err
5200 } && test -s conftest.$ac_objext; then
5356 ac_cv_sys_large_files=no; break 5201 ac_cv_sys_large_files=no; break
5202else
5203 echo "$as_me: failed program was:" >&5
5204sed 's/^/| /' conftest.$ac_ext >&5
5205
5206
5357fi 5207fi
5208
5358rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5209rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5359 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 5210 cat >conftest.$ac_ext <<_ACEOF
5211/* confdefs.h. */
5212_ACEOF
5213cat confdefs.h >>conftest.$ac_ext
5214cat >>conftest.$ac_ext <<_ACEOF
5360/* end confdefs.h. */ 5215/* end confdefs.h. */
5361#define _LARGE_FILES 1 5216#define _LARGE_FILES 1
5362#include <sys/types.h> 5217#include <sys/types.h>
@@ -5376,16 +5231,38 @@ main ()
5376 return 0; 5231 return 0;
5377} 5232}
5378_ACEOF 5233_ACEOF
5379if ac_fn_c_try_compile "$LINENO"; then : 5234rm -f conftest.$ac_objext
5235if { (ac_try="$ac_compile"
5236case "(($ac_try" in
5237 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5238 *) ac_try_echo=$ac_try;;
5239esac
5240eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5241 (eval "$ac_compile") 2>conftest.er1
5242 ac_status=$?
5243 grep -v '^ *+' conftest.er1 >conftest.err
5244 rm -f conftest.er1
5245 cat conftest.err >&5
5246 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5247 (exit $ac_status); } && {
5248 test -z "$ac_c_werror_flag" ||
5249 test ! -s conftest.err
5250 } && test -s conftest.$ac_objext; then
5380 ac_cv_sys_large_files=1; break 5251 ac_cv_sys_large_files=1; break
5252else
5253 echo "$as_me: failed program was:" >&5
5254sed 's/^/| /' conftest.$ac_ext >&5
5255
5256
5381fi 5257fi
5258
5382rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5259rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5383 ac_cv_sys_large_files=unknown 5260 ac_cv_sys_large_files=unknown
5384 break 5261 break
5385done 5262done
5386fi 5263fi
5387{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 5264{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
5388$as_echo "$ac_cv_sys_large_files" >&6; } 5265echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }
5389case $ac_cv_sys_large_files in #( 5266case $ac_cv_sys_large_files in #(
5390 no | unknown) ;; 5267 no | unknown) ;;
5391 *) 5268 *)
@@ -5394,13 +5271,15 @@ cat >>confdefs.h <<_ACEOF
5394_ACEOF 5271_ACEOF
5395;; 5272;;
5396esac 5273esac
5397rm -rf conftest* 5274rm -f conftest*
5398 fi 5275 fi
5399fi 5276fi
5400 5277
5401 5278
5402if test -z "$AR" ; then 5279if test -z "$AR" ; then
5403 as_fn_error $? "*** 'ar' missing, please install or fix your \$PATH ***" "$LINENO" 5 5280 { { echo "$as_me:$LINENO: error: *** 'ar' missing, please install or fix your \$PATH ***" >&5
5281echo "$as_me: error: *** 'ar' missing, please install or fix your \$PATH ***" >&2;}
5282 { (exit 1); exit 1; }; }
5404fi 5283fi
5405 5284
5406# Use LOGIN_PROGRAM from environment if possible 5285# Use LOGIN_PROGRAM from environment if possible
@@ -5414,10 +5293,10 @@ else
5414 # Search for login 5293 # Search for login
5415 # Extract the first word of "login", so it can be a program name with args. 5294 # Extract the first word of "login", so it can be a program name with args.
5416set dummy login; ac_word=$2 5295set dummy login; ac_word=$2
5417{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 5296{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5418$as_echo_n "checking for $ac_word... " >&6; } 5297echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5419if ${ac_cv_path_LOGIN_PROGRAM_FALLBACK+:} false; then : 5298if test "${ac_cv_path_LOGIN_PROGRAM_FALLBACK+set}" = set; then
5420 $as_echo_n "(cached) " >&6 5299 echo $ECHO_N "(cached) $ECHO_C" >&6
5421else 5300else
5422 case $LOGIN_PROGRAM_FALLBACK in 5301 case $LOGIN_PROGRAM_FALLBACK in
5423 [\\/]* | ?:[\\/]*) 5302 [\\/]* | ?:[\\/]*)
@@ -5429,14 +5308,14 @@ for as_dir in $PATH
5429do 5308do
5430 IFS=$as_save_IFS 5309 IFS=$as_save_IFS
5431 test -z "$as_dir" && as_dir=. 5310 test -z "$as_dir" && as_dir=.
5432 for ac_exec_ext in '' $ac_executable_extensions; do 5311 for ac_exec_ext in '' $ac_executable_extensions; do
5433 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 5312 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5434 ac_cv_path_LOGIN_PROGRAM_FALLBACK="$as_dir/$ac_word$ac_exec_ext" 5313 ac_cv_path_LOGIN_PROGRAM_FALLBACK="$as_dir/$ac_word$ac_exec_ext"
5435 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 5314 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
5436 break 2 5315 break 2
5437 fi 5316 fi
5438done 5317done
5439 done 5318done
5440IFS=$as_save_IFS 5319IFS=$as_save_IFS
5441 5320
5442 ;; 5321 ;;
@@ -5444,11 +5323,11 @@ esac
5444fi 5323fi
5445LOGIN_PROGRAM_FALLBACK=$ac_cv_path_LOGIN_PROGRAM_FALLBACK 5324LOGIN_PROGRAM_FALLBACK=$ac_cv_path_LOGIN_PROGRAM_FALLBACK
5446if test -n "$LOGIN_PROGRAM_FALLBACK"; then 5325if test -n "$LOGIN_PROGRAM_FALLBACK"; then
5447 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LOGIN_PROGRAM_FALLBACK" >&5 5326 { echo "$as_me:$LINENO: result: $LOGIN_PROGRAM_FALLBACK" >&5
5448$as_echo "$LOGIN_PROGRAM_FALLBACK" >&6; } 5327echo "${ECHO_T}$LOGIN_PROGRAM_FALLBACK" >&6; }
5449else 5328else
5450 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5329 { echo "$as_me:$LINENO: result: no" >&5
5451$as_echo "no" >&6; } 5330echo "${ECHO_T}no" >&6; }
5452fi 5331fi
5453 5332
5454 5333
@@ -5462,10 +5341,10 @@ fi
5462 5341
5463# Extract the first word of "passwd", so it can be a program name with args. 5342# Extract the first word of "passwd", so it can be a program name with args.
5464set dummy passwd; ac_word=$2 5343set dummy passwd; ac_word=$2
5465{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 5344{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5466$as_echo_n "checking for $ac_word... " >&6; } 5345echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5467if ${ac_cv_path_PATH_PASSWD_PROG+:} false; then : 5346if test "${ac_cv_path_PATH_PASSWD_PROG+set}" = set; then
5468 $as_echo_n "(cached) " >&6 5347 echo $ECHO_N "(cached) $ECHO_C" >&6
5469else 5348else
5470 case $PATH_PASSWD_PROG in 5349 case $PATH_PASSWD_PROG in
5471 [\\/]* | ?:[\\/]*) 5350 [\\/]* | ?:[\\/]*)
@@ -5477,14 +5356,14 @@ for as_dir in $PATH
5477do 5356do
5478 IFS=$as_save_IFS 5357 IFS=$as_save_IFS
5479 test -z "$as_dir" && as_dir=. 5358 test -z "$as_dir" && as_dir=.
5480 for ac_exec_ext in '' $ac_executable_extensions; do 5359 for ac_exec_ext in '' $ac_executable_extensions; do
5481 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 5360 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
5482 ac_cv_path_PATH_PASSWD_PROG="$as_dir/$ac_word$ac_exec_ext" 5361 ac_cv_path_PATH_PASSWD_PROG="$as_dir/$ac_word$ac_exec_ext"
5483 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 5362 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
5484 break 2 5363 break 2
5485 fi 5364 fi
5486done 5365done
5487 done 5366done
5488IFS=$as_save_IFS 5367IFS=$as_save_IFS
5489 5368
5490 ;; 5369 ;;
@@ -5492,11 +5371,11 @@ esac
5492fi 5371fi
5493PATH_PASSWD_PROG=$ac_cv_path_PATH_PASSWD_PROG 5372PATH_PASSWD_PROG=$ac_cv_path_PATH_PASSWD_PROG
5494if test -n "$PATH_PASSWD_PROG"; then 5373if test -n "$PATH_PASSWD_PROG"; then
5495 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATH_PASSWD_PROG" >&5 5374 { echo "$as_me:$LINENO: result: $PATH_PASSWD_PROG" >&5
5496$as_echo "$PATH_PASSWD_PROG" >&6; } 5375echo "${ECHO_T}$PATH_PASSWD_PROG" >&6; }
5497else 5376else
5498 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5377 { echo "$as_me:$LINENO: result: no" >&5
5499$as_echo "no" >&6; } 5378echo "${ECHO_T}no" >&6; }
5500fi 5379fi
5501 5380
5502 5381
@@ -5513,14 +5392,18 @@ if test -z "$LD" ; then
5513fi 5392fi
5514 5393
5515 5394
5516{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 5395{ echo "$as_me:$LINENO: checking for inline" >&5
5517$as_echo_n "checking for inline... " >&6; } 5396echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
5518if ${ac_cv_c_inline+:} false; then : 5397if test "${ac_cv_c_inline+set}" = set; then
5519 $as_echo_n "(cached) " >&6 5398 echo $ECHO_N "(cached) $ECHO_C" >&6
5520else 5399else
5521 ac_cv_c_inline=no 5400 ac_cv_c_inline=no
5522for ac_kw in inline __inline__ __inline; do 5401for ac_kw in inline __inline__ __inline; do
5523 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 5402 cat >conftest.$ac_ext <<_ACEOF
5403/* confdefs.h. */
5404_ACEOF
5405cat confdefs.h >>conftest.$ac_ext
5406cat >>conftest.$ac_ext <<_ACEOF
5524/* end confdefs.h. */ 5407/* end confdefs.h. */
5525#ifndef __cplusplus 5408#ifndef __cplusplus
5526typedef int foo_t; 5409typedef int foo_t;
@@ -5529,16 +5412,39 @@ $ac_kw foo_t foo () {return 0; }
5529#endif 5412#endif
5530 5413
5531_ACEOF 5414_ACEOF
5532if ac_fn_c_try_compile "$LINENO"; then : 5415rm -f conftest.$ac_objext
5416if { (ac_try="$ac_compile"
5417case "(($ac_try" in
5418 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5419 *) ac_try_echo=$ac_try;;
5420esac
5421eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5422 (eval "$ac_compile") 2>conftest.er1
5423 ac_status=$?
5424 grep -v '^ *+' conftest.er1 >conftest.err
5425 rm -f conftest.er1
5426 cat conftest.err >&5
5427 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5428 (exit $ac_status); } && {
5429 test -z "$ac_c_werror_flag" ||
5430 test ! -s conftest.err
5431 } && test -s conftest.$ac_objext; then
5533 ac_cv_c_inline=$ac_kw 5432 ac_cv_c_inline=$ac_kw
5433else
5434 echo "$as_me: failed program was:" >&5
5435sed 's/^/| /' conftest.$ac_ext >&5
5436
5437
5534fi 5438fi
5439
5535rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5440rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5536 test "$ac_cv_c_inline" != no && break 5441 test "$ac_cv_c_inline" != no && break
5537done 5442done
5538 5443
5539fi 5444fi
5540{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 5445{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
5541$as_echo "$ac_cv_c_inline" >&6; } 5446echo "${ECHO_T}$ac_cv_c_inline" >&6; }
5447
5542 5448
5543case $ac_cv_c_inline in 5449case $ac_cv_c_inline in
5544 inline | yes) ;; 5450 inline | yes) ;;
@@ -5556,48 +5462,312 @@ _ACEOF
5556esac 5462esac
5557 5463
5558 5464
5559ac_fn_c_check_decl "$LINENO" "LLONG_MAX" "ac_cv_have_decl_LLONG_MAX" "#include <limits.h> 5465{ echo "$as_me:$LINENO: checking whether LLONG_MAX is declared" >&5
5560" 5466echo $ECHO_N "checking whether LLONG_MAX is declared... $ECHO_C" >&6; }
5561if test "x$ac_cv_have_decl_LLONG_MAX" = xyes; then : 5467if test "${ac_cv_have_decl_LLONG_MAX+set}" = set; then
5468 echo $ECHO_N "(cached) $ECHO_C" >&6
5469else
5470 cat >conftest.$ac_ext <<_ACEOF
5471/* confdefs.h. */
5472_ACEOF
5473cat confdefs.h >>conftest.$ac_ext
5474cat >>conftest.$ac_ext <<_ACEOF
5475/* end confdefs.h. */
5476#include <limits.h>
5477
5478int
5479main ()
5480{
5481#ifndef LLONG_MAX
5482 (void) LLONG_MAX;
5483#endif
5484
5485 ;
5486 return 0;
5487}
5488_ACEOF
5489rm -f conftest.$ac_objext
5490if { (ac_try="$ac_compile"
5491case "(($ac_try" in
5492 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5493 *) ac_try_echo=$ac_try;;
5494esac
5495eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5496 (eval "$ac_compile") 2>conftest.er1
5497 ac_status=$?
5498 grep -v '^ *+' conftest.er1 >conftest.err
5499 rm -f conftest.er1
5500 cat conftest.err >&5
5501 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5502 (exit $ac_status); } && {
5503 test -z "$ac_c_werror_flag" ||
5504 test ! -s conftest.err
5505 } && test -s conftest.$ac_objext; then
5506 ac_cv_have_decl_LLONG_MAX=yes
5507else
5508 echo "$as_me: failed program was:" >&5
5509sed 's/^/| /' conftest.$ac_ext >&5
5510
5511 ac_cv_have_decl_LLONG_MAX=no
5512fi
5513
5514rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5515fi
5516{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_LLONG_MAX" >&5
5517echo "${ECHO_T}$ac_cv_have_decl_LLONG_MAX" >&6; }
5518if test $ac_cv_have_decl_LLONG_MAX = yes; then
5562 have_llong_max=1 5519 have_llong_max=1
5563fi 5520fi
5564 5521
5565ac_fn_c_check_decl "$LINENO" "SYSTR_POLICY_KILL" "ac_cv_have_decl_SYSTR_POLICY_KILL" " 5522{ echo "$as_me:$LINENO: checking whether SYSTR_POLICY_KILL is declared" >&5
5523echo $ECHO_N "checking whether SYSTR_POLICY_KILL is declared... $ECHO_C" >&6; }
5524if test "${ac_cv_have_decl_SYSTR_POLICY_KILL+set}" = set; then
5525 echo $ECHO_N "(cached) $ECHO_C" >&6
5526else
5527 cat >conftest.$ac_ext <<_ACEOF
5528/* confdefs.h. */
5529_ACEOF
5530cat confdefs.h >>conftest.$ac_ext
5531cat >>conftest.$ac_ext <<_ACEOF
5532/* end confdefs.h. */
5533
5566 #include <sys/types.h> 5534 #include <sys/types.h>
5567 #include <sys/param.h> 5535 #include <sys/param.h>
5568 #include <dev/systrace.h> 5536 #include <dev/systrace.h>
5569 5537
5570" 5538
5571if test "x$ac_cv_have_decl_SYSTR_POLICY_KILL" = xyes; then : 5539int
5540main ()
5541{
5542#ifndef SYSTR_POLICY_KILL
5543 (void) SYSTR_POLICY_KILL;
5544#endif
5545
5546 ;
5547 return 0;
5548}
5549_ACEOF
5550rm -f conftest.$ac_objext
5551if { (ac_try="$ac_compile"
5552case "(($ac_try" in
5553 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5554 *) ac_try_echo=$ac_try;;
5555esac
5556eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5557 (eval "$ac_compile") 2>conftest.er1
5558 ac_status=$?
5559 grep -v '^ *+' conftest.er1 >conftest.err
5560 rm -f conftest.er1
5561 cat conftest.err >&5
5562 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5563 (exit $ac_status); } && {
5564 test -z "$ac_c_werror_flag" ||
5565 test ! -s conftest.err
5566 } && test -s conftest.$ac_objext; then
5567 ac_cv_have_decl_SYSTR_POLICY_KILL=yes
5568else
5569 echo "$as_me: failed program was:" >&5
5570sed 's/^/| /' conftest.$ac_ext >&5
5571
5572 ac_cv_have_decl_SYSTR_POLICY_KILL=no
5573fi
5574
5575rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5576fi
5577{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_SYSTR_POLICY_KILL" >&5
5578echo "${ECHO_T}$ac_cv_have_decl_SYSTR_POLICY_KILL" >&6; }
5579if test $ac_cv_have_decl_SYSTR_POLICY_KILL = yes; then
5572 have_systr_policy_kill=1 5580 have_systr_policy_kill=1
5573fi 5581fi
5574 5582
5575ac_fn_c_check_decl "$LINENO" "RLIMIT_NPROC" "ac_cv_have_decl_RLIMIT_NPROC" " 5583{ echo "$as_me:$LINENO: checking whether RLIMIT_NPROC is declared" >&5
5584echo $ECHO_N "checking whether RLIMIT_NPROC is declared... $ECHO_C" >&6; }
5585if test "${ac_cv_have_decl_RLIMIT_NPROC+set}" = set; then
5586 echo $ECHO_N "(cached) $ECHO_C" >&6
5587else
5588 cat >conftest.$ac_ext <<_ACEOF
5589/* confdefs.h. */
5590_ACEOF
5591cat confdefs.h >>conftest.$ac_ext
5592cat >>conftest.$ac_ext <<_ACEOF
5593/* end confdefs.h. */
5594
5576 #include <sys/types.h> 5595 #include <sys/types.h>
5577 #include <sys/resource.h> 5596 #include <sys/resource.h>
5578 5597
5579"
5580if test "x$ac_cv_have_decl_RLIMIT_NPROC" = xyes; then :
5581 5598
5582$as_echo "#define HAVE_RLIMIT_NPROC /**/" >>confdefs.h 5599int
5600main ()
5601{
5602#ifndef RLIMIT_NPROC
5603 (void) RLIMIT_NPROC;
5604#endif
5583 5605
5606 ;
5607 return 0;
5608}
5609_ACEOF
5610rm -f conftest.$ac_objext
5611if { (ac_try="$ac_compile"
5612case "(($ac_try" in
5613 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5614 *) ac_try_echo=$ac_try;;
5615esac
5616eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5617 (eval "$ac_compile") 2>conftest.er1
5618 ac_status=$?
5619 grep -v '^ *+' conftest.er1 >conftest.err
5620 rm -f conftest.er1
5621 cat conftest.err >&5
5622 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5623 (exit $ac_status); } && {
5624 test -z "$ac_c_werror_flag" ||
5625 test ! -s conftest.err
5626 } && test -s conftest.$ac_objext; then
5627 ac_cv_have_decl_RLIMIT_NPROC=yes
5628else
5629 echo "$as_me: failed program was:" >&5
5630sed 's/^/| /' conftest.$ac_ext >&5
5631
5632 ac_cv_have_decl_RLIMIT_NPROC=no
5584fi 5633fi
5585 5634
5586ac_fn_c_check_decl "$LINENO" "PR_SET_NO_NEW_PRIVS" "ac_cv_have_decl_PR_SET_NO_NEW_PRIVS" " 5635rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5636fi
5637{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_RLIMIT_NPROC" >&5
5638echo "${ECHO_T}$ac_cv_have_decl_RLIMIT_NPROC" >&6; }
5639if test $ac_cv_have_decl_RLIMIT_NPROC = yes; then
5640
5641cat >>confdefs.h <<\_ACEOF
5642#define HAVE_RLIMIT_NPROC
5643_ACEOF
5644
5645fi
5646
5647{ echo "$as_me:$LINENO: checking whether PR_SET_NO_NEW_PRIVS is declared" >&5
5648echo $ECHO_N "checking whether PR_SET_NO_NEW_PRIVS is declared... $ECHO_C" >&6; }
5649if test "${ac_cv_have_decl_PR_SET_NO_NEW_PRIVS+set}" = set; then
5650 echo $ECHO_N "(cached) $ECHO_C" >&6
5651else
5652 cat >conftest.$ac_ext <<_ACEOF
5653/* confdefs.h. */
5654_ACEOF
5655cat confdefs.h >>conftest.$ac_ext
5656cat >>conftest.$ac_ext <<_ACEOF
5657/* end confdefs.h. */
5658
5587 #include <sys/types.h> 5659 #include <sys/types.h>
5588 #include <linux/prctl.h> 5660 #include <linux/prctl.h>
5589 5661
5590" 5662
5591if test "x$ac_cv_have_decl_PR_SET_NO_NEW_PRIVS" = xyes; then : 5663int
5664main ()
5665{
5666#ifndef PR_SET_NO_NEW_PRIVS
5667 (void) PR_SET_NO_NEW_PRIVS;
5668#endif
5669
5670 ;
5671 return 0;
5672}
5673_ACEOF
5674rm -f conftest.$ac_objext
5675if { (ac_try="$ac_compile"
5676case "(($ac_try" in
5677 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5678 *) ac_try_echo=$ac_try;;
5679esac
5680eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5681 (eval "$ac_compile") 2>conftest.er1
5682 ac_status=$?
5683 grep -v '^ *+' conftest.er1 >conftest.err
5684 rm -f conftest.er1
5685 cat conftest.err >&5
5686 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5687 (exit $ac_status); } && {
5688 test -z "$ac_c_werror_flag" ||
5689 test ! -s conftest.err
5690 } && test -s conftest.$ac_objext; then
5691 ac_cv_have_decl_PR_SET_NO_NEW_PRIVS=yes
5692else
5693 echo "$as_me: failed program was:" >&5
5694sed 's/^/| /' conftest.$ac_ext >&5
5695
5696 ac_cv_have_decl_PR_SET_NO_NEW_PRIVS=no
5697fi
5698
5699rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5700fi
5701{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_PR_SET_NO_NEW_PRIVS" >&5
5702echo "${ECHO_T}$ac_cv_have_decl_PR_SET_NO_NEW_PRIVS" >&6; }
5703if test $ac_cv_have_decl_PR_SET_NO_NEW_PRIVS = yes; then
5592 have_linux_no_new_privs=1 5704 have_linux_no_new_privs=1
5593fi 5705fi
5594 5706
5595 5707
5708openssl=yes
5709ssh1=yes
5710
5711# Check whether --with-openssl was given.
5712if test "${with_openssl+set}" = set; then
5713 withval=$with_openssl; if test "x$withval" = "xno" ; then
5714 openssl=no
5715 ssh1=no
5716 fi
5717
5718
5719fi
5720
5721{ echo "$as_me:$LINENO: checking whether OpenSSL will be used for cryptography" >&5
5722echo $ECHO_N "checking whether OpenSSL will be used for cryptography... $ECHO_C" >&6; }
5723if test "x$openssl" = "xyes" ; then
5724 { echo "$as_me:$LINENO: result: yes" >&5
5725echo "${ECHO_T}yes" >&6; }
5726
5727cat >>confdefs.h <<_ACEOF
5728#define WITH_OPENSSL 1
5729_ACEOF
5730
5731else
5732 { echo "$as_me:$LINENO: result: no" >&5
5733echo "${ECHO_T}no" >&6; }
5734fi
5735
5736
5737# Check whether --with-ssh1 was given.
5738if test "${with_ssh1+set}" = set; then
5739 withval=$with_ssh1;
5740 if test "x$withval" = "xno" ; then
5741 ssh1=no
5742 elif test "x$openssl" = "xno" ; then
5743 { { echo "$as_me:$LINENO: error: Cannot enable SSH protocol 1 with OpenSSL disabled" >&5
5744echo "$as_me: error: Cannot enable SSH protocol 1 with OpenSSL disabled" >&2;}
5745 { (exit 1); exit 1; }; }
5746 fi
5747
5748
5749fi
5750
5751{ echo "$as_me:$LINENO: checking whether SSH protocol 1 support is enabled" >&5
5752echo $ECHO_N "checking whether SSH protocol 1 support is enabled... $ECHO_C" >&6; }
5753if test "x$ssh1" = "xyes" ; then
5754 { echo "$as_me:$LINENO: result: yes" >&5
5755echo "${ECHO_T}yes" >&6; }
5756
5757cat >>confdefs.h <<_ACEOF
5758#define WITH_SSH1 1
5759_ACEOF
5760
5761else
5762 { echo "$as_me:$LINENO: result: no" >&5
5763echo "${ECHO_T}no" >&6; }
5764fi
5765
5596use_stack_protector=1 5766use_stack_protector=1
5597use_toolchain_hardening=1 5767use_toolchain_hardening=1
5598 5768
5599# Check whether --with-stackprotect was given. 5769# Check whether --with-stackprotect was given.
5600if test "${with_stackprotect+set}" = set; then : 5770if test "${with_stackprotect+set}" = set; then
5601 withval=$with_stackprotect; 5771 withval=$with_stackprotect;
5602 if test "x$withval" = "xno"; then 5772 if test "x$withval" = "xno"; then
5603 use_stack_protector=0 5773 use_stack_protector=0
@@ -5606,7 +5776,7 @@ fi
5606 5776
5607 5777
5608# Check whether --with-hardening was given. 5778# Check whether --with-hardening was given.
5609if test "${with_hardening+set}" = set; then : 5779if test "${with_hardening+set}" = set; then
5610 withval=$with_hardening; 5780 withval=$with_hardening;
5611 if test "x$withval" = "xno"; then 5781 if test "x$withval" = "xno"; then
5612 use_toolchain_hardening=0 5782 use_toolchain_hardening=0
@@ -5616,36 +5786,64 @@ fi
5616 5786
5617# We use -Werror for the tests only so that we catch warnings like "this is 5787# We use -Werror for the tests only so that we catch warnings like "this is
5618# on by default" for things like -fPIE. 5788# on by default" for things like -fPIE.
5619{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror" >&5 5789{ echo "$as_me:$LINENO: checking if $CC supports -Werror" >&5
5620$as_echo_n "checking if $CC supports -Werror... " >&6; } 5790echo $ECHO_N "checking if $CC supports -Werror... $ECHO_C" >&6; }
5621saved_CFLAGS="$CFLAGS" 5791saved_CFLAGS="$CFLAGS"
5622CFLAGS="$CFLAGS -Werror" 5792CFLAGS="$CFLAGS -Werror"
5623cat confdefs.h - <<_ACEOF >conftest.$ac_ext 5793cat >conftest.$ac_ext <<_ACEOF
5794/* confdefs.h. */
5795_ACEOF
5796cat confdefs.h >>conftest.$ac_ext
5797cat >>conftest.$ac_ext <<_ACEOF
5624/* end confdefs.h. */ 5798/* end confdefs.h. */
5625int main(void) { return 0; } 5799int main(void) { return 0; }
5626_ACEOF 5800_ACEOF
5627if ac_fn_c_try_compile "$LINENO"; then : 5801rm -f conftest.$ac_objext
5628 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 5802if { (ac_try="$ac_compile"
5629$as_echo "yes" >&6; } 5803case "(($ac_try" in
5804 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5805 *) ac_try_echo=$ac_try;;
5806esac
5807eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5808 (eval "$ac_compile") 2>conftest.er1
5809 ac_status=$?
5810 grep -v '^ *+' conftest.er1 >conftest.err
5811 rm -f conftest.er1
5812 cat conftest.err >&5
5813 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5814 (exit $ac_status); } && {
5815 test -z "$ac_c_werror_flag" ||
5816 test ! -s conftest.err
5817 } && test -s conftest.$ac_objext; then
5818 { echo "$as_me:$LINENO: result: yes" >&5
5819echo "${ECHO_T}yes" >&6; }
5630 WERROR="-Werror" 5820 WERROR="-Werror"
5631else 5821else
5632 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5822 echo "$as_me: failed program was:" >&5
5633$as_echo "no" >&6; } 5823sed 's/^/| /' conftest.$ac_ext >&5
5824
5825 { echo "$as_me:$LINENO: result: no" >&5
5826echo "${ECHO_T}no" >&6; }
5634 WERROR="" 5827 WERROR=""
5635 5828
5636fi 5829fi
5830
5637rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5831rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5638CFLAGS="$saved_CFLAGS" 5832CFLAGS="$saved_CFLAGS"
5639 5833
5640if test "$GCC" = "yes" || test "$GCC" = "egcs"; then 5834if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
5641 { 5835 {
5642 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Qunused-arguments" >&5 5836 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Qunused-arguments" >&5
5643$as_echo_n "checking if $CC supports compile flag -Qunused-arguments... " >&6; } 5837echo $ECHO_N "checking if $CC supports compile flag -Qunused-arguments... $ECHO_C" >&6; }
5644 saved_CFLAGS="$CFLAGS" 5838 saved_CFLAGS="$CFLAGS"
5645 CFLAGS="$CFLAGS $WERROR -Qunused-arguments" 5839 CFLAGS="$CFLAGS $WERROR -Qunused-arguments"
5646 _define_flag="" 5840 _define_flag=""
5647 test "x$_define_flag" = "x" && _define_flag="-Qunused-arguments" 5841 test "x$_define_flag" = "x" && _define_flag="-Qunused-arguments"
5648 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 5842 cat >conftest.$ac_ext <<_ACEOF
5843/* confdefs.h. */
5844_ACEOF
5845cat confdefs.h >>conftest.$ac_ext
5846cat >>conftest.$ac_ext <<_ACEOF
5649/* end confdefs.h. */ 5847/* end confdefs.h. */
5650 5848
5651#include <stdlib.h> 5849#include <stdlib.h>
@@ -5661,34 +5859,58 @@ int main(int argc, char **argv) {
5661} 5859}
5662 5860
5663_ACEOF 5861_ACEOF
5664if ac_fn_c_try_compile "$LINENO"; then : 5862rm -f conftest.$ac_objext
5863if { (ac_try="$ac_compile"
5864case "(($ac_try" in
5865 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5866 *) ac_try_echo=$ac_try;;
5867esac
5868eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5869 (eval "$ac_compile") 2>conftest.er1
5870 ac_status=$?
5871 grep -v '^ *+' conftest.er1 >conftest.err
5872 rm -f conftest.er1
5873 cat conftest.err >&5
5874 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5875 (exit $ac_status); } && {
5876 test -z "$ac_c_werror_flag" ||
5877 test ! -s conftest.err
5878 } && test -s conftest.$ac_objext; then
5665 5879
5666if `grep -i "unrecognized option" conftest.err >/dev/null` 5880if `grep -i "unrecognized option" conftest.err >/dev/null`
5667then 5881then
5668 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5882 { echo "$as_me:$LINENO: result: no" >&5
5669$as_echo "no" >&6; } 5883echo "${ECHO_T}no" >&6; }
5670 CFLAGS="$saved_CFLAGS" 5884 CFLAGS="$saved_CFLAGS"
5671else 5885else
5672 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 5886 { echo "$as_me:$LINENO: result: yes" >&5
5673$as_echo "yes" >&6; } 5887echo "${ECHO_T}yes" >&6; }
5674 CFLAGS="$saved_CFLAGS $_define_flag" 5888 CFLAGS="$saved_CFLAGS $_define_flag"
5675fi 5889fi
5676else 5890else
5677 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5891 echo "$as_me: failed program was:" >&5
5678$as_echo "no" >&6; } 5892sed 's/^/| /' conftest.$ac_ext >&5
5893
5894 { echo "$as_me:$LINENO: result: no" >&5
5895echo "${ECHO_T}no" >&6; }
5679 CFLAGS="$saved_CFLAGS" 5896 CFLAGS="$saved_CFLAGS"
5680 5897
5681fi 5898fi
5899
5682rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5900rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5683} 5901}
5684 { 5902 {
5685 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Wunknown-warning-option" >&5 5903 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Wunknown-warning-option" >&5
5686$as_echo_n "checking if $CC supports compile flag -Wunknown-warning-option... " >&6; } 5904echo $ECHO_N "checking if $CC supports compile flag -Wunknown-warning-option... $ECHO_C" >&6; }
5687 saved_CFLAGS="$CFLAGS" 5905 saved_CFLAGS="$CFLAGS"
5688 CFLAGS="$CFLAGS $WERROR -Wunknown-warning-option" 5906 CFLAGS="$CFLAGS $WERROR -Wunknown-warning-option"
5689 _define_flag="" 5907 _define_flag=""
5690 test "x$_define_flag" = "x" && _define_flag="-Wunknown-warning-option" 5908 test "x$_define_flag" = "x" && _define_flag="-Wunknown-warning-option"
5691 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 5909 cat >conftest.$ac_ext <<_ACEOF
5910/* confdefs.h. */
5911_ACEOF
5912cat confdefs.h >>conftest.$ac_ext
5913cat >>conftest.$ac_ext <<_ACEOF
5692/* end confdefs.h. */ 5914/* end confdefs.h. */
5693 5915
5694#include <stdlib.h> 5916#include <stdlib.h>
@@ -5704,34 +5926,58 @@ int main(int argc, char **argv) {
5704} 5926}
5705 5927
5706_ACEOF 5928_ACEOF
5707if ac_fn_c_try_compile "$LINENO"; then : 5929rm -f conftest.$ac_objext
5930if { (ac_try="$ac_compile"
5931case "(($ac_try" in
5932 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5933 *) ac_try_echo=$ac_try;;
5934esac
5935eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5936 (eval "$ac_compile") 2>conftest.er1
5937 ac_status=$?
5938 grep -v '^ *+' conftest.er1 >conftest.err
5939 rm -f conftest.er1
5940 cat conftest.err >&5
5941 echo "$as_me:$LINENO: \$? = $ac_status" >&5
5942 (exit $ac_status); } && {
5943 test -z "$ac_c_werror_flag" ||
5944 test ! -s conftest.err
5945 } && test -s conftest.$ac_objext; then
5708 5946
5709if `grep -i "unrecognized option" conftest.err >/dev/null` 5947if `grep -i "unrecognized option" conftest.err >/dev/null`
5710then 5948then
5711 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5949 { echo "$as_me:$LINENO: result: no" >&5
5712$as_echo "no" >&6; } 5950echo "${ECHO_T}no" >&6; }
5713 CFLAGS="$saved_CFLAGS" 5951 CFLAGS="$saved_CFLAGS"
5714else 5952else
5715 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 5953 { echo "$as_me:$LINENO: result: yes" >&5
5716$as_echo "yes" >&6; } 5954echo "${ECHO_T}yes" >&6; }
5717 CFLAGS="$saved_CFLAGS $_define_flag" 5955 CFLAGS="$saved_CFLAGS $_define_flag"
5718fi 5956fi
5719else 5957else
5720 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5958 echo "$as_me: failed program was:" >&5
5721$as_echo "no" >&6; } 5959sed 's/^/| /' conftest.$ac_ext >&5
5960
5961 { echo "$as_me:$LINENO: result: no" >&5
5962echo "${ECHO_T}no" >&6; }
5722 CFLAGS="$saved_CFLAGS" 5963 CFLAGS="$saved_CFLAGS"
5723 5964
5724fi 5965fi
5966
5725rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5967rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5726} 5968}
5727 { 5969 {
5728 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Wall" >&5 5970 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Wall" >&5
5729$as_echo_n "checking if $CC supports compile flag -Wall... " >&6; } 5971echo $ECHO_N "checking if $CC supports compile flag -Wall... $ECHO_C" >&6; }
5730 saved_CFLAGS="$CFLAGS" 5972 saved_CFLAGS="$CFLAGS"
5731 CFLAGS="$CFLAGS $WERROR -Wall" 5973 CFLAGS="$CFLAGS $WERROR -Wall"
5732 _define_flag="" 5974 _define_flag=""
5733 test "x$_define_flag" = "x" && _define_flag="-Wall" 5975 test "x$_define_flag" = "x" && _define_flag="-Wall"
5734 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 5976 cat >conftest.$ac_ext <<_ACEOF
5977/* confdefs.h. */
5978_ACEOF
5979cat confdefs.h >>conftest.$ac_ext
5980cat >>conftest.$ac_ext <<_ACEOF
5735/* end confdefs.h. */ 5981/* end confdefs.h. */
5736 5982
5737#include <stdlib.h> 5983#include <stdlib.h>
@@ -5747,34 +5993,58 @@ int main(int argc, char **argv) {
5747} 5993}
5748 5994
5749_ACEOF 5995_ACEOF
5750if ac_fn_c_try_compile "$LINENO"; then : 5996rm -f conftest.$ac_objext
5997if { (ac_try="$ac_compile"
5998case "(($ac_try" in
5999 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6000 *) ac_try_echo=$ac_try;;
6001esac
6002eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6003 (eval "$ac_compile") 2>conftest.er1
6004 ac_status=$?
6005 grep -v '^ *+' conftest.er1 >conftest.err
6006 rm -f conftest.er1
6007 cat conftest.err >&5
6008 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6009 (exit $ac_status); } && {
6010 test -z "$ac_c_werror_flag" ||
6011 test ! -s conftest.err
6012 } && test -s conftest.$ac_objext; then
5751 6013
5752if `grep -i "unrecognized option" conftest.err >/dev/null` 6014if `grep -i "unrecognized option" conftest.err >/dev/null`
5753then 6015then
5754 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6016 { echo "$as_me:$LINENO: result: no" >&5
5755$as_echo "no" >&6; } 6017echo "${ECHO_T}no" >&6; }
5756 CFLAGS="$saved_CFLAGS" 6018 CFLAGS="$saved_CFLAGS"
5757else 6019else
5758 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6020 { echo "$as_me:$LINENO: result: yes" >&5
5759$as_echo "yes" >&6; } 6021echo "${ECHO_T}yes" >&6; }
5760 CFLAGS="$saved_CFLAGS $_define_flag" 6022 CFLAGS="$saved_CFLAGS $_define_flag"
5761fi 6023fi
5762else 6024else
5763 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6025 echo "$as_me: failed program was:" >&5
5764$as_echo "no" >&6; } 6026sed 's/^/| /' conftest.$ac_ext >&5
6027
6028 { echo "$as_me:$LINENO: result: no" >&5
6029echo "${ECHO_T}no" >&6; }
5765 CFLAGS="$saved_CFLAGS" 6030 CFLAGS="$saved_CFLAGS"
5766 6031
5767fi 6032fi
6033
5768rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6034rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5769} 6035}
5770 { 6036 {
5771 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Wpointer-arith" >&5 6037 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Wpointer-arith" >&5
5772$as_echo_n "checking if $CC supports compile flag -Wpointer-arith... " >&6; } 6038echo $ECHO_N "checking if $CC supports compile flag -Wpointer-arith... $ECHO_C" >&6; }
5773 saved_CFLAGS="$CFLAGS" 6039 saved_CFLAGS="$CFLAGS"
5774 CFLAGS="$CFLAGS $WERROR -Wpointer-arith" 6040 CFLAGS="$CFLAGS $WERROR -Wpointer-arith"
5775 _define_flag="" 6041 _define_flag=""
5776 test "x$_define_flag" = "x" && _define_flag="-Wpointer-arith" 6042 test "x$_define_flag" = "x" && _define_flag="-Wpointer-arith"
5777 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6043 cat >conftest.$ac_ext <<_ACEOF
6044/* confdefs.h. */
6045_ACEOF
6046cat confdefs.h >>conftest.$ac_ext
6047cat >>conftest.$ac_ext <<_ACEOF
5778/* end confdefs.h. */ 6048/* end confdefs.h. */
5779 6049
5780#include <stdlib.h> 6050#include <stdlib.h>
@@ -5790,34 +6060,58 @@ int main(int argc, char **argv) {
5790} 6060}
5791 6061
5792_ACEOF 6062_ACEOF
5793if ac_fn_c_try_compile "$LINENO"; then : 6063rm -f conftest.$ac_objext
6064if { (ac_try="$ac_compile"
6065case "(($ac_try" in
6066 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6067 *) ac_try_echo=$ac_try;;
6068esac
6069eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6070 (eval "$ac_compile") 2>conftest.er1
6071 ac_status=$?
6072 grep -v '^ *+' conftest.er1 >conftest.err
6073 rm -f conftest.er1
6074 cat conftest.err >&5
6075 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6076 (exit $ac_status); } && {
6077 test -z "$ac_c_werror_flag" ||
6078 test ! -s conftest.err
6079 } && test -s conftest.$ac_objext; then
5794 6080
5795if `grep -i "unrecognized option" conftest.err >/dev/null` 6081if `grep -i "unrecognized option" conftest.err >/dev/null`
5796then 6082then
5797 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6083 { echo "$as_me:$LINENO: result: no" >&5
5798$as_echo "no" >&6; } 6084echo "${ECHO_T}no" >&6; }
5799 CFLAGS="$saved_CFLAGS" 6085 CFLAGS="$saved_CFLAGS"
5800else 6086else
5801 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6087 { echo "$as_me:$LINENO: result: yes" >&5
5802$as_echo "yes" >&6; } 6088echo "${ECHO_T}yes" >&6; }
5803 CFLAGS="$saved_CFLAGS $_define_flag" 6089 CFLAGS="$saved_CFLAGS $_define_flag"
5804fi 6090fi
5805else 6091else
5806 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6092 echo "$as_me: failed program was:" >&5
5807$as_echo "no" >&6; } 6093sed 's/^/| /' conftest.$ac_ext >&5
6094
6095 { echo "$as_me:$LINENO: result: no" >&5
6096echo "${ECHO_T}no" >&6; }
5808 CFLAGS="$saved_CFLAGS" 6097 CFLAGS="$saved_CFLAGS"
5809 6098
5810fi 6099fi
6100
5811rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6101rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5812} 6102}
5813 { 6103 {
5814 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Wuninitialized" >&5 6104 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Wuninitialized" >&5
5815$as_echo_n "checking if $CC supports compile flag -Wuninitialized... " >&6; } 6105echo $ECHO_N "checking if $CC supports compile flag -Wuninitialized... $ECHO_C" >&6; }
5816 saved_CFLAGS="$CFLAGS" 6106 saved_CFLAGS="$CFLAGS"
5817 CFLAGS="$CFLAGS $WERROR -Wuninitialized" 6107 CFLAGS="$CFLAGS $WERROR -Wuninitialized"
5818 _define_flag="" 6108 _define_flag=""
5819 test "x$_define_flag" = "x" && _define_flag="-Wuninitialized" 6109 test "x$_define_flag" = "x" && _define_flag="-Wuninitialized"
5820 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6110 cat >conftest.$ac_ext <<_ACEOF
6111/* confdefs.h. */
6112_ACEOF
6113cat confdefs.h >>conftest.$ac_ext
6114cat >>conftest.$ac_ext <<_ACEOF
5821/* end confdefs.h. */ 6115/* end confdefs.h. */
5822 6116
5823#include <stdlib.h> 6117#include <stdlib.h>
@@ -5833,34 +6127,58 @@ int main(int argc, char **argv) {
5833} 6127}
5834 6128
5835_ACEOF 6129_ACEOF
5836if ac_fn_c_try_compile "$LINENO"; then : 6130rm -f conftest.$ac_objext
6131if { (ac_try="$ac_compile"
6132case "(($ac_try" in
6133 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6134 *) ac_try_echo=$ac_try;;
6135esac
6136eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6137 (eval "$ac_compile") 2>conftest.er1
6138 ac_status=$?
6139 grep -v '^ *+' conftest.er1 >conftest.err
6140 rm -f conftest.er1
6141 cat conftest.err >&5
6142 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6143 (exit $ac_status); } && {
6144 test -z "$ac_c_werror_flag" ||
6145 test ! -s conftest.err
6146 } && test -s conftest.$ac_objext; then
5837 6147
5838if `grep -i "unrecognized option" conftest.err >/dev/null` 6148if `grep -i "unrecognized option" conftest.err >/dev/null`
5839then 6149then
5840 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6150 { echo "$as_me:$LINENO: result: no" >&5
5841$as_echo "no" >&6; } 6151echo "${ECHO_T}no" >&6; }
5842 CFLAGS="$saved_CFLAGS" 6152 CFLAGS="$saved_CFLAGS"
5843else 6153else
5844 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6154 { echo "$as_me:$LINENO: result: yes" >&5
5845$as_echo "yes" >&6; } 6155echo "${ECHO_T}yes" >&6; }
5846 CFLAGS="$saved_CFLAGS $_define_flag" 6156 CFLAGS="$saved_CFLAGS $_define_flag"
5847fi 6157fi
5848else 6158else
5849 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6159 echo "$as_me: failed program was:" >&5
5850$as_echo "no" >&6; } 6160sed 's/^/| /' conftest.$ac_ext >&5
6161
6162 { echo "$as_me:$LINENO: result: no" >&5
6163echo "${ECHO_T}no" >&6; }
5851 CFLAGS="$saved_CFLAGS" 6164 CFLAGS="$saved_CFLAGS"
5852 6165
5853fi 6166fi
6167
5854rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6168rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5855} 6169}
5856 { 6170 {
5857 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Wsign-compare" >&5 6171 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Wsign-compare" >&5
5858$as_echo_n "checking if $CC supports compile flag -Wsign-compare... " >&6; } 6172echo $ECHO_N "checking if $CC supports compile flag -Wsign-compare... $ECHO_C" >&6; }
5859 saved_CFLAGS="$CFLAGS" 6173 saved_CFLAGS="$CFLAGS"
5860 CFLAGS="$CFLAGS $WERROR -Wsign-compare" 6174 CFLAGS="$CFLAGS $WERROR -Wsign-compare"
5861 _define_flag="" 6175 _define_flag=""
5862 test "x$_define_flag" = "x" && _define_flag="-Wsign-compare" 6176 test "x$_define_flag" = "x" && _define_flag="-Wsign-compare"
5863 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6177 cat >conftest.$ac_ext <<_ACEOF
6178/* confdefs.h. */
6179_ACEOF
6180cat confdefs.h >>conftest.$ac_ext
6181cat >>conftest.$ac_ext <<_ACEOF
5864/* end confdefs.h. */ 6182/* end confdefs.h. */
5865 6183
5866#include <stdlib.h> 6184#include <stdlib.h>
@@ -5876,34 +6194,58 @@ int main(int argc, char **argv) {
5876} 6194}
5877 6195
5878_ACEOF 6196_ACEOF
5879if ac_fn_c_try_compile "$LINENO"; then : 6197rm -f conftest.$ac_objext
6198if { (ac_try="$ac_compile"
6199case "(($ac_try" in
6200 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6201 *) ac_try_echo=$ac_try;;
6202esac
6203eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6204 (eval "$ac_compile") 2>conftest.er1
6205 ac_status=$?
6206 grep -v '^ *+' conftest.er1 >conftest.err
6207 rm -f conftest.er1
6208 cat conftest.err >&5
6209 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6210 (exit $ac_status); } && {
6211 test -z "$ac_c_werror_flag" ||
6212 test ! -s conftest.err
6213 } && test -s conftest.$ac_objext; then
5880 6214
5881if `grep -i "unrecognized option" conftest.err >/dev/null` 6215if `grep -i "unrecognized option" conftest.err >/dev/null`
5882then 6216then
5883 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6217 { echo "$as_me:$LINENO: result: no" >&5
5884$as_echo "no" >&6; } 6218echo "${ECHO_T}no" >&6; }
5885 CFLAGS="$saved_CFLAGS" 6219 CFLAGS="$saved_CFLAGS"
5886else 6220else
5887 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6221 { echo "$as_me:$LINENO: result: yes" >&5
5888$as_echo "yes" >&6; } 6222echo "${ECHO_T}yes" >&6; }
5889 CFLAGS="$saved_CFLAGS $_define_flag" 6223 CFLAGS="$saved_CFLAGS $_define_flag"
5890fi 6224fi
5891else 6225else
5892 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6226 echo "$as_me: failed program was:" >&5
5893$as_echo "no" >&6; } 6227sed 's/^/| /' conftest.$ac_ext >&5
6228
6229 { echo "$as_me:$LINENO: result: no" >&5
6230echo "${ECHO_T}no" >&6; }
5894 CFLAGS="$saved_CFLAGS" 6231 CFLAGS="$saved_CFLAGS"
5895 6232
5896fi 6233fi
6234
5897rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6235rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5898} 6236}
5899 { 6237 {
5900 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Wformat-security" >&5 6238 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Wformat-security" >&5
5901$as_echo_n "checking if $CC supports compile flag -Wformat-security... " >&6; } 6239echo $ECHO_N "checking if $CC supports compile flag -Wformat-security... $ECHO_C" >&6; }
5902 saved_CFLAGS="$CFLAGS" 6240 saved_CFLAGS="$CFLAGS"
5903 CFLAGS="$CFLAGS $WERROR -Wformat-security" 6241 CFLAGS="$CFLAGS $WERROR -Wformat-security"
5904 _define_flag="" 6242 _define_flag=""
5905 test "x$_define_flag" = "x" && _define_flag="-Wformat-security" 6243 test "x$_define_flag" = "x" && _define_flag="-Wformat-security"
5906 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6244 cat >conftest.$ac_ext <<_ACEOF
6245/* confdefs.h. */
6246_ACEOF
6247cat confdefs.h >>conftest.$ac_ext
6248cat >>conftest.$ac_ext <<_ACEOF
5907/* end confdefs.h. */ 6249/* end confdefs.h. */
5908 6250
5909#include <stdlib.h> 6251#include <stdlib.h>
@@ -5919,34 +6261,58 @@ int main(int argc, char **argv) {
5919} 6261}
5920 6262
5921_ACEOF 6263_ACEOF
5922if ac_fn_c_try_compile "$LINENO"; then : 6264rm -f conftest.$ac_objext
6265if { (ac_try="$ac_compile"
6266case "(($ac_try" in
6267 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6268 *) ac_try_echo=$ac_try;;
6269esac
6270eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6271 (eval "$ac_compile") 2>conftest.er1
6272 ac_status=$?
6273 grep -v '^ *+' conftest.er1 >conftest.err
6274 rm -f conftest.er1
6275 cat conftest.err >&5
6276 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6277 (exit $ac_status); } && {
6278 test -z "$ac_c_werror_flag" ||
6279 test ! -s conftest.err
6280 } && test -s conftest.$ac_objext; then
5923 6281
5924if `grep -i "unrecognized option" conftest.err >/dev/null` 6282if `grep -i "unrecognized option" conftest.err >/dev/null`
5925then 6283then
5926 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6284 { echo "$as_me:$LINENO: result: no" >&5
5927$as_echo "no" >&6; } 6285echo "${ECHO_T}no" >&6; }
5928 CFLAGS="$saved_CFLAGS" 6286 CFLAGS="$saved_CFLAGS"
5929else 6287else
5930 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6288 { echo "$as_me:$LINENO: result: yes" >&5
5931$as_echo "yes" >&6; } 6289echo "${ECHO_T}yes" >&6; }
5932 CFLAGS="$saved_CFLAGS $_define_flag" 6290 CFLAGS="$saved_CFLAGS $_define_flag"
5933fi 6291fi
5934else 6292else
5935 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6293 echo "$as_me: failed program was:" >&5
5936$as_echo "no" >&6; } 6294sed 's/^/| /' conftest.$ac_ext >&5
6295
6296 { echo "$as_me:$LINENO: result: no" >&5
6297echo "${ECHO_T}no" >&6; }
5937 CFLAGS="$saved_CFLAGS" 6298 CFLAGS="$saved_CFLAGS"
5938 6299
5939fi 6300fi
6301
5940rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6302rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5941} 6303}
5942 { 6304 {
5943 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Wsizeof-pointer-memaccess" >&5 6305 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Wsizeof-pointer-memaccess" >&5
5944$as_echo_n "checking if $CC supports compile flag -Wsizeof-pointer-memaccess... " >&6; } 6306echo $ECHO_N "checking if $CC supports compile flag -Wsizeof-pointer-memaccess... $ECHO_C" >&6; }
5945 saved_CFLAGS="$CFLAGS" 6307 saved_CFLAGS="$CFLAGS"
5946 CFLAGS="$CFLAGS $WERROR -Wsizeof-pointer-memaccess" 6308 CFLAGS="$CFLAGS $WERROR -Wsizeof-pointer-memaccess"
5947 _define_flag="" 6309 _define_flag=""
5948 test "x$_define_flag" = "x" && _define_flag="-Wsizeof-pointer-memaccess" 6310 test "x$_define_flag" = "x" && _define_flag="-Wsizeof-pointer-memaccess"
5949 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6311 cat >conftest.$ac_ext <<_ACEOF
6312/* confdefs.h. */
6313_ACEOF
6314cat confdefs.h >>conftest.$ac_ext
6315cat >>conftest.$ac_ext <<_ACEOF
5950/* end confdefs.h. */ 6316/* end confdefs.h. */
5951 6317
5952#include <stdlib.h> 6318#include <stdlib.h>
@@ -5962,34 +6328,58 @@ int main(int argc, char **argv) {
5962} 6328}
5963 6329
5964_ACEOF 6330_ACEOF
5965if ac_fn_c_try_compile "$LINENO"; then : 6331rm -f conftest.$ac_objext
6332if { (ac_try="$ac_compile"
6333case "(($ac_try" in
6334 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6335 *) ac_try_echo=$ac_try;;
6336esac
6337eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6338 (eval "$ac_compile") 2>conftest.er1
6339 ac_status=$?
6340 grep -v '^ *+' conftest.er1 >conftest.err
6341 rm -f conftest.er1
6342 cat conftest.err >&5
6343 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6344 (exit $ac_status); } && {
6345 test -z "$ac_c_werror_flag" ||
6346 test ! -s conftest.err
6347 } && test -s conftest.$ac_objext; then
5966 6348
5967if `grep -i "unrecognized option" conftest.err >/dev/null` 6349if `grep -i "unrecognized option" conftest.err >/dev/null`
5968then 6350then
5969 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6351 { echo "$as_me:$LINENO: result: no" >&5
5970$as_echo "no" >&6; } 6352echo "${ECHO_T}no" >&6; }
5971 CFLAGS="$saved_CFLAGS" 6353 CFLAGS="$saved_CFLAGS"
5972else 6354else
5973 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6355 { echo "$as_me:$LINENO: result: yes" >&5
5974$as_echo "yes" >&6; } 6356echo "${ECHO_T}yes" >&6; }
5975 CFLAGS="$saved_CFLAGS $_define_flag" 6357 CFLAGS="$saved_CFLAGS $_define_flag"
5976fi 6358fi
5977else 6359else
5978 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6360 echo "$as_me: failed program was:" >&5
5979$as_echo "no" >&6; } 6361sed 's/^/| /' conftest.$ac_ext >&5
6362
6363 { echo "$as_me:$LINENO: result: no" >&5
6364echo "${ECHO_T}no" >&6; }
5980 CFLAGS="$saved_CFLAGS" 6365 CFLAGS="$saved_CFLAGS"
5981 6366
5982fi 6367fi
6368
5983rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6369rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5984} 6370}
5985 { 6371 {
5986 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Wpointer-sign" >&5 6372 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Wpointer-sign" >&5
5987$as_echo_n "checking if $CC supports compile flag -Wpointer-sign... " >&6; } 6373echo $ECHO_N "checking if $CC supports compile flag -Wpointer-sign... $ECHO_C" >&6; }
5988 saved_CFLAGS="$CFLAGS" 6374 saved_CFLAGS="$CFLAGS"
5989 CFLAGS="$CFLAGS $WERROR -Wpointer-sign" 6375 CFLAGS="$CFLAGS $WERROR -Wpointer-sign"
5990 _define_flag="-Wno-pointer-sign" 6376 _define_flag="-Wno-pointer-sign"
5991 test "x$_define_flag" = "x" && _define_flag="-Wpointer-sign" 6377 test "x$_define_flag" = "x" && _define_flag="-Wpointer-sign"
5992 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6378 cat >conftest.$ac_ext <<_ACEOF
6379/* confdefs.h. */
6380_ACEOF
6381cat confdefs.h >>conftest.$ac_ext
6382cat >>conftest.$ac_ext <<_ACEOF
5993/* end confdefs.h. */ 6383/* end confdefs.h. */
5994 6384
5995#include <stdlib.h> 6385#include <stdlib.h>
@@ -6005,34 +6395,58 @@ int main(int argc, char **argv) {
6005} 6395}
6006 6396
6007_ACEOF 6397_ACEOF
6008if ac_fn_c_try_compile "$LINENO"; then : 6398rm -f conftest.$ac_objext
6399if { (ac_try="$ac_compile"
6400case "(($ac_try" in
6401 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6402 *) ac_try_echo=$ac_try;;
6403esac
6404eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6405 (eval "$ac_compile") 2>conftest.er1
6406 ac_status=$?
6407 grep -v '^ *+' conftest.er1 >conftest.err
6408 rm -f conftest.er1
6409 cat conftest.err >&5
6410 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6411 (exit $ac_status); } && {
6412 test -z "$ac_c_werror_flag" ||
6413 test ! -s conftest.err
6414 } && test -s conftest.$ac_objext; then
6009 6415
6010if `grep -i "unrecognized option" conftest.err >/dev/null` 6416if `grep -i "unrecognized option" conftest.err >/dev/null`
6011then 6417then
6012 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6418 { echo "$as_me:$LINENO: result: no" >&5
6013$as_echo "no" >&6; } 6419echo "${ECHO_T}no" >&6; }
6014 CFLAGS="$saved_CFLAGS" 6420 CFLAGS="$saved_CFLAGS"
6015else 6421else
6016 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6422 { echo "$as_me:$LINENO: result: yes" >&5
6017$as_echo "yes" >&6; } 6423echo "${ECHO_T}yes" >&6; }
6018 CFLAGS="$saved_CFLAGS $_define_flag" 6424 CFLAGS="$saved_CFLAGS $_define_flag"
6019fi 6425fi
6020else 6426else
6021 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6427 echo "$as_me: failed program was:" >&5
6022$as_echo "no" >&6; } 6428sed 's/^/| /' conftest.$ac_ext >&5
6429
6430 { echo "$as_me:$LINENO: result: no" >&5
6431echo "${ECHO_T}no" >&6; }
6023 CFLAGS="$saved_CFLAGS" 6432 CFLAGS="$saved_CFLAGS"
6024 6433
6025fi 6434fi
6435
6026rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6436rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6027} 6437}
6028 { 6438 {
6029 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Wunused-result" >&5 6439 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Wunused-result" >&5
6030$as_echo_n "checking if $CC supports compile flag -Wunused-result... " >&6; } 6440echo $ECHO_N "checking if $CC supports compile flag -Wunused-result... $ECHO_C" >&6; }
6031 saved_CFLAGS="$CFLAGS" 6441 saved_CFLAGS="$CFLAGS"
6032 CFLAGS="$CFLAGS $WERROR -Wunused-result" 6442 CFLAGS="$CFLAGS $WERROR -Wunused-result"
6033 _define_flag="-Wno-unused-result" 6443 _define_flag="-Wno-unused-result"
6034 test "x$_define_flag" = "x" && _define_flag="-Wunused-result" 6444 test "x$_define_flag" = "x" && _define_flag="-Wunused-result"
6035 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6445 cat >conftest.$ac_ext <<_ACEOF
6446/* confdefs.h. */
6447_ACEOF
6448cat confdefs.h >>conftest.$ac_ext
6449cat >>conftest.$ac_ext <<_ACEOF
6036/* end confdefs.h. */ 6450/* end confdefs.h. */
6037 6451
6038#include <stdlib.h> 6452#include <stdlib.h>
@@ -6048,34 +6462,58 @@ int main(int argc, char **argv) {
6048} 6462}
6049 6463
6050_ACEOF 6464_ACEOF
6051if ac_fn_c_try_compile "$LINENO"; then : 6465rm -f conftest.$ac_objext
6466if { (ac_try="$ac_compile"
6467case "(($ac_try" in
6468 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6469 *) ac_try_echo=$ac_try;;
6470esac
6471eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6472 (eval "$ac_compile") 2>conftest.er1
6473 ac_status=$?
6474 grep -v '^ *+' conftest.er1 >conftest.err
6475 rm -f conftest.er1
6476 cat conftest.err >&5
6477 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6478 (exit $ac_status); } && {
6479 test -z "$ac_c_werror_flag" ||
6480 test ! -s conftest.err
6481 } && test -s conftest.$ac_objext; then
6052 6482
6053if `grep -i "unrecognized option" conftest.err >/dev/null` 6483if `grep -i "unrecognized option" conftest.err >/dev/null`
6054then 6484then
6055 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6485 { echo "$as_me:$LINENO: result: no" >&5
6056$as_echo "no" >&6; } 6486echo "${ECHO_T}no" >&6; }
6057 CFLAGS="$saved_CFLAGS" 6487 CFLAGS="$saved_CFLAGS"
6058else 6488else
6059 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6489 { echo "$as_me:$LINENO: result: yes" >&5
6060$as_echo "yes" >&6; } 6490echo "${ECHO_T}yes" >&6; }
6061 CFLAGS="$saved_CFLAGS $_define_flag" 6491 CFLAGS="$saved_CFLAGS $_define_flag"
6062fi 6492fi
6063else 6493else
6064 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6494 echo "$as_me: failed program was:" >&5
6065$as_echo "no" >&6; } 6495sed 's/^/| /' conftest.$ac_ext >&5
6496
6497 { echo "$as_me:$LINENO: result: no" >&5
6498echo "${ECHO_T}no" >&6; }
6066 CFLAGS="$saved_CFLAGS" 6499 CFLAGS="$saved_CFLAGS"
6067 6500
6068fi 6501fi
6502
6069rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6503rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6070} 6504}
6071 { 6505 {
6072 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -fno-strict-aliasing" >&5 6506 { echo "$as_me:$LINENO: checking if $CC supports compile flag -fno-strict-aliasing" >&5
6073$as_echo_n "checking if $CC supports compile flag -fno-strict-aliasing... " >&6; } 6507echo $ECHO_N "checking if $CC supports compile flag -fno-strict-aliasing... $ECHO_C" >&6; }
6074 saved_CFLAGS="$CFLAGS" 6508 saved_CFLAGS="$CFLAGS"
6075 CFLAGS="$CFLAGS $WERROR -fno-strict-aliasing" 6509 CFLAGS="$CFLAGS $WERROR -fno-strict-aliasing"
6076 _define_flag="" 6510 _define_flag=""
6077 test "x$_define_flag" = "x" && _define_flag="-fno-strict-aliasing" 6511 test "x$_define_flag" = "x" && _define_flag="-fno-strict-aliasing"
6078 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6512 cat >conftest.$ac_ext <<_ACEOF
6513/* confdefs.h. */
6514_ACEOF
6515cat confdefs.h >>conftest.$ac_ext
6516cat >>conftest.$ac_ext <<_ACEOF
6079/* end confdefs.h. */ 6517/* end confdefs.h. */
6080 6518
6081#include <stdlib.h> 6519#include <stdlib.h>
@@ -6091,34 +6529,58 @@ int main(int argc, char **argv) {
6091} 6529}
6092 6530
6093_ACEOF 6531_ACEOF
6094if ac_fn_c_try_compile "$LINENO"; then : 6532rm -f conftest.$ac_objext
6533if { (ac_try="$ac_compile"
6534case "(($ac_try" in
6535 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6536 *) ac_try_echo=$ac_try;;
6537esac
6538eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6539 (eval "$ac_compile") 2>conftest.er1
6540 ac_status=$?
6541 grep -v '^ *+' conftest.er1 >conftest.err
6542 rm -f conftest.er1
6543 cat conftest.err >&5
6544 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6545 (exit $ac_status); } && {
6546 test -z "$ac_c_werror_flag" ||
6547 test ! -s conftest.err
6548 } && test -s conftest.$ac_objext; then
6095 6549
6096if `grep -i "unrecognized option" conftest.err >/dev/null` 6550if `grep -i "unrecognized option" conftest.err >/dev/null`
6097then 6551then
6098 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6552 { echo "$as_me:$LINENO: result: no" >&5
6099$as_echo "no" >&6; } 6553echo "${ECHO_T}no" >&6; }
6100 CFLAGS="$saved_CFLAGS" 6554 CFLAGS="$saved_CFLAGS"
6101else 6555else
6102 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6556 { echo "$as_me:$LINENO: result: yes" >&5
6103$as_echo "yes" >&6; } 6557echo "${ECHO_T}yes" >&6; }
6104 CFLAGS="$saved_CFLAGS $_define_flag" 6558 CFLAGS="$saved_CFLAGS $_define_flag"
6105fi 6559fi
6106else 6560else
6107 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6561 echo "$as_me: failed program was:" >&5
6108$as_echo "no" >&6; } 6562sed 's/^/| /' conftest.$ac_ext >&5
6563
6564 { echo "$as_me:$LINENO: result: no" >&5
6565echo "${ECHO_T}no" >&6; }
6109 CFLAGS="$saved_CFLAGS" 6566 CFLAGS="$saved_CFLAGS"
6110 6567
6111fi 6568fi
6569
6112rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6570rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6113} 6571}
6114 { 6572 {
6115 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -D_FORTIFY_SOURCE=2" >&5 6573 { echo "$as_me:$LINENO: checking if $CC supports compile flag -D_FORTIFY_SOURCE=2" >&5
6116$as_echo_n "checking if $CC supports compile flag -D_FORTIFY_SOURCE=2... " >&6; } 6574echo $ECHO_N "checking if $CC supports compile flag -D_FORTIFY_SOURCE=2... $ECHO_C" >&6; }
6117 saved_CFLAGS="$CFLAGS" 6575 saved_CFLAGS="$CFLAGS"
6118 CFLAGS="$CFLAGS $WERROR -D_FORTIFY_SOURCE=2" 6576 CFLAGS="$CFLAGS $WERROR -D_FORTIFY_SOURCE=2"
6119 _define_flag="" 6577 _define_flag=""
6120 test "x$_define_flag" = "x" && _define_flag="-D_FORTIFY_SOURCE=2" 6578 test "x$_define_flag" = "x" && _define_flag="-D_FORTIFY_SOURCE=2"
6121 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6579 cat >conftest.$ac_ext <<_ACEOF
6580/* confdefs.h. */
6581_ACEOF
6582cat confdefs.h >>conftest.$ac_ext
6583cat >>conftest.$ac_ext <<_ACEOF
6122/* end confdefs.h. */ 6584/* end confdefs.h. */
6123 6585
6124#include <stdlib.h> 6586#include <stdlib.h>
@@ -6134,35 +6596,59 @@ int main(int argc, char **argv) {
6134} 6596}
6135 6597
6136_ACEOF 6598_ACEOF
6137if ac_fn_c_try_compile "$LINENO"; then : 6599rm -f conftest.$ac_objext
6600if { (ac_try="$ac_compile"
6601case "(($ac_try" in
6602 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6603 *) ac_try_echo=$ac_try;;
6604esac
6605eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6606 (eval "$ac_compile") 2>conftest.er1
6607 ac_status=$?
6608 grep -v '^ *+' conftest.er1 >conftest.err
6609 rm -f conftest.er1
6610 cat conftest.err >&5
6611 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6612 (exit $ac_status); } && {
6613 test -z "$ac_c_werror_flag" ||
6614 test ! -s conftest.err
6615 } && test -s conftest.$ac_objext; then
6138 6616
6139if `grep -i "unrecognized option" conftest.err >/dev/null` 6617if `grep -i "unrecognized option" conftest.err >/dev/null`
6140then 6618then
6141 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6619 { echo "$as_me:$LINENO: result: no" >&5
6142$as_echo "no" >&6; } 6620echo "${ECHO_T}no" >&6; }
6143 CFLAGS="$saved_CFLAGS" 6621 CFLAGS="$saved_CFLAGS"
6144else 6622else
6145 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6623 { echo "$as_me:$LINENO: result: yes" >&5
6146$as_echo "yes" >&6; } 6624echo "${ECHO_T}yes" >&6; }
6147 CFLAGS="$saved_CFLAGS $_define_flag" 6625 CFLAGS="$saved_CFLAGS $_define_flag"
6148fi 6626fi
6149else 6627else
6150 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6628 echo "$as_me: failed program was:" >&5
6151$as_echo "no" >&6; } 6629sed 's/^/| /' conftest.$ac_ext >&5
6630
6631 { echo "$as_me:$LINENO: result: no" >&5
6632echo "${ECHO_T}no" >&6; }
6152 CFLAGS="$saved_CFLAGS" 6633 CFLAGS="$saved_CFLAGS"
6153 6634
6154fi 6635fi
6636
6155rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6637rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6156} 6638}
6157 if test "x$use_toolchain_hardening" = "x1"; then 6639 if test "x$use_toolchain_hardening" = "x1"; then
6158 { 6640 {
6159 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $LD supports link flag -Wl,-z,relro" >&5 6641 { echo "$as_me:$LINENO: checking if $LD supports link flag -Wl,-z,relro" >&5
6160$as_echo_n "checking if $LD supports link flag -Wl,-z,relro... " >&6; } 6642echo $ECHO_N "checking if $LD supports link flag -Wl,-z,relro... $ECHO_C" >&6; }
6161 saved_LDFLAGS="$LDFLAGS" 6643 saved_LDFLAGS="$LDFLAGS"
6162 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,relro" 6644 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,relro"
6163 _define_flag="" 6645 _define_flag=""
6164 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,relro" 6646 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,relro"
6165 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6647 cat >conftest.$ac_ext <<_ACEOF
6648/* confdefs.h. */
6649_ACEOF
6650cat confdefs.h >>conftest.$ac_ext
6651cat >>conftest.$ac_ext <<_ACEOF
6166/* end confdefs.h. */ 6652/* end confdefs.h. */
6167 6653
6168#include <stdlib.h> 6654#include <stdlib.h>
@@ -6178,27 +6664,52 @@ int main(int argc, char **argv) {
6178} 6664}
6179 6665
6180_ACEOF 6666_ACEOF
6181if ac_fn_c_try_link "$LINENO"; then : 6667rm -f conftest.$ac_objext conftest$ac_exeext
6182 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6668if { (ac_try="$ac_link"
6183$as_echo "yes" >&6; } 6669case "(($ac_try" in
6670 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6671 *) ac_try_echo=$ac_try;;
6672esac
6673eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6674 (eval "$ac_link") 2>conftest.er1
6675 ac_status=$?
6676 grep -v '^ *+' conftest.er1 >conftest.err
6677 rm -f conftest.er1
6678 cat conftest.err >&5
6679 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6680 (exit $ac_status); } && {
6681 test -z "$ac_c_werror_flag" ||
6682 test ! -s conftest.err
6683 } && test -s conftest$ac_exeext &&
6684 $as_test_x conftest$ac_exeext; then
6685 { echo "$as_me:$LINENO: result: yes" >&5
6686echo "${ECHO_T}yes" >&6; }
6184 LDFLAGS="$saved_LDFLAGS $_define_flag" 6687 LDFLAGS="$saved_LDFLAGS $_define_flag"
6185else 6688else
6186 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6689 echo "$as_me: failed program was:" >&5
6187$as_echo "no" >&6; } 6690sed 's/^/| /' conftest.$ac_ext >&5
6691
6692 { echo "$as_me:$LINENO: result: no" >&5
6693echo "${ECHO_T}no" >&6; }
6188 LDFLAGS="$saved_LDFLAGS" 6694 LDFLAGS="$saved_LDFLAGS"
6189 6695
6190fi 6696fi
6191rm -f core conftest.err conftest.$ac_objext \ 6697
6192 conftest$ac_exeext conftest.$ac_ext 6698rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
6699 conftest$ac_exeext conftest.$ac_ext
6193} 6700}
6194 { 6701 {
6195 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $LD supports link flag -Wl,-z,now" >&5 6702 { echo "$as_me:$LINENO: checking if $LD supports link flag -Wl,-z,now" >&5
6196$as_echo_n "checking if $LD supports link flag -Wl,-z,now... " >&6; } 6703echo $ECHO_N "checking if $LD supports link flag -Wl,-z,now... $ECHO_C" >&6; }
6197 saved_LDFLAGS="$LDFLAGS" 6704 saved_LDFLAGS="$LDFLAGS"
6198 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,now" 6705 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,now"
6199 _define_flag="" 6706 _define_flag=""
6200 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,now" 6707 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,now"
6201 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6708 cat >conftest.$ac_ext <<_ACEOF
6709/* confdefs.h. */
6710_ACEOF
6711cat confdefs.h >>conftest.$ac_ext
6712cat >>conftest.$ac_ext <<_ACEOF
6202/* end confdefs.h. */ 6713/* end confdefs.h. */
6203 6714
6204#include <stdlib.h> 6715#include <stdlib.h>
@@ -6214,27 +6725,52 @@ int main(int argc, char **argv) {
6214} 6725}
6215 6726
6216_ACEOF 6727_ACEOF
6217if ac_fn_c_try_link "$LINENO"; then : 6728rm -f conftest.$ac_objext conftest$ac_exeext
6218 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6729if { (ac_try="$ac_link"
6219$as_echo "yes" >&6; } 6730case "(($ac_try" in
6731 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6732 *) ac_try_echo=$ac_try;;
6733esac
6734eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6735 (eval "$ac_link") 2>conftest.er1
6736 ac_status=$?
6737 grep -v '^ *+' conftest.er1 >conftest.err
6738 rm -f conftest.er1
6739 cat conftest.err >&5
6740 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6741 (exit $ac_status); } && {
6742 test -z "$ac_c_werror_flag" ||
6743 test ! -s conftest.err
6744 } && test -s conftest$ac_exeext &&
6745 $as_test_x conftest$ac_exeext; then
6746 { echo "$as_me:$LINENO: result: yes" >&5
6747echo "${ECHO_T}yes" >&6; }
6220 LDFLAGS="$saved_LDFLAGS $_define_flag" 6748 LDFLAGS="$saved_LDFLAGS $_define_flag"
6221else 6749else
6222 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6750 echo "$as_me: failed program was:" >&5
6223$as_echo "no" >&6; } 6751sed 's/^/| /' conftest.$ac_ext >&5
6752
6753 { echo "$as_me:$LINENO: result: no" >&5
6754echo "${ECHO_T}no" >&6; }
6224 LDFLAGS="$saved_LDFLAGS" 6755 LDFLAGS="$saved_LDFLAGS"
6225 6756
6226fi 6757fi
6227rm -f core conftest.err conftest.$ac_objext \ 6758
6228 conftest$ac_exeext conftest.$ac_ext 6759rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
6760 conftest$ac_exeext conftest.$ac_ext
6229} 6761}
6230 { 6762 {
6231 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $LD supports link flag -Wl,-z,noexecstack" >&5 6763 { echo "$as_me:$LINENO: checking if $LD supports link flag -Wl,-z,noexecstack" >&5
6232$as_echo_n "checking if $LD supports link flag -Wl,-z,noexecstack... " >&6; } 6764echo $ECHO_N "checking if $LD supports link flag -Wl,-z,noexecstack... $ECHO_C" >&6; }
6233 saved_LDFLAGS="$LDFLAGS" 6765 saved_LDFLAGS="$LDFLAGS"
6234 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,noexecstack" 6766 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,noexecstack"
6235 _define_flag="" 6767 _define_flag=""
6236 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,noexecstack" 6768 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,noexecstack"
6237 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6769 cat >conftest.$ac_ext <<_ACEOF
6770/* confdefs.h. */
6771_ACEOF
6772cat confdefs.h >>conftest.$ac_ext
6773cat >>conftest.$ac_ext <<_ACEOF
6238/* end confdefs.h. */ 6774/* end confdefs.h. */
6239 6775
6240#include <stdlib.h> 6776#include <stdlib.h>
@@ -6250,18 +6786,39 @@ int main(int argc, char **argv) {
6250} 6786}
6251 6787
6252_ACEOF 6788_ACEOF
6253if ac_fn_c_try_link "$LINENO"; then : 6789rm -f conftest.$ac_objext conftest$ac_exeext
6254 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6790if { (ac_try="$ac_link"
6255$as_echo "yes" >&6; } 6791case "(($ac_try" in
6792 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6793 *) ac_try_echo=$ac_try;;
6794esac
6795eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6796 (eval "$ac_link") 2>conftest.er1
6797 ac_status=$?
6798 grep -v '^ *+' conftest.er1 >conftest.err
6799 rm -f conftest.er1
6800 cat conftest.err >&5
6801 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6802 (exit $ac_status); } && {
6803 test -z "$ac_c_werror_flag" ||
6804 test ! -s conftest.err
6805 } && test -s conftest$ac_exeext &&
6806 $as_test_x conftest$ac_exeext; then
6807 { echo "$as_me:$LINENO: result: yes" >&5
6808echo "${ECHO_T}yes" >&6; }
6256 LDFLAGS="$saved_LDFLAGS $_define_flag" 6809 LDFLAGS="$saved_LDFLAGS $_define_flag"
6257else 6810else
6258 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6811 echo "$as_me: failed program was:" >&5
6259$as_echo "no" >&6; } 6812sed 's/^/| /' conftest.$ac_ext >&5
6813
6814 { echo "$as_me:$LINENO: result: no" >&5
6815echo "${ECHO_T}no" >&6; }
6260 LDFLAGS="$saved_LDFLAGS" 6816 LDFLAGS="$saved_LDFLAGS"
6261 6817
6262fi 6818fi
6263rm -f core conftest.err conftest.$ac_objext \ 6819
6264 conftest$ac_exeext conftest.$ac_ext 6820rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
6821 conftest$ac_exeext conftest.$ac_ext
6265} 6822}
6266 # NB. -ftrapv expects certain support functions to be present in 6823 # NB. -ftrapv expects certain support functions to be present in
6267 # the compiler library (libgcc or similar) to detect integer operations 6824 # the compiler library (libgcc or similar) to detect integer operations
@@ -6269,13 +6826,17 @@ rm -f core conftest.err conftest.$ac_objext \
6269 # actually links. The test program compiled/linked includes a number 6826 # actually links. The test program compiled/linked includes a number
6270 # of integer operations that should exercise this. 6827 # of integer operations that should exercise this.
6271 { 6828 {
6272 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -ftrapv and linking succeeds" >&5 6829 { echo "$as_me:$LINENO: checking if $CC supports compile flag -ftrapv and linking succeeds" >&5
6273$as_echo_n "checking if $CC supports compile flag -ftrapv and linking succeeds... " >&6; } 6830echo $ECHO_N "checking if $CC supports compile flag -ftrapv and linking succeeds... $ECHO_C" >&6; }
6274 saved_CFLAGS="$CFLAGS" 6831 saved_CFLAGS="$CFLAGS"
6275 CFLAGS="$CFLAGS $WERROR -ftrapv" 6832 CFLAGS="$CFLAGS $WERROR -ftrapv"
6276 _define_flag="" 6833 _define_flag=""
6277 test "x$_define_flag" = "x" && _define_flag="-ftrapv" 6834 test "x$_define_flag" = "x" && _define_flag="-ftrapv"
6278 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6835 cat >conftest.$ac_ext <<_ACEOF
6836/* confdefs.h. */
6837_ACEOF
6838cat confdefs.h >>conftest.$ac_ext
6839cat >>conftest.$ac_ext <<_ACEOF
6279/* end confdefs.h. */ 6840/* end confdefs.h. */
6280 6841
6281#include <stdlib.h> 6842#include <stdlib.h>
@@ -6291,30 +6852,51 @@ int main(int argc, char **argv) {
6291} 6852}
6292 6853
6293_ACEOF 6854_ACEOF
6294if ac_fn_c_try_link "$LINENO"; then : 6855rm -f conftest.$ac_objext conftest$ac_exeext
6856if { (ac_try="$ac_link"
6857case "(($ac_try" in
6858 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6859 *) ac_try_echo=$ac_try;;
6860esac
6861eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6862 (eval "$ac_link") 2>conftest.er1
6863 ac_status=$?
6864 grep -v '^ *+' conftest.er1 >conftest.err
6865 rm -f conftest.er1
6866 cat conftest.err >&5
6867 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6868 (exit $ac_status); } && {
6869 test -z "$ac_c_werror_flag" ||
6870 test ! -s conftest.err
6871 } && test -s conftest$ac_exeext &&
6872 $as_test_x conftest$ac_exeext; then
6295 6873
6296if `grep -i "unrecognized option" conftest.err >/dev/null` 6874if `grep -i "unrecognized option" conftest.err >/dev/null`
6297then 6875then
6298 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6876 { echo "$as_me:$LINENO: result: no" >&5
6299$as_echo "no" >&6; } 6877echo "${ECHO_T}no" >&6; }
6300 CFLAGS="$saved_CFLAGS" 6878 CFLAGS="$saved_CFLAGS"
6301else 6879else
6302 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6880 { echo "$as_me:$LINENO: result: yes" >&5
6303$as_echo "yes" >&6; } 6881echo "${ECHO_T}yes" >&6; }
6304 CFLAGS="$saved_CFLAGS $_define_flag" 6882 CFLAGS="$saved_CFLAGS $_define_flag"
6305fi 6883fi
6306else 6884else
6307 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6885 echo "$as_me: failed program was:" >&5
6308$as_echo "no" >&6; } 6886sed 's/^/| /' conftest.$ac_ext >&5
6887
6888 { echo "$as_me:$LINENO: result: no" >&5
6889echo "${ECHO_T}no" >&6; }
6309 CFLAGS="$saved_CFLAGS" 6890 CFLAGS="$saved_CFLAGS"
6310 6891
6311fi 6892fi
6312rm -f core conftest.err conftest.$ac_objext \ 6893
6313 conftest$ac_exeext conftest.$ac_ext 6894rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
6895 conftest$ac_exeext conftest.$ac_ext
6314} 6896}
6315 fi 6897 fi
6316 { $as_echo "$as_me:${as_lineno-$LINENO}: checking gcc version" >&5 6898 { echo "$as_me:$LINENO: checking gcc version" >&5
6317$as_echo_n "checking gcc version... " >&6; } 6899echo $ECHO_N "checking gcc version... $ECHO_C" >&6; }
6318 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` 6900 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
6319 case $GCC_VER in 6901 case $GCC_VER in
6320 1.*) no_attrib_nonnull=1 ;; 6902 1.*) no_attrib_nonnull=1 ;;
@@ -6324,14 +6906,18 @@ $as_echo_n "checking gcc version... " >&6; }
6324 2.*) no_attrib_nonnull=1 ;; 6906 2.*) no_attrib_nonnull=1 ;;
6325 *) ;; 6907 *) ;;
6326 esac 6908 esac
6327 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCC_VER" >&5 6909 { echo "$as_me:$LINENO: result: $GCC_VER" >&5
6328$as_echo "$GCC_VER" >&6; } 6910echo "${ECHO_T}$GCC_VER" >&6; }
6329 6911
6330 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-builtin-memset" >&5 6912 { echo "$as_me:$LINENO: checking if $CC accepts -fno-builtin-memset" >&5
6331$as_echo_n "checking if $CC accepts -fno-builtin-memset... " >&6; } 6913echo $ECHO_N "checking if $CC accepts -fno-builtin-memset... $ECHO_C" >&6; }
6332 saved_CFLAGS="$CFLAGS" 6914 saved_CFLAGS="$CFLAGS"
6333 CFLAGS="$CFLAGS -fno-builtin-memset" 6915 CFLAGS="$CFLAGS -fno-builtin-memset"
6334 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6916 cat >conftest.$ac_ext <<_ACEOF
6917/* confdefs.h. */
6918_ACEOF
6919cat confdefs.h >>conftest.$ac_ext
6920cat >>conftest.$ac_ext <<_ACEOF
6335/* end confdefs.h. */ 6921/* end confdefs.h. */
6336 #include <string.h> 6922 #include <string.h>
6337int 6923int
@@ -6342,17 +6928,38 @@ main ()
6342 return 0; 6928 return 0;
6343} 6929}
6344_ACEOF 6930_ACEOF
6345if ac_fn_c_try_link "$LINENO"; then : 6931rm -f conftest.$ac_objext conftest$ac_exeext
6346 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6932if { (ac_try="$ac_link"
6347$as_echo "yes" >&6; } 6933case "(($ac_try" in
6934 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6935 *) ac_try_echo=$ac_try;;
6936esac
6937eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
6938 (eval "$ac_link") 2>conftest.er1
6939 ac_status=$?
6940 grep -v '^ *+' conftest.er1 >conftest.err
6941 rm -f conftest.er1
6942 cat conftest.err >&5
6943 echo "$as_me:$LINENO: \$? = $ac_status" >&5
6944 (exit $ac_status); } && {
6945 test -z "$ac_c_werror_flag" ||
6946 test ! -s conftest.err
6947 } && test -s conftest$ac_exeext &&
6948 $as_test_x conftest$ac_exeext; then
6949 { echo "$as_me:$LINENO: result: yes" >&5
6950echo "${ECHO_T}yes" >&6; }
6348else 6951else
6349 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6952 echo "$as_me: failed program was:" >&5
6350$as_echo "no" >&6; } 6953sed 's/^/| /' conftest.$ac_ext >&5
6954
6955 { echo "$as_me:$LINENO: result: no" >&5
6956echo "${ECHO_T}no" >&6; }
6351 CFLAGS="$saved_CFLAGS" 6957 CFLAGS="$saved_CFLAGS"
6352 6958
6353fi 6959fi
6354rm -f core conftest.err conftest.$ac_objext \ 6960
6355 conftest$ac_exeext conftest.$ac_ext 6961rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
6962 conftest$ac_exeext conftest.$ac_ext
6356 6963
6357 # -fstack-protector-all doesn't always work for some GCC versions 6964 # -fstack-protector-all doesn't always work for some GCC versions
6358 # and/or platforms, so we test if we can. If it's not supported 6965 # and/or platforms, so we test if we can. If it's not supported
@@ -6360,13 +6967,17 @@ rm -f core conftest.err conftest.$ac_objext \
6360 if test "x$use_stack_protector" = "x1"; then 6967 if test "x$use_stack_protector" = "x1"; then
6361 for t in -fstack-protector-strong -fstack-protector-all \ 6968 for t in -fstack-protector-strong -fstack-protector-all \
6362 -fstack-protector; do 6969 -fstack-protector; do
6363 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports $t" >&5 6970 { echo "$as_me:$LINENO: checking if $CC supports $t" >&5
6364$as_echo_n "checking if $CC supports $t... " >&6; } 6971echo $ECHO_N "checking if $CC supports $t... $ECHO_C" >&6; }
6365 saved_CFLAGS="$CFLAGS" 6972 saved_CFLAGS="$CFLAGS"
6366 saved_LDFLAGS="$LDFLAGS" 6973 saved_LDFLAGS="$LDFLAGS"
6367 CFLAGS="$CFLAGS $t -Werror" 6974 CFLAGS="$CFLAGS $t -Werror"
6368 LDFLAGS="$LDFLAGS $t -Werror" 6975 LDFLAGS="$LDFLAGS $t -Werror"
6369 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 6976 cat >conftest.$ac_ext <<_ACEOF
6977/* confdefs.h. */
6978_ACEOF
6979cat confdefs.h >>conftest.$ac_ext
6980cat >>conftest.$ac_ext <<_ACEOF
6370/* end confdefs.h. */ 6981/* end confdefs.h. */
6371 #include <stdio.h> 6982 #include <stdio.h>
6372int 6983int
@@ -6380,20 +6991,41 @@ main ()
6380 return 0; 6991 return 0;
6381} 6992}
6382_ACEOF 6993_ACEOF
6383if ac_fn_c_try_link "$LINENO"; then : 6994rm -f conftest.$ac_objext conftest$ac_exeext
6384 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6995if { (ac_try="$ac_link"
6385$as_echo "yes" >&6; } 6996case "(($ac_try" in
6997 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
6998 *) ac_try_echo=$ac_try;;
6999esac
7000eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7001 (eval "$ac_link") 2>conftest.er1
7002 ac_status=$?
7003 grep -v '^ *+' conftest.er1 >conftest.err
7004 rm -f conftest.er1
7005 cat conftest.err >&5
7006 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7007 (exit $ac_status); } && {
7008 test -z "$ac_c_werror_flag" ||
7009 test ! -s conftest.err
7010 } && test -s conftest$ac_exeext &&
7011 $as_test_x conftest$ac_exeext; then
7012 { echo "$as_me:$LINENO: result: yes" >&5
7013echo "${ECHO_T}yes" >&6; }
6386 CFLAGS="$saved_CFLAGS $t" 7014 CFLAGS="$saved_CFLAGS $t"
6387 LDFLAGS="$saved_LDFLAGS $t" 7015 LDFLAGS="$saved_LDFLAGS $t"
6388 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $t works" >&5 7016 { echo "$as_me:$LINENO: checking if $t works" >&5
6389$as_echo_n "checking if $t works... " >&6; } 7017echo $ECHO_N "checking if $t works... $ECHO_C" >&6; }
6390 if test "$cross_compiling" = yes; then : 7018 if test "$cross_compiling" = yes; then
6391 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: cannot test" >&5 7019 { echo "$as_me:$LINENO: WARNING: cross compiling: cannot test" >&5
6392$as_echo "$as_me: WARNING: cross compiling: cannot test" >&2;} 7020echo "$as_me: WARNING: cross compiling: cannot test" >&2;}
6393 break 7021 break
6394 7022
6395else 7023else
6396 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 7024 cat >conftest.$ac_ext <<_ACEOF
7025/* confdefs.h. */
7026_ACEOF
7027cat confdefs.h >>conftest.$ac_ext
7028cat >>conftest.$ac_ext <<_ACEOF
6397/* end confdefs.h. */ 7029/* end confdefs.h. */
6398 #include <stdio.h> 7030 #include <stdio.h>
6399int 7031int
@@ -6407,26 +7039,54 @@ main ()
6407 return 0; 7039 return 0;
6408} 7040}
6409_ACEOF 7041_ACEOF
6410if ac_fn_c_try_run "$LINENO"; then : 7042rm -f conftest$ac_exeext
6411 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 7043if { (ac_try="$ac_link"
6412$as_echo "yes" >&6; } 7044case "(($ac_try" in
7045 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7046 *) ac_try_echo=$ac_try;;
7047esac
7048eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7049 (eval "$ac_link") 2>&5
7050 ac_status=$?
7051 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7052 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
7053 { (case "(($ac_try" in
7054 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7055 *) ac_try_echo=$ac_try;;
7056esac
7057eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7058 (eval "$ac_try") 2>&5
7059 ac_status=$?
7060 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7061 (exit $ac_status); }; }; then
7062 { echo "$as_me:$LINENO: result: yes" >&5
7063echo "${ECHO_T}yes" >&6; }
6413 break 7064 break
6414else 7065else
6415 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 7066 echo "$as_me: program exited with status $ac_status" >&5
6416$as_echo "no" >&6; } 7067echo "$as_me: failed program was:" >&5
7068sed 's/^/| /' conftest.$ac_ext >&5
7069
7070( exit $ac_status )
7071 { echo "$as_me:$LINENO: result: no" >&5
7072echo "${ECHO_T}no" >&6; }
6417fi 7073fi
6418rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 7074rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
6419 conftest.$ac_objext conftest.beam conftest.$ac_ext
6420fi 7075fi
6421 7076
6422 7077
7078
6423else 7079else
6424 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 7080 echo "$as_me: failed program was:" >&5
6425$as_echo "no" >&6; } 7081sed 's/^/| /' conftest.$ac_ext >&5
7082
7083 { echo "$as_me:$LINENO: result: no" >&5
7084echo "${ECHO_T}no" >&6; }
6426 7085
6427fi 7086fi
6428rm -f core conftest.err conftest.$ac_objext \ 7087
6429 conftest$ac_exeext conftest.$ac_ext 7088rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
7089 conftest$ac_exeext conftest.$ac_ext
6430 CFLAGS="$saved_CFLAGS" 7090 CFLAGS="$saved_CFLAGS"
6431 LDFLAGS="$saved_LDFLAGS" 7091 LDFLAGS="$saved_LDFLAGS"
6432 done 7092 done
@@ -6437,10 +7097,61 @@ rm -f core conftest.err conftest.$ac_objext \
6437 unset ac_cv_have_decl_LLONG_MAX 7097 unset ac_cv_have_decl_LLONG_MAX
6438 saved_CFLAGS="$CFLAGS" 7098 saved_CFLAGS="$CFLAGS"
6439 CFLAGS="$CFLAGS -std=gnu99" 7099 CFLAGS="$CFLAGS -std=gnu99"
6440 ac_fn_c_check_decl "$LINENO" "LLONG_MAX" "ac_cv_have_decl_LLONG_MAX" "#include <limits.h> 7100 { echo "$as_me:$LINENO: checking whether LLONG_MAX is declared" >&5
7101echo $ECHO_N "checking whether LLONG_MAX is declared... $ECHO_C" >&6; }
7102if test "${ac_cv_have_decl_LLONG_MAX+set}" = set; then
7103 echo $ECHO_N "(cached) $ECHO_C" >&6
7104else
7105 cat >conftest.$ac_ext <<_ACEOF
7106/* confdefs.h. */
7107_ACEOF
7108cat confdefs.h >>conftest.$ac_ext
7109cat >>conftest.$ac_ext <<_ACEOF
7110/* end confdefs.h. */
7111#include <limits.h>
6441 7112
6442" 7113
6443if test "x$ac_cv_have_decl_LLONG_MAX" = xyes; then : 7114int
7115main ()
7116{
7117#ifndef LLONG_MAX
7118 (void) LLONG_MAX;
7119#endif
7120
7121 ;
7122 return 0;
7123}
7124_ACEOF
7125rm -f conftest.$ac_objext
7126if { (ac_try="$ac_compile"
7127case "(($ac_try" in
7128 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7129 *) ac_try_echo=$ac_try;;
7130esac
7131eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7132 (eval "$ac_compile") 2>conftest.er1
7133 ac_status=$?
7134 grep -v '^ *+' conftest.er1 >conftest.err
7135 rm -f conftest.er1
7136 cat conftest.err >&5
7137 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7138 (exit $ac_status); } && {
7139 test -z "$ac_c_werror_flag" ||
7140 test ! -s conftest.err
7141 } && test -s conftest.$ac_objext; then
7142 ac_cv_have_decl_LLONG_MAX=yes
7143else
7144 echo "$as_me: failed program was:" >&5
7145sed 's/^/| /' conftest.$ac_ext >&5
7146
7147 ac_cv_have_decl_LLONG_MAX=no
7148fi
7149
7150rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7151fi
7152{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_LLONG_MAX" >&5
7153echo "${ECHO_T}$ac_cv_have_decl_LLONG_MAX" >&6; }
7154if test $ac_cv_have_decl_LLONG_MAX = yes; then
6444 have_llong_max=1 7155 have_llong_max=1
6445else 7156else
6446 CFLAGS="$saved_CFLAGS" 7157 CFLAGS="$saved_CFLAGS"
@@ -6449,9 +7160,13 @@ fi
6449 fi 7160 fi
6450fi 7161fi
6451 7162
6452{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler allows __attribute__ on return types" >&5 7163{ echo "$as_me:$LINENO: checking if compiler allows __attribute__ on return types" >&5
6453$as_echo_n "checking if compiler allows __attribute__ on return types... " >&6; } 7164echo $ECHO_N "checking if compiler allows __attribute__ on return types... $ECHO_C" >&6; }
6454cat confdefs.h - <<_ACEOF >conftest.$ac_ext 7165cat >conftest.$ac_ext <<_ACEOF
7166/* confdefs.h. */
7167_ACEOF
7168cat confdefs.h >>conftest.$ac_ext
7169cat >>conftest.$ac_ext <<_ACEOF
6455/* end confdefs.h. */ 7170/* end confdefs.h. */
6456 7171
6457#include <stdlib.h> 7172#include <stdlib.h>
@@ -6464,28 +7179,52 @@ main ()
6464 return 0; 7179 return 0;
6465} 7180}
6466_ACEOF 7181_ACEOF
6467if ac_fn_c_try_compile "$LINENO"; then : 7182rm -f conftest.$ac_objext
6468 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 7183if { (ac_try="$ac_compile"
6469$as_echo "yes" >&6; } 7184case "(($ac_try" in
7185 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7186 *) ac_try_echo=$ac_try;;
7187esac
7188eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7189 (eval "$ac_compile") 2>conftest.er1
7190 ac_status=$?
7191 grep -v '^ *+' conftest.er1 >conftest.err
7192 rm -f conftest.er1
7193 cat conftest.err >&5
7194 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7195 (exit $ac_status); } && {
7196 test -z "$ac_c_werror_flag" ||
7197 test ! -s conftest.err
7198 } && test -s conftest.$ac_objext; then
7199 { echo "$as_me:$LINENO: result: yes" >&5
7200echo "${ECHO_T}yes" >&6; }
6470else 7201else
6471 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 7202 echo "$as_me: failed program was:" >&5
6472$as_echo "no" >&6; } 7203sed 's/^/| /' conftest.$ac_ext >&5
6473 7204
6474$as_echo "#define NO_ATTRIBUTE_ON_RETURN_TYPE 1" >>confdefs.h 7205 { echo "$as_me:$LINENO: result: no" >&5
7206echo "${ECHO_T}no" >&6; }
7207
7208cat >>confdefs.h <<\_ACEOF
7209#define NO_ATTRIBUTE_ON_RETURN_TYPE 1
7210_ACEOF
6475 7211
6476 7212
6477fi 7213fi
7214
6478rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 7215rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6479 7216
6480if test "x$no_attrib_nonnull" != "x1" ; then 7217if test "x$no_attrib_nonnull" != "x1" ; then
6481 7218
6482$as_echo "#define HAVE_ATTRIBUTE__NONNULL__ 1" >>confdefs.h 7219cat >>confdefs.h <<\_ACEOF
7220#define HAVE_ATTRIBUTE__NONNULL__ 1
7221_ACEOF
6483 7222
6484fi 7223fi
6485 7224
6486 7225
6487# Check whether --with-rpath was given. 7226# Check whether --with-rpath was given.
6488if test "${with_rpath+set}" = set; then : 7227if test "${with_rpath+set}" = set; then
6489 withval=$with_rpath; 7228 withval=$with_rpath;
6490 if test "x$withval" = "xno" ; then 7229 if test "x$withval" = "xno" ; then
6491 need_dash_r="" 7230 need_dash_r=""
@@ -6501,7 +7240,7 @@ fi
6501# Allow user to specify flags 7240# Allow user to specify flags
6502 7241
6503# Check whether --with-cflags was given. 7242# Check whether --with-cflags was given.
6504if test "${with_cflags+set}" = set; then : 7243if test "${with_cflags+set}" = set; then
6505 withval=$with_cflags; 7244 withval=$with_cflags;
6506 if test -n "$withval" && test "x$withval" != "xno" && \ 7245 if test -n "$withval" && test "x$withval" != "xno" && \
6507 test "x${withval}" != "xyes"; then 7246 test "x${withval}" != "xyes"; then
@@ -6513,7 +7252,7 @@ fi
6513 7252
6514 7253
6515# Check whether --with-cppflags was given. 7254# Check whether --with-cppflags was given.
6516if test "${with_cppflags+set}" = set; then : 7255if test "${with_cppflags+set}" = set; then
6517 withval=$with_cppflags; 7256 withval=$with_cppflags;
6518 if test -n "$withval" && test "x$withval" != "xno" && \ 7257 if test -n "$withval" && test "x$withval" != "xno" && \
6519 test "x${withval}" != "xyes"; then 7258 test "x${withval}" != "xyes"; then
@@ -6525,7 +7264,7 @@ fi
6525 7264
6526 7265
6527# Check whether --with-ldflags was given. 7266# Check whether --with-ldflags was given.
6528if test "${with_ldflags+set}" = set; then : 7267if test "${with_ldflags+set}" = set; then
6529 withval=$with_ldflags; 7268 withval=$with_ldflags;
6530 if test -n "$withval" && test "x$withval" != "xno" && \ 7269 if test -n "$withval" && test "x$withval" != "xno" && \
6531 test "x${withval}" != "xyes"; then 7270 test "x${withval}" != "xyes"; then
@@ -6537,7 +7276,7 @@ fi
6537 7276
6538 7277
6539# Check whether --with-libs was given. 7278# Check whether --with-libs was given.
6540if test "${with_libs+set}" = set; then : 7279if test "${with_libs+set}" = set; then
6541 withval=$with_libs; 7280 withval=$with_libs;
6542 if test -n "$withval" && test "x$withval" != "xno" && \ 7281 if test -n "$withval" && test "x$withval" != "xno" && \
6543 test "x${withval}" != "xyes"; then 7282 test "x${withval}" != "xyes"; then
@@ -6549,7 +7288,7 @@ fi
6549 7288
6550 7289
6551# Check whether --with-Werror was given. 7290# Check whether --with-Werror was given.
6552if test "${with_Werror+set}" = set; then : 7291if test "${with_Werror+set}" = set; then
6553 withval=$with_Werror; 7292 withval=$with_Werror;
6554 if test -n "$withval" && test "x$withval" != "xno"; then 7293 if test -n "$withval" && test "x$withval" != "xno"; then
6555 werror_flags="-Werror" 7294 werror_flags="-Werror"
@@ -6562,6 +7301,73 @@ if test "${with_Werror+set}" = set; then :
6562fi 7301fi
6563 7302
6564 7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
6565for ac_header in \ 7371for ac_header in \
6566 blf.h \ 7372 blf.h \
6567 bstring.h \ 7373 bstring.h \
@@ -6631,12 +7437,143 @@ for ac_header in \
6631 utmpx.h \ 7437 utmpx.h \
6632 vis.h \ 7438 vis.h \
6633 7439
6634do : 7440do
6635 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 7441as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
6636ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" 7442if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
6637if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : 7443 { echo "$as_me:$LINENO: checking for $ac_header" >&5
7444echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
7445if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
7446 echo $ECHO_N "(cached) $ECHO_C" >&6
7447fi
7448ac_res=`eval echo '${'$as_ac_Header'}'`
7449 { echo "$as_me:$LINENO: result: $ac_res" >&5
7450echo "${ECHO_T}$ac_res" >&6; }
7451else
7452 # Is the header compilable?
7453{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
7454echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
7455cat >conftest.$ac_ext <<_ACEOF
7456/* confdefs.h. */
7457_ACEOF
7458cat confdefs.h >>conftest.$ac_ext
7459cat >>conftest.$ac_ext <<_ACEOF
7460/* end confdefs.h. */
7461$ac_includes_default
7462#include <$ac_header>
7463_ACEOF
7464rm -f conftest.$ac_objext
7465if { (ac_try="$ac_compile"
7466case "(($ac_try" in
7467 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7468 *) ac_try_echo=$ac_try;;
7469esac
7470eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7471 (eval "$ac_compile") 2>conftest.er1
7472 ac_status=$?
7473 grep -v '^ *+' conftest.er1 >conftest.err
7474 rm -f conftest.er1
7475 cat conftest.err >&5
7476 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7477 (exit $ac_status); } && {
7478 test -z "$ac_c_werror_flag" ||
7479 test ! -s conftest.err
7480 } && test -s conftest.$ac_objext; then
7481 ac_header_compiler=yes
7482else
7483 echo "$as_me: failed program was:" >&5
7484sed 's/^/| /' conftest.$ac_ext >&5
7485
7486 ac_header_compiler=no
7487fi
7488
7489rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7490{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
7491echo "${ECHO_T}$ac_header_compiler" >&6; }
7492
7493# Is the header present?
7494{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
7495echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
7496cat >conftest.$ac_ext <<_ACEOF
7497/* confdefs.h. */
7498_ACEOF
7499cat confdefs.h >>conftest.$ac_ext
7500cat >>conftest.$ac_ext <<_ACEOF
7501/* end confdefs.h. */
7502#include <$ac_header>
7503_ACEOF
7504if { (ac_try="$ac_cpp conftest.$ac_ext"
7505case "(($ac_try" in
7506 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7507 *) ac_try_echo=$ac_try;;
7508esac
7509eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7510 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
7511 ac_status=$?
7512 grep -v '^ *+' conftest.er1 >conftest.err
7513 rm -f conftest.er1
7514 cat conftest.err >&5
7515 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7516 (exit $ac_status); } >/dev/null && {
7517 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
7518 test ! -s conftest.err
7519 }; then
7520 ac_header_preproc=yes
7521else
7522 echo "$as_me: failed program was:" >&5
7523sed 's/^/| /' conftest.$ac_ext >&5
7524
7525 ac_header_preproc=no
7526fi
7527
7528rm -f conftest.err conftest.$ac_ext
7529{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
7530echo "${ECHO_T}$ac_header_preproc" >&6; }
7531
7532# So? What about this header?
7533case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
7534 yes:no: )
7535 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
7536echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
7537 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
7538echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
7539 ac_header_preproc=yes
7540 ;;
7541 no:yes:* )
7542 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
7543echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
7544 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
7545echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
7546 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
7547echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
7548 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
7549echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
7550 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
7551echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
7552 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
7553echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
7554 ( cat <<\_ASBOX
7555## ------------------------------------------- ##
7556## Report this to openssh-unix-dev@mindrot.org ##
7557## ------------------------------------------- ##
7558_ASBOX
7559 ) | sed "s/^/$as_me: WARNING: /" >&2
7560 ;;
7561esac
7562{ echo "$as_me:$LINENO: checking for $ac_header" >&5
7563echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
7564if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
7565 echo $ECHO_N "(cached) $ECHO_C" >&6
7566else
7567 eval "$as_ac_Header=\$ac_header_preproc"
7568fi
7569ac_res=`eval echo '${'$as_ac_Header'}'`
7570 { echo "$as_me:$LINENO: result: $ac_res" >&5
7571echo "${ECHO_T}$ac_res" >&6; }
7572
7573fi
7574if test `eval echo '${'$as_ac_Header'}'` = yes; then
6638 cat >>confdefs.h <<_ACEOF 7575 cat >>confdefs.h <<_ACEOF
6639#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 7576#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6640_ACEOF 7577_ACEOF
6641 7578
6642fi 7579fi
@@ -6645,17 +7582,62 @@ done
6645 7582
6646 7583
6647# lastlog.h requires sys/time.h to be included first on Solaris 7584# lastlog.h requires sys/time.h to be included first on Solaris
7585
6648for ac_header in lastlog.h 7586for ac_header in lastlog.h
6649do : 7587do
6650 ac_fn_c_check_header_compile "$LINENO" "lastlog.h" "ac_cv_header_lastlog_h" " 7588as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
7589{ echo "$as_me:$LINENO: checking for $ac_header" >&5
7590echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
7591if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
7592 echo $ECHO_N "(cached) $ECHO_C" >&6
7593else
7594 cat >conftest.$ac_ext <<_ACEOF
7595/* confdefs.h. */
7596_ACEOF
7597cat confdefs.h >>conftest.$ac_ext
7598cat >>conftest.$ac_ext <<_ACEOF
7599/* end confdefs.h. */
7600
6651#ifdef HAVE_SYS_TIME_H 7601#ifdef HAVE_SYS_TIME_H
6652# include <sys/time.h> 7602# include <sys/time.h>
6653#endif 7603#endif
6654 7604
6655" 7605
6656if test "x$ac_cv_header_lastlog_h" = xyes; then : 7606#include <$ac_header>
7607_ACEOF
7608rm -f conftest.$ac_objext
7609if { (ac_try="$ac_compile"
7610case "(($ac_try" in
7611 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7612 *) ac_try_echo=$ac_try;;
7613esac
7614eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7615 (eval "$ac_compile") 2>conftest.er1
7616 ac_status=$?
7617 grep -v '^ *+' conftest.er1 >conftest.err
7618 rm -f conftest.er1
7619 cat conftest.err >&5
7620 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7621 (exit $ac_status); } && {
7622 test -z "$ac_c_werror_flag" ||
7623 test ! -s conftest.err
7624 } && test -s conftest.$ac_objext; then
7625 eval "$as_ac_Header=yes"
7626else
7627 echo "$as_me: failed program was:" >&5
7628sed 's/^/| /' conftest.$ac_ext >&5
7629
7630 eval "$as_ac_Header=no"
7631fi
7632
7633rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7634fi
7635ac_res=`eval echo '${'$as_ac_Header'}'`
7636 { echo "$as_me:$LINENO: result: $ac_res" >&5
7637echo "${ECHO_T}$ac_res" >&6; }
7638if test `eval echo '${'$as_ac_Header'}'` = yes; then
6657 cat >>confdefs.h <<_ACEOF 7639 cat >>confdefs.h <<_ACEOF
6658#define HAVE_LASTLOG_H 1 7640#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6659_ACEOF 7641_ACEOF
6660 7642
6661fi 7643fi
@@ -6664,17 +7646,62 @@ done
6664 7646
6665 7647
6666# sys/ptms.h requires sys/stream.h to be included first on Solaris 7648# sys/ptms.h requires sys/stream.h to be included first on Solaris
7649
6667for ac_header in sys/ptms.h 7650for ac_header in sys/ptms.h
6668do : 7651do
6669 ac_fn_c_check_header_compile "$LINENO" "sys/ptms.h" "ac_cv_header_sys_ptms_h" " 7652as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
7653{ echo "$as_me:$LINENO: checking for $ac_header" >&5
7654echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
7655if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
7656 echo $ECHO_N "(cached) $ECHO_C" >&6
7657else
7658 cat >conftest.$ac_ext <<_ACEOF
7659/* confdefs.h. */
7660_ACEOF
7661cat confdefs.h >>conftest.$ac_ext
7662cat >>conftest.$ac_ext <<_ACEOF
7663/* end confdefs.h. */
7664
6670#ifdef HAVE_SYS_STREAM_H 7665#ifdef HAVE_SYS_STREAM_H
6671# include <sys/stream.h> 7666# include <sys/stream.h>
6672#endif 7667#endif
6673 7668
6674" 7669
6675if test "x$ac_cv_header_sys_ptms_h" = xyes; then : 7670#include <$ac_header>
7671_ACEOF
7672rm -f conftest.$ac_objext
7673if { (ac_try="$ac_compile"
7674case "(($ac_try" in
7675 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7676 *) ac_try_echo=$ac_try;;
7677esac
7678eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7679 (eval "$ac_compile") 2>conftest.er1
7680 ac_status=$?
7681 grep -v '^ *+' conftest.er1 >conftest.err
7682 rm -f conftest.er1
7683 cat conftest.err >&5
7684 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7685 (exit $ac_status); } && {
7686 test -z "$ac_c_werror_flag" ||
7687 test ! -s conftest.err
7688 } && test -s conftest.$ac_objext; then
7689 eval "$as_ac_Header=yes"
7690else
7691 echo "$as_me: failed program was:" >&5
7692sed 's/^/| /' conftest.$ac_ext >&5
7693
7694 eval "$as_ac_Header=no"
7695fi
7696
7697rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7698fi
7699ac_res=`eval echo '${'$as_ac_Header'}'`
7700 { echo "$as_me:$LINENO: result: $ac_res" >&5
7701echo "${ECHO_T}$ac_res" >&6; }
7702if test `eval echo '${'$as_ac_Header'}'` = yes; then
6676 cat >>confdefs.h <<_ACEOF 7703 cat >>confdefs.h <<_ACEOF
6677#define HAVE_SYS_PTMS_H 1 7704#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6678_ACEOF 7705_ACEOF
6679 7706
6680fi 7707fi
@@ -6683,15 +7710,60 @@ done
6683 7710
6684 7711
6685# login_cap.h requires sys/types.h on NetBSD 7712# login_cap.h requires sys/types.h on NetBSD
7713
6686for ac_header in login_cap.h 7714for ac_header in login_cap.h
6687do : 7715do
6688 ac_fn_c_check_header_compile "$LINENO" "login_cap.h" "ac_cv_header_login_cap_h" " 7716as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
7717{ echo "$as_me:$LINENO: checking for $ac_header" >&5
7718echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
7719if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
7720 echo $ECHO_N "(cached) $ECHO_C" >&6
7721else
7722 cat >conftest.$ac_ext <<_ACEOF
7723/* confdefs.h. */
7724_ACEOF
7725cat confdefs.h >>conftest.$ac_ext
7726cat >>conftest.$ac_ext <<_ACEOF
7727/* end confdefs.h. */
7728
6689#include <sys/types.h> 7729#include <sys/types.h>
6690 7730
6691" 7731
6692if test "x$ac_cv_header_login_cap_h" = xyes; then : 7732#include <$ac_header>
7733_ACEOF
7734rm -f conftest.$ac_objext
7735if { (ac_try="$ac_compile"
7736case "(($ac_try" in
7737 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7738 *) ac_try_echo=$ac_try;;
7739esac
7740eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7741 (eval "$ac_compile") 2>conftest.er1
7742 ac_status=$?
7743 grep -v '^ *+' conftest.er1 >conftest.err
7744 rm -f conftest.er1
7745 cat conftest.err >&5
7746 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7747 (exit $ac_status); } && {
7748 test -z "$ac_c_werror_flag" ||
7749 test ! -s conftest.err
7750 } && test -s conftest.$ac_objext; then
7751 eval "$as_ac_Header=yes"
7752else
7753 echo "$as_me: failed program was:" >&5
7754sed 's/^/| /' conftest.$ac_ext >&5
7755
7756 eval "$as_ac_Header=no"
7757fi
7758
7759rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7760fi
7761ac_res=`eval echo '${'$as_ac_Header'}'`
7762 { echo "$as_me:$LINENO: result: $ac_res" >&5
7763echo "${ECHO_T}$ac_res" >&6; }
7764if test `eval echo '${'$as_ac_Header'}'` = yes; then
6693 cat >>confdefs.h <<_ACEOF 7765 cat >>confdefs.h <<_ACEOF
6694#define HAVE_LOGIN_CAP_H 1 7766#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6695_ACEOF 7767_ACEOF
6696 7768
6697fi 7769fi
@@ -6700,15 +7772,60 @@ done
6700 7772
6701 7773
6702# older BSDs need sys/param.h before sys/mount.h 7774# older BSDs need sys/param.h before sys/mount.h
7775
6703for ac_header in sys/mount.h 7776for ac_header in sys/mount.h
6704do : 7777do
6705 ac_fn_c_check_header_compile "$LINENO" "sys/mount.h" "ac_cv_header_sys_mount_h" " 7778as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
7779{ echo "$as_me:$LINENO: checking for $ac_header" >&5
7780echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
7781if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
7782 echo $ECHO_N "(cached) $ECHO_C" >&6
7783else
7784 cat >conftest.$ac_ext <<_ACEOF
7785/* confdefs.h. */
7786_ACEOF
7787cat confdefs.h >>conftest.$ac_ext
7788cat >>conftest.$ac_ext <<_ACEOF
7789/* end confdefs.h. */
7790
6706#include <sys/param.h> 7791#include <sys/param.h>
6707 7792
6708" 7793
6709if test "x$ac_cv_header_sys_mount_h" = xyes; then : 7794#include <$ac_header>
7795_ACEOF
7796rm -f conftest.$ac_objext
7797if { (ac_try="$ac_compile"
7798case "(($ac_try" in
7799 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7800 *) ac_try_echo=$ac_try;;
7801esac
7802eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7803 (eval "$ac_compile") 2>conftest.er1
7804 ac_status=$?
7805 grep -v '^ *+' conftest.er1 >conftest.err
7806 rm -f conftest.er1
7807 cat conftest.err >&5
7808 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7809 (exit $ac_status); } && {
7810 test -z "$ac_c_werror_flag" ||
7811 test ! -s conftest.err
7812 } && test -s conftest.$ac_objext; then
7813 eval "$as_ac_Header=yes"
7814else
7815 echo "$as_me: failed program was:" >&5
7816sed 's/^/| /' conftest.$ac_ext >&5
7817
7818 eval "$as_ac_Header=no"
7819fi
7820
7821rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7822fi
7823ac_res=`eval echo '${'$as_ac_Header'}'`
7824 { echo "$as_me:$LINENO: result: $ac_res" >&5
7825echo "${ECHO_T}$ac_res" >&6; }
7826if test `eval echo '${'$as_ac_Header'}'` = yes; then
6710 cat >>confdefs.h <<_ACEOF 7827 cat >>confdefs.h <<_ACEOF
6711#define HAVE_SYS_MOUNT_H 1 7828#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6712_ACEOF 7829_ACEOF
6713 7830
6714fi 7831fi
@@ -6717,16 +7834,61 @@ done
6717 7834
6718 7835
6719# Android requires sys/socket.h to be included before sys/un.h 7836# Android requires sys/socket.h to be included before sys/un.h
7837
6720for ac_header in sys/un.h 7838for ac_header in sys/un.h
6721do : 7839do
6722 ac_fn_c_check_header_compile "$LINENO" "sys/un.h" "ac_cv_header_sys_un_h" " 7840as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
7841{ echo "$as_me:$LINENO: checking for $ac_header" >&5
7842echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
7843if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
7844 echo $ECHO_N "(cached) $ECHO_C" >&6
7845else
7846 cat >conftest.$ac_ext <<_ACEOF
7847/* confdefs.h. */
7848_ACEOF
7849cat confdefs.h >>conftest.$ac_ext
7850cat >>conftest.$ac_ext <<_ACEOF
7851/* end confdefs.h. */
7852
6723#include <sys/types.h> 7853#include <sys/types.h>
6724#include <sys/socket.h> 7854#include <sys/socket.h>
6725 7855
6726" 7856
6727if test "x$ac_cv_header_sys_un_h" = xyes; then : 7857#include <$ac_header>
7858_ACEOF
7859rm -f conftest.$ac_objext
7860if { (ac_try="$ac_compile"
7861case "(($ac_try" in
7862 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7863 *) ac_try_echo=$ac_try;;
7864esac
7865eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7866 (eval "$ac_compile") 2>conftest.er1
7867 ac_status=$?
7868 grep -v '^ *+' conftest.er1 >conftest.err
7869 rm -f conftest.er1
7870 cat conftest.err >&5
7871 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7872 (exit $ac_status); } && {
7873 test -z "$ac_c_werror_flag" ||
7874 test ! -s conftest.err
7875 } && test -s conftest.$ac_objext; then
7876 eval "$as_ac_Header=yes"
7877else
7878 echo "$as_me: failed program was:" >&5
7879sed 's/^/| /' conftest.$ac_ext >&5
7880
7881 eval "$as_ac_Header=no"
7882fi
7883
7884rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7885fi
7886ac_res=`eval echo '${'$as_ac_Header'}'`
7887 { echo "$as_me:$LINENO: result: $ac_res" >&5
7888echo "${ECHO_T}$ac_res" >&6; }
7889if test `eval echo '${'$as_ac_Header'}'` = yes; then
6728 cat >>confdefs.h <<_ACEOF 7890 cat >>confdefs.h <<_ACEOF
6729#define HAVE_SYS_UN_H 1 7891#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6730_ACEOF 7892_ACEOF
6731 7893
6732fi 7894fi
@@ -6747,9 +7909,13 @@ case "$host" in
6747 # particularly with older versions of vac or xlc. 7909 # particularly with older versions of vac or xlc.
6748 # It also throws errors about null macro argments, but these are 7910 # It also throws errors about null macro argments, but these are
6749 # not fatal. 7911 # not fatal.
6750 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler allows macro redefinitions" >&5 7912 { echo "$as_me:$LINENO: checking if compiler allows macro redefinitions" >&5
6751$as_echo_n "checking if compiler allows macro redefinitions... " >&6; } 7913echo $ECHO_N "checking if compiler allows macro redefinitions... $ECHO_C" >&6; }
6752 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 7914 cat >conftest.$ac_ext <<_ACEOF
7915/* confdefs.h. */
7916_ACEOF
7917cat confdefs.h >>conftest.$ac_ext
7918cat >>conftest.$ac_ext <<_ACEOF
6753/* end confdefs.h. */ 7919/* end confdefs.h. */
6754 7920
6755#define testmacro foo 7921#define testmacro foo
@@ -6762,12 +7928,31 @@ main ()
6762 return 0; 7928 return 0;
6763} 7929}
6764_ACEOF 7930_ACEOF
6765if ac_fn_c_try_compile "$LINENO"; then : 7931rm -f conftest.$ac_objext
6766 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 7932if { (ac_try="$ac_compile"
6767$as_echo "yes" >&6; } 7933case "(($ac_try" in
7934 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7935 *) ac_try_echo=$ac_try;;
7936esac
7937eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
7938 (eval "$ac_compile") 2>conftest.er1
7939 ac_status=$?
7940 grep -v '^ *+' conftest.er1 >conftest.err
7941 rm -f conftest.er1
7942 cat conftest.err >&5
7943 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7944 (exit $ac_status); } && {
7945 test -z "$ac_c_werror_flag" ||
7946 test ! -s conftest.err
7947 } && test -s conftest.$ac_objext; then
7948 { echo "$as_me:$LINENO: result: yes" >&5
7949echo "${ECHO_T}yes" >&6; }
6768else 7950else
6769 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 7951 echo "$as_me: failed program was:" >&5
6770$as_echo "no" >&6; } 7952sed 's/^/| /' conftest.$ac_ext >&5
7953
7954 { echo "$as_me:$LINENO: result: no" >&5
7955echo "${ECHO_T}no" >&6; }
6771 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`" 7956 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
6772 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`" 7957 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
6773 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`" 7958 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
@@ -6775,10 +7960,11 @@ $as_echo "no" >&6; }
6775 7960
6776 7961
6777fi 7962fi
7963
6778rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 7964rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6779 7965
6780 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to specify blibpath for linker ($LD)" >&5 7966 { echo "$as_me:$LINENO: checking how to specify blibpath for linker ($LD)" >&5
6781$as_echo_n "checking how to specify blibpath for linker ($LD)... " >&6; } 7967echo $ECHO_N "checking how to specify blibpath for linker ($LD)... $ECHO_C" >&6; }
6782 if (test -z "$blibpath"); then 7968 if (test -z "$blibpath"); then
6783 blibpath="/usr/lib:/lib" 7969 blibpath="/usr/lib:/lib"
6784 fi 7970 fi
@@ -6791,7 +7977,11 @@ $as_echo_n "checking how to specify blibpath for linker ($LD)... " >&6; }
6791 for tryflags in $flags ;do 7977 for tryflags in $flags ;do
6792 if (test -z "$blibflags"); then 7978 if (test -z "$blibflags"); then
6793 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath" 7979 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
6794 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 7980 cat >conftest.$ac_ext <<_ACEOF
7981/* confdefs.h. */
7982_ACEOF
7983cat confdefs.h >>conftest.$ac_ext
7984cat >>conftest.$ac_ext <<_ACEOF
6795/* end confdefs.h. */ 7985/* end confdefs.h. */
6796 7986
6797int 7987int
@@ -6802,36 +7992,147 @@ main ()
6802 return 0; 7992 return 0;
6803} 7993}
6804_ACEOF 7994_ACEOF
6805if ac_fn_c_try_link "$LINENO"; then : 7995rm -f conftest.$ac_objext conftest$ac_exeext
7996if { (ac_try="$ac_link"
7997case "(($ac_try" in
7998 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
7999 *) ac_try_echo=$ac_try;;
8000esac
8001eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8002 (eval "$ac_link") 2>conftest.er1
8003 ac_status=$?
8004 grep -v '^ *+' conftest.er1 >conftest.err
8005 rm -f conftest.er1
8006 cat conftest.err >&5
8007 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8008 (exit $ac_status); } && {
8009 test -z "$ac_c_werror_flag" ||
8010 test ! -s conftest.err
8011 } && test -s conftest$ac_exeext &&
8012 $as_test_x conftest$ac_exeext; then
6806 blibflags=$tryflags 8013 blibflags=$tryflags
8014else
8015 echo "$as_me: failed program was:" >&5
8016sed 's/^/| /' conftest.$ac_ext >&5
8017
8018
6807fi 8019fi
6808rm -f core conftest.err conftest.$ac_objext \ 8020
6809 conftest$ac_exeext conftest.$ac_ext 8021rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8022 conftest$ac_exeext conftest.$ac_ext
6810 fi 8023 fi
6811 done 8024 done
6812 if (test -z "$blibflags"); then 8025 if (test -z "$blibflags"); then
6813 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 8026 { echo "$as_me:$LINENO: result: not found" >&5
6814$as_echo "not found" >&6; } 8027echo "${ECHO_T}not found" >&6; }
6815 as_fn_error $? "*** must be able to specify blibpath on AIX - check config.log" "$LINENO" 5 8028 { { echo "$as_me:$LINENO: error: *** must be able to specify blibpath on AIX - check config.log" >&5
8029echo "$as_me: error: *** must be able to specify blibpath on AIX - check config.log" >&2;}
8030 { (exit 1); exit 1; }; }
6816 else 8031 else
6817 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $blibflags" >&5 8032 { echo "$as_me:$LINENO: result: $blibflags" >&5
6818$as_echo "$blibflags" >&6; } 8033echo "${ECHO_T}$blibflags" >&6; }
6819 fi 8034 fi
6820 LDFLAGS="$saved_LDFLAGS" 8035 LDFLAGS="$saved_LDFLAGS"
6821 ac_fn_c_check_func "$LINENO" "authenticate" "ac_cv_func_authenticate" 8036 { echo "$as_me:$LINENO: checking for authenticate" >&5
6822if test "x$ac_cv_func_authenticate" = xyes; then : 8037echo $ECHO_N "checking for authenticate... $ECHO_C" >&6; }
8038if test "${ac_cv_func_authenticate+set}" = set; then
8039 echo $ECHO_N "(cached) $ECHO_C" >&6
8040else
8041 cat >conftest.$ac_ext <<_ACEOF
8042/* confdefs.h. */
8043_ACEOF
8044cat confdefs.h >>conftest.$ac_ext
8045cat >>conftest.$ac_ext <<_ACEOF
8046/* end confdefs.h. */
8047/* Define authenticate to an innocuous variant, in case <limits.h> declares authenticate.
8048 For example, HP-UX 11i <limits.h> declares gettimeofday. */
8049#define authenticate innocuous_authenticate
8050
8051/* System header to define __stub macros and hopefully few prototypes,
8052 which can conflict with char authenticate (); below.
8053 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
8054 <limits.h> exists even on freestanding compilers. */
8055
8056#ifdef __STDC__
8057# include <limits.h>
8058#else
8059# include <assert.h>
8060#endif
8061
8062#undef authenticate
8063
8064/* Override any GCC internal prototype to avoid an error.
8065 Use char because int might match the return type of a GCC
8066 builtin and then its argument prototype would still apply. */
8067#ifdef __cplusplus
8068extern "C"
8069#endif
8070char authenticate ();
8071/* The GNU C library defines this for functions which it implements
8072 to always fail with ENOSYS. Some functions are actually named
8073 something starting with __ and the normal name is an alias. */
8074#if defined __stub_authenticate || defined __stub___authenticate
8075choke me
8076#endif
6823 8077
6824$as_echo "#define WITH_AIXAUTHENTICATE 1" >>confdefs.h 8078int
8079main ()
8080{
8081return authenticate ();
8082 ;
8083 return 0;
8084}
8085_ACEOF
8086rm -f conftest.$ac_objext conftest$ac_exeext
8087if { (ac_try="$ac_link"
8088case "(($ac_try" in
8089 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8090 *) ac_try_echo=$ac_try;;
8091esac
8092eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8093 (eval "$ac_link") 2>conftest.er1
8094 ac_status=$?
8095 grep -v '^ *+' conftest.er1 >conftest.err
8096 rm -f conftest.er1
8097 cat conftest.err >&5
8098 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8099 (exit $ac_status); } && {
8100 test -z "$ac_c_werror_flag" ||
8101 test ! -s conftest.err
8102 } && test -s conftest$ac_exeext &&
8103 $as_test_x conftest$ac_exeext; then
8104 ac_cv_func_authenticate=yes
8105else
8106 echo "$as_me: failed program was:" >&5
8107sed 's/^/| /' conftest.$ac_ext >&5
8108
8109 ac_cv_func_authenticate=no
8110fi
8111
8112rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8113 conftest$ac_exeext conftest.$ac_ext
8114fi
8115{ echo "$as_me:$LINENO: result: $ac_cv_func_authenticate" >&5
8116echo "${ECHO_T}$ac_cv_func_authenticate" >&6; }
8117if test $ac_cv_func_authenticate = yes; then
8118
8119cat >>confdefs.h <<\_ACEOF
8120#define WITH_AIXAUTHENTICATE 1
8121_ACEOF
6825 8122
6826else 8123else
6827 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for authenticate in -ls" >&5 8124 { echo "$as_me:$LINENO: checking for authenticate in -ls" >&5
6828$as_echo_n "checking for authenticate in -ls... " >&6; } 8125echo $ECHO_N "checking for authenticate in -ls... $ECHO_C" >&6; }
6829if ${ac_cv_lib_s_authenticate+:} false; then : 8126if test "${ac_cv_lib_s_authenticate+set}" = set; then
6830 $as_echo_n "(cached) " >&6 8127 echo $ECHO_N "(cached) $ECHO_C" >&6
6831else 8128else
6832 ac_check_lib_save_LIBS=$LIBS 8129 ac_check_lib_save_LIBS=$LIBS
6833LIBS="-ls $LIBS" 8130LIBS="-ls $LIBS"
6834cat confdefs.h - <<_ACEOF >conftest.$ac_ext 8131cat >conftest.$ac_ext <<_ACEOF
8132/* confdefs.h. */
8133_ACEOF
8134cat confdefs.h >>conftest.$ac_ext
8135cat >>conftest.$ac_ext <<_ACEOF
6835/* end confdefs.h. */ 8136/* end confdefs.h. */
6836 8137
6837/* Override any GCC internal prototype to avoid an error. 8138/* Override any GCC internal prototype to avoid an error.
@@ -6849,19 +8150,42 @@ return authenticate ();
6849 return 0; 8150 return 0;
6850} 8151}
6851_ACEOF 8152_ACEOF
6852if ac_fn_c_try_link "$LINENO"; then : 8153rm -f conftest.$ac_objext conftest$ac_exeext
8154if { (ac_try="$ac_link"
8155case "(($ac_try" in
8156 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8157 *) ac_try_echo=$ac_try;;
8158esac
8159eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8160 (eval "$ac_link") 2>conftest.er1
8161 ac_status=$?
8162 grep -v '^ *+' conftest.er1 >conftest.err
8163 rm -f conftest.er1
8164 cat conftest.err >&5
8165 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8166 (exit $ac_status); } && {
8167 test -z "$ac_c_werror_flag" ||
8168 test ! -s conftest.err
8169 } && test -s conftest$ac_exeext &&
8170 $as_test_x conftest$ac_exeext; then
6853 ac_cv_lib_s_authenticate=yes 8171 ac_cv_lib_s_authenticate=yes
6854else 8172else
6855 ac_cv_lib_s_authenticate=no 8173 echo "$as_me: failed program was:" >&5
8174sed 's/^/| /' conftest.$ac_ext >&5
8175
8176 ac_cv_lib_s_authenticate=no
6856fi 8177fi
6857rm -f core conftest.err conftest.$ac_objext \ 8178
6858 conftest$ac_exeext conftest.$ac_ext 8179rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8180 conftest$ac_exeext conftest.$ac_ext
6859LIBS=$ac_check_lib_save_LIBS 8181LIBS=$ac_check_lib_save_LIBS
6860fi 8182fi
6861{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_s_authenticate" >&5 8183{ echo "$as_me:$LINENO: result: $ac_cv_lib_s_authenticate" >&5
6862$as_echo "$ac_cv_lib_s_authenticate" >&6; } 8184echo "${ECHO_T}$ac_cv_lib_s_authenticate" >&6; }
6863if test "x$ac_cv_lib_s_authenticate" = xyes; then : 8185if test $ac_cv_lib_s_authenticate = yes; then
6864 $as_echo "#define WITH_AIXAUTHENTICATE 1" >>confdefs.h 8186 cat >>confdefs.h <<\_ACEOF
8187#define WITH_AIXAUTHENTICATE 1
8188_ACEOF
6865 8189
6866 LIBS="$LIBS -ls" 8190 LIBS="$LIBS -ls"
6867 8191
@@ -6870,78 +8194,410 @@ fi
6870 8194
6871fi 8195fi
6872 8196
6873 ac_fn_c_check_decl "$LINENO" "authenticate" "ac_cv_have_decl_authenticate" "#include <usersec.h> 8197 { echo "$as_me:$LINENO: checking whether authenticate is declared" >&5
6874" 8198echo $ECHO_N "checking whether authenticate is declared... $ECHO_C" >&6; }
6875if test "x$ac_cv_have_decl_authenticate" = xyes; then : 8199if test "${ac_cv_have_decl_authenticate+set}" = set; then
6876 ac_have_decl=1 8200 echo $ECHO_N "(cached) $ECHO_C" >&6
6877else 8201else
6878 ac_have_decl=0 8202 cat >conftest.$ac_ext <<_ACEOF
8203/* confdefs.h. */
8204_ACEOF
8205cat confdefs.h >>conftest.$ac_ext
8206cat >>conftest.$ac_ext <<_ACEOF
8207/* end confdefs.h. */
8208#include <usersec.h>
8209
8210int
8211main ()
8212{
8213#ifndef authenticate
8214 (void) authenticate;
8215#endif
8216
8217 ;
8218 return 0;
8219}
8220_ACEOF
8221rm -f conftest.$ac_objext
8222if { (ac_try="$ac_compile"
8223case "(($ac_try" in
8224 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8225 *) ac_try_echo=$ac_try;;
8226esac
8227eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8228 (eval "$ac_compile") 2>conftest.er1
8229 ac_status=$?
8230 grep -v '^ *+' conftest.er1 >conftest.err
8231 rm -f conftest.er1
8232 cat conftest.err >&5
8233 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8234 (exit $ac_status); } && {
8235 test -z "$ac_c_werror_flag" ||
8236 test ! -s conftest.err
8237 } && test -s conftest.$ac_objext; then
8238 ac_cv_have_decl_authenticate=yes
8239else
8240 echo "$as_me: failed program was:" >&5
8241sed 's/^/| /' conftest.$ac_ext >&5
8242
8243 ac_cv_have_decl_authenticate=no
6879fi 8244fi
6880 8245
8246rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
8247fi
8248{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_authenticate" >&5
8249echo "${ECHO_T}$ac_cv_have_decl_authenticate" >&6; }
8250if test $ac_cv_have_decl_authenticate = yes; then
8251
6881cat >>confdefs.h <<_ACEOF 8252cat >>confdefs.h <<_ACEOF
6882#define HAVE_DECL_AUTHENTICATE $ac_have_decl 8253#define HAVE_DECL_AUTHENTICATE 1
6883_ACEOF 8254_ACEOF
6884ac_fn_c_check_decl "$LINENO" "loginrestrictions" "ac_cv_have_decl_loginrestrictions" "#include <usersec.h> 8255
6885" 8256
6886if test "x$ac_cv_have_decl_loginrestrictions" = xyes; then : 8257else
6887 ac_have_decl=1 8258 cat >>confdefs.h <<_ACEOF
8259#define HAVE_DECL_AUTHENTICATE 0
8260_ACEOF
8261
8262
8263fi
8264{ echo "$as_me:$LINENO: checking whether loginrestrictions is declared" >&5
8265echo $ECHO_N "checking whether loginrestrictions is declared... $ECHO_C" >&6; }
8266if test "${ac_cv_have_decl_loginrestrictions+set}" = set; then
8267 echo $ECHO_N "(cached) $ECHO_C" >&6
8268else
8269 cat >conftest.$ac_ext <<_ACEOF
8270/* confdefs.h. */
8271_ACEOF
8272cat confdefs.h >>conftest.$ac_ext
8273cat >>conftest.$ac_ext <<_ACEOF
8274/* end confdefs.h. */
8275#include <usersec.h>
8276
8277int
8278main ()
8279{
8280#ifndef loginrestrictions
8281 (void) loginrestrictions;
8282#endif
8283
8284 ;
8285 return 0;
8286}
8287_ACEOF
8288rm -f conftest.$ac_objext
8289if { (ac_try="$ac_compile"
8290case "(($ac_try" in
8291 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8292 *) ac_try_echo=$ac_try;;
8293esac
8294eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8295 (eval "$ac_compile") 2>conftest.er1
8296 ac_status=$?
8297 grep -v '^ *+' conftest.er1 >conftest.err
8298 rm -f conftest.er1
8299 cat conftest.err >&5
8300 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8301 (exit $ac_status); } && {
8302 test -z "$ac_c_werror_flag" ||
8303 test ! -s conftest.err
8304 } && test -s conftest.$ac_objext; then
8305 ac_cv_have_decl_loginrestrictions=yes
6888else 8306else
6889 ac_have_decl=0 8307 echo "$as_me: failed program was:" >&5
8308sed 's/^/| /' conftest.$ac_ext >&5
8309
8310 ac_cv_have_decl_loginrestrictions=no
6890fi 8311fi
6891 8312
8313rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
8314fi
8315{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_loginrestrictions" >&5
8316echo "${ECHO_T}$ac_cv_have_decl_loginrestrictions" >&6; }
8317if test $ac_cv_have_decl_loginrestrictions = yes; then
8318
6892cat >>confdefs.h <<_ACEOF 8319cat >>confdefs.h <<_ACEOF
6893#define HAVE_DECL_LOGINRESTRICTIONS $ac_have_decl 8320#define HAVE_DECL_LOGINRESTRICTIONS 1
6894_ACEOF 8321_ACEOF
6895ac_fn_c_check_decl "$LINENO" "loginsuccess" "ac_cv_have_decl_loginsuccess" "#include <usersec.h> 8322
6896" 8323
6897if test "x$ac_cv_have_decl_loginsuccess" = xyes; then : 8324else
6898 ac_have_decl=1 8325 cat >>confdefs.h <<_ACEOF
8326#define HAVE_DECL_LOGINRESTRICTIONS 0
8327_ACEOF
8328
8329
8330fi
8331{ echo "$as_me:$LINENO: checking whether loginsuccess is declared" >&5
8332echo $ECHO_N "checking whether loginsuccess is declared... $ECHO_C" >&6; }
8333if test "${ac_cv_have_decl_loginsuccess+set}" = set; then
8334 echo $ECHO_N "(cached) $ECHO_C" >&6
8335else
8336 cat >conftest.$ac_ext <<_ACEOF
8337/* confdefs.h. */
8338_ACEOF
8339cat confdefs.h >>conftest.$ac_ext
8340cat >>conftest.$ac_ext <<_ACEOF
8341/* end confdefs.h. */
8342#include <usersec.h>
8343
8344int
8345main ()
8346{
8347#ifndef loginsuccess
8348 (void) loginsuccess;
8349#endif
8350
8351 ;
8352 return 0;
8353}
8354_ACEOF
8355rm -f conftest.$ac_objext
8356if { (ac_try="$ac_compile"
8357case "(($ac_try" in
8358 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8359 *) ac_try_echo=$ac_try;;
8360esac
8361eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8362 (eval "$ac_compile") 2>conftest.er1
8363 ac_status=$?
8364 grep -v '^ *+' conftest.er1 >conftest.err
8365 rm -f conftest.er1
8366 cat conftest.err >&5
8367 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8368 (exit $ac_status); } && {
8369 test -z "$ac_c_werror_flag" ||
8370 test ! -s conftest.err
8371 } && test -s conftest.$ac_objext; then
8372 ac_cv_have_decl_loginsuccess=yes
6899else 8373else
6900 ac_have_decl=0 8374 echo "$as_me: failed program was:" >&5
8375sed 's/^/| /' conftest.$ac_ext >&5
8376
8377 ac_cv_have_decl_loginsuccess=no
8378fi
8379
8380rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6901fi 8381fi
8382{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_loginsuccess" >&5
8383echo "${ECHO_T}$ac_cv_have_decl_loginsuccess" >&6; }
8384if test $ac_cv_have_decl_loginsuccess = yes; then
6902 8385
6903cat >>confdefs.h <<_ACEOF 8386cat >>confdefs.h <<_ACEOF
6904#define HAVE_DECL_LOGINSUCCESS $ac_have_decl 8387#define HAVE_DECL_LOGINSUCCESS 1
6905_ACEOF 8388_ACEOF
6906ac_fn_c_check_decl "$LINENO" "passwdexpired" "ac_cv_have_decl_passwdexpired" "#include <usersec.h> 8389
6907" 8390
6908if test "x$ac_cv_have_decl_passwdexpired" = xyes; then :
6909 ac_have_decl=1
6910else 8391else
6911 ac_have_decl=0 8392 cat >>confdefs.h <<_ACEOF
8393#define HAVE_DECL_LOGINSUCCESS 0
8394_ACEOF
8395
8396
6912fi 8397fi
8398{ echo "$as_me:$LINENO: checking whether passwdexpired is declared" >&5
8399echo $ECHO_N "checking whether passwdexpired is declared... $ECHO_C" >&6; }
8400if test "${ac_cv_have_decl_passwdexpired+set}" = set; then
8401 echo $ECHO_N "(cached) $ECHO_C" >&6
8402else
8403 cat >conftest.$ac_ext <<_ACEOF
8404/* confdefs.h. */
8405_ACEOF
8406cat confdefs.h >>conftest.$ac_ext
8407cat >>conftest.$ac_ext <<_ACEOF
8408/* end confdefs.h. */
8409#include <usersec.h>
8410
8411int
8412main ()
8413{
8414#ifndef passwdexpired
8415 (void) passwdexpired;
8416#endif
8417
8418 ;
8419 return 0;
8420}
8421_ACEOF
8422rm -f conftest.$ac_objext
8423if { (ac_try="$ac_compile"
8424case "(($ac_try" in
8425 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8426 *) ac_try_echo=$ac_try;;
8427esac
8428eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8429 (eval "$ac_compile") 2>conftest.er1
8430 ac_status=$?
8431 grep -v '^ *+' conftest.er1 >conftest.err
8432 rm -f conftest.er1
8433 cat conftest.err >&5
8434 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8435 (exit $ac_status); } && {
8436 test -z "$ac_c_werror_flag" ||
8437 test ! -s conftest.err
8438 } && test -s conftest.$ac_objext; then
8439 ac_cv_have_decl_passwdexpired=yes
8440else
8441 echo "$as_me: failed program was:" >&5
8442sed 's/^/| /' conftest.$ac_ext >&5
8443
8444 ac_cv_have_decl_passwdexpired=no
8445fi
8446
8447rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
8448fi
8449{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_passwdexpired" >&5
8450echo "${ECHO_T}$ac_cv_have_decl_passwdexpired" >&6; }
8451if test $ac_cv_have_decl_passwdexpired = yes; then
6913 8452
6914cat >>confdefs.h <<_ACEOF 8453cat >>confdefs.h <<_ACEOF
6915#define HAVE_DECL_PASSWDEXPIRED $ac_have_decl 8454#define HAVE_DECL_PASSWDEXPIRED 1
6916_ACEOF 8455_ACEOF
6917ac_fn_c_check_decl "$LINENO" "setauthdb" "ac_cv_have_decl_setauthdb" "#include <usersec.h> 8456
6918" 8457
6919if test "x$ac_cv_have_decl_setauthdb" = xyes; then : 8458else
6920 ac_have_decl=1 8459 cat >>confdefs.h <<_ACEOF
8460#define HAVE_DECL_PASSWDEXPIRED 0
8461_ACEOF
8462
8463
8464fi
8465{ echo "$as_me:$LINENO: checking whether setauthdb is declared" >&5
8466echo $ECHO_N "checking whether setauthdb is declared... $ECHO_C" >&6; }
8467if test "${ac_cv_have_decl_setauthdb+set}" = set; then
8468 echo $ECHO_N "(cached) $ECHO_C" >&6
6921else 8469else
6922 ac_have_decl=0 8470 cat >conftest.$ac_ext <<_ACEOF
8471/* confdefs.h. */
8472_ACEOF
8473cat confdefs.h >>conftest.$ac_ext
8474cat >>conftest.$ac_ext <<_ACEOF
8475/* end confdefs.h. */
8476#include <usersec.h>
8477
8478int
8479main ()
8480{
8481#ifndef setauthdb
8482 (void) setauthdb;
8483#endif
8484
8485 ;
8486 return 0;
8487}
8488_ACEOF
8489rm -f conftest.$ac_objext
8490if { (ac_try="$ac_compile"
8491case "(($ac_try" in
8492 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8493 *) ac_try_echo=$ac_try;;
8494esac
8495eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8496 (eval "$ac_compile") 2>conftest.er1
8497 ac_status=$?
8498 grep -v '^ *+' conftest.er1 >conftest.err
8499 rm -f conftest.er1
8500 cat conftest.err >&5
8501 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8502 (exit $ac_status); } && {
8503 test -z "$ac_c_werror_flag" ||
8504 test ! -s conftest.err
8505 } && test -s conftest.$ac_objext; then
8506 ac_cv_have_decl_setauthdb=yes
8507else
8508 echo "$as_me: failed program was:" >&5
8509sed 's/^/| /' conftest.$ac_ext >&5
8510
8511 ac_cv_have_decl_setauthdb=no
6923fi 8512fi
6924 8513
8514rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
8515fi
8516{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_setauthdb" >&5
8517echo "${ECHO_T}$ac_cv_have_decl_setauthdb" >&6; }
8518if test $ac_cv_have_decl_setauthdb = yes; then
8519
6925cat >>confdefs.h <<_ACEOF 8520cat >>confdefs.h <<_ACEOF
6926#define HAVE_DECL_SETAUTHDB $ac_have_decl 8521#define HAVE_DECL_SETAUTHDB 1
6927_ACEOF 8522_ACEOF
6928 8523
6929 ac_fn_c_check_decl "$LINENO" "loginfailed" "ac_cv_have_decl_loginfailed" "#include <usersec.h>
6930 8524
6931"
6932if test "x$ac_cv_have_decl_loginfailed" = xyes; then :
6933 ac_have_decl=1
6934else 8525else
6935 ac_have_decl=0 8526 cat >>confdefs.h <<_ACEOF
8527#define HAVE_DECL_SETAUTHDB 0
8528_ACEOF
8529
8530
6936fi 8531fi
6937 8532
8533
8534 { echo "$as_me:$LINENO: checking whether loginfailed is declared" >&5
8535echo $ECHO_N "checking whether loginfailed is declared... $ECHO_C" >&6; }
8536if test "${ac_cv_have_decl_loginfailed+set}" = set; then
8537 echo $ECHO_N "(cached) $ECHO_C" >&6
8538else
8539 cat >conftest.$ac_ext <<_ACEOF
8540/* confdefs.h. */
8541_ACEOF
8542cat confdefs.h >>conftest.$ac_ext
8543cat >>conftest.$ac_ext <<_ACEOF
8544/* end confdefs.h. */
8545#include <usersec.h>
8546
8547
8548int
8549main ()
8550{
8551#ifndef loginfailed
8552 (void) loginfailed;
8553#endif
8554
8555 ;
8556 return 0;
8557}
8558_ACEOF
8559rm -f conftest.$ac_objext
8560if { (ac_try="$ac_compile"
8561case "(($ac_try" in
8562 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8563 *) ac_try_echo=$ac_try;;
8564esac
8565eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8566 (eval "$ac_compile") 2>conftest.er1
8567 ac_status=$?
8568 grep -v '^ *+' conftest.er1 >conftest.err
8569 rm -f conftest.er1
8570 cat conftest.err >&5
8571 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8572 (exit $ac_status); } && {
8573 test -z "$ac_c_werror_flag" ||
8574 test ! -s conftest.err
8575 } && test -s conftest.$ac_objext; then
8576 ac_cv_have_decl_loginfailed=yes
8577else
8578 echo "$as_me: failed program was:" >&5
8579sed 's/^/| /' conftest.$ac_ext >&5
8580
8581 ac_cv_have_decl_loginfailed=no
8582fi
8583
8584rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
8585fi
8586{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_loginfailed" >&5
8587echo "${ECHO_T}$ac_cv_have_decl_loginfailed" >&6; }
8588if test $ac_cv_have_decl_loginfailed = yes; then
8589
6938cat >>confdefs.h <<_ACEOF 8590cat >>confdefs.h <<_ACEOF
6939#define HAVE_DECL_LOGINFAILED $ac_have_decl 8591#define HAVE_DECL_LOGINFAILED 1
6940_ACEOF 8592_ACEOF
6941if test $ac_have_decl = 1; then : 8593
6942 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if loginfailed takes 4 arguments" >&5 8594{ echo "$as_me:$LINENO: checking if loginfailed takes 4 arguments" >&5
6943$as_echo_n "checking if loginfailed takes 4 arguments... " >&6; } 8595echo $ECHO_N "checking if loginfailed takes 4 arguments... $ECHO_C" >&6; }
6944 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 8596 cat >conftest.$ac_ext <<_ACEOF
8597/* confdefs.h. */
8598_ACEOF
8599cat confdefs.h >>conftest.$ac_ext
8600cat >>conftest.$ac_ext <<_ACEOF
6945/* end confdefs.h. */ 8601/* end confdefs.h. */
6946 #include <usersec.h> 8602 #include <usersec.h>
6947int 8603int
@@ -6952,119 +8608,328 @@ main ()
6952 return 0; 8608 return 0;
6953} 8609}
6954_ACEOF 8610_ACEOF
6955if ac_fn_c_try_compile "$LINENO"; then : 8611rm -f conftest.$ac_objext
6956 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 8612if { (ac_try="$ac_compile"
6957$as_echo "yes" >&6; } 8613case "(($ac_try" in
8614 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8615 *) ac_try_echo=$ac_try;;
8616esac
8617eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8618 (eval "$ac_compile") 2>conftest.er1
8619 ac_status=$?
8620 grep -v '^ *+' conftest.er1 >conftest.err
8621 rm -f conftest.er1
8622 cat conftest.err >&5
8623 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8624 (exit $ac_status); } && {
8625 test -z "$ac_c_werror_flag" ||
8626 test ! -s conftest.err
8627 } && test -s conftest.$ac_objext; then
8628 { echo "$as_me:$LINENO: result: yes" >&5
8629echo "${ECHO_T}yes" >&6; }
6958 8630
6959$as_echo "#define AIX_LOGINFAILED_4ARG 1" >>confdefs.h 8631cat >>confdefs.h <<\_ACEOF
8632#define AIX_LOGINFAILED_4ARG 1
8633_ACEOF
6960 8634
6961else 8635else
6962 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 8636 echo "$as_me: failed program was:" >&5
6963$as_echo "no" >&6; } 8637sed 's/^/| /' conftest.$ac_ext >&5
8638
8639 { echo "$as_me:$LINENO: result: no" >&5
8640echo "${ECHO_T}no" >&6; }
6964 8641
6965fi 8642fi
8643
6966rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 8644rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
8645else
8646 cat >>confdefs.h <<_ACEOF
8647#define HAVE_DECL_LOGINFAILED 0
8648_ACEOF
8649
8650
8651fi
8652
8653
8654
8655
8656for ac_func in getgrset setauthdb
8657do
8658as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
8659{ echo "$as_me:$LINENO: checking for $ac_func" >&5
8660echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
8661if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
8662 echo $ECHO_N "(cached) $ECHO_C" >&6
8663else
8664 cat >conftest.$ac_ext <<_ACEOF
8665/* confdefs.h. */
8666_ACEOF
8667cat confdefs.h >>conftest.$ac_ext
8668cat >>conftest.$ac_ext <<_ACEOF
8669/* end confdefs.h. */
8670/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
8671 For example, HP-UX 11i <limits.h> declares gettimeofday. */
8672#define $ac_func innocuous_$ac_func
8673
8674/* System header to define __stub macros and hopefully few prototypes,
8675 which can conflict with char $ac_func (); below.
8676 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
8677 <limits.h> exists even on freestanding compilers. */
8678
8679#ifdef __STDC__
8680# include <limits.h>
8681#else
8682# include <assert.h>
8683#endif
8684
8685#undef $ac_func
8686
8687/* Override any GCC internal prototype to avoid an error.
8688 Use char because int might match the return type of a GCC
8689 builtin and then its argument prototype would still apply. */
8690#ifdef __cplusplus
8691extern "C"
8692#endif
8693char $ac_func ();
8694/* The GNU C library defines this for functions which it implements
8695 to always fail with ENOSYS. Some functions are actually named
8696 something starting with __ and the normal name is an alias. */
8697#if defined __stub_$ac_func || defined __stub___$ac_func
8698choke me
8699#endif
8700
8701int
8702main ()
8703{
8704return $ac_func ();
8705 ;
8706 return 0;
8707}
8708_ACEOF
8709rm -f conftest.$ac_objext conftest$ac_exeext
8710if { (ac_try="$ac_link"
8711case "(($ac_try" in
8712 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8713 *) ac_try_echo=$ac_try;;
8714esac
8715eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8716 (eval "$ac_link") 2>conftest.er1
8717 ac_status=$?
8718 grep -v '^ *+' conftest.er1 >conftest.err
8719 rm -f conftest.er1
8720 cat conftest.err >&5
8721 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8722 (exit $ac_status); } && {
8723 test -z "$ac_c_werror_flag" ||
8724 test ! -s conftest.err
8725 } && test -s conftest$ac_exeext &&
8726 $as_test_x conftest$ac_exeext; then
8727 eval "$as_ac_var=yes"
8728else
8729 echo "$as_me: failed program was:" >&5
8730sed 's/^/| /' conftest.$ac_ext >&5
8731
8732 eval "$as_ac_var=no"
6967fi 8733fi
6968 8734
6969 for ac_func in getgrset setauthdb 8735rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
6970do : 8736 conftest$ac_exeext conftest.$ac_ext
6971 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 8737fi
6972ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 8738ac_res=`eval echo '${'$as_ac_var'}'`
6973if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 8739 { echo "$as_me:$LINENO: result: $ac_res" >&5
8740echo "${ECHO_T}$ac_res" >&6; }
8741if test `eval echo '${'$as_ac_var'}'` = yes; then
6974 cat >>confdefs.h <<_ACEOF 8742 cat >>confdefs.h <<_ACEOF
6975#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 8743#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
6976_ACEOF 8744_ACEOF
6977 8745
6978fi 8746fi
6979done 8747done
6980 8748
6981 ac_fn_c_check_decl "$LINENO" "F_CLOSEM" "ac_cv_have_decl_F_CLOSEM" " #include <limits.h> 8749 { echo "$as_me:$LINENO: checking whether F_CLOSEM is declared" >&5
8750echo $ECHO_N "checking whether F_CLOSEM is declared... $ECHO_C" >&6; }
8751if test "${ac_cv_have_decl_F_CLOSEM+set}" = set; then
8752 echo $ECHO_N "(cached) $ECHO_C" >&6
8753else
8754 cat >conftest.$ac_ext <<_ACEOF
8755/* confdefs.h. */
8756_ACEOF
8757cat confdefs.h >>conftest.$ac_ext
8758cat >>conftest.$ac_ext <<_ACEOF
8759/* end confdefs.h. */
8760 #include <limits.h>
6982 #include <fcntl.h> 8761 #include <fcntl.h>
6983 8762
6984"
6985if test "x$ac_cv_have_decl_F_CLOSEM" = xyes; then :
6986 8763
6987$as_echo "#define HAVE_FCNTL_CLOSEM 1" >>confdefs.h 8764int
8765main ()
8766{
8767#ifndef F_CLOSEM
8768 (void) F_CLOSEM;
8769#endif
8770
8771 ;
8772 return 0;
8773}
8774_ACEOF
8775rm -f conftest.$ac_objext
8776if { (ac_try="$ac_compile"
8777case "(($ac_try" in
8778 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8779 *) ac_try_echo=$ac_try;;
8780esac
8781eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8782 (eval "$ac_compile") 2>conftest.er1
8783 ac_status=$?
8784 grep -v '^ *+' conftest.er1 >conftest.err
8785 rm -f conftest.er1
8786 cat conftest.err >&5
8787 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8788 (exit $ac_status); } && {
8789 test -z "$ac_c_werror_flag" ||
8790 test ! -s conftest.err
8791 } && test -s conftest.$ac_objext; then
8792 ac_cv_have_decl_F_CLOSEM=yes
8793else
8794 echo "$as_me: failed program was:" >&5
8795sed 's/^/| /' conftest.$ac_ext >&5
8796
8797 ac_cv_have_decl_F_CLOSEM=no
8798fi
8799
8800rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
8801fi
8802{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_F_CLOSEM" >&5
8803echo "${ECHO_T}$ac_cv_have_decl_F_CLOSEM" >&6; }
8804if test $ac_cv_have_decl_F_CLOSEM = yes; then
8805
8806cat >>confdefs.h <<\_ACEOF
8807#define HAVE_FCNTL_CLOSEM 1
8808_ACEOF
6988 8809
6989fi 8810fi
6990 8811
6991 check_for_aix_broken_getaddrinfo=1 8812 check_for_aix_broken_getaddrinfo=1
6992 8813
6993$as_echo "#define BROKEN_REALPATH 1" >>confdefs.h 8814cat >>confdefs.h <<\_ACEOF
8815#define BROKEN_REALPATH 1
8816_ACEOF
6994 8817
6995 8818
6996$as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 8819cat >>confdefs.h <<\_ACEOF
8820#define SETEUID_BREAKS_SETUID 1
8821_ACEOF
6997 8822
6998 8823
6999$as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 8824cat >>confdefs.h <<\_ACEOF
8825#define BROKEN_SETREUID 1
8826_ACEOF
7000 8827
7001 8828
7002$as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 8829cat >>confdefs.h <<\_ACEOF
8830#define BROKEN_SETREGID 1
8831_ACEOF
7003 8832
7004 8833
7005$as_echo "#define DISABLE_LASTLOG 1" >>confdefs.h 8834cat >>confdefs.h <<\_ACEOF
8835#define DISABLE_LASTLOG 1
8836_ACEOF
7006 8837
7007 8838
7008$as_echo "#define LOGIN_NEEDS_UTMPX 1" >>confdefs.h 8839cat >>confdefs.h <<\_ACEOF
8840#define LOGIN_NEEDS_UTMPX 1
8841_ACEOF
7009 8842
7010 8843
7011$as_echo "#define SPT_TYPE SPT_REUSEARGV" >>confdefs.h 8844cat >>confdefs.h <<\_ACEOF
8845#define SPT_TYPE SPT_REUSEARGV
8846_ACEOF
7012 8847
7013 8848
7014$as_echo "#define SSHPAM_CHAUTHTOK_NEEDS_RUID 1" >>confdefs.h 8849cat >>confdefs.h <<\_ACEOF
8850#define SSHPAM_CHAUTHTOK_NEEDS_RUID 1
8851_ACEOF
7015 8852
7016 8853
7017$as_echo "#define PTY_ZEROREAD 1" >>confdefs.h 8854cat >>confdefs.h <<\_ACEOF
8855#define PTY_ZEROREAD 1
8856_ACEOF
7018 8857
7019 8858
7020$as_echo "#define PLATFORM_SYS_DIR_UID 2" >>confdefs.h 8859cat >>confdefs.h <<\_ACEOF
8860#define PLATFORM_SYS_DIR_UID 2
8861_ACEOF
7021 8862
7022 ;; 8863 ;;
7023*-*-android*) 8864*-*-android*)
7024 8865
7025$as_echo "#define DISABLE_UTMP 1" >>confdefs.h 8866cat >>confdefs.h <<\_ACEOF
8867#define DISABLE_UTMP 1
8868_ACEOF
7026 8869
7027 8870
7028$as_echo "#define DISABLE_WTMP 1" >>confdefs.h 8871cat >>confdefs.h <<\_ACEOF
8872#define DISABLE_WTMP 1
8873_ACEOF
7029 8874
7030 ;; 8875 ;;
7031*-*-cygwin*) 8876*-*-cygwin*)
7032 check_for_libcrypt_later=1 8877 check_for_libcrypt_later=1
7033 LIBS="$LIBS /usr/lib/textreadmode.o" 8878 LIBS="$LIBS /usr/lib/textreadmode.o"
7034 8879
7035$as_echo "#define HAVE_CYGWIN 1" >>confdefs.h 8880cat >>confdefs.h <<\_ACEOF
8881#define HAVE_CYGWIN 1
8882_ACEOF
7036 8883
7037 8884
7038$as_echo "#define USE_PIPES 1" >>confdefs.h 8885cat >>confdefs.h <<\_ACEOF
8886#define USE_PIPES 1
8887_ACEOF
7039 8888
7040 8889
7041$as_echo "#define DISABLE_SHADOW 1" >>confdefs.h 8890cat >>confdefs.h <<\_ACEOF
8891#define DISABLE_SHADOW 1
8892_ACEOF
7042 8893
7043 8894
7044$as_echo "#define NO_X11_UNIX_SOCKETS 1" >>confdefs.h 8895cat >>confdefs.h <<\_ACEOF
8896#define NO_X11_UNIX_SOCKETS 1
8897_ACEOF
7045 8898
7046 8899
7047$as_echo "#define NO_IPPORT_RESERVED_CONCEPT 1" >>confdefs.h 8900cat >>confdefs.h <<\_ACEOF
8901#define NO_IPPORT_RESERVED_CONCEPT 1
8902_ACEOF
7048 8903
7049 8904
7050$as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 8905cat >>confdefs.h <<\_ACEOF
8906#define DISABLE_FD_PASSING 1
8907_ACEOF
7051 8908
7052 8909
7053$as_echo "#define SSH_IOBUFSZ 65535" >>confdefs.h 8910cat >>confdefs.h <<\_ACEOF
8911#define SSH_IOBUFSZ 65535
8912_ACEOF
7054 8913
7055 8914
7056$as_echo "#define FILESYSTEM_NO_BACKSLASH 1" >>confdefs.h 8915cat >>confdefs.h <<\_ACEOF
8916#define FILESYSTEM_NO_BACKSLASH 1
8917_ACEOF
7057 8918
7058 # Cygwin defines optargs, optargs as declspec(dllimport) for historical 8919 # Cygwin defines optargs, optargs as declspec(dllimport) for historical
7059 # reasons which cause compile warnings, so we disable those warnings. 8920 # reasons which cause compile warnings, so we disable those warnings.
7060 { 8921 {
7061 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -Wno-attributes" >&5 8922 { echo "$as_me:$LINENO: checking if $CC supports compile flag -Wno-attributes" >&5
7062$as_echo_n "checking if $CC supports compile flag -Wno-attributes... " >&6; } 8923echo $ECHO_N "checking if $CC supports compile flag -Wno-attributes... $ECHO_C" >&6; }
7063 saved_CFLAGS="$CFLAGS" 8924 saved_CFLAGS="$CFLAGS"
7064 CFLAGS="$CFLAGS $WERROR -Wno-attributes" 8925 CFLAGS="$CFLAGS $WERROR -Wno-attributes"
7065 _define_flag="" 8926 _define_flag=""
7066 test "x$_define_flag" = "x" && _define_flag="-Wno-attributes" 8927 test "x$_define_flag" = "x" && _define_flag="-Wno-attributes"
7067 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 8928 cat >conftest.$ac_ext <<_ACEOF
8929/* confdefs.h. */
8930_ACEOF
8931cat confdefs.h >>conftest.$ac_ext
8932cat >>conftest.$ac_ext <<_ACEOF
7068/* end confdefs.h. */ 8933/* end confdefs.h. */
7069 8934
7070#include <stdlib.h> 8935#include <stdlib.h>
@@ -7080,47 +8945,79 @@ int main(int argc, char **argv) {
7080} 8945}
7081 8946
7082_ACEOF 8947_ACEOF
7083if ac_fn_c_try_compile "$LINENO"; then : 8948rm -f conftest.$ac_objext
8949if { (ac_try="$ac_compile"
8950case "(($ac_try" in
8951 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8952 *) ac_try_echo=$ac_try;;
8953esac
8954eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8955 (eval "$ac_compile") 2>conftest.er1
8956 ac_status=$?
8957 grep -v '^ *+' conftest.er1 >conftest.err
8958 rm -f conftest.er1
8959 cat conftest.err >&5
8960 echo "$as_me:$LINENO: \$? = $ac_status" >&5
8961 (exit $ac_status); } && {
8962 test -z "$ac_c_werror_flag" ||
8963 test ! -s conftest.err
8964 } && test -s conftest.$ac_objext; then
7084 8965
7085if `grep -i "unrecognized option" conftest.err >/dev/null` 8966if `grep -i "unrecognized option" conftest.err >/dev/null`
7086then 8967then
7087 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 8968 { echo "$as_me:$LINENO: result: no" >&5
7088$as_echo "no" >&6; } 8969echo "${ECHO_T}no" >&6; }
7089 CFLAGS="$saved_CFLAGS" 8970 CFLAGS="$saved_CFLAGS"
7090else 8971else
7091 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 8972 { echo "$as_me:$LINENO: result: yes" >&5
7092$as_echo "yes" >&6; } 8973echo "${ECHO_T}yes" >&6; }
7093 CFLAGS="$saved_CFLAGS $_define_flag" 8974 CFLAGS="$saved_CFLAGS $_define_flag"
7094fi 8975fi
7095else 8976else
7096 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 8977 echo "$as_me: failed program was:" >&5
7097$as_echo "no" >&6; } 8978sed 's/^/| /' conftest.$ac_ext >&5
8979
8980 { echo "$as_me:$LINENO: result: no" >&5
8981echo "${ECHO_T}no" >&6; }
7098 CFLAGS="$saved_CFLAGS" 8982 CFLAGS="$saved_CFLAGS"
7099 8983
7100fi 8984fi
8985
7101rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 8986rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7102} 8987}
7103 ;; 8988 ;;
7104*-*-dgux*) 8989*-*-dgux*)
7105 8990
7106$as_echo "#define IP_TOS_IS_BROKEN 1" >>confdefs.h 8991cat >>confdefs.h <<\_ACEOF
8992#define IP_TOS_IS_BROKEN 1
8993_ACEOF
7107 8994
7108 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 8995 cat >>confdefs.h <<\_ACEOF
8996#define SETEUID_BREAKS_SETUID 1
8997_ACEOF
7109 8998
7110 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 8999 cat >>confdefs.h <<\_ACEOF
9000#define BROKEN_SETREUID 1
9001_ACEOF
7111 9002
7112 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 9003 cat >>confdefs.h <<\_ACEOF
9004#define BROKEN_SETREGID 1
9005_ACEOF
7113 9006
7114 ;; 9007 ;;
7115*-*-darwin*) 9008*-*-darwin*)
7116 use_pie=auto 9009 use_pie=auto
7117 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have working getaddrinfo" >&5 9010 { echo "$as_me:$LINENO: checking if we have working getaddrinfo" >&5
7118$as_echo_n "checking if we have working getaddrinfo... " >&6; } 9011echo $ECHO_N "checking if we have working getaddrinfo... $ECHO_C" >&6; }
7119 if test "$cross_compiling" = yes; then : 9012 if test "$cross_compiling" = yes; then
7120 { $as_echo "$as_me:${as_lineno-$LINENO}: result: assume it is working" >&5 9013 { echo "$as_me:$LINENO: result: assume it is working" >&5
7121$as_echo "assume it is working" >&6; } 9014echo "${ECHO_T}assume it is working" >&6; }
7122else 9015else
7123 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 9016 cat >conftest.$ac_ext <<_ACEOF
9017/* confdefs.h. */
9018_ACEOF
9019cat confdefs.h >>conftest.$ac_ext
9020cat >>conftest.$ac_ext <<_ACEOF
7124/* end confdefs.h. */ 9021/* end confdefs.h. */
7125 #include <mach-o/dyld.h> 9022 #include <mach-o/dyld.h>
7126main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) 9023main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
@@ -7130,29 +9027,63 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
7130} 9027}
7131 9028
7132_ACEOF 9029_ACEOF
7133if ac_fn_c_try_run "$LINENO"; then : 9030rm -f conftest$ac_exeext
7134 { $as_echo "$as_me:${as_lineno-$LINENO}: result: working" >&5 9031if { (ac_try="$ac_link"
7135$as_echo "working" >&6; } 9032case "(($ac_try" in
9033 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9034 *) ac_try_echo=$ac_try;;
9035esac
9036eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9037 (eval "$ac_link") 2>&5
9038 ac_status=$?
9039 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9040 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
9041 { (case "(($ac_try" in
9042 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9043 *) ac_try_echo=$ac_try;;
9044esac
9045eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9046 (eval "$ac_try") 2>&5
9047 ac_status=$?
9048 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9049 (exit $ac_status); }; }; then
9050 { echo "$as_me:$LINENO: result: working" >&5
9051echo "${ECHO_T}working" >&6; }
7136else 9052else
7137 { $as_echo "$as_me:${as_lineno-$LINENO}: result: buggy" >&5 9053 echo "$as_me: program exited with status $ac_status" >&5
7138$as_echo "buggy" >&6; } 9054echo "$as_me: failed program was:" >&5
9055sed 's/^/| /' conftest.$ac_ext >&5
7139 9056
7140$as_echo "#define BROKEN_GETADDRINFO 1" >>confdefs.h 9057( exit $ac_status )
9058{ echo "$as_me:$LINENO: result: buggy" >&5
9059echo "${ECHO_T}buggy" >&6; }
9060
9061cat >>confdefs.h <<\_ACEOF
9062#define BROKEN_GETADDRINFO 1
9063_ACEOF
7141 9064
7142 9065
7143fi 9066fi
7144rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 9067rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
7145 conftest.$ac_objext conftest.beam conftest.$ac_ext
7146fi 9068fi
7147 9069
7148 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h
7149 9070
7150 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 9071 cat >>confdefs.h <<\_ACEOF
9072#define SETEUID_BREAKS_SETUID 1
9073_ACEOF
9074
9075 cat >>confdefs.h <<\_ACEOF
9076#define BROKEN_SETREUID 1
9077_ACEOF
7151 9078
7152 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 9079 cat >>confdefs.h <<\_ACEOF
9080#define BROKEN_SETREGID 1
9081_ACEOF
7153 9082
7154 9083
7155$as_echo "#define BROKEN_GLOB 1" >>confdefs.h 9084cat >>confdefs.h <<\_ACEOF
9085#define BROKEN_GLOB 1
9086_ACEOF
7156 9087
7157 9088
7158cat >>confdefs.h <<_ACEOF 9089cat >>confdefs.h <<_ACEOF
@@ -7160,49 +9091,328 @@ cat >>confdefs.h <<_ACEOF
7160_ACEOF 9091_ACEOF
7161 9092
7162 9093
7163$as_echo "#define SSH_TUN_FREEBSD 1" >>confdefs.h 9094cat >>confdefs.h <<\_ACEOF
9095#define SSH_TUN_FREEBSD 1
9096_ACEOF
7164 9097
7165 9098
7166$as_echo "#define SSH_TUN_COMPAT_AF 1" >>confdefs.h 9099cat >>confdefs.h <<\_ACEOF
9100#define SSH_TUN_COMPAT_AF 1
9101_ACEOF
7167 9102
7168 9103
7169$as_echo "#define SSH_TUN_PREPEND_AF 1" >>confdefs.h 9104cat >>confdefs.h <<\_ACEOF
9105#define SSH_TUN_PREPEND_AF 1
9106_ACEOF
7170 9107
7171 9108
7172 ac_fn_c_check_decl "$LINENO" "AU_IPv4" "ac_cv_have_decl_AU_IPv4" "$ac_includes_default" 9109 { echo "$as_me:$LINENO: checking whether AU_IPv4 is declared" >&5
7173if test "x$ac_cv_have_decl_AU_IPv4" = xyes; then : 9110echo $ECHO_N "checking whether AU_IPv4 is declared... $ECHO_C" >&6; }
9111if test "${ac_cv_have_decl_AU_IPv4+set}" = set; then
9112 echo $ECHO_N "(cached) $ECHO_C" >&6
9113else
9114 cat >conftest.$ac_ext <<_ACEOF
9115/* confdefs.h. */
9116_ACEOF
9117cat confdefs.h >>conftest.$ac_ext
9118cat >>conftest.$ac_ext <<_ACEOF
9119/* end confdefs.h. */
9120$ac_includes_default
9121int
9122main ()
9123{
9124#ifndef AU_IPv4
9125 (void) AU_IPv4;
9126#endif
7174 9127
9128 ;
9129 return 0;
9130}
9131_ACEOF
9132rm -f conftest.$ac_objext
9133if { (ac_try="$ac_compile"
9134case "(($ac_try" in
9135 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9136 *) ac_try_echo=$ac_try;;
9137esac
9138eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9139 (eval "$ac_compile") 2>conftest.er1
9140 ac_status=$?
9141 grep -v '^ *+' conftest.er1 >conftest.err
9142 rm -f conftest.er1
9143 cat conftest.err >&5
9144 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9145 (exit $ac_status); } && {
9146 test -z "$ac_c_werror_flag" ||
9147 test ! -s conftest.err
9148 } && test -s conftest.$ac_objext; then
9149 ac_cv_have_decl_AU_IPv4=yes
7175else 9150else
9151 echo "$as_me: failed program was:" >&5
9152sed 's/^/| /' conftest.$ac_ext >&5
7176 9153
7177$as_echo "#define AU_IPv4 0" >>confdefs.h 9154 ac_cv_have_decl_AU_IPv4=no
9155fi
9156
9157rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9158fi
9159{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_AU_IPv4" >&5
9160echo "${ECHO_T}$ac_cv_have_decl_AU_IPv4" >&6; }
9161if test $ac_cv_have_decl_AU_IPv4 = yes; then
9162 :
9163else
9164
9165cat >>confdefs.h <<\_ACEOF
9166#define AU_IPv4 0
9167_ACEOF
7178 9168
7179 #include <bsm/audit.h> 9169 #include <bsm/audit.h>
7180 9170
7181$as_echo "#define LASTLOG_WRITE_PUTUTXLINE 1" >>confdefs.h 9171cat >>confdefs.h <<\_ACEOF
9172#define LASTLOG_WRITE_PUTUTXLINE 1
9173_ACEOF
7182 9174
7183 9175
7184fi 9176fi
7185 9177
7186 9178
7187$as_echo "#define SPT_TYPE SPT_REUSEARGV" >>confdefs.h 9179cat >>confdefs.h <<\_ACEOF
9180#define SPT_TYPE SPT_REUSEARGV
9181_ACEOF
9182
9183
9184for ac_func in sandbox_init
9185do
9186as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
9187{ echo "$as_me:$LINENO: checking for $ac_func" >&5
9188echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
9189if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
9190 echo $ECHO_N "(cached) $ECHO_C" >&6
9191else
9192 cat >conftest.$ac_ext <<_ACEOF
9193/* confdefs.h. */
9194_ACEOF
9195cat confdefs.h >>conftest.$ac_ext
9196cat >>conftest.$ac_ext <<_ACEOF
9197/* end confdefs.h. */
9198/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
9199 For example, HP-UX 11i <limits.h> declares gettimeofday. */
9200#define $ac_func innocuous_$ac_func
9201
9202/* System header to define __stub macros and hopefully few prototypes,
9203 which can conflict with char $ac_func (); below.
9204 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
9205 <limits.h> exists even on freestanding compilers. */
9206
9207#ifdef __STDC__
9208# include <limits.h>
9209#else
9210# include <assert.h>
9211#endif
9212
9213#undef $ac_func
9214
9215/* Override any GCC internal prototype to avoid an error.
9216 Use char because int might match the return type of a GCC
9217 builtin and then its argument prototype would still apply. */
9218#ifdef __cplusplus
9219extern "C"
9220#endif
9221char $ac_func ();
9222/* The GNU C library defines this for functions which it implements
9223 to always fail with ENOSYS. Some functions are actually named
9224 something starting with __ and the normal name is an alias. */
9225#if defined __stub_$ac_func || defined __stub___$ac_func
9226choke me
9227#endif
9228
9229int
9230main ()
9231{
9232return $ac_func ();
9233 ;
9234 return 0;
9235}
9236_ACEOF
9237rm -f conftest.$ac_objext conftest$ac_exeext
9238if { (ac_try="$ac_link"
9239case "(($ac_try" in
9240 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9241 *) ac_try_echo=$ac_try;;
9242esac
9243eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9244 (eval "$ac_link") 2>conftest.er1
9245 ac_status=$?
9246 grep -v '^ *+' conftest.er1 >conftest.err
9247 rm -f conftest.er1
9248 cat conftest.err >&5
9249 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9250 (exit $ac_status); } && {
9251 test -z "$ac_c_werror_flag" ||
9252 test ! -s conftest.err
9253 } && test -s conftest$ac_exeext &&
9254 $as_test_x conftest$ac_exeext; then
9255 eval "$as_ac_var=yes"
9256else
9257 echo "$as_me: failed program was:" >&5
9258sed 's/^/| /' conftest.$ac_ext >&5
9259
9260 eval "$as_ac_var=no"
9261fi
7188 9262
7189 for ac_func in sandbox_init 9263rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
7190do : 9264 conftest$ac_exeext conftest.$ac_ext
7191 ac_fn_c_check_func "$LINENO" "sandbox_init" "ac_cv_func_sandbox_init" 9265fi
7192if test "x$ac_cv_func_sandbox_init" = xyes; then : 9266ac_res=`eval echo '${'$as_ac_var'}'`
9267 { echo "$as_me:$LINENO: result: $ac_res" >&5
9268echo "${ECHO_T}$ac_res" >&6; }
9269if test `eval echo '${'$as_ac_var'}'` = yes; then
7193 cat >>confdefs.h <<_ACEOF 9270 cat >>confdefs.h <<_ACEOF
7194#define HAVE_SANDBOX_INIT 1 9271#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
7195_ACEOF 9272_ACEOF
7196 9273
7197fi 9274fi
7198done 9275done
7199 9276
7200 for ac_header in sandbox.h 9277
7201do : 9278for ac_header in sandbox.h
7202 ac_fn_c_check_header_mongrel "$LINENO" "sandbox.h" "ac_cv_header_sandbox_h" "$ac_includes_default" 9279do
7203if test "x$ac_cv_header_sandbox_h" = xyes; then : 9280as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
9281if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
9282 { echo "$as_me:$LINENO: checking for $ac_header" >&5
9283echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
9284if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
9285 echo $ECHO_N "(cached) $ECHO_C" >&6
9286fi
9287ac_res=`eval echo '${'$as_ac_Header'}'`
9288 { echo "$as_me:$LINENO: result: $ac_res" >&5
9289echo "${ECHO_T}$ac_res" >&6; }
9290else
9291 # Is the header compilable?
9292{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
9293echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
9294cat >conftest.$ac_ext <<_ACEOF
9295/* confdefs.h. */
9296_ACEOF
9297cat confdefs.h >>conftest.$ac_ext
9298cat >>conftest.$ac_ext <<_ACEOF
9299/* end confdefs.h. */
9300$ac_includes_default
9301#include <$ac_header>
9302_ACEOF
9303rm -f conftest.$ac_objext
9304if { (ac_try="$ac_compile"
9305case "(($ac_try" in
9306 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9307 *) ac_try_echo=$ac_try;;
9308esac
9309eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9310 (eval "$ac_compile") 2>conftest.er1
9311 ac_status=$?
9312 grep -v '^ *+' conftest.er1 >conftest.err
9313 rm -f conftest.er1
9314 cat conftest.err >&5
9315 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9316 (exit $ac_status); } && {
9317 test -z "$ac_c_werror_flag" ||
9318 test ! -s conftest.err
9319 } && test -s conftest.$ac_objext; then
9320 ac_header_compiler=yes
9321else
9322 echo "$as_me: failed program was:" >&5
9323sed 's/^/| /' conftest.$ac_ext >&5
9324
9325 ac_header_compiler=no
9326fi
9327
9328rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9329{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
9330echo "${ECHO_T}$ac_header_compiler" >&6; }
9331
9332# Is the header present?
9333{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
9334echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
9335cat >conftest.$ac_ext <<_ACEOF
9336/* confdefs.h. */
9337_ACEOF
9338cat confdefs.h >>conftest.$ac_ext
9339cat >>conftest.$ac_ext <<_ACEOF
9340/* end confdefs.h. */
9341#include <$ac_header>
9342_ACEOF
9343if { (ac_try="$ac_cpp conftest.$ac_ext"
9344case "(($ac_try" in
9345 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9346 *) ac_try_echo=$ac_try;;
9347esac
9348eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9349 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
9350 ac_status=$?
9351 grep -v '^ *+' conftest.er1 >conftest.err
9352 rm -f conftest.er1
9353 cat conftest.err >&5
9354 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9355 (exit $ac_status); } >/dev/null && {
9356 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
9357 test ! -s conftest.err
9358 }; then
9359 ac_header_preproc=yes
9360else
9361 echo "$as_me: failed program was:" >&5
9362sed 's/^/| /' conftest.$ac_ext >&5
9363
9364 ac_header_preproc=no
9365fi
9366
9367rm -f conftest.err conftest.$ac_ext
9368{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
9369echo "${ECHO_T}$ac_header_preproc" >&6; }
9370
9371# So? What about this header?
9372case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
9373 yes:no: )
9374 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
9375echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
9376 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
9377echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
9378 ac_header_preproc=yes
9379 ;;
9380 no:yes:* )
9381 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
9382echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
9383 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
9384echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
9385 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
9386echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
9387 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
9388echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
9389 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
9390echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
9391 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
9392echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
9393 ( cat <<\_ASBOX
9394## ------------------------------------------- ##
9395## Report this to openssh-unix-dev@mindrot.org ##
9396## ------------------------------------------- ##
9397_ASBOX
9398 ) | sed "s/^/$as_me: WARNING: /" >&2
9399 ;;
9400esac
9401{ echo "$as_me:$LINENO: checking for $ac_header" >&5
9402echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
9403if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
9404 echo $ECHO_N "(cached) $ECHO_C" >&6
9405else
9406 eval "$as_ac_Header=\$ac_header_preproc"
9407fi
9408ac_res=`eval echo '${'$as_ac_Header'}'`
9409 { echo "$as_me:$LINENO: result: $ac_res" >&5
9410echo "${ECHO_T}$ac_res" >&6; }
9411
9412fi
9413if test `eval echo '${'$as_ac_Header'}'` = yes; then
7204 cat >>confdefs.h <<_ACEOF 9414 cat >>confdefs.h <<_ACEOF
7205#define HAVE_SANDBOX_H 1 9415#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
7206_ACEOF 9416_ACEOF
7207 9417
7208fi 9418fi
@@ -7216,14 +9426,19 @@ done
7216 ;; 9426 ;;
7217*-*-haiku*) 9427*-*-haiku*)
7218 LIBS="$LIBS -lbsd " 9428 LIBS="$LIBS -lbsd "
7219 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lnetwork" >&5 9429
7220$as_echo_n "checking for socket in -lnetwork... " >&6; } 9430{ echo "$as_me:$LINENO: checking for socket in -lnetwork" >&5
7221if ${ac_cv_lib_network_socket+:} false; then : 9431echo $ECHO_N "checking for socket in -lnetwork... $ECHO_C" >&6; }
7222 $as_echo_n "(cached) " >&6 9432if test "${ac_cv_lib_network_socket+set}" = set; then
9433 echo $ECHO_N "(cached) $ECHO_C" >&6
7223else 9434else
7224 ac_check_lib_save_LIBS=$LIBS 9435 ac_check_lib_save_LIBS=$LIBS
7225LIBS="-lnetwork $LIBS" 9436LIBS="-lnetwork $LIBS"
7226cat confdefs.h - <<_ACEOF >conftest.$ac_ext 9437cat >conftest.$ac_ext <<_ACEOF
9438/* confdefs.h. */
9439_ACEOF
9440cat confdefs.h >>conftest.$ac_ext
9441cat >>conftest.$ac_ext <<_ACEOF
7227/* end confdefs.h. */ 9442/* end confdefs.h. */
7228 9443
7229/* Override any GCC internal prototype to avoid an error. 9444/* Override any GCC internal prototype to avoid an error.
@@ -7241,18 +9456,39 @@ return socket ();
7241 return 0; 9456 return 0;
7242} 9457}
7243_ACEOF 9458_ACEOF
7244if ac_fn_c_try_link "$LINENO"; then : 9459rm -f conftest.$ac_objext conftest$ac_exeext
9460if { (ac_try="$ac_link"
9461case "(($ac_try" in
9462 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9463 *) ac_try_echo=$ac_try;;
9464esac
9465eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9466 (eval "$ac_link") 2>conftest.er1
9467 ac_status=$?
9468 grep -v '^ *+' conftest.er1 >conftest.err
9469 rm -f conftest.er1
9470 cat conftest.err >&5
9471 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9472 (exit $ac_status); } && {
9473 test -z "$ac_c_werror_flag" ||
9474 test ! -s conftest.err
9475 } && test -s conftest$ac_exeext &&
9476 $as_test_x conftest$ac_exeext; then
7245 ac_cv_lib_network_socket=yes 9477 ac_cv_lib_network_socket=yes
7246else 9478else
7247 ac_cv_lib_network_socket=no 9479 echo "$as_me: failed program was:" >&5
9480sed 's/^/| /' conftest.$ac_ext >&5
9481
9482 ac_cv_lib_network_socket=no
7248fi 9483fi
7249rm -f core conftest.err conftest.$ac_objext \ 9484
7250 conftest$ac_exeext conftest.$ac_ext 9485rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9486 conftest$ac_exeext conftest.$ac_ext
7251LIBS=$ac_check_lib_save_LIBS 9487LIBS=$ac_check_lib_save_LIBS
7252fi 9488fi
7253{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_socket" >&5 9489{ echo "$as_me:$LINENO: result: $ac_cv_lib_network_socket" >&5
7254$as_echo "$ac_cv_lib_network_socket" >&6; } 9490echo "${ECHO_T}$ac_cv_lib_network_socket" >&6; }
7255if test "x$ac_cv_lib_network_socket" = xyes; then : 9491if test $ac_cv_lib_network_socket = yes; then
7256 cat >>confdefs.h <<_ACEOF 9492 cat >>confdefs.h <<_ACEOF
7257#define HAVE_LIBNETWORK 1 9493#define HAVE_LIBNETWORK 1
7258_ACEOF 9494_ACEOF
@@ -7261,7 +9497,9 @@ _ACEOF
7261 9497
7262fi 9498fi
7263 9499
7264 $as_echo "#define HAVE_U_INT64_T 1" >>confdefs.h 9500 cat >>confdefs.h <<\_ACEOF
9501#define HAVE_U_INT64_T 1
9502_ACEOF
7265 9503
7266 MANTYPE=man 9504 MANTYPE=man
7267 ;; 9505 ;;
@@ -7269,31 +9507,48 @@ fi
7269 # first we define all of the options common to all HP-UX releases 9507 # first we define all of the options common to all HP-UX releases
7270 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1" 9508 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
7271 IPADDR_IN_DISPLAY=yes 9509 IPADDR_IN_DISPLAY=yes
7272 $as_echo "#define USE_PIPES 1" >>confdefs.h 9510 cat >>confdefs.h <<\_ACEOF
9511#define USE_PIPES 1
9512_ACEOF
7273 9513
7274 9514
7275$as_echo "#define LOGIN_NO_ENDOPT 1" >>confdefs.h 9515cat >>confdefs.h <<\_ACEOF
9516#define LOGIN_NO_ENDOPT 1
9517_ACEOF
7276 9518
7277 $as_echo "#define LOGIN_NEEDS_UTMPX 1" >>confdefs.h 9519 cat >>confdefs.h <<\_ACEOF
9520#define LOGIN_NEEDS_UTMPX 1
9521_ACEOF
7278 9522
7279 9523
7280$as_echo "#define LOCKED_PASSWD_STRING \"*\"" >>confdefs.h 9524cat >>confdefs.h <<\_ACEOF
9525#define LOCKED_PASSWD_STRING "*"
9526_ACEOF
7281 9527
7282 $as_echo "#define SPT_TYPE SPT_PSTAT" >>confdefs.h 9528 cat >>confdefs.h <<\_ACEOF
9529#define SPT_TYPE SPT_PSTAT
9530_ACEOF
7283 9531
7284 9532
7285$as_echo "#define PLATFORM_SYS_DIR_UID 2" >>confdefs.h 9533cat >>confdefs.h <<\_ACEOF
9534#define PLATFORM_SYS_DIR_UID 2
9535_ACEOF
7286 9536
7287 maildir="/var/mail" 9537 maildir="/var/mail"
7288 LIBS="$LIBS -lsec" 9538 LIBS="$LIBS -lsec"
7289 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_error in -lxnet" >&5 9539
7290$as_echo_n "checking for t_error in -lxnet... " >&6; } 9540{ echo "$as_me:$LINENO: checking for t_error in -lxnet" >&5
7291if ${ac_cv_lib_xnet_t_error+:} false; then : 9541echo $ECHO_N "checking for t_error in -lxnet... $ECHO_C" >&6; }
7292 $as_echo_n "(cached) " >&6 9542if test "${ac_cv_lib_xnet_t_error+set}" = set; then
9543 echo $ECHO_N "(cached) $ECHO_C" >&6
7293else 9544else
7294 ac_check_lib_save_LIBS=$LIBS 9545 ac_check_lib_save_LIBS=$LIBS
7295LIBS="-lxnet $LIBS" 9546LIBS="-lxnet $LIBS"
7296cat confdefs.h - <<_ACEOF >conftest.$ac_ext 9547cat >conftest.$ac_ext <<_ACEOF
9548/* confdefs.h. */
9549_ACEOF
9550cat confdefs.h >>conftest.$ac_ext
9551cat >>conftest.$ac_ext <<_ACEOF
7297/* end confdefs.h. */ 9552/* end confdefs.h. */
7298 9553
7299/* Override any GCC internal prototype to avoid an error. 9554/* Override any GCC internal prototype to avoid an error.
@@ -7311,18 +9566,39 @@ return t_error ();
7311 return 0; 9566 return 0;
7312} 9567}
7313_ACEOF 9568_ACEOF
7314if ac_fn_c_try_link "$LINENO"; then : 9569rm -f conftest.$ac_objext conftest$ac_exeext
9570if { (ac_try="$ac_link"
9571case "(($ac_try" in
9572 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9573 *) ac_try_echo=$ac_try;;
9574esac
9575eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9576 (eval "$ac_link") 2>conftest.er1
9577 ac_status=$?
9578 grep -v '^ *+' conftest.er1 >conftest.err
9579 rm -f conftest.er1
9580 cat conftest.err >&5
9581 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9582 (exit $ac_status); } && {
9583 test -z "$ac_c_werror_flag" ||
9584 test ! -s conftest.err
9585 } && test -s conftest$ac_exeext &&
9586 $as_test_x conftest$ac_exeext; then
7315 ac_cv_lib_xnet_t_error=yes 9587 ac_cv_lib_xnet_t_error=yes
7316else 9588else
7317 ac_cv_lib_xnet_t_error=no 9589 echo "$as_me: failed program was:" >&5
9590sed 's/^/| /' conftest.$ac_ext >&5
9591
9592 ac_cv_lib_xnet_t_error=no
7318fi 9593fi
7319rm -f core conftest.err conftest.$ac_objext \ 9594
7320 conftest$ac_exeext conftest.$ac_ext 9595rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9596 conftest$ac_exeext conftest.$ac_ext
7321LIBS=$ac_check_lib_save_LIBS 9597LIBS=$ac_check_lib_save_LIBS
7322fi 9598fi
7323{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xnet_t_error" >&5 9599{ echo "$as_me:$LINENO: result: $ac_cv_lib_xnet_t_error" >&5
7324$as_echo "$ac_cv_lib_xnet_t_error" >&6; } 9600echo "${ECHO_T}$ac_cv_lib_xnet_t_error" >&6; }
7325if test "x$ac_cv_lib_xnet_t_error" = xyes; then : 9601if test $ac_cv_lib_xnet_t_error = yes; then
7326 cat >>confdefs.h <<_ACEOF 9602 cat >>confdefs.h <<_ACEOF
7327#define HAVE_LIBXNET 1 9603#define HAVE_LIBXNET 1
7328_ACEOF 9604_ACEOF
@@ -7330,7 +9606,9 @@ _ACEOF
7330 LIBS="-lxnet $LIBS" 9606 LIBS="-lxnet $LIBS"
7331 9607
7332else 9608else
7333 as_fn_error $? "*** -lxnet needed on HP-UX - check config.log ***" "$LINENO" 5 9609 { { echo "$as_me:$LINENO: error: *** -lxnet needed on HP-UX - check config.log ***" >&5
9610echo "$as_me: error: *** -lxnet needed on HP-UX - check config.log ***" >&2;}
9611 { (exit 1); exit 1; }; }
7334fi 9612fi
7335 9613
7336 9614
@@ -7343,13 +9621,19 @@ fi
7343 ;; 9621 ;;
7344 *-*-hpux11*) 9622 *-*-hpux11*)
7345 9623
7346$as_echo "#define PAM_SUN_CODEBASE 1" >>confdefs.h 9624cat >>confdefs.h <<\_ACEOF
9625#define PAM_SUN_CODEBASE 1
9626_ACEOF
7347 9627
7348 9628
7349$as_echo "#define DISABLE_UTMP 1" >>confdefs.h 9629cat >>confdefs.h <<\_ACEOF
9630#define DISABLE_UTMP 1
9631_ACEOF
7350 9632
7351 9633
7352$as_echo "#define USE_BTMP 1" >>confdefs.h 9634cat >>confdefs.h <<\_ACEOF
9635#define USE_BTMP 1
9636_ACEOF
7353 9637
7354 check_for_hpux_broken_getaddrinfo=1 9638 check_for_hpux_broken_getaddrinfo=1
7355 check_for_conflicting_getspnam=1 9639 check_for_conflicting_getspnam=1
@@ -7360,7 +9644,9 @@ $as_echo "#define USE_BTMP 1" >>confdefs.h
7360 case "$host" in 9644 case "$host" in
7361 *-*-hpux10.26) 9645 *-*-hpux10.26)
7362 9646
7363$as_echo "#define HAVE_SECUREWARE 1" >>confdefs.h 9647cat >>confdefs.h <<\_ACEOF
9648#define HAVE_SECUREWARE 1
9649_ACEOF
7364 9650
7365 disable_ptmx_check=yes 9651 disable_ptmx_check=yes
7366 LIBS="$LIBS -lsecpw" 9652 LIBS="$LIBS -lsecpw"
@@ -7370,67 +9656,191 @@ $as_echo "#define HAVE_SECUREWARE 1" >>confdefs.h
7370*-*-irix5*) 9656*-*-irix5*)
7371 PATH="$PATH:/usr/etc" 9657 PATH="$PATH:/usr/etc"
7372 9658
7373$as_echo "#define BROKEN_INET_NTOA 1" >>confdefs.h 9659cat >>confdefs.h <<\_ACEOF
9660#define BROKEN_INET_NTOA 1
9661_ACEOF
7374 9662
7375 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 9663 cat >>confdefs.h <<\_ACEOF
9664#define SETEUID_BREAKS_SETUID 1
9665_ACEOF
7376 9666
7377 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 9667 cat >>confdefs.h <<\_ACEOF
9668#define BROKEN_SETREUID 1
9669_ACEOF
7378 9670
7379 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 9671 cat >>confdefs.h <<\_ACEOF
9672#define BROKEN_SETREGID 1
9673_ACEOF
7380 9674
7381 9675
7382$as_echo "#define WITH_ABBREV_NO_TTY 1" >>confdefs.h 9676cat >>confdefs.h <<\_ACEOF
9677#define WITH_ABBREV_NO_TTY 1
9678_ACEOF
7383 9679
7384 $as_echo "#define LOCKED_PASSWD_STRING \"*LK*\"" >>confdefs.h 9680 cat >>confdefs.h <<\_ACEOF
9681#define LOCKED_PASSWD_STRING "*LK*"
9682_ACEOF
7385 9683
7386 ;; 9684 ;;
7387*-*-irix6*) 9685*-*-irix6*)
7388 PATH="$PATH:/usr/etc" 9686 PATH="$PATH:/usr/etc"
7389 9687
7390$as_echo "#define WITH_IRIX_ARRAY 1" >>confdefs.h 9688cat >>confdefs.h <<\_ACEOF
9689#define WITH_IRIX_ARRAY 1
9690_ACEOF
9691
9692
9693cat >>confdefs.h <<\_ACEOF
9694#define WITH_IRIX_PROJECT 1
9695_ACEOF
7391 9696
7392 9697
7393$as_echo "#define WITH_IRIX_PROJECT 1" >>confdefs.h 9698cat >>confdefs.h <<\_ACEOF
9699#define WITH_IRIX_AUDIT 1
9700_ACEOF
9701
9702 { echo "$as_me:$LINENO: checking for jlimit_startjob" >&5
9703echo $ECHO_N "checking for jlimit_startjob... $ECHO_C" >&6; }
9704if test "${ac_cv_func_jlimit_startjob+set}" = set; then
9705 echo $ECHO_N "(cached) $ECHO_C" >&6
9706else
9707 cat >conftest.$ac_ext <<_ACEOF
9708/* confdefs.h. */
9709_ACEOF
9710cat confdefs.h >>conftest.$ac_ext
9711cat >>conftest.$ac_ext <<_ACEOF
9712/* end confdefs.h. */
9713/* Define jlimit_startjob to an innocuous variant, in case <limits.h> declares jlimit_startjob.
9714 For example, HP-UX 11i <limits.h> declares gettimeofday. */
9715#define jlimit_startjob innocuous_jlimit_startjob
7394 9716
9717/* System header to define __stub macros and hopefully few prototypes,
9718 which can conflict with char jlimit_startjob (); below.
9719 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
9720 <limits.h> exists even on freestanding compilers. */
7395 9721
7396$as_echo "#define WITH_IRIX_AUDIT 1" >>confdefs.h 9722#ifdef __STDC__
9723# include <limits.h>
9724#else
9725# include <assert.h>
9726#endif
7397 9727
7398 ac_fn_c_check_func "$LINENO" "jlimit_startjob" "ac_cv_func_jlimit_startjob" 9728#undef jlimit_startjob
7399if test "x$ac_cv_func_jlimit_startjob" = xyes; then :
7400 9729
7401$as_echo "#define WITH_IRIX_JOBS 1" >>confdefs.h 9730/* Override any GCC internal prototype to avoid an error.
9731 Use char because int might match the return type of a GCC
9732 builtin and then its argument prototype would still apply. */
9733#ifdef __cplusplus
9734extern "C"
9735#endif
9736char jlimit_startjob ();
9737/* The GNU C library defines this for functions which it implements
9738 to always fail with ENOSYS. Some functions are actually named
9739 something starting with __ and the normal name is an alias. */
9740#if defined __stub_jlimit_startjob || defined __stub___jlimit_startjob
9741choke me
9742#endif
7402 9743
9744int
9745main ()
9746{
9747return jlimit_startjob ();
9748 ;
9749 return 0;
9750}
9751_ACEOF
9752rm -f conftest.$ac_objext conftest$ac_exeext
9753if { (ac_try="$ac_link"
9754case "(($ac_try" in
9755 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9756 *) ac_try_echo=$ac_try;;
9757esac
9758eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9759 (eval "$ac_link") 2>conftest.er1
9760 ac_status=$?
9761 grep -v '^ *+' conftest.er1 >conftest.err
9762 rm -f conftest.er1
9763 cat conftest.err >&5
9764 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9765 (exit $ac_status); } && {
9766 test -z "$ac_c_werror_flag" ||
9767 test ! -s conftest.err
9768 } && test -s conftest$ac_exeext &&
9769 $as_test_x conftest$ac_exeext; then
9770 ac_cv_func_jlimit_startjob=yes
9771else
9772 echo "$as_me: failed program was:" >&5
9773sed 's/^/| /' conftest.$ac_ext >&5
9774
9775 ac_cv_func_jlimit_startjob=no
7403fi 9776fi
7404 9777
7405 $as_echo "#define BROKEN_INET_NTOA 1" >>confdefs.h 9778rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9779 conftest$ac_exeext conftest.$ac_ext
9780fi
9781{ echo "$as_me:$LINENO: result: $ac_cv_func_jlimit_startjob" >&5
9782echo "${ECHO_T}$ac_cv_func_jlimit_startjob" >&6; }
9783if test $ac_cv_func_jlimit_startjob = yes; then
7406 9784
7407 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 9785cat >>confdefs.h <<\_ACEOF
9786#define WITH_IRIX_JOBS 1
9787_ACEOF
7408 9788
7409 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 9789fi
7410 9790
7411 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 9791 cat >>confdefs.h <<\_ACEOF
9792#define BROKEN_INET_NTOA 1
9793_ACEOF
7412 9794
9795 cat >>confdefs.h <<\_ACEOF
9796#define SETEUID_BREAKS_SETUID 1
9797_ACEOF
7413 9798
7414$as_echo "#define BROKEN_UPDWTMPX 1" >>confdefs.h 9799 cat >>confdefs.h <<\_ACEOF
9800#define BROKEN_SETREUID 1
9801_ACEOF
7415 9802
7416 $as_echo "#define WITH_ABBREV_NO_TTY 1" >>confdefs.h 9803 cat >>confdefs.h <<\_ACEOF
9804#define BROKEN_SETREGID 1
9805_ACEOF
7417 9806
7418 $as_echo "#define LOCKED_PASSWD_STRING \"*LK*\"" >>confdefs.h 9807
9808cat >>confdefs.h <<\_ACEOF
9809#define BROKEN_UPDWTMPX 1
9810_ACEOF
9811
9812 cat >>confdefs.h <<\_ACEOF
9813#define WITH_ABBREV_NO_TTY 1
9814_ACEOF
9815
9816 cat >>confdefs.h <<\_ACEOF
9817#define LOCKED_PASSWD_STRING "*LK*"
9818_ACEOF
7419 9819
7420 ;; 9820 ;;
7421*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu) 9821*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
7422 check_for_libcrypt_later=1 9822 check_for_libcrypt_later=1
7423 $as_echo "#define PAM_TTY_KLUDGE 1" >>confdefs.h 9823 cat >>confdefs.h <<\_ACEOF
9824#define PAM_TTY_KLUDGE 1
9825_ACEOF
7424 9826
7425 $as_echo "#define LOCKED_PASSWD_PREFIX \"!\"" >>confdefs.h 9827 cat >>confdefs.h <<\_ACEOF
9828#define LOCKED_PASSWD_PREFIX "!"
9829_ACEOF
7426 9830
7427 $as_echo "#define SPT_TYPE SPT_REUSEARGV" >>confdefs.h 9831 cat >>confdefs.h <<\_ACEOF
9832#define SPT_TYPE SPT_REUSEARGV
9833_ACEOF
7428 9834
7429 9835
7430$as_echo "#define _PATH_BTMP \"/var/log/btmp\"" >>confdefs.h 9836cat >>confdefs.h <<\_ACEOF
9837#define _PATH_BTMP "/var/log/btmp"
9838_ACEOF
7431 9839
7432 9840
7433$as_echo "#define USE_BTMP 1" >>confdefs.h 9841cat >>confdefs.h <<\_ACEOF
9842#define USE_BTMP 1
9843_ACEOF
7434 9844
7435 ;; 9845 ;;
7436*-*-linux*) 9846*-*-linux*)
@@ -7439,39 +9849,188 @@ $as_echo "#define USE_BTMP 1" >>confdefs.h
7439 check_for_libcrypt_later=1 9849 check_for_libcrypt_later=1
7440 check_for_openpty_ctty_bug=1 9850 check_for_openpty_ctty_bug=1
7441 9851
7442$as_echo "#define PAM_TTY_KLUDGE 1" >>confdefs.h 9852cat >>confdefs.h <<\_ACEOF
9853#define PAM_TTY_KLUDGE 1
9854_ACEOF
7443 9855
7444 9856
7445$as_echo "#define LOCKED_PASSWD_PREFIX \"!\"" >>confdefs.h 9857cat >>confdefs.h <<\_ACEOF
9858#define LOCKED_PASSWD_PREFIX "!"
9859_ACEOF
7446 9860
7447 $as_echo "#define SPT_TYPE SPT_REUSEARGV" >>confdefs.h 9861 cat >>confdefs.h <<\_ACEOF
9862#define SPT_TYPE SPT_REUSEARGV
9863_ACEOF
7448 9864
7449 9865
7450$as_echo "#define LINK_OPNOTSUPP_ERRNO EPERM" >>confdefs.h 9866cat >>confdefs.h <<\_ACEOF
9867#define LINK_OPNOTSUPP_ERRNO EPERM
9868_ACEOF
7451 9869
7452 9870
7453$as_echo "#define _PATH_BTMP \"/var/log/btmp\"" >>confdefs.h 9871cat >>confdefs.h <<\_ACEOF
9872#define _PATH_BTMP "/var/log/btmp"
9873_ACEOF
7454 9874
7455 $as_echo "#define USE_BTMP 1" >>confdefs.h 9875 cat >>confdefs.h <<\_ACEOF
9876#define USE_BTMP 1
9877_ACEOF
7456 9878
7457 9879
7458$as_echo "#define LINUX_OOM_ADJUST 1" >>confdefs.h 9880cat >>confdefs.h <<\_ACEOF
9881#define LINUX_OOM_ADJUST 1
9882_ACEOF
7459 9883
7460 inet6_default_4in6=yes 9884 inet6_default_4in6=yes
7461 case `uname -r` in 9885 case `uname -r` in
7462 1.*|2.0.*) 9886 1.*|2.0.*)
7463 9887
7464$as_echo "#define BROKEN_CMSG_TYPE 1" >>confdefs.h 9888cat >>confdefs.h <<\_ACEOF
9889#define BROKEN_CMSG_TYPE 1
9890_ACEOF
7465 9891
7466 ;; 9892 ;;
7467 esac 9893 esac
7468 # tun(4) forwarding compat code 9894 # tun(4) forwarding compat code
7469 for ac_header in linux/if_tun.h 9895
7470do : 9896for ac_header in linux/if_tun.h
7471 ac_fn_c_check_header_mongrel "$LINENO" "linux/if_tun.h" "ac_cv_header_linux_if_tun_h" "$ac_includes_default" 9897do
7472if test "x$ac_cv_header_linux_if_tun_h" = xyes; then : 9898as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
9899if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
9900 { echo "$as_me:$LINENO: checking for $ac_header" >&5
9901echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
9902if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
9903 echo $ECHO_N "(cached) $ECHO_C" >&6
9904fi
9905ac_res=`eval echo '${'$as_ac_Header'}'`
9906 { echo "$as_me:$LINENO: result: $ac_res" >&5
9907echo "${ECHO_T}$ac_res" >&6; }
9908else
9909 # Is the header compilable?
9910{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
9911echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
9912cat >conftest.$ac_ext <<_ACEOF
9913/* confdefs.h. */
9914_ACEOF
9915cat confdefs.h >>conftest.$ac_ext
9916cat >>conftest.$ac_ext <<_ACEOF
9917/* end confdefs.h. */
9918$ac_includes_default
9919#include <$ac_header>
9920_ACEOF
9921rm -f conftest.$ac_objext
9922if { (ac_try="$ac_compile"
9923case "(($ac_try" in
9924 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9925 *) ac_try_echo=$ac_try;;
9926esac
9927eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9928 (eval "$ac_compile") 2>conftest.er1
9929 ac_status=$?
9930 grep -v '^ *+' conftest.er1 >conftest.err
9931 rm -f conftest.er1
9932 cat conftest.err >&5
9933 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9934 (exit $ac_status); } && {
9935 test -z "$ac_c_werror_flag" ||
9936 test ! -s conftest.err
9937 } && test -s conftest.$ac_objext; then
9938 ac_header_compiler=yes
9939else
9940 echo "$as_me: failed program was:" >&5
9941sed 's/^/| /' conftest.$ac_ext >&5
9942
9943 ac_header_compiler=no
9944fi
9945
9946rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9947{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
9948echo "${ECHO_T}$ac_header_compiler" >&6; }
9949
9950# Is the header present?
9951{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
9952echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
9953cat >conftest.$ac_ext <<_ACEOF
9954/* confdefs.h. */
9955_ACEOF
9956cat confdefs.h >>conftest.$ac_ext
9957cat >>conftest.$ac_ext <<_ACEOF
9958/* end confdefs.h. */
9959#include <$ac_header>
9960_ACEOF
9961if { (ac_try="$ac_cpp conftest.$ac_ext"
9962case "(($ac_try" in
9963 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
9964 *) ac_try_echo=$ac_try;;
9965esac
9966eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
9967 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
9968 ac_status=$?
9969 grep -v '^ *+' conftest.er1 >conftest.err
9970 rm -f conftest.er1
9971 cat conftest.err >&5
9972 echo "$as_me:$LINENO: \$? = $ac_status" >&5
9973 (exit $ac_status); } >/dev/null && {
9974 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
9975 test ! -s conftest.err
9976 }; then
9977 ac_header_preproc=yes
9978else
9979 echo "$as_me: failed program was:" >&5
9980sed 's/^/| /' conftest.$ac_ext >&5
9981
9982 ac_header_preproc=no
9983fi
9984
9985rm -f conftest.err conftest.$ac_ext
9986{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
9987echo "${ECHO_T}$ac_header_preproc" >&6; }
9988
9989# So? What about this header?
9990case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
9991 yes:no: )
9992 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
9993echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
9994 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
9995echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
9996 ac_header_preproc=yes
9997 ;;
9998 no:yes:* )
9999 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
10000echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
10001 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
10002echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
10003 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
10004echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
10005 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
10006echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
10007 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
10008echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
10009 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
10010echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
10011 ( cat <<\_ASBOX
10012## ------------------------------------------- ##
10013## Report this to openssh-unix-dev@mindrot.org ##
10014## ------------------------------------------- ##
10015_ASBOX
10016 ) | sed "s/^/$as_me: WARNING: /" >&2
10017 ;;
10018esac
10019{ echo "$as_me:$LINENO: checking for $ac_header" >&5
10020echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
10021if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
10022 echo $ECHO_N "(cached) $ECHO_C" >&6
10023else
10024 eval "$as_ac_Header=\$ac_header_preproc"
10025fi
10026ac_res=`eval echo '${'$as_ac_Header'}'`
10027 { echo "$as_me:$LINENO: result: $ac_res" >&5
10028echo "${ECHO_T}$ac_res" >&6; }
10029
10030fi
10031if test `eval echo '${'$as_ac_Header'}'` = yes; then
7473 cat >>confdefs.h <<_ACEOF 10032 cat >>confdefs.h <<_ACEOF
7474#define HAVE_LINUX_IF_TUN_H 1 10033#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
7475_ACEOF 10034_ACEOF
7476 10035
7477fi 10036fi
@@ -7480,42 +10039,177 @@ done
7480 10039
7481 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then 10040 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
7482 10041
7483$as_echo "#define SSH_TUN_LINUX 1" >>confdefs.h 10042cat >>confdefs.h <<\_ACEOF
10043#define SSH_TUN_LINUX 1
10044_ACEOF
7484 10045
7485 10046
7486$as_echo "#define SSH_TUN_COMPAT_AF 1" >>confdefs.h 10047cat >>confdefs.h <<\_ACEOF
10048#define SSH_TUN_COMPAT_AF 1
10049_ACEOF
7487 10050
7488 10051
7489$as_echo "#define SSH_TUN_PREPEND_AF 1" >>confdefs.h 10052cat >>confdefs.h <<\_ACEOF
10053#define SSH_TUN_PREPEND_AF 1
10054_ACEOF
7490 10055
7491 fi 10056 fi
7492 for ac_header in linux/seccomp.h linux/filter.h linux/audit.h 10057
7493do : 10058
7494 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 10059
7495ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include <linux/types.h> 10060for ac_header in linux/seccomp.h linux/filter.h linux/audit.h
7496" 10061do
7497if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : 10062as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
10063{ echo "$as_me:$LINENO: checking for $ac_header" >&5
10064echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
10065if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
10066 echo $ECHO_N "(cached) $ECHO_C" >&6
10067else
10068 cat >conftest.$ac_ext <<_ACEOF
10069/* confdefs.h. */
10070_ACEOF
10071cat confdefs.h >>conftest.$ac_ext
10072cat >>conftest.$ac_ext <<_ACEOF
10073/* end confdefs.h. */
10074#include <linux/types.h>
10075
10076#include <$ac_header>
10077_ACEOF
10078rm -f conftest.$ac_objext
10079if { (ac_try="$ac_compile"
10080case "(($ac_try" in
10081 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10082 *) ac_try_echo=$ac_try;;
10083esac
10084eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
10085 (eval "$ac_compile") 2>conftest.er1
10086 ac_status=$?
10087 grep -v '^ *+' conftest.er1 >conftest.err
10088 rm -f conftest.er1
10089 cat conftest.err >&5
10090 echo "$as_me:$LINENO: \$? = $ac_status" >&5
10091 (exit $ac_status); } && {
10092 test -z "$ac_c_werror_flag" ||
10093 test ! -s conftest.err
10094 } && test -s conftest.$ac_objext; then
10095 eval "$as_ac_Header=yes"
10096else
10097 echo "$as_me: failed program was:" >&5
10098sed 's/^/| /' conftest.$ac_ext >&5
10099
10100 eval "$as_ac_Header=no"
10101fi
10102
10103rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10104fi
10105ac_res=`eval echo '${'$as_ac_Header'}'`
10106 { echo "$as_me:$LINENO: result: $ac_res" >&5
10107echo "${ECHO_T}$ac_res" >&6; }
10108if test `eval echo '${'$as_ac_Header'}'` = yes; then
7498 cat >>confdefs.h <<_ACEOF 10109 cat >>confdefs.h <<_ACEOF
7499#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 10110#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
7500_ACEOF 10111_ACEOF
7501 10112
7502fi 10113fi
7503 10114
7504done 10115done
7505 10116
7506 for ac_func in prctl 10117
7507do : 10118for ac_func in prctl
7508 ac_fn_c_check_func "$LINENO" "prctl" "ac_cv_func_prctl" 10119do
7509if test "x$ac_cv_func_prctl" = xyes; then : 10120as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10121{ echo "$as_me:$LINENO: checking for $ac_func" >&5
10122echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
10123if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
10124 echo $ECHO_N "(cached) $ECHO_C" >&6
10125else
10126 cat >conftest.$ac_ext <<_ACEOF
10127/* confdefs.h. */
10128_ACEOF
10129cat confdefs.h >>conftest.$ac_ext
10130cat >>conftest.$ac_ext <<_ACEOF
10131/* end confdefs.h. */
10132/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
10133 For example, HP-UX 11i <limits.h> declares gettimeofday. */
10134#define $ac_func innocuous_$ac_func
10135
10136/* System header to define __stub macros and hopefully few prototypes,
10137 which can conflict with char $ac_func (); below.
10138 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
10139 <limits.h> exists even on freestanding compilers. */
10140
10141#ifdef __STDC__
10142# include <limits.h>
10143#else
10144# include <assert.h>
10145#endif
10146
10147#undef $ac_func
10148
10149/* Override any GCC internal prototype to avoid an error.
10150 Use char because int might match the return type of a GCC
10151 builtin and then its argument prototype would still apply. */
10152#ifdef __cplusplus
10153extern "C"
10154#endif
10155char $ac_func ();
10156/* The GNU C library defines this for functions which it implements
10157 to always fail with ENOSYS. Some functions are actually named
10158 something starting with __ and the normal name is an alias. */
10159#if defined __stub_$ac_func || defined __stub___$ac_func
10160choke me
10161#endif
10162
10163int
10164main ()
10165{
10166return $ac_func ();
10167 ;
10168 return 0;
10169}
10170_ACEOF
10171rm -f conftest.$ac_objext conftest$ac_exeext
10172if { (ac_try="$ac_link"
10173case "(($ac_try" in
10174 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10175 *) ac_try_echo=$ac_try;;
10176esac
10177eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
10178 (eval "$ac_link") 2>conftest.er1
10179 ac_status=$?
10180 grep -v '^ *+' conftest.er1 >conftest.err
10181 rm -f conftest.er1
10182 cat conftest.err >&5
10183 echo "$as_me:$LINENO: \$? = $ac_status" >&5
10184 (exit $ac_status); } && {
10185 test -z "$ac_c_werror_flag" ||
10186 test ! -s conftest.err
10187 } && test -s conftest$ac_exeext &&
10188 $as_test_x conftest$ac_exeext; then
10189 eval "$as_ac_var=yes"
10190else
10191 echo "$as_me: failed program was:" >&5
10192sed 's/^/| /' conftest.$ac_ext >&5
10193
10194 eval "$as_ac_var=no"
10195fi
10196
10197rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10198 conftest$ac_exeext conftest.$ac_ext
10199fi
10200ac_res=`eval echo '${'$as_ac_var'}'`
10201 { echo "$as_me:$LINENO: result: $ac_res" >&5
10202echo "${ECHO_T}$ac_res" >&6; }
10203if test `eval echo '${'$as_ac_var'}'` = yes; then
7510 cat >>confdefs.h <<_ACEOF 10204 cat >>confdefs.h <<_ACEOF
7511#define HAVE_PRCTL 1 10205#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
7512_ACEOF 10206_ACEOF
7513 10207
7514fi 10208fi
7515done 10209done
7516 10210
7517 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for seccomp architecture" >&5 10211 { echo "$as_me:$LINENO: checking for seccomp architecture" >&5
7518$as_echo_n "checking for seccomp architecture... " >&6; } 10212echo $ECHO_N "checking for seccomp architecture... $ECHO_C" >&6; }
7519 seccomp_audit_arch= 10213 seccomp_audit_arch=
7520 case "$host" in 10214 case "$host" in
7521 x86_64-*) 10215 x86_64-*)
@@ -7529,21 +10223,23 @@ $as_echo_n "checking for seccomp architecture... " >&6; }
7529 ;; 10223 ;;
7530 esac 10224 esac
7531 if test "x$seccomp_audit_arch" != "x" ; then 10225 if test "x$seccomp_audit_arch" != "x" ; then
7532 { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$seccomp_audit_arch\"" >&5 10226 { echo "$as_me:$LINENO: result: \"$seccomp_audit_arch\"" >&5
7533$as_echo "\"$seccomp_audit_arch\"" >&6; } 10227echo "${ECHO_T}\"$seccomp_audit_arch\"" >&6; }
7534 10228
7535cat >>confdefs.h <<_ACEOF 10229cat >>confdefs.h <<_ACEOF
7536#define SECCOMP_AUDIT_ARCH $seccomp_audit_arch 10230#define SECCOMP_AUDIT_ARCH $seccomp_audit_arch
7537_ACEOF 10231_ACEOF
7538 10232
7539 else 10233 else
7540 { $as_echo "$as_me:${as_lineno-$LINENO}: result: architecture not supported" >&5 10234 { echo "$as_me:$LINENO: result: architecture not supported" >&5
7541$as_echo "architecture not supported" >&6; } 10235echo "${ECHO_T}architecture not supported" >&6; }
7542 fi 10236 fi
7543 ;; 10237 ;;
7544mips-sony-bsd|mips-sony-newsos4) 10238mips-sony-bsd|mips-sony-newsos4)
7545 10239
7546$as_echo "#define NEED_SETPGRP 1" >>confdefs.h 10240cat >>confdefs.h <<\_ACEOF
10241#define NEED_SETPGRP 1
10242_ACEOF
7547 10243
7548 SONY=1 10244 SONY=1
7549 ;; 10245 ;;
@@ -7553,66 +10249,352 @@ $as_echo "#define NEED_SETPGRP 1" >>confdefs.h
7553 need_dash_r=1 10249 need_dash_r=1
7554 fi 10250 fi
7555 10251
7556$as_echo "#define SSH_TUN_FREEBSD 1" >>confdefs.h 10252cat >>confdefs.h <<\_ACEOF
10253#define SSH_TUN_FREEBSD 1
10254_ACEOF
10255
10256 if test "${ac_cv_header_net_if_tap_h+set}" = set; then
10257 { echo "$as_me:$LINENO: checking for net/if_tap.h" >&5
10258echo $ECHO_N "checking for net/if_tap.h... $ECHO_C" >&6; }
10259if test "${ac_cv_header_net_if_tap_h+set}" = set; then
10260 echo $ECHO_N "(cached) $ECHO_C" >&6
10261fi
10262{ echo "$as_me:$LINENO: result: $ac_cv_header_net_if_tap_h" >&5
10263echo "${ECHO_T}$ac_cv_header_net_if_tap_h" >&6; }
10264else
10265 # Is the header compilable?
10266{ echo "$as_me:$LINENO: checking net/if_tap.h usability" >&5
10267echo $ECHO_N "checking net/if_tap.h usability... $ECHO_C" >&6; }
10268cat >conftest.$ac_ext <<_ACEOF
10269/* confdefs.h. */
10270_ACEOF
10271cat confdefs.h >>conftest.$ac_ext
10272cat >>conftest.$ac_ext <<_ACEOF
10273/* end confdefs.h. */
10274$ac_includes_default
10275#include <net/if_tap.h>
10276_ACEOF
10277rm -f conftest.$ac_objext
10278if { (ac_try="$ac_compile"
10279case "(($ac_try" in
10280 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10281 *) ac_try_echo=$ac_try;;
10282esac
10283eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
10284 (eval "$ac_compile") 2>conftest.er1
10285 ac_status=$?
10286 grep -v '^ *+' conftest.er1 >conftest.err
10287 rm -f conftest.er1
10288 cat conftest.err >&5
10289 echo "$as_me:$LINENO: \$? = $ac_status" >&5
10290 (exit $ac_status); } && {
10291 test -z "$ac_c_werror_flag" ||
10292 test ! -s conftest.err
10293 } && test -s conftest.$ac_objext; then
10294 ac_header_compiler=yes
10295else
10296 echo "$as_me: failed program was:" >&5
10297sed 's/^/| /' conftest.$ac_ext >&5
10298
10299 ac_header_compiler=no
10300fi
10301
10302rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10303{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
10304echo "${ECHO_T}$ac_header_compiler" >&6; }
10305
10306# Is the header present?
10307{ echo "$as_me:$LINENO: checking net/if_tap.h presence" >&5
10308echo $ECHO_N "checking net/if_tap.h presence... $ECHO_C" >&6; }
10309cat >conftest.$ac_ext <<_ACEOF
10310/* confdefs.h. */
10311_ACEOF
10312cat confdefs.h >>conftest.$ac_ext
10313cat >>conftest.$ac_ext <<_ACEOF
10314/* end confdefs.h. */
10315#include <net/if_tap.h>
10316_ACEOF
10317if { (ac_try="$ac_cpp conftest.$ac_ext"
10318case "(($ac_try" in
10319 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10320 *) ac_try_echo=$ac_try;;
10321esac
10322eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
10323 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
10324 ac_status=$?
10325 grep -v '^ *+' conftest.er1 >conftest.err
10326 rm -f conftest.er1
10327 cat conftest.err >&5
10328 echo "$as_me:$LINENO: \$? = $ac_status" >&5
10329 (exit $ac_status); } >/dev/null && {
10330 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
10331 test ! -s conftest.err
10332 }; then
10333 ac_header_preproc=yes
10334else
10335 echo "$as_me: failed program was:" >&5
10336sed 's/^/| /' conftest.$ac_ext >&5
10337
10338 ac_header_preproc=no
10339fi
10340
10341rm -f conftest.err conftest.$ac_ext
10342{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
10343echo "${ECHO_T}$ac_header_preproc" >&6; }
7557 10344
7558 ac_fn_c_check_header_mongrel "$LINENO" "net/if_tap.h" "ac_cv_header_net_if_tap_h" "$ac_includes_default" 10345# So? What about this header?
7559if test "x$ac_cv_header_net_if_tap_h" = xyes; then : 10346case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
10347 yes:no: )
10348 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: accepted by the compiler, rejected by the preprocessor!" >&5
10349echo "$as_me: WARNING: net/if_tap.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
10350 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: proceeding with the compiler's result" >&5
10351echo "$as_me: WARNING: net/if_tap.h: proceeding with the compiler's result" >&2;}
10352 ac_header_preproc=yes
10353 ;;
10354 no:yes:* )
10355 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: present but cannot be compiled" >&5
10356echo "$as_me: WARNING: net/if_tap.h: present but cannot be compiled" >&2;}
10357 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: check for missing prerequisite headers?" >&5
10358echo "$as_me: WARNING: net/if_tap.h: check for missing prerequisite headers?" >&2;}
10359 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: see the Autoconf documentation" >&5
10360echo "$as_me: WARNING: net/if_tap.h: see the Autoconf documentation" >&2;}
10361 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: section \"Present But Cannot Be Compiled\"" >&5
10362echo "$as_me: WARNING: net/if_tap.h: section \"Present But Cannot Be Compiled\"" >&2;}
10363 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: proceeding with the preprocessor's result" >&5
10364echo "$as_me: WARNING: net/if_tap.h: proceeding with the preprocessor's result" >&2;}
10365 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: in the future, the compiler will take precedence" >&5
10366echo "$as_me: WARNING: net/if_tap.h: in the future, the compiler will take precedence" >&2;}
10367 ( cat <<\_ASBOX
10368## ------------------------------------------- ##
10369## Report this to openssh-unix-dev@mindrot.org ##
10370## ------------------------------------------- ##
10371_ASBOX
10372 ) | sed "s/^/$as_me: WARNING: /" >&2
10373 ;;
10374esac
10375{ echo "$as_me:$LINENO: checking for net/if_tap.h" >&5
10376echo $ECHO_N "checking for net/if_tap.h... $ECHO_C" >&6; }
10377if test "${ac_cv_header_net_if_tap_h+set}" = set; then
10378 echo $ECHO_N "(cached) $ECHO_C" >&6
10379else
10380 ac_cv_header_net_if_tap_h=$ac_header_preproc
10381fi
10382{ echo "$as_me:$LINENO: result: $ac_cv_header_net_if_tap_h" >&5
10383echo "${ECHO_T}$ac_cv_header_net_if_tap_h" >&6; }
7560 10384
10385fi
10386if test $ac_cv_header_net_if_tap_h = yes; then
10387 :
7561else 10388else
7562 10389
7563$as_echo "#define SSH_TUN_NO_L2 1" >>confdefs.h 10390cat >>confdefs.h <<\_ACEOF
10391#define SSH_TUN_NO_L2 1
10392_ACEOF
7564 10393
7565fi 10394fi
7566 10395
7567 10396
7568 10397
7569$as_echo "#define SSH_TUN_PREPEND_AF 1" >>confdefs.h 10398cat >>confdefs.h <<\_ACEOF
10399#define SSH_TUN_PREPEND_AF 1
10400_ACEOF
7570 10401
7571 TEST_MALLOC_OPTIONS="AJRX" 10402 TEST_MALLOC_OPTIONS="AJRX"
7572 10403
7573$as_echo "#define BROKEN_STRNVIS 1" >>confdefs.h 10404cat >>confdefs.h <<\_ACEOF
10405#define BROKEN_STRNVIS 1
10406_ACEOF
7574 10407
7575 10408
7576$as_echo "#define BROKEN_READ_COMPARISON 1" >>confdefs.h 10409cat >>confdefs.h <<\_ACEOF
10410#define BROKEN_READ_COMPARISON 1
10411_ACEOF
7577 10412
7578 ;; 10413 ;;
7579*-*-freebsd*) 10414*-*-freebsd*)
7580 check_for_libcrypt_later=1 10415 check_for_libcrypt_later=1
7581 10416
7582$as_echo "#define LOCKED_PASSWD_PREFIX \"*LOCKED*\"" >>confdefs.h 10417cat >>confdefs.h <<\_ACEOF
10418#define LOCKED_PASSWD_PREFIX "*LOCKED*"
10419_ACEOF
10420
10421
10422cat >>confdefs.h <<\_ACEOF
10423#define SSH_TUN_FREEBSD 1
10424_ACEOF
10425
10426 if test "${ac_cv_header_net_if_tap_h+set}" = set; then
10427 { echo "$as_me:$LINENO: checking for net/if_tap.h" >&5
10428echo $ECHO_N "checking for net/if_tap.h... $ECHO_C" >&6; }
10429if test "${ac_cv_header_net_if_tap_h+set}" = set; then
10430 echo $ECHO_N "(cached) $ECHO_C" >&6
10431fi
10432{ echo "$as_me:$LINENO: result: $ac_cv_header_net_if_tap_h" >&5
10433echo "${ECHO_T}$ac_cv_header_net_if_tap_h" >&6; }
10434else
10435 # Is the header compilable?
10436{ echo "$as_me:$LINENO: checking net/if_tap.h usability" >&5
10437echo $ECHO_N "checking net/if_tap.h usability... $ECHO_C" >&6; }
10438cat >conftest.$ac_ext <<_ACEOF
10439/* confdefs.h. */
10440_ACEOF
10441cat confdefs.h >>conftest.$ac_ext
10442cat >>conftest.$ac_ext <<_ACEOF
10443/* end confdefs.h. */
10444$ac_includes_default
10445#include <net/if_tap.h>
10446_ACEOF
10447rm -f conftest.$ac_objext
10448if { (ac_try="$ac_compile"
10449case "(($ac_try" in
10450 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10451 *) ac_try_echo=$ac_try;;
10452esac
10453eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
10454 (eval "$ac_compile") 2>conftest.er1
10455 ac_status=$?
10456 grep -v '^ *+' conftest.er1 >conftest.err
10457 rm -f conftest.er1
10458 cat conftest.err >&5
10459 echo "$as_me:$LINENO: \$? = $ac_status" >&5
10460 (exit $ac_status); } && {
10461 test -z "$ac_c_werror_flag" ||
10462 test ! -s conftest.err
10463 } && test -s conftest.$ac_objext; then
10464 ac_header_compiler=yes
10465else
10466 echo "$as_me: failed program was:" >&5
10467sed 's/^/| /' conftest.$ac_ext >&5
10468
10469 ac_header_compiler=no
10470fi
10471
10472rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10473{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
10474echo "${ECHO_T}$ac_header_compiler" >&6; }
7583 10475
10476# Is the header present?
10477{ echo "$as_me:$LINENO: checking net/if_tap.h presence" >&5
10478echo $ECHO_N "checking net/if_tap.h presence... $ECHO_C" >&6; }
10479cat >conftest.$ac_ext <<_ACEOF
10480/* confdefs.h. */
10481_ACEOF
10482cat confdefs.h >>conftest.$ac_ext
10483cat >>conftest.$ac_ext <<_ACEOF
10484/* end confdefs.h. */
10485#include <net/if_tap.h>
10486_ACEOF
10487if { (ac_try="$ac_cpp conftest.$ac_ext"
10488case "(($ac_try" in
10489 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10490 *) ac_try_echo=$ac_try;;
10491esac
10492eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
10493 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
10494 ac_status=$?
10495 grep -v '^ *+' conftest.er1 >conftest.err
10496 rm -f conftest.er1
10497 cat conftest.err >&5
10498 echo "$as_me:$LINENO: \$? = $ac_status" >&5
10499 (exit $ac_status); } >/dev/null && {
10500 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
10501 test ! -s conftest.err
10502 }; then
10503 ac_header_preproc=yes
10504else
10505 echo "$as_me: failed program was:" >&5
10506sed 's/^/| /' conftest.$ac_ext >&5
7584 10507
7585$as_echo "#define SSH_TUN_FREEBSD 1" >>confdefs.h 10508 ac_header_preproc=no
10509fi
7586 10510
7587 ac_fn_c_check_header_mongrel "$LINENO" "net/if_tap.h" "ac_cv_header_net_if_tap_h" "$ac_includes_default" 10511rm -f conftest.err conftest.$ac_ext
7588if test "x$ac_cv_header_net_if_tap_h" = xyes; then : 10512{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
10513echo "${ECHO_T}$ac_header_preproc" >&6; }
7589 10514
10515# So? What about this header?
10516case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
10517 yes:no: )
10518 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: accepted by the compiler, rejected by the preprocessor!" >&5
10519echo "$as_me: WARNING: net/if_tap.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
10520 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: proceeding with the compiler's result" >&5
10521echo "$as_me: WARNING: net/if_tap.h: proceeding with the compiler's result" >&2;}
10522 ac_header_preproc=yes
10523 ;;
10524 no:yes:* )
10525 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: present but cannot be compiled" >&5
10526echo "$as_me: WARNING: net/if_tap.h: present but cannot be compiled" >&2;}
10527 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: check for missing prerequisite headers?" >&5
10528echo "$as_me: WARNING: net/if_tap.h: check for missing prerequisite headers?" >&2;}
10529 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: see the Autoconf documentation" >&5
10530echo "$as_me: WARNING: net/if_tap.h: see the Autoconf documentation" >&2;}
10531 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: section \"Present But Cannot Be Compiled\"" >&5
10532echo "$as_me: WARNING: net/if_tap.h: section \"Present But Cannot Be Compiled\"" >&2;}
10533 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: proceeding with the preprocessor's result" >&5
10534echo "$as_me: WARNING: net/if_tap.h: proceeding with the preprocessor's result" >&2;}
10535 { echo "$as_me:$LINENO: WARNING: net/if_tap.h: in the future, the compiler will take precedence" >&5
10536echo "$as_me: WARNING: net/if_tap.h: in the future, the compiler will take precedence" >&2;}
10537 ( cat <<\_ASBOX
10538## ------------------------------------------- ##
10539## Report this to openssh-unix-dev@mindrot.org ##
10540## ------------------------------------------- ##
10541_ASBOX
10542 ) | sed "s/^/$as_me: WARNING: /" >&2
10543 ;;
10544esac
10545{ echo "$as_me:$LINENO: checking for net/if_tap.h" >&5
10546echo $ECHO_N "checking for net/if_tap.h... $ECHO_C" >&6; }
10547if test "${ac_cv_header_net_if_tap_h+set}" = set; then
10548 echo $ECHO_N "(cached) $ECHO_C" >&6
7590else 10549else
10550 ac_cv_header_net_if_tap_h=$ac_header_preproc
10551fi
10552{ echo "$as_me:$LINENO: result: $ac_cv_header_net_if_tap_h" >&5
10553echo "${ECHO_T}$ac_cv_header_net_if_tap_h" >&6; }
7591 10554
7592$as_echo "#define SSH_TUN_NO_L2 1" >>confdefs.h 10555fi
10556if test $ac_cv_header_net_if_tap_h = yes; then
10557 :
10558else
10559
10560cat >>confdefs.h <<\_ACEOF
10561#define SSH_TUN_NO_L2 1
10562_ACEOF
7593 10563
7594fi 10564fi
7595 10565
7596 10566
7597 10567
7598$as_echo "#define BROKEN_GLOB 1" >>confdefs.h 10568cat >>confdefs.h <<\_ACEOF
10569#define BROKEN_GLOB 1
10570_ACEOF
7599 10571
7600 10572
7601$as_echo "#define BROKEN_STRNVIS 1" >>confdefs.h 10573cat >>confdefs.h <<\_ACEOF
10574#define BROKEN_STRNVIS 1
10575_ACEOF
7602 10576
7603 TEST_MALLOC_OPTIONS="AJRX" 10577 TEST_MALLOC_OPTIONS="AJRX"
7604 # Preauth crypto occasionally uses file descriptors for crypto offload 10578 # Preauth crypto occasionally uses file descriptors for crypto offload
7605 # and will crash if they cannot be opened. 10579 # and will crash if they cannot be opened.
7606 10580
7607$as_echo "#define SANDBOX_SKIP_RLIMIT_NOFILE 1" >>confdefs.h 10581cat >>confdefs.h <<\_ACEOF
10582#define SANDBOX_SKIP_RLIMIT_NOFILE 1
10583_ACEOF
7608 10584
7609 ;; 10585 ;;
7610*-*-bsdi*) 10586*-*-bsdi*)
7611 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 10587 cat >>confdefs.h <<\_ACEOF
10588#define SETEUID_BREAKS_SETUID 1
10589_ACEOF
7612 10590
7613 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 10591 cat >>confdefs.h <<\_ACEOF
10592#define BROKEN_SETREUID 1
10593_ACEOF
7614 10594
7615 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 10595 cat >>confdefs.h <<\_ACEOF
10596#define BROKEN_SETREGID 1
10597_ACEOF
7616 10598
7617 ;; 10599 ;;
7618*-next-*) 10600*-next-*)
@@ -7621,29 +10603,45 @@ $as_echo "#define SANDBOX_SKIP_RLIMIT_NOFILE 1" >>confdefs.h
7621 conf_wtmp_location=/usr/adm/wtmp 10603 conf_wtmp_location=/usr/adm/wtmp
7622 maildir=/usr/spool/mail 10604 maildir=/usr/spool/mail
7623 10605
7624$as_echo "#define HAVE_NEXT 1" >>confdefs.h 10606cat >>confdefs.h <<\_ACEOF
10607#define HAVE_NEXT 1
10608_ACEOF
7625 10609
7626 $as_echo "#define BROKEN_REALPATH 1" >>confdefs.h 10610 cat >>confdefs.h <<\_ACEOF
10611#define BROKEN_REALPATH 1
10612_ACEOF
7627 10613
7628 $as_echo "#define USE_PIPES 1" >>confdefs.h 10614 cat >>confdefs.h <<\_ACEOF
10615#define USE_PIPES 1
10616_ACEOF
7629 10617
7630 10618
7631$as_echo "#define BROKEN_SAVED_UIDS 1" >>confdefs.h 10619cat >>confdefs.h <<\_ACEOF
10620#define BROKEN_SAVED_UIDS 1
10621_ACEOF
7632 10622
7633 ;; 10623 ;;
7634*-*-openbsd*) 10624*-*-openbsd*)
7635 use_pie=auto 10625 use_pie=auto
7636 10626
7637$as_echo "#define HAVE_ATTRIBUTE__SENTINEL__ 1" >>confdefs.h 10627cat >>confdefs.h <<\_ACEOF
10628#define HAVE_ATTRIBUTE__SENTINEL__ 1
10629_ACEOF
7638 10630
7639 10631
7640$as_echo "#define HAVE_ATTRIBUTE__BOUNDED__ 1" >>confdefs.h 10632cat >>confdefs.h <<\_ACEOF
10633#define HAVE_ATTRIBUTE__BOUNDED__ 1
10634_ACEOF
7641 10635
7642 10636
7643$as_echo "#define SSH_TUN_OPENBSD 1" >>confdefs.h 10637cat >>confdefs.h <<\_ACEOF
10638#define SSH_TUN_OPENBSD 1
10639_ACEOF
7644 10640
7645 10641
7646$as_echo "#define SYSLOG_R_SAFE_IN_SIGHAND 1" >>confdefs.h 10642cat >>confdefs.h <<\_ACEOF
10643#define SYSLOG_R_SAFE_IN_SIGHAND 1
10644_ACEOF
7647 10645
7648 TEST_MALLOC_OPTIONS="AFGJPRX" 10646 TEST_MALLOC_OPTIONS="AFGJPRX"
7649 ;; 10647 ;;
@@ -7651,60 +10649,86 @@ $as_echo "#define SYSLOG_R_SAFE_IN_SIGHAND 1" >>confdefs.h
7651 if test "x$withval" != "xno" ; then 10649 if test "x$withval" != "xno" ; then
7652 need_dash_r=1 10650 need_dash_r=1
7653 fi 10651 fi
7654 $as_echo "#define PAM_SUN_CODEBASE 1" >>confdefs.h 10652 cat >>confdefs.h <<\_ACEOF
10653#define PAM_SUN_CODEBASE 1
10654_ACEOF
7655 10655
7656 $as_echo "#define LOGIN_NEEDS_UTMPX 1" >>confdefs.h 10656 cat >>confdefs.h <<\_ACEOF
10657#define LOGIN_NEEDS_UTMPX 1
10658_ACEOF
7657 10659
7658 10660
7659$as_echo "#define LOGIN_NEEDS_TERM 1" >>confdefs.h 10661cat >>confdefs.h <<\_ACEOF
10662#define LOGIN_NEEDS_TERM 1
10663_ACEOF
7660 10664
7661 $as_echo "#define PAM_TTY_KLUDGE 1" >>confdefs.h 10665 cat >>confdefs.h <<\_ACEOF
10666#define PAM_TTY_KLUDGE 1
10667_ACEOF
7662 10668
7663 10669
7664$as_echo "#define SSHPAM_CHAUTHTOK_NEEDS_RUID 1" >>confdefs.h 10670cat >>confdefs.h <<\_ACEOF
10671#define SSHPAM_CHAUTHTOK_NEEDS_RUID 1
10672_ACEOF
7665 10673
7666 $as_echo "#define LOCKED_PASSWD_STRING \"*LK*\"" >>confdefs.h 10674 cat >>confdefs.h <<\_ACEOF
10675#define LOCKED_PASSWD_STRING "*LK*"
10676_ACEOF
7667 10677
7668 # Pushing STREAMS modules will cause sshd to acquire a controlling tty. 10678 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
7669 10679
7670$as_echo "#define SSHD_ACQUIRES_CTTY 1" >>confdefs.h 10680cat >>confdefs.h <<\_ACEOF
10681#define SSHD_ACQUIRES_CTTY 1
10682_ACEOF
7671 10683
7672 10684
7673$as_echo "#define PASSWD_NEEDS_USERNAME 1" >>confdefs.h 10685cat >>confdefs.h <<\_ACEOF
10686#define PASSWD_NEEDS_USERNAME 1
10687_ACEOF
7674 10688
7675 10689
7676$as_echo "#define BROKEN_TCGETATTR_ICANON 1" >>confdefs.h 10690cat >>confdefs.h <<\_ACEOF
10691#define BROKEN_TCGETATTR_ICANON 1
10692_ACEOF
7677 10693
7678 external_path_file=/etc/default/login 10694 external_path_file=/etc/default/login
7679 # hardwire lastlog location (can't detect it on some versions) 10695 # hardwire lastlog location (can't detect it on some versions)
7680 conf_lastlog_location="/var/adm/lastlog" 10696 conf_lastlog_location="/var/adm/lastlog"
7681 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for obsolete utmp and wtmp in solaris2.x" >&5 10697 { echo "$as_me:$LINENO: checking for obsolete utmp and wtmp in solaris2.x" >&5
7682$as_echo_n "checking for obsolete utmp and wtmp in solaris2.x... " >&6; } 10698echo $ECHO_N "checking for obsolete utmp and wtmp in solaris2.x... $ECHO_C" >&6; }
7683 sol2ver=`echo "$host"| sed -e 's/.*[0-9]\.//'` 10699 sol2ver=`echo "$host"| sed -e 's/.*[0-9]\.//'`
7684 if test "$sol2ver" -ge 8; then 10700 if test "$sol2ver" -ge 8; then
7685 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 10701 { echo "$as_me:$LINENO: result: yes" >&5
7686$as_echo "yes" >&6; } 10702echo "${ECHO_T}yes" >&6; }
7687 $as_echo "#define DISABLE_UTMP 1" >>confdefs.h 10703 cat >>confdefs.h <<\_ACEOF
10704#define DISABLE_UTMP 1
10705_ACEOF
7688 10706
7689 10707
7690$as_echo "#define DISABLE_WTMP 1" >>confdefs.h 10708cat >>confdefs.h <<\_ACEOF
10709#define DISABLE_WTMP 1
10710_ACEOF
7691 10711
7692 else 10712 else
7693 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 10713 { echo "$as_me:$LINENO: result: no" >&5
7694$as_echo "no" >&6; } 10714echo "${ECHO_T}no" >&6; }
7695 fi 10715 fi
7696 10716
7697# Check whether --with-solaris-contracts was given. 10717# Check whether --with-solaris-contracts was given.
7698if test "${with_solaris_contracts+set}" = set; then : 10718if test "${with_solaris_contracts+set}" = set; then
7699 withval=$with_solaris_contracts; 10719 withval=$with_solaris_contracts;
7700 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ct_tmpl_activate in -lcontract" >&5 10720 { echo "$as_me:$LINENO: checking for ct_tmpl_activate in -lcontract" >&5
7701$as_echo_n "checking for ct_tmpl_activate in -lcontract... " >&6; } 10721echo $ECHO_N "checking for ct_tmpl_activate in -lcontract... $ECHO_C" >&6; }
7702if ${ac_cv_lib_contract_ct_tmpl_activate+:} false; then : 10722if test "${ac_cv_lib_contract_ct_tmpl_activate+set}" = set; then
7703 $as_echo_n "(cached) " >&6 10723 echo $ECHO_N "(cached) $ECHO_C" >&6
7704else 10724else
7705 ac_check_lib_save_LIBS=$LIBS 10725 ac_check_lib_save_LIBS=$LIBS
7706LIBS="-lcontract $LIBS" 10726LIBS="-lcontract $LIBS"
7707cat confdefs.h - <<_ACEOF >conftest.$ac_ext 10727cat >conftest.$ac_ext <<_ACEOF
10728/* confdefs.h. */
10729_ACEOF
10730cat confdefs.h >>conftest.$ac_ext
10731cat >>conftest.$ac_ext <<_ACEOF
7708/* end confdefs.h. */ 10732/* end confdefs.h. */
7709 10733
7710/* Override any GCC internal prototype to avoid an error. 10734/* Override any GCC internal prototype to avoid an error.
@@ -7722,20 +10746,43 @@ return ct_tmpl_activate ();
7722 return 0; 10746 return 0;
7723} 10747}
7724_ACEOF 10748_ACEOF
7725if ac_fn_c_try_link "$LINENO"; then : 10749rm -f conftest.$ac_objext conftest$ac_exeext
10750if { (ac_try="$ac_link"
10751case "(($ac_try" in
10752 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10753 *) ac_try_echo=$ac_try;;
10754esac
10755eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
10756 (eval "$ac_link") 2>conftest.er1
10757 ac_status=$?
10758 grep -v '^ *+' conftest.er1 >conftest.err
10759 rm -f conftest.er1
10760 cat conftest.err >&5
10761 echo "$as_me:$LINENO: \$? = $ac_status" >&5
10762 (exit $ac_status); } && {
10763 test -z "$ac_c_werror_flag" ||
10764 test ! -s conftest.err
10765 } && test -s conftest$ac_exeext &&
10766 $as_test_x conftest$ac_exeext; then
7726 ac_cv_lib_contract_ct_tmpl_activate=yes 10767 ac_cv_lib_contract_ct_tmpl_activate=yes
7727else 10768else
7728 ac_cv_lib_contract_ct_tmpl_activate=no 10769 echo "$as_me: failed program was:" >&5
10770sed 's/^/| /' conftest.$ac_ext >&5
10771
10772 ac_cv_lib_contract_ct_tmpl_activate=no
7729fi 10773fi
7730rm -f core conftest.err conftest.$ac_objext \ 10774
7731 conftest$ac_exeext conftest.$ac_ext 10775rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10776 conftest$ac_exeext conftest.$ac_ext
7732LIBS=$ac_check_lib_save_LIBS 10777LIBS=$ac_check_lib_save_LIBS
7733fi 10778fi
7734{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_contract_ct_tmpl_activate" >&5 10779{ echo "$as_me:$LINENO: result: $ac_cv_lib_contract_ct_tmpl_activate" >&5
7735$as_echo "$ac_cv_lib_contract_ct_tmpl_activate" >&6; } 10780echo "${ECHO_T}$ac_cv_lib_contract_ct_tmpl_activate" >&6; }
7736if test "x$ac_cv_lib_contract_ct_tmpl_activate" = xyes; then : 10781if test $ac_cv_lib_contract_ct_tmpl_activate = yes; then
7737 10782
7738$as_echo "#define USE_SOLARIS_PROCESS_CONTRACTS 1" >>confdefs.h 10783cat >>confdefs.h <<\_ACEOF
10784#define USE_SOLARIS_PROCESS_CONTRACTS 1
10785_ACEOF
7739 10786
7740 SSHDLIBS="$SSHDLIBS -lcontract" 10787 SSHDLIBS="$SSHDLIBS -lcontract"
7741 SPC_MSG="yes" 10788 SPC_MSG="yes"
@@ -7746,16 +10793,20 @@ fi
7746 10793
7747 10794
7748# Check whether --with-solaris-projects was given. 10795# Check whether --with-solaris-projects was given.
7749if test "${with_solaris_projects+set}" = set; then : 10796if test "${with_solaris_projects+set}" = set; then
7750 withval=$with_solaris_projects; 10797 withval=$with_solaris_projects;
7751 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setproject in -lproject" >&5 10798 { echo "$as_me:$LINENO: checking for setproject in -lproject" >&5
7752$as_echo_n "checking for setproject in -lproject... " >&6; } 10799echo $ECHO_N "checking for setproject in -lproject... $ECHO_C" >&6; }
7753if ${ac_cv_lib_project_setproject+:} false; then : 10800if test "${ac_cv_lib_project_setproject+set}" = set; then
7754 $as_echo_n "(cached) " >&6 10801 echo $ECHO_N "(cached) $ECHO_C" >&6
7755else 10802else
7756 ac_check_lib_save_LIBS=$LIBS 10803 ac_check_lib_save_LIBS=$LIBS
7757LIBS="-lproject $LIBS" 10804LIBS="-lproject $LIBS"
7758cat confdefs.h - <<_ACEOF >conftest.$ac_ext 10805cat >conftest.$ac_ext <<_ACEOF
10806/* confdefs.h. */
10807_ACEOF
10808cat confdefs.h >>conftest.$ac_ext
10809cat >>conftest.$ac_ext <<_ACEOF
7759/* end confdefs.h. */ 10810/* end confdefs.h. */
7760 10811
7761/* Override any GCC internal prototype to avoid an error. 10812/* Override any GCC internal prototype to avoid an error.
@@ -7773,20 +10824,43 @@ return setproject ();
7773 return 0; 10824 return 0;
7774} 10825}
7775_ACEOF 10826_ACEOF
7776if ac_fn_c_try_link "$LINENO"; then : 10827rm -f conftest.$ac_objext conftest$ac_exeext
10828if { (ac_try="$ac_link"
10829case "(($ac_try" in
10830 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10831 *) ac_try_echo=$ac_try;;
10832esac
10833eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
10834 (eval "$ac_link") 2>conftest.er1
10835 ac_status=$?
10836 grep -v '^ *+' conftest.er1 >conftest.err
10837 rm -f conftest.er1
10838 cat conftest.err >&5
10839 echo "$as_me:$LINENO: \$? = $ac_status" >&5
10840 (exit $ac_status); } && {
10841 test -z "$ac_c_werror_flag" ||
10842 test ! -s conftest.err
10843 } && test -s conftest$ac_exeext &&
10844 $as_test_x conftest$ac_exeext; then
7777 ac_cv_lib_project_setproject=yes 10845 ac_cv_lib_project_setproject=yes
7778else 10846else
7779 ac_cv_lib_project_setproject=no 10847 echo "$as_me: failed program was:" >&5
10848sed 's/^/| /' conftest.$ac_ext >&5
10849
10850 ac_cv_lib_project_setproject=no
7780fi 10851fi
7781rm -f core conftest.err conftest.$ac_objext \ 10852
7782 conftest$ac_exeext conftest.$ac_ext 10853rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10854 conftest$ac_exeext conftest.$ac_ext
7783LIBS=$ac_check_lib_save_LIBS 10855LIBS=$ac_check_lib_save_LIBS
7784fi 10856fi
7785{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_project_setproject" >&5 10857{ echo "$as_me:$LINENO: result: $ac_cv_lib_project_setproject" >&5
7786$as_echo "$ac_cv_lib_project_setproject" >&6; } 10858echo "${ECHO_T}$ac_cv_lib_project_setproject" >&6; }
7787if test "x$ac_cv_lib_project_setproject" = xyes; then : 10859if test $ac_cv_lib_project_setproject = yes; then
7788 10860
7789$as_echo "#define USE_SOLARIS_PROJECTS 1" >>confdefs.h 10861cat >>confdefs.h <<\_ACEOF
10862#define USE_SOLARIS_PROJECTS 1
10863_ACEOF
7790 10864
7791 SSHDLIBS="$SSHDLIBS -lproject" 10865 SSHDLIBS="$SSHDLIBS -lproject"
7792 SP_MSG="yes" 10866 SP_MSG="yes"
@@ -7799,48 +10873,150 @@ fi
7799 ;; 10873 ;;
7800*-*-sunos4*) 10874*-*-sunos4*)
7801 CPPFLAGS="$CPPFLAGS -DSUNOS4" 10875 CPPFLAGS="$CPPFLAGS -DSUNOS4"
7802 for ac_func in getpwanam 10876
7803do : 10877for ac_func in getpwanam
7804 ac_fn_c_check_func "$LINENO" "getpwanam" "ac_cv_func_getpwanam" 10878do
7805if test "x$ac_cv_func_getpwanam" = xyes; then : 10879as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10880{ echo "$as_me:$LINENO: checking for $ac_func" >&5
10881echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
10882if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
10883 echo $ECHO_N "(cached) $ECHO_C" >&6
10884else
10885 cat >conftest.$ac_ext <<_ACEOF
10886/* confdefs.h. */
10887_ACEOF
10888cat confdefs.h >>conftest.$ac_ext
10889cat >>conftest.$ac_ext <<_ACEOF
10890/* end confdefs.h. */
10891/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
10892 For example, HP-UX 11i <limits.h> declares gettimeofday. */
10893#define $ac_func innocuous_$ac_func
10894
10895/* System header to define __stub macros and hopefully few prototypes,
10896 which can conflict with char $ac_func (); below.
10897 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
10898 <limits.h> exists even on freestanding compilers. */
10899
10900#ifdef __STDC__
10901# include <limits.h>
10902#else
10903# include <assert.h>
10904#endif
10905
10906#undef $ac_func
10907
10908/* Override any GCC internal prototype to avoid an error.
10909 Use char because int might match the return type of a GCC
10910 builtin and then its argument prototype would still apply. */
10911#ifdef __cplusplus
10912extern "C"
10913#endif
10914char $ac_func ();
10915/* The GNU C library defines this for functions which it implements
10916 to always fail with ENOSYS. Some functions are actually named
10917 something starting with __ and the normal name is an alias. */
10918#if defined __stub_$ac_func || defined __stub___$ac_func
10919choke me
10920#endif
10921
10922int
10923main ()
10924{
10925return $ac_func ();
10926 ;
10927 return 0;
10928}
10929_ACEOF
10930rm -f conftest.$ac_objext conftest$ac_exeext
10931if { (ac_try="$ac_link"
10932case "(($ac_try" in
10933 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
10934 *) ac_try_echo=$ac_try;;
10935esac
10936eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
10937 (eval "$ac_link") 2>conftest.er1
10938 ac_status=$?
10939 grep -v '^ *+' conftest.er1 >conftest.err
10940 rm -f conftest.er1
10941 cat conftest.err >&5
10942 echo "$as_me:$LINENO: \$? = $ac_status" >&5
10943 (exit $ac_status); } && {
10944 test -z "$ac_c_werror_flag" ||
10945 test ! -s conftest.err
10946 } && test -s conftest$ac_exeext &&
10947 $as_test_x conftest$ac_exeext; then
10948 eval "$as_ac_var=yes"
10949else
10950 echo "$as_me: failed program was:" >&5
10951sed 's/^/| /' conftest.$ac_ext >&5
10952
10953 eval "$as_ac_var=no"
10954fi
10955
10956rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10957 conftest$ac_exeext conftest.$ac_ext
10958fi
10959ac_res=`eval echo '${'$as_ac_var'}'`
10960 { echo "$as_me:$LINENO: result: $ac_res" >&5
10961echo "${ECHO_T}$ac_res" >&6; }
10962if test `eval echo '${'$as_ac_var'}'` = yes; then
7806 cat >>confdefs.h <<_ACEOF 10963 cat >>confdefs.h <<_ACEOF
7807#define HAVE_GETPWANAM 1 10964#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
7808_ACEOF 10965_ACEOF
7809 10966
7810fi 10967fi
7811done 10968done
7812 10969
7813 $as_echo "#define PAM_SUN_CODEBASE 1" >>confdefs.h 10970 cat >>confdefs.h <<\_ACEOF
10971#define PAM_SUN_CODEBASE 1
10972_ACEOF
7814 10973
7815 conf_utmp_location=/etc/utmp 10974 conf_utmp_location=/etc/utmp
7816 conf_wtmp_location=/var/adm/wtmp 10975 conf_wtmp_location=/var/adm/wtmp
7817 conf_lastlog_location=/var/adm/lastlog 10976 conf_lastlog_location=/var/adm/lastlog
7818 $as_echo "#define USE_PIPES 1" >>confdefs.h 10977 cat >>confdefs.h <<\_ACEOF
10978#define USE_PIPES 1
10979_ACEOF
7819 10980
7820 ;; 10981 ;;
7821*-ncr-sysv*) 10982*-ncr-sysv*)
7822 LIBS="$LIBS -lc89" 10983 LIBS="$LIBS -lc89"
7823 $as_echo "#define USE_PIPES 1" >>confdefs.h 10984 cat >>confdefs.h <<\_ACEOF
10985#define USE_PIPES 1
10986_ACEOF
7824 10987
7825 $as_echo "#define SSHD_ACQUIRES_CTTY 1" >>confdefs.h 10988 cat >>confdefs.h <<\_ACEOF
10989#define SSHD_ACQUIRES_CTTY 1
10990_ACEOF
7826 10991
7827 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 10992 cat >>confdefs.h <<\_ACEOF
10993#define SETEUID_BREAKS_SETUID 1
10994_ACEOF
7828 10995
7829 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 10996 cat >>confdefs.h <<\_ACEOF
10997#define BROKEN_SETREUID 1
10998_ACEOF
7830 10999
7831 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11000 cat >>confdefs.h <<\_ACEOF
11001#define BROKEN_SETREGID 1
11002_ACEOF
7832 11003
7833 ;; 11004 ;;
7834*-sni-sysv*) 11005*-sni-sysv*)
7835 # /usr/ucblib MUST NOT be searched on ReliantUNIX 11006 # /usr/ucblib MUST NOT be searched on ReliantUNIX
7836 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5 11007
7837$as_echo_n "checking for dlsym in -ldl... " >&6; } 11008{ echo "$as_me:$LINENO: checking for dlsym in -ldl" >&5
7838if ${ac_cv_lib_dl_dlsym+:} false; then : 11009echo $ECHO_N "checking for dlsym in -ldl... $ECHO_C" >&6; }
7839 $as_echo_n "(cached) " >&6 11010if test "${ac_cv_lib_dl_dlsym+set}" = set; then
11011 echo $ECHO_N "(cached) $ECHO_C" >&6
7840else 11012else
7841 ac_check_lib_save_LIBS=$LIBS 11013 ac_check_lib_save_LIBS=$LIBS
7842LIBS="-ldl $LIBS" 11014LIBS="-ldl $LIBS"
7843cat confdefs.h - <<_ACEOF >conftest.$ac_ext 11015cat >conftest.$ac_ext <<_ACEOF
11016/* confdefs.h. */
11017_ACEOF
11018cat confdefs.h >>conftest.$ac_ext
11019cat >>conftest.$ac_ext <<_ACEOF
7844/* end confdefs.h. */ 11020/* end confdefs.h. */
7845 11021
7846/* Override any GCC internal prototype to avoid an error. 11022/* Override any GCC internal prototype to avoid an error.
@@ -7858,18 +11034,39 @@ return dlsym ();
7858 return 0; 11034 return 0;
7859} 11035}
7860_ACEOF 11036_ACEOF
7861if ac_fn_c_try_link "$LINENO"; then : 11037rm -f conftest.$ac_objext conftest$ac_exeext
11038if { (ac_try="$ac_link"
11039case "(($ac_try" in
11040 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11041 *) ac_try_echo=$ac_try;;
11042esac
11043eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11044 (eval "$ac_link") 2>conftest.er1
11045 ac_status=$?
11046 grep -v '^ *+' conftest.er1 >conftest.err
11047 rm -f conftest.er1
11048 cat conftest.err >&5
11049 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11050 (exit $ac_status); } && {
11051 test -z "$ac_c_werror_flag" ||
11052 test ! -s conftest.err
11053 } && test -s conftest$ac_exeext &&
11054 $as_test_x conftest$ac_exeext; then
7862 ac_cv_lib_dl_dlsym=yes 11055 ac_cv_lib_dl_dlsym=yes
7863else 11056else
7864 ac_cv_lib_dl_dlsym=no 11057 echo "$as_me: failed program was:" >&5
11058sed 's/^/| /' conftest.$ac_ext >&5
11059
11060 ac_cv_lib_dl_dlsym=no
7865fi 11061fi
7866rm -f core conftest.err conftest.$ac_objext \ 11062
7867 conftest$ac_exeext conftest.$ac_ext 11063rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11064 conftest$ac_exeext conftest.$ac_ext
7868LIBS=$ac_check_lib_save_LIBS 11065LIBS=$ac_check_lib_save_LIBS
7869fi 11066fi
7870{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlsym" >&5 11067{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlsym" >&5
7871$as_echo "$ac_cv_lib_dl_dlsym" >&6; } 11068echo "${ECHO_T}$ac_cv_lib_dl_dlsym" >&6; }
7872if test "x$ac_cv_lib_dl_dlsym" = xyes; then : 11069if test $ac_cv_lib_dl_dlsym = yes; then
7873 cat >>confdefs.h <<_ACEOF 11070 cat >>confdefs.h <<_ACEOF
7874#define HAVE_LIBDL 1 11071#define HAVE_LIBDL 1
7875_ACEOF 11072_ACEOF
@@ -7879,14 +11076,18 @@ _ACEOF
7879fi 11076fi
7880 11077
7881 # -lresolv needs to be at the end of LIBS or DNS lookups break 11078 # -lresolv needs to be at the end of LIBS or DNS lookups break
7882 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_query in -lresolv" >&5 11079 { echo "$as_me:$LINENO: checking for res_query in -lresolv" >&5
7883$as_echo_n "checking for res_query in -lresolv... " >&6; } 11080echo $ECHO_N "checking for res_query in -lresolv... $ECHO_C" >&6; }
7884if ${ac_cv_lib_resolv_res_query+:} false; then : 11081if test "${ac_cv_lib_resolv_res_query+set}" = set; then
7885 $as_echo_n "(cached) " >&6 11082 echo $ECHO_N "(cached) $ECHO_C" >&6
7886else 11083else
7887 ac_check_lib_save_LIBS=$LIBS 11084 ac_check_lib_save_LIBS=$LIBS
7888LIBS="-lresolv $LIBS" 11085LIBS="-lresolv $LIBS"
7889cat confdefs.h - <<_ACEOF >conftest.$ac_ext 11086cat >conftest.$ac_ext <<_ACEOF
11087/* confdefs.h. */
11088_ACEOF
11089cat confdefs.h >>conftest.$ac_ext
11090cat >>conftest.$ac_ext <<_ACEOF
7890/* end confdefs.h. */ 11091/* end confdefs.h. */
7891 11092
7892/* Override any GCC internal prototype to avoid an error. 11093/* Override any GCC internal prototype to avoid an error.
@@ -7904,33 +11105,66 @@ return res_query ();
7904 return 0; 11105 return 0;
7905} 11106}
7906_ACEOF 11107_ACEOF
7907if ac_fn_c_try_link "$LINENO"; then : 11108rm -f conftest.$ac_objext conftest$ac_exeext
11109if { (ac_try="$ac_link"
11110case "(($ac_try" in
11111 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11112 *) ac_try_echo=$ac_try;;
11113esac
11114eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11115 (eval "$ac_link") 2>conftest.er1
11116 ac_status=$?
11117 grep -v '^ *+' conftest.er1 >conftest.err
11118 rm -f conftest.er1
11119 cat conftest.err >&5
11120 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11121 (exit $ac_status); } && {
11122 test -z "$ac_c_werror_flag" ||
11123 test ! -s conftest.err
11124 } && test -s conftest$ac_exeext &&
11125 $as_test_x conftest$ac_exeext; then
7908 ac_cv_lib_resolv_res_query=yes 11126 ac_cv_lib_resolv_res_query=yes
7909else 11127else
7910 ac_cv_lib_resolv_res_query=no 11128 echo "$as_me: failed program was:" >&5
11129sed 's/^/| /' conftest.$ac_ext >&5
11130
11131 ac_cv_lib_resolv_res_query=no
7911fi 11132fi
7912rm -f core conftest.err conftest.$ac_objext \ 11133
7913 conftest$ac_exeext conftest.$ac_ext 11134rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11135 conftest$ac_exeext conftest.$ac_ext
7914LIBS=$ac_check_lib_save_LIBS 11136LIBS=$ac_check_lib_save_LIBS
7915fi 11137fi
7916{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_query" >&5 11138{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_query" >&5
7917$as_echo "$ac_cv_lib_resolv_res_query" >&6; } 11139echo "${ECHO_T}$ac_cv_lib_resolv_res_query" >&6; }
7918if test "x$ac_cv_lib_resolv_res_query" = xyes; then : 11140if test $ac_cv_lib_resolv_res_query = yes; then
7919 LIBS="$LIBS -lresolv" 11141 LIBS="$LIBS -lresolv"
7920fi 11142fi
7921 11143
7922 IPADDR_IN_DISPLAY=yes 11144 IPADDR_IN_DISPLAY=yes
7923 $as_echo "#define USE_PIPES 1" >>confdefs.h 11145 cat >>confdefs.h <<\_ACEOF
11146#define USE_PIPES 1
11147_ACEOF
7924 11148
7925 $as_echo "#define IP_TOS_IS_BROKEN 1" >>confdefs.h 11149 cat >>confdefs.h <<\_ACEOF
11150#define IP_TOS_IS_BROKEN 1
11151_ACEOF
7926 11152
7927 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11153 cat >>confdefs.h <<\_ACEOF
11154#define SETEUID_BREAKS_SETUID 1
11155_ACEOF
7928 11156
7929 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11157 cat >>confdefs.h <<\_ACEOF
11158#define BROKEN_SETREUID 1
11159_ACEOF
7930 11160
7931 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11161 cat >>confdefs.h <<\_ACEOF
11162#define BROKEN_SETREGID 1
11163_ACEOF
7932 11164
7933 $as_echo "#define SSHD_ACQUIRES_CTTY 1" >>confdefs.h 11165 cat >>confdefs.h <<\_ACEOF
11166#define SSHD_ACQUIRES_CTTY 1
11167_ACEOF
7934 11168
7935 external_path_file=/etc/default/login 11169 external_path_file=/etc/default/login
7936 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX 11170 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
@@ -7939,18 +11173,30 @@ fi
7939 ;; 11173 ;;
7940# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel. 11174# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
7941*-*-sysv4.2*) 11175*-*-sysv4.2*)
7942 $as_echo "#define USE_PIPES 1" >>confdefs.h 11176 cat >>confdefs.h <<\_ACEOF
11177#define USE_PIPES 1
11178_ACEOF
7943 11179
7944 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11180 cat >>confdefs.h <<\_ACEOF
11181#define SETEUID_BREAKS_SETUID 1
11182_ACEOF
7945 11183
7946 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11184 cat >>confdefs.h <<\_ACEOF
11185#define BROKEN_SETREUID 1
11186_ACEOF
7947 11187
7948 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11188 cat >>confdefs.h <<\_ACEOF
11189#define BROKEN_SETREGID 1
11190_ACEOF
7949 11191
7950 11192
7951$as_echo "#define PASSWD_NEEDS_USERNAME 1" >>confdefs.h 11193cat >>confdefs.h <<\_ACEOF
11194#define PASSWD_NEEDS_USERNAME 1
11195_ACEOF
7952 11196
7953 $as_echo "#define LOCKED_PASSWD_STRING \"*LK*\"" >>confdefs.h 11197 cat >>confdefs.h <<\_ACEOF
11198#define LOCKED_PASSWD_STRING "*LK*"
11199_ACEOF
7954 11200
7955 TEST_SHELL=$SHELL # let configure find us a capable shell 11201 TEST_SHELL=$SHELL # let configure find us a capable shell
7956 ;; 11202 ;;
@@ -7958,37 +11204,59 @@ $as_echo "#define PASSWD_NEEDS_USERNAME 1" >>confdefs.h
7958*-*-sysv5*) 11204*-*-sysv5*)
7959 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf" 11205 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
7960 11206
7961$as_echo "#define UNIXWARE_LONG_PASSWORDS 1" >>confdefs.h 11207cat >>confdefs.h <<\_ACEOF
11208#define UNIXWARE_LONG_PASSWORDS 1
11209_ACEOF
7962 11210
7963 $as_echo "#define USE_PIPES 1" >>confdefs.h 11211 cat >>confdefs.h <<\_ACEOF
11212#define USE_PIPES 1
11213_ACEOF
7964 11214
7965 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11215 cat >>confdefs.h <<\_ACEOF
11216#define SETEUID_BREAKS_SETUID 1
11217_ACEOF
7966 11218
7967 $as_echo "#define BROKEN_GETADDRINFO 1" >>confdefs.h 11219 cat >>confdefs.h <<\_ACEOF
11220#define BROKEN_GETADDRINFO 1
11221_ACEOF
7968 11222
7969 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11223 cat >>confdefs.h <<\_ACEOF
11224#define BROKEN_SETREUID 1
11225_ACEOF
7970 11226
7971 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11227 cat >>confdefs.h <<\_ACEOF
11228#define BROKEN_SETREGID 1
11229_ACEOF
7972 11230
7973 $as_echo "#define PASSWD_NEEDS_USERNAME 1" >>confdefs.h 11231 cat >>confdefs.h <<\_ACEOF
11232#define PASSWD_NEEDS_USERNAME 1
11233_ACEOF
7974 11234
7975 TEST_SHELL=$SHELL # let configure find us a capable shell 11235 TEST_SHELL=$SHELL # let configure find us a capable shell
7976 case "$host" in 11236 case "$host" in
7977 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x 11237 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
7978 maildir=/var/spool/mail 11238 maildir=/var/spool/mail
7979 11239
7980$as_echo "#define BROKEN_LIBIAF 1" >>confdefs.h 11240cat >>confdefs.h <<\_ACEOF
11241#define BROKEN_LIBIAF 1
11242_ACEOF
7981 11243
7982 $as_echo "#define BROKEN_UPDWTMPX 1" >>confdefs.h 11244 cat >>confdefs.h <<\_ACEOF
11245#define BROKEN_UPDWTMPX 1
11246_ACEOF
7983 11247
7984 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getluid in -lprot" >&5 11248 { echo "$as_me:$LINENO: checking for getluid in -lprot" >&5
7985$as_echo_n "checking for getluid in -lprot... " >&6; } 11249echo $ECHO_N "checking for getluid in -lprot... $ECHO_C" >&6; }
7986if ${ac_cv_lib_prot_getluid+:} false; then : 11250if test "${ac_cv_lib_prot_getluid+set}" = set; then
7987 $as_echo_n "(cached) " >&6 11251 echo $ECHO_N "(cached) $ECHO_C" >&6
7988else 11252else
7989 ac_check_lib_save_LIBS=$LIBS 11253 ac_check_lib_save_LIBS=$LIBS
7990LIBS="-lprot $LIBS" 11254LIBS="-lprot $LIBS"
7991cat confdefs.h - <<_ACEOF >conftest.$ac_ext 11255cat >conftest.$ac_ext <<_ACEOF
11256/* confdefs.h. */
11257_ACEOF
11258cat confdefs.h >>conftest.$ac_ext
11259cat >>conftest.$ac_ext <<_ACEOF
7992/* end confdefs.h. */ 11260/* end confdefs.h. */
7993 11261
7994/* Override any GCC internal prototype to avoid an error. 11262/* Override any GCC internal prototype to avoid an error.
@@ -8006,40 +11274,150 @@ return getluid ();
8006 return 0; 11274 return 0;
8007} 11275}
8008_ACEOF 11276_ACEOF
8009if ac_fn_c_try_link "$LINENO"; then : 11277rm -f conftest.$ac_objext conftest$ac_exeext
11278if { (ac_try="$ac_link"
11279case "(($ac_try" in
11280 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11281 *) ac_try_echo=$ac_try;;
11282esac
11283eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11284 (eval "$ac_link") 2>conftest.er1
11285 ac_status=$?
11286 grep -v '^ *+' conftest.er1 >conftest.err
11287 rm -f conftest.er1
11288 cat conftest.err >&5
11289 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11290 (exit $ac_status); } && {
11291 test -z "$ac_c_werror_flag" ||
11292 test ! -s conftest.err
11293 } && test -s conftest$ac_exeext &&
11294 $as_test_x conftest$ac_exeext; then
8010 ac_cv_lib_prot_getluid=yes 11295 ac_cv_lib_prot_getluid=yes
8011else 11296else
8012 ac_cv_lib_prot_getluid=no 11297 echo "$as_me: failed program was:" >&5
11298sed 's/^/| /' conftest.$ac_ext >&5
11299
11300 ac_cv_lib_prot_getluid=no
8013fi 11301fi
8014rm -f core conftest.err conftest.$ac_objext \ 11302
8015 conftest$ac_exeext conftest.$ac_ext 11303rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11304 conftest$ac_exeext conftest.$ac_ext
8016LIBS=$ac_check_lib_save_LIBS 11305LIBS=$ac_check_lib_save_LIBS
8017fi 11306fi
8018{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_prot_getluid" >&5 11307{ echo "$as_me:$LINENO: result: $ac_cv_lib_prot_getluid" >&5
8019$as_echo "$ac_cv_lib_prot_getluid" >&6; } 11308echo "${ECHO_T}$ac_cv_lib_prot_getluid" >&6; }
8020if test "x$ac_cv_lib_prot_getluid" = xyes; then : 11309if test $ac_cv_lib_prot_getluid = yes; then
8021 LIBS="$LIBS -lprot" 11310 LIBS="$LIBS -lprot"
8022 for ac_func in getluid setluid 11311
8023do : 11312
8024 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 11313for ac_func in getluid setluid
8025ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 11314do
8026if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 11315as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
11316{ echo "$as_me:$LINENO: checking for $ac_func" >&5
11317echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
11318if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
11319 echo $ECHO_N "(cached) $ECHO_C" >&6
11320else
11321 cat >conftest.$ac_ext <<_ACEOF
11322/* confdefs.h. */
11323_ACEOF
11324cat confdefs.h >>conftest.$ac_ext
11325cat >>conftest.$ac_ext <<_ACEOF
11326/* end confdefs.h. */
11327/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
11328 For example, HP-UX 11i <limits.h> declares gettimeofday. */
11329#define $ac_func innocuous_$ac_func
11330
11331/* System header to define __stub macros and hopefully few prototypes,
11332 which can conflict with char $ac_func (); below.
11333 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
11334 <limits.h> exists even on freestanding compilers. */
11335
11336#ifdef __STDC__
11337# include <limits.h>
11338#else
11339# include <assert.h>
11340#endif
11341
11342#undef $ac_func
11343
11344/* Override any GCC internal prototype to avoid an error.
11345 Use char because int might match the return type of a GCC
11346 builtin and then its argument prototype would still apply. */
11347#ifdef __cplusplus
11348extern "C"
11349#endif
11350char $ac_func ();
11351/* The GNU C library defines this for functions which it implements
11352 to always fail with ENOSYS. Some functions are actually named
11353 something starting with __ and the normal name is an alias. */
11354#if defined __stub_$ac_func || defined __stub___$ac_func
11355choke me
11356#endif
11357
11358int
11359main ()
11360{
11361return $ac_func ();
11362 ;
11363 return 0;
11364}
11365_ACEOF
11366rm -f conftest.$ac_objext conftest$ac_exeext
11367if { (ac_try="$ac_link"
11368case "(($ac_try" in
11369 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11370 *) ac_try_echo=$ac_try;;
11371esac
11372eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11373 (eval "$ac_link") 2>conftest.er1
11374 ac_status=$?
11375 grep -v '^ *+' conftest.er1 >conftest.err
11376 rm -f conftest.er1
11377 cat conftest.err >&5
11378 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11379 (exit $ac_status); } && {
11380 test -z "$ac_c_werror_flag" ||
11381 test ! -s conftest.err
11382 } && test -s conftest$ac_exeext &&
11383 $as_test_x conftest$ac_exeext; then
11384 eval "$as_ac_var=yes"
11385else
11386 echo "$as_me: failed program was:" >&5
11387sed 's/^/| /' conftest.$ac_ext >&5
11388
11389 eval "$as_ac_var=no"
11390fi
11391
11392rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11393 conftest$ac_exeext conftest.$ac_ext
11394fi
11395ac_res=`eval echo '${'$as_ac_var'}'`
11396 { echo "$as_me:$LINENO: result: $ac_res" >&5
11397echo "${ECHO_T}$ac_res" >&6; }
11398if test `eval echo '${'$as_ac_var'}'` = yes; then
8027 cat >>confdefs.h <<_ACEOF 11399 cat >>confdefs.h <<_ACEOF
8028#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 11400#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
8029_ACEOF 11401_ACEOF
8030 11402
8031fi 11403fi
8032done 11404done
8033 11405
8034 $as_echo "#define HAVE_SECUREWARE 1" >>confdefs.h 11406 cat >>confdefs.h <<\_ACEOF
11407#define HAVE_SECUREWARE 1
11408_ACEOF
8035 11409
8036 $as_echo "#define DISABLE_SHADOW 1" >>confdefs.h 11410 cat >>confdefs.h <<\_ACEOF
11411#define DISABLE_SHADOW 1
11412_ACEOF
8037 11413
8038 11414
8039fi 11415fi
8040 11416
8041 ;; 11417 ;;
8042 *) $as_echo "#define LOCKED_PASSWD_STRING \"*LK*\"" >>confdefs.h 11418 *) cat >>confdefs.h <<\_ACEOF
11419#define LOCKED_PASSWD_STRING "*LK*"
11420_ACEOF
8043 11421
8044 check_for_libcrypt_later=1 11422 check_for_libcrypt_later=1
8045 ;; 11423 ;;
@@ -8049,7 +11427,9 @@ fi
8049 ;; 11427 ;;
8050# SCO UNIX and OEM versions of SCO UNIX 11428# SCO UNIX and OEM versions of SCO UNIX
8051*-*-sco3.2v4*) 11429*-*-sco3.2v4*)
8052 as_fn_error $? "\"This Platform is no longer supported.\"" "$LINENO" 5 11430 { { echo "$as_me:$LINENO: error: \"This Platform is no longer supported.\"" >&5
11431echo "$as_me: error: \"This Platform is no longer supported.\"" >&2;}
11432 { (exit 1); exit 1; }; }
8053 ;; 11433 ;;
8054# SCO OpenServer 5.x 11434# SCO OpenServer 5.x
8055*-*-sco3.2v5*) 11435*-*-sco3.2v5*)
@@ -8058,35 +11438,140 @@ fi
8058 fi 11438 fi
8059 LIBS="$LIBS -lprot -lx -ltinfo -lm" 11439 LIBS="$LIBS -lprot -lx -ltinfo -lm"
8060 no_dev_ptmx=1 11440 no_dev_ptmx=1
8061 $as_echo "#define USE_PIPES 1" >>confdefs.h 11441 cat >>confdefs.h <<\_ACEOF
11442#define USE_PIPES 1
11443_ACEOF
11444
11445 cat >>confdefs.h <<\_ACEOF
11446#define HAVE_SECUREWARE 1
11447_ACEOF
11448
11449 cat >>confdefs.h <<\_ACEOF
11450#define DISABLE_SHADOW 1
11451_ACEOF
11452
11453 cat >>confdefs.h <<\_ACEOF
11454#define DISABLE_FD_PASSING 1
11455_ACEOF
11456
11457 cat >>confdefs.h <<\_ACEOF
11458#define SETEUID_BREAKS_SETUID 1
11459_ACEOF
11460
11461 cat >>confdefs.h <<\_ACEOF
11462#define BROKEN_GETADDRINFO 1
11463_ACEOF
8062 11464
8063 $as_echo "#define HAVE_SECUREWARE 1" >>confdefs.h 11465 cat >>confdefs.h <<\_ACEOF
11466#define BROKEN_SETREUID 1
11467_ACEOF
11468
11469 cat >>confdefs.h <<\_ACEOF
11470#define BROKEN_SETREGID 1
11471_ACEOF
8064 11472
8065 $as_echo "#define DISABLE_SHADOW 1" >>confdefs.h 11473 cat >>confdefs.h <<\_ACEOF
11474#define WITH_ABBREV_NO_TTY 1
11475_ACEOF
8066 11476
8067 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11477 cat >>confdefs.h <<\_ACEOF
11478#define BROKEN_UPDWTMPX 1
11479_ACEOF
8068 11480
8069 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11481 cat >>confdefs.h <<\_ACEOF
11482#define PASSWD_NEEDS_USERNAME 1
11483_ACEOF
8070 11484
8071 $as_echo "#define BROKEN_GETADDRINFO 1" >>confdefs.h
8072 11485
8073 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h
8074 11486
8075 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11487for ac_func in getluid setluid
11488do
11489as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
11490{ echo "$as_me:$LINENO: checking for $ac_func" >&5
11491echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
11492if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
11493 echo $ECHO_N "(cached) $ECHO_C" >&6
11494else
11495 cat >conftest.$ac_ext <<_ACEOF
11496/* confdefs.h. */
11497_ACEOF
11498cat confdefs.h >>conftest.$ac_ext
11499cat >>conftest.$ac_ext <<_ACEOF
11500/* end confdefs.h. */
11501/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
11502 For example, HP-UX 11i <limits.h> declares gettimeofday. */
11503#define $ac_func innocuous_$ac_func
11504
11505/* System header to define __stub macros and hopefully few prototypes,
11506 which can conflict with char $ac_func (); below.
11507 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
11508 <limits.h> exists even on freestanding compilers. */
11509
11510#ifdef __STDC__
11511# include <limits.h>
11512#else
11513# include <assert.h>
11514#endif
8076 11515
8077 $as_echo "#define WITH_ABBREV_NO_TTY 1" >>confdefs.h 11516#undef $ac_func
8078 11517
8079 $as_echo "#define BROKEN_UPDWTMPX 1" >>confdefs.h 11518/* Override any GCC internal prototype to avoid an error.
11519 Use char because int might match the return type of a GCC
11520 builtin and then its argument prototype would still apply. */
11521#ifdef __cplusplus
11522extern "C"
11523#endif
11524char $ac_func ();
11525/* The GNU C library defines this for functions which it implements
11526 to always fail with ENOSYS. Some functions are actually named
11527 something starting with __ and the normal name is an alias. */
11528#if defined __stub_$ac_func || defined __stub___$ac_func
11529choke me
11530#endif
11531
11532int
11533main ()
11534{
11535return $ac_func ();
11536 ;
11537 return 0;
11538}
11539_ACEOF
11540rm -f conftest.$ac_objext conftest$ac_exeext
11541if { (ac_try="$ac_link"
11542case "(($ac_try" in
11543 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11544 *) ac_try_echo=$ac_try;;
11545esac
11546eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11547 (eval "$ac_link") 2>conftest.er1
11548 ac_status=$?
11549 grep -v '^ *+' conftest.er1 >conftest.err
11550 rm -f conftest.er1
11551 cat conftest.err >&5
11552 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11553 (exit $ac_status); } && {
11554 test -z "$ac_c_werror_flag" ||
11555 test ! -s conftest.err
11556 } && test -s conftest$ac_exeext &&
11557 $as_test_x conftest$ac_exeext; then
11558 eval "$as_ac_var=yes"
11559else
11560 echo "$as_me: failed program was:" >&5
11561sed 's/^/| /' conftest.$ac_ext >&5
8080 11562
8081 $as_echo "#define PASSWD_NEEDS_USERNAME 1" >>confdefs.h 11563 eval "$as_ac_var=no"
11564fi
8082 11565
8083 for ac_func in getluid setluid 11566rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8084do : 11567 conftest$ac_exeext conftest.$ac_ext
8085 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 11568fi
8086ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 11569ac_res=`eval echo '${'$as_ac_var'}'`
8087if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 11570 { echo "$as_me:$LINENO: result: $ac_res" >&5
11571echo "${ECHO_T}$ac_res" >&6; }
11572if test `eval echo '${'$as_ac_var'}'` = yes; then
8088 cat >>confdefs.h <<_ACEOF 11573 cat >>confdefs.h <<_ACEOF
8089#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 11574#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
8090_ACEOF 11575_ACEOF
8091 11576
8092fi 11577fi
@@ -8098,67 +11583,103 @@ done
8098 ;; 11583 ;;
8099*-*-unicosmk*) 11584*-*-unicosmk*)
8100 11585
8101$as_echo "#define NO_SSH_LASTLOG 1" >>confdefs.h 11586cat >>confdefs.h <<\_ACEOF
11587#define NO_SSH_LASTLOG 1
11588_ACEOF
8102 11589
8103 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11590 cat >>confdefs.h <<\_ACEOF
11591#define SETEUID_BREAKS_SETUID 1
11592_ACEOF
8104 11593
8105 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11594 cat >>confdefs.h <<\_ACEOF
11595#define BROKEN_SETREUID 1
11596_ACEOF
8106 11597
8107 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11598 cat >>confdefs.h <<\_ACEOF
11599#define BROKEN_SETREGID 1
11600_ACEOF
8108 11601
8109 $as_echo "#define USE_PIPES 1" >>confdefs.h 11602 cat >>confdefs.h <<\_ACEOF
11603#define USE_PIPES 1
11604_ACEOF
8110 11605
8111 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11606 cat >>confdefs.h <<\_ACEOF
11607#define DISABLE_FD_PASSING 1
11608_ACEOF
8112 11609
8113 LDFLAGS="$LDFLAGS" 11610 LDFLAGS="$LDFLAGS"
8114 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm" 11611 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
8115 MANTYPE=cat 11612 MANTYPE=cat
8116 ;; 11613 ;;
8117*-*-unicosmp*) 11614*-*-unicosmp*)
8118 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11615 cat >>confdefs.h <<\_ACEOF
11616#define SETEUID_BREAKS_SETUID 1
11617_ACEOF
8119 11618
8120 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11619 cat >>confdefs.h <<\_ACEOF
11620#define BROKEN_SETREUID 1
11621_ACEOF
8121 11622
8122 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11623 cat >>confdefs.h <<\_ACEOF
11624#define BROKEN_SETREGID 1
11625_ACEOF
8123 11626
8124 $as_echo "#define WITH_ABBREV_NO_TTY 1" >>confdefs.h 11627 cat >>confdefs.h <<\_ACEOF
11628#define WITH_ABBREV_NO_TTY 1
11629_ACEOF
8125 11630
8126 $as_echo "#define USE_PIPES 1" >>confdefs.h 11631 cat >>confdefs.h <<\_ACEOF
11632#define USE_PIPES 1
11633_ACEOF
8127 11634
8128 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11635 cat >>confdefs.h <<\_ACEOF
11636#define DISABLE_FD_PASSING 1
11637_ACEOF
8129 11638
8130 LDFLAGS="$LDFLAGS" 11639 LDFLAGS="$LDFLAGS"
8131 LIBS="$LIBS -lgen -lacid -ldb" 11640 LIBS="$LIBS -lgen -lacid -ldb"
8132 MANTYPE=cat 11641 MANTYPE=cat
8133 ;; 11642 ;;
8134*-*-unicos*) 11643*-*-unicos*)
8135 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11644 cat >>confdefs.h <<\_ACEOF
11645#define SETEUID_BREAKS_SETUID 1
11646_ACEOF
8136 11647
8137 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11648 cat >>confdefs.h <<\_ACEOF
11649#define BROKEN_SETREUID 1
11650_ACEOF
8138 11651
8139 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11652 cat >>confdefs.h <<\_ACEOF
11653#define BROKEN_SETREGID 1
11654_ACEOF
8140 11655
8141 $as_echo "#define USE_PIPES 1" >>confdefs.h 11656 cat >>confdefs.h <<\_ACEOF
11657#define USE_PIPES 1
11658_ACEOF
8142 11659
8143 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11660 cat >>confdefs.h <<\_ACEOF
11661#define DISABLE_FD_PASSING 1
11662_ACEOF
8144 11663
8145 $as_echo "#define NO_SSH_LASTLOG 1" >>confdefs.h 11664 cat >>confdefs.h <<\_ACEOF
11665#define NO_SSH_LASTLOG 1
11666_ACEOF
8146 11667
8147 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal" 11668 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
8148 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm" 11669 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
8149 MANTYPE=cat 11670 MANTYPE=cat
8150 ;; 11671 ;;
8151*-dec-osf*) 11672*-dec-osf*)
8152 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Digital Unix SIA" >&5 11673 { echo "$as_me:$LINENO: checking for Digital Unix SIA" >&5
8153$as_echo_n "checking for Digital Unix SIA... " >&6; } 11674echo $ECHO_N "checking for Digital Unix SIA... $ECHO_C" >&6; }
8154 no_osfsia="" 11675 no_osfsia=""
8155 11676
8156# Check whether --with-osfsia was given. 11677# Check whether --with-osfsia was given.
8157if test "${with_osfsia+set}" = set; then : 11678if test "${with_osfsia+set}" = set; then
8158 withval=$with_osfsia; 11679 withval=$with_osfsia;
8159 if test "x$withval" = "xno" ; then 11680 if test "x$withval" = "xno" ; then
8160 { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 11681 { echo "$as_me:$LINENO: result: disabled" >&5
8161$as_echo "disabled" >&6; } 11682echo "${ECHO_T}disabled" >&6; }
8162 no_osfsia=1 11683 no_osfsia=1
8163 fi 11684 fi
8164 11685
@@ -8166,55 +11687,85 @@ fi
8166 11687
8167 if test -z "$no_osfsia" ; then 11688 if test -z "$no_osfsia" ; then
8168 if test -f /etc/sia/matrix.conf; then 11689 if test -f /etc/sia/matrix.conf; then
8169 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 11690 { echo "$as_me:$LINENO: result: yes" >&5
8170$as_echo "yes" >&6; } 11691echo "${ECHO_T}yes" >&6; }
8171 11692
8172$as_echo "#define HAVE_OSF_SIA 1" >>confdefs.h 11693cat >>confdefs.h <<\_ACEOF
11694#define HAVE_OSF_SIA 1
11695_ACEOF
8173 11696
8174 11697
8175$as_echo "#define DISABLE_LOGIN 1" >>confdefs.h 11698cat >>confdefs.h <<\_ACEOF
11699#define DISABLE_LOGIN 1
11700_ACEOF
8176 11701
8177 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11702 cat >>confdefs.h <<\_ACEOF
11703#define DISABLE_FD_PASSING 1
11704_ACEOF
8178 11705
8179 LIBS="$LIBS -lsecurity -ldb -lm -laud" 11706 LIBS="$LIBS -lsecurity -ldb -lm -laud"
8180 SIA_MSG="yes" 11707 SIA_MSG="yes"
8181 else 11708 else
8182 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 11709 { echo "$as_me:$LINENO: result: no" >&5
8183$as_echo "no" >&6; } 11710echo "${ECHO_T}no" >&6; }
8184 11711
8185$as_echo "#define LOCKED_PASSWD_SUBSTR \"Nologin\"" >>confdefs.h 11712cat >>confdefs.h <<\_ACEOF
11713#define LOCKED_PASSWD_SUBSTR "Nologin"
11714_ACEOF
8186 11715
8187 fi 11716 fi
8188 fi 11717 fi
8189 $as_echo "#define BROKEN_GETADDRINFO 1" >>confdefs.h 11718 cat >>confdefs.h <<\_ACEOF
11719#define BROKEN_GETADDRINFO 1
11720_ACEOF
8190 11721
8191 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11722 cat >>confdefs.h <<\_ACEOF
11723#define SETEUID_BREAKS_SETUID 1
11724_ACEOF
8192 11725
8193 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11726 cat >>confdefs.h <<\_ACEOF
11727#define BROKEN_SETREUID 1
11728_ACEOF
8194 11729
8195 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11730 cat >>confdefs.h <<\_ACEOF
11731#define BROKEN_SETREGID 1
11732_ACEOF
8196 11733
8197 11734
8198$as_echo "#define BROKEN_READV_COMPARISON 1" >>confdefs.h 11735cat >>confdefs.h <<\_ACEOF
11736#define BROKEN_READV_COMPARISON 1
11737_ACEOF
8199 11738
8200 ;; 11739 ;;
8201 11740
8202*-*-nto-qnx*) 11741*-*-nto-qnx*)
8203 $as_echo "#define USE_PIPES 1" >>confdefs.h 11742 cat >>confdefs.h <<\_ACEOF
11743#define USE_PIPES 1
11744_ACEOF
8204 11745
8205 $as_echo "#define NO_X11_UNIX_SOCKETS 1" >>confdefs.h 11746 cat >>confdefs.h <<\_ACEOF
11747#define NO_X11_UNIX_SOCKETS 1
11748_ACEOF
8206 11749
8207 $as_echo "#define DISABLE_LASTLOG 1" >>confdefs.h 11750 cat >>confdefs.h <<\_ACEOF
11751#define DISABLE_LASTLOG 1
11752_ACEOF
8208 11753
8209 $as_echo "#define SSHD_ACQUIRES_CTTY 1" >>confdefs.h 11754 cat >>confdefs.h <<\_ACEOF
11755#define SSHD_ACQUIRES_CTTY 1
11756_ACEOF
8210 11757
8211 11758
8212$as_echo "#define BROKEN_SHADOW_EXPIRE 1" >>confdefs.h 11759cat >>confdefs.h <<\_ACEOF
11760#define BROKEN_SHADOW_EXPIRE 1
11761_ACEOF
8213 11762
8214 enable_etc_default_login=no # has incompatible /etc/default/login 11763 enable_etc_default_login=no # has incompatible /etc/default/login
8215 case "$host" in 11764 case "$host" in
8216 *-*-nto-qnx6*) 11765 *-*-nto-qnx6*)
8217 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11766 cat >>confdefs.h <<\_ACEOF
11767#define DISABLE_FD_PASSING 1
11768_ACEOF
8218 11769
8219 ;; 11770 ;;
8220 esac 11771 esac
@@ -8222,34 +11773,48 @@ $as_echo "#define BROKEN_SHADOW_EXPIRE 1" >>confdefs.h
8222 11773
8223*-*-ultrix*) 11774*-*-ultrix*)
8224 11775
8225$as_echo "#define BROKEN_GETGROUPS 1" >>confdefs.h 11776cat >>confdefs.h <<\_ACEOF
11777#define BROKEN_GETGROUPS 1
11778_ACEOF
8226 11779
8227 11780
8228$as_echo "#define BROKEN_MMAP 1" >>confdefs.h 11781cat >>confdefs.h <<\_ACEOF
11782#define BROKEN_MMAP 1
11783_ACEOF
8229 11784
8230 $as_echo "#define NEED_SETPGRP 1" >>confdefs.h 11785 cat >>confdefs.h <<\_ACEOF
11786#define NEED_SETPGRP 1
11787_ACEOF
8231 11788
8232 11789
8233$as_echo "#define HAVE_SYS_SYSLOG_H 1" >>confdefs.h 11790cat >>confdefs.h <<\_ACEOF
11791#define HAVE_SYS_SYSLOG_H 1
11792_ACEOF
8234 11793
8235 ;; 11794 ;;
8236 11795
8237*-*-lynxos) 11796*-*-lynxos)
8238 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__" 11797 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
8239 11798
8240$as_echo "#define BROKEN_SETVBUF 1" >>confdefs.h 11799cat >>confdefs.h <<\_ACEOF
11800#define BROKEN_SETVBUF 1
11801_ACEOF
8241 11802
8242 ;; 11803 ;;
8243esac 11804esac
8244 11805
8245{ $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler and flags for sanity" >&5 11806{ echo "$as_me:$LINENO: checking compiler and flags for sanity" >&5
8246$as_echo_n "checking compiler and flags for sanity... " >&6; } 11807echo $ECHO_N "checking compiler and flags for sanity... $ECHO_C" >&6; }
8247if test "$cross_compiling" = yes; then : 11808if test "$cross_compiling" = yes; then
8248 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking compiler sanity" >&5 11809 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking compiler sanity" >&5
8249$as_echo "$as_me: WARNING: cross compiling: not checking compiler sanity" >&2;} 11810echo "$as_me: WARNING: cross compiling: not checking compiler sanity" >&2;}
8250 11811
8251else 11812else
8252 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 11813 cat >conftest.$ac_ext <<_ACEOF
11814/* confdefs.h. */
11815_ACEOF
11816cat confdefs.h >>conftest.$ac_ext
11817cat >>conftest.$ac_ext <<_ACEOF
8253/* end confdefs.h. */ 11818/* end confdefs.h. */
8254 #include <stdio.h> 11819 #include <stdio.h>
8255int 11820int
@@ -8260,34 +11825,145 @@ main ()
8260 return 0; 11825 return 0;
8261} 11826}
8262_ACEOF 11827_ACEOF
8263if ac_fn_c_try_run "$LINENO"; then : 11828rm -f conftest$ac_exeext
8264 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 11829if { (ac_try="$ac_link"
8265$as_echo "yes" >&6; } 11830case "(($ac_try" in
11831 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11832 *) ac_try_echo=$ac_try;;
11833esac
11834eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11835 (eval "$ac_link") 2>&5
11836 ac_status=$?
11837 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11838 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
11839 { (case "(($ac_try" in
11840 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11841 *) ac_try_echo=$ac_try;;
11842esac
11843eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11844 (eval "$ac_try") 2>&5
11845 ac_status=$?
11846 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11847 (exit $ac_status); }; }; then
11848 { echo "$as_me:$LINENO: result: yes" >&5
11849echo "${ECHO_T}yes" >&6; }
8266else 11850else
11851 echo "$as_me: program exited with status $ac_status" >&5
11852echo "$as_me: failed program was:" >&5
11853sed 's/^/| /' conftest.$ac_ext >&5
11854
11855( exit $ac_status )
8267 11856
8268 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 11857 { echo "$as_me:$LINENO: result: no" >&5
8269$as_echo "no" >&6; } 11858echo "${ECHO_T}no" >&6; }
8270 as_fn_error $? "*** compiler cannot create working executables, check config.log ***" "$LINENO" 5 11859 { { echo "$as_me:$LINENO: error: *** compiler cannot create working executables, check config.log ***" >&5
11860echo "$as_me: error: *** compiler cannot create working executables, check config.log ***" >&2;}
11861 { (exit 1); exit 1; }; }
8271 11862
8272fi 11863fi
8273rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 11864rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8274 conftest.$ac_objext conftest.beam conftest.$ac_ext
8275fi 11865fi
8276 11866
8277 11867
11868
8278# Checks for libraries. 11869# Checks for libraries.
8279ac_fn_c_check_func "$LINENO" "yp_match" "ac_cv_func_yp_match" 11870{ echo "$as_me:$LINENO: checking for yp_match" >&5
8280if test "x$ac_cv_func_yp_match" = xyes; then : 11871echo $ECHO_N "checking for yp_match... $ECHO_C" >&6; }
11872if test "${ac_cv_func_yp_match+set}" = set; then
11873 echo $ECHO_N "(cached) $ECHO_C" >&6
11874else
11875 cat >conftest.$ac_ext <<_ACEOF
11876/* confdefs.h. */
11877_ACEOF
11878cat confdefs.h >>conftest.$ac_ext
11879cat >>conftest.$ac_ext <<_ACEOF
11880/* end confdefs.h. */
11881/* Define yp_match to an innocuous variant, in case <limits.h> declares yp_match.
11882 For example, HP-UX 11i <limits.h> declares gettimeofday. */
11883#define yp_match innocuous_yp_match
11884
11885/* System header to define __stub macros and hopefully few prototypes,
11886 which can conflict with char yp_match (); below.
11887 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
11888 <limits.h> exists even on freestanding compilers. */
11889
11890#ifdef __STDC__
11891# include <limits.h>
11892#else
11893# include <assert.h>
11894#endif
11895
11896#undef yp_match
11897
11898/* Override any GCC internal prototype to avoid an error.
11899 Use char because int might match the return type of a GCC
11900 builtin and then its argument prototype would still apply. */
11901#ifdef __cplusplus
11902extern "C"
11903#endif
11904char yp_match ();
11905/* The GNU C library defines this for functions which it implements
11906 to always fail with ENOSYS. Some functions are actually named
11907 something starting with __ and the normal name is an alias. */
11908#if defined __stub_yp_match || defined __stub___yp_match
11909choke me
11910#endif
11911
11912int
11913main ()
11914{
11915return yp_match ();
11916 ;
11917 return 0;
11918}
11919_ACEOF
11920rm -f conftest.$ac_objext conftest$ac_exeext
11921if { (ac_try="$ac_link"
11922case "(($ac_try" in
11923 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11924 *) ac_try_echo=$ac_try;;
11925esac
11926eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11927 (eval "$ac_link") 2>conftest.er1
11928 ac_status=$?
11929 grep -v '^ *+' conftest.er1 >conftest.err
11930 rm -f conftest.er1
11931 cat conftest.err >&5
11932 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11933 (exit $ac_status); } && {
11934 test -z "$ac_c_werror_flag" ||
11935 test ! -s conftest.err
11936 } && test -s conftest$ac_exeext &&
11937 $as_test_x conftest$ac_exeext; then
11938 ac_cv_func_yp_match=yes
11939else
11940 echo "$as_me: failed program was:" >&5
11941sed 's/^/| /' conftest.$ac_ext >&5
11942
11943 ac_cv_func_yp_match=no
11944fi
8281 11945
11946rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11947 conftest$ac_exeext conftest.$ac_ext
11948fi
11949{ echo "$as_me:$LINENO: result: $ac_cv_func_yp_match" >&5
11950echo "${ECHO_T}$ac_cv_func_yp_match" >&6; }
11951if test $ac_cv_func_yp_match = yes; then
11952 :
8282else 11953else
8283 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for yp_match in -lnsl" >&5 11954
8284$as_echo_n "checking for yp_match in -lnsl... " >&6; } 11955{ echo "$as_me:$LINENO: checking for yp_match in -lnsl" >&5
8285if ${ac_cv_lib_nsl_yp_match+:} false; then : 11956echo $ECHO_N "checking for yp_match in -lnsl... $ECHO_C" >&6; }
8286 $as_echo_n "(cached) " >&6 11957if test "${ac_cv_lib_nsl_yp_match+set}" = set; then
11958 echo $ECHO_N "(cached) $ECHO_C" >&6
8287else 11959else
8288 ac_check_lib_save_LIBS=$LIBS 11960 ac_check_lib_save_LIBS=$LIBS
8289LIBS="-lnsl $LIBS" 11961LIBS="-lnsl $LIBS"
8290cat confdefs.h - <<_ACEOF >conftest.$ac_ext 11962cat >conftest.$ac_ext <<_ACEOF
11963/* confdefs.h. */
11964_ACEOF
11965cat confdefs.h >>conftest.$ac_ext
11966cat >>conftest.$ac_ext <<_ACEOF
8291/* end confdefs.h. */ 11967/* end confdefs.h. */
8292 11968
8293/* Override any GCC internal prototype to avoid an error. 11969/* Override any GCC internal prototype to avoid an error.
@@ -8305,18 +11981,39 @@ return yp_match ();
8305 return 0; 11981 return 0;
8306} 11982}
8307_ACEOF 11983_ACEOF
8308if ac_fn_c_try_link "$LINENO"; then : 11984rm -f conftest.$ac_objext conftest$ac_exeext
11985if { (ac_try="$ac_link"
11986case "(($ac_try" in
11987 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11988 *) ac_try_echo=$ac_try;;
11989esac
11990eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11991 (eval "$ac_link") 2>conftest.er1
11992 ac_status=$?
11993 grep -v '^ *+' conftest.er1 >conftest.err
11994 rm -f conftest.er1
11995 cat conftest.err >&5
11996 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11997 (exit $ac_status); } && {
11998 test -z "$ac_c_werror_flag" ||
11999 test ! -s conftest.err
12000 } && test -s conftest$ac_exeext &&
12001 $as_test_x conftest$ac_exeext; then
8309 ac_cv_lib_nsl_yp_match=yes 12002 ac_cv_lib_nsl_yp_match=yes
8310else 12003else
8311 ac_cv_lib_nsl_yp_match=no 12004 echo "$as_me: failed program was:" >&5
12005sed 's/^/| /' conftest.$ac_ext >&5
12006
12007 ac_cv_lib_nsl_yp_match=no
8312fi 12008fi
8313rm -f core conftest.err conftest.$ac_objext \ 12009
8314 conftest$ac_exeext conftest.$ac_ext 12010rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12011 conftest$ac_exeext conftest.$ac_ext
8315LIBS=$ac_check_lib_save_LIBS 12012LIBS=$ac_check_lib_save_LIBS
8316fi 12013fi
8317{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_yp_match" >&5 12014{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_yp_match" >&5
8318$as_echo "$ac_cv_lib_nsl_yp_match" >&6; } 12015echo "${ECHO_T}$ac_cv_lib_nsl_yp_match" >&6; }
8319if test "x$ac_cv_lib_nsl_yp_match" = xyes; then : 12016if test $ac_cv_lib_nsl_yp_match = yes; then
8320 cat >>confdefs.h <<_ACEOF 12017 cat >>confdefs.h <<_ACEOF
8321#define HAVE_LIBNSL 1 12018#define HAVE_LIBNSL 1
8322_ACEOF 12019_ACEOF
@@ -8327,18 +12024,103 @@ fi
8327 12024
8328fi 12025fi
8329 12026
8330ac_fn_c_check_func "$LINENO" "setsockopt" "ac_cv_func_setsockopt" 12027{ echo "$as_me:$LINENO: checking for setsockopt" >&5
8331if test "x$ac_cv_func_setsockopt" = xyes; then : 12028echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6; }
12029if test "${ac_cv_func_setsockopt+set}" = set; then
12030 echo $ECHO_N "(cached) $ECHO_C" >&6
12031else
12032 cat >conftest.$ac_ext <<_ACEOF
12033/* confdefs.h. */
12034_ACEOF
12035cat confdefs.h >>conftest.$ac_ext
12036cat >>conftest.$ac_ext <<_ACEOF
12037/* end confdefs.h. */
12038/* Define setsockopt to an innocuous variant, in case <limits.h> declares setsockopt.
12039 For example, HP-UX 11i <limits.h> declares gettimeofday. */
12040#define setsockopt innocuous_setsockopt
8332 12041
12042/* System header to define __stub macros and hopefully few prototypes,
12043 which can conflict with char setsockopt (); below.
12044 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
12045 <limits.h> exists even on freestanding compilers. */
12046
12047#ifdef __STDC__
12048# include <limits.h>
12049#else
12050# include <assert.h>
12051#endif
12052
12053#undef setsockopt
12054
12055/* Override any GCC internal prototype to avoid an error.
12056 Use char because int might match the return type of a GCC
12057 builtin and then its argument prototype would still apply. */
12058#ifdef __cplusplus
12059extern "C"
12060#endif
12061char setsockopt ();
12062/* The GNU C library defines this for functions which it implements
12063 to always fail with ENOSYS. Some functions are actually named
12064 something starting with __ and the normal name is an alias. */
12065#if defined __stub_setsockopt || defined __stub___setsockopt
12066choke me
12067#endif
12068
12069int
12070main ()
12071{
12072return setsockopt ();
12073 ;
12074 return 0;
12075}
12076_ACEOF
12077rm -f conftest.$ac_objext conftest$ac_exeext
12078if { (ac_try="$ac_link"
12079case "(($ac_try" in
12080 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12081 *) ac_try_echo=$ac_try;;
12082esac
12083eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12084 (eval "$ac_link") 2>conftest.er1
12085 ac_status=$?
12086 grep -v '^ *+' conftest.er1 >conftest.err
12087 rm -f conftest.er1
12088 cat conftest.err >&5
12089 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12090 (exit $ac_status); } && {
12091 test -z "$ac_c_werror_flag" ||
12092 test ! -s conftest.err
12093 } && test -s conftest$ac_exeext &&
12094 $as_test_x conftest$ac_exeext; then
12095 ac_cv_func_setsockopt=yes
8333else 12096else
8334 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setsockopt in -lsocket" >&5 12097 echo "$as_me: failed program was:" >&5
8335$as_echo_n "checking for setsockopt in -lsocket... " >&6; } 12098sed 's/^/| /' conftest.$ac_ext >&5
8336if ${ac_cv_lib_socket_setsockopt+:} false; then : 12099
8337 $as_echo_n "(cached) " >&6 12100 ac_cv_func_setsockopt=no
12101fi
12102
12103rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12104 conftest$ac_exeext conftest.$ac_ext
12105fi
12106{ echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5
12107echo "${ECHO_T}$ac_cv_func_setsockopt" >&6; }
12108if test $ac_cv_func_setsockopt = yes; then
12109 :
12110else
12111
12112{ echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5
12113echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6; }
12114if test "${ac_cv_lib_socket_setsockopt+set}" = set; then
12115 echo $ECHO_N "(cached) $ECHO_C" >&6
8338else 12116else
8339 ac_check_lib_save_LIBS=$LIBS 12117 ac_check_lib_save_LIBS=$LIBS
8340LIBS="-lsocket $LIBS" 12118LIBS="-lsocket $LIBS"
8341cat confdefs.h - <<_ACEOF >conftest.$ac_ext 12119cat >conftest.$ac_ext <<_ACEOF
12120/* confdefs.h. */
12121_ACEOF
12122cat confdefs.h >>conftest.$ac_ext
12123cat >>conftest.$ac_ext <<_ACEOF
8342/* end confdefs.h. */ 12124/* end confdefs.h. */
8343 12125
8344/* Override any GCC internal prototype to avoid an error. 12126/* Override any GCC internal prototype to avoid an error.
@@ -8356,18 +12138,39 @@ return setsockopt ();
8356 return 0; 12138 return 0;
8357} 12139}
8358_ACEOF 12140_ACEOF
8359if ac_fn_c_try_link "$LINENO"; then : 12141rm -f conftest.$ac_objext conftest$ac_exeext
12142if { (ac_try="$ac_link"
12143case "(($ac_try" in
12144 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12145 *) ac_try_echo=$ac_try;;
12146esac
12147eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12148 (eval "$ac_link") 2>conftest.er1
12149 ac_status=$?
12150 grep -v '^ *+' conftest.er1 >conftest.err
12151 rm -f conftest.er1
12152 cat conftest.err >&5
12153 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12154 (exit $ac_status); } && {
12155 test -z "$ac_c_werror_flag" ||
12156 test ! -s conftest.err
12157 } && test -s conftest$ac_exeext &&
12158 $as_test_x conftest$ac_exeext; then
8360 ac_cv_lib_socket_setsockopt=yes 12159 ac_cv_lib_socket_setsockopt=yes
8361else 12160else
8362 ac_cv_lib_socket_setsockopt=no 12161 echo "$as_me: failed program was:" >&5
12162sed 's/^/| /' conftest.$ac_ext >&5
12163
12164 ac_cv_lib_socket_setsockopt=no
8363fi 12165fi
8364rm -f core conftest.err conftest.$ac_objext \ 12166
8365 conftest$ac_exeext conftest.$ac_ext 12167rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12168 conftest$ac_exeext conftest.$ac_ext
8366LIBS=$ac_check_lib_save_LIBS 12169LIBS=$ac_check_lib_save_LIBS
8367fi 12170fi
8368{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_setsockopt" >&5 12171{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5
8369$as_echo "$ac_cv_lib_socket_setsockopt" >&6; } 12172echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6; }
8370if test "x$ac_cv_lib_socket_setsockopt" = xyes; then : 12173if test $ac_cv_lib_socket_setsockopt = yes; then
8371 cat >>confdefs.h <<_ACEOF 12174 cat >>confdefs.h <<_ACEOF
8372#define HAVE_LIBSOCKET 1 12175#define HAVE_LIBSOCKET 1
8373_ACEOF 12176_ACEOF
@@ -8379,19 +12182,235 @@ fi
8379fi 12182fi
8380 12183
8381 12184
12185
8382for ac_func in dirname 12186for ac_func in dirname
8383do : 12187do
8384 ac_fn_c_check_func "$LINENO" "dirname" "ac_cv_func_dirname" 12188as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
8385if test "x$ac_cv_func_dirname" = xyes; then : 12189{ echo "$as_me:$LINENO: checking for $ac_func" >&5
12190echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
12191if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
12192 echo $ECHO_N "(cached) $ECHO_C" >&6
12193else
12194 cat >conftest.$ac_ext <<_ACEOF
12195/* confdefs.h. */
12196_ACEOF
12197cat confdefs.h >>conftest.$ac_ext
12198cat >>conftest.$ac_ext <<_ACEOF
12199/* end confdefs.h. */
12200/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
12201 For example, HP-UX 11i <limits.h> declares gettimeofday. */
12202#define $ac_func innocuous_$ac_func
12203
12204/* System header to define __stub macros and hopefully few prototypes,
12205 which can conflict with char $ac_func (); below.
12206 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
12207 <limits.h> exists even on freestanding compilers. */
12208
12209#ifdef __STDC__
12210# include <limits.h>
12211#else
12212# include <assert.h>
12213#endif
12214
12215#undef $ac_func
12216
12217/* Override any GCC internal prototype to avoid an error.
12218 Use char because int might match the return type of a GCC
12219 builtin and then its argument prototype would still apply. */
12220#ifdef __cplusplus
12221extern "C"
12222#endif
12223char $ac_func ();
12224/* The GNU C library defines this for functions which it implements
12225 to always fail with ENOSYS. Some functions are actually named
12226 something starting with __ and the normal name is an alias. */
12227#if defined __stub_$ac_func || defined __stub___$ac_func
12228choke me
12229#endif
12230
12231int
12232main ()
12233{
12234return $ac_func ();
12235 ;
12236 return 0;
12237}
12238_ACEOF
12239rm -f conftest.$ac_objext conftest$ac_exeext
12240if { (ac_try="$ac_link"
12241case "(($ac_try" in
12242 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12243 *) ac_try_echo=$ac_try;;
12244esac
12245eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12246 (eval "$ac_link") 2>conftest.er1
12247 ac_status=$?
12248 grep -v '^ *+' conftest.er1 >conftest.err
12249 rm -f conftest.er1
12250 cat conftest.err >&5
12251 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12252 (exit $ac_status); } && {
12253 test -z "$ac_c_werror_flag" ||
12254 test ! -s conftest.err
12255 } && test -s conftest$ac_exeext &&
12256 $as_test_x conftest$ac_exeext; then
12257 eval "$as_ac_var=yes"
12258else
12259 echo "$as_me: failed program was:" >&5
12260sed 's/^/| /' conftest.$ac_ext >&5
12261
12262 eval "$as_ac_var=no"
12263fi
12264
12265rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12266 conftest$ac_exeext conftest.$ac_ext
12267fi
12268ac_res=`eval echo '${'$as_ac_var'}'`
12269 { echo "$as_me:$LINENO: result: $ac_res" >&5
12270echo "${ECHO_T}$ac_res" >&6; }
12271if test `eval echo '${'$as_ac_var'}'` = yes; then
8386 cat >>confdefs.h <<_ACEOF 12272 cat >>confdefs.h <<_ACEOF
8387#define HAVE_DIRNAME 1 12273#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
8388_ACEOF 12274_ACEOF
8389 for ac_header in libgen.h 12275
8390do : 12276for ac_header in libgen.h
8391 ac_fn_c_check_header_mongrel "$LINENO" "libgen.h" "ac_cv_header_libgen_h" "$ac_includes_default" 12277do
8392if test "x$ac_cv_header_libgen_h" = xyes; then : 12278as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
12279if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
12280 { echo "$as_me:$LINENO: checking for $ac_header" >&5
12281echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
12282if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
12283 echo $ECHO_N "(cached) $ECHO_C" >&6
12284fi
12285ac_res=`eval echo '${'$as_ac_Header'}'`
12286 { echo "$as_me:$LINENO: result: $ac_res" >&5
12287echo "${ECHO_T}$ac_res" >&6; }
12288else
12289 # Is the header compilable?
12290{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
12291echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
12292cat >conftest.$ac_ext <<_ACEOF
12293/* confdefs.h. */
12294_ACEOF
12295cat confdefs.h >>conftest.$ac_ext
12296cat >>conftest.$ac_ext <<_ACEOF
12297/* end confdefs.h. */
12298$ac_includes_default
12299#include <$ac_header>
12300_ACEOF
12301rm -f conftest.$ac_objext
12302if { (ac_try="$ac_compile"
12303case "(($ac_try" in
12304 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12305 *) ac_try_echo=$ac_try;;
12306esac
12307eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12308 (eval "$ac_compile") 2>conftest.er1
12309 ac_status=$?
12310 grep -v '^ *+' conftest.er1 >conftest.err
12311 rm -f conftest.er1
12312 cat conftest.err >&5
12313 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12314 (exit $ac_status); } && {
12315 test -z "$ac_c_werror_flag" ||
12316 test ! -s conftest.err
12317 } && test -s conftest.$ac_objext; then
12318 ac_header_compiler=yes
12319else
12320 echo "$as_me: failed program was:" >&5
12321sed 's/^/| /' conftest.$ac_ext >&5
12322
12323 ac_header_compiler=no
12324fi
12325
12326rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
12327{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
12328echo "${ECHO_T}$ac_header_compiler" >&6; }
12329
12330# Is the header present?
12331{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
12332echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
12333cat >conftest.$ac_ext <<_ACEOF
12334/* confdefs.h. */
12335_ACEOF
12336cat confdefs.h >>conftest.$ac_ext
12337cat >>conftest.$ac_ext <<_ACEOF
12338/* end confdefs.h. */
12339#include <$ac_header>
12340_ACEOF
12341if { (ac_try="$ac_cpp conftest.$ac_ext"
12342case "(($ac_try" in
12343 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12344 *) ac_try_echo=$ac_try;;
12345esac
12346eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12347 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
12348 ac_status=$?
12349 grep -v '^ *+' conftest.er1 >conftest.err
12350 rm -f conftest.er1
12351 cat conftest.err >&5
12352 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12353 (exit $ac_status); } >/dev/null && {
12354 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
12355 test ! -s conftest.err
12356 }; then
12357 ac_header_preproc=yes
12358else
12359 echo "$as_me: failed program was:" >&5
12360sed 's/^/| /' conftest.$ac_ext >&5
12361
12362 ac_header_preproc=no
12363fi
12364
12365rm -f conftest.err conftest.$ac_ext
12366{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
12367echo "${ECHO_T}$ac_header_preproc" >&6; }
12368
12369# So? What about this header?
12370case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
12371 yes:no: )
12372 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
12373echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
12374 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
12375echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
12376 ac_header_preproc=yes
12377 ;;
12378 no:yes:* )
12379 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
12380echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
12381 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
12382echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
12383 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
12384echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
12385 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
12386echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
12387 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
12388echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
12389 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
12390echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
12391 ( cat <<\_ASBOX
12392## ------------------------------------------- ##
12393## Report this to openssh-unix-dev@mindrot.org ##
12394## ------------------------------------------- ##
12395_ASBOX
12396 ) | sed "s/^/$as_me: WARNING: /" >&2
12397 ;;
12398esac
12399{ echo "$as_me:$LINENO: checking for $ac_header" >&5
12400echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
12401if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
12402 echo $ECHO_N "(cached) $ECHO_C" >&6
12403else
12404 eval "$as_ac_Header=\$ac_header_preproc"
12405fi
12406ac_res=`eval echo '${'$as_ac_Header'}'`
12407 { echo "$as_me:$LINENO: result: $ac_res" >&5
12408echo "${ECHO_T}$ac_res" >&6; }
12409
12410fi
12411if test `eval echo '${'$as_ac_Header'}'` = yes; then
8393 cat >>confdefs.h <<_ACEOF 12412 cat >>confdefs.h <<_ACEOF
8394#define HAVE_LIBGEN_H 1 12413#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
8395_ACEOF 12414_ACEOF
8396 12415
8397fi 12416fi
@@ -8400,14 +12419,18 @@ done
8400 12419
8401else 12420else
8402 12421
8403 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dirname in -lgen" >&5 12422 { echo "$as_me:$LINENO: checking for dirname in -lgen" >&5
8404$as_echo_n "checking for dirname in -lgen... " >&6; } 12423echo $ECHO_N "checking for dirname in -lgen... $ECHO_C" >&6; }
8405if ${ac_cv_lib_gen_dirname+:} false; then : 12424if test "${ac_cv_lib_gen_dirname+set}" = set; then
8406 $as_echo_n "(cached) " >&6 12425 echo $ECHO_N "(cached) $ECHO_C" >&6
8407else 12426else
8408 ac_check_lib_save_LIBS=$LIBS 12427 ac_check_lib_save_LIBS=$LIBS
8409LIBS="-lgen $LIBS" 12428LIBS="-lgen $LIBS"
8410cat confdefs.h - <<_ACEOF >conftest.$ac_ext 12429cat >conftest.$ac_ext <<_ACEOF
12430/* confdefs.h. */
12431_ACEOF
12432cat confdefs.h >>conftest.$ac_ext
12433cat >>conftest.$ac_ext <<_ACEOF
8411/* end confdefs.h. */ 12434/* end confdefs.h. */
8412 12435
8413/* Override any GCC internal prototype to avoid an error. 12436/* Override any GCC internal prototype to avoid an error.
@@ -8425,31 +12448,56 @@ return dirname ();
8425 return 0; 12448 return 0;
8426} 12449}
8427_ACEOF 12450_ACEOF
8428if ac_fn_c_try_link "$LINENO"; then : 12451rm -f conftest.$ac_objext conftest$ac_exeext
12452if { (ac_try="$ac_link"
12453case "(($ac_try" in
12454 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12455 *) ac_try_echo=$ac_try;;
12456esac
12457eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12458 (eval "$ac_link") 2>conftest.er1
12459 ac_status=$?
12460 grep -v '^ *+' conftest.er1 >conftest.err
12461 rm -f conftest.er1
12462 cat conftest.err >&5
12463 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12464 (exit $ac_status); } && {
12465 test -z "$ac_c_werror_flag" ||
12466 test ! -s conftest.err
12467 } && test -s conftest$ac_exeext &&
12468 $as_test_x conftest$ac_exeext; then
8429 ac_cv_lib_gen_dirname=yes 12469 ac_cv_lib_gen_dirname=yes
8430else 12470else
8431 ac_cv_lib_gen_dirname=no 12471 echo "$as_me: failed program was:" >&5
12472sed 's/^/| /' conftest.$ac_ext >&5
12473
12474 ac_cv_lib_gen_dirname=no
8432fi 12475fi
8433rm -f core conftest.err conftest.$ac_objext \ 12476
8434 conftest$ac_exeext conftest.$ac_ext 12477rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12478 conftest$ac_exeext conftest.$ac_ext
8435LIBS=$ac_check_lib_save_LIBS 12479LIBS=$ac_check_lib_save_LIBS
8436fi 12480fi
8437{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_dirname" >&5 12481{ echo "$as_me:$LINENO: result: $ac_cv_lib_gen_dirname" >&5
8438$as_echo "$ac_cv_lib_gen_dirname" >&6; } 12482echo "${ECHO_T}$ac_cv_lib_gen_dirname" >&6; }
8439if test "x$ac_cv_lib_gen_dirname" = xyes; then : 12483if test $ac_cv_lib_gen_dirname = yes; then
8440 12484
8441 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken dirname" >&5 12485 { echo "$as_me:$LINENO: checking for broken dirname" >&5
8442$as_echo_n "checking for broken dirname... " >&6; } 12486echo $ECHO_N "checking for broken dirname... $ECHO_C" >&6; }
8443if ${ac_cv_have_broken_dirname+:} false; then : 12487if test "${ac_cv_have_broken_dirname+set}" = set; then
8444 $as_echo_n "(cached) " >&6 12488 echo $ECHO_N "(cached) $ECHO_C" >&6
8445else 12489else
8446 12490
8447 save_LIBS="$LIBS" 12491 save_LIBS="$LIBS"
8448 LIBS="$LIBS -lgen" 12492 LIBS="$LIBS -lgen"
8449 if test "$cross_compiling" = yes; then : 12493 if test "$cross_compiling" = yes; then
8450 ac_cv_have_broken_dirname="no" 12494 ac_cv_have_broken_dirname="no"
8451else 12495else
8452 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 12496 cat >conftest.$ac_ext <<_ACEOF
12497/* confdefs.h. */
12498_ACEOF
12499cat confdefs.h >>conftest.$ac_ext
12500cat >>conftest.$ac_ext <<_ACEOF
8453/* end confdefs.h. */ 12501/* end confdefs.h. */
8454 12502
8455#include <libgen.h> 12503#include <libgen.h>
@@ -8468,30 +12516,189 @@ int main(int argc, char **argv) {
8468} 12516}
8469 12517
8470_ACEOF 12518_ACEOF
8471if ac_fn_c_try_run "$LINENO"; then : 12519rm -f conftest$ac_exeext
12520if { (ac_try="$ac_link"
12521case "(($ac_try" in
12522 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12523 *) ac_try_echo=$ac_try;;
12524esac
12525eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12526 (eval "$ac_link") 2>&5
12527 ac_status=$?
12528 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12529 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
12530 { (case "(($ac_try" in
12531 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12532 *) ac_try_echo=$ac_try;;
12533esac
12534eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12535 (eval "$ac_try") 2>&5
12536 ac_status=$?
12537 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12538 (exit $ac_status); }; }; then
8472 ac_cv_have_broken_dirname="no" 12539 ac_cv_have_broken_dirname="no"
8473else 12540else
8474 ac_cv_have_broken_dirname="yes" 12541 echo "$as_me: program exited with status $ac_status" >&5
12542echo "$as_me: failed program was:" >&5
12543sed 's/^/| /' conftest.$ac_ext >&5
12544
12545( exit $ac_status )
12546 ac_cv_have_broken_dirname="yes"
8475fi 12547fi
8476rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 12548rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8477 conftest.$ac_objext conftest.beam conftest.$ac_ext
8478fi 12549fi
8479 12550
12551
8480 LIBS="$save_LIBS" 12552 LIBS="$save_LIBS"
8481 12553
8482fi 12554fi
8483{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_broken_dirname" >&5 12555{ echo "$as_me:$LINENO: result: $ac_cv_have_broken_dirname" >&5
8484$as_echo "$ac_cv_have_broken_dirname" >&6; } 12556echo "${ECHO_T}$ac_cv_have_broken_dirname" >&6; }
8485 if test "x$ac_cv_have_broken_dirname" = "xno" ; then 12557 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
8486 LIBS="$LIBS -lgen" 12558 LIBS="$LIBS -lgen"
8487 $as_echo "#define HAVE_DIRNAME 1" >>confdefs.h 12559 cat >>confdefs.h <<\_ACEOF
12560#define HAVE_DIRNAME 1
12561_ACEOF
12562
12563
12564for ac_header in libgen.h
12565do
12566as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
12567if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
12568 { echo "$as_me:$LINENO: checking for $ac_header" >&5
12569echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
12570if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
12571 echo $ECHO_N "(cached) $ECHO_C" >&6
12572fi
12573ac_res=`eval echo '${'$as_ac_Header'}'`
12574 { echo "$as_me:$LINENO: result: $ac_res" >&5
12575echo "${ECHO_T}$ac_res" >&6; }
12576else
12577 # Is the header compilable?
12578{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
12579echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
12580cat >conftest.$ac_ext <<_ACEOF
12581/* confdefs.h. */
12582_ACEOF
12583cat confdefs.h >>conftest.$ac_ext
12584cat >>conftest.$ac_ext <<_ACEOF
12585/* end confdefs.h. */
12586$ac_includes_default
12587#include <$ac_header>
12588_ACEOF
12589rm -f conftest.$ac_objext
12590if { (ac_try="$ac_compile"
12591case "(($ac_try" in
12592 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12593 *) ac_try_echo=$ac_try;;
12594esac
12595eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12596 (eval "$ac_compile") 2>conftest.er1
12597 ac_status=$?
12598 grep -v '^ *+' conftest.er1 >conftest.err
12599 rm -f conftest.er1
12600 cat conftest.err >&5
12601 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12602 (exit $ac_status); } && {
12603 test -z "$ac_c_werror_flag" ||
12604 test ! -s conftest.err
12605 } && test -s conftest.$ac_objext; then
12606 ac_header_compiler=yes
12607else
12608 echo "$as_me: failed program was:" >&5
12609sed 's/^/| /' conftest.$ac_ext >&5
12610
12611 ac_header_compiler=no
12612fi
12613
12614rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
12615{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
12616echo "${ECHO_T}$ac_header_compiler" >&6; }
12617
12618# Is the header present?
12619{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
12620echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
12621cat >conftest.$ac_ext <<_ACEOF
12622/* confdefs.h. */
12623_ACEOF
12624cat confdefs.h >>conftest.$ac_ext
12625cat >>conftest.$ac_ext <<_ACEOF
12626/* end confdefs.h. */
12627#include <$ac_header>
12628_ACEOF
12629if { (ac_try="$ac_cpp conftest.$ac_ext"
12630case "(($ac_try" in
12631 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12632 *) ac_try_echo=$ac_try;;
12633esac
12634eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12635 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
12636 ac_status=$?
12637 grep -v '^ *+' conftest.er1 >conftest.err
12638 rm -f conftest.er1
12639 cat conftest.err >&5
12640 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12641 (exit $ac_status); } >/dev/null && {
12642 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
12643 test ! -s conftest.err
12644 }; then
12645 ac_header_preproc=yes
12646else
12647 echo "$as_me: failed program was:" >&5
12648sed 's/^/| /' conftest.$ac_ext >&5
12649
12650 ac_header_preproc=no
12651fi
8488 12652
8489 for ac_header in libgen.h 12653rm -f conftest.err conftest.$ac_ext
8490do : 12654{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
8491 ac_fn_c_check_header_mongrel "$LINENO" "libgen.h" "ac_cv_header_libgen_h" "$ac_includes_default" 12655echo "${ECHO_T}$ac_header_preproc" >&6; }
8492if test "x$ac_cv_header_libgen_h" = xyes; then : 12656
12657# So? What about this header?
12658case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
12659 yes:no: )
12660 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
12661echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
12662 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
12663echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
12664 ac_header_preproc=yes
12665 ;;
12666 no:yes:* )
12667 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
12668echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
12669 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
12670echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
12671 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
12672echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
12673 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
12674echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
12675 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
12676echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
12677 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
12678echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
12679 ( cat <<\_ASBOX
12680## ------------------------------------------- ##
12681## Report this to openssh-unix-dev@mindrot.org ##
12682## ------------------------------------------- ##
12683_ASBOX
12684 ) | sed "s/^/$as_me: WARNING: /" >&2
12685 ;;
12686esac
12687{ echo "$as_me:$LINENO: checking for $ac_header" >&5
12688echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
12689if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
12690 echo $ECHO_N "(cached) $ECHO_C" >&6
12691else
12692 eval "$as_ac_Header=\$ac_header_preproc"
12693fi
12694ac_res=`eval echo '${'$as_ac_Header'}'`
12695 { echo "$as_me:$LINENO: result: $ac_res" >&5
12696echo "${ECHO_T}$ac_res" >&6; }
12697
12698fi
12699if test `eval echo '${'$as_ac_Header'}'` = yes; then
8493 cat >>confdefs.h <<_ACEOF 12700 cat >>confdefs.h <<_ACEOF
8494#define HAVE_LIBGEN_H 1 12701#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
8495_ACEOF 12702_ACEOF
8496 12703
8497fi 12704fi
@@ -8507,18 +12714,102 @@ fi
8507done 12714done
8508 12715
8509 12716
8510ac_fn_c_check_func "$LINENO" "getspnam" "ac_cv_func_getspnam" 12717{ echo "$as_me:$LINENO: checking for getspnam" >&5
8511if test "x$ac_cv_func_getspnam" = xyes; then : 12718echo $ECHO_N "checking for getspnam... $ECHO_C" >&6; }
12719if test "${ac_cv_func_getspnam+set}" = set; then
12720 echo $ECHO_N "(cached) $ECHO_C" >&6
12721else
12722 cat >conftest.$ac_ext <<_ACEOF
12723/* confdefs.h. */
12724_ACEOF
12725cat confdefs.h >>conftest.$ac_ext
12726cat >>conftest.$ac_ext <<_ACEOF
12727/* end confdefs.h. */
12728/* Define getspnam to an innocuous variant, in case <limits.h> declares getspnam.
12729 For example, HP-UX 11i <limits.h> declares gettimeofday. */
12730#define getspnam innocuous_getspnam
12731
12732/* System header to define __stub macros and hopefully few prototypes,
12733 which can conflict with char getspnam (); below.
12734 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
12735 <limits.h> exists even on freestanding compilers. */
12736
12737#ifdef __STDC__
12738# include <limits.h>
12739#else
12740# include <assert.h>
12741#endif
12742
12743#undef getspnam
12744
12745/* Override any GCC internal prototype to avoid an error.
12746 Use char because int might match the return type of a GCC
12747 builtin and then its argument prototype would still apply. */
12748#ifdef __cplusplus
12749extern "C"
12750#endif
12751char getspnam ();
12752/* The GNU C library defines this for functions which it implements
12753 to always fail with ENOSYS. Some functions are actually named
12754 something starting with __ and the normal name is an alias. */
12755#if defined __stub_getspnam || defined __stub___getspnam
12756choke me
12757#endif
8512 12758
12759int
12760main ()
12761{
12762return getspnam ();
12763 ;
12764 return 0;
12765}
12766_ACEOF
12767rm -f conftest.$ac_objext conftest$ac_exeext
12768if { (ac_try="$ac_link"
12769case "(($ac_try" in
12770 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12771 *) ac_try_echo=$ac_try;;
12772esac
12773eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12774 (eval "$ac_link") 2>conftest.er1
12775 ac_status=$?
12776 grep -v '^ *+' conftest.er1 >conftest.err
12777 rm -f conftest.er1
12778 cat conftest.err >&5
12779 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12780 (exit $ac_status); } && {
12781 test -z "$ac_c_werror_flag" ||
12782 test ! -s conftest.err
12783 } && test -s conftest$ac_exeext &&
12784 $as_test_x conftest$ac_exeext; then
12785 ac_cv_func_getspnam=yes
8513else 12786else
8514 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getspnam in -lgen" >&5 12787 echo "$as_me: failed program was:" >&5
8515$as_echo_n "checking for getspnam in -lgen... " >&6; } 12788sed 's/^/| /' conftest.$ac_ext >&5
8516if ${ac_cv_lib_gen_getspnam+:} false; then : 12789
8517 $as_echo_n "(cached) " >&6 12790 ac_cv_func_getspnam=no
12791fi
12792
12793rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12794 conftest$ac_exeext conftest.$ac_ext
12795fi
12796{ echo "$as_me:$LINENO: result: $ac_cv_func_getspnam" >&5
12797echo "${ECHO_T}$ac_cv_func_getspnam" >&6; }
12798if test $ac_cv_func_getspnam = yes; then
12799 :
12800else
12801 { echo "$as_me:$LINENO: checking for getspnam in -lgen" >&5
12802echo $ECHO_N "checking for getspnam in -lgen... $ECHO_C" >&6; }
12803if test "${ac_cv_lib_gen_getspnam+set}" = set; then
12804 echo $ECHO_N "(cached) $ECHO_C" >&6
8518else 12805else
8519 ac_check_lib_save_LIBS=$LIBS 12806 ac_check_lib_save_LIBS=$LIBS
8520LIBS="-lgen $LIBS" 12807LIBS="-lgen $LIBS"
8521cat confdefs.h - <<_ACEOF >conftest.$ac_ext 12808cat >conftest.$ac_ext <<_ACEOF
12809/* confdefs.h. */
12810_ACEOF
12811cat confdefs.h >>conftest.$ac_ext
12812cat >>conftest.$ac_ext <<_ACEOF
8522/* end confdefs.h. */ 12813/* end confdefs.h. */
8523 12814
8524/* Override any GCC internal prototype to avoid an error. 12815/* Override any GCC internal prototype to avoid an error.
@@ -8536,30 +12827,55 @@ return getspnam ();
8536 return 0; 12827 return 0;
8537} 12828}
8538_ACEOF 12829_ACEOF
8539if ac_fn_c_try_link "$LINENO"; then : 12830rm -f conftest.$ac_objext conftest$ac_exeext
12831if { (ac_try="$ac_link"
12832case "(($ac_try" in
12833 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12834 *) ac_try_echo=$ac_try;;
12835esac
12836eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12837 (eval "$ac_link") 2>conftest.er1
12838 ac_status=$?
12839 grep -v '^ *+' conftest.er1 >conftest.err
12840 rm -f conftest.er1
12841 cat conftest.err >&5
12842 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12843 (exit $ac_status); } && {
12844 test -z "$ac_c_werror_flag" ||
12845 test ! -s conftest.err
12846 } && test -s conftest$ac_exeext &&
12847 $as_test_x conftest$ac_exeext; then
8540 ac_cv_lib_gen_getspnam=yes 12848 ac_cv_lib_gen_getspnam=yes
8541else 12849else
8542 ac_cv_lib_gen_getspnam=no 12850 echo "$as_me: failed program was:" >&5
12851sed 's/^/| /' conftest.$ac_ext >&5
12852
12853 ac_cv_lib_gen_getspnam=no
8543fi 12854fi
8544rm -f core conftest.err conftest.$ac_objext \ 12855
8545 conftest$ac_exeext conftest.$ac_ext 12856rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12857 conftest$ac_exeext conftest.$ac_ext
8546LIBS=$ac_check_lib_save_LIBS 12858LIBS=$ac_check_lib_save_LIBS
8547fi 12859fi
8548{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_getspnam" >&5 12860{ echo "$as_me:$LINENO: result: $ac_cv_lib_gen_getspnam" >&5
8549$as_echo "$ac_cv_lib_gen_getspnam" >&6; } 12861echo "${ECHO_T}$ac_cv_lib_gen_getspnam" >&6; }
8550if test "x$ac_cv_lib_gen_getspnam" = xyes; then : 12862if test $ac_cv_lib_gen_getspnam = yes; then
8551 LIBS="$LIBS -lgen" 12863 LIBS="$LIBS -lgen"
8552fi 12864fi
8553 12865
8554fi 12866fi
8555 12867
8556{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing basename" >&5 12868{ echo "$as_me:$LINENO: checking for library containing basename" >&5
8557$as_echo_n "checking for library containing basename... " >&6; } 12869echo $ECHO_N "checking for library containing basename... $ECHO_C" >&6; }
8558if ${ac_cv_search_basename+:} false; then : 12870if test "${ac_cv_search_basename+set}" = set; then
8559 $as_echo_n "(cached) " >&6 12871 echo $ECHO_N "(cached) $ECHO_C" >&6
8560else 12872else
8561 ac_func_search_save_LIBS=$LIBS 12873 ac_func_search_save_LIBS=$LIBS
8562cat confdefs.h - <<_ACEOF >conftest.$ac_ext 12874cat >conftest.$ac_ext <<_ACEOF
12875/* confdefs.h. */
12876_ACEOF
12877cat confdefs.h >>conftest.$ac_ext
12878cat >>conftest.$ac_ext <<_ACEOF
8563/* end confdefs.h. */ 12879/* end confdefs.h. */
8564 12880
8565/* Override any GCC internal prototype to avoid an error. 12881/* Override any GCC internal prototype to avoid an error.
@@ -8584,39 +12900,66 @@ for ac_lib in '' gen; do
8584 ac_res=-l$ac_lib 12900 ac_res=-l$ac_lib
8585 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 12901 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
8586 fi 12902 fi
8587 if ac_fn_c_try_link "$LINENO"; then : 12903 rm -f conftest.$ac_objext conftest$ac_exeext
12904if { (ac_try="$ac_link"
12905case "(($ac_try" in
12906 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12907 *) ac_try_echo=$ac_try;;
12908esac
12909eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12910 (eval "$ac_link") 2>conftest.er1
12911 ac_status=$?
12912 grep -v '^ *+' conftest.er1 >conftest.err
12913 rm -f conftest.er1
12914 cat conftest.err >&5
12915 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12916 (exit $ac_status); } && {
12917 test -z "$ac_c_werror_flag" ||
12918 test ! -s conftest.err
12919 } && test -s conftest$ac_exeext &&
12920 $as_test_x conftest$ac_exeext; then
8588 ac_cv_search_basename=$ac_res 12921 ac_cv_search_basename=$ac_res
12922else
12923 echo "$as_me: failed program was:" >&5
12924sed 's/^/| /' conftest.$ac_ext >&5
12925
12926
8589fi 12927fi
8590rm -f core conftest.err conftest.$ac_objext \ 12928
8591 conftest$ac_exeext 12929rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8592 if ${ac_cv_search_basename+:} false; then : 12930 conftest$ac_exeext
12931 if test "${ac_cv_search_basename+set}" = set; then
8593 break 12932 break
8594fi 12933fi
8595done 12934done
8596if ${ac_cv_search_basename+:} false; then : 12935if test "${ac_cv_search_basename+set}" = set; then
8597 12936 :
8598else 12937else
8599 ac_cv_search_basename=no 12938 ac_cv_search_basename=no
8600fi 12939fi
8601rm conftest.$ac_ext 12940rm conftest.$ac_ext
8602LIBS=$ac_func_search_save_LIBS 12941LIBS=$ac_func_search_save_LIBS
8603fi 12942fi
8604{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_basename" >&5 12943{ echo "$as_me:$LINENO: result: $ac_cv_search_basename" >&5
8605$as_echo "$ac_cv_search_basename" >&6; } 12944echo "${ECHO_T}$ac_cv_search_basename" >&6; }
8606ac_res=$ac_cv_search_basename 12945ac_res=$ac_cv_search_basename
8607if test "$ac_res" != no; then : 12946if test "$ac_res" != no; then
8608 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 12947 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
8609 12948
8610$as_echo "#define HAVE_BASENAME 1" >>confdefs.h 12949cat >>confdefs.h <<\_ACEOF
12950#define HAVE_BASENAME 1
12951_ACEOF
8611 12952
8612fi 12953fi
8613 12954
8614 12955
8615 12956
8616# Check whether --with-zlib was given. 12957# Check whether --with-zlib was given.
8617if test "${with_zlib+set}" = set; then : 12958if test "${with_zlib+set}" = set; then
8618 withval=$with_zlib; if test "x$withval" = "xno" ; then 12959 withval=$with_zlib; if test "x$withval" = "xno" ; then
8619 as_fn_error $? "*** zlib is required ***" "$LINENO" 5 12960 { { echo "$as_me:$LINENO: error: *** zlib is required ***" >&5
12961echo "$as_me: error: *** zlib is required ***" >&2;}
12962 { (exit 1); exit 1; }; }
8620 elif test "x$withval" != "xyes"; then 12963 elif test "x$withval" != "xyes"; then
8621 if test -d "$withval/lib"; then 12964 if test -d "$withval/lib"; then
8622 if test -n "${need_dash_r}"; then 12965 if test -n "${need_dash_r}"; then
@@ -8641,22 +12984,158 @@ if test "${with_zlib+set}" = set; then :
8641fi 12984fi
8642 12985
8643 12986
8644ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" 12987if test "${ac_cv_header_zlib_h+set}" = set; then
8645if test "x$ac_cv_header_zlib_h" = xyes; then : 12988 { echo "$as_me:$LINENO: checking for zlib.h" >&5
12989echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
12990if test "${ac_cv_header_zlib_h+set}" = set; then
12991 echo $ECHO_N "(cached) $ECHO_C" >&6
12992fi
12993{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
12994echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
12995else
12996 # Is the header compilable?
12997{ echo "$as_me:$LINENO: checking zlib.h usability" >&5
12998echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6; }
12999cat >conftest.$ac_ext <<_ACEOF
13000/* confdefs.h. */
13001_ACEOF
13002cat confdefs.h >>conftest.$ac_ext
13003cat >>conftest.$ac_ext <<_ACEOF
13004/* end confdefs.h. */
13005$ac_includes_default
13006#include <zlib.h>
13007_ACEOF
13008rm -f conftest.$ac_objext
13009if { (ac_try="$ac_compile"
13010case "(($ac_try" in
13011 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13012 *) ac_try_echo=$ac_try;;
13013esac
13014eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13015 (eval "$ac_compile") 2>conftest.er1
13016 ac_status=$?
13017 grep -v '^ *+' conftest.er1 >conftest.err
13018 rm -f conftest.er1
13019 cat conftest.err >&5
13020 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13021 (exit $ac_status); } && {
13022 test -z "$ac_c_werror_flag" ||
13023 test ! -s conftest.err
13024 } && test -s conftest.$ac_objext; then
13025 ac_header_compiler=yes
13026else
13027 echo "$as_me: failed program was:" >&5
13028sed 's/^/| /' conftest.$ac_ext >&5
13029
13030 ac_header_compiler=no
13031fi
13032
13033rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13034{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
13035echo "${ECHO_T}$ac_header_compiler" >&6; }
13036
13037# Is the header present?
13038{ echo "$as_me:$LINENO: checking zlib.h presence" >&5
13039echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6; }
13040cat >conftest.$ac_ext <<_ACEOF
13041/* confdefs.h. */
13042_ACEOF
13043cat confdefs.h >>conftest.$ac_ext
13044cat >>conftest.$ac_ext <<_ACEOF
13045/* end confdefs.h. */
13046#include <zlib.h>
13047_ACEOF
13048if { (ac_try="$ac_cpp conftest.$ac_ext"
13049case "(($ac_try" in
13050 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13051 *) ac_try_echo=$ac_try;;
13052esac
13053eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13054 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
13055 ac_status=$?
13056 grep -v '^ *+' conftest.er1 >conftest.err
13057 rm -f conftest.er1
13058 cat conftest.err >&5
13059 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13060 (exit $ac_status); } >/dev/null && {
13061 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
13062 test ! -s conftest.err
13063 }; then
13064 ac_header_preproc=yes
13065else
13066 echo "$as_me: failed program was:" >&5
13067sed 's/^/| /' conftest.$ac_ext >&5
13068
13069 ac_header_preproc=no
13070fi
13071
13072rm -f conftest.err conftest.$ac_ext
13073{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
13074echo "${ECHO_T}$ac_header_preproc" >&6; }
8646 13075
13076# So? What about this header?
13077case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
13078 yes:no: )
13079 { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
13080echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
13081 { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
13082echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
13083 ac_header_preproc=yes
13084 ;;
13085 no:yes:* )
13086 { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
13087echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
13088 { echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5
13089echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;}
13090 { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
13091echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
13092 { echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5
13093echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
13094 { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
13095echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
13096 { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
13097echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
13098 ( cat <<\_ASBOX
13099## ------------------------------------------- ##
13100## Report this to openssh-unix-dev@mindrot.org ##
13101## ------------------------------------------- ##
13102_ASBOX
13103 ) | sed "s/^/$as_me: WARNING: /" >&2
13104 ;;
13105esac
13106{ echo "$as_me:$LINENO: checking for zlib.h" >&5
13107echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
13108if test "${ac_cv_header_zlib_h+set}" = set; then
13109 echo $ECHO_N "(cached) $ECHO_C" >&6
8647else 13110else
8648 as_fn_error $? "*** zlib.h missing - please install first or check config.log ***" "$LINENO" 5 13111 ac_cv_header_zlib_h=$ac_header_preproc
13112fi
13113{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
13114echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
13115
13116fi
13117if test $ac_cv_header_zlib_h = yes; then
13118 :
13119else
13120 { { echo "$as_me:$LINENO: error: *** zlib.h missing - please install first or check config.log ***" >&5
13121echo "$as_me: error: *** zlib.h missing - please install first or check config.log ***" >&2;}
13122 { (exit 1); exit 1; }; }
8649fi 13123fi
8650 13124
8651 13125
8652{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 13126
8653$as_echo_n "checking for deflate in -lz... " >&6; } 13127{ echo "$as_me:$LINENO: checking for deflate in -lz" >&5
8654if ${ac_cv_lib_z_deflate+:} false; then : 13128echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6; }
8655 $as_echo_n "(cached) " >&6 13129if test "${ac_cv_lib_z_deflate+set}" = set; then
13130 echo $ECHO_N "(cached) $ECHO_C" >&6
8656else 13131else
8657 ac_check_lib_save_LIBS=$LIBS 13132 ac_check_lib_save_LIBS=$LIBS
8658LIBS="-lz $LIBS" 13133LIBS="-lz $LIBS"
8659cat confdefs.h - <<_ACEOF >conftest.$ac_ext 13134cat >conftest.$ac_ext <<_ACEOF
13135/* confdefs.h. */
13136_ACEOF
13137cat confdefs.h >>conftest.$ac_ext
13138cat >>conftest.$ac_ext <<_ACEOF
8660/* end confdefs.h. */ 13139/* end confdefs.h. */
8661 13140
8662/* Override any GCC internal prototype to avoid an error. 13141/* Override any GCC internal prototype to avoid an error.
@@ -8674,18 +13153,39 @@ return deflate ();
8674 return 0; 13153 return 0;
8675} 13154}
8676_ACEOF 13155_ACEOF
8677if ac_fn_c_try_link "$LINENO"; then : 13156rm -f conftest.$ac_objext conftest$ac_exeext
13157if { (ac_try="$ac_link"
13158case "(($ac_try" in
13159 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13160 *) ac_try_echo=$ac_try;;
13161esac
13162eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13163 (eval "$ac_link") 2>conftest.er1
13164 ac_status=$?
13165 grep -v '^ *+' conftest.er1 >conftest.err
13166 rm -f conftest.er1
13167 cat conftest.err >&5
13168 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13169 (exit $ac_status); } && {
13170 test -z "$ac_c_werror_flag" ||
13171 test ! -s conftest.err
13172 } && test -s conftest$ac_exeext &&
13173 $as_test_x conftest$ac_exeext; then
8678 ac_cv_lib_z_deflate=yes 13174 ac_cv_lib_z_deflate=yes
8679else 13175else
8680 ac_cv_lib_z_deflate=no 13176 echo "$as_me: failed program was:" >&5
13177sed 's/^/| /' conftest.$ac_ext >&5
13178
13179 ac_cv_lib_z_deflate=no
8681fi 13180fi
8682rm -f core conftest.err conftest.$ac_objext \ 13181
8683 conftest$ac_exeext conftest.$ac_ext 13182rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
13183 conftest$ac_exeext conftest.$ac_ext
8684LIBS=$ac_check_lib_save_LIBS 13184LIBS=$ac_check_lib_save_LIBS
8685fi 13185fi
8686{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5 13186{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5
8687$as_echo "$ac_cv_lib_z_deflate" >&6; } 13187echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6; }
8688if test "x$ac_cv_lib_z_deflate" = xyes; then : 13188if test $ac_cv_lib_z_deflate = yes; then
8689 cat >>confdefs.h <<_ACEOF 13189 cat >>confdefs.h <<_ACEOF
8690#define HAVE_LIBZ 1 13190#define HAVE_LIBZ 1
8691_ACEOF 13191_ACEOF
@@ -8704,7 +13204,11 @@ else
8704 fi 13204 fi
8705 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}" 13205 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
8706 LIBS="$LIBS -lz" 13206 LIBS="$LIBS -lz"
8707 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 13207 cat >conftest.$ac_ext <<_ACEOF
13208/* confdefs.h. */
13209_ACEOF
13210cat confdefs.h >>conftest.$ac_ext
13211cat >>conftest.$ac_ext <<_ACEOF
8708/* end confdefs.h. */ 13212/* end confdefs.h. */
8709 13213
8710/* Override any GCC internal prototype to avoid an error. 13214/* Override any GCC internal prototype to avoid an error.
@@ -8722,17 +13226,42 @@ return deflate ();
8722 return 0; 13226 return 0;
8723} 13227}
8724_ACEOF 13228_ACEOF
8725if ac_fn_c_try_link "$LINENO"; then : 13229rm -f conftest.$ac_objext conftest$ac_exeext
8726 $as_echo "#define HAVE_LIBZ 1" >>confdefs.h 13230if { (ac_try="$ac_link"
13231case "(($ac_try" in
13232 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13233 *) ac_try_echo=$ac_try;;
13234esac
13235eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13236 (eval "$ac_link") 2>conftest.er1
13237 ac_status=$?
13238 grep -v '^ *+' conftest.er1 >conftest.err
13239 rm -f conftest.er1
13240 cat conftest.err >&5
13241 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13242 (exit $ac_status); } && {
13243 test -z "$ac_c_werror_flag" ||
13244 test ! -s conftest.err
13245 } && test -s conftest$ac_exeext &&
13246 $as_test_x conftest$ac_exeext; then
13247 cat >>confdefs.h <<\_ACEOF
13248#define HAVE_LIBZ 1
13249_ACEOF
8727 13250
8728else 13251else
13252 echo "$as_me: failed program was:" >&5
13253sed 's/^/| /' conftest.$ac_ext >&5
13254
8729 13255
8730 as_fn_error $? "*** zlib missing - please install first or check config.log ***" "$LINENO" 5 13256 { { echo "$as_me:$LINENO: error: *** zlib missing - please install first or check config.log ***" >&5
13257echo "$as_me: error: *** zlib missing - please install first or check config.log ***" >&2;}
13258 { (exit 1); exit 1; }; }
8731 13259
8732 13260
8733fi 13261fi
8734rm -f core conftest.err conftest.$ac_objext \ 13262
8735 conftest$ac_exeext conftest.$ac_ext 13263rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
13264 conftest$ac_exeext conftest.$ac_ext
8736 13265
8737 13266
8738fi 13267fi
@@ -8740,7 +13269,7 @@ fi
8740 13269
8741 13270
8742# Check whether --with-zlib-version-check was given. 13271# Check whether --with-zlib-version-check was given.
8743if test "${with_zlib_version_check+set}" = set; then : 13272if test "${with_zlib_version_check+set}" = set; then
8744 withval=$with_zlib_version_check; if test "x$withval" = "xno" ; then 13273 withval=$with_zlib_version_check; if test "x$withval" = "xno" ; then
8745 zlib_check_nonfatal=1 13274 zlib_check_nonfatal=1
8746 fi 13275 fi
@@ -8749,14 +13278,18 @@ if test "${with_zlib_version_check+set}" = set; then :
8749fi 13278fi
8750 13279
8751 13280
8752{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for possibly buggy zlib" >&5 13281{ echo "$as_me:$LINENO: checking for possibly buggy zlib" >&5
8753$as_echo_n "checking for possibly buggy zlib... " >&6; } 13282echo $ECHO_N "checking for possibly buggy zlib... $ECHO_C" >&6; }
8754if test "$cross_compiling" = yes; then : 13283if test "$cross_compiling" = yes; then
8755 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking zlib version" >&5 13284 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking zlib version" >&5
8756$as_echo "$as_me: WARNING: cross compiling: not checking zlib version" >&2;} 13285echo "$as_me: WARNING: cross compiling: not checking zlib version" >&2;}
8757 13286
8758else 13287else
8759 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 13288 cat >conftest.$ac_ext <<_ACEOF
13289/* confdefs.h. */
13290_ACEOF
13291cat confdefs.h >>conftest.$ac_ext
13292cat >>conftest.$ac_ext <<_ACEOF
8760/* end confdefs.h. */ 13293/* end confdefs.h. */
8761 13294
8762#include <stdio.h> 13295#include <stdio.h>
@@ -8788,43 +13321,159 @@ main ()
8788 return 0; 13321 return 0;
8789} 13322}
8790_ACEOF 13323_ACEOF
8791if ac_fn_c_try_run "$LINENO"; then : 13324rm -f conftest$ac_exeext
8792 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 13325if { (ac_try="$ac_link"
8793$as_echo "no" >&6; } 13326case "(($ac_try" in
13327 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13328 *) ac_try_echo=$ac_try;;
13329esac
13330eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13331 (eval "$ac_link") 2>&5
13332 ac_status=$?
13333 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13334 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
13335 { (case "(($ac_try" in
13336 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13337 *) ac_try_echo=$ac_try;;
13338esac
13339eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13340 (eval "$ac_try") 2>&5
13341 ac_status=$?
13342 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13343 (exit $ac_status); }; }; then
13344 { echo "$as_me:$LINENO: result: no" >&5
13345echo "${ECHO_T}no" >&6; }
8794else 13346else
8795 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 13347 echo "$as_me: program exited with status $ac_status" >&5
8796$as_echo "yes" >&6; } 13348echo "$as_me: failed program was:" >&5
13349sed 's/^/| /' conftest.$ac_ext >&5
13350
13351( exit $ac_status )
13352 { echo "$as_me:$LINENO: result: yes" >&5
13353echo "${ECHO_T}yes" >&6; }
8797 if test -z "$zlib_check_nonfatal" ; then 13354 if test -z "$zlib_check_nonfatal" ; then
8798 as_fn_error $? "*** zlib too old - check config.log *** 13355 { { echo "$as_me:$LINENO: error: *** zlib too old - check config.log ***
8799Your reported zlib version has known security problems. It's possible your 13356Your reported zlib version has known security problems. It's possible your
8800vendor has fixed these problems without changing the version number. If you 13357vendor has fixed these problems without changing the version number. If you
8801are sure this is the case, you can disable the check by running 13358are sure this is the case, you can disable the check by running
8802\"./configure --without-zlib-version-check\". 13359\"./configure --without-zlib-version-check\".
8803If you are in doubt, upgrade zlib to version 1.2.3 or greater. 13360If you are in doubt, upgrade zlib to version 1.2.3 or greater.
8804See http://www.gzip.org/zlib/ for details." "$LINENO" 5 13361See http://www.gzip.org/zlib/ for details." >&5
13362echo "$as_me: error: *** zlib too old - check config.log ***
13363Your reported zlib version has known security problems. It's possible your
13364vendor has fixed these problems without changing the version number. If you
13365are sure this is the case, you can disable the check by running
13366\"./configure --without-zlib-version-check\".
13367If you are in doubt, upgrade zlib to version 1.2.3 or greater.
13368See http://www.gzip.org/zlib/ for details." >&2;}
13369 { (exit 1); exit 1; }; }
8805 else 13370 else
8806 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: zlib version may have security problems" >&5 13371 { echo "$as_me:$LINENO: WARNING: zlib version may have security problems" >&5
8807$as_echo "$as_me: WARNING: zlib version may have security problems" >&2;} 13372echo "$as_me: WARNING: zlib version may have security problems" >&2;}
8808 fi 13373 fi
8809 13374
8810fi 13375fi
8811rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 13376rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
8812 conftest.$ac_objext conftest.beam conftest.$ac_ext
8813fi 13377fi
8814 13378
8815 13379
8816ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp"
8817if test "x$ac_cv_func_strcasecmp" = xyes; then :
8818 13380
13381{ echo "$as_me:$LINENO: checking for strcasecmp" >&5
13382echo $ECHO_N "checking for strcasecmp... $ECHO_C" >&6; }
13383if test "${ac_cv_func_strcasecmp+set}" = set; then
13384 echo $ECHO_N "(cached) $ECHO_C" >&6
13385else
13386 cat >conftest.$ac_ext <<_ACEOF
13387/* confdefs.h. */
13388_ACEOF
13389cat confdefs.h >>conftest.$ac_ext
13390cat >>conftest.$ac_ext <<_ACEOF
13391/* end confdefs.h. */
13392/* Define strcasecmp to an innocuous variant, in case <limits.h> declares strcasecmp.
13393 For example, HP-UX 11i <limits.h> declares gettimeofday. */
13394#define strcasecmp innocuous_strcasecmp
13395
13396/* System header to define __stub macros and hopefully few prototypes,
13397 which can conflict with char strcasecmp (); below.
13398 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
13399 <limits.h> exists even on freestanding compilers. */
13400
13401#ifdef __STDC__
13402# include <limits.h>
13403#else
13404# include <assert.h>
13405#endif
13406
13407#undef strcasecmp
13408
13409/* Override any GCC internal prototype to avoid an error.
13410 Use char because int might match the return type of a GCC
13411 builtin and then its argument prototype would still apply. */
13412#ifdef __cplusplus
13413extern "C"
13414#endif
13415char strcasecmp ();
13416/* The GNU C library defines this for functions which it implements
13417 to always fail with ENOSYS. Some functions are actually named
13418 something starting with __ and the normal name is an alias. */
13419#if defined __stub_strcasecmp || defined __stub___strcasecmp
13420choke me
13421#endif
13422
13423int
13424main ()
13425{
13426return strcasecmp ();
13427 ;
13428 return 0;
13429}
13430_ACEOF
13431rm -f conftest.$ac_objext conftest$ac_exeext
13432if { (ac_try="$ac_link"
13433case "(($ac_try" in
13434 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13435 *) ac_try_echo=$ac_try;;
13436esac
13437eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13438 (eval "$ac_link") 2>conftest.er1
13439 ac_status=$?
13440 grep -v '^ *+' conftest.er1 >conftest.err
13441 rm -f conftest.er1
13442 cat conftest.err >&5
13443 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13444 (exit $ac_status); } && {
13445 test -z "$ac_c_werror_flag" ||
13446 test ! -s conftest.err
13447 } && test -s conftest$ac_exeext &&
13448 $as_test_x conftest$ac_exeext; then
13449 ac_cv_func_strcasecmp=yes
13450else
13451 echo "$as_me: failed program was:" >&5
13452sed 's/^/| /' conftest.$ac_ext >&5
13453
13454 ac_cv_func_strcasecmp=no
13455fi
13456
13457rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
13458 conftest$ac_exeext conftest.$ac_ext
13459fi
13460{ echo "$as_me:$LINENO: result: $ac_cv_func_strcasecmp" >&5
13461echo "${ECHO_T}$ac_cv_func_strcasecmp" >&6; }
13462if test $ac_cv_func_strcasecmp = yes; then
13463 :
8819else 13464else
8820 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strcasecmp in -lresolv" >&5 13465 { echo "$as_me:$LINENO: checking for strcasecmp in -lresolv" >&5
8821$as_echo_n "checking for strcasecmp in -lresolv... " >&6; } 13466echo $ECHO_N "checking for strcasecmp in -lresolv... $ECHO_C" >&6; }
8822if ${ac_cv_lib_resolv_strcasecmp+:} false; then : 13467if test "${ac_cv_lib_resolv_strcasecmp+set}" = set; then
8823 $as_echo_n "(cached) " >&6 13468 echo $ECHO_N "(cached) $ECHO_C" >&6
8824else 13469else
8825 ac_check_lib_save_LIBS=$LIBS 13470 ac_check_lib_save_LIBS=$LIBS
8826LIBS="-lresolv $LIBS" 13471LIBS="-lresolv $LIBS"
8827cat confdefs.h - <<_ACEOF >conftest.$ac_ext 13472cat >conftest.$ac_ext <<_ACEOF
13473/* confdefs.h. */
13474_ACEOF
13475cat confdefs.h >>conftest.$ac_ext
13476cat >>conftest.$ac_ext <<_ACEOF
8828/* end confdefs.h. */ 13477/* end confdefs.h. */
8829 13478
8830/* Override any GCC internal prototype to avoid an error. 13479/* Override any GCC internal prototype to avoid an error.
@@ -8842,41 +13491,149 @@ return strcasecmp ();
8842 return 0; 13491 return 0;
8843} 13492}
8844_ACEOF 13493_ACEOF
8845if ac_fn_c_try_link "$LINENO"; then : 13494rm -f conftest.$ac_objext conftest$ac_exeext
13495if { (ac_try="$ac_link"
13496case "(($ac_try" in
13497 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13498 *) ac_try_echo=$ac_try;;
13499esac
13500eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13501 (eval "$ac_link") 2>conftest.er1
13502 ac_status=$?
13503 grep -v '^ *+' conftest.er1 >conftest.err
13504 rm -f conftest.er1
13505 cat conftest.err >&5
13506 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13507 (exit $ac_status); } && {
13508 test -z "$ac_c_werror_flag" ||
13509 test ! -s conftest.err
13510 } && test -s conftest$ac_exeext &&
13511 $as_test_x conftest$ac_exeext; then
8846 ac_cv_lib_resolv_strcasecmp=yes 13512 ac_cv_lib_resolv_strcasecmp=yes
8847else 13513else
8848 ac_cv_lib_resolv_strcasecmp=no 13514 echo "$as_me: failed program was:" >&5
13515sed 's/^/| /' conftest.$ac_ext >&5
13516
13517 ac_cv_lib_resolv_strcasecmp=no
8849fi 13518fi
8850rm -f core conftest.err conftest.$ac_objext \ 13519
8851 conftest$ac_exeext conftest.$ac_ext 13520rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
13521 conftest$ac_exeext conftest.$ac_ext
8852LIBS=$ac_check_lib_save_LIBS 13522LIBS=$ac_check_lib_save_LIBS
8853fi 13523fi
8854{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_strcasecmp" >&5 13524{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_strcasecmp" >&5
8855$as_echo "$ac_cv_lib_resolv_strcasecmp" >&6; } 13525echo "${ECHO_T}$ac_cv_lib_resolv_strcasecmp" >&6; }
8856if test "x$ac_cv_lib_resolv_strcasecmp" = xyes; then : 13526if test $ac_cv_lib_resolv_strcasecmp = yes; then
8857 LIBS="$LIBS -lresolv" 13527 LIBS="$LIBS -lresolv"
8858fi 13528fi
8859 13529
8860 13530
8861fi 13531fi
8862 13532
13533
8863for ac_func in utimes 13534for ac_func in utimes
8864do : 13535do
8865 ac_fn_c_check_func "$LINENO" "utimes" "ac_cv_func_utimes" 13536as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
8866if test "x$ac_cv_func_utimes" = xyes; then : 13537{ echo "$as_me:$LINENO: checking for $ac_func" >&5
13538echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
13539if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
13540 echo $ECHO_N "(cached) $ECHO_C" >&6
13541else
13542 cat >conftest.$ac_ext <<_ACEOF
13543/* confdefs.h. */
13544_ACEOF
13545cat confdefs.h >>conftest.$ac_ext
13546cat >>conftest.$ac_ext <<_ACEOF
13547/* end confdefs.h. */
13548/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
13549 For example, HP-UX 11i <limits.h> declares gettimeofday. */
13550#define $ac_func innocuous_$ac_func
13551
13552/* System header to define __stub macros and hopefully few prototypes,
13553 which can conflict with char $ac_func (); below.
13554 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
13555 <limits.h> exists even on freestanding compilers. */
13556
13557#ifdef __STDC__
13558# include <limits.h>
13559#else
13560# include <assert.h>
13561#endif
13562
13563#undef $ac_func
13564
13565/* Override any GCC internal prototype to avoid an error.
13566 Use char because int might match the return type of a GCC
13567 builtin and then its argument prototype would still apply. */
13568#ifdef __cplusplus
13569extern "C"
13570#endif
13571char $ac_func ();
13572/* The GNU C library defines this for functions which it implements
13573 to always fail with ENOSYS. Some functions are actually named
13574 something starting with __ and the normal name is an alias. */
13575#if defined __stub_$ac_func || defined __stub___$ac_func
13576choke me
13577#endif
13578
13579int
13580main ()
13581{
13582return $ac_func ();
13583 ;
13584 return 0;
13585}
13586_ACEOF
13587rm -f conftest.$ac_objext conftest$ac_exeext
13588if { (ac_try="$ac_link"
13589case "(($ac_try" in
13590 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13591 *) ac_try_echo=$ac_try;;
13592esac
13593eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13594 (eval "$ac_link") 2>conftest.er1
13595 ac_status=$?
13596 grep -v '^ *+' conftest.er1 >conftest.err
13597 rm -f conftest.er1
13598 cat conftest.err >&5
13599 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13600 (exit $ac_status); } && {
13601 test -z "$ac_c_werror_flag" ||
13602 test ! -s conftest.err
13603 } && test -s conftest$ac_exeext &&
13604 $as_test_x conftest$ac_exeext; then
13605 eval "$as_ac_var=yes"
13606else
13607 echo "$as_me: failed program was:" >&5
13608sed 's/^/| /' conftest.$ac_ext >&5
13609
13610 eval "$as_ac_var=no"
13611fi
13612
13613rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
13614 conftest$ac_exeext conftest.$ac_ext
13615fi
13616ac_res=`eval echo '${'$as_ac_var'}'`
13617 { echo "$as_me:$LINENO: result: $ac_res" >&5
13618echo "${ECHO_T}$ac_res" >&6; }
13619if test `eval echo '${'$as_ac_var'}'` = yes; then
8867 cat >>confdefs.h <<_ACEOF 13620 cat >>confdefs.h <<_ACEOF
8868#define HAVE_UTIMES 1 13621#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
8869_ACEOF 13622_ACEOF
8870 13623
8871else 13624else
8872 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for utimes in -lc89" >&5 13625 { echo "$as_me:$LINENO: checking for utimes in -lc89" >&5
8873$as_echo_n "checking for utimes in -lc89... " >&6; } 13626echo $ECHO_N "checking for utimes in -lc89... $ECHO_C" >&6; }
8874if ${ac_cv_lib_c89_utimes+:} false; then : 13627if test "${ac_cv_lib_c89_utimes+set}" = set; then
8875 $as_echo_n "(cached) " >&6 13628 echo $ECHO_N "(cached) $ECHO_C" >&6
8876else 13629else
8877 ac_check_lib_save_LIBS=$LIBS 13630 ac_check_lib_save_LIBS=$LIBS
8878LIBS="-lc89 $LIBS" 13631LIBS="-lc89 $LIBS"
8879cat confdefs.h - <<_ACEOF >conftest.$ac_ext 13632cat >conftest.$ac_ext <<_ACEOF
13633/* confdefs.h. */
13634_ACEOF
13635cat confdefs.h >>conftest.$ac_ext
13636cat >>conftest.$ac_ext <<_ACEOF
8880/* end confdefs.h. */ 13637/* end confdefs.h. */
8881 13638
8882/* Override any GCC internal prototype to avoid an error. 13639/* Override any GCC internal prototype to avoid an error.
@@ -8894,19 +13651,42 @@ return utimes ();
8894 return 0; 13651 return 0;
8895} 13652}
8896_ACEOF 13653_ACEOF
8897if ac_fn_c_try_link "$LINENO"; then : 13654rm -f conftest.$ac_objext conftest$ac_exeext
13655if { (ac_try="$ac_link"
13656case "(($ac_try" in
13657 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13658 *) ac_try_echo=$ac_try;;
13659esac
13660eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13661 (eval "$ac_link") 2>conftest.er1
13662 ac_status=$?
13663 grep -v '^ *+' conftest.er1 >conftest.err
13664 rm -f conftest.er1
13665 cat conftest.err >&5
13666 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13667 (exit $ac_status); } && {
13668 test -z "$ac_c_werror_flag" ||
13669 test ! -s conftest.err
13670 } && test -s conftest$ac_exeext &&
13671 $as_test_x conftest$ac_exeext; then
8898 ac_cv_lib_c89_utimes=yes 13672 ac_cv_lib_c89_utimes=yes
8899else 13673else
8900 ac_cv_lib_c89_utimes=no 13674 echo "$as_me: failed program was:" >&5
13675sed 's/^/| /' conftest.$ac_ext >&5
13676
13677 ac_cv_lib_c89_utimes=no
8901fi 13678fi
8902rm -f core conftest.err conftest.$ac_objext \ 13679
8903 conftest$ac_exeext conftest.$ac_ext 13680rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
13681 conftest$ac_exeext conftest.$ac_ext
8904LIBS=$ac_check_lib_save_LIBS 13682LIBS=$ac_check_lib_save_LIBS
8905fi 13683fi
8906{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c89_utimes" >&5 13684{ echo "$as_me:$LINENO: result: $ac_cv_lib_c89_utimes" >&5
8907$as_echo "$ac_cv_lib_c89_utimes" >&6; } 13685echo "${ECHO_T}$ac_cv_lib_c89_utimes" >&6; }
8908if test "x$ac_cv_lib_c89_utimes" = xyes; then : 13686if test $ac_cv_lib_c89_utimes = yes; then
8909 $as_echo "#define HAVE_UTIMES 1" >>confdefs.h 13687 cat >>confdefs.h <<\_ACEOF
13688#define HAVE_UTIMES 1
13689_ACEOF
8910 13690
8911 LIBS="$LIBS -lc89" 13691 LIBS="$LIBS -lc89"
8912fi 13692fi
@@ -8916,26 +13696,163 @@ fi
8916done 13696done
8917 13697
8918 13698
13699
13700
8919for ac_header in bsd/libutil.h libutil.h 13701for ac_header in bsd/libutil.h libutil.h
8920do : 13702do
8921 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 13703as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
8922ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" 13704if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
8923if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : 13705 { echo "$as_me:$LINENO: checking for $ac_header" >&5
13706echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
13707if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
13708 echo $ECHO_N "(cached) $ECHO_C" >&6
13709fi
13710ac_res=`eval echo '${'$as_ac_Header'}'`
13711 { echo "$as_me:$LINENO: result: $ac_res" >&5
13712echo "${ECHO_T}$ac_res" >&6; }
13713else
13714 # Is the header compilable?
13715{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
13716echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
13717cat >conftest.$ac_ext <<_ACEOF
13718/* confdefs.h. */
13719_ACEOF
13720cat confdefs.h >>conftest.$ac_ext
13721cat >>conftest.$ac_ext <<_ACEOF
13722/* end confdefs.h. */
13723$ac_includes_default
13724#include <$ac_header>
13725_ACEOF
13726rm -f conftest.$ac_objext
13727if { (ac_try="$ac_compile"
13728case "(($ac_try" in
13729 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13730 *) ac_try_echo=$ac_try;;
13731esac
13732eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13733 (eval "$ac_compile") 2>conftest.er1
13734 ac_status=$?
13735 grep -v '^ *+' conftest.er1 >conftest.err
13736 rm -f conftest.er1
13737 cat conftest.err >&5
13738 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13739 (exit $ac_status); } && {
13740 test -z "$ac_c_werror_flag" ||
13741 test ! -s conftest.err
13742 } && test -s conftest.$ac_objext; then
13743 ac_header_compiler=yes
13744else
13745 echo "$as_me: failed program was:" >&5
13746sed 's/^/| /' conftest.$ac_ext >&5
13747
13748 ac_header_compiler=no
13749fi
13750
13751rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13752{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
13753echo "${ECHO_T}$ac_header_compiler" >&6; }
13754
13755# Is the header present?
13756{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
13757echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
13758cat >conftest.$ac_ext <<_ACEOF
13759/* confdefs.h. */
13760_ACEOF
13761cat confdefs.h >>conftest.$ac_ext
13762cat >>conftest.$ac_ext <<_ACEOF
13763/* end confdefs.h. */
13764#include <$ac_header>
13765_ACEOF
13766if { (ac_try="$ac_cpp conftest.$ac_ext"
13767case "(($ac_try" in
13768 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13769 *) ac_try_echo=$ac_try;;
13770esac
13771eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13772 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
13773 ac_status=$?
13774 grep -v '^ *+' conftest.er1 >conftest.err
13775 rm -f conftest.er1
13776 cat conftest.err >&5
13777 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13778 (exit $ac_status); } >/dev/null && {
13779 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
13780 test ! -s conftest.err
13781 }; then
13782 ac_header_preproc=yes
13783else
13784 echo "$as_me: failed program was:" >&5
13785sed 's/^/| /' conftest.$ac_ext >&5
13786
13787 ac_header_preproc=no
13788fi
13789
13790rm -f conftest.err conftest.$ac_ext
13791{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
13792echo "${ECHO_T}$ac_header_preproc" >&6; }
13793
13794# So? What about this header?
13795case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
13796 yes:no: )
13797 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
13798echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
13799 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
13800echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
13801 ac_header_preproc=yes
13802 ;;
13803 no:yes:* )
13804 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
13805echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
13806 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
13807echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
13808 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
13809echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
13810 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
13811echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
13812 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
13813echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
13814 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
13815echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
13816 ( cat <<\_ASBOX
13817## ------------------------------------------- ##
13818## Report this to openssh-unix-dev@mindrot.org ##
13819## ------------------------------------------- ##
13820_ASBOX
13821 ) | sed "s/^/$as_me: WARNING: /" >&2
13822 ;;
13823esac
13824{ echo "$as_me:$LINENO: checking for $ac_header" >&5
13825echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
13826if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
13827 echo $ECHO_N "(cached) $ECHO_C" >&6
13828else
13829 eval "$as_ac_Header=\$ac_header_preproc"
13830fi
13831ac_res=`eval echo '${'$as_ac_Header'}'`
13832 { echo "$as_me:$LINENO: result: $ac_res" >&5
13833echo "${ECHO_T}$ac_res" >&6; }
13834
13835fi
13836if test `eval echo '${'$as_ac_Header'}'` = yes; then
8924 cat >>confdefs.h <<_ACEOF 13837 cat >>confdefs.h <<_ACEOF
8925#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 13838#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
8926_ACEOF 13839_ACEOF
8927 13840
8928fi 13841fi
8929 13842
8930done 13843done
8931 13844
8932{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing fmt_scaled" >&5 13845{ echo "$as_me:$LINENO: checking for library containing fmt_scaled" >&5
8933$as_echo_n "checking for library containing fmt_scaled... " >&6; } 13846echo $ECHO_N "checking for library containing fmt_scaled... $ECHO_C" >&6; }
8934if ${ac_cv_search_fmt_scaled+:} false; then : 13847if test "${ac_cv_search_fmt_scaled+set}" = set; then
8935 $as_echo_n "(cached) " >&6 13848 echo $ECHO_N "(cached) $ECHO_C" >&6
8936else 13849else
8937 ac_func_search_save_LIBS=$LIBS 13850 ac_func_search_save_LIBS=$LIBS
8938cat confdefs.h - <<_ACEOF >conftest.$ac_ext 13851cat >conftest.$ac_ext <<_ACEOF
13852/* confdefs.h. */
13853_ACEOF
13854cat confdefs.h >>conftest.$ac_ext
13855cat >>conftest.$ac_ext <<_ACEOF
8939/* end confdefs.h. */ 13856/* end confdefs.h. */
8940 13857
8941/* Override any GCC internal prototype to avoid an error. 13858/* Override any GCC internal prototype to avoid an error.
@@ -8960,38 +13877,65 @@ for ac_lib in '' util bsd; do
8960 ac_res=-l$ac_lib 13877 ac_res=-l$ac_lib
8961 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 13878 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
8962 fi 13879 fi
8963 if ac_fn_c_try_link "$LINENO"; then : 13880 rm -f conftest.$ac_objext conftest$ac_exeext
13881if { (ac_try="$ac_link"
13882case "(($ac_try" in
13883 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13884 *) ac_try_echo=$ac_try;;
13885esac
13886eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13887 (eval "$ac_link") 2>conftest.er1
13888 ac_status=$?
13889 grep -v '^ *+' conftest.er1 >conftest.err
13890 rm -f conftest.er1
13891 cat conftest.err >&5
13892 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13893 (exit $ac_status); } && {
13894 test -z "$ac_c_werror_flag" ||
13895 test ! -s conftest.err
13896 } && test -s conftest$ac_exeext &&
13897 $as_test_x conftest$ac_exeext; then
8964 ac_cv_search_fmt_scaled=$ac_res 13898 ac_cv_search_fmt_scaled=$ac_res
13899else
13900 echo "$as_me: failed program was:" >&5
13901sed 's/^/| /' conftest.$ac_ext >&5
13902
13903
8965fi 13904fi
8966rm -f core conftest.err conftest.$ac_objext \ 13905
8967 conftest$ac_exeext 13906rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8968 if ${ac_cv_search_fmt_scaled+:} false; then : 13907 conftest$ac_exeext
13908 if test "${ac_cv_search_fmt_scaled+set}" = set; then
8969 break 13909 break
8970fi 13910fi
8971done 13911done
8972if ${ac_cv_search_fmt_scaled+:} false; then : 13912if test "${ac_cv_search_fmt_scaled+set}" = set; then
8973 13913 :
8974else 13914else
8975 ac_cv_search_fmt_scaled=no 13915 ac_cv_search_fmt_scaled=no
8976fi 13916fi
8977rm conftest.$ac_ext 13917rm conftest.$ac_ext
8978LIBS=$ac_func_search_save_LIBS 13918LIBS=$ac_func_search_save_LIBS
8979fi 13919fi
8980{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_fmt_scaled" >&5 13920{ echo "$as_me:$LINENO: result: $ac_cv_search_fmt_scaled" >&5
8981$as_echo "$ac_cv_search_fmt_scaled" >&6; } 13921echo "${ECHO_T}$ac_cv_search_fmt_scaled" >&6; }
8982ac_res=$ac_cv_search_fmt_scaled 13922ac_res=$ac_cv_search_fmt_scaled
8983if test "$ac_res" != no; then : 13923if test "$ac_res" != no; then
8984 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 13924 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
8985 13925
8986fi 13926fi
8987 13927
8988{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing scan_scaled" >&5 13928{ echo "$as_me:$LINENO: checking for library containing scan_scaled" >&5
8989$as_echo_n "checking for library containing scan_scaled... " >&6; } 13929echo $ECHO_N "checking for library containing scan_scaled... $ECHO_C" >&6; }
8990if ${ac_cv_search_scan_scaled+:} false; then : 13930if test "${ac_cv_search_scan_scaled+set}" = set; then
8991 $as_echo_n "(cached) " >&6 13931 echo $ECHO_N "(cached) $ECHO_C" >&6
8992else 13932else
8993 ac_func_search_save_LIBS=$LIBS 13933 ac_func_search_save_LIBS=$LIBS
8994cat confdefs.h - <<_ACEOF >conftest.$ac_ext 13934cat >conftest.$ac_ext <<_ACEOF
13935/* confdefs.h. */
13936_ACEOF
13937cat confdefs.h >>conftest.$ac_ext
13938cat >>conftest.$ac_ext <<_ACEOF
8995/* end confdefs.h. */ 13939/* end confdefs.h. */
8996 13940
8997/* Override any GCC internal prototype to avoid an error. 13941/* Override any GCC internal prototype to avoid an error.
@@ -9016,38 +13960,65 @@ for ac_lib in '' util bsd; do
9016 ac_res=-l$ac_lib 13960 ac_res=-l$ac_lib
9017 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 13961 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9018 fi 13962 fi
9019 if ac_fn_c_try_link "$LINENO"; then : 13963 rm -f conftest.$ac_objext conftest$ac_exeext
13964if { (ac_try="$ac_link"
13965case "(($ac_try" in
13966 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
13967 *) ac_try_echo=$ac_try;;
13968esac
13969eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
13970 (eval "$ac_link") 2>conftest.er1
13971 ac_status=$?
13972 grep -v '^ *+' conftest.er1 >conftest.err
13973 rm -f conftest.er1
13974 cat conftest.err >&5
13975 echo "$as_me:$LINENO: \$? = $ac_status" >&5
13976 (exit $ac_status); } && {
13977 test -z "$ac_c_werror_flag" ||
13978 test ! -s conftest.err
13979 } && test -s conftest$ac_exeext &&
13980 $as_test_x conftest$ac_exeext; then
9020 ac_cv_search_scan_scaled=$ac_res 13981 ac_cv_search_scan_scaled=$ac_res
13982else
13983 echo "$as_me: failed program was:" >&5
13984sed 's/^/| /' conftest.$ac_ext >&5
13985
13986
9021fi 13987fi
9022rm -f core conftest.err conftest.$ac_objext \ 13988
9023 conftest$ac_exeext 13989rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9024 if ${ac_cv_search_scan_scaled+:} false; then : 13990 conftest$ac_exeext
13991 if test "${ac_cv_search_scan_scaled+set}" = set; then
9025 break 13992 break
9026fi 13993fi
9027done 13994done
9028if ${ac_cv_search_scan_scaled+:} false; then : 13995if test "${ac_cv_search_scan_scaled+set}" = set; then
9029 13996 :
9030else 13997else
9031 ac_cv_search_scan_scaled=no 13998 ac_cv_search_scan_scaled=no
9032fi 13999fi
9033rm conftest.$ac_ext 14000rm conftest.$ac_ext
9034LIBS=$ac_func_search_save_LIBS 14001LIBS=$ac_func_search_save_LIBS
9035fi 14002fi
9036{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_scan_scaled" >&5 14003{ echo "$as_me:$LINENO: result: $ac_cv_search_scan_scaled" >&5
9037$as_echo "$ac_cv_search_scan_scaled" >&6; } 14004echo "${ECHO_T}$ac_cv_search_scan_scaled" >&6; }
9038ac_res=$ac_cv_search_scan_scaled 14005ac_res=$ac_cv_search_scan_scaled
9039if test "$ac_res" != no; then : 14006if test "$ac_res" != no; then
9040 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14007 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9041 14008
9042fi 14009fi
9043 14010
9044{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing login" >&5 14011{ echo "$as_me:$LINENO: checking for library containing login" >&5
9045$as_echo_n "checking for library containing login... " >&6; } 14012echo $ECHO_N "checking for library containing login... $ECHO_C" >&6; }
9046if ${ac_cv_search_login+:} false; then : 14013if test "${ac_cv_search_login+set}" = set; then
9047 $as_echo_n "(cached) " >&6 14014 echo $ECHO_N "(cached) $ECHO_C" >&6
9048else 14015else
9049 ac_func_search_save_LIBS=$LIBS 14016 ac_func_search_save_LIBS=$LIBS
9050cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14017cat >conftest.$ac_ext <<_ACEOF
14018/* confdefs.h. */
14019_ACEOF
14020cat confdefs.h >>conftest.$ac_ext
14021cat >>conftest.$ac_ext <<_ACEOF
9051/* end confdefs.h. */ 14022/* end confdefs.h. */
9052 14023
9053/* Override any GCC internal prototype to avoid an error. 14024/* Override any GCC internal prototype to avoid an error.
@@ -9072,38 +14043,65 @@ for ac_lib in '' util bsd; do
9072 ac_res=-l$ac_lib 14043 ac_res=-l$ac_lib
9073 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14044 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9074 fi 14045 fi
9075 if ac_fn_c_try_link "$LINENO"; then : 14046 rm -f conftest.$ac_objext conftest$ac_exeext
14047if { (ac_try="$ac_link"
14048case "(($ac_try" in
14049 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14050 *) ac_try_echo=$ac_try;;
14051esac
14052eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14053 (eval "$ac_link") 2>conftest.er1
14054 ac_status=$?
14055 grep -v '^ *+' conftest.er1 >conftest.err
14056 rm -f conftest.er1
14057 cat conftest.err >&5
14058 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14059 (exit $ac_status); } && {
14060 test -z "$ac_c_werror_flag" ||
14061 test ! -s conftest.err
14062 } && test -s conftest$ac_exeext &&
14063 $as_test_x conftest$ac_exeext; then
9076 ac_cv_search_login=$ac_res 14064 ac_cv_search_login=$ac_res
14065else
14066 echo "$as_me: failed program was:" >&5
14067sed 's/^/| /' conftest.$ac_ext >&5
14068
14069
9077fi 14070fi
9078rm -f core conftest.err conftest.$ac_objext \ 14071
9079 conftest$ac_exeext 14072rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9080 if ${ac_cv_search_login+:} false; then : 14073 conftest$ac_exeext
14074 if test "${ac_cv_search_login+set}" = set; then
9081 break 14075 break
9082fi 14076fi
9083done 14077done
9084if ${ac_cv_search_login+:} false; then : 14078if test "${ac_cv_search_login+set}" = set; then
9085 14079 :
9086else 14080else
9087 ac_cv_search_login=no 14081 ac_cv_search_login=no
9088fi 14082fi
9089rm conftest.$ac_ext 14083rm conftest.$ac_ext
9090LIBS=$ac_func_search_save_LIBS 14084LIBS=$ac_func_search_save_LIBS
9091fi 14085fi
9092{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_login" >&5 14086{ echo "$as_me:$LINENO: result: $ac_cv_search_login" >&5
9093$as_echo "$ac_cv_search_login" >&6; } 14087echo "${ECHO_T}$ac_cv_search_login" >&6; }
9094ac_res=$ac_cv_search_login 14088ac_res=$ac_cv_search_login
9095if test "$ac_res" != no; then : 14089if test "$ac_res" != no; then
9096 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14090 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9097 14091
9098fi 14092fi
9099 14093
9100{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing logout" >&5 14094{ echo "$as_me:$LINENO: checking for library containing logout" >&5
9101$as_echo_n "checking for library containing logout... " >&6; } 14095echo $ECHO_N "checking for library containing logout... $ECHO_C" >&6; }
9102if ${ac_cv_search_logout+:} false; then : 14096if test "${ac_cv_search_logout+set}" = set; then
9103 $as_echo_n "(cached) " >&6 14097 echo $ECHO_N "(cached) $ECHO_C" >&6
9104else 14098else
9105 ac_func_search_save_LIBS=$LIBS 14099 ac_func_search_save_LIBS=$LIBS
9106cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14100cat >conftest.$ac_ext <<_ACEOF
14101/* confdefs.h. */
14102_ACEOF
14103cat confdefs.h >>conftest.$ac_ext
14104cat >>conftest.$ac_ext <<_ACEOF
9107/* end confdefs.h. */ 14105/* end confdefs.h. */
9108 14106
9109/* Override any GCC internal prototype to avoid an error. 14107/* Override any GCC internal prototype to avoid an error.
@@ -9128,38 +14126,65 @@ for ac_lib in '' util bsd; do
9128 ac_res=-l$ac_lib 14126 ac_res=-l$ac_lib
9129 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14127 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9130 fi 14128 fi
9131 if ac_fn_c_try_link "$LINENO"; then : 14129 rm -f conftest.$ac_objext conftest$ac_exeext
14130if { (ac_try="$ac_link"
14131case "(($ac_try" in
14132 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14133 *) ac_try_echo=$ac_try;;
14134esac
14135eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14136 (eval "$ac_link") 2>conftest.er1
14137 ac_status=$?
14138 grep -v '^ *+' conftest.er1 >conftest.err
14139 rm -f conftest.er1
14140 cat conftest.err >&5
14141 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14142 (exit $ac_status); } && {
14143 test -z "$ac_c_werror_flag" ||
14144 test ! -s conftest.err
14145 } && test -s conftest$ac_exeext &&
14146 $as_test_x conftest$ac_exeext; then
9132 ac_cv_search_logout=$ac_res 14147 ac_cv_search_logout=$ac_res
14148else
14149 echo "$as_me: failed program was:" >&5
14150sed 's/^/| /' conftest.$ac_ext >&5
14151
14152
9133fi 14153fi
9134rm -f core conftest.err conftest.$ac_objext \ 14154
9135 conftest$ac_exeext 14155rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9136 if ${ac_cv_search_logout+:} false; then : 14156 conftest$ac_exeext
14157 if test "${ac_cv_search_logout+set}" = set; then
9137 break 14158 break
9138fi 14159fi
9139done 14160done
9140if ${ac_cv_search_logout+:} false; then : 14161if test "${ac_cv_search_logout+set}" = set; then
9141 14162 :
9142else 14163else
9143 ac_cv_search_logout=no 14164 ac_cv_search_logout=no
9144fi 14165fi
9145rm conftest.$ac_ext 14166rm conftest.$ac_ext
9146LIBS=$ac_func_search_save_LIBS 14167LIBS=$ac_func_search_save_LIBS
9147fi 14168fi
9148{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_logout" >&5 14169{ echo "$as_me:$LINENO: result: $ac_cv_search_logout" >&5
9149$as_echo "$ac_cv_search_logout" >&6; } 14170echo "${ECHO_T}$ac_cv_search_logout" >&6; }
9150ac_res=$ac_cv_search_logout 14171ac_res=$ac_cv_search_logout
9151if test "$ac_res" != no; then : 14172if test "$ac_res" != no; then
9152 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14173 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9153 14174
9154fi 14175fi
9155 14176
9156{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing logwtmp" >&5 14177{ echo "$as_me:$LINENO: checking for library containing logwtmp" >&5
9157$as_echo_n "checking for library containing logwtmp... " >&6; } 14178echo $ECHO_N "checking for library containing logwtmp... $ECHO_C" >&6; }
9158if ${ac_cv_search_logwtmp+:} false; then : 14179if test "${ac_cv_search_logwtmp+set}" = set; then
9159 $as_echo_n "(cached) " >&6 14180 echo $ECHO_N "(cached) $ECHO_C" >&6
9160else 14181else
9161 ac_func_search_save_LIBS=$LIBS 14182 ac_func_search_save_LIBS=$LIBS
9162cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14183cat >conftest.$ac_ext <<_ACEOF
14184/* confdefs.h. */
14185_ACEOF
14186cat confdefs.h >>conftest.$ac_ext
14187cat >>conftest.$ac_ext <<_ACEOF
9163/* end confdefs.h. */ 14188/* end confdefs.h. */
9164 14189
9165/* Override any GCC internal prototype to avoid an error. 14190/* Override any GCC internal prototype to avoid an error.
@@ -9184,38 +14209,65 @@ for ac_lib in '' util bsd; do
9184 ac_res=-l$ac_lib 14209 ac_res=-l$ac_lib
9185 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14210 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9186 fi 14211 fi
9187 if ac_fn_c_try_link "$LINENO"; then : 14212 rm -f conftest.$ac_objext conftest$ac_exeext
14213if { (ac_try="$ac_link"
14214case "(($ac_try" in
14215 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14216 *) ac_try_echo=$ac_try;;
14217esac
14218eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14219 (eval "$ac_link") 2>conftest.er1
14220 ac_status=$?
14221 grep -v '^ *+' conftest.er1 >conftest.err
14222 rm -f conftest.er1
14223 cat conftest.err >&5
14224 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14225 (exit $ac_status); } && {
14226 test -z "$ac_c_werror_flag" ||
14227 test ! -s conftest.err
14228 } && test -s conftest$ac_exeext &&
14229 $as_test_x conftest$ac_exeext; then
9188 ac_cv_search_logwtmp=$ac_res 14230 ac_cv_search_logwtmp=$ac_res
14231else
14232 echo "$as_me: failed program was:" >&5
14233sed 's/^/| /' conftest.$ac_ext >&5
14234
14235
9189fi 14236fi
9190rm -f core conftest.err conftest.$ac_objext \ 14237
9191 conftest$ac_exeext 14238rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9192 if ${ac_cv_search_logwtmp+:} false; then : 14239 conftest$ac_exeext
14240 if test "${ac_cv_search_logwtmp+set}" = set; then
9193 break 14241 break
9194fi 14242fi
9195done 14243done
9196if ${ac_cv_search_logwtmp+:} false; then : 14244if test "${ac_cv_search_logwtmp+set}" = set; then
9197 14245 :
9198else 14246else
9199 ac_cv_search_logwtmp=no 14247 ac_cv_search_logwtmp=no
9200fi 14248fi
9201rm conftest.$ac_ext 14249rm conftest.$ac_ext
9202LIBS=$ac_func_search_save_LIBS 14250LIBS=$ac_func_search_save_LIBS
9203fi 14251fi
9204{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_logwtmp" >&5 14252{ echo "$as_me:$LINENO: result: $ac_cv_search_logwtmp" >&5
9205$as_echo "$ac_cv_search_logwtmp" >&6; } 14253echo "${ECHO_T}$ac_cv_search_logwtmp" >&6; }
9206ac_res=$ac_cv_search_logwtmp 14254ac_res=$ac_cv_search_logwtmp
9207if test "$ac_res" != no; then : 14255if test "$ac_res" != no; then
9208 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14256 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9209 14257
9210fi 14258fi
9211 14259
9212{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing openpty" >&5 14260{ echo "$as_me:$LINENO: checking for library containing openpty" >&5
9213$as_echo_n "checking for library containing openpty... " >&6; } 14261echo $ECHO_N "checking for library containing openpty... $ECHO_C" >&6; }
9214if ${ac_cv_search_openpty+:} false; then : 14262if test "${ac_cv_search_openpty+set}" = set; then
9215 $as_echo_n "(cached) " >&6 14263 echo $ECHO_N "(cached) $ECHO_C" >&6
9216else 14264else
9217 ac_func_search_save_LIBS=$LIBS 14265 ac_func_search_save_LIBS=$LIBS
9218cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14266cat >conftest.$ac_ext <<_ACEOF
14267/* confdefs.h. */
14268_ACEOF
14269cat confdefs.h >>conftest.$ac_ext
14270cat >>conftest.$ac_ext <<_ACEOF
9219/* end confdefs.h. */ 14271/* end confdefs.h. */
9220 14272
9221/* Override any GCC internal prototype to avoid an error. 14273/* Override any GCC internal prototype to avoid an error.
@@ -9240,38 +14292,65 @@ for ac_lib in '' util bsd; do
9240 ac_res=-l$ac_lib 14292 ac_res=-l$ac_lib
9241 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14293 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9242 fi 14294 fi
9243 if ac_fn_c_try_link "$LINENO"; then : 14295 rm -f conftest.$ac_objext conftest$ac_exeext
14296if { (ac_try="$ac_link"
14297case "(($ac_try" in
14298 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14299 *) ac_try_echo=$ac_try;;
14300esac
14301eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14302 (eval "$ac_link") 2>conftest.er1
14303 ac_status=$?
14304 grep -v '^ *+' conftest.er1 >conftest.err
14305 rm -f conftest.er1
14306 cat conftest.err >&5
14307 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14308 (exit $ac_status); } && {
14309 test -z "$ac_c_werror_flag" ||
14310 test ! -s conftest.err
14311 } && test -s conftest$ac_exeext &&
14312 $as_test_x conftest$ac_exeext; then
9244 ac_cv_search_openpty=$ac_res 14313 ac_cv_search_openpty=$ac_res
14314else
14315 echo "$as_me: failed program was:" >&5
14316sed 's/^/| /' conftest.$ac_ext >&5
14317
14318
9245fi 14319fi
9246rm -f core conftest.err conftest.$ac_objext \ 14320
9247 conftest$ac_exeext 14321rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9248 if ${ac_cv_search_openpty+:} false; then : 14322 conftest$ac_exeext
14323 if test "${ac_cv_search_openpty+set}" = set; then
9249 break 14324 break
9250fi 14325fi
9251done 14326done
9252if ${ac_cv_search_openpty+:} false; then : 14327if test "${ac_cv_search_openpty+set}" = set; then
9253 14328 :
9254else 14329else
9255 ac_cv_search_openpty=no 14330 ac_cv_search_openpty=no
9256fi 14331fi
9257rm conftest.$ac_ext 14332rm conftest.$ac_ext
9258LIBS=$ac_func_search_save_LIBS 14333LIBS=$ac_func_search_save_LIBS
9259fi 14334fi
9260{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_openpty" >&5 14335{ echo "$as_me:$LINENO: result: $ac_cv_search_openpty" >&5
9261$as_echo "$ac_cv_search_openpty" >&6; } 14336echo "${ECHO_T}$ac_cv_search_openpty" >&6; }
9262ac_res=$ac_cv_search_openpty 14337ac_res=$ac_cv_search_openpty
9263if test "$ac_res" != no; then : 14338if test "$ac_res" != no; then
9264 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14339 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9265 14340
9266fi 14341fi
9267 14342
9268{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing updwtmp" >&5 14343{ echo "$as_me:$LINENO: checking for library containing updwtmp" >&5
9269$as_echo_n "checking for library containing updwtmp... " >&6; } 14344echo $ECHO_N "checking for library containing updwtmp... $ECHO_C" >&6; }
9270if ${ac_cv_search_updwtmp+:} false; then : 14345if test "${ac_cv_search_updwtmp+set}" = set; then
9271 $as_echo_n "(cached) " >&6 14346 echo $ECHO_N "(cached) $ECHO_C" >&6
9272else 14347else
9273 ac_func_search_save_LIBS=$LIBS 14348 ac_func_search_save_LIBS=$LIBS
9274cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14349cat >conftest.$ac_ext <<_ACEOF
14350/* confdefs.h. */
14351_ACEOF
14352cat confdefs.h >>conftest.$ac_ext
14353cat >>conftest.$ac_ext <<_ACEOF
9275/* end confdefs.h. */ 14354/* end confdefs.h. */
9276 14355
9277/* Override any GCC internal prototype to avoid an error. 14356/* Override any GCC internal prototype to avoid an error.
@@ -9296,38 +14375,149 @@ for ac_lib in '' util bsd; do
9296 ac_res=-l$ac_lib 14375 ac_res=-l$ac_lib
9297 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14376 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9298 fi 14377 fi
9299 if ac_fn_c_try_link "$LINENO"; then : 14378 rm -f conftest.$ac_objext conftest$ac_exeext
14379if { (ac_try="$ac_link"
14380case "(($ac_try" in
14381 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14382 *) ac_try_echo=$ac_try;;
14383esac
14384eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14385 (eval "$ac_link") 2>conftest.er1
14386 ac_status=$?
14387 grep -v '^ *+' conftest.er1 >conftest.err
14388 rm -f conftest.er1
14389 cat conftest.err >&5
14390 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14391 (exit $ac_status); } && {
14392 test -z "$ac_c_werror_flag" ||
14393 test ! -s conftest.err
14394 } && test -s conftest$ac_exeext &&
14395 $as_test_x conftest$ac_exeext; then
9300 ac_cv_search_updwtmp=$ac_res 14396 ac_cv_search_updwtmp=$ac_res
14397else
14398 echo "$as_me: failed program was:" >&5
14399sed 's/^/| /' conftest.$ac_ext >&5
14400
14401
9301fi 14402fi
9302rm -f core conftest.err conftest.$ac_objext \ 14403
9303 conftest$ac_exeext 14404rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9304 if ${ac_cv_search_updwtmp+:} false; then : 14405 conftest$ac_exeext
14406 if test "${ac_cv_search_updwtmp+set}" = set; then
9305 break 14407 break
9306fi 14408fi
9307done 14409done
9308if ${ac_cv_search_updwtmp+:} false; then : 14410if test "${ac_cv_search_updwtmp+set}" = set; then
9309 14411 :
9310else 14412else
9311 ac_cv_search_updwtmp=no 14413 ac_cv_search_updwtmp=no
9312fi 14414fi
9313rm conftest.$ac_ext 14415rm conftest.$ac_ext
9314LIBS=$ac_func_search_save_LIBS 14416LIBS=$ac_func_search_save_LIBS
9315fi 14417fi
9316{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_updwtmp" >&5 14418{ echo "$as_me:$LINENO: result: $ac_cv_search_updwtmp" >&5
9317$as_echo "$ac_cv_search_updwtmp" >&6; } 14419echo "${ECHO_T}$ac_cv_search_updwtmp" >&6; }
9318ac_res=$ac_cv_search_updwtmp 14420ac_res=$ac_cv_search_updwtmp
9319if test "$ac_res" != no; then : 14421if test "$ac_res" != no; then
9320 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14422 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9321 14423
9322fi 14424fi
9323 14425
14426
14427
14428
14429
14430
14431
14432
9324for ac_func in fmt_scaled scan_scaled login logout openpty updwtmp logwtmp 14433for ac_func in fmt_scaled scan_scaled login logout openpty updwtmp logwtmp
9325do : 14434do
9326 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 14435as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
9327ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 14436{ echo "$as_me:$LINENO: checking for $ac_func" >&5
9328if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 14437echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
14438if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
14439 echo $ECHO_N "(cached) $ECHO_C" >&6
14440else
14441 cat >conftest.$ac_ext <<_ACEOF
14442/* confdefs.h. */
14443_ACEOF
14444cat confdefs.h >>conftest.$ac_ext
14445cat >>conftest.$ac_ext <<_ACEOF
14446/* end confdefs.h. */
14447/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
14448 For example, HP-UX 11i <limits.h> declares gettimeofday. */
14449#define $ac_func innocuous_$ac_func
14450
14451/* System header to define __stub macros and hopefully few prototypes,
14452 which can conflict with char $ac_func (); below.
14453 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
14454 <limits.h> exists even on freestanding compilers. */
14455
14456#ifdef __STDC__
14457# include <limits.h>
14458#else
14459# include <assert.h>
14460#endif
14461
14462#undef $ac_func
14463
14464/* Override any GCC internal prototype to avoid an error.
14465 Use char because int might match the return type of a GCC
14466 builtin and then its argument prototype would still apply. */
14467#ifdef __cplusplus
14468extern "C"
14469#endif
14470char $ac_func ();
14471/* The GNU C library defines this for functions which it implements
14472 to always fail with ENOSYS. Some functions are actually named
14473 something starting with __ and the normal name is an alias. */
14474#if defined __stub_$ac_func || defined __stub___$ac_func
14475choke me
14476#endif
14477
14478int
14479main ()
14480{
14481return $ac_func ();
14482 ;
14483 return 0;
14484}
14485_ACEOF
14486rm -f conftest.$ac_objext conftest$ac_exeext
14487if { (ac_try="$ac_link"
14488case "(($ac_try" in
14489 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14490 *) ac_try_echo=$ac_try;;
14491esac
14492eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14493 (eval "$ac_link") 2>conftest.er1
14494 ac_status=$?
14495 grep -v '^ *+' conftest.er1 >conftest.err
14496 rm -f conftest.er1
14497 cat conftest.err >&5
14498 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14499 (exit $ac_status); } && {
14500 test -z "$ac_c_werror_flag" ||
14501 test ! -s conftest.err
14502 } && test -s conftest$ac_exeext &&
14503 $as_test_x conftest$ac_exeext; then
14504 eval "$as_ac_var=yes"
14505else
14506 echo "$as_me: failed program was:" >&5
14507sed 's/^/| /' conftest.$ac_ext >&5
14508
14509 eval "$as_ac_var=no"
14510fi
14511
14512rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
14513 conftest$ac_exeext conftest.$ac_ext
14514fi
14515ac_res=`eval echo '${'$as_ac_var'}'`
14516 { echo "$as_me:$LINENO: result: $ac_res" >&5
14517echo "${ECHO_T}$ac_res" >&6; }
14518if test `eval echo '${'$as_ac_var'}'` = yes; then
9329 cat >>confdefs.h <<_ACEOF 14519 cat >>confdefs.h <<_ACEOF
9330#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 14520#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
9331_ACEOF 14521_ACEOF
9332 14522
9333fi 14523fi
@@ -9335,13 +14525,17 @@ done
9335 14525
9336 14526
9337# On some platforms, inet_ntop may be found in libresolv or libnsl. 14527# On some platforms, inet_ntop may be found in libresolv or libnsl.
9338{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_ntop" >&5 14528{ echo "$as_me:$LINENO: checking for library containing inet_ntop" >&5
9339$as_echo_n "checking for library containing inet_ntop... " >&6; } 14529echo $ECHO_N "checking for library containing inet_ntop... $ECHO_C" >&6; }
9340if ${ac_cv_search_inet_ntop+:} false; then : 14530if test "${ac_cv_search_inet_ntop+set}" = set; then
9341 $as_echo_n "(cached) " >&6 14531 echo $ECHO_N "(cached) $ECHO_C" >&6
9342else 14532else
9343 ac_func_search_save_LIBS=$LIBS 14533 ac_func_search_save_LIBS=$LIBS
9344cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14534cat >conftest.$ac_ext <<_ACEOF
14535/* confdefs.h. */
14536_ACEOF
14537cat confdefs.h >>conftest.$ac_ext
14538cat >>conftest.$ac_ext <<_ACEOF
9345/* end confdefs.h. */ 14539/* end confdefs.h. */
9346 14540
9347/* Override any GCC internal prototype to avoid an error. 14541/* Override any GCC internal prototype to avoid an error.
@@ -9366,50 +14560,160 @@ for ac_lib in '' resolv nsl; do
9366 ac_res=-l$ac_lib 14560 ac_res=-l$ac_lib
9367 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14561 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9368 fi 14562 fi
9369 if ac_fn_c_try_link "$LINENO"; then : 14563 rm -f conftest.$ac_objext conftest$ac_exeext
14564if { (ac_try="$ac_link"
14565case "(($ac_try" in
14566 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14567 *) ac_try_echo=$ac_try;;
14568esac
14569eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14570 (eval "$ac_link") 2>conftest.er1
14571 ac_status=$?
14572 grep -v '^ *+' conftest.er1 >conftest.err
14573 rm -f conftest.er1
14574 cat conftest.err >&5
14575 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14576 (exit $ac_status); } && {
14577 test -z "$ac_c_werror_flag" ||
14578 test ! -s conftest.err
14579 } && test -s conftest$ac_exeext &&
14580 $as_test_x conftest$ac_exeext; then
9370 ac_cv_search_inet_ntop=$ac_res 14581 ac_cv_search_inet_ntop=$ac_res
14582else
14583 echo "$as_me: failed program was:" >&5
14584sed 's/^/| /' conftest.$ac_ext >&5
14585
14586
9371fi 14587fi
9372rm -f core conftest.err conftest.$ac_objext \ 14588
9373 conftest$ac_exeext 14589rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9374 if ${ac_cv_search_inet_ntop+:} false; then : 14590 conftest$ac_exeext
14591 if test "${ac_cv_search_inet_ntop+set}" = set; then
9375 break 14592 break
9376fi 14593fi
9377done 14594done
9378if ${ac_cv_search_inet_ntop+:} false; then : 14595if test "${ac_cv_search_inet_ntop+set}" = set; then
9379 14596 :
9380else 14597else
9381 ac_cv_search_inet_ntop=no 14598 ac_cv_search_inet_ntop=no
9382fi 14599fi
9383rm conftest.$ac_ext 14600rm conftest.$ac_ext
9384LIBS=$ac_func_search_save_LIBS 14601LIBS=$ac_func_search_save_LIBS
9385fi 14602fi
9386{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_ntop" >&5 14603{ echo "$as_me:$LINENO: result: $ac_cv_search_inet_ntop" >&5
9387$as_echo "$ac_cv_search_inet_ntop" >&6; } 14604echo "${ECHO_T}$ac_cv_search_inet_ntop" >&6; }
9388ac_res=$ac_cv_search_inet_ntop 14605ac_res=$ac_cv_search_inet_ntop
9389if test "$ac_res" != no; then : 14606if test "$ac_res" != no; then
9390 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14607 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9391 14608
9392fi 14609fi
9393 14610
9394 14611
14612
9395for ac_func in strftime 14613for ac_func in strftime
9396do : 14614do
9397 ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" 14615as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
9398if test "x$ac_cv_func_strftime" = xyes; then : 14616{ echo "$as_me:$LINENO: checking for $ac_func" >&5
14617echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
14618if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
14619 echo $ECHO_N "(cached) $ECHO_C" >&6
14620else
14621 cat >conftest.$ac_ext <<_ACEOF
14622/* confdefs.h. */
14623_ACEOF
14624cat confdefs.h >>conftest.$ac_ext
14625cat >>conftest.$ac_ext <<_ACEOF
14626/* end confdefs.h. */
14627/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
14628 For example, HP-UX 11i <limits.h> declares gettimeofday. */
14629#define $ac_func innocuous_$ac_func
14630
14631/* System header to define __stub macros and hopefully few prototypes,
14632 which can conflict with char $ac_func (); below.
14633 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
14634 <limits.h> exists even on freestanding compilers. */
14635
14636#ifdef __STDC__
14637# include <limits.h>
14638#else
14639# include <assert.h>
14640#endif
14641
14642#undef $ac_func
14643
14644/* Override any GCC internal prototype to avoid an error.
14645 Use char because int might match the return type of a GCC
14646 builtin and then its argument prototype would still apply. */
14647#ifdef __cplusplus
14648extern "C"
14649#endif
14650char $ac_func ();
14651/* The GNU C library defines this for functions which it implements
14652 to always fail with ENOSYS. Some functions are actually named
14653 something starting with __ and the normal name is an alias. */
14654#if defined __stub_$ac_func || defined __stub___$ac_func
14655choke me
14656#endif
14657
14658int
14659main ()
14660{
14661return $ac_func ();
14662 ;
14663 return 0;
14664}
14665_ACEOF
14666rm -f conftest.$ac_objext conftest$ac_exeext
14667if { (ac_try="$ac_link"
14668case "(($ac_try" in
14669 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14670 *) ac_try_echo=$ac_try;;
14671esac
14672eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14673 (eval "$ac_link") 2>conftest.er1
14674 ac_status=$?
14675 grep -v '^ *+' conftest.er1 >conftest.err
14676 rm -f conftest.er1
14677 cat conftest.err >&5
14678 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14679 (exit $ac_status); } && {
14680 test -z "$ac_c_werror_flag" ||
14681 test ! -s conftest.err
14682 } && test -s conftest$ac_exeext &&
14683 $as_test_x conftest$ac_exeext; then
14684 eval "$as_ac_var=yes"
14685else
14686 echo "$as_me: failed program was:" >&5
14687sed 's/^/| /' conftest.$ac_ext >&5
14688
14689 eval "$as_ac_var=no"
14690fi
14691
14692rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
14693 conftest$ac_exeext conftest.$ac_ext
14694fi
14695ac_res=`eval echo '${'$as_ac_var'}'`
14696 { echo "$as_me:$LINENO: result: $ac_res" >&5
14697echo "${ECHO_T}$ac_res" >&6; }
14698if test `eval echo '${'$as_ac_var'}'` = yes; then
9399 cat >>confdefs.h <<_ACEOF 14699 cat >>confdefs.h <<_ACEOF
9400#define HAVE_STRFTIME 1 14700#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
9401_ACEOF 14701_ACEOF
9402 14702
9403else 14703else
9404 # strftime is in -lintl on SCO UNIX. 14704 # strftime is in -lintl on SCO UNIX.
9405{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 14705{ echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
9406$as_echo_n "checking for strftime in -lintl... " >&6; } 14706echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6; }
9407if ${ac_cv_lib_intl_strftime+:} false; then : 14707if test "${ac_cv_lib_intl_strftime+set}" = set; then
9408 $as_echo_n "(cached) " >&6 14708 echo $ECHO_N "(cached) $ECHO_C" >&6
9409else 14709else
9410 ac_check_lib_save_LIBS=$LIBS 14710 ac_check_lib_save_LIBS=$LIBS
9411LIBS="-lintl $LIBS" 14711LIBS="-lintl $LIBS"
9412cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14712cat >conftest.$ac_ext <<_ACEOF
14713/* confdefs.h. */
14714_ACEOF
14715cat confdefs.h >>conftest.$ac_ext
14716cat >>conftest.$ac_ext <<_ACEOF
9413/* end confdefs.h. */ 14717/* end confdefs.h. */
9414 14718
9415/* Override any GCC internal prototype to avoid an error. 14719/* Override any GCC internal prototype to avoid an error.
@@ -9427,19 +14731,42 @@ return strftime ();
9427 return 0; 14731 return 0;
9428} 14732}
9429_ACEOF 14733_ACEOF
9430if ac_fn_c_try_link "$LINENO"; then : 14734rm -f conftest.$ac_objext conftest$ac_exeext
14735if { (ac_try="$ac_link"
14736case "(($ac_try" in
14737 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14738 *) ac_try_echo=$ac_try;;
14739esac
14740eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14741 (eval "$ac_link") 2>conftest.er1
14742 ac_status=$?
14743 grep -v '^ *+' conftest.er1 >conftest.err
14744 rm -f conftest.er1
14745 cat conftest.err >&5
14746 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14747 (exit $ac_status); } && {
14748 test -z "$ac_c_werror_flag" ||
14749 test ! -s conftest.err
14750 } && test -s conftest$ac_exeext &&
14751 $as_test_x conftest$ac_exeext; then
9431 ac_cv_lib_intl_strftime=yes 14752 ac_cv_lib_intl_strftime=yes
9432else 14753else
9433 ac_cv_lib_intl_strftime=no 14754 echo "$as_me: failed program was:" >&5
14755sed 's/^/| /' conftest.$ac_ext >&5
14756
14757 ac_cv_lib_intl_strftime=no
9434fi 14758fi
9435rm -f core conftest.err conftest.$ac_objext \ 14759
9436 conftest$ac_exeext conftest.$ac_ext 14760rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
14761 conftest$ac_exeext conftest.$ac_ext
9437LIBS=$ac_check_lib_save_LIBS 14762LIBS=$ac_check_lib_save_LIBS
9438fi 14763fi
9439{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 14764{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
9440$as_echo "$ac_cv_lib_intl_strftime" >&6; } 14765echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6; }
9441if test "x$ac_cv_lib_intl_strftime" = xyes; then : 14766if test $ac_cv_lib_intl_strftime = yes; then
9442 $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h 14767 cat >>confdefs.h <<\_ACEOF
14768#define HAVE_STRFTIME 1
14769_ACEOF
9443 14770
9444LIBS="-lintl $LIBS" 14771LIBS="-lintl $LIBS"
9445fi 14772fi
@@ -9449,9 +14776,13 @@ done
9449 14776
9450 14777
9451# Check for ALTDIRFUNC glob() extension 14778# Check for ALTDIRFUNC glob() extension
9452{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_ALTDIRFUNC support" >&5 14779{ echo "$as_me:$LINENO: checking for GLOB_ALTDIRFUNC support" >&5
9453$as_echo_n "checking for GLOB_ALTDIRFUNC support... " >&6; } 14780echo $ECHO_N "checking for GLOB_ALTDIRFUNC support... $ECHO_C" >&6; }
9454cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14781cat >conftest.$ac_ext <<_ACEOF
14782/* confdefs.h. */
14783_ACEOF
14784cat confdefs.h >>conftest.$ac_ext
14785cat >>conftest.$ac_ext <<_ACEOF
9455/* end confdefs.h. */ 14786/* end confdefs.h. */
9456 14787
9457 #include <glob.h> 14788 #include <glob.h>
@@ -9461,18 +14792,20 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9461 14792
9462_ACEOF 14793_ACEOF
9463if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 14794if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
9464 $EGREP "FOUNDIT" >/dev/null 2>&1; then : 14795 $EGREP "FOUNDIT" >/dev/null 2>&1; then
9465 14796
9466 14797
9467$as_echo "#define GLOB_HAS_ALTDIRFUNC 1" >>confdefs.h 14798cat >>confdefs.h <<\_ACEOF
14799#define GLOB_HAS_ALTDIRFUNC 1
14800_ACEOF
9468 14801
9469 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 14802 { echo "$as_me:$LINENO: result: yes" >&5
9470$as_echo "yes" >&6; } 14803echo "${ECHO_T}yes" >&6; }
9471 14804
9472else 14805else
9473 14806
9474 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 14807 { echo "$as_me:$LINENO: result: no" >&5
9475$as_echo "no" >&6; } 14808echo "${ECHO_T}no" >&6; }
9476 14809
9477 14810
9478fi 14811fi
@@ -9480,9 +14813,13 @@ rm -f conftest*
9480 14813
9481 14814
9482# Check for g.gl_matchc glob() extension 14815# Check for g.gl_matchc glob() extension
9483{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gl_matchc field in glob_t" >&5 14816{ echo "$as_me:$LINENO: checking for gl_matchc field in glob_t" >&5
9484$as_echo_n "checking for gl_matchc field in glob_t... " >&6; } 14817echo $ECHO_N "checking for gl_matchc field in glob_t... $ECHO_C" >&6; }
9485cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14818cat >conftest.$ac_ext <<_ACEOF
14819/* confdefs.h. */
14820_ACEOF
14821cat confdefs.h >>conftest.$ac_ext
14822cat >>conftest.$ac_ext <<_ACEOF
9486/* end confdefs.h. */ 14823/* end confdefs.h. */
9487 #include <glob.h> 14824 #include <glob.h>
9488int 14825int
@@ -9493,26 +14830,52 @@ main ()
9493 return 0; 14830 return 0;
9494} 14831}
9495_ACEOF 14832_ACEOF
9496if ac_fn_c_try_compile "$LINENO"; then : 14833rm -f conftest.$ac_objext
14834if { (ac_try="$ac_compile"
14835case "(($ac_try" in
14836 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14837 *) ac_try_echo=$ac_try;;
14838esac
14839eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14840 (eval "$ac_compile") 2>conftest.er1
14841 ac_status=$?
14842 grep -v '^ *+' conftest.er1 >conftest.err
14843 rm -f conftest.er1
14844 cat conftest.err >&5
14845 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14846 (exit $ac_status); } && {
14847 test -z "$ac_c_werror_flag" ||
14848 test ! -s conftest.err
14849 } && test -s conftest.$ac_objext; then
9497 14850
9498 14851
9499$as_echo "#define GLOB_HAS_GL_MATCHC 1" >>confdefs.h 14852cat >>confdefs.h <<\_ACEOF
14853#define GLOB_HAS_GL_MATCHC 1
14854_ACEOF
9500 14855
9501 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 14856 { echo "$as_me:$LINENO: result: yes" >&5
9502$as_echo "yes" >&6; } 14857echo "${ECHO_T}yes" >&6; }
9503 14858
9504else 14859else
14860 echo "$as_me: failed program was:" >&5
14861sed 's/^/| /' conftest.$ac_ext >&5
9505 14862
9506 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 14863
9507$as_echo "no" >&6; } 14864 { echo "$as_me:$LINENO: result: no" >&5
14865echo "${ECHO_T}no" >&6; }
9508 14866
9509fi 14867fi
14868
9510rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 14869rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9511 14870
9512# Check for g.gl_statv glob() extension 14871# Check for g.gl_statv glob() extension
9513{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gl_statv and GLOB_KEEPSTAT extensions for glob" >&5 14872{ echo "$as_me:$LINENO: checking for gl_statv and GLOB_KEEPSTAT extensions for glob" >&5
9514$as_echo_n "checking for gl_statv and GLOB_KEEPSTAT extensions for glob... " >&6; } 14873echo $ECHO_N "checking for gl_statv and GLOB_KEEPSTAT extensions for glob... $ECHO_C" >&6; }
9515cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14874cat >conftest.$ac_ext <<_ACEOF
14875/* confdefs.h. */
14876_ACEOF
14877cat confdefs.h >>conftest.$ac_ext
14878cat >>conftest.$ac_ext <<_ACEOF
9516/* end confdefs.h. */ 14879/* end confdefs.h. */
9517 #include <glob.h> 14880 #include <glob.h>
9518int 14881int
@@ -9529,48 +14892,133 @@ g.gl_statv = NULL;
9529 return 0; 14892 return 0;
9530} 14893}
9531_ACEOF 14894_ACEOF
9532if ac_fn_c_try_compile "$LINENO"; then : 14895rm -f conftest.$ac_objext
14896if { (ac_try="$ac_compile"
14897case "(($ac_try" in
14898 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14899 *) ac_try_echo=$ac_try;;
14900esac
14901eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14902 (eval "$ac_compile") 2>conftest.er1
14903 ac_status=$?
14904 grep -v '^ *+' conftest.er1 >conftest.err
14905 rm -f conftest.er1
14906 cat conftest.err >&5
14907 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14908 (exit $ac_status); } && {
14909 test -z "$ac_c_werror_flag" ||
14910 test ! -s conftest.err
14911 } && test -s conftest.$ac_objext; then
9533 14912
9534 14913
9535$as_echo "#define GLOB_HAS_GL_STATV 1" >>confdefs.h 14914cat >>confdefs.h <<\_ACEOF
14915#define GLOB_HAS_GL_STATV 1
14916_ACEOF
9536 14917
9537 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 14918 { echo "$as_me:$LINENO: result: yes" >&5
9538$as_echo "yes" >&6; } 14919echo "${ECHO_T}yes" >&6; }
9539 14920
9540else 14921else
14922 echo "$as_me: failed program was:" >&5
14923sed 's/^/| /' conftest.$ac_ext >&5
14924
9541 14925
9542 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 14926 { echo "$as_me:$LINENO: result: no" >&5
9543$as_echo "no" >&6; } 14927echo "${ECHO_T}no" >&6; }
9544 14928
9545 14929
9546fi 14930fi
14931
9547rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 14932rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9548 14933
9549ac_fn_c_check_decl "$LINENO" "GLOB_NOMATCH" "ac_cv_have_decl_GLOB_NOMATCH" "#include <glob.h> 14934{ echo "$as_me:$LINENO: checking whether GLOB_NOMATCH is declared" >&5
9550" 14935echo $ECHO_N "checking whether GLOB_NOMATCH is declared... $ECHO_C" >&6; }
9551if test "x$ac_cv_have_decl_GLOB_NOMATCH" = xyes; then : 14936if test "${ac_cv_have_decl_GLOB_NOMATCH+set}" = set; then
9552 ac_have_decl=1 14937 echo $ECHO_N "(cached) $ECHO_C" >&6
9553else 14938else
9554 ac_have_decl=0 14939 cat >conftest.$ac_ext <<_ACEOF
14940/* confdefs.h. */
14941_ACEOF
14942cat confdefs.h >>conftest.$ac_ext
14943cat >>conftest.$ac_ext <<_ACEOF
14944/* end confdefs.h. */
14945#include <glob.h>
14946
14947int
14948main ()
14949{
14950#ifndef GLOB_NOMATCH
14951 (void) GLOB_NOMATCH;
14952#endif
14953
14954 ;
14955 return 0;
14956}
14957_ACEOF
14958rm -f conftest.$ac_objext
14959if { (ac_try="$ac_compile"
14960case "(($ac_try" in
14961 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14962 *) ac_try_echo=$ac_try;;
14963esac
14964eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
14965 (eval "$ac_compile") 2>conftest.er1
14966 ac_status=$?
14967 grep -v '^ *+' conftest.er1 >conftest.err
14968 rm -f conftest.er1
14969 cat conftest.err >&5
14970 echo "$as_me:$LINENO: \$? = $ac_status" >&5
14971 (exit $ac_status); } && {
14972 test -z "$ac_c_werror_flag" ||
14973 test ! -s conftest.err
14974 } && test -s conftest.$ac_objext; then
14975 ac_cv_have_decl_GLOB_NOMATCH=yes
14976else
14977 echo "$as_me: failed program was:" >&5
14978sed 's/^/| /' conftest.$ac_ext >&5
14979
14980 ac_cv_have_decl_GLOB_NOMATCH=no
9555fi 14981fi
9556 14982
14983rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14984fi
14985{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_GLOB_NOMATCH" >&5
14986echo "${ECHO_T}$ac_cv_have_decl_GLOB_NOMATCH" >&6; }
14987if test $ac_cv_have_decl_GLOB_NOMATCH = yes; then
14988
9557cat >>confdefs.h <<_ACEOF 14989cat >>confdefs.h <<_ACEOF
9558#define HAVE_DECL_GLOB_NOMATCH $ac_have_decl 14990#define HAVE_DECL_GLOB_NOMATCH 1
9559_ACEOF 14991_ACEOF
9560 14992
9561 14993
9562{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct dirent allocates space for d_name" >&5 14994else
9563$as_echo_n "checking whether struct dirent allocates space for d_name... " >&6; } 14995 cat >>confdefs.h <<_ACEOF
9564if test "$cross_compiling" = yes; then : 14996#define HAVE_DECL_GLOB_NOMATCH 0
14997_ACEOF
14998
14999
15000fi
15001
15002
9565 15003
9566 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME" >&5 15004{ echo "$as_me:$LINENO: checking whether struct dirent allocates space for d_name" >&5
9567$as_echo "$as_me: WARNING: cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME" >&2;} 15005echo $ECHO_N "checking whether struct dirent allocates space for d_name... $ECHO_C" >&6; }
9568 $as_echo "#define BROKEN_ONE_BYTE_DIRENT_D_NAME 1" >>confdefs.h 15006if test "$cross_compiling" = yes; then
15007
15008 { echo "$as_me:$LINENO: WARNING: cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME" >&5
15009echo "$as_me: WARNING: cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME" >&2;}
15010 cat >>confdefs.h <<\_ACEOF
15011#define BROKEN_ONE_BYTE_DIRENT_D_NAME 1
15012_ACEOF
9569 15013
9570 15014
9571 15015
9572else 15016else
9573 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15017 cat >conftest.$ac_ext <<_ACEOF
15018/* confdefs.h. */
15019_ACEOF
15020cat confdefs.h >>conftest.$ac_ext
15021cat >>conftest.$ac_ext <<_ACEOF
9574/* end confdefs.h. */ 15022/* end confdefs.h. */
9575 15023
9576#include <sys/types.h> 15024#include <sys/types.h>
@@ -9586,41 +15034,69 @@ main ()
9586 return 0; 15034 return 0;
9587} 15035}
9588_ACEOF 15036_ACEOF
9589if ac_fn_c_try_run "$LINENO"; then : 15037rm -f conftest$ac_exeext
9590 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15038if { (ac_try="$ac_link"
9591$as_echo "yes" >&6; } 15039case "(($ac_try" in
15040 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15041 *) ac_try_echo=$ac_try;;
15042esac
15043eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15044 (eval "$ac_link") 2>&5
15045 ac_status=$?
15046 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15047 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
15048 { (case "(($ac_try" in
15049 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15050 *) ac_try_echo=$ac_try;;
15051esac
15052eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15053 (eval "$ac_try") 2>&5
15054 ac_status=$?
15055 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15056 (exit $ac_status); }; }; then
15057 { echo "$as_me:$LINENO: result: yes" >&5
15058echo "${ECHO_T}yes" >&6; }
9592else 15059else
15060 echo "$as_me: program exited with status $ac_status" >&5
15061echo "$as_me: failed program was:" >&5
15062sed 's/^/| /' conftest.$ac_ext >&5
15063
15064( exit $ac_status )
9593 15065
9594 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15066 { echo "$as_me:$LINENO: result: no" >&5
9595$as_echo "no" >&6; } 15067echo "${ECHO_T}no" >&6; }
9596 15068
9597$as_echo "#define BROKEN_ONE_BYTE_DIRENT_D_NAME 1" >>confdefs.h 15069cat >>confdefs.h <<\_ACEOF
15070#define BROKEN_ONE_BYTE_DIRENT_D_NAME 1
15071_ACEOF
9598 15072
9599 15073
9600fi 15074fi
9601rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 15075rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
9602 conftest.$ac_objext conftest.beam conftest.$ac_ext
9603fi 15076fi
9604 15077
9605 15078
9606{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc/pid/fd directory" >&5 15079
9607$as_echo_n "checking for /proc/pid/fd directory... " >&6; } 15080{ echo "$as_me:$LINENO: checking for /proc/pid/fd directory" >&5
15081echo $ECHO_N "checking for /proc/pid/fd directory... $ECHO_C" >&6; }
9608if test -d "/proc/$$/fd" ; then 15082if test -d "/proc/$$/fd" ; then
9609 15083
9610$as_echo "#define HAVE_PROC_PID 1" >>confdefs.h 15084cat >>confdefs.h <<\_ACEOF
15085#define HAVE_PROC_PID 1
15086_ACEOF
9611 15087
9612 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15088 { echo "$as_me:$LINENO: result: yes" >&5
9613$as_echo "yes" >&6; } 15089echo "${ECHO_T}yes" >&6; }
9614else 15090else
9615 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15091 { echo "$as_me:$LINENO: result: no" >&5
9616$as_echo "no" >&6; } 15092echo "${ECHO_T}no" >&6; }
9617fi 15093fi
9618 15094
9619# Check whether user wants S/Key support 15095# Check whether user wants S/Key support
9620SKEY_MSG="no" 15096SKEY_MSG="no"
9621 15097
9622# Check whether --with-skey was given. 15098# Check whether --with-skey was given.
9623if test "${with_skey+set}" = set; then : 15099if test "${with_skey+set}" = set; then
9624 withval=$with_skey; 15100 withval=$with_skey;
9625 if test "x$withval" != "xno" ; then 15101 if test "x$withval" != "xno" ; then
9626 15102
@@ -9630,14 +15106,20 @@ if test "${with_skey+set}" = set; then :
9630 fi 15106 fi
9631 15107
9632 15108
9633$as_echo "#define SKEY 1" >>confdefs.h 15109cat >>confdefs.h <<\_ACEOF
15110#define SKEY 1
15111_ACEOF
9634 15112
9635 LIBS="-lskey $LIBS" 15113 LIBS="-lskey $LIBS"
9636 SKEY_MSG="yes" 15114 SKEY_MSG="yes"
9637 15115
9638 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for s/key support" >&5 15116 { echo "$as_me:$LINENO: checking for s/key support" >&5
9639$as_echo_n "checking for s/key support... " >&6; } 15117echo $ECHO_N "checking for s/key support... $ECHO_C" >&6; }
9640 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15118 cat >conftest.$ac_ext <<_ACEOF
15119/* confdefs.h. */
15120_ACEOF
15121cat confdefs.h >>conftest.$ac_ext
15122cat >>conftest.$ac_ext <<_ACEOF
9641/* end confdefs.h. */ 15123/* end confdefs.h. */
9642 15124
9643#include <stdio.h> 15125#include <stdio.h>
@@ -9654,21 +15136,48 @@ main ()
9654 return 0; 15136 return 0;
9655} 15137}
9656_ACEOF 15138_ACEOF
9657if ac_fn_c_try_link "$LINENO"; then : 15139rm -f conftest.$ac_objext conftest$ac_exeext
9658 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15140if { (ac_try="$ac_link"
9659$as_echo "yes" >&6; } 15141case "(($ac_try" in
15142 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15143 *) ac_try_echo=$ac_try;;
15144esac
15145eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15146 (eval "$ac_link") 2>conftest.er1
15147 ac_status=$?
15148 grep -v '^ *+' conftest.er1 >conftest.err
15149 rm -f conftest.er1
15150 cat conftest.err >&5
15151 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15152 (exit $ac_status); } && {
15153 test -z "$ac_c_werror_flag" ||
15154 test ! -s conftest.err
15155 } && test -s conftest$ac_exeext &&
15156 $as_test_x conftest$ac_exeext; then
15157 { echo "$as_me:$LINENO: result: yes" >&5
15158echo "${ECHO_T}yes" >&6; }
9660else 15159else
15160 echo "$as_me: failed program was:" >&5
15161sed 's/^/| /' conftest.$ac_ext >&5
15162
9661 15163
9662 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15164 { echo "$as_me:$LINENO: result: no" >&5
9663$as_echo "no" >&6; } 15165echo "${ECHO_T}no" >&6; }
9664 as_fn_error $? "** Incomplete or missing s/key libraries." "$LINENO" 5 15166 { { echo "$as_me:$LINENO: error: ** Incomplete or missing s/key libraries." >&5
15167echo "$as_me: error: ** Incomplete or missing s/key libraries." >&2;}
15168 { (exit 1); exit 1; }; }
9665 15169
9666fi 15170fi
9667rm -f core conftest.err conftest.$ac_objext \ 15171
9668 conftest$ac_exeext conftest.$ac_ext 15172rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9669 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if skeychallenge takes 4 arguments" >&5 15173 conftest$ac_exeext conftest.$ac_ext
9670$as_echo_n "checking if skeychallenge takes 4 arguments... " >&6; } 15174 { echo "$as_me:$LINENO: checking if skeychallenge takes 4 arguments" >&5
9671 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15175echo $ECHO_N "checking if skeychallenge takes 4 arguments... $ECHO_C" >&6; }
15176 cat >conftest.$ac_ext <<_ACEOF
15177/* confdefs.h. */
15178_ACEOF
15179cat confdefs.h >>conftest.$ac_ext
15180cat >>conftest.$ac_ext <<_ACEOF
9672/* end confdefs.h. */ 15181/* end confdefs.h. */
9673 15182
9674#include <stdio.h> 15183#include <stdio.h>
@@ -9684,19 +15193,41 @@ main ()
9684 return 0; 15193 return 0;
9685} 15194}
9686_ACEOF 15195_ACEOF
9687if ac_fn_c_try_compile "$LINENO"; then : 15196rm -f conftest.$ac_objext
15197if { (ac_try="$ac_compile"
15198case "(($ac_try" in
15199 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15200 *) ac_try_echo=$ac_try;;
15201esac
15202eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15203 (eval "$ac_compile") 2>conftest.er1
15204 ac_status=$?
15205 grep -v '^ *+' conftest.er1 >conftest.err
15206 rm -f conftest.er1
15207 cat conftest.err >&5
15208 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15209 (exit $ac_status); } && {
15210 test -z "$ac_c_werror_flag" ||
15211 test ! -s conftest.err
15212 } && test -s conftest.$ac_objext; then
9688 15213
9689 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15214 { echo "$as_me:$LINENO: result: yes" >&5
9690$as_echo "yes" >&6; } 15215echo "${ECHO_T}yes" >&6; }
9691 15216
9692$as_echo "#define SKEYCHALLENGE_4ARG 1" >>confdefs.h 15217cat >>confdefs.h <<\_ACEOF
15218#define SKEYCHALLENGE_4ARG 1
15219_ACEOF
9693 15220
9694else 15221else
15222 echo "$as_me: failed program was:" >&5
15223sed 's/^/| /' conftest.$ac_ext >&5
9695 15224
9696 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15225
9697$as_echo "no" >&6; } 15226 { echo "$as_me:$LINENO: result: no" >&5
15227echo "${ECHO_T}no" >&6; }
9698 15228
9699fi 15229fi
15230
9700rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 15231rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9701 fi 15232 fi
9702 15233
@@ -9708,7 +15239,7 @@ fi
9708LDNS_MSG="no" 15239LDNS_MSG="no"
9709 15240
9710# Check whether --with-ldns was given. 15241# Check whether --with-ldns was given.
9711if test "${with_ldns+set}" = set; then : 15242if test "${with_ldns+set}" = set; then
9712 withval=$with_ldns; 15243 withval=$with_ldns;
9713 if test "x$withval" != "xno" ; then 15244 if test "x$withval" != "xno" ; then
9714 15245
@@ -9718,14 +15249,20 @@ if test "${with_ldns+set}" = set; then :
9718 fi 15249 fi
9719 15250
9720 15251
9721$as_echo "#define HAVE_LDNS 1" >>confdefs.h 15252cat >>confdefs.h <<\_ACEOF
15253#define HAVE_LDNS 1
15254_ACEOF
9722 15255
9723 LIBS="-lldns $LIBS" 15256 LIBS="-lldns $LIBS"
9724 LDNS_MSG="yes" 15257 LDNS_MSG="yes"
9725 15258
9726 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns support" >&5 15259 { echo "$as_me:$LINENO: checking for ldns support" >&5
9727$as_echo_n "checking for ldns support... " >&6; } 15260echo $ECHO_N "checking for ldns support... $ECHO_C" >&6; }
9728 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15261 cat >conftest.$ac_ext <<_ACEOF
15262/* confdefs.h. */
15263_ACEOF
15264cat confdefs.h >>conftest.$ac_ext
15265cat >>conftest.$ac_ext <<_ACEOF
9729/* end confdefs.h. */ 15266/* end confdefs.h. */
9730 15267
9731#include <stdio.h> 15268#include <stdio.h>
@@ -9736,18 +15273,41 @@ int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); s
9736 15273
9737 15274
9738_ACEOF 15275_ACEOF
9739if ac_fn_c_try_link "$LINENO"; then : 15276rm -f conftest.$ac_objext conftest$ac_exeext
9740 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15277if { (ac_try="$ac_link"
9741$as_echo "yes" >&6; } 15278case "(($ac_try" in
15279 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15280 *) ac_try_echo=$ac_try;;
15281esac
15282eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15283 (eval "$ac_link") 2>conftest.er1
15284 ac_status=$?
15285 grep -v '^ *+' conftest.er1 >conftest.err
15286 rm -f conftest.er1
15287 cat conftest.err >&5
15288 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15289 (exit $ac_status); } && {
15290 test -z "$ac_c_werror_flag" ||
15291 test ! -s conftest.err
15292 } && test -s conftest$ac_exeext &&
15293 $as_test_x conftest$ac_exeext; then
15294 { echo "$as_me:$LINENO: result: yes" >&5
15295echo "${ECHO_T}yes" >&6; }
9742else 15296else
15297 echo "$as_me: failed program was:" >&5
15298sed 's/^/| /' conftest.$ac_ext >&5
15299
9743 15300
9744 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15301 { echo "$as_me:$LINENO: result: no" >&5
9745$as_echo "no" >&6; } 15302echo "${ECHO_T}no" >&6; }
9746 as_fn_error $? "** Incomplete or missing ldns libraries." "$LINENO" 5 15303 { { echo "$as_me:$LINENO: error: ** Incomplete or missing ldns libraries." >&5
15304echo "$as_me: error: ** Incomplete or missing ldns libraries." >&2;}
15305 { (exit 1); exit 1; }; }
9747 15306
9748fi 15307fi
9749rm -f core conftest.err conftest.$ac_objext \ 15308
9750 conftest$ac_exeext conftest.$ac_ext 15309rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
15310 conftest$ac_exeext conftest.$ac_ext
9751 fi 15311 fi
9752 15312
9753 15313
@@ -9758,16 +15318,16 @@ fi
9758LIBEDIT_MSG="no" 15318LIBEDIT_MSG="no"
9759 15319
9760# Check whether --with-libedit was given. 15320# Check whether --with-libedit was given.
9761if test "${with_libedit+set}" = set; then : 15321if test "${with_libedit+set}" = set; then
9762 withval=$with_libedit; if test "x$withval" != "xno" ; then 15322 withval=$with_libedit; if test "x$withval" != "xno" ; then
9763 if test "x$withval" = "xyes" ; then 15323 if test "x$withval" = "xyes" ; then
9764 if test -n "$ac_tool_prefix"; then 15324 if test -n "$ac_tool_prefix"; then
9765 # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. 15325 # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
9766set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 15326set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
9767{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 15327{ echo "$as_me:$LINENO: checking for $ac_word" >&5
9768$as_echo_n "checking for $ac_word... " >&6; } 15328echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
9769if ${ac_cv_path_PKGCONFIG+:} false; then : 15329if test "${ac_cv_path_PKGCONFIG+set}" = set; then
9770 $as_echo_n "(cached) " >&6 15330 echo $ECHO_N "(cached) $ECHO_C" >&6
9771else 15331else
9772 case $PKGCONFIG in 15332 case $PKGCONFIG in
9773 [\\/]* | ?:[\\/]*) 15333 [\\/]* | ?:[\\/]*)
@@ -9779,14 +15339,14 @@ for as_dir in $PATH
9779do 15339do
9780 IFS=$as_save_IFS 15340 IFS=$as_save_IFS
9781 test -z "$as_dir" && as_dir=. 15341 test -z "$as_dir" && as_dir=.
9782 for ac_exec_ext in '' $ac_executable_extensions; do 15342 for ac_exec_ext in '' $ac_executable_extensions; do
9783 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 15343 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
9784 ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" 15344 ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
9785 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 15345 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
9786 break 2 15346 break 2
9787 fi 15347 fi
9788done 15348done
9789 done 15349done
9790IFS=$as_save_IFS 15350IFS=$as_save_IFS
9791 15351
9792 ;; 15352 ;;
@@ -9794,11 +15354,11 @@ esac
9794fi 15354fi
9795PKGCONFIG=$ac_cv_path_PKGCONFIG 15355PKGCONFIG=$ac_cv_path_PKGCONFIG
9796if test -n "$PKGCONFIG"; then 15356if test -n "$PKGCONFIG"; then
9797 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 15357 { echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
9798$as_echo "$PKGCONFIG" >&6; } 15358echo "${ECHO_T}$PKGCONFIG" >&6; }
9799else 15359else
9800 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15360 { echo "$as_me:$LINENO: result: no" >&5
9801$as_echo "no" >&6; } 15361echo "${ECHO_T}no" >&6; }
9802fi 15362fi
9803 15363
9804 15364
@@ -9807,10 +15367,10 @@ if test -z "$ac_cv_path_PKGCONFIG"; then
9807 ac_pt_PKGCONFIG=$PKGCONFIG 15367 ac_pt_PKGCONFIG=$PKGCONFIG
9808 # Extract the first word of "pkg-config", so it can be a program name with args. 15368 # Extract the first word of "pkg-config", so it can be a program name with args.
9809set dummy pkg-config; ac_word=$2 15369set dummy pkg-config; ac_word=$2
9810{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 15370{ echo "$as_me:$LINENO: checking for $ac_word" >&5
9811$as_echo_n "checking for $ac_word... " >&6; } 15371echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
9812if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : 15372if test "${ac_cv_path_ac_pt_PKGCONFIG+set}" = set; then
9813 $as_echo_n "(cached) " >&6 15373 echo $ECHO_N "(cached) $ECHO_C" >&6
9814else 15374else
9815 case $ac_pt_PKGCONFIG in 15375 case $ac_pt_PKGCONFIG in
9816 [\\/]* | ?:[\\/]*) 15376 [\\/]* | ?:[\\/]*)
@@ -9822,14 +15382,14 @@ for as_dir in $PATH
9822do 15382do
9823 IFS=$as_save_IFS 15383 IFS=$as_save_IFS
9824 test -z "$as_dir" && as_dir=. 15384 test -z "$as_dir" && as_dir=.
9825 for ac_exec_ext in '' $ac_executable_extensions; do 15385 for ac_exec_ext in '' $ac_executable_extensions; do
9826 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 15386 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
9827 ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" 15387 ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
9828 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 15388 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
9829 break 2 15389 break 2
9830 fi 15390 fi
9831done 15391done
9832 done 15392done
9833IFS=$as_save_IFS 15393IFS=$as_save_IFS
9834 15394
9835 ;; 15395 ;;
@@ -9837,11 +15397,11 @@ esac
9837fi 15397fi
9838ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG 15398ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG
9839if test -n "$ac_pt_PKGCONFIG"; then 15399if test -n "$ac_pt_PKGCONFIG"; then
9840 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 15400 { echo "$as_me:$LINENO: result: $ac_pt_PKGCONFIG" >&5
9841$as_echo "$ac_pt_PKGCONFIG" >&6; } 15401echo "${ECHO_T}$ac_pt_PKGCONFIG" >&6; }
9842else 15402else
9843 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15403 { echo "$as_me:$LINENO: result: no" >&5
9844$as_echo "no" >&6; } 15404echo "${ECHO_T}no" >&6; }
9845fi 15405fi
9846 15406
9847 if test "x$ac_pt_PKGCONFIG" = x; then 15407 if test "x$ac_pt_PKGCONFIG" = x; then
@@ -9849,8 +15409,12 @@ fi
9849 else 15409 else
9850 case $cross_compiling:$ac_tool_warned in 15410 case $cross_compiling:$ac_tool_warned in
9851yes:) 15411yes:)
9852{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 15412{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
9853$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} 15413whose name does not start with the host triplet. If you think this
15414configuration is useful to you, please write to autoconf@gnu.org." >&5
15415echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
15416whose name does not start with the host triplet. If you think this
15417configuration is useful to you, please write to autoconf@gnu.org." >&2;}
9854ac_tool_warned=yes ;; 15418ac_tool_warned=yes ;;
9855esac 15419esac
9856 PKGCONFIG=$ac_pt_PKGCONFIG 15420 PKGCONFIG=$ac_pt_PKGCONFIG
@@ -9860,15 +15424,15 @@ else
9860fi 15424fi
9861 15425
9862 if test "x$PKGCONFIG" != "xno"; then 15426 if test "x$PKGCONFIG" != "xno"; then
9863 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $PKGCONFIG knows about libedit" >&5 15427 { echo "$as_me:$LINENO: checking if $PKGCONFIG knows about libedit" >&5
9864$as_echo_n "checking if $PKGCONFIG knows about libedit... " >&6; } 15428echo $ECHO_N "checking if $PKGCONFIG knows about libedit... $ECHO_C" >&6; }
9865 if "$PKGCONFIG" libedit; then 15429 if "$PKGCONFIG" libedit; then
9866 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15430 { echo "$as_me:$LINENO: result: yes" >&5
9867$as_echo "yes" >&6; } 15431echo "${ECHO_T}yes" >&6; }
9868 use_pkgconfig_for_libedit=yes 15432 use_pkgconfig_for_libedit=yes
9869 else 15433 else
9870 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15434 { echo "$as_me:$LINENO: result: no" >&5
9871$as_echo "no" >&6; } 15435echo "${ECHO_T}no" >&6; }
9872 fi 15436 fi
9873 fi 15437 fi
9874 else 15438 else
@@ -9886,15 +15450,19 @@ $as_echo "no" >&6; }
9886 LIBEDIT="-ledit -lcurses" 15450 LIBEDIT="-ledit -lcurses"
9887 fi 15451 fi
9888 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'` 15452 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
9889 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for el_init in -ledit" >&5 15453 { echo "$as_me:$LINENO: checking for el_init in -ledit" >&5
9890$as_echo_n "checking for el_init in -ledit... " >&6; } 15454echo $ECHO_N "checking for el_init in -ledit... $ECHO_C" >&6; }
9891if ${ac_cv_lib_edit_el_init+:} false; then : 15455if test "${ac_cv_lib_edit_el_init+set}" = set; then
9892 $as_echo_n "(cached) " >&6 15456 echo $ECHO_N "(cached) $ECHO_C" >&6
9893else 15457else
9894 ac_check_lib_save_LIBS=$LIBS 15458 ac_check_lib_save_LIBS=$LIBS
9895LIBS="-ledit $OTHERLIBS 15459LIBS="-ledit $OTHERLIBS
9896 $LIBS" 15460 $LIBS"
9897cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15461cat >conftest.$ac_ext <<_ACEOF
15462/* confdefs.h. */
15463_ACEOF
15464cat confdefs.h >>conftest.$ac_ext
15465cat >>conftest.$ac_ext <<_ACEOF
9898/* end confdefs.h. */ 15466/* end confdefs.h. */
9899 15467
9900/* Override any GCC internal prototype to avoid an error. 15468/* Override any GCC internal prototype to avoid an error.
@@ -9912,31 +15480,60 @@ return el_init ();
9912 return 0; 15480 return 0;
9913} 15481}
9914_ACEOF 15482_ACEOF
9915if ac_fn_c_try_link "$LINENO"; then : 15483rm -f conftest.$ac_objext conftest$ac_exeext
15484if { (ac_try="$ac_link"
15485case "(($ac_try" in
15486 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15487 *) ac_try_echo=$ac_try;;
15488esac
15489eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15490 (eval "$ac_link") 2>conftest.er1
15491 ac_status=$?
15492 grep -v '^ *+' conftest.er1 >conftest.err
15493 rm -f conftest.er1
15494 cat conftest.err >&5
15495 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15496 (exit $ac_status); } && {
15497 test -z "$ac_c_werror_flag" ||
15498 test ! -s conftest.err
15499 } && test -s conftest$ac_exeext &&
15500 $as_test_x conftest$ac_exeext; then
9916 ac_cv_lib_edit_el_init=yes 15501 ac_cv_lib_edit_el_init=yes
9917else 15502else
9918 ac_cv_lib_edit_el_init=no 15503 echo "$as_me: failed program was:" >&5
15504sed 's/^/| /' conftest.$ac_ext >&5
15505
15506 ac_cv_lib_edit_el_init=no
9919fi 15507fi
9920rm -f core conftest.err conftest.$ac_objext \ 15508
9921 conftest$ac_exeext conftest.$ac_ext 15509rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
15510 conftest$ac_exeext conftest.$ac_ext
9922LIBS=$ac_check_lib_save_LIBS 15511LIBS=$ac_check_lib_save_LIBS
9923fi 15512fi
9924{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_edit_el_init" >&5 15513{ echo "$as_me:$LINENO: result: $ac_cv_lib_edit_el_init" >&5
9925$as_echo "$ac_cv_lib_edit_el_init" >&6; } 15514echo "${ECHO_T}$ac_cv_lib_edit_el_init" >&6; }
9926if test "x$ac_cv_lib_edit_el_init" = xyes; then : 15515if test $ac_cv_lib_edit_el_init = yes; then
9927 15516
9928$as_echo "#define USE_LIBEDIT 1" >>confdefs.h 15517cat >>confdefs.h <<\_ACEOF
15518#define USE_LIBEDIT 1
15519_ACEOF
9929 15520
9930 LIBEDIT_MSG="yes" 15521 LIBEDIT_MSG="yes"
9931 15522
9932 15523
9933else 15524else
9934 as_fn_error $? "libedit not found" "$LINENO" 5 15525 { { echo "$as_me:$LINENO: error: libedit not found" >&5
15526echo "$as_me: error: libedit not found" >&2;}
15527 { (exit 1); exit 1; }; }
9935fi 15528fi
9936 15529
9937 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libedit version is compatible" >&5 15530 { echo "$as_me:$LINENO: checking if libedit version is compatible" >&5
9938$as_echo_n "checking if libedit version is compatible... " >&6; } 15531echo $ECHO_N "checking if libedit version is compatible... $ECHO_C" >&6; }
9939 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15532 cat >conftest.$ac_ext <<_ACEOF
15533/* confdefs.h. */
15534_ACEOF
15535cat confdefs.h >>conftest.$ac_ext
15536cat >>conftest.$ac_ext <<_ACEOF
9940/* end confdefs.h. */ 15537/* end confdefs.h. */
9941 #include <histedit.h> 15538 #include <histedit.h>
9942int 15539int
@@ -9951,15 +15548,37 @@ main ()
9951 return 0; 15548 return 0;
9952} 15549}
9953_ACEOF 15550_ACEOF
9954if ac_fn_c_try_compile "$LINENO"; then : 15551rm -f conftest.$ac_objext
9955 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15552if { (ac_try="$ac_compile"
9956$as_echo "yes" >&6; } 15553case "(($ac_try" in
15554 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15555 *) ac_try_echo=$ac_try;;
15556esac
15557eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15558 (eval "$ac_compile") 2>conftest.er1
15559 ac_status=$?
15560 grep -v '^ *+' conftest.er1 >conftest.err
15561 rm -f conftest.er1
15562 cat conftest.err >&5
15563 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15564 (exit $ac_status); } && {
15565 test -z "$ac_c_werror_flag" ||
15566 test ! -s conftest.err
15567 } && test -s conftest.$ac_objext; then
15568 { echo "$as_me:$LINENO: result: yes" >&5
15569echo "${ECHO_T}yes" >&6; }
9957else 15570else
9958 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15571 echo "$as_me: failed program was:" >&5
9959$as_echo "no" >&6; } 15572sed 's/^/| /' conftest.$ac_ext >&5
9960 as_fn_error $? "libedit version is not compatible" "$LINENO" 5 15573
15574 { echo "$as_me:$LINENO: result: no" >&5
15575echo "${ECHO_T}no" >&6; }
15576 { { echo "$as_me:$LINENO: error: libedit version is not compatible" >&5
15577echo "$as_me: error: libedit version is not compatible" >&2;}
15578 { (exit 1); exit 1; }; }
9961 15579
9962fi 15580fi
15581
9963rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 15582rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9964 fi 15583 fi
9965 15584
@@ -9969,43 +15588,95 @@ fi
9969AUDIT_MODULE=none 15588AUDIT_MODULE=none
9970 15589
9971# Check whether --with-audit was given. 15590# Check whether --with-audit was given.
9972if test "${with_audit+set}" = set; then : 15591if test "${with_audit+set}" = set; then
9973 withval=$with_audit; 15592 withval=$with_audit;
9974 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for supported audit module" >&5 15593 { echo "$as_me:$LINENO: checking for supported audit module" >&5
9975$as_echo_n "checking for supported audit module... " >&6; } 15594echo $ECHO_N "checking for supported audit module... $ECHO_C" >&6; }
9976 case "$withval" in 15595 case "$withval" in
9977 bsm) 15596 bsm)
9978 { $as_echo "$as_me:${as_lineno-$LINENO}: result: bsm" >&5 15597 { echo "$as_me:$LINENO: result: bsm" >&5
9979$as_echo "bsm" >&6; } 15598echo "${ECHO_T}bsm" >&6; }
9980 AUDIT_MODULE=bsm 15599 AUDIT_MODULE=bsm
9981 for ac_header in bsm/audit.h 15600
9982do : 15601for ac_header in bsm/audit.h
9983 ac_fn_c_check_header_compile "$LINENO" "bsm/audit.h" "ac_cv_header_bsm_audit_h" " 15602do
15603as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
15604{ echo "$as_me:$LINENO: checking for $ac_header" >&5
15605echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
15606if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
15607 echo $ECHO_N "(cached) $ECHO_C" >&6
15608else
15609 cat >conftest.$ac_ext <<_ACEOF
15610/* confdefs.h. */
15611_ACEOF
15612cat confdefs.h >>conftest.$ac_ext
15613cat >>conftest.$ac_ext <<_ACEOF
15614/* end confdefs.h. */
15615
9984#ifdef HAVE_TIME_H 15616#ifdef HAVE_TIME_H
9985# include <time.h> 15617# include <time.h>
9986#endif 15618#endif
9987 15619
9988 15620
9989" 15621
9990if test "x$ac_cv_header_bsm_audit_h" = xyes; then : 15622#include <$ac_header>
15623_ACEOF
15624rm -f conftest.$ac_objext
15625if { (ac_try="$ac_compile"
15626case "(($ac_try" in
15627 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15628 *) ac_try_echo=$ac_try;;
15629esac
15630eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15631 (eval "$ac_compile") 2>conftest.er1
15632 ac_status=$?
15633 grep -v '^ *+' conftest.er1 >conftest.err
15634 rm -f conftest.er1
15635 cat conftest.err >&5
15636 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15637 (exit $ac_status); } && {
15638 test -z "$ac_c_werror_flag" ||
15639 test ! -s conftest.err
15640 } && test -s conftest.$ac_objext; then
15641 eval "$as_ac_Header=yes"
15642else
15643 echo "$as_me: failed program was:" >&5
15644sed 's/^/| /' conftest.$ac_ext >&5
15645
15646 eval "$as_ac_Header=no"
15647fi
15648
15649rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15650fi
15651ac_res=`eval echo '${'$as_ac_Header'}'`
15652 { echo "$as_me:$LINENO: result: $ac_res" >&5
15653echo "${ECHO_T}$ac_res" >&6; }
15654if test `eval echo '${'$as_ac_Header'}'` = yes; then
9991 cat >>confdefs.h <<_ACEOF 15655 cat >>confdefs.h <<_ACEOF
9992#define HAVE_BSM_AUDIT_H 1 15656#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
9993_ACEOF 15657_ACEOF
9994 15658
9995else 15659else
9996 as_fn_error $? "BSM enabled and bsm/audit.h not found" "$LINENO" 5 15660 { { echo "$as_me:$LINENO: error: BSM enabled and bsm/audit.h not found" >&5
15661echo "$as_me: error: BSM enabled and bsm/audit.h not found" >&2;}
15662 { (exit 1); exit 1; }; }
9997fi 15663fi
9998 15664
9999done 15665done
10000 15666
10001 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaudit in -lbsm" >&5 15667
10002$as_echo_n "checking for getaudit in -lbsm... " >&6; } 15668{ echo "$as_me:$LINENO: checking for getaudit in -lbsm" >&5
10003if ${ac_cv_lib_bsm_getaudit+:} false; then : 15669echo $ECHO_N "checking for getaudit in -lbsm... $ECHO_C" >&6; }
10004 $as_echo_n "(cached) " >&6 15670if test "${ac_cv_lib_bsm_getaudit+set}" = set; then
15671 echo $ECHO_N "(cached) $ECHO_C" >&6
10005else 15672else
10006 ac_check_lib_save_LIBS=$LIBS 15673 ac_check_lib_save_LIBS=$LIBS
10007LIBS="-lbsm $LIBS" 15674LIBS="-lbsm $LIBS"
10008cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15675cat >conftest.$ac_ext <<_ACEOF
15676/* confdefs.h. */
15677_ACEOF
15678cat confdefs.h >>conftest.$ac_ext
15679cat >>conftest.$ac_ext <<_ACEOF
10009/* end confdefs.h. */ 15680/* end confdefs.h. */
10010 15681
10011/* Override any GCC internal prototype to avoid an error. 15682/* Override any GCC internal prototype to avoid an error.
@@ -10023,18 +15694,39 @@ return getaudit ();
10023 return 0; 15694 return 0;
10024} 15695}
10025_ACEOF 15696_ACEOF
10026if ac_fn_c_try_link "$LINENO"; then : 15697rm -f conftest.$ac_objext conftest$ac_exeext
15698if { (ac_try="$ac_link"
15699case "(($ac_try" in
15700 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15701 *) ac_try_echo=$ac_try;;
15702esac
15703eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15704 (eval "$ac_link") 2>conftest.er1
15705 ac_status=$?
15706 grep -v '^ *+' conftest.er1 >conftest.err
15707 rm -f conftest.er1
15708 cat conftest.err >&5
15709 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15710 (exit $ac_status); } && {
15711 test -z "$ac_c_werror_flag" ||
15712 test ! -s conftest.err
15713 } && test -s conftest$ac_exeext &&
15714 $as_test_x conftest$ac_exeext; then
10027 ac_cv_lib_bsm_getaudit=yes 15715 ac_cv_lib_bsm_getaudit=yes
10028else 15716else
10029 ac_cv_lib_bsm_getaudit=no 15717 echo "$as_me: failed program was:" >&5
15718sed 's/^/| /' conftest.$ac_ext >&5
15719
15720 ac_cv_lib_bsm_getaudit=no
10030fi 15721fi
10031rm -f core conftest.err conftest.$ac_objext \ 15722
10032 conftest$ac_exeext conftest.$ac_ext 15723rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
15724 conftest$ac_exeext conftest.$ac_ext
10033LIBS=$ac_check_lib_save_LIBS 15725LIBS=$ac_check_lib_save_LIBS
10034fi 15726fi
10035{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsm_getaudit" >&5 15727{ echo "$as_me:$LINENO: result: $ac_cv_lib_bsm_getaudit" >&5
10036$as_echo "$ac_cv_lib_bsm_getaudit" >&6; } 15728echo "${ECHO_T}$ac_cv_lib_bsm_getaudit" >&6; }
10037if test "x$ac_cv_lib_bsm_getaudit" = xyes; then : 15729if test $ac_cv_lib_bsm_getaudit = yes; then
10038 cat >>confdefs.h <<_ACEOF 15730 cat >>confdefs.h <<_ACEOF
10039#define HAVE_LIBBSM 1 15731#define HAVE_LIBBSM 1
10040_ACEOF 15732_ACEOF
@@ -10042,55 +15734,362 @@ _ACEOF
10042 LIBS="-lbsm $LIBS" 15734 LIBS="-lbsm $LIBS"
10043 15735
10044else 15736else
10045 as_fn_error $? "BSM enabled and required library not found" "$LINENO" 5 15737 { { echo "$as_me:$LINENO: error: BSM enabled and required library not found" >&5
15738echo "$as_me: error: BSM enabled and required library not found" >&2;}
15739 { (exit 1); exit 1; }; }
15740fi
15741
15742
15743for ac_func in getaudit
15744do
15745as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
15746{ echo "$as_me:$LINENO: checking for $ac_func" >&5
15747echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
15748if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
15749 echo $ECHO_N "(cached) $ECHO_C" >&6
15750else
15751 cat >conftest.$ac_ext <<_ACEOF
15752/* confdefs.h. */
15753_ACEOF
15754cat confdefs.h >>conftest.$ac_ext
15755cat >>conftest.$ac_ext <<_ACEOF
15756/* end confdefs.h. */
15757/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
15758 For example, HP-UX 11i <limits.h> declares gettimeofday. */
15759#define $ac_func innocuous_$ac_func
15760
15761/* System header to define __stub macros and hopefully few prototypes,
15762 which can conflict with char $ac_func (); below.
15763 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
15764 <limits.h> exists even on freestanding compilers. */
15765
15766#ifdef __STDC__
15767# include <limits.h>
15768#else
15769# include <assert.h>
15770#endif
15771
15772#undef $ac_func
15773
15774/* Override any GCC internal prototype to avoid an error.
15775 Use char because int might match the return type of a GCC
15776 builtin and then its argument prototype would still apply. */
15777#ifdef __cplusplus
15778extern "C"
15779#endif
15780char $ac_func ();
15781/* The GNU C library defines this for functions which it implements
15782 to always fail with ENOSYS. Some functions are actually named
15783 something starting with __ and the normal name is an alias. */
15784#if defined __stub_$ac_func || defined __stub___$ac_func
15785choke me
15786#endif
15787
15788int
15789main ()
15790{
15791return $ac_func ();
15792 ;
15793 return 0;
15794}
15795_ACEOF
15796rm -f conftest.$ac_objext conftest$ac_exeext
15797if { (ac_try="$ac_link"
15798case "(($ac_try" in
15799 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15800 *) ac_try_echo=$ac_try;;
15801esac
15802eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15803 (eval "$ac_link") 2>conftest.er1
15804 ac_status=$?
15805 grep -v '^ *+' conftest.er1 >conftest.err
15806 rm -f conftest.er1
15807 cat conftest.err >&5
15808 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15809 (exit $ac_status); } && {
15810 test -z "$ac_c_werror_flag" ||
15811 test ! -s conftest.err
15812 } && test -s conftest$ac_exeext &&
15813 $as_test_x conftest$ac_exeext; then
15814 eval "$as_ac_var=yes"
15815else
15816 echo "$as_me: failed program was:" >&5
15817sed 's/^/| /' conftest.$ac_ext >&5
15818
15819 eval "$as_ac_var=no"
10046fi 15820fi
10047 15821
10048 for ac_func in getaudit 15822rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10049do : 15823 conftest$ac_exeext conftest.$ac_ext
10050 ac_fn_c_check_func "$LINENO" "getaudit" "ac_cv_func_getaudit" 15824fi
10051if test "x$ac_cv_func_getaudit" = xyes; then : 15825ac_res=`eval echo '${'$as_ac_var'}'`
15826 { echo "$as_me:$LINENO: result: $ac_res" >&5
15827echo "${ECHO_T}$ac_res" >&6; }
15828if test `eval echo '${'$as_ac_var'}'` = yes; then
10052 cat >>confdefs.h <<_ACEOF 15829 cat >>confdefs.h <<_ACEOF
10053#define HAVE_GETAUDIT 1 15830#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10054_ACEOF 15831_ACEOF
10055 15832
10056else 15833else
10057 as_fn_error $? "BSM enabled and required function not found" "$LINENO" 5 15834 { { echo "$as_me:$LINENO: error: BSM enabled and required function not found" >&5
15835echo "$as_me: error: BSM enabled and required function not found" >&2;}
15836 { (exit 1); exit 1; }; }
10058fi 15837fi
10059done 15838done
10060 15839
10061 # These are optional 15840 # These are optional
10062 for ac_func in getaudit_addr aug_get_machine 15841
10063do : 15842
10064 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 15843for ac_func in getaudit_addr aug_get_machine
10065ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 15844do
10066if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 15845as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
15846{ echo "$as_me:$LINENO: checking for $ac_func" >&5
15847echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
15848if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
15849 echo $ECHO_N "(cached) $ECHO_C" >&6
15850else
15851 cat >conftest.$ac_ext <<_ACEOF
15852/* confdefs.h. */
15853_ACEOF
15854cat confdefs.h >>conftest.$ac_ext
15855cat >>conftest.$ac_ext <<_ACEOF
15856/* end confdefs.h. */
15857/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
15858 For example, HP-UX 11i <limits.h> declares gettimeofday. */
15859#define $ac_func innocuous_$ac_func
15860
15861/* System header to define __stub macros and hopefully few prototypes,
15862 which can conflict with char $ac_func (); below.
15863 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
15864 <limits.h> exists even on freestanding compilers. */
15865
15866#ifdef __STDC__
15867# include <limits.h>
15868#else
15869# include <assert.h>
15870#endif
15871
15872#undef $ac_func
15873
15874/* Override any GCC internal prototype to avoid an error.
15875 Use char because int might match the return type of a GCC
15876 builtin and then its argument prototype would still apply. */
15877#ifdef __cplusplus
15878extern "C"
15879#endif
15880char $ac_func ();
15881/* The GNU C library defines this for functions which it implements
15882 to always fail with ENOSYS. Some functions are actually named
15883 something starting with __ and the normal name is an alias. */
15884#if defined __stub_$ac_func || defined __stub___$ac_func
15885choke me
15886#endif
15887
15888int
15889main ()
15890{
15891return $ac_func ();
15892 ;
15893 return 0;
15894}
15895_ACEOF
15896rm -f conftest.$ac_objext conftest$ac_exeext
15897if { (ac_try="$ac_link"
15898case "(($ac_try" in
15899 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15900 *) ac_try_echo=$ac_try;;
15901esac
15902eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15903 (eval "$ac_link") 2>conftest.er1
15904 ac_status=$?
15905 grep -v '^ *+' conftest.er1 >conftest.err
15906 rm -f conftest.er1
15907 cat conftest.err >&5
15908 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15909 (exit $ac_status); } && {
15910 test -z "$ac_c_werror_flag" ||
15911 test ! -s conftest.err
15912 } && test -s conftest$ac_exeext &&
15913 $as_test_x conftest$ac_exeext; then
15914 eval "$as_ac_var=yes"
15915else
15916 echo "$as_me: failed program was:" >&5
15917sed 's/^/| /' conftest.$ac_ext >&5
15918
15919 eval "$as_ac_var=no"
15920fi
15921
15922rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
15923 conftest$ac_exeext conftest.$ac_ext
15924fi
15925ac_res=`eval echo '${'$as_ac_var'}'`
15926 { echo "$as_me:$LINENO: result: $ac_res" >&5
15927echo "${ECHO_T}$ac_res" >&6; }
15928if test `eval echo '${'$as_ac_var'}'` = yes; then
10067 cat >>confdefs.h <<_ACEOF 15929 cat >>confdefs.h <<_ACEOF
10068#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 15930#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10069_ACEOF 15931_ACEOF
10070 15932
10071fi 15933fi
10072done 15934done
10073 15935
10074 15936
10075$as_echo "#define USE_BSM_AUDIT 1" >>confdefs.h 15937cat >>confdefs.h <<\_ACEOF
15938#define USE_BSM_AUDIT 1
15939_ACEOF
10076 15940
10077 if test "$sol2ver" -ge 11; then 15941 if test "$sol2ver" -ge 11; then
10078 SSHDLIBS="$SSHDLIBS -lscf" 15942 SSHDLIBS="$SSHDLIBS -lscf"
10079 15943
10080$as_echo "#define BROKEN_BSM_API 1" >>confdefs.h 15944cat >>confdefs.h <<\_ACEOF
15945#define BROKEN_BSM_API 1
15946_ACEOF
10081 15947
10082 fi 15948 fi
10083 ;; 15949 ;;
10084 linux) 15950 linux)
10085 { $as_echo "$as_me:${as_lineno-$LINENO}: result: linux" >&5 15951 { echo "$as_me:$LINENO: result: linux" >&5
10086$as_echo "linux" >&6; } 15952echo "${ECHO_T}linux" >&6; }
10087 AUDIT_MODULE=linux 15953 AUDIT_MODULE=linux
10088 for ac_header in libaudit.h 15954
10089do : 15955for ac_header in libaudit.h
10090 ac_fn_c_check_header_mongrel "$LINENO" "libaudit.h" "ac_cv_header_libaudit_h" "$ac_includes_default" 15956do
10091if test "x$ac_cv_header_libaudit_h" = xyes; then : 15957as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
15958if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
15959 { echo "$as_me:$LINENO: checking for $ac_header" >&5
15960echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
15961if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
15962 echo $ECHO_N "(cached) $ECHO_C" >&6
15963fi
15964ac_res=`eval echo '${'$as_ac_Header'}'`
15965 { echo "$as_me:$LINENO: result: $ac_res" >&5
15966echo "${ECHO_T}$ac_res" >&6; }
15967else
15968 # Is the header compilable?
15969{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
15970echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
15971cat >conftest.$ac_ext <<_ACEOF
15972/* confdefs.h. */
15973_ACEOF
15974cat confdefs.h >>conftest.$ac_ext
15975cat >>conftest.$ac_ext <<_ACEOF
15976/* end confdefs.h. */
15977$ac_includes_default
15978#include <$ac_header>
15979_ACEOF
15980rm -f conftest.$ac_objext
15981if { (ac_try="$ac_compile"
15982case "(($ac_try" in
15983 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
15984 *) ac_try_echo=$ac_try;;
15985esac
15986eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
15987 (eval "$ac_compile") 2>conftest.er1
15988 ac_status=$?
15989 grep -v '^ *+' conftest.er1 >conftest.err
15990 rm -f conftest.er1
15991 cat conftest.err >&5
15992 echo "$as_me:$LINENO: \$? = $ac_status" >&5
15993 (exit $ac_status); } && {
15994 test -z "$ac_c_werror_flag" ||
15995 test ! -s conftest.err
15996 } && test -s conftest.$ac_objext; then
15997 ac_header_compiler=yes
15998else
15999 echo "$as_me: failed program was:" >&5
16000sed 's/^/| /' conftest.$ac_ext >&5
16001
16002 ac_header_compiler=no
16003fi
16004
16005rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16006{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
16007echo "${ECHO_T}$ac_header_compiler" >&6; }
16008
16009# Is the header present?
16010{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
16011echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
16012cat >conftest.$ac_ext <<_ACEOF
16013/* confdefs.h. */
16014_ACEOF
16015cat confdefs.h >>conftest.$ac_ext
16016cat >>conftest.$ac_ext <<_ACEOF
16017/* end confdefs.h. */
16018#include <$ac_header>
16019_ACEOF
16020if { (ac_try="$ac_cpp conftest.$ac_ext"
16021case "(($ac_try" in
16022 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16023 *) ac_try_echo=$ac_try;;
16024esac
16025eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16026 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
16027 ac_status=$?
16028 grep -v '^ *+' conftest.er1 >conftest.err
16029 rm -f conftest.er1
16030 cat conftest.err >&5
16031 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16032 (exit $ac_status); } >/dev/null && {
16033 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
16034 test ! -s conftest.err
16035 }; then
16036 ac_header_preproc=yes
16037else
16038 echo "$as_me: failed program was:" >&5
16039sed 's/^/| /' conftest.$ac_ext >&5
16040
16041 ac_header_preproc=no
16042fi
16043
16044rm -f conftest.err conftest.$ac_ext
16045{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
16046echo "${ECHO_T}$ac_header_preproc" >&6; }
16047
16048# So? What about this header?
16049case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
16050 yes:no: )
16051 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
16052echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
16053 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
16054echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
16055 ac_header_preproc=yes
16056 ;;
16057 no:yes:* )
16058 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
16059echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
16060 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
16061echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
16062 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
16063echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
16064 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
16065echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
16066 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
16067echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
16068 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
16069echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
16070 ( cat <<\_ASBOX
16071## ------------------------------------------- ##
16072## Report this to openssh-unix-dev@mindrot.org ##
16073## ------------------------------------------- ##
16074_ASBOX
16075 ) | sed "s/^/$as_me: WARNING: /" >&2
16076 ;;
16077esac
16078{ echo "$as_me:$LINENO: checking for $ac_header" >&5
16079echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
16080if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
16081 echo $ECHO_N "(cached) $ECHO_C" >&6
16082else
16083 eval "$as_ac_Header=\$ac_header_preproc"
16084fi
16085ac_res=`eval echo '${'$as_ac_Header'}'`
16086 { echo "$as_me:$LINENO: result: $ac_res" >&5
16087echo "${ECHO_T}$ac_res" >&6; }
16088
16089fi
16090if test `eval echo '${'$as_ac_Header'}'` = yes; then
10092 cat >>confdefs.h <<_ACEOF 16091 cat >>confdefs.h <<_ACEOF
10093#define HAVE_LIBAUDIT_H 1 16092#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
10094_ACEOF 16093_ACEOF
10095 16094
10096fi 16095fi
@@ -10099,23 +16098,29 @@ done
10099 16098
10100 SSHDLIBS="$SSHDLIBS -laudit" 16099 SSHDLIBS="$SSHDLIBS -laudit"
10101 16100
10102$as_echo "#define USE_LINUX_AUDIT 1" >>confdefs.h 16101cat >>confdefs.h <<\_ACEOF
16102#define USE_LINUX_AUDIT 1
16103_ACEOF
10103 16104
10104 ;; 16105 ;;
10105 debug) 16106 debug)
10106 AUDIT_MODULE=debug 16107 AUDIT_MODULE=debug
10107 { $as_echo "$as_me:${as_lineno-$LINENO}: result: debug" >&5 16108 { echo "$as_me:$LINENO: result: debug" >&5
10108$as_echo "debug" >&6; } 16109echo "${ECHO_T}debug" >&6; }
10109 16110
10110$as_echo "#define SSH_AUDIT_EVENTS 1" >>confdefs.h 16111cat >>confdefs.h <<\_ACEOF
16112#define SSH_AUDIT_EVENTS 1
16113_ACEOF
10111 16114
10112 ;; 16115 ;;
10113 no) 16116 no)
10114 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16117 { echo "$as_me:$LINENO: result: no" >&5
10115$as_echo "no" >&6; } 16118echo "${ECHO_T}no" >&6; }
10116 ;; 16119 ;;
10117 *) 16120 *)
10118 as_fn_error $? "Unknown audit module $withval" "$LINENO" 5 16121 { { echo "$as_me:$LINENO: error: Unknown audit module $withval" >&5
16122echo "$as_me: error: Unknown audit module $withval" >&2;}
16123 { (exit 1); exit 1; }; }
10119 ;; 16124 ;;
10120 esac 16125 esac
10121 16126
@@ -10124,7 +16129,7 @@ fi
10124 16129
10125 16130
10126# Check whether --with-pie was given. 16131# Check whether --with-pie was given.
10127if test "${with_pie+set}" = set; then : 16132if test "${with_pie+set}" = set; then
10128 withval=$with_pie; 16133 withval=$with_pie;
10129 if test "x$withval" = "xno"; then 16134 if test "x$withval" = "xno"; then
10130 use_pie=no 16135 use_pie=no
@@ -10145,9 +16150,13 @@ if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then
10145fi 16150fi
10146if test "x$use_pie" = "xauto"; then 16151if test "x$use_pie" = "xauto"; then
10147 # Automatic PIE requires gcc >= 4.x 16152 # Automatic PIE requires gcc >= 4.x
10148 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc >= 4.x" >&5 16153 { echo "$as_me:$LINENO: checking for gcc >= 4.x" >&5
10149$as_echo_n "checking for gcc >= 4.x... " >&6; } 16154echo $ECHO_N "checking for gcc >= 4.x... $ECHO_C" >&6; }
10150 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 16155 cat >conftest.$ac_ext <<_ACEOF
16156/* confdefs.h. */
16157_ACEOF
16158cat confdefs.h >>conftest.$ac_ext
16159cat >>conftest.$ac_ext <<_ACEOF
10151/* end confdefs.h. */ 16160/* end confdefs.h. */
10152 16161
10153#if !defined(__GNUC__) || __GNUC__ < 4 16162#if !defined(__GNUC__) || __GNUC__ < 4
@@ -10155,28 +16164,52 @@ $as_echo_n "checking for gcc >= 4.x... " >&6; }
10155#endif 16164#endif
10156 16165
10157_ACEOF 16166_ACEOF
10158if ac_fn_c_try_compile "$LINENO"; then : 16167rm -f conftest.$ac_objext
10159 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 16168if { (ac_try="$ac_compile"
10160$as_echo "yes" >&6; } 16169case "(($ac_try" in
16170 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16171 *) ac_try_echo=$ac_try;;
16172esac
16173eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16174 (eval "$ac_compile") 2>conftest.er1
16175 ac_status=$?
16176 grep -v '^ *+' conftest.er1 >conftest.err
16177 rm -f conftest.er1
16178 cat conftest.err >&5
16179 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16180 (exit $ac_status); } && {
16181 test -z "$ac_c_werror_flag" ||
16182 test ! -s conftest.err
16183 } && test -s conftest.$ac_objext; then
16184 { echo "$as_me:$LINENO: result: yes" >&5
16185echo "${ECHO_T}yes" >&6; }
10161else 16186else
10162 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16187 echo "$as_me: failed program was:" >&5
10163$as_echo "no" >&6; } 16188sed 's/^/| /' conftest.$ac_ext >&5
16189
16190 { echo "$as_me:$LINENO: result: no" >&5
16191echo "${ECHO_T}no" >&6; }
10164 use_pie=no 16192 use_pie=no
10165 16193
10166fi 16194fi
16195
10167rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 16196rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10168fi 16197fi
10169if test "x$use_pie" != "xno"; then 16198if test "x$use_pie" != "xno"; then
10170 SAVED_CFLAGS="$CFLAGS" 16199 SAVED_CFLAGS="$CFLAGS"
10171 SAVED_LDFLAGS="$LDFLAGS" 16200 SAVED_LDFLAGS="$LDFLAGS"
10172 { 16201 {
10173 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports compile flag -fPIE" >&5 16202 { echo "$as_me:$LINENO: checking if $CC supports compile flag -fPIE" >&5
10174$as_echo_n "checking if $CC supports compile flag -fPIE... " >&6; } 16203echo $ECHO_N "checking if $CC supports compile flag -fPIE... $ECHO_C" >&6; }
10175 saved_CFLAGS="$CFLAGS" 16204 saved_CFLAGS="$CFLAGS"
10176 CFLAGS="$CFLAGS $WERROR -fPIE" 16205 CFLAGS="$CFLAGS $WERROR -fPIE"
10177 _define_flag="" 16206 _define_flag=""
10178 test "x$_define_flag" = "x" && _define_flag="-fPIE" 16207 test "x$_define_flag" = "x" && _define_flag="-fPIE"
10179 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 16208 cat >conftest.$ac_ext <<_ACEOF
16209/* confdefs.h. */
16210_ACEOF
16211cat confdefs.h >>conftest.$ac_ext
16212cat >>conftest.$ac_ext <<_ACEOF
10180/* end confdefs.h. */ 16213/* end confdefs.h. */
10181 16214
10182#include <stdlib.h> 16215#include <stdlib.h>
@@ -10192,34 +16225,58 @@ int main(int argc, char **argv) {
10192} 16225}
10193 16226
10194_ACEOF 16227_ACEOF
10195if ac_fn_c_try_compile "$LINENO"; then : 16228rm -f conftest.$ac_objext
16229if { (ac_try="$ac_compile"
16230case "(($ac_try" in
16231 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16232 *) ac_try_echo=$ac_try;;
16233esac
16234eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16235 (eval "$ac_compile") 2>conftest.er1
16236 ac_status=$?
16237 grep -v '^ *+' conftest.er1 >conftest.err
16238 rm -f conftest.er1
16239 cat conftest.err >&5
16240 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16241 (exit $ac_status); } && {
16242 test -z "$ac_c_werror_flag" ||
16243 test ! -s conftest.err
16244 } && test -s conftest.$ac_objext; then
10196 16245
10197if `grep -i "unrecognized option" conftest.err >/dev/null` 16246if `grep -i "unrecognized option" conftest.err >/dev/null`
10198then 16247then
10199 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16248 { echo "$as_me:$LINENO: result: no" >&5
10200$as_echo "no" >&6; } 16249echo "${ECHO_T}no" >&6; }
10201 CFLAGS="$saved_CFLAGS" 16250 CFLAGS="$saved_CFLAGS"
10202else 16251else
10203 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 16252 { echo "$as_me:$LINENO: result: yes" >&5
10204$as_echo "yes" >&6; } 16253echo "${ECHO_T}yes" >&6; }
10205 CFLAGS="$saved_CFLAGS $_define_flag" 16254 CFLAGS="$saved_CFLAGS $_define_flag"
10206fi 16255fi
10207else 16256else
10208 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16257 echo "$as_me: failed program was:" >&5
10209$as_echo "no" >&6; } 16258sed 's/^/| /' conftest.$ac_ext >&5
16259
16260 { echo "$as_me:$LINENO: result: no" >&5
16261echo "${ECHO_T}no" >&6; }
10210 CFLAGS="$saved_CFLAGS" 16262 CFLAGS="$saved_CFLAGS"
10211 16263
10212fi 16264fi
16265
10213rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 16266rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10214} 16267}
10215 { 16268 {
10216 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $LD supports link flag -pie" >&5 16269 { echo "$as_me:$LINENO: checking if $LD supports link flag -pie" >&5
10217$as_echo_n "checking if $LD supports link flag -pie... " >&6; } 16270echo $ECHO_N "checking if $LD supports link flag -pie... $ECHO_C" >&6; }
10218 saved_LDFLAGS="$LDFLAGS" 16271 saved_LDFLAGS="$LDFLAGS"
10219 LDFLAGS="$LDFLAGS $WERROR -pie" 16272 LDFLAGS="$LDFLAGS $WERROR -pie"
10220 _define_flag="" 16273 _define_flag=""
10221 test "x$_define_flag" = "x" && _define_flag="-pie" 16274 test "x$_define_flag" = "x" && _define_flag="-pie"
10222 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 16275 cat >conftest.$ac_ext <<_ACEOF
16276/* confdefs.h. */
16277_ACEOF
16278cat confdefs.h >>conftest.$ac_ext
16279cat >>conftest.$ac_ext <<_ACEOF
10223/* end confdefs.h. */ 16280/* end confdefs.h. */
10224 16281
10225#include <stdlib.h> 16282#include <stdlib.h>
@@ -10235,34 +16292,164 @@ int main(int argc, char **argv) {
10235} 16292}
10236 16293
10237_ACEOF 16294_ACEOF
10238if ac_fn_c_try_link "$LINENO"; then : 16295rm -f conftest.$ac_objext conftest$ac_exeext
10239 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 16296if { (ac_try="$ac_link"
10240$as_echo "yes" >&6; } 16297case "(($ac_try" in
16298 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16299 *) ac_try_echo=$ac_try;;
16300esac
16301eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16302 (eval "$ac_link") 2>conftest.er1
16303 ac_status=$?
16304 grep -v '^ *+' conftest.er1 >conftest.err
16305 rm -f conftest.er1
16306 cat conftest.err >&5
16307 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16308 (exit $ac_status); } && {
16309 test -z "$ac_c_werror_flag" ||
16310 test ! -s conftest.err
16311 } && test -s conftest$ac_exeext &&
16312 $as_test_x conftest$ac_exeext; then
16313 { echo "$as_me:$LINENO: result: yes" >&5
16314echo "${ECHO_T}yes" >&6; }
10241 LDFLAGS="$saved_LDFLAGS $_define_flag" 16315 LDFLAGS="$saved_LDFLAGS $_define_flag"
10242else 16316else
10243 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16317 echo "$as_me: failed program was:" >&5
10244$as_echo "no" >&6; } 16318sed 's/^/| /' conftest.$ac_ext >&5
16319
16320 { echo "$as_me:$LINENO: result: no" >&5
16321echo "${ECHO_T}no" >&6; }
10245 LDFLAGS="$saved_LDFLAGS" 16322 LDFLAGS="$saved_LDFLAGS"
10246 16323
10247fi 16324fi
10248rm -f core conftest.err conftest.$ac_objext \ 16325
10249 conftest$ac_exeext conftest.$ac_ext 16326rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16327 conftest$ac_exeext conftest.$ac_ext
10250} 16328}
10251 # We use both -fPIE and -pie or neither. 16329 # We use both -fPIE and -pie or neither.
10252 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether both -fPIE and -pie are supported" >&5 16330 { echo "$as_me:$LINENO: checking whether both -fPIE and -pie are supported" >&5
10253$as_echo_n "checking whether both -fPIE and -pie are supported... " >&6; } 16331echo $ECHO_N "checking whether both -fPIE and -pie are supported... $ECHO_C" >&6; }
10254 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \ 16332 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \
10255 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then 16333 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then
10256 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 16334 { echo "$as_me:$LINENO: result: yes" >&5
10257$as_echo "yes" >&6; } 16335echo "${ECHO_T}yes" >&6; }
10258 else 16336 else
10259 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16337 { echo "$as_me:$LINENO: result: no" >&5
10260$as_echo "no" >&6; } 16338echo "${ECHO_T}no" >&6; }
10261 CFLAGS="$SAVED_CFLAGS" 16339 CFLAGS="$SAVED_CFLAGS"
10262 LDFLAGS="$SAVED_LDFLAGS" 16340 LDFLAGS="$SAVED_LDFLAGS"
10263 fi 16341 fi
10264fi 16342fi
10265 16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
10266for ac_func in \ 16453for ac_func in \
10267 Blowfish_initstate \ 16454 Blowfish_initstate \
10268 Blowfish_expandstate \ 16455 Blowfish_expandstate \
@@ -10322,6 +16509,7 @@ for ac_func in \
10322 prctl \ 16509 prctl \
10323 pstat \ 16510 pstat \
10324 readpassphrase \ 16511 readpassphrase \
16512 reallocarray \
10325 realpath \ 16513 realpath \
10326 recvmsg \ 16514 recvmsg \
10327 rresvport_af \ 16515 rresvport_af \
@@ -10373,19 +16561,104 @@ for ac_func in \
10373 vsnprintf \ 16561 vsnprintf \
10374 waitpid \ 16562 waitpid \
10375 16563
10376do : 16564do
10377 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 16565as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10378ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 16566{ echo "$as_me:$LINENO: checking for $ac_func" >&5
10379if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 16567echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
16568if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
16569 echo $ECHO_N "(cached) $ECHO_C" >&6
16570else
16571 cat >conftest.$ac_ext <<_ACEOF
16572/* confdefs.h. */
16573_ACEOF
16574cat confdefs.h >>conftest.$ac_ext
16575cat >>conftest.$ac_ext <<_ACEOF
16576/* end confdefs.h. */
16577/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
16578 For example, HP-UX 11i <limits.h> declares gettimeofday. */
16579#define $ac_func innocuous_$ac_func
16580
16581/* System header to define __stub macros and hopefully few prototypes,
16582 which can conflict with char $ac_func (); below.
16583 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
16584 <limits.h> exists even on freestanding compilers. */
16585
16586#ifdef __STDC__
16587# include <limits.h>
16588#else
16589# include <assert.h>
16590#endif
16591
16592#undef $ac_func
16593
16594/* Override any GCC internal prototype to avoid an error.
16595 Use char because int might match the return type of a GCC
16596 builtin and then its argument prototype would still apply. */
16597#ifdef __cplusplus
16598extern "C"
16599#endif
16600char $ac_func ();
16601/* The GNU C library defines this for functions which it implements
16602 to always fail with ENOSYS. Some functions are actually named
16603 something starting with __ and the normal name is an alias. */
16604#if defined __stub_$ac_func || defined __stub___$ac_func
16605choke me
16606#endif
16607
16608int
16609main ()
16610{
16611return $ac_func ();
16612 ;
16613 return 0;
16614}
16615_ACEOF
16616rm -f conftest.$ac_objext conftest$ac_exeext
16617if { (ac_try="$ac_link"
16618case "(($ac_try" in
16619 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16620 *) ac_try_echo=$ac_try;;
16621esac
16622eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16623 (eval "$ac_link") 2>conftest.er1
16624 ac_status=$?
16625 grep -v '^ *+' conftest.er1 >conftest.err
16626 rm -f conftest.er1
16627 cat conftest.err >&5
16628 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16629 (exit $ac_status); } && {
16630 test -z "$ac_c_werror_flag" ||
16631 test ! -s conftest.err
16632 } && test -s conftest$ac_exeext &&
16633 $as_test_x conftest$ac_exeext; then
16634 eval "$as_ac_var=yes"
16635else
16636 echo "$as_me: failed program was:" >&5
16637sed 's/^/| /' conftest.$ac_ext >&5
16638
16639 eval "$as_ac_var=no"
16640fi
16641
16642rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16643 conftest$ac_exeext conftest.$ac_ext
16644fi
16645ac_res=`eval echo '${'$as_ac_var'}'`
16646 { echo "$as_me:$LINENO: result: $ac_res" >&5
16647echo "${ECHO_T}$ac_res" >&6; }
16648if test `eval echo '${'$as_ac_var'}'` = yes; then
10380 cat >>confdefs.h <<_ACEOF 16649 cat >>confdefs.h <<_ACEOF
10381#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 16650#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10382_ACEOF 16651_ACEOF
10383 16652
10384fi 16653fi
10385done 16654done
10386 16655
10387 16656
10388cat confdefs.h - <<_ACEOF >conftest.$ac_ext 16657cat >conftest.$ac_ext <<_ACEOF
16658/* confdefs.h. */
16659_ACEOF
16660cat confdefs.h >>conftest.$ac_ext
16661cat >>conftest.$ac_ext <<_ACEOF
10389/* end confdefs.h. */ 16662/* end confdefs.h. */
10390 #include <ctype.h> 16663 #include <ctype.h>
10391int 16664int
@@ -10396,23 +16669,54 @@ main ()
10396 return 0; 16669 return 0;
10397} 16670}
10398_ACEOF 16671_ACEOF
10399if ac_fn_c_try_link "$LINENO"; then : 16672rm -f conftest.$ac_objext conftest$ac_exeext
16673if { (ac_try="$ac_link"
16674case "(($ac_try" in
16675 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16676 *) ac_try_echo=$ac_try;;
16677esac
16678eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16679 (eval "$ac_link") 2>conftest.er1
16680 ac_status=$?
16681 grep -v '^ *+' conftest.er1 >conftest.err
16682 rm -f conftest.er1
16683 cat conftest.err >&5
16684 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16685 (exit $ac_status); } && {
16686 test -z "$ac_c_werror_flag" ||
16687 test ! -s conftest.err
16688 } && test -s conftest$ac_exeext &&
16689 $as_test_x conftest$ac_exeext; then
16690
16691cat >>confdefs.h <<\_ACEOF
16692#define HAVE_ISBLANK 1
16693_ACEOF
10400 16694
10401$as_echo "#define HAVE_ISBLANK 1" >>confdefs.h 16695
16696else
16697 echo "$as_me: failed program was:" >&5
16698sed 's/^/| /' conftest.$ac_ext >&5
10402 16699
10403 16700
10404fi 16701fi
10405rm -f core conftest.err conftest.$ac_objext \
10406 conftest$ac_exeext conftest.$ac_ext
10407 16702
10408# PKCS#11 support requires dlopen() and co 16703rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10409{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 16704 conftest$ac_exeext conftest.$ac_ext
10410$as_echo_n "checking for library containing dlopen... " >&6; } 16705
10411if ${ac_cv_search_dlopen+:} false; then : 16706# PKCS11 depends on OpenSSL.
10412 $as_echo_n "(cached) " >&6 16707if test "x$openssl" = "xyes" ; then
16708 # PKCS#11 support requires dlopen() and co
16709 { echo "$as_me:$LINENO: checking for library containing dlopen" >&5
16710echo $ECHO_N "checking for library containing dlopen... $ECHO_C" >&6; }
16711if test "${ac_cv_search_dlopen+set}" = set; then
16712 echo $ECHO_N "(cached) $ECHO_C" >&6
10413else 16713else
10414 ac_func_search_save_LIBS=$LIBS 16714 ac_func_search_save_LIBS=$LIBS
10415cat confdefs.h - <<_ACEOF >conftest.$ac_ext 16715cat >conftest.$ac_ext <<_ACEOF
16716/* confdefs.h. */
16717_ACEOF
16718cat confdefs.h >>conftest.$ac_ext
16719cat >>conftest.$ac_ext <<_ACEOF
10416/* end confdefs.h. */ 16720/* end confdefs.h. */
10417 16721
10418/* Override any GCC internal prototype to avoid an error. 16722/* Override any GCC internal prototype to avoid an error.
@@ -10437,47 +16741,162 @@ for ac_lib in '' dl; do
10437 ac_res=-l$ac_lib 16741 ac_res=-l$ac_lib
10438 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 16742 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
10439 fi 16743 fi
10440 if ac_fn_c_try_link "$LINENO"; then : 16744 rm -f conftest.$ac_objext conftest$ac_exeext
16745if { (ac_try="$ac_link"
16746case "(($ac_try" in
16747 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16748 *) ac_try_echo=$ac_try;;
16749esac
16750eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16751 (eval "$ac_link") 2>conftest.er1
16752 ac_status=$?
16753 grep -v '^ *+' conftest.er1 >conftest.err
16754 rm -f conftest.er1
16755 cat conftest.err >&5
16756 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16757 (exit $ac_status); } && {
16758 test -z "$ac_c_werror_flag" ||
16759 test ! -s conftest.err
16760 } && test -s conftest$ac_exeext &&
16761 $as_test_x conftest$ac_exeext; then
10441 ac_cv_search_dlopen=$ac_res 16762 ac_cv_search_dlopen=$ac_res
16763else
16764 echo "$as_me: failed program was:" >&5
16765sed 's/^/| /' conftest.$ac_ext >&5
16766
16767
10442fi 16768fi
10443rm -f core conftest.err conftest.$ac_objext \ 16769
10444 conftest$ac_exeext 16770rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10445 if ${ac_cv_search_dlopen+:} false; then : 16771 conftest$ac_exeext
16772 if test "${ac_cv_search_dlopen+set}" = set; then
10446 break 16773 break
10447fi 16774fi
10448done 16775done
10449if ${ac_cv_search_dlopen+:} false; then : 16776if test "${ac_cv_search_dlopen+set}" = set; then
10450 16777 :
10451else 16778else
10452 ac_cv_search_dlopen=no 16779 ac_cv_search_dlopen=no
10453fi 16780fi
10454rm conftest.$ac_ext 16781rm conftest.$ac_ext
10455LIBS=$ac_func_search_save_LIBS 16782LIBS=$ac_func_search_save_LIBS
10456fi 16783fi
10457{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 16784{ echo "$as_me:$LINENO: result: $ac_cv_search_dlopen" >&5
10458$as_echo "$ac_cv_search_dlopen" >&6; } 16785echo "${ECHO_T}$ac_cv_search_dlopen" >&6; }
10459ac_res=$ac_cv_search_dlopen 16786ac_res=$ac_cv_search_dlopen
10460if test "$ac_res" != no; then : 16787if test "$ac_res" != no; then
10461 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 16788 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
10462 16789
10463$as_echo "#define ENABLE_PKCS11 /**/" >>confdefs.h 16790cat >>confdefs.h <<\_ACEOF
16791#define ENABLE_PKCS11
16792_ACEOF
10464 16793
10465 16794
10466fi 16795fi
10467 16796
16797fi
10468 16798
10469# IRIX has a const char return value for gai_strerror() 16799# IRIX has a const char return value for gai_strerror()
16800
10470for ac_func in gai_strerror 16801for ac_func in gai_strerror
10471do : 16802do
10472 ac_fn_c_check_func "$LINENO" "gai_strerror" "ac_cv_func_gai_strerror" 16803as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10473if test "x$ac_cv_func_gai_strerror" = xyes; then : 16804{ echo "$as_me:$LINENO: checking for $ac_func" >&5
16805echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
16806if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
16807 echo $ECHO_N "(cached) $ECHO_C" >&6
16808else
16809 cat >conftest.$ac_ext <<_ACEOF
16810/* confdefs.h. */
16811_ACEOF
16812cat confdefs.h >>conftest.$ac_ext
16813cat >>conftest.$ac_ext <<_ACEOF
16814/* end confdefs.h. */
16815/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
16816 For example, HP-UX 11i <limits.h> declares gettimeofday. */
16817#define $ac_func innocuous_$ac_func
16818
16819/* System header to define __stub macros and hopefully few prototypes,
16820 which can conflict with char $ac_func (); below.
16821 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
16822 <limits.h> exists even on freestanding compilers. */
16823
16824#ifdef __STDC__
16825# include <limits.h>
16826#else
16827# include <assert.h>
16828#endif
16829
16830#undef $ac_func
16831
16832/* Override any GCC internal prototype to avoid an error.
16833 Use char because int might match the return type of a GCC
16834 builtin and then its argument prototype would still apply. */
16835#ifdef __cplusplus
16836extern "C"
16837#endif
16838char $ac_func ();
16839/* The GNU C library defines this for functions which it implements
16840 to always fail with ENOSYS. Some functions are actually named
16841 something starting with __ and the normal name is an alias. */
16842#if defined __stub_$ac_func || defined __stub___$ac_func
16843choke me
16844#endif
16845
16846int
16847main ()
16848{
16849return $ac_func ();
16850 ;
16851 return 0;
16852}
16853_ACEOF
16854rm -f conftest.$ac_objext conftest$ac_exeext
16855if { (ac_try="$ac_link"
16856case "(($ac_try" in
16857 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16858 *) ac_try_echo=$ac_try;;
16859esac
16860eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16861 (eval "$ac_link") 2>conftest.er1
16862 ac_status=$?
16863 grep -v '^ *+' conftest.er1 >conftest.err
16864 rm -f conftest.er1
16865 cat conftest.err >&5
16866 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16867 (exit $ac_status); } && {
16868 test -z "$ac_c_werror_flag" ||
16869 test ! -s conftest.err
16870 } && test -s conftest$ac_exeext &&
16871 $as_test_x conftest$ac_exeext; then
16872 eval "$as_ac_var=yes"
16873else
16874 echo "$as_me: failed program was:" >&5
16875sed 's/^/| /' conftest.$ac_ext >&5
16876
16877 eval "$as_ac_var=no"
16878fi
16879
16880rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16881 conftest$ac_exeext conftest.$ac_ext
16882fi
16883ac_res=`eval echo '${'$as_ac_var'}'`
16884 { echo "$as_me:$LINENO: result: $ac_res" >&5
16885echo "${ECHO_T}$ac_res" >&6; }
16886if test `eval echo '${'$as_ac_var'}'` = yes; then
10474 cat >>confdefs.h <<_ACEOF 16887 cat >>confdefs.h <<_ACEOF
10475#define HAVE_GAI_STRERROR 1 16888#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10476_ACEOF 16889_ACEOF
10477 16890
10478 $as_echo "#define HAVE_GAI_STRERROR 1" >>confdefs.h 16891 cat >>confdefs.h <<\_ACEOF
16892#define HAVE_GAI_STRERROR 1
16893_ACEOF
10479 16894
10480 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 16895 cat >conftest.$ac_ext <<_ACEOF
16896/* confdefs.h. */
16897_ACEOF
16898cat confdefs.h >>conftest.$ac_ext
16899cat >>conftest.$ac_ext <<_ACEOF
10481/* end confdefs.h. */ 16900/* end confdefs.h. */
10482 16901
10483#include <sys/types.h> 16902#include <sys/types.h>
@@ -10497,24 +16916,52 @@ main ()
10497 return 0; 16916 return 0;
10498} 16917}
10499_ACEOF 16918_ACEOF
10500if ac_fn_c_try_compile "$LINENO"; then : 16919rm -f conftest.$ac_objext
16920if { (ac_try="$ac_compile"
16921case "(($ac_try" in
16922 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16923 *) ac_try_echo=$ac_try;;
16924esac
16925eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16926 (eval "$ac_compile") 2>conftest.er1
16927 ac_status=$?
16928 grep -v '^ *+' conftest.er1 >conftest.err
16929 rm -f conftest.er1
16930 cat conftest.err >&5
16931 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16932 (exit $ac_status); } && {
16933 test -z "$ac_c_werror_flag" ||
16934 test ! -s conftest.err
16935 } && test -s conftest.$ac_objext; then
16936
16937
16938cat >>confdefs.h <<\_ACEOF
16939#define HAVE_CONST_GAI_STRERROR_PROTO 1
16940_ACEOF
10501 16941
16942else
16943 echo "$as_me: failed program was:" >&5
16944sed 's/^/| /' conftest.$ac_ext >&5
10502 16945
10503$as_echo "#define HAVE_CONST_GAI_STRERROR_PROTO 1" >>confdefs.h
10504 16946
10505fi 16947fi
16948
10506rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 16949rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10507fi 16950fi
10508done 16951done
10509 16952
10510 16953
10511{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5 16954{ echo "$as_me:$LINENO: checking for library containing nanosleep" >&5
10512$as_echo_n "checking for library containing nanosleep... " >&6; } 16955echo $ECHO_N "checking for library containing nanosleep... $ECHO_C" >&6; }
10513if ${ac_cv_search_nanosleep+:} false; then : 16956if test "${ac_cv_search_nanosleep+set}" = set; then
10514 $as_echo_n "(cached) " >&6 16957 echo $ECHO_N "(cached) $ECHO_C" >&6
10515else 16958else
10516 ac_func_search_save_LIBS=$LIBS 16959 ac_func_search_save_LIBS=$LIBS
10517cat confdefs.h - <<_ACEOF >conftest.$ac_ext 16960cat >conftest.$ac_ext <<_ACEOF
16961/* confdefs.h. */
16962_ACEOF
16963cat confdefs.h >>conftest.$ac_ext
16964cat >>conftest.$ac_ext <<_ACEOF
10518/* end confdefs.h. */ 16965/* end confdefs.h. */
10519 16966
10520/* Override any GCC internal prototype to avoid an error. 16967/* Override any GCC internal prototype to avoid an error.
@@ -10539,41 +16986,70 @@ for ac_lib in '' rt posix4; do
10539 ac_res=-l$ac_lib 16986 ac_res=-l$ac_lib
10540 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 16987 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
10541 fi 16988 fi
10542 if ac_fn_c_try_link "$LINENO"; then : 16989 rm -f conftest.$ac_objext conftest$ac_exeext
16990if { (ac_try="$ac_link"
16991case "(($ac_try" in
16992 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16993 *) ac_try_echo=$ac_try;;
16994esac
16995eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
16996 (eval "$ac_link") 2>conftest.er1
16997 ac_status=$?
16998 grep -v '^ *+' conftest.er1 >conftest.err
16999 rm -f conftest.er1
17000 cat conftest.err >&5
17001 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17002 (exit $ac_status); } && {
17003 test -z "$ac_c_werror_flag" ||
17004 test ! -s conftest.err
17005 } && test -s conftest$ac_exeext &&
17006 $as_test_x conftest$ac_exeext; then
10543 ac_cv_search_nanosleep=$ac_res 17007 ac_cv_search_nanosleep=$ac_res
17008else
17009 echo "$as_me: failed program was:" >&5
17010sed 's/^/| /' conftest.$ac_ext >&5
17011
17012
10544fi 17013fi
10545rm -f core conftest.err conftest.$ac_objext \ 17014
10546 conftest$ac_exeext 17015rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10547 if ${ac_cv_search_nanosleep+:} false; then : 17016 conftest$ac_exeext
17017 if test "${ac_cv_search_nanosleep+set}" = set; then
10548 break 17018 break
10549fi 17019fi
10550done 17020done
10551if ${ac_cv_search_nanosleep+:} false; then : 17021if test "${ac_cv_search_nanosleep+set}" = set; then
10552 17022 :
10553else 17023else
10554 ac_cv_search_nanosleep=no 17024 ac_cv_search_nanosleep=no
10555fi 17025fi
10556rm conftest.$ac_ext 17026rm conftest.$ac_ext
10557LIBS=$ac_func_search_save_LIBS 17027LIBS=$ac_func_search_save_LIBS
10558fi 17028fi
10559{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5 17029{ echo "$as_me:$LINENO: result: $ac_cv_search_nanosleep" >&5
10560$as_echo "$ac_cv_search_nanosleep" >&6; } 17030echo "${ECHO_T}$ac_cv_search_nanosleep" >&6; }
10561ac_res=$ac_cv_search_nanosleep 17031ac_res=$ac_cv_search_nanosleep
10562if test "$ac_res" != no; then : 17032if test "$ac_res" != no; then
10563 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 17033 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
10564 17034
10565$as_echo "#define HAVE_NANOSLEEP 1" >>confdefs.h 17035cat >>confdefs.h <<\_ACEOF
17036#define HAVE_NANOSLEEP 1
17037_ACEOF
10566 17038
10567fi 17039fi
10568 17040
10569 17041
10570{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 17042{ echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5
10571$as_echo_n "checking for library containing clock_gettime... " >&6; } 17043echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6; }
10572if ${ac_cv_search_clock_gettime+:} false; then : 17044if test "${ac_cv_search_clock_gettime+set}" = set; then
10573 $as_echo_n "(cached) " >&6 17045 echo $ECHO_N "(cached) $ECHO_C" >&6
10574else 17046else
10575 ac_func_search_save_LIBS=$LIBS 17047 ac_func_search_save_LIBS=$LIBS
10576cat confdefs.h - <<_ACEOF >conftest.$ac_ext 17048cat >conftest.$ac_ext <<_ACEOF
17049/* confdefs.h. */
17050_ACEOF
17051cat confdefs.h >>conftest.$ac_ext
17052cat >>conftest.$ac_ext <<_ACEOF
10577/* end confdefs.h. */ 17053/* end confdefs.h. */
10578 17054
10579/* Override any GCC internal prototype to avoid an error. 17055/* Override any GCC internal prototype to avoid an error.
@@ -10598,42 +17074,201 @@ for ac_lib in '' rt; do
10598 ac_res=-l$ac_lib 17074 ac_res=-l$ac_lib
10599 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 17075 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
10600 fi 17076 fi
10601 if ac_fn_c_try_link "$LINENO"; then : 17077 rm -f conftest.$ac_objext conftest$ac_exeext
17078if { (ac_try="$ac_link"
17079case "(($ac_try" in
17080 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17081 *) ac_try_echo=$ac_try;;
17082esac
17083eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17084 (eval "$ac_link") 2>conftest.er1
17085 ac_status=$?
17086 grep -v '^ *+' conftest.er1 >conftest.err
17087 rm -f conftest.er1
17088 cat conftest.err >&5
17089 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17090 (exit $ac_status); } && {
17091 test -z "$ac_c_werror_flag" ||
17092 test ! -s conftest.err
17093 } && test -s conftest$ac_exeext &&
17094 $as_test_x conftest$ac_exeext; then
10602 ac_cv_search_clock_gettime=$ac_res 17095 ac_cv_search_clock_gettime=$ac_res
17096else
17097 echo "$as_me: failed program was:" >&5
17098sed 's/^/| /' conftest.$ac_ext >&5
17099
17100
10603fi 17101fi
10604rm -f core conftest.err conftest.$ac_objext \ 17102
10605 conftest$ac_exeext 17103rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10606 if ${ac_cv_search_clock_gettime+:} false; then : 17104 conftest$ac_exeext
17105 if test "${ac_cv_search_clock_gettime+set}" = set; then
10607 break 17106 break
10608fi 17107fi
10609done 17108done
10610if ${ac_cv_search_clock_gettime+:} false; then : 17109if test "${ac_cv_search_clock_gettime+set}" = set; then
10611 17110 :
10612else 17111else
10613 ac_cv_search_clock_gettime=no 17112 ac_cv_search_clock_gettime=no
10614fi 17113fi
10615rm conftest.$ac_ext 17114rm conftest.$ac_ext
10616LIBS=$ac_func_search_save_LIBS 17115LIBS=$ac_func_search_save_LIBS
10617fi 17116fi
10618{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 17117{ echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettime" >&5
10619$as_echo "$ac_cv_search_clock_gettime" >&6; } 17118echo "${ECHO_T}$ac_cv_search_clock_gettime" >&6; }
10620ac_res=$ac_cv_search_clock_gettime 17119ac_res=$ac_cv_search_clock_gettime
10621if test "$ac_res" != no; then : 17120if test "$ac_res" != no; then
10622 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 17121 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
10623 17122
10624$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h 17123cat >>confdefs.h <<\_ACEOF
17124#define HAVE_CLOCK_GETTIME 1
17125_ACEOF
10625 17126
10626fi 17127fi
10627 17128
10628 17129
10629ac_fn_c_check_decl "$LINENO" "getrusage" "ac_cv_have_decl_getrusage" "$ac_includes_default" 17130{ echo "$as_me:$LINENO: checking whether getrusage is declared" >&5
10630if test "x$ac_cv_have_decl_getrusage" = xyes; then : 17131echo $ECHO_N "checking whether getrusage is declared... $ECHO_C" >&6; }
10631 for ac_func in getrusage 17132if test "${ac_cv_have_decl_getrusage+set}" = set; then
10632do : 17133 echo $ECHO_N "(cached) $ECHO_C" >&6
10633 ac_fn_c_check_func "$LINENO" "getrusage" "ac_cv_func_getrusage" 17134else
10634if test "x$ac_cv_func_getrusage" = xyes; then : 17135 cat >conftest.$ac_ext <<_ACEOF
17136/* confdefs.h. */
17137_ACEOF
17138cat confdefs.h >>conftest.$ac_ext
17139cat >>conftest.$ac_ext <<_ACEOF
17140/* end confdefs.h. */
17141$ac_includes_default
17142int
17143main ()
17144{
17145#ifndef getrusage
17146 (void) getrusage;
17147#endif
17148
17149 ;
17150 return 0;
17151}
17152_ACEOF
17153rm -f conftest.$ac_objext
17154if { (ac_try="$ac_compile"
17155case "(($ac_try" in
17156 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17157 *) ac_try_echo=$ac_try;;
17158esac
17159eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17160 (eval "$ac_compile") 2>conftest.er1
17161 ac_status=$?
17162 grep -v '^ *+' conftest.er1 >conftest.err
17163 rm -f conftest.er1
17164 cat conftest.err >&5
17165 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17166 (exit $ac_status); } && {
17167 test -z "$ac_c_werror_flag" ||
17168 test ! -s conftest.err
17169 } && test -s conftest.$ac_objext; then
17170 ac_cv_have_decl_getrusage=yes
17171else
17172 echo "$as_me: failed program was:" >&5
17173sed 's/^/| /' conftest.$ac_ext >&5
17174
17175 ac_cv_have_decl_getrusage=no
17176fi
17177
17178rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17179fi
17180{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getrusage" >&5
17181echo "${ECHO_T}$ac_cv_have_decl_getrusage" >&6; }
17182if test $ac_cv_have_decl_getrusage = yes; then
17183
17184for ac_func in getrusage
17185do
17186as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
17187{ echo "$as_me:$LINENO: checking for $ac_func" >&5
17188echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
17189if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
17190 echo $ECHO_N "(cached) $ECHO_C" >&6
17191else
17192 cat >conftest.$ac_ext <<_ACEOF
17193/* confdefs.h. */
17194_ACEOF
17195cat confdefs.h >>conftest.$ac_ext
17196cat >>conftest.$ac_ext <<_ACEOF
17197/* end confdefs.h. */
17198/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
17199 For example, HP-UX 11i <limits.h> declares gettimeofday. */
17200#define $ac_func innocuous_$ac_func
17201
17202/* System header to define __stub macros and hopefully few prototypes,
17203 which can conflict with char $ac_func (); below.
17204 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
17205 <limits.h> exists even on freestanding compilers. */
17206
17207#ifdef __STDC__
17208# include <limits.h>
17209#else
17210# include <assert.h>
17211#endif
17212
17213#undef $ac_func
17214
17215/* Override any GCC internal prototype to avoid an error.
17216 Use char because int might match the return type of a GCC
17217 builtin and then its argument prototype would still apply. */
17218#ifdef __cplusplus
17219extern "C"
17220#endif
17221char $ac_func ();
17222/* The GNU C library defines this for functions which it implements
17223 to always fail with ENOSYS. Some functions are actually named
17224 something starting with __ and the normal name is an alias. */
17225#if defined __stub_$ac_func || defined __stub___$ac_func
17226choke me
17227#endif
17228
17229int
17230main ()
17231{
17232return $ac_func ();
17233 ;
17234 return 0;
17235}
17236_ACEOF
17237rm -f conftest.$ac_objext conftest$ac_exeext
17238if { (ac_try="$ac_link"
17239case "(($ac_try" in
17240 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17241 *) ac_try_echo=$ac_try;;
17242esac
17243eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17244 (eval "$ac_link") 2>conftest.er1
17245 ac_status=$?
17246 grep -v '^ *+' conftest.er1 >conftest.err
17247 rm -f conftest.er1
17248 cat conftest.err >&5
17249 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17250 (exit $ac_status); } && {
17251 test -z "$ac_c_werror_flag" ||
17252 test ! -s conftest.err
17253 } && test -s conftest$ac_exeext &&
17254 $as_test_x conftest$ac_exeext; then
17255 eval "$as_ac_var=yes"
17256else
17257 echo "$as_me: failed program was:" >&5
17258sed 's/^/| /' conftest.$ac_ext >&5
17259
17260 eval "$as_ac_var=no"
17261fi
17262
17263rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
17264 conftest$ac_exeext conftest.$ac_ext
17265fi
17266ac_res=`eval echo '${'$as_ac_var'}'`
17267 { echo "$as_me:$LINENO: result: $ac_res" >&5
17268echo "${ECHO_T}$ac_res" >&6; }
17269if test `eval echo '${'$as_ac_var'}'` = yes; then
10635 cat >>confdefs.h <<_ACEOF 17270 cat >>confdefs.h <<_ACEOF
10636#define HAVE_GETRUSAGE 1 17271#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10637_ACEOF 17272_ACEOF
10638 17273
10639fi 17274fi
@@ -10641,19 +17276,153 @@ done
10641 17276
10642fi 17277fi
10643 17278
10644ac_fn_c_check_decl "$LINENO" "strsep" "ac_cv_have_decl_strsep" " 17279{ echo "$as_me:$LINENO: checking whether strsep is declared" >&5
17280echo $ECHO_N "checking whether strsep is declared... $ECHO_C" >&6; }
17281if test "${ac_cv_have_decl_strsep+set}" = set; then
17282 echo $ECHO_N "(cached) $ECHO_C" >&6
17283else
17284 cat >conftest.$ac_ext <<_ACEOF
17285/* confdefs.h. */
17286_ACEOF
17287cat confdefs.h >>conftest.$ac_ext
17288cat >>conftest.$ac_ext <<_ACEOF
17289/* end confdefs.h. */
17290
10645#ifdef HAVE_STRING_H 17291#ifdef HAVE_STRING_H
10646# include <string.h> 17292# include <string.h>
10647#endif 17293#endif
10648 17294
10649" 17295
10650if test "x$ac_cv_have_decl_strsep" = xyes; then : 17296int
10651 for ac_func in strsep 17297main ()
10652do : 17298{
10653 ac_fn_c_check_func "$LINENO" "strsep" "ac_cv_func_strsep" 17299#ifndef strsep
10654if test "x$ac_cv_func_strsep" = xyes; then : 17300 (void) strsep;
17301#endif
17302
17303 ;
17304 return 0;
17305}
17306_ACEOF
17307rm -f conftest.$ac_objext
17308if { (ac_try="$ac_compile"
17309case "(($ac_try" in
17310 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17311 *) ac_try_echo=$ac_try;;
17312esac
17313eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17314 (eval "$ac_compile") 2>conftest.er1
17315 ac_status=$?
17316 grep -v '^ *+' conftest.er1 >conftest.err
17317 rm -f conftest.er1
17318 cat conftest.err >&5
17319 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17320 (exit $ac_status); } && {
17321 test -z "$ac_c_werror_flag" ||
17322 test ! -s conftest.err
17323 } && test -s conftest.$ac_objext; then
17324 ac_cv_have_decl_strsep=yes
17325else
17326 echo "$as_me: failed program was:" >&5
17327sed 's/^/| /' conftest.$ac_ext >&5
17328
17329 ac_cv_have_decl_strsep=no
17330fi
17331
17332rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17333fi
17334{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_strsep" >&5
17335echo "${ECHO_T}$ac_cv_have_decl_strsep" >&6; }
17336if test $ac_cv_have_decl_strsep = yes; then
17337
17338for ac_func in strsep
17339do
17340as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
17341{ echo "$as_me:$LINENO: checking for $ac_func" >&5
17342echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
17343if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
17344 echo $ECHO_N "(cached) $ECHO_C" >&6
17345else
17346 cat >conftest.$ac_ext <<_ACEOF
17347/* confdefs.h. */
17348_ACEOF
17349cat confdefs.h >>conftest.$ac_ext
17350cat >>conftest.$ac_ext <<_ACEOF
17351/* end confdefs.h. */
17352/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
17353 For example, HP-UX 11i <limits.h> declares gettimeofday. */
17354#define $ac_func innocuous_$ac_func
17355
17356/* System header to define __stub macros and hopefully few prototypes,
17357 which can conflict with char $ac_func (); below.
17358 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
17359 <limits.h> exists even on freestanding compilers. */
17360
17361#ifdef __STDC__
17362# include <limits.h>
17363#else
17364# include <assert.h>
17365#endif
17366
17367#undef $ac_func
17368
17369/* Override any GCC internal prototype to avoid an error.
17370 Use char because int might match the return type of a GCC
17371 builtin and then its argument prototype would still apply. */
17372#ifdef __cplusplus
17373extern "C"
17374#endif
17375char $ac_func ();
17376/* The GNU C library defines this for functions which it implements
17377 to always fail with ENOSYS. Some functions are actually named
17378 something starting with __ and the normal name is an alias. */
17379#if defined __stub_$ac_func || defined __stub___$ac_func
17380choke me
17381#endif
17382
17383int
17384main ()
17385{
17386return $ac_func ();
17387 ;
17388 return 0;
17389}
17390_ACEOF
17391rm -f conftest.$ac_objext conftest$ac_exeext
17392if { (ac_try="$ac_link"
17393case "(($ac_try" in
17394 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17395 *) ac_try_echo=$ac_try;;
17396esac
17397eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17398 (eval "$ac_link") 2>conftest.er1
17399 ac_status=$?
17400 grep -v '^ *+' conftest.er1 >conftest.err
17401 rm -f conftest.er1
17402 cat conftest.err >&5
17403 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17404 (exit $ac_status); } && {
17405 test -z "$ac_c_werror_flag" ||
17406 test ! -s conftest.err
17407 } && test -s conftest$ac_exeext &&
17408 $as_test_x conftest$ac_exeext; then
17409 eval "$as_ac_var=yes"
17410else
17411 echo "$as_me: failed program was:" >&5
17412sed 's/^/| /' conftest.$ac_ext >&5
17413
17414 eval "$as_ac_var=no"
17415fi
17416
17417rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
17418 conftest$ac_exeext conftest.$ac_ext
17419fi
17420ac_res=`eval echo '${'$as_ac_var'}'`
17421 { echo "$as_me:$LINENO: result: $ac_res" >&5
17422echo "${ECHO_T}$ac_res" >&6; }
17423if test `eval echo '${'$as_ac_var'}'` = yes; then
10655 cat >>confdefs.h <<_ACEOF 17424 cat >>confdefs.h <<_ACEOF
10656#define HAVE_STRSEP 1 17425#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10657_ACEOF 17426_ACEOF
10658 17427
10659fi 17428fi
@@ -10662,57 +17431,318 @@ done
10662fi 17431fi
10663 17432
10664 17433
10665ac_fn_c_check_decl "$LINENO" "tcsendbreak" "ac_cv_have_decl_tcsendbreak" "#include <termios.h> 17434{ echo "$as_me:$LINENO: checking whether tcsendbreak is declared" >&5
17435echo $ECHO_N "checking whether tcsendbreak is declared... $ECHO_C" >&6; }
17436if test "${ac_cv_have_decl_tcsendbreak+set}" = set; then
17437 echo $ECHO_N "(cached) $ECHO_C" >&6
17438else
17439 cat >conftest.$ac_ext <<_ACEOF
17440/* confdefs.h. */
17441_ACEOF
17442cat confdefs.h >>conftest.$ac_ext
17443cat >>conftest.$ac_ext <<_ACEOF
17444/* end confdefs.h. */
17445#include <termios.h>
10666 17446
10667"
10668if test "x$ac_cv_have_decl_tcsendbreak" = xyes; then :
10669 $as_echo "#define HAVE_TCSENDBREAK 1" >>confdefs.h
10670 17447
17448int
17449main ()
17450{
17451#ifndef tcsendbreak
17452 (void) tcsendbreak;
17453#endif
17454
17455 ;
17456 return 0;
17457}
17458_ACEOF
17459rm -f conftest.$ac_objext
17460if { (ac_try="$ac_compile"
17461case "(($ac_try" in
17462 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17463 *) ac_try_echo=$ac_try;;
17464esac
17465eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17466 (eval "$ac_compile") 2>conftest.er1
17467 ac_status=$?
17468 grep -v '^ *+' conftest.er1 >conftest.err
17469 rm -f conftest.er1
17470 cat conftest.err >&5
17471 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17472 (exit $ac_status); } && {
17473 test -z "$ac_c_werror_flag" ||
17474 test ! -s conftest.err
17475 } && test -s conftest.$ac_objext; then
17476 ac_cv_have_decl_tcsendbreak=yes
10671else 17477else
10672 for ac_func in tcsendbreak 17478 echo "$as_me: failed program was:" >&5
10673do : 17479sed 's/^/| /' conftest.$ac_ext >&5
10674 ac_fn_c_check_func "$LINENO" "tcsendbreak" "ac_cv_func_tcsendbreak" 17480
10675if test "x$ac_cv_func_tcsendbreak" = xyes; then : 17481 ac_cv_have_decl_tcsendbreak=no
10676 cat >>confdefs.h <<_ACEOF 17482fi
17483
17484rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17485fi
17486{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_tcsendbreak" >&5
17487echo "${ECHO_T}$ac_cv_have_decl_tcsendbreak" >&6; }
17488if test $ac_cv_have_decl_tcsendbreak = yes; then
17489 cat >>confdefs.h <<\_ACEOF
10677#define HAVE_TCSENDBREAK 1 17490#define HAVE_TCSENDBREAK 1
10678_ACEOF 17491_ACEOF
10679 17492
17493else
17494
17495for ac_func in tcsendbreak
17496do
17497as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
17498{ echo "$as_me:$LINENO: checking for $ac_func" >&5
17499echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
17500if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
17501 echo $ECHO_N "(cached) $ECHO_C" >&6
17502else
17503 cat >conftest.$ac_ext <<_ACEOF
17504/* confdefs.h. */
17505_ACEOF
17506cat confdefs.h >>conftest.$ac_ext
17507cat >>conftest.$ac_ext <<_ACEOF
17508/* end confdefs.h. */
17509/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
17510 For example, HP-UX 11i <limits.h> declares gettimeofday. */
17511#define $ac_func innocuous_$ac_func
17512
17513/* System header to define __stub macros and hopefully few prototypes,
17514 which can conflict with char $ac_func (); below.
17515 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
17516 <limits.h> exists even on freestanding compilers. */
17517
17518#ifdef __STDC__
17519# include <limits.h>
17520#else
17521# include <assert.h>
17522#endif
17523
17524#undef $ac_func
17525
17526/* Override any GCC internal prototype to avoid an error.
17527 Use char because int might match the return type of a GCC
17528 builtin and then its argument prototype would still apply. */
17529#ifdef __cplusplus
17530extern "C"
17531#endif
17532char $ac_func ();
17533/* The GNU C library defines this for functions which it implements
17534 to always fail with ENOSYS. Some functions are actually named
17535 something starting with __ and the normal name is an alias. */
17536#if defined __stub_$ac_func || defined __stub___$ac_func
17537choke me
17538#endif
17539
17540int
17541main ()
17542{
17543return $ac_func ();
17544 ;
17545 return 0;
17546}
17547_ACEOF
17548rm -f conftest.$ac_objext conftest$ac_exeext
17549if { (ac_try="$ac_link"
17550case "(($ac_try" in
17551 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17552 *) ac_try_echo=$ac_try;;
17553esac
17554eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17555 (eval "$ac_link") 2>conftest.er1
17556 ac_status=$?
17557 grep -v '^ *+' conftest.er1 >conftest.err
17558 rm -f conftest.er1
17559 cat conftest.err >&5
17560 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17561 (exit $ac_status); } && {
17562 test -z "$ac_c_werror_flag" ||
17563 test ! -s conftest.err
17564 } && test -s conftest$ac_exeext &&
17565 $as_test_x conftest$ac_exeext; then
17566 eval "$as_ac_var=yes"
17567else
17568 echo "$as_me: failed program was:" >&5
17569sed 's/^/| /' conftest.$ac_ext >&5
17570
17571 eval "$as_ac_var=no"
17572fi
17573
17574rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
17575 conftest$ac_exeext conftest.$ac_ext
17576fi
17577ac_res=`eval echo '${'$as_ac_var'}'`
17578 { echo "$as_me:$LINENO: result: $ac_res" >&5
17579echo "${ECHO_T}$ac_res" >&6; }
17580if test `eval echo '${'$as_ac_var'}'` = yes; then
17581 cat >>confdefs.h <<_ACEOF
17582#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
17583_ACEOF
17584
10680fi 17585fi
10681done 17586done
10682 17587
10683fi 17588fi
10684 17589
10685 17590
10686ac_fn_c_check_decl "$LINENO" "h_errno" "ac_cv_have_decl_h_errno" "#include <netdb.h> 17591{ echo "$as_me:$LINENO: checking whether h_errno is declared" >&5
10687" 17592echo $ECHO_N "checking whether h_errno is declared... $ECHO_C" >&6; }
10688if test "x$ac_cv_have_decl_h_errno" = xyes; then : 17593if test "${ac_cv_have_decl_h_errno+set}" = set; then
10689 ac_have_decl=1 17594 echo $ECHO_N "(cached) $ECHO_C" >&6
17595else
17596 cat >conftest.$ac_ext <<_ACEOF
17597/* confdefs.h. */
17598_ACEOF
17599cat confdefs.h >>conftest.$ac_ext
17600cat >>conftest.$ac_ext <<_ACEOF
17601/* end confdefs.h. */
17602#include <netdb.h>
17603
17604int
17605main ()
17606{
17607#ifndef h_errno
17608 (void) h_errno;
17609#endif
17610
17611 ;
17612 return 0;
17613}
17614_ACEOF
17615rm -f conftest.$ac_objext
17616if { (ac_try="$ac_compile"
17617case "(($ac_try" in
17618 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17619 *) ac_try_echo=$ac_try;;
17620esac
17621eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17622 (eval "$ac_compile") 2>conftest.er1
17623 ac_status=$?
17624 grep -v '^ *+' conftest.er1 >conftest.err
17625 rm -f conftest.er1
17626 cat conftest.err >&5
17627 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17628 (exit $ac_status); } && {
17629 test -z "$ac_c_werror_flag" ||
17630 test ! -s conftest.err
17631 } && test -s conftest.$ac_objext; then
17632 ac_cv_have_decl_h_errno=yes
10690else 17633else
10691 ac_have_decl=0 17634 echo "$as_me: failed program was:" >&5
17635sed 's/^/| /' conftest.$ac_ext >&5
17636
17637 ac_cv_have_decl_h_errno=no
17638fi
17639
17640rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10692fi 17641fi
17642{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_h_errno" >&5
17643echo "${ECHO_T}$ac_cv_have_decl_h_errno" >&6; }
17644if test $ac_cv_have_decl_h_errno = yes; then
10693 17645
10694cat >>confdefs.h <<_ACEOF 17646cat >>confdefs.h <<_ACEOF
10695#define HAVE_DECL_H_ERRNO $ac_have_decl 17647#define HAVE_DECL_H_ERRNO 1
17648_ACEOF
17649
17650
17651else
17652 cat >>confdefs.h <<_ACEOF
17653#define HAVE_DECL_H_ERRNO 0
10696_ACEOF 17654_ACEOF
10697 17655
10698 17656
10699ac_fn_c_check_decl "$LINENO" "SHUT_RD" "ac_cv_have_decl_SHUT_RD" " 17657fi
17658
17659
17660
17661{ echo "$as_me:$LINENO: checking whether SHUT_RD is declared" >&5
17662echo $ECHO_N "checking whether SHUT_RD is declared... $ECHO_C" >&6; }
17663if test "${ac_cv_have_decl_SHUT_RD+set}" = set; then
17664 echo $ECHO_N "(cached) $ECHO_C" >&6
17665else
17666 cat >conftest.$ac_ext <<_ACEOF
17667/* confdefs.h. */
17668_ACEOF
17669cat confdefs.h >>conftest.$ac_ext
17670cat >>conftest.$ac_ext <<_ACEOF
17671/* end confdefs.h. */
17672
10700#include <sys/types.h> 17673#include <sys/types.h>
10701#include <sys/socket.h> 17674#include <sys/socket.h>
10702 17675
10703" 17676
10704if test "x$ac_cv_have_decl_SHUT_RD" = xyes; then : 17677int
10705 ac_have_decl=1 17678main ()
17679{
17680#ifndef SHUT_RD
17681 (void) SHUT_RD;
17682#endif
17683
17684 ;
17685 return 0;
17686}
17687_ACEOF
17688rm -f conftest.$ac_objext
17689if { (ac_try="$ac_compile"
17690case "(($ac_try" in
17691 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17692 *) ac_try_echo=$ac_try;;
17693esac
17694eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17695 (eval "$ac_compile") 2>conftest.er1
17696 ac_status=$?
17697 grep -v '^ *+' conftest.er1 >conftest.err
17698 rm -f conftest.er1
17699 cat conftest.err >&5
17700 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17701 (exit $ac_status); } && {
17702 test -z "$ac_c_werror_flag" ||
17703 test ! -s conftest.err
17704 } && test -s conftest.$ac_objext; then
17705 ac_cv_have_decl_SHUT_RD=yes
10706else 17706else
10707 ac_have_decl=0 17707 echo "$as_me: failed program was:" >&5
17708sed 's/^/| /' conftest.$ac_ext >&5
17709
17710 ac_cv_have_decl_SHUT_RD=no
10708fi 17711fi
10709 17712
17713rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17714fi
17715{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_SHUT_RD" >&5
17716echo "${ECHO_T}$ac_cv_have_decl_SHUT_RD" >&6; }
17717if test $ac_cv_have_decl_SHUT_RD = yes; then
17718
10710cat >>confdefs.h <<_ACEOF 17719cat >>confdefs.h <<_ACEOF
10711#define HAVE_DECL_SHUT_RD $ac_have_decl 17720#define HAVE_DECL_SHUT_RD 1
17721_ACEOF
17722
17723
17724else
17725 cat >>confdefs.h <<_ACEOF
17726#define HAVE_DECL_SHUT_RD 0
10712_ACEOF 17727_ACEOF
10713 17728
10714 17729
10715ac_fn_c_check_decl "$LINENO" "O_NONBLOCK" "ac_cv_have_decl_O_NONBLOCK" " 17730fi
17731
17732
17733
17734{ echo "$as_me:$LINENO: checking whether O_NONBLOCK is declared" >&5
17735echo $ECHO_N "checking whether O_NONBLOCK is declared... $ECHO_C" >&6; }
17736if test "${ac_cv_have_decl_O_NONBLOCK+set}" = set; then
17737 echo $ECHO_N "(cached) $ECHO_C" >&6
17738else
17739 cat >conftest.$ac_ext <<_ACEOF
17740/* confdefs.h. */
17741_ACEOF
17742cat confdefs.h >>conftest.$ac_ext
17743cat >>conftest.$ac_ext <<_ACEOF
17744/* end confdefs.h. */
17745
10716#include <sys/types.h> 17746#include <sys/types.h>
10717#ifdef HAVE_SYS_STAT_H 17747#ifdef HAVE_SYS_STAT_H
10718# include <sys/stat.h> 17748# include <sys/stat.h>
@@ -10721,67 +17751,295 @@ ac_fn_c_check_decl "$LINENO" "O_NONBLOCK" "ac_cv_have_decl_O_NONBLOCK" "
10721# include <fcntl.h> 17751# include <fcntl.h>
10722#endif 17752#endif
10723 17753
10724" 17754
10725if test "x$ac_cv_have_decl_O_NONBLOCK" = xyes; then : 17755int
10726 ac_have_decl=1 17756main ()
17757{
17758#ifndef O_NONBLOCK
17759 (void) O_NONBLOCK;
17760#endif
17761
17762 ;
17763 return 0;
17764}
17765_ACEOF
17766rm -f conftest.$ac_objext
17767if { (ac_try="$ac_compile"
17768case "(($ac_try" in
17769 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17770 *) ac_try_echo=$ac_try;;
17771esac
17772eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17773 (eval "$ac_compile") 2>conftest.er1
17774 ac_status=$?
17775 grep -v '^ *+' conftest.er1 >conftest.err
17776 rm -f conftest.er1
17777 cat conftest.err >&5
17778 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17779 (exit $ac_status); } && {
17780 test -z "$ac_c_werror_flag" ||
17781 test ! -s conftest.err
17782 } && test -s conftest.$ac_objext; then
17783 ac_cv_have_decl_O_NONBLOCK=yes
10727else 17784else
10728 ac_have_decl=0 17785 echo "$as_me: failed program was:" >&5
17786sed 's/^/| /' conftest.$ac_ext >&5
17787
17788 ac_cv_have_decl_O_NONBLOCK=no
10729fi 17789fi
10730 17790
17791rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17792fi
17793{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_O_NONBLOCK" >&5
17794echo "${ECHO_T}$ac_cv_have_decl_O_NONBLOCK" >&6; }
17795if test $ac_cv_have_decl_O_NONBLOCK = yes; then
17796
10731cat >>confdefs.h <<_ACEOF 17797cat >>confdefs.h <<_ACEOF
10732#define HAVE_DECL_O_NONBLOCK $ac_have_decl 17798#define HAVE_DECL_O_NONBLOCK 1
10733_ACEOF 17799_ACEOF
10734 17800
10735 17801
10736ac_fn_c_check_decl "$LINENO" "writev" "ac_cv_have_decl_writev" " 17802else
17803 cat >>confdefs.h <<_ACEOF
17804#define HAVE_DECL_O_NONBLOCK 0
17805_ACEOF
17806
17807
17808fi
17809
17810
17811
17812{ echo "$as_me:$LINENO: checking whether writev is declared" >&5
17813echo $ECHO_N "checking whether writev is declared... $ECHO_C" >&6; }
17814if test "${ac_cv_have_decl_writev+set}" = set; then
17815 echo $ECHO_N "(cached) $ECHO_C" >&6
17816else
17817 cat >conftest.$ac_ext <<_ACEOF
17818/* confdefs.h. */
17819_ACEOF
17820cat confdefs.h >>conftest.$ac_ext
17821cat >>conftest.$ac_ext <<_ACEOF
17822/* end confdefs.h. */
17823
10737#include <sys/types.h> 17824#include <sys/types.h>
10738#include <sys/uio.h> 17825#include <sys/uio.h>
10739#include <unistd.h> 17826#include <unistd.h>
10740 17827
10741" 17828
10742if test "x$ac_cv_have_decl_writev" = xyes; then : 17829int
10743 ac_have_decl=1 17830main ()
17831{
17832#ifndef writev
17833 (void) writev;
17834#endif
17835
17836 ;
17837 return 0;
17838}
17839_ACEOF
17840rm -f conftest.$ac_objext
17841if { (ac_try="$ac_compile"
17842case "(($ac_try" in
17843 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17844 *) ac_try_echo=$ac_try;;
17845esac
17846eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17847 (eval "$ac_compile") 2>conftest.er1
17848 ac_status=$?
17849 grep -v '^ *+' conftest.er1 >conftest.err
17850 rm -f conftest.er1
17851 cat conftest.err >&5
17852 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17853 (exit $ac_status); } && {
17854 test -z "$ac_c_werror_flag" ||
17855 test ! -s conftest.err
17856 } && test -s conftest.$ac_objext; then
17857 ac_cv_have_decl_writev=yes
10744else 17858else
10745 ac_have_decl=0 17859 echo "$as_me: failed program was:" >&5
17860sed 's/^/| /' conftest.$ac_ext >&5
17861
17862 ac_cv_have_decl_writev=no
17863fi
17864
17865rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10746fi 17866fi
17867{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_writev" >&5
17868echo "${ECHO_T}$ac_cv_have_decl_writev" >&6; }
17869if test $ac_cv_have_decl_writev = yes; then
10747 17870
10748cat >>confdefs.h <<_ACEOF 17871cat >>confdefs.h <<_ACEOF
10749#define HAVE_DECL_WRITEV $ac_have_decl 17872#define HAVE_DECL_WRITEV 1
17873_ACEOF
17874
17875
17876else
17877 cat >>confdefs.h <<_ACEOF
17878#define HAVE_DECL_WRITEV 0
10750_ACEOF 17879_ACEOF
10751 17880
10752 17881
10753ac_fn_c_check_decl "$LINENO" "MAXSYMLINKS" "ac_cv_have_decl_MAXSYMLINKS" " 17882fi
17883
17884
17885
17886{ echo "$as_me:$LINENO: checking whether MAXSYMLINKS is declared" >&5
17887echo $ECHO_N "checking whether MAXSYMLINKS is declared... $ECHO_C" >&6; }
17888if test "${ac_cv_have_decl_MAXSYMLINKS+set}" = set; then
17889 echo $ECHO_N "(cached) $ECHO_C" >&6
17890else
17891 cat >conftest.$ac_ext <<_ACEOF
17892/* confdefs.h. */
17893_ACEOF
17894cat confdefs.h >>conftest.$ac_ext
17895cat >>conftest.$ac_ext <<_ACEOF
17896/* end confdefs.h. */
17897
10754#include <sys/param.h> 17898#include <sys/param.h>
10755 17899
10756" 17900
10757if test "x$ac_cv_have_decl_MAXSYMLINKS" = xyes; then : 17901int
10758 ac_have_decl=1 17902main ()
17903{
17904#ifndef MAXSYMLINKS
17905 (void) MAXSYMLINKS;
17906#endif
17907
17908 ;
17909 return 0;
17910}
17911_ACEOF
17912rm -f conftest.$ac_objext
17913if { (ac_try="$ac_compile"
17914case "(($ac_try" in
17915 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17916 *) ac_try_echo=$ac_try;;
17917esac
17918eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17919 (eval "$ac_compile") 2>conftest.er1
17920 ac_status=$?
17921 grep -v '^ *+' conftest.er1 >conftest.err
17922 rm -f conftest.er1
17923 cat conftest.err >&5
17924 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17925 (exit $ac_status); } && {
17926 test -z "$ac_c_werror_flag" ||
17927 test ! -s conftest.err
17928 } && test -s conftest.$ac_objext; then
17929 ac_cv_have_decl_MAXSYMLINKS=yes
10759else 17930else
10760 ac_have_decl=0 17931 echo "$as_me: failed program was:" >&5
17932sed 's/^/| /' conftest.$ac_ext >&5
17933
17934 ac_cv_have_decl_MAXSYMLINKS=no
10761fi 17935fi
10762 17936
17937rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17938fi
17939{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_MAXSYMLINKS" >&5
17940echo "${ECHO_T}$ac_cv_have_decl_MAXSYMLINKS" >&6; }
17941if test $ac_cv_have_decl_MAXSYMLINKS = yes; then
17942
10763cat >>confdefs.h <<_ACEOF 17943cat >>confdefs.h <<_ACEOF
10764#define HAVE_DECL_MAXSYMLINKS $ac_have_decl 17944#define HAVE_DECL_MAXSYMLINKS 1
10765_ACEOF 17945_ACEOF
10766 17946
10767 17947
10768ac_fn_c_check_decl "$LINENO" "offsetof" "ac_cv_have_decl_offsetof" " 17948else
17949 cat >>confdefs.h <<_ACEOF
17950#define HAVE_DECL_MAXSYMLINKS 0
17951_ACEOF
17952
17953
17954fi
17955
17956
17957
17958{ echo "$as_me:$LINENO: checking whether offsetof is declared" >&5
17959echo $ECHO_N "checking whether offsetof is declared... $ECHO_C" >&6; }
17960if test "${ac_cv_have_decl_offsetof+set}" = set; then
17961 echo $ECHO_N "(cached) $ECHO_C" >&6
17962else
17963 cat >conftest.$ac_ext <<_ACEOF
17964/* confdefs.h. */
17965_ACEOF
17966cat confdefs.h >>conftest.$ac_ext
17967cat >>conftest.$ac_ext <<_ACEOF
17968/* end confdefs.h. */
17969
10769#include <stddef.h> 17970#include <stddef.h>
10770 17971
10771" 17972
10772if test "x$ac_cv_have_decl_offsetof" = xyes; then : 17973int
10773 ac_have_decl=1 17974main ()
17975{
17976#ifndef offsetof
17977 (void) offsetof;
17978#endif
17979
17980 ;
17981 return 0;
17982}
17983_ACEOF
17984rm -f conftest.$ac_objext
17985if { (ac_try="$ac_compile"
17986case "(($ac_try" in
17987 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17988 *) ac_try_echo=$ac_try;;
17989esac
17990eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17991 (eval "$ac_compile") 2>conftest.er1
17992 ac_status=$?
17993 grep -v '^ *+' conftest.er1 >conftest.err
17994 rm -f conftest.er1
17995 cat conftest.err >&5
17996 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17997 (exit $ac_status); } && {
17998 test -z "$ac_c_werror_flag" ||
17999 test ! -s conftest.err
18000 } && test -s conftest.$ac_objext; then
18001 ac_cv_have_decl_offsetof=yes
10774else 18002else
10775 ac_have_decl=0 18003 echo "$as_me: failed program was:" >&5
18004sed 's/^/| /' conftest.$ac_ext >&5
18005
18006 ac_cv_have_decl_offsetof=no
10776fi 18007fi
10777 18008
18009rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18010fi
18011{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_offsetof" >&5
18012echo "${ECHO_T}$ac_cv_have_decl_offsetof" >&6; }
18013if test $ac_cv_have_decl_offsetof = yes; then
18014
10778cat >>confdefs.h <<_ACEOF 18015cat >>confdefs.h <<_ACEOF
10779#define HAVE_DECL_OFFSETOF $ac_have_decl 18016#define HAVE_DECL_OFFSETOF 1
10780_ACEOF 18017_ACEOF
10781 18018
10782 18019
18020else
18021 cat >>confdefs.h <<_ACEOF
18022#define HAVE_DECL_OFFSETOF 0
18023_ACEOF
18024
18025
18026fi
18027
18028
18029
10783# extra bits for select(2) 18030# extra bits for select(2)
10784ac_fn_c_check_decl "$LINENO" "howmany" "ac_cv_have_decl_howmany" " 18031{ echo "$as_me:$LINENO: checking whether howmany is declared" >&5
18032echo $ECHO_N "checking whether howmany is declared... $ECHO_C" >&6; }
18033if test "${ac_cv_have_decl_howmany+set}" = set; then
18034 echo $ECHO_N "(cached) $ECHO_C" >&6
18035else
18036 cat >conftest.$ac_ext <<_ACEOF
18037/* confdefs.h. */
18038_ACEOF
18039cat confdefs.h >>conftest.$ac_ext
18040cat >>conftest.$ac_ext <<_ACEOF
18041/* end confdefs.h. */
18042
10785#include <sys/param.h> 18043#include <sys/param.h>
10786#include <sys/types.h> 18044#include <sys/types.h>
10787#ifdef HAVE_SYS_SYSMACROS_H 18045#ifdef HAVE_SYS_SYSMACROS_H
@@ -10797,17 +18055,73 @@ ac_fn_c_check_decl "$LINENO" "howmany" "ac_cv_have_decl_howmany" "
10797#include <unistd.h> 18055#include <unistd.h>
10798#endif 18056#endif
10799 18057
10800" 18058
10801if test "x$ac_cv_have_decl_howmany" = xyes; then : 18059int
10802 ac_have_decl=1 18060main ()
18061{
18062#ifndef howmany
18063 (void) howmany;
18064#endif
18065
18066 ;
18067 return 0;
18068}
18069_ACEOF
18070rm -f conftest.$ac_objext
18071if { (ac_try="$ac_compile"
18072case "(($ac_try" in
18073 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18074 *) ac_try_echo=$ac_try;;
18075esac
18076eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18077 (eval "$ac_compile") 2>conftest.er1
18078 ac_status=$?
18079 grep -v '^ *+' conftest.er1 >conftest.err
18080 rm -f conftest.er1
18081 cat conftest.err >&5
18082 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18083 (exit $ac_status); } && {
18084 test -z "$ac_c_werror_flag" ||
18085 test ! -s conftest.err
18086 } && test -s conftest.$ac_objext; then
18087 ac_cv_have_decl_howmany=yes
10803else 18088else
10804 ac_have_decl=0 18089 echo "$as_me: failed program was:" >&5
18090sed 's/^/| /' conftest.$ac_ext >&5
18091
18092 ac_cv_have_decl_howmany=no
10805fi 18093fi
10806 18094
18095rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18096fi
18097{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_howmany" >&5
18098echo "${ECHO_T}$ac_cv_have_decl_howmany" >&6; }
18099if test $ac_cv_have_decl_howmany = yes; then
18100
10807cat >>confdefs.h <<_ACEOF 18101cat >>confdefs.h <<_ACEOF
10808#define HAVE_DECL_HOWMANY $ac_have_decl 18102#define HAVE_DECL_HOWMANY 1
10809_ACEOF 18103_ACEOF
10810ac_fn_c_check_decl "$LINENO" "NFDBITS" "ac_cv_have_decl_NFDBITS" " 18104
18105
18106else
18107 cat >>confdefs.h <<_ACEOF
18108#define HAVE_DECL_HOWMANY 0
18109_ACEOF
18110
18111
18112fi
18113{ echo "$as_me:$LINENO: checking whether NFDBITS is declared" >&5
18114echo $ECHO_N "checking whether NFDBITS is declared... $ECHO_C" >&6; }
18115if test "${ac_cv_have_decl_NFDBITS+set}" = set; then
18116 echo $ECHO_N "(cached) $ECHO_C" >&6
18117else
18118 cat >conftest.$ac_ext <<_ACEOF
18119/* confdefs.h. */
18120_ACEOF
18121cat confdefs.h >>conftest.$ac_ext
18122cat >>conftest.$ac_ext <<_ACEOF
18123/* end confdefs.h. */
18124
10811#include <sys/param.h> 18125#include <sys/param.h>
10812#include <sys/types.h> 18126#include <sys/types.h>
10813#ifdef HAVE_SYS_SYSMACROS_H 18127#ifdef HAVE_SYS_SYSMACROS_H
@@ -10823,18 +18137,75 @@ ac_fn_c_check_decl "$LINENO" "NFDBITS" "ac_cv_have_decl_NFDBITS" "
10823#include <unistd.h> 18137#include <unistd.h>
10824#endif 18138#endif
10825 18139
10826" 18140
10827if test "x$ac_cv_have_decl_NFDBITS" = xyes; then : 18141int
10828 ac_have_decl=1 18142main ()
18143{
18144#ifndef NFDBITS
18145 (void) NFDBITS;
18146#endif
18147
18148 ;
18149 return 0;
18150}
18151_ACEOF
18152rm -f conftest.$ac_objext
18153if { (ac_try="$ac_compile"
18154case "(($ac_try" in
18155 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18156 *) ac_try_echo=$ac_try;;
18157esac
18158eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18159 (eval "$ac_compile") 2>conftest.er1
18160 ac_status=$?
18161 grep -v '^ *+' conftest.er1 >conftest.err
18162 rm -f conftest.er1
18163 cat conftest.err >&5
18164 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18165 (exit $ac_status); } && {
18166 test -z "$ac_c_werror_flag" ||
18167 test ! -s conftest.err
18168 } && test -s conftest.$ac_objext; then
18169 ac_cv_have_decl_NFDBITS=yes
10829else 18170else
10830 ac_have_decl=0 18171 echo "$as_me: failed program was:" >&5
18172sed 's/^/| /' conftest.$ac_ext >&5
18173
18174 ac_cv_have_decl_NFDBITS=no
10831fi 18175fi
10832 18176
18177rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18178fi
18179{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_NFDBITS" >&5
18180echo "${ECHO_T}$ac_cv_have_decl_NFDBITS" >&6; }
18181if test $ac_cv_have_decl_NFDBITS = yes; then
18182
10833cat >>confdefs.h <<_ACEOF 18183cat >>confdefs.h <<_ACEOF
10834#define HAVE_DECL_NFDBITS $ac_have_decl 18184#define HAVE_DECL_NFDBITS 1
18185_ACEOF
18186
18187
18188else
18189 cat >>confdefs.h <<_ACEOF
18190#define HAVE_DECL_NFDBITS 0
18191_ACEOF
18192
18193
18194fi
18195
18196
18197{ echo "$as_me:$LINENO: checking for fd_mask" >&5
18198echo $ECHO_N "checking for fd_mask... $ECHO_C" >&6; }
18199if test "${ac_cv_type_fd_mask+set}" = set; then
18200 echo $ECHO_N "(cached) $ECHO_C" >&6
18201else
18202 cat >conftest.$ac_ext <<_ACEOF
18203/* confdefs.h. */
10835_ACEOF 18204_ACEOF
18205cat confdefs.h >>conftest.$ac_ext
18206cat >>conftest.$ac_ext <<_ACEOF
18207/* end confdefs.h. */
10836 18208
10837ac_fn_c_check_type "$LINENO" "fd_mask" "ac_cv_type_fd_mask" "
10838#include <sys/param.h> 18209#include <sys/param.h>
10839#include <sys/types.h> 18210#include <sys/types.h>
10840#ifdef HAVE_SYS_SELECT_H 18211#ifdef HAVE_SYS_SELECT_H
@@ -10847,8 +18218,49 @@ ac_fn_c_check_type "$LINENO" "fd_mask" "ac_cv_type_fd_mask" "
10847#include <unistd.h> 18218#include <unistd.h>
10848#endif 18219#endif
10849 18220
10850" 18221
10851if test "x$ac_cv_type_fd_mask" = xyes; then : 18222typedef fd_mask ac__type_new_;
18223int
18224main ()
18225{
18226if ((ac__type_new_ *) 0)
18227 return 0;
18228if (sizeof (ac__type_new_))
18229 return 0;
18230 ;
18231 return 0;
18232}
18233_ACEOF
18234rm -f conftest.$ac_objext
18235if { (ac_try="$ac_compile"
18236case "(($ac_try" in
18237 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18238 *) ac_try_echo=$ac_try;;
18239esac
18240eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18241 (eval "$ac_compile") 2>conftest.er1
18242 ac_status=$?
18243 grep -v '^ *+' conftest.er1 >conftest.err
18244 rm -f conftest.er1
18245 cat conftest.err >&5
18246 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18247 (exit $ac_status); } && {
18248 test -z "$ac_c_werror_flag" ||
18249 test ! -s conftest.err
18250 } && test -s conftest.$ac_objext; then
18251 ac_cv_type_fd_mask=yes
18252else
18253 echo "$as_me: failed program was:" >&5
18254sed 's/^/| /' conftest.$ac_ext >&5
18255
18256 ac_cv_type_fd_mask=no
18257fi
18258
18259rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18260fi
18261{ echo "$as_me:$LINENO: result: $ac_cv_type_fd_mask" >&5
18262echo "${ECHO_T}$ac_cv_type_fd_mask" >&6; }
18263if test $ac_cv_type_fd_mask = yes; then
10852 18264
10853cat >>confdefs.h <<_ACEOF 18265cat >>confdefs.h <<_ACEOF
10854#define HAVE_FD_MASK 1 18266#define HAVE_FD_MASK 1
@@ -10858,22 +18270,109 @@ _ACEOF
10858fi 18270fi
10859 18271
10860 18272
18273
10861for ac_func in setresuid 18274for ac_func in setresuid
10862do : 18275do
10863 ac_fn_c_check_func "$LINENO" "setresuid" "ac_cv_func_setresuid" 18276as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10864if test "x$ac_cv_func_setresuid" = xyes; then : 18277{ echo "$as_me:$LINENO: checking for $ac_func" >&5
18278echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
18279if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
18280 echo $ECHO_N "(cached) $ECHO_C" >&6
18281else
18282 cat >conftest.$ac_ext <<_ACEOF
18283/* confdefs.h. */
18284_ACEOF
18285cat confdefs.h >>conftest.$ac_ext
18286cat >>conftest.$ac_ext <<_ACEOF
18287/* end confdefs.h. */
18288/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
18289 For example, HP-UX 11i <limits.h> declares gettimeofday. */
18290#define $ac_func innocuous_$ac_func
18291
18292/* System header to define __stub macros and hopefully few prototypes,
18293 which can conflict with char $ac_func (); below.
18294 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
18295 <limits.h> exists even on freestanding compilers. */
18296
18297#ifdef __STDC__
18298# include <limits.h>
18299#else
18300# include <assert.h>
18301#endif
18302
18303#undef $ac_func
18304
18305/* Override any GCC internal prototype to avoid an error.
18306 Use char because int might match the return type of a GCC
18307 builtin and then its argument prototype would still apply. */
18308#ifdef __cplusplus
18309extern "C"
18310#endif
18311char $ac_func ();
18312/* The GNU C library defines this for functions which it implements
18313 to always fail with ENOSYS. Some functions are actually named
18314 something starting with __ and the normal name is an alias. */
18315#if defined __stub_$ac_func || defined __stub___$ac_func
18316choke me
18317#endif
18318
18319int
18320main ()
18321{
18322return $ac_func ();
18323 ;
18324 return 0;
18325}
18326_ACEOF
18327rm -f conftest.$ac_objext conftest$ac_exeext
18328if { (ac_try="$ac_link"
18329case "(($ac_try" in
18330 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18331 *) ac_try_echo=$ac_try;;
18332esac
18333eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18334 (eval "$ac_link") 2>conftest.er1
18335 ac_status=$?
18336 grep -v '^ *+' conftest.er1 >conftest.err
18337 rm -f conftest.er1
18338 cat conftest.err >&5
18339 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18340 (exit $ac_status); } && {
18341 test -z "$ac_c_werror_flag" ||
18342 test ! -s conftest.err
18343 } && test -s conftest$ac_exeext &&
18344 $as_test_x conftest$ac_exeext; then
18345 eval "$as_ac_var=yes"
18346else
18347 echo "$as_me: failed program was:" >&5
18348sed 's/^/| /' conftest.$ac_ext >&5
18349
18350 eval "$as_ac_var=no"
18351fi
18352
18353rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
18354 conftest$ac_exeext conftest.$ac_ext
18355fi
18356ac_res=`eval echo '${'$as_ac_var'}'`
18357 { echo "$as_me:$LINENO: result: $ac_res" >&5
18358echo "${ECHO_T}$ac_res" >&6; }
18359if test `eval echo '${'$as_ac_var'}'` = yes; then
10865 cat >>confdefs.h <<_ACEOF 18360 cat >>confdefs.h <<_ACEOF
10866#define HAVE_SETRESUID 1 18361#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10867_ACEOF 18362_ACEOF
10868 18363
10869 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setresuid seems to work" >&5 18364 { echo "$as_me:$LINENO: checking if setresuid seems to work" >&5
10870$as_echo_n "checking if setresuid seems to work... " >&6; } 18365echo $ECHO_N "checking if setresuid seems to work... $ECHO_C" >&6; }
10871 if test "$cross_compiling" = yes; then : 18366 if test "$cross_compiling" = yes; then
10872 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking setresuid" >&5 18367 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking setresuid" >&5
10873$as_echo "$as_me: WARNING: cross compiling: not checking setresuid" >&2;} 18368echo "$as_me: WARNING: cross compiling: not checking setresuid" >&2;}
10874 18369
10875else 18370else
10876 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 18371 cat >conftest.$ac_ext <<_ACEOF
18372/* confdefs.h. */
18373_ACEOF
18374cat confdefs.h >>conftest.$ac_ext
18375cat >>conftest.$ac_ext <<_ACEOF
10877/* end confdefs.h. */ 18376/* end confdefs.h. */
10878 18377
10879#include <stdlib.h> 18378#include <stdlib.h>
@@ -10894,41 +18393,154 @@ main ()
10894 return 0; 18393 return 0;
10895} 18394}
10896_ACEOF 18395_ACEOF
10897if ac_fn_c_try_run "$LINENO"; then : 18396rm -f conftest$ac_exeext
10898 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 18397if { (ac_try="$ac_link"
10899$as_echo "yes" >&6; } 18398case "(($ac_try" in
18399 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18400 *) ac_try_echo=$ac_try;;
18401esac
18402eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18403 (eval "$ac_link") 2>&5
18404 ac_status=$?
18405 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18406 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
18407 { (case "(($ac_try" in
18408 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18409 *) ac_try_echo=$ac_try;;
18410esac
18411eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18412 (eval "$ac_try") 2>&5
18413 ac_status=$?
18414 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18415 (exit $ac_status); }; }; then
18416 { echo "$as_me:$LINENO: result: yes" >&5
18417echo "${ECHO_T}yes" >&6; }
10900else 18418else
18419 echo "$as_me: program exited with status $ac_status" >&5
18420echo "$as_me: failed program was:" >&5
18421sed 's/^/| /' conftest.$ac_ext >&5
18422
18423( exit $ac_status )
10901 18424
10902$as_echo "#define BROKEN_SETRESUID 1" >>confdefs.h 18425cat >>confdefs.h <<\_ACEOF
18426#define BROKEN_SETRESUID 1
18427_ACEOF
10903 18428
10904 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not implemented" >&5 18429 { echo "$as_me:$LINENO: result: not implemented" >&5
10905$as_echo "not implemented" >&6; } 18430echo "${ECHO_T}not implemented" >&6; }
10906fi 18431fi
10907rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 18432rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
10908 conftest.$ac_objext conftest.beam conftest.$ac_ext
10909fi 18433fi
10910 18434
10911 18435
18436
10912fi 18437fi
10913done 18438done
10914 18439
10915 18440
18441
10916for ac_func in setresgid 18442for ac_func in setresgid
10917do : 18443do
10918 ac_fn_c_check_func "$LINENO" "setresgid" "ac_cv_func_setresgid" 18444as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10919if test "x$ac_cv_func_setresgid" = xyes; then : 18445{ echo "$as_me:$LINENO: checking for $ac_func" >&5
18446echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
18447if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
18448 echo $ECHO_N "(cached) $ECHO_C" >&6
18449else
18450 cat >conftest.$ac_ext <<_ACEOF
18451/* confdefs.h. */
18452_ACEOF
18453cat confdefs.h >>conftest.$ac_ext
18454cat >>conftest.$ac_ext <<_ACEOF
18455/* end confdefs.h. */
18456/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
18457 For example, HP-UX 11i <limits.h> declares gettimeofday. */
18458#define $ac_func innocuous_$ac_func
18459
18460/* System header to define __stub macros and hopefully few prototypes,
18461 which can conflict with char $ac_func (); below.
18462 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
18463 <limits.h> exists even on freestanding compilers. */
18464
18465#ifdef __STDC__
18466# include <limits.h>
18467#else
18468# include <assert.h>
18469#endif
18470
18471#undef $ac_func
18472
18473/* Override any GCC internal prototype to avoid an error.
18474 Use char because int might match the return type of a GCC
18475 builtin and then its argument prototype would still apply. */
18476#ifdef __cplusplus
18477extern "C"
18478#endif
18479char $ac_func ();
18480/* The GNU C library defines this for functions which it implements
18481 to always fail with ENOSYS. Some functions are actually named
18482 something starting with __ and the normal name is an alias. */
18483#if defined __stub_$ac_func || defined __stub___$ac_func
18484choke me
18485#endif
18486
18487int
18488main ()
18489{
18490return $ac_func ();
18491 ;
18492 return 0;
18493}
18494_ACEOF
18495rm -f conftest.$ac_objext conftest$ac_exeext
18496if { (ac_try="$ac_link"
18497case "(($ac_try" in
18498 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18499 *) ac_try_echo=$ac_try;;
18500esac
18501eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18502 (eval "$ac_link") 2>conftest.er1
18503 ac_status=$?
18504 grep -v '^ *+' conftest.er1 >conftest.err
18505 rm -f conftest.er1
18506 cat conftest.err >&5
18507 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18508 (exit $ac_status); } && {
18509 test -z "$ac_c_werror_flag" ||
18510 test ! -s conftest.err
18511 } && test -s conftest$ac_exeext &&
18512 $as_test_x conftest$ac_exeext; then
18513 eval "$as_ac_var=yes"
18514else
18515 echo "$as_me: failed program was:" >&5
18516sed 's/^/| /' conftest.$ac_ext >&5
18517
18518 eval "$as_ac_var=no"
18519fi
18520
18521rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
18522 conftest$ac_exeext conftest.$ac_ext
18523fi
18524ac_res=`eval echo '${'$as_ac_var'}'`
18525 { echo "$as_me:$LINENO: result: $ac_res" >&5
18526echo "${ECHO_T}$ac_res" >&6; }
18527if test `eval echo '${'$as_ac_var'}'` = yes; then
10920 cat >>confdefs.h <<_ACEOF 18528 cat >>confdefs.h <<_ACEOF
10921#define HAVE_SETRESGID 1 18529#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10922_ACEOF 18530_ACEOF
10923 18531
10924 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setresgid seems to work" >&5 18532 { echo "$as_me:$LINENO: checking if setresgid seems to work" >&5
10925$as_echo_n "checking if setresgid seems to work... " >&6; } 18533echo $ECHO_N "checking if setresgid seems to work... $ECHO_C" >&6; }
10926 if test "$cross_compiling" = yes; then : 18534 if test "$cross_compiling" = yes; then
10927 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking setresuid" >&5 18535 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking setresuid" >&5
10928$as_echo "$as_me: WARNING: cross compiling: not checking setresuid" >&2;} 18536echo "$as_me: WARNING: cross compiling: not checking setresuid" >&2;}
10929 18537
10930else 18538else
10931 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 18539 cat >conftest.$ac_ext <<_ACEOF
18540/* confdefs.h. */
18541_ACEOF
18542cat confdefs.h >>conftest.$ac_ext
18543cat >>conftest.$ac_ext <<_ACEOF
10932/* end confdefs.h. */ 18544/* end confdefs.h. */
10933 18545
10934#include <stdlib.h> 18546#include <stdlib.h>
@@ -10949,110 +18561,729 @@ main ()
10949 return 0; 18561 return 0;
10950} 18562}
10951_ACEOF 18563_ACEOF
10952if ac_fn_c_try_run "$LINENO"; then : 18564rm -f conftest$ac_exeext
10953 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 18565if { (ac_try="$ac_link"
10954$as_echo "yes" >&6; } 18566case "(($ac_try" in
18567 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18568 *) ac_try_echo=$ac_try;;
18569esac
18570eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18571 (eval "$ac_link") 2>&5
18572 ac_status=$?
18573 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18574 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
18575 { (case "(($ac_try" in
18576 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18577 *) ac_try_echo=$ac_try;;
18578esac
18579eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18580 (eval "$ac_try") 2>&5
18581 ac_status=$?
18582 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18583 (exit $ac_status); }; }; then
18584 { echo "$as_me:$LINENO: result: yes" >&5
18585echo "${ECHO_T}yes" >&6; }
10955else 18586else
18587 echo "$as_me: program exited with status $ac_status" >&5
18588echo "$as_me: failed program was:" >&5
18589sed 's/^/| /' conftest.$ac_ext >&5
18590
18591( exit $ac_status )
10956 18592
10957$as_echo "#define BROKEN_SETRESGID 1" >>confdefs.h 18593cat >>confdefs.h <<\_ACEOF
18594#define BROKEN_SETRESGID 1
18595_ACEOF
10958 18596
10959 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not implemented" >&5 18597 { echo "$as_me:$LINENO: result: not implemented" >&5
10960$as_echo "not implemented" >&6; } 18598echo "${ECHO_T}not implemented" >&6; }
10961fi 18599fi
10962rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 18600rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
10963 conftest.$ac_objext conftest.beam conftest.$ac_ext
10964fi 18601fi
10965 18602
10966 18603
18604
10967fi 18605fi
10968done 18606done
10969 18607
10970 18608
18609
18610
10971for ac_func in gettimeofday time 18611for ac_func in gettimeofday time
10972do : 18612do
10973 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 18613as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10974ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 18614{ echo "$as_me:$LINENO: checking for $ac_func" >&5
10975if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 18615echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
18616if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
18617 echo $ECHO_N "(cached) $ECHO_C" >&6
18618else
18619 cat >conftest.$ac_ext <<_ACEOF
18620/* confdefs.h. */
18621_ACEOF
18622cat confdefs.h >>conftest.$ac_ext
18623cat >>conftest.$ac_ext <<_ACEOF
18624/* end confdefs.h. */
18625/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
18626 For example, HP-UX 11i <limits.h> declares gettimeofday. */
18627#define $ac_func innocuous_$ac_func
18628
18629/* System header to define __stub macros and hopefully few prototypes,
18630 which can conflict with char $ac_func (); below.
18631 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
18632 <limits.h> exists even on freestanding compilers. */
18633
18634#ifdef __STDC__
18635# include <limits.h>
18636#else
18637# include <assert.h>
18638#endif
18639
18640#undef $ac_func
18641
18642/* Override any GCC internal prototype to avoid an error.
18643 Use char because int might match the return type of a GCC
18644 builtin and then its argument prototype would still apply. */
18645#ifdef __cplusplus
18646extern "C"
18647#endif
18648char $ac_func ();
18649/* The GNU C library defines this for functions which it implements
18650 to always fail with ENOSYS. Some functions are actually named
18651 something starting with __ and the normal name is an alias. */
18652#if defined __stub_$ac_func || defined __stub___$ac_func
18653choke me
18654#endif
18655
18656int
18657main ()
18658{
18659return $ac_func ();
18660 ;
18661 return 0;
18662}
18663_ACEOF
18664rm -f conftest.$ac_objext conftest$ac_exeext
18665if { (ac_try="$ac_link"
18666case "(($ac_try" in
18667 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18668 *) ac_try_echo=$ac_try;;
18669esac
18670eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18671 (eval "$ac_link") 2>conftest.er1
18672 ac_status=$?
18673 grep -v '^ *+' conftest.er1 >conftest.err
18674 rm -f conftest.er1
18675 cat conftest.err >&5
18676 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18677 (exit $ac_status); } && {
18678 test -z "$ac_c_werror_flag" ||
18679 test ! -s conftest.err
18680 } && test -s conftest$ac_exeext &&
18681 $as_test_x conftest$ac_exeext; then
18682 eval "$as_ac_var=yes"
18683else
18684 echo "$as_me: failed program was:" >&5
18685sed 's/^/| /' conftest.$ac_ext >&5
18686
18687 eval "$as_ac_var=no"
18688fi
18689
18690rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
18691 conftest$ac_exeext conftest.$ac_ext
18692fi
18693ac_res=`eval echo '${'$as_ac_var'}'`
18694 { echo "$as_me:$LINENO: result: $ac_res" >&5
18695echo "${ECHO_T}$ac_res" >&6; }
18696if test `eval echo '${'$as_ac_var'}'` = yes; then
10976 cat >>confdefs.h <<_ACEOF 18697 cat >>confdefs.h <<_ACEOF
10977#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 18698#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10978_ACEOF 18699_ACEOF
10979 18700
10980fi 18701fi
10981done 18702done
10982 18703
18704
18705
18706
18707
18708
18709
10983for ac_func in endutent getutent getutid getutline pututline setutent 18710for ac_func in endutent getutent getutid getutline pututline setutent
10984do : 18711do
10985 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 18712as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10986ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 18713{ echo "$as_me:$LINENO: checking for $ac_func" >&5
10987if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 18714echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
18715if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
18716 echo $ECHO_N "(cached) $ECHO_C" >&6
18717else
18718 cat >conftest.$ac_ext <<_ACEOF
18719/* confdefs.h. */
18720_ACEOF
18721cat confdefs.h >>conftest.$ac_ext
18722cat >>conftest.$ac_ext <<_ACEOF
18723/* end confdefs.h. */
18724/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
18725 For example, HP-UX 11i <limits.h> declares gettimeofday. */
18726#define $ac_func innocuous_$ac_func
18727
18728/* System header to define __stub macros and hopefully few prototypes,
18729 which can conflict with char $ac_func (); below.
18730 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
18731 <limits.h> exists even on freestanding compilers. */
18732
18733#ifdef __STDC__
18734# include <limits.h>
18735#else
18736# include <assert.h>
18737#endif
18738
18739#undef $ac_func
18740
18741/* Override any GCC internal prototype to avoid an error.
18742 Use char because int might match the return type of a GCC
18743 builtin and then its argument prototype would still apply. */
18744#ifdef __cplusplus
18745extern "C"
18746#endif
18747char $ac_func ();
18748/* The GNU C library defines this for functions which it implements
18749 to always fail with ENOSYS. Some functions are actually named
18750 something starting with __ and the normal name is an alias. */
18751#if defined __stub_$ac_func || defined __stub___$ac_func
18752choke me
18753#endif
18754
18755int
18756main ()
18757{
18758return $ac_func ();
18759 ;
18760 return 0;
18761}
18762_ACEOF
18763rm -f conftest.$ac_objext conftest$ac_exeext
18764if { (ac_try="$ac_link"
18765case "(($ac_try" in
18766 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18767 *) ac_try_echo=$ac_try;;
18768esac
18769eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18770 (eval "$ac_link") 2>conftest.er1
18771 ac_status=$?
18772 grep -v '^ *+' conftest.er1 >conftest.err
18773 rm -f conftest.er1
18774 cat conftest.err >&5
18775 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18776 (exit $ac_status); } && {
18777 test -z "$ac_c_werror_flag" ||
18778 test ! -s conftest.err
18779 } && test -s conftest$ac_exeext &&
18780 $as_test_x conftest$ac_exeext; then
18781 eval "$as_ac_var=yes"
18782else
18783 echo "$as_me: failed program was:" >&5
18784sed 's/^/| /' conftest.$ac_ext >&5
18785
18786 eval "$as_ac_var=no"
18787fi
18788
18789rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
18790 conftest$ac_exeext conftest.$ac_ext
18791fi
18792ac_res=`eval echo '${'$as_ac_var'}'`
18793 { echo "$as_me:$LINENO: result: $ac_res" >&5
18794echo "${ECHO_T}$ac_res" >&6; }
18795if test `eval echo '${'$as_ac_var'}'` = yes; then
10988 cat >>confdefs.h <<_ACEOF 18796 cat >>confdefs.h <<_ACEOF
10989#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 18797#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10990_ACEOF 18798_ACEOF
10991 18799
10992fi 18800fi
10993done 18801done
10994 18802
18803
10995for ac_func in utmpname 18804for ac_func in utmpname
10996do : 18805do
10997 ac_fn_c_check_func "$LINENO" "utmpname" "ac_cv_func_utmpname" 18806as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10998if test "x$ac_cv_func_utmpname" = xyes; then : 18807{ echo "$as_me:$LINENO: checking for $ac_func" >&5
18808echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
18809if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
18810 echo $ECHO_N "(cached) $ECHO_C" >&6
18811else
18812 cat >conftest.$ac_ext <<_ACEOF
18813/* confdefs.h. */
18814_ACEOF
18815cat confdefs.h >>conftest.$ac_ext
18816cat >>conftest.$ac_ext <<_ACEOF
18817/* end confdefs.h. */
18818/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
18819 For example, HP-UX 11i <limits.h> declares gettimeofday. */
18820#define $ac_func innocuous_$ac_func
18821
18822/* System header to define __stub macros and hopefully few prototypes,
18823 which can conflict with char $ac_func (); below.
18824 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
18825 <limits.h> exists even on freestanding compilers. */
18826
18827#ifdef __STDC__
18828# include <limits.h>
18829#else
18830# include <assert.h>
18831#endif
18832
18833#undef $ac_func
18834
18835/* Override any GCC internal prototype to avoid an error.
18836 Use char because int might match the return type of a GCC
18837 builtin and then its argument prototype would still apply. */
18838#ifdef __cplusplus
18839extern "C"
18840#endif
18841char $ac_func ();
18842/* The GNU C library defines this for functions which it implements
18843 to always fail with ENOSYS. Some functions are actually named
18844 something starting with __ and the normal name is an alias. */
18845#if defined __stub_$ac_func || defined __stub___$ac_func
18846choke me
18847#endif
18848
18849int
18850main ()
18851{
18852return $ac_func ();
18853 ;
18854 return 0;
18855}
18856_ACEOF
18857rm -f conftest.$ac_objext conftest$ac_exeext
18858if { (ac_try="$ac_link"
18859case "(($ac_try" in
18860 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18861 *) ac_try_echo=$ac_try;;
18862esac
18863eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18864 (eval "$ac_link") 2>conftest.er1
18865 ac_status=$?
18866 grep -v '^ *+' conftest.er1 >conftest.err
18867 rm -f conftest.er1
18868 cat conftest.err >&5
18869 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18870 (exit $ac_status); } && {
18871 test -z "$ac_c_werror_flag" ||
18872 test ! -s conftest.err
18873 } && test -s conftest$ac_exeext &&
18874 $as_test_x conftest$ac_exeext; then
18875 eval "$as_ac_var=yes"
18876else
18877 echo "$as_me: failed program was:" >&5
18878sed 's/^/| /' conftest.$ac_ext >&5
18879
18880 eval "$as_ac_var=no"
18881fi
18882
18883rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
18884 conftest$ac_exeext conftest.$ac_ext
18885fi
18886ac_res=`eval echo '${'$as_ac_var'}'`
18887 { echo "$as_me:$LINENO: result: $ac_res" >&5
18888echo "${ECHO_T}$ac_res" >&6; }
18889if test `eval echo '${'$as_ac_var'}'` = yes; then
10999 cat >>confdefs.h <<_ACEOF 18890 cat >>confdefs.h <<_ACEOF
11000#define HAVE_UTMPNAME 1 18891#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
11001_ACEOF 18892_ACEOF
11002 18893
11003fi 18894fi
11004done 18895done
11005 18896
18897
18898
18899
18900
18901
18902
11006for ac_func in endutxent getutxent getutxid getutxline getutxuser pututxline 18903for ac_func in endutxent getutxent getutxid getutxline getutxuser pututxline
11007do : 18904do
11008 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 18905as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
11009ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 18906{ echo "$as_me:$LINENO: checking for $ac_func" >&5
11010if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 18907echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
18908if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
18909 echo $ECHO_N "(cached) $ECHO_C" >&6
18910else
18911 cat >conftest.$ac_ext <<_ACEOF
18912/* confdefs.h. */
18913_ACEOF
18914cat confdefs.h >>conftest.$ac_ext
18915cat >>conftest.$ac_ext <<_ACEOF
18916/* end confdefs.h. */
18917/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
18918 For example, HP-UX 11i <limits.h> declares gettimeofday. */
18919#define $ac_func innocuous_$ac_func
18920
18921/* System header to define __stub macros and hopefully few prototypes,
18922 which can conflict with char $ac_func (); below.
18923 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
18924 <limits.h> exists even on freestanding compilers. */
18925
18926#ifdef __STDC__
18927# include <limits.h>
18928#else
18929# include <assert.h>
18930#endif
18931
18932#undef $ac_func
18933
18934/* Override any GCC internal prototype to avoid an error.
18935 Use char because int might match the return type of a GCC
18936 builtin and then its argument prototype would still apply. */
18937#ifdef __cplusplus
18938extern "C"
18939#endif
18940char $ac_func ();
18941/* The GNU C library defines this for functions which it implements
18942 to always fail with ENOSYS. Some functions are actually named
18943 something starting with __ and the normal name is an alias. */
18944#if defined __stub_$ac_func || defined __stub___$ac_func
18945choke me
18946#endif
18947
18948int
18949main ()
18950{
18951return $ac_func ();
18952 ;
18953 return 0;
18954}
18955_ACEOF
18956rm -f conftest.$ac_objext conftest$ac_exeext
18957if { (ac_try="$ac_link"
18958case "(($ac_try" in
18959 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
18960 *) ac_try_echo=$ac_try;;
18961esac
18962eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
18963 (eval "$ac_link") 2>conftest.er1
18964 ac_status=$?
18965 grep -v '^ *+' conftest.er1 >conftest.err
18966 rm -f conftest.er1
18967 cat conftest.err >&5
18968 echo "$as_me:$LINENO: \$? = $ac_status" >&5
18969 (exit $ac_status); } && {
18970 test -z "$ac_c_werror_flag" ||
18971 test ! -s conftest.err
18972 } && test -s conftest$ac_exeext &&
18973 $as_test_x conftest$ac_exeext; then
18974 eval "$as_ac_var=yes"
18975else
18976 echo "$as_me: failed program was:" >&5
18977sed 's/^/| /' conftest.$ac_ext >&5
18978
18979 eval "$as_ac_var=no"
18980fi
18981
18982rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
18983 conftest$ac_exeext conftest.$ac_ext
18984fi
18985ac_res=`eval echo '${'$as_ac_var'}'`
18986 { echo "$as_me:$LINENO: result: $ac_res" >&5
18987echo "${ECHO_T}$ac_res" >&6; }
18988if test `eval echo '${'$as_ac_var'}'` = yes; then
11011 cat >>confdefs.h <<_ACEOF 18989 cat >>confdefs.h <<_ACEOF
11012#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 18990#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
11013_ACEOF 18991_ACEOF
11014 18992
11015fi 18993fi
11016done 18994done
11017 18995
18996
18997
18998
11018for ac_func in setutxdb setutxent utmpxname 18999for ac_func in setutxdb setutxent utmpxname
11019do : 19000do
11020 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 19001as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
11021ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 19002{ echo "$as_me:$LINENO: checking for $ac_func" >&5
11022if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 19003echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
19004if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
19005 echo $ECHO_N "(cached) $ECHO_C" >&6
19006else
19007 cat >conftest.$ac_ext <<_ACEOF
19008/* confdefs.h. */
19009_ACEOF
19010cat confdefs.h >>conftest.$ac_ext
19011cat >>conftest.$ac_ext <<_ACEOF
19012/* end confdefs.h. */
19013/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
19014 For example, HP-UX 11i <limits.h> declares gettimeofday. */
19015#define $ac_func innocuous_$ac_func
19016
19017/* System header to define __stub macros and hopefully few prototypes,
19018 which can conflict with char $ac_func (); below.
19019 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
19020 <limits.h> exists even on freestanding compilers. */
19021
19022#ifdef __STDC__
19023# include <limits.h>
19024#else
19025# include <assert.h>
19026#endif
19027
19028#undef $ac_func
19029
19030/* Override any GCC internal prototype to avoid an error.
19031 Use char because int might match the return type of a GCC
19032 builtin and then its argument prototype would still apply. */
19033#ifdef __cplusplus
19034extern "C"
19035#endif
19036char $ac_func ();
19037/* The GNU C library defines this for functions which it implements
19038 to always fail with ENOSYS. Some functions are actually named
19039 something starting with __ and the normal name is an alias. */
19040#if defined __stub_$ac_func || defined __stub___$ac_func
19041choke me
19042#endif
19043
19044int
19045main ()
19046{
19047return $ac_func ();
19048 ;
19049 return 0;
19050}
19051_ACEOF
19052rm -f conftest.$ac_objext conftest$ac_exeext
19053if { (ac_try="$ac_link"
19054case "(($ac_try" in
19055 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19056 *) ac_try_echo=$ac_try;;
19057esac
19058eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19059 (eval "$ac_link") 2>conftest.er1
19060 ac_status=$?
19061 grep -v '^ *+' conftest.er1 >conftest.err
19062 rm -f conftest.er1
19063 cat conftest.err >&5
19064 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19065 (exit $ac_status); } && {
19066 test -z "$ac_c_werror_flag" ||
19067 test ! -s conftest.err
19068 } && test -s conftest$ac_exeext &&
19069 $as_test_x conftest$ac_exeext; then
19070 eval "$as_ac_var=yes"
19071else
19072 echo "$as_me: failed program was:" >&5
19073sed 's/^/| /' conftest.$ac_ext >&5
19074
19075 eval "$as_ac_var=no"
19076fi
19077
19078rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
19079 conftest$ac_exeext conftest.$ac_ext
19080fi
19081ac_res=`eval echo '${'$as_ac_var'}'`
19082 { echo "$as_me:$LINENO: result: $ac_res" >&5
19083echo "${ECHO_T}$ac_res" >&6; }
19084if test `eval echo '${'$as_ac_var'}'` = yes; then
11023 cat >>confdefs.h <<_ACEOF 19085 cat >>confdefs.h <<_ACEOF
11024#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 19086#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
11025_ACEOF 19087_ACEOF
11026 19088
11027fi 19089fi
11028done 19090done
11029 19091
19092
11030for ac_func in getlastlogxbyname 19093for ac_func in getlastlogxbyname
11031do : 19094do
11032 ac_fn_c_check_func "$LINENO" "getlastlogxbyname" "ac_cv_func_getlastlogxbyname" 19095as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
11033if test "x$ac_cv_func_getlastlogxbyname" = xyes; then : 19096{ echo "$as_me:$LINENO: checking for $ac_func" >&5
19097echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
19098if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
19099 echo $ECHO_N "(cached) $ECHO_C" >&6
19100else
19101 cat >conftest.$ac_ext <<_ACEOF
19102/* confdefs.h. */
19103_ACEOF
19104cat confdefs.h >>conftest.$ac_ext
19105cat >>conftest.$ac_ext <<_ACEOF
19106/* end confdefs.h. */
19107/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
19108 For example, HP-UX 11i <limits.h> declares gettimeofday. */
19109#define $ac_func innocuous_$ac_func
19110
19111/* System header to define __stub macros and hopefully few prototypes,
19112 which can conflict with char $ac_func (); below.
19113 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
19114 <limits.h> exists even on freestanding compilers. */
19115
19116#ifdef __STDC__
19117# include <limits.h>
19118#else
19119# include <assert.h>
19120#endif
19121
19122#undef $ac_func
19123
19124/* Override any GCC internal prototype to avoid an error.
19125 Use char because int might match the return type of a GCC
19126 builtin and then its argument prototype would still apply. */
19127#ifdef __cplusplus
19128extern "C"
19129#endif
19130char $ac_func ();
19131/* The GNU C library defines this for functions which it implements
19132 to always fail with ENOSYS. Some functions are actually named
19133 something starting with __ and the normal name is an alias. */
19134#if defined __stub_$ac_func || defined __stub___$ac_func
19135choke me
19136#endif
19137
19138int
19139main ()
19140{
19141return $ac_func ();
19142 ;
19143 return 0;
19144}
19145_ACEOF
19146rm -f conftest.$ac_objext conftest$ac_exeext
19147if { (ac_try="$ac_link"
19148case "(($ac_try" in
19149 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19150 *) ac_try_echo=$ac_try;;
19151esac
19152eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19153 (eval "$ac_link") 2>conftest.er1
19154 ac_status=$?
19155 grep -v '^ *+' conftest.er1 >conftest.err
19156 rm -f conftest.er1
19157 cat conftest.err >&5
19158 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19159 (exit $ac_status); } && {
19160 test -z "$ac_c_werror_flag" ||
19161 test ! -s conftest.err
19162 } && test -s conftest$ac_exeext &&
19163 $as_test_x conftest$ac_exeext; then
19164 eval "$as_ac_var=yes"
19165else
19166 echo "$as_me: failed program was:" >&5
19167sed 's/^/| /' conftest.$ac_ext >&5
19168
19169 eval "$as_ac_var=no"
19170fi
19171
19172rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
19173 conftest$ac_exeext conftest.$ac_ext
19174fi
19175ac_res=`eval echo '${'$as_ac_var'}'`
19176 { echo "$as_me:$LINENO: result: $ac_res" >&5
19177echo "${ECHO_T}$ac_res" >&6; }
19178if test `eval echo '${'$as_ac_var'}'` = yes; then
11034 cat >>confdefs.h <<_ACEOF 19179 cat >>confdefs.h <<_ACEOF
11035#define HAVE_GETLASTLOGXBYNAME 1 19180#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
11036_ACEOF 19181_ACEOF
11037 19182
11038fi 19183fi
11039done 19184done
11040 19185
11041 19186
11042ac_fn_c_check_func "$LINENO" "daemon" "ac_cv_func_daemon" 19187{ echo "$as_me:$LINENO: checking for daemon" >&5
11043if test "x$ac_cv_func_daemon" = xyes; then : 19188echo $ECHO_N "checking for daemon... $ECHO_C" >&6; }
19189if test "${ac_cv_func_daemon+set}" = set; then
19190 echo $ECHO_N "(cached) $ECHO_C" >&6
19191else
19192 cat >conftest.$ac_ext <<_ACEOF
19193/* confdefs.h. */
19194_ACEOF
19195cat confdefs.h >>conftest.$ac_ext
19196cat >>conftest.$ac_ext <<_ACEOF
19197/* end confdefs.h. */
19198/* Define daemon to an innocuous variant, in case <limits.h> declares daemon.
19199 For example, HP-UX 11i <limits.h> declares gettimeofday. */
19200#define daemon innocuous_daemon
19201
19202/* System header to define __stub macros and hopefully few prototypes,
19203 which can conflict with char daemon (); below.
19204 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
19205 <limits.h> exists even on freestanding compilers. */
19206
19207#ifdef __STDC__
19208# include <limits.h>
19209#else
19210# include <assert.h>
19211#endif
19212
19213#undef daemon
19214
19215/* Override any GCC internal prototype to avoid an error.
19216 Use char because int might match the return type of a GCC
19217 builtin and then its argument prototype would still apply. */
19218#ifdef __cplusplus
19219extern "C"
19220#endif
19221char daemon ();
19222/* The GNU C library defines this for functions which it implements
19223 to always fail with ENOSYS. Some functions are actually named
19224 something starting with __ and the normal name is an alias. */
19225#if defined __stub_daemon || defined __stub___daemon
19226choke me
19227#endif
19228
19229int
19230main ()
19231{
19232return daemon ();
19233 ;
19234 return 0;
19235}
19236_ACEOF
19237rm -f conftest.$ac_objext conftest$ac_exeext
19238if { (ac_try="$ac_link"
19239case "(($ac_try" in
19240 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19241 *) ac_try_echo=$ac_try;;
19242esac
19243eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19244 (eval "$ac_link") 2>conftest.er1
19245 ac_status=$?
19246 grep -v '^ *+' conftest.er1 >conftest.err
19247 rm -f conftest.er1
19248 cat conftest.err >&5
19249 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19250 (exit $ac_status); } && {
19251 test -z "$ac_c_werror_flag" ||
19252 test ! -s conftest.err
19253 } && test -s conftest$ac_exeext &&
19254 $as_test_x conftest$ac_exeext; then
19255 ac_cv_func_daemon=yes
19256else
19257 echo "$as_me: failed program was:" >&5
19258sed 's/^/| /' conftest.$ac_ext >&5
19259
19260 ac_cv_func_daemon=no
19261fi
19262
19263rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
19264 conftest$ac_exeext conftest.$ac_ext
19265fi
19266{ echo "$as_me:$LINENO: result: $ac_cv_func_daemon" >&5
19267echo "${ECHO_T}$ac_cv_func_daemon" >&6; }
19268if test $ac_cv_func_daemon = yes; then
11044 19269
11045$as_echo "#define HAVE_DAEMON 1" >>confdefs.h 19270cat >>confdefs.h <<\_ACEOF
19271#define HAVE_DAEMON 1
19272_ACEOF
11046 19273
11047else 19274else
11048 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for daemon in -lbsd" >&5 19275 { echo "$as_me:$LINENO: checking for daemon in -lbsd" >&5
11049$as_echo_n "checking for daemon in -lbsd... " >&6; } 19276echo $ECHO_N "checking for daemon in -lbsd... $ECHO_C" >&6; }
11050if ${ac_cv_lib_bsd_daemon+:} false; then : 19277if test "${ac_cv_lib_bsd_daemon+set}" = set; then
11051 $as_echo_n "(cached) " >&6 19278 echo $ECHO_N "(cached) $ECHO_C" >&6
11052else 19279else
11053 ac_check_lib_save_LIBS=$LIBS 19280 ac_check_lib_save_LIBS=$LIBS
11054LIBS="-lbsd $LIBS" 19281LIBS="-lbsd $LIBS"
11055cat confdefs.h - <<_ACEOF >conftest.$ac_ext 19282cat >conftest.$ac_ext <<_ACEOF
19283/* confdefs.h. */
19284_ACEOF
19285cat confdefs.h >>conftest.$ac_ext
19286cat >>conftest.$ac_ext <<_ACEOF
11056/* end confdefs.h. */ 19287/* end confdefs.h. */
11057 19288
11058/* Override any GCC internal prototype to avoid an error. 19289/* Override any GCC internal prototype to avoid an error.
@@ -11070,19 +19301,42 @@ return daemon ();
11070 return 0; 19301 return 0;
11071} 19302}
11072_ACEOF 19303_ACEOF
11073if ac_fn_c_try_link "$LINENO"; then : 19304rm -f conftest.$ac_objext conftest$ac_exeext
19305if { (ac_try="$ac_link"
19306case "(($ac_try" in
19307 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19308 *) ac_try_echo=$ac_try;;
19309esac
19310eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19311 (eval "$ac_link") 2>conftest.er1
19312 ac_status=$?
19313 grep -v '^ *+' conftest.er1 >conftest.err
19314 rm -f conftest.er1
19315 cat conftest.err >&5
19316 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19317 (exit $ac_status); } && {
19318 test -z "$ac_c_werror_flag" ||
19319 test ! -s conftest.err
19320 } && test -s conftest$ac_exeext &&
19321 $as_test_x conftest$ac_exeext; then
11074 ac_cv_lib_bsd_daemon=yes 19322 ac_cv_lib_bsd_daemon=yes
11075else 19323else
11076 ac_cv_lib_bsd_daemon=no 19324 echo "$as_me: failed program was:" >&5
19325sed 's/^/| /' conftest.$ac_ext >&5
19326
19327 ac_cv_lib_bsd_daemon=no
11077fi 19328fi
11078rm -f core conftest.err conftest.$ac_objext \ 19329
11079 conftest$ac_exeext conftest.$ac_ext 19330rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
19331 conftest$ac_exeext conftest.$ac_ext
11080LIBS=$ac_check_lib_save_LIBS 19332LIBS=$ac_check_lib_save_LIBS
11081fi 19333fi
11082{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_daemon" >&5 19334{ echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_daemon" >&5
11083$as_echo "$ac_cv_lib_bsd_daemon" >&6; } 19335echo "${ECHO_T}$ac_cv_lib_bsd_daemon" >&6; }
11084if test "x$ac_cv_lib_bsd_daemon" = xyes; then : 19336if test $ac_cv_lib_bsd_daemon = yes; then
11085 LIBS="$LIBS -lbsd"; $as_echo "#define HAVE_DAEMON 1" >>confdefs.h 19337 LIBS="$LIBS -lbsd"; cat >>confdefs.h <<\_ACEOF
19338#define HAVE_DAEMON 1
19339_ACEOF
11086 19340
11087fi 19341fi
11088 19342
@@ -11090,20 +19344,106 @@ fi
11090fi 19344fi
11091 19345
11092 19346
11093ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" 19347{ echo "$as_me:$LINENO: checking for getpagesize" >&5
11094if test "x$ac_cv_func_getpagesize" = xyes; then : 19348echo $ECHO_N "checking for getpagesize... $ECHO_C" >&6; }
19349if test "${ac_cv_func_getpagesize+set}" = set; then
19350 echo $ECHO_N "(cached) $ECHO_C" >&6
19351else
19352 cat >conftest.$ac_ext <<_ACEOF
19353/* confdefs.h. */
19354_ACEOF
19355cat confdefs.h >>conftest.$ac_ext
19356cat >>conftest.$ac_ext <<_ACEOF
19357/* end confdefs.h. */
19358/* Define getpagesize to an innocuous variant, in case <limits.h> declares getpagesize.
19359 For example, HP-UX 11i <limits.h> declares gettimeofday. */
19360#define getpagesize innocuous_getpagesize
19361
19362/* System header to define __stub macros and hopefully few prototypes,
19363 which can conflict with char getpagesize (); below.
19364 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
19365 <limits.h> exists even on freestanding compilers. */
19366
19367#ifdef __STDC__
19368# include <limits.h>
19369#else
19370# include <assert.h>
19371#endif
19372
19373#undef getpagesize
19374
19375/* Override any GCC internal prototype to avoid an error.
19376 Use char because int might match the return type of a GCC
19377 builtin and then its argument prototype would still apply. */
19378#ifdef __cplusplus
19379extern "C"
19380#endif
19381char getpagesize ();
19382/* The GNU C library defines this for functions which it implements
19383 to always fail with ENOSYS. Some functions are actually named
19384 something starting with __ and the normal name is an alias. */
19385#if defined __stub_getpagesize || defined __stub___getpagesize
19386choke me
19387#endif
19388
19389int
19390main ()
19391{
19392return getpagesize ();
19393 ;
19394 return 0;
19395}
19396_ACEOF
19397rm -f conftest.$ac_objext conftest$ac_exeext
19398if { (ac_try="$ac_link"
19399case "(($ac_try" in
19400 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19401 *) ac_try_echo=$ac_try;;
19402esac
19403eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19404 (eval "$ac_link") 2>conftest.er1
19405 ac_status=$?
19406 grep -v '^ *+' conftest.er1 >conftest.err
19407 rm -f conftest.er1
19408 cat conftest.err >&5
19409 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19410 (exit $ac_status); } && {
19411 test -z "$ac_c_werror_flag" ||
19412 test ! -s conftest.err
19413 } && test -s conftest$ac_exeext &&
19414 $as_test_x conftest$ac_exeext; then
19415 ac_cv_func_getpagesize=yes
19416else
19417 echo "$as_me: failed program was:" >&5
19418sed 's/^/| /' conftest.$ac_ext >&5
19419
19420 ac_cv_func_getpagesize=no
19421fi
19422
19423rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
19424 conftest$ac_exeext conftest.$ac_ext
19425fi
19426{ echo "$as_me:$LINENO: result: $ac_cv_func_getpagesize" >&5
19427echo "${ECHO_T}$ac_cv_func_getpagesize" >&6; }
19428if test $ac_cv_func_getpagesize = yes; then
11095 19429
11096$as_echo "#define HAVE_GETPAGESIZE 1" >>confdefs.h 19430cat >>confdefs.h <<\_ACEOF
19431#define HAVE_GETPAGESIZE 1
19432_ACEOF
11097 19433
11098else 19434else
11099 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpagesize in -lucb" >&5 19435 { echo "$as_me:$LINENO: checking for getpagesize in -lucb" >&5
11100$as_echo_n "checking for getpagesize in -lucb... " >&6; } 19436echo $ECHO_N "checking for getpagesize in -lucb... $ECHO_C" >&6; }
11101if ${ac_cv_lib_ucb_getpagesize+:} false; then : 19437if test "${ac_cv_lib_ucb_getpagesize+set}" = set; then
11102 $as_echo_n "(cached) " >&6 19438 echo $ECHO_N "(cached) $ECHO_C" >&6
11103else 19439else
11104 ac_check_lib_save_LIBS=$LIBS 19440 ac_check_lib_save_LIBS=$LIBS
11105LIBS="-lucb $LIBS" 19441LIBS="-lucb $LIBS"
11106cat confdefs.h - <<_ACEOF >conftest.$ac_ext 19442cat >conftest.$ac_ext <<_ACEOF
19443/* confdefs.h. */
19444_ACEOF
19445cat confdefs.h >>conftest.$ac_ext
19446cat >>conftest.$ac_ext <<_ACEOF
11107/* end confdefs.h. */ 19447/* end confdefs.h. */
11108 19448
11109/* Override any GCC internal prototype to avoid an error. 19449/* Override any GCC internal prototype to avoid an error.
@@ -11121,19 +19461,42 @@ return getpagesize ();
11121 return 0; 19461 return 0;
11122} 19462}
11123_ACEOF 19463_ACEOF
11124if ac_fn_c_try_link "$LINENO"; then : 19464rm -f conftest.$ac_objext conftest$ac_exeext
19465if { (ac_try="$ac_link"
19466case "(($ac_try" in
19467 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19468 *) ac_try_echo=$ac_try;;
19469esac
19470eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19471 (eval "$ac_link") 2>conftest.er1
19472 ac_status=$?
19473 grep -v '^ *+' conftest.er1 >conftest.err
19474 rm -f conftest.er1
19475 cat conftest.err >&5
19476 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19477 (exit $ac_status); } && {
19478 test -z "$ac_c_werror_flag" ||
19479 test ! -s conftest.err
19480 } && test -s conftest$ac_exeext &&
19481 $as_test_x conftest$ac_exeext; then
11125 ac_cv_lib_ucb_getpagesize=yes 19482 ac_cv_lib_ucb_getpagesize=yes
11126else 19483else
11127 ac_cv_lib_ucb_getpagesize=no 19484 echo "$as_me: failed program was:" >&5
19485sed 's/^/| /' conftest.$ac_ext >&5
19486
19487 ac_cv_lib_ucb_getpagesize=no
11128fi 19488fi
11129rm -f core conftest.err conftest.$ac_objext \ 19489
11130 conftest$ac_exeext conftest.$ac_ext 19490rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
19491 conftest$ac_exeext conftest.$ac_ext
11131LIBS=$ac_check_lib_save_LIBS 19492LIBS=$ac_check_lib_save_LIBS
11132fi 19493fi
11133{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ucb_getpagesize" >&5 19494{ echo "$as_me:$LINENO: result: $ac_cv_lib_ucb_getpagesize" >&5
11134$as_echo "$ac_cv_lib_ucb_getpagesize" >&6; } 19495echo "${ECHO_T}$ac_cv_lib_ucb_getpagesize" >&6; }
11135if test "x$ac_cv_lib_ucb_getpagesize" = xyes; then : 19496if test $ac_cv_lib_ucb_getpagesize = yes; then
11136 LIBS="$LIBS -lucb"; $as_echo "#define HAVE_GETPAGESIZE 1" >>confdefs.h 19497 LIBS="$LIBS -lucb"; cat >>confdefs.h <<\_ACEOF
19498#define HAVE_GETPAGESIZE 1
19499_ACEOF
11137 19500
11138fi 19501fi
11139 19502
@@ -11143,14 +19506,18 @@ fi
11143 19506
11144# Check for broken snprintf 19507# Check for broken snprintf
11145if test "x$ac_cv_func_snprintf" = "xyes" ; then 19508if test "x$ac_cv_func_snprintf" = "xyes" ; then
11146 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf correctly terminates long strings" >&5 19509 { echo "$as_me:$LINENO: checking whether snprintf correctly terminates long strings" >&5
11147$as_echo_n "checking whether snprintf correctly terminates long strings... " >&6; } 19510echo $ECHO_N "checking whether snprintf correctly terminates long strings... $ECHO_C" >&6; }
11148 if test "$cross_compiling" = yes; then : 19511 if test "$cross_compiling" = yes; then
11149 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: Assuming working snprintf()" >&5 19512 { echo "$as_me:$LINENO: WARNING: cross compiling: Assuming working snprintf()" >&5
11150$as_echo "$as_me: WARNING: cross compiling: Assuming working snprintf()" >&2;} 19513echo "$as_me: WARNING: cross compiling: Assuming working snprintf()" >&2;}
11151 19514
11152else 19515else
11153 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 19516 cat >conftest.$ac_ext <<_ACEOF
19517/* confdefs.h. */
19518_ACEOF
19519cat confdefs.h >>conftest.$ac_ext
19520cat >>conftest.$ac_ext <<_ACEOF
11154/* end confdefs.h. */ 19521/* end confdefs.h. */
11155 #include <stdio.h> 19522 #include <stdio.h>
11156int 19523int
@@ -11165,37 +19532,67 @@ main ()
11165 return 0; 19532 return 0;
11166} 19533}
11167_ACEOF 19534_ACEOF
11168if ac_fn_c_try_run "$LINENO"; then : 19535rm -f conftest$ac_exeext
11169 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19536if { (ac_try="$ac_link"
11170$as_echo "yes" >&6; } 19537case "(($ac_try" in
19538 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19539 *) ac_try_echo=$ac_try;;
19540esac
19541eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19542 (eval "$ac_link") 2>&5
19543 ac_status=$?
19544 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19545 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
19546 { (case "(($ac_try" in
19547 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19548 *) ac_try_echo=$ac_try;;
19549esac
19550eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19551 (eval "$ac_try") 2>&5
19552 ac_status=$?
19553 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19554 (exit $ac_status); }; }; then
19555 { echo "$as_me:$LINENO: result: yes" >&5
19556echo "${ECHO_T}yes" >&6; }
11171else 19557else
19558 echo "$as_me: program exited with status $ac_status" >&5
19559echo "$as_me: failed program was:" >&5
19560sed 's/^/| /' conftest.$ac_ext >&5
19561
19562( exit $ac_status )
11172 19563
11173 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19564 { echo "$as_me:$LINENO: result: no" >&5
11174$as_echo "no" >&6; } 19565echo "${ECHO_T}no" >&6; }
11175 19566
11176$as_echo "#define BROKEN_SNPRINTF 1" >>confdefs.h 19567cat >>confdefs.h <<\_ACEOF
19568#define BROKEN_SNPRINTF 1
19569_ACEOF
11177 19570
11178 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ****** Your snprintf() function is broken, complain to your vendor" >&5 19571 { echo "$as_me:$LINENO: WARNING: ****** Your snprintf() function is broken, complain to your vendor" >&5
11179$as_echo "$as_me: WARNING: ****** Your snprintf() function is broken, complain to your vendor" >&2;} 19572echo "$as_me: WARNING: ****** Your snprintf() function is broken, complain to your vendor" >&2;}
11180 19573
11181fi 19574fi
11182rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 19575rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
11183 conftest.$ac_objext conftest.beam conftest.$ac_ext
11184fi 19576fi
11185 19577
19578
11186fi 19579fi
11187 19580
11188# We depend on vsnprintf returning the right thing on overflow: the 19581# We depend on vsnprintf returning the right thing on overflow: the
11189# number of characters it tried to create (as per SUSv3) 19582# number of characters it tried to create (as per SUSv3)
11190if test "x$ac_cv_func_vsnprintf" = "xyes" ; then 19583if test "x$ac_cv_func_vsnprintf" = "xyes" ; then
11191 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vsnprintf returns correct values on overflow" >&5 19584 { echo "$as_me:$LINENO: checking whether vsnprintf returns correct values on overflow" >&5
11192$as_echo_n "checking whether vsnprintf returns correct values on overflow... " >&6; } 19585echo $ECHO_N "checking whether vsnprintf returns correct values on overflow... $ECHO_C" >&6; }
11193 if test "$cross_compiling" = yes; then : 19586 if test "$cross_compiling" = yes; then
11194 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: Assuming working vsnprintf()" >&5 19587 { echo "$as_me:$LINENO: WARNING: cross compiling: Assuming working vsnprintf()" >&5
11195$as_echo "$as_me: WARNING: cross compiling: Assuming working vsnprintf()" >&2;} 19588echo "$as_me: WARNING: cross compiling: Assuming working vsnprintf()" >&2;}
11196 19589
11197else 19590else
11198 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 19591 cat >conftest.$ac_ext <<_ACEOF
19592/* confdefs.h. */
19593_ACEOF
19594cat confdefs.h >>conftest.$ac_ext
19595cat >>conftest.$ac_ext <<_ACEOF
11199/* end confdefs.h. */ 19596/* end confdefs.h. */
11200 19597
11201#include <sys/types.h> 19598#include <sys/types.h>
@@ -11228,32 +19625,62 @@ return 0;
11228 return 0; 19625 return 0;
11229} 19626}
11230_ACEOF 19627_ACEOF
11231if ac_fn_c_try_run "$LINENO"; then : 19628rm -f conftest$ac_exeext
11232 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19629if { (ac_try="$ac_link"
11233$as_echo "yes" >&6; } 19630case "(($ac_try" in
19631 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19632 *) ac_try_echo=$ac_try;;
19633esac
19634eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19635 (eval "$ac_link") 2>&5
19636 ac_status=$?
19637 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19638 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
19639 { (case "(($ac_try" in
19640 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19641 *) ac_try_echo=$ac_try;;
19642esac
19643eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19644 (eval "$ac_try") 2>&5
19645 ac_status=$?
19646 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19647 (exit $ac_status); }; }; then
19648 { echo "$as_me:$LINENO: result: yes" >&5
19649echo "${ECHO_T}yes" >&6; }
11234else 19650else
19651 echo "$as_me: program exited with status $ac_status" >&5
19652echo "$as_me: failed program was:" >&5
19653sed 's/^/| /' conftest.$ac_ext >&5
19654
19655( exit $ac_status )
11235 19656
11236 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19657 { echo "$as_me:$LINENO: result: no" >&5
11237$as_echo "no" >&6; } 19658echo "${ECHO_T}no" >&6; }
11238 19659
11239$as_echo "#define BROKEN_SNPRINTF 1" >>confdefs.h 19660cat >>confdefs.h <<\_ACEOF
19661#define BROKEN_SNPRINTF 1
19662_ACEOF
11240 19663
11241 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ****** Your vsnprintf() function is broken, complain to your vendor" >&5 19664 { echo "$as_me:$LINENO: WARNING: ****** Your vsnprintf() function is broken, complain to your vendor" >&5
11242$as_echo "$as_me: WARNING: ****** Your vsnprintf() function is broken, complain to your vendor" >&2;} 19665echo "$as_me: WARNING: ****** Your vsnprintf() function is broken, complain to your vendor" >&2;}
11243 19666
11244fi 19667fi
11245rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 19668rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
11246 conftest.$ac_objext conftest.beam conftest.$ac_ext
11247fi 19669fi
11248 19670
19671
11249fi 19672fi
11250 19673
11251# On systems where [v]snprintf is broken, but is declared in stdio, 19674# On systems where [v]snprintf is broken, but is declared in stdio,
11252# check that the fmt argument is const char * or just char *. 19675# check that the fmt argument is const char * or just char *.
11253# This is only useful for when BROKEN_SNPRINTF 19676# This is only useful for when BROKEN_SNPRINTF
11254{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf can declare const char *fmt" >&5 19677{ echo "$as_me:$LINENO: checking whether snprintf can declare const char *fmt" >&5
11255$as_echo_n "checking whether snprintf can declare const char *fmt... " >&6; } 19678echo $ECHO_N "checking whether snprintf can declare const char *fmt... $ECHO_C" >&6; }
11256cat confdefs.h - <<_ACEOF >conftest.$ac_ext 19679cat >conftest.$ac_ext <<_ACEOF
19680/* confdefs.h. */
19681_ACEOF
19682cat confdefs.h >>conftest.$ac_ext
19683cat >>conftest.$ac_ext <<_ACEOF
11257/* end confdefs.h. */ 19684/* end confdefs.h. */
11258 19685
11259#include <stdio.h> 19686#include <stdio.h>
@@ -11269,26 +19696,54 @@ main ()
11269 return 0; 19696 return 0;
11270} 19697}
11271_ACEOF 19698_ACEOF
11272if ac_fn_c_try_compile "$LINENO"; then : 19699rm -f conftest.$ac_objext
11273 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19700if { (ac_try="$ac_compile"
11274$as_echo "yes" >&6; } 19701case "(($ac_try" in
19702 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19703 *) ac_try_echo=$ac_try;;
19704esac
19705eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19706 (eval "$ac_compile") 2>conftest.er1
19707 ac_status=$?
19708 grep -v '^ *+' conftest.er1 >conftest.err
19709 rm -f conftest.er1
19710 cat conftest.err >&5
19711 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19712 (exit $ac_status); } && {
19713 test -z "$ac_c_werror_flag" ||
19714 test ! -s conftest.err
19715 } && test -s conftest.$ac_objext; then
19716 { echo "$as_me:$LINENO: result: yes" >&5
19717echo "${ECHO_T}yes" >&6; }
11275 19718
11276$as_echo "#define SNPRINTF_CONST const" >>confdefs.h 19719cat >>confdefs.h <<\_ACEOF
19720#define SNPRINTF_CONST const
19721_ACEOF
11277 19722
11278else 19723else
11279 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19724 echo "$as_me: failed program was:" >&5
11280$as_echo "no" >&6; } 19725sed 's/^/| /' conftest.$ac_ext >&5
11281 $as_echo "#define SNPRINTF_CONST /* not const */" >>confdefs.h 19726
19727 { echo "$as_me:$LINENO: result: no" >&5
19728echo "${ECHO_T}no" >&6; }
19729 cat >>confdefs.h <<\_ACEOF
19730#define SNPRINTF_CONST /* not const */
19731_ACEOF
11282 19732
11283fi 19733fi
19734
11284rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 19735rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11285 19736
11286# Check for missing getpeereid (or equiv) support 19737# Check for missing getpeereid (or equiv) support
11287NO_PEERCHECK="" 19738NO_PEERCHECK=""
11288if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then 19739if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
11289 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system supports SO_PEERCRED getsockopt" >&5 19740 { echo "$as_me:$LINENO: checking whether system supports SO_PEERCRED getsockopt" >&5
11290$as_echo_n "checking whether system supports SO_PEERCRED getsockopt... " >&6; } 19741echo $ECHO_N "checking whether system supports SO_PEERCRED getsockopt... $ECHO_C" >&6; }
11291 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 19742 cat >conftest.$ac_ext <<_ACEOF
19743/* confdefs.h. */
19744_ACEOF
19745cat confdefs.h >>conftest.$ac_ext
19746cat >>conftest.$ac_ext <<_ACEOF
11292/* end confdefs.h. */ 19747/* end confdefs.h. */
11293 19748
11294#include <sys/types.h> 19749#include <sys/types.h>
@@ -11301,35 +19756,63 @@ int i = SO_PEERCRED;
11301 return 0; 19756 return 0;
11302} 19757}
11303_ACEOF 19758_ACEOF
11304if ac_fn_c_try_compile "$LINENO"; then : 19759rm -f conftest.$ac_objext
11305 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19760if { (ac_try="$ac_compile"
11306$as_echo "yes" >&6; } 19761case "(($ac_try" in
19762 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19763 *) ac_try_echo=$ac_try;;
19764esac
19765eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19766 (eval "$ac_compile") 2>conftest.er1
19767 ac_status=$?
19768 grep -v '^ *+' conftest.er1 >conftest.err
19769 rm -f conftest.er1
19770 cat conftest.err >&5
19771 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19772 (exit $ac_status); } && {
19773 test -z "$ac_c_werror_flag" ||
19774 test ! -s conftest.err
19775 } && test -s conftest.$ac_objext; then
19776 { echo "$as_me:$LINENO: result: yes" >&5
19777echo "${ECHO_T}yes" >&6; }
11307 19778
11308$as_echo "#define HAVE_SO_PEERCRED 1" >>confdefs.h 19779cat >>confdefs.h <<\_ACEOF
19780#define HAVE_SO_PEERCRED 1
19781_ACEOF
11309 19782
11310 19783
11311else 19784else
11312 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19785 echo "$as_me: failed program was:" >&5
11313$as_echo "no" >&6; } 19786sed 's/^/| /' conftest.$ac_ext >&5
19787
19788 { echo "$as_me:$LINENO: result: no" >&5
19789echo "${ECHO_T}no" >&6; }
11314 NO_PEERCHECK=1 19790 NO_PEERCHECK=1
11315 19791
11316fi 19792fi
19793
11317rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 19794rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11318fi 19795fi
11319 19796
11320if test "x$ac_cv_func_mkdtemp" = "xyes" ; then 19797if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
11321{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for (overly) strict mkstemp" >&5 19798{ echo "$as_me:$LINENO: checking for (overly) strict mkstemp" >&5
11322$as_echo_n "checking for (overly) strict mkstemp... " >&6; } 19799echo $ECHO_N "checking for (overly) strict mkstemp... $ECHO_C" >&6; }
11323if test "$cross_compiling" = yes; then : 19800if test "$cross_compiling" = yes; then
11324 19801
11325 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19802 { echo "$as_me:$LINENO: result: yes" >&5
11326$as_echo "yes" >&6; } 19803echo "${ECHO_T}yes" >&6; }
11327 $as_echo "#define HAVE_STRICT_MKSTEMP 1" >>confdefs.h 19804 cat >>confdefs.h <<\_ACEOF
19805#define HAVE_STRICT_MKSTEMP 1
19806_ACEOF
11328 19807
11329 19808
11330 19809
11331else 19810else
11332 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 19811 cat >conftest.$ac_ext <<_ACEOF
19812/* confdefs.h. */
19813_ACEOF
19814cat confdefs.h >>conftest.$ac_ext
19815cat >>conftest.$ac_ext <<_ACEOF
11333/* end confdefs.h. */ 19816/* end confdefs.h. */
11334 19817
11335#include <stdlib.h> 19818#include <stdlib.h>
@@ -11348,37 +19831,67 @@ main ()
11348 return 0; 19831 return 0;
11349} 19832}
11350_ACEOF 19833_ACEOF
11351if ac_fn_c_try_run "$LINENO"; then : 19834rm -f conftest$ac_exeext
19835if { (ac_try="$ac_link"
19836case "(($ac_try" in
19837 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19838 *) ac_try_echo=$ac_try;;
19839esac
19840eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19841 (eval "$ac_link") 2>&5
19842 ac_status=$?
19843 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19844 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
19845 { (case "(($ac_try" in
19846 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19847 *) ac_try_echo=$ac_try;;
19848esac
19849eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19850 (eval "$ac_try") 2>&5
19851 ac_status=$?
19852 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19853 (exit $ac_status); }; }; then
11352 19854
11353 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19855 { echo "$as_me:$LINENO: result: no" >&5
11354$as_echo "no" >&6; } 19856echo "${ECHO_T}no" >&6; }
11355 19857
11356else 19858else
19859 echo "$as_me: program exited with status $ac_status" >&5
19860echo "$as_me: failed program was:" >&5
19861sed 's/^/| /' conftest.$ac_ext >&5
19862
19863( exit $ac_status )
11357 19864
11358 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19865 { echo "$as_me:$LINENO: result: yes" >&5
11359$as_echo "yes" >&6; } 19866echo "${ECHO_T}yes" >&6; }
11360 19867
11361$as_echo "#define HAVE_STRICT_MKSTEMP 1" >>confdefs.h 19868cat >>confdefs.h <<\_ACEOF
19869#define HAVE_STRICT_MKSTEMP 1
19870_ACEOF
11362 19871
11363 19872
11364fi 19873fi
11365rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 19874rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
11366 conftest.$ac_objext conftest.beam conftest.$ac_ext
11367fi 19875fi
11368 19876
19877
11369fi 19878fi
11370 19879
11371if test ! -z "$check_for_openpty_ctty_bug"; then 19880if test ! -z "$check_for_openpty_ctty_bug"; then
11372 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if openpty correctly handles controlling tty" >&5 19881 { echo "$as_me:$LINENO: checking if openpty correctly handles controlling tty" >&5
11373$as_echo_n "checking if openpty correctly handles controlling tty... " >&6; } 19882echo $ECHO_N "checking if openpty correctly handles controlling tty... $ECHO_C" >&6; }
11374 if test "$cross_compiling" = yes; then : 19883 if test "$cross_compiling" = yes; then
11375 19884
11376 { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling, assuming yes" >&5 19885 { echo "$as_me:$LINENO: result: cross-compiling, assuming yes" >&5
11377$as_echo "cross-compiling, assuming yes" >&6; } 19886echo "${ECHO_T}cross-compiling, assuming yes" >&6; }
11378 19887
11379 19888
11380else 19889else
11381 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 19890 cat >conftest.$ac_ext <<_ACEOF
19891/* confdefs.h. */
19892_ACEOF
19893cat confdefs.h >>conftest.$ac_ext
19894cat >>conftest.$ac_ext <<_ACEOF
11382/* end confdefs.h. */ 19895/* end confdefs.h. */
11383 19896
11384#include <stdio.h> 19897#include <stdio.h>
@@ -11417,37 +19930,67 @@ main ()
11417 return 0; 19930 return 0;
11418} 19931}
11419_ACEOF 19932_ACEOF
11420if ac_fn_c_try_run "$LINENO"; then : 19933rm -f conftest$ac_exeext
19934if { (ac_try="$ac_link"
19935case "(($ac_try" in
19936 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19937 *) ac_try_echo=$ac_try;;
19938esac
19939eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19940 (eval "$ac_link") 2>&5
19941 ac_status=$?
19942 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19943 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
19944 { (case "(($ac_try" in
19945 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
19946 *) ac_try_echo=$ac_try;;
19947esac
19948eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
19949 (eval "$ac_try") 2>&5
19950 ac_status=$?
19951 echo "$as_me:$LINENO: \$? = $ac_status" >&5
19952 (exit $ac_status); }; }; then
11421 19953
11422 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19954 { echo "$as_me:$LINENO: result: yes" >&5
11423$as_echo "yes" >&6; } 19955echo "${ECHO_T}yes" >&6; }
11424 19956
11425else 19957else
19958 echo "$as_me: program exited with status $ac_status" >&5
19959echo "$as_me: failed program was:" >&5
19960sed 's/^/| /' conftest.$ac_ext >&5
11426 19961
11427 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19962( exit $ac_status )
11428$as_echo "no" >&6; } 19963
11429 $as_echo "#define SSHD_ACQUIRES_CTTY 1" >>confdefs.h 19964 { echo "$as_me:$LINENO: result: no" >&5
19965echo "${ECHO_T}no" >&6; }
19966 cat >>confdefs.h <<\_ACEOF
19967#define SSHD_ACQUIRES_CTTY 1
19968_ACEOF
11430 19969
11431 19970
11432fi 19971fi
11433rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 19972rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
11434 conftest.$ac_objext conftest.beam conftest.$ac_ext
11435fi 19973fi
11436 19974
19975
11437fi 19976fi
11438 19977
11439if test "x$ac_cv_func_getaddrinfo" = "xyes" && \ 19978if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
11440 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then 19979 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
11441 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo seems to work" >&5 19980 { echo "$as_me:$LINENO: checking if getaddrinfo seems to work" >&5
11442$as_echo_n "checking if getaddrinfo seems to work... " >&6; } 19981echo $ECHO_N "checking if getaddrinfo seems to work... $ECHO_C" >&6; }
11443 if test "$cross_compiling" = yes; then : 19982 if test "$cross_compiling" = yes; then
11444 19983
11445 { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling, assuming yes" >&5 19984 { echo "$as_me:$LINENO: result: cross-compiling, assuming yes" >&5
11446$as_echo "cross-compiling, assuming yes" >&6; } 19985echo "${ECHO_T}cross-compiling, assuming yes" >&6; }
11447 19986
11448 19987
11449else 19988else
11450 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 19989 cat >conftest.$ac_ext <<_ACEOF
19990/* confdefs.h. */
19991_ACEOF
19992cat confdefs.h >>conftest.$ac_ext
19993cat >>conftest.$ac_ext <<_ACEOF
11451/* end confdefs.h. */ 19994/* end confdefs.h. */
11452 19995
11453#include <stdio.h> 19996#include <stdio.h>
@@ -11508,37 +20051,67 @@ main ()
11508 return 0; 20051 return 0;
11509} 20052}
11510_ACEOF 20053_ACEOF
11511if ac_fn_c_try_run "$LINENO"; then : 20054rm -f conftest$ac_exeext
20055if { (ac_try="$ac_link"
20056case "(($ac_try" in
20057 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20058 *) ac_try_echo=$ac_try;;
20059esac
20060eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20061 (eval "$ac_link") 2>&5
20062 ac_status=$?
20063 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20064 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
20065 { (case "(($ac_try" in
20066 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20067 *) ac_try_echo=$ac_try;;
20068esac
20069eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20070 (eval "$ac_try") 2>&5
20071 ac_status=$?
20072 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20073 (exit $ac_status); }; }; then
11512 20074
11513 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 20075 { echo "$as_me:$LINENO: result: yes" >&5
11514$as_echo "yes" >&6; } 20076echo "${ECHO_T}yes" >&6; }
11515 20077
11516else 20078else
20079 echo "$as_me: program exited with status $ac_status" >&5
20080echo "$as_me: failed program was:" >&5
20081sed 's/^/| /' conftest.$ac_ext >&5
11517 20082
11518 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 20083( exit $ac_status )
11519$as_echo "no" >&6; } 20084
11520 $as_echo "#define BROKEN_GETADDRINFO 1" >>confdefs.h 20085 { echo "$as_me:$LINENO: result: no" >&5
20086echo "${ECHO_T}no" >&6; }
20087 cat >>confdefs.h <<\_ACEOF
20088#define BROKEN_GETADDRINFO 1
20089_ACEOF
11521 20090
11522 20091
11523fi 20092fi
11524rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 20093rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
11525 conftest.$ac_objext conftest.beam conftest.$ac_ext
11526fi 20094fi
11527 20095
20096
11528fi 20097fi
11529 20098
11530if test "x$ac_cv_func_getaddrinfo" = "xyes" && \ 20099if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
11531 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then 20100 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
11532 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo seems to work" >&5 20101 { echo "$as_me:$LINENO: checking if getaddrinfo seems to work" >&5
11533$as_echo_n "checking if getaddrinfo seems to work... " >&6; } 20102echo $ECHO_N "checking if getaddrinfo seems to work... $ECHO_C" >&6; }
11534 if test "$cross_compiling" = yes; then : 20103 if test "$cross_compiling" = yes; then
11535 20104
11536 { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling, assuming no" >&5 20105 { echo "$as_me:$LINENO: result: cross-compiling, assuming no" >&5
11537$as_echo "cross-compiling, assuming no" >&6; } 20106echo "${ECHO_T}cross-compiling, assuming no" >&6; }
11538 20107
11539 20108
11540else 20109else
11541 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 20110 cat >conftest.$ac_ext <<_ACEOF
20111/* confdefs.h. */
20112_ACEOF
20113cat confdefs.h >>conftest.$ac_ext
20114cat >>conftest.$ac_ext <<_ACEOF
11542/* end confdefs.h. */ 20115/* end confdefs.h. */
11543 20116
11544#include <stdio.h> 20117#include <stdio.h>
@@ -11587,32 +20160,138 @@ main ()
11587 return 0; 20160 return 0;
11588} 20161}
11589_ACEOF 20162_ACEOF
11590if ac_fn_c_try_run "$LINENO"; then : 20163rm -f conftest$ac_exeext
20164if { (ac_try="$ac_link"
20165case "(($ac_try" in
20166 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20167 *) ac_try_echo=$ac_try;;
20168esac
20169eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20170 (eval "$ac_link") 2>&5
20171 ac_status=$?
20172 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20173 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
20174 { (case "(($ac_try" in
20175 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20176 *) ac_try_echo=$ac_try;;
20177esac
20178eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20179 (eval "$ac_try") 2>&5
20180 ac_status=$?
20181 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20182 (exit $ac_status); }; }; then
11591 20183
11592 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 20184 { echo "$as_me:$LINENO: result: yes" >&5
11593$as_echo "yes" >&6; } 20185echo "${ECHO_T}yes" >&6; }
11594 20186
11595$as_echo "#define AIX_GETNAMEINFO_HACK 1" >>confdefs.h 20187cat >>confdefs.h <<\_ACEOF
20188#define AIX_GETNAMEINFO_HACK 1
20189_ACEOF
11596 20190
11597 20191
11598else 20192else
20193 echo "$as_me: program exited with status $ac_status" >&5
20194echo "$as_me: failed program was:" >&5
20195sed 's/^/| /' conftest.$ac_ext >&5
11599 20196
11600 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 20197( exit $ac_status )
11601$as_echo "no" >&6; } 20198
11602 $as_echo "#define BROKEN_GETADDRINFO 1" >>confdefs.h 20199 { echo "$as_me:$LINENO: result: no" >&5
20200echo "${ECHO_T}no" >&6; }
20201 cat >>confdefs.h <<\_ACEOF
20202#define BROKEN_GETADDRINFO 1
20203_ACEOF
11603 20204
11604 20205
11605fi 20206fi
11606rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 20207rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
11607 conftest.$ac_objext conftest.beam conftest.$ac_ext
11608fi 20208fi
11609 20209
20210
20211fi
20212
20213if test "x$ac_cv_func_getaddrinfo" = "xyes"; then
20214 { echo "$as_me:$LINENO: checking whether AI_NUMERICSERV is declared" >&5
20215echo $ECHO_N "checking whether AI_NUMERICSERV is declared... $ECHO_C" >&6; }
20216if test "${ac_cv_have_decl_AI_NUMERICSERV+set}" = set; then
20217 echo $ECHO_N "(cached) $ECHO_C" >&6
20218else
20219 cat >conftest.$ac_ext <<_ACEOF
20220/* confdefs.h. */
20221_ACEOF
20222cat confdefs.h >>conftest.$ac_ext
20223cat >>conftest.$ac_ext <<_ACEOF
20224/* end confdefs.h. */
20225#include <sys/types.h>
20226 #include <sys/socket.h>
20227 #include <netdb.h>
20228
20229int
20230main ()
20231{
20232#ifndef AI_NUMERICSERV
20233 (void) AI_NUMERICSERV;
20234#endif
20235
20236 ;
20237 return 0;
20238}
20239_ACEOF
20240rm -f conftest.$ac_objext
20241if { (ac_try="$ac_compile"
20242case "(($ac_try" in
20243 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20244 *) ac_try_echo=$ac_try;;
20245esac
20246eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20247 (eval "$ac_compile") 2>conftest.er1
20248 ac_status=$?
20249 grep -v '^ *+' conftest.er1 >conftest.err
20250 rm -f conftest.er1
20251 cat conftest.err >&5
20252 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20253 (exit $ac_status); } && {
20254 test -z "$ac_c_werror_flag" ||
20255 test ! -s conftest.err
20256 } && test -s conftest.$ac_objext; then
20257 ac_cv_have_decl_AI_NUMERICSERV=yes
20258else
20259 echo "$as_me: failed program was:" >&5
20260sed 's/^/| /' conftest.$ac_ext >&5
20261
20262 ac_cv_have_decl_AI_NUMERICSERV=no
20263fi
20264
20265rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
20266fi
20267{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_AI_NUMERICSERV" >&5
20268echo "${ECHO_T}$ac_cv_have_decl_AI_NUMERICSERV" >&6; }
20269if test $ac_cv_have_decl_AI_NUMERICSERV = yes; then
20270
20271cat >>confdefs.h <<_ACEOF
20272#define HAVE_DECL_AI_NUMERICSERV 1
20273_ACEOF
20274
20275
20276else
20277 cat >>confdefs.h <<_ACEOF
20278#define HAVE_DECL_AI_NUMERICSERV 0
20279_ACEOF
20280
20281
20282fi
20283
20284
11610fi 20285fi
11611 20286
11612if test "x$check_for_conflicting_getspnam" = "x1"; then 20287if test "x$check_for_conflicting_getspnam" = "x1"; then
11613 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for conflicting getspnam in shadow.h" >&5 20288 { echo "$as_me:$LINENO: checking for conflicting getspnam in shadow.h" >&5
11614$as_echo_n "checking for conflicting getspnam in shadow.h... " >&6; } 20289echo $ECHO_N "checking for conflicting getspnam in shadow.h... $ECHO_C" >&6; }
11615 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 20290 cat >conftest.$ac_ext <<_ACEOF
20291/* confdefs.h. */
20292_ACEOF
20293cat confdefs.h >>conftest.$ac_ext
20294cat >>conftest.$ac_ext <<_ACEOF
11616/* end confdefs.h. */ 20295/* end confdefs.h. */
11617 #include <shadow.h> 20296 #include <shadow.h>
11618int 20297int
@@ -11623,31 +20302,57 @@ main ()
11623 return 0; 20302 return 0;
11624} 20303}
11625_ACEOF 20304_ACEOF
11626if ac_fn_c_try_compile "$LINENO"; then : 20305rm -f conftest.$ac_objext
20306if { (ac_try="$ac_compile"
20307case "(($ac_try" in
20308 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20309 *) ac_try_echo=$ac_try;;
20310esac
20311eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20312 (eval "$ac_compile") 2>conftest.er1
20313 ac_status=$?
20314 grep -v '^ *+' conftest.er1 >conftest.err
20315 rm -f conftest.er1
20316 cat conftest.err >&5
20317 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20318 (exit $ac_status); } && {
20319 test -z "$ac_c_werror_flag" ||
20320 test ! -s conftest.err
20321 } && test -s conftest.$ac_objext; then
11627 20322
11628 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 20323 { echo "$as_me:$LINENO: result: no" >&5
11629$as_echo "no" >&6; } 20324echo "${ECHO_T}no" >&6; }
11630 20325
11631else 20326else
20327 echo "$as_me: failed program was:" >&5
20328sed 's/^/| /' conftest.$ac_ext >&5
20329
11632 20330
11633 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 20331 { echo "$as_me:$LINENO: result: yes" >&5
11634$as_echo "yes" >&6; } 20332echo "${ECHO_T}yes" >&6; }
11635 20333
11636$as_echo "#define GETSPNAM_CONFLICTING_DEFS 1" >>confdefs.h 20334cat >>confdefs.h <<\_ACEOF
20335#define GETSPNAM_CONFLICTING_DEFS 1
20336_ACEOF
11637 20337
11638 20338
11639 20339
11640fi 20340fi
20341
11641rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 20342rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11642fi 20343fi
11643 20344
11644{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getpgrp requires zero arguments" >&5 20345{ echo "$as_me:$LINENO: checking whether getpgrp requires zero arguments" >&5
11645$as_echo_n "checking whether getpgrp requires zero arguments... " >&6; } 20346echo $ECHO_N "checking whether getpgrp requires zero arguments... $ECHO_C" >&6; }
11646if ${ac_cv_func_getpgrp_void+:} false; then : 20347if test "${ac_cv_func_getpgrp_void+set}" = set; then
11647 $as_echo_n "(cached) " >&6 20348 echo $ECHO_N "(cached) $ECHO_C" >&6
11648else 20349else
11649 # Use it with a single arg. 20350 # Use it with a single arg.
11650cat confdefs.h - <<_ACEOF >conftest.$ac_ext 20351cat >conftest.$ac_ext <<_ACEOF
20352/* confdefs.h. */
20353_ACEOF
20354cat confdefs.h >>conftest.$ac_ext
20355cat >>conftest.$ac_ext <<_ACEOF
11651/* end confdefs.h. */ 20356/* end confdefs.h. */
11652$ac_includes_default 20357$ac_includes_default
11653int 20358int
@@ -11658,19 +20363,41 @@ getpgrp (0);
11658 return 0; 20363 return 0;
11659} 20364}
11660_ACEOF 20365_ACEOF
11661if ac_fn_c_try_compile "$LINENO"; then : 20366rm -f conftest.$ac_objext
20367if { (ac_try="$ac_compile"
20368case "(($ac_try" in
20369 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20370 *) ac_try_echo=$ac_try;;
20371esac
20372eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20373 (eval "$ac_compile") 2>conftest.er1
20374 ac_status=$?
20375 grep -v '^ *+' conftest.er1 >conftest.err
20376 rm -f conftest.er1
20377 cat conftest.err >&5
20378 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20379 (exit $ac_status); } && {
20380 test -z "$ac_c_werror_flag" ||
20381 test ! -s conftest.err
20382 } && test -s conftest.$ac_objext; then
11662 ac_cv_func_getpgrp_void=no 20383 ac_cv_func_getpgrp_void=no
11663else 20384else
11664 ac_cv_func_getpgrp_void=yes 20385 echo "$as_me: failed program was:" >&5
20386sed 's/^/| /' conftest.$ac_ext >&5
20387
20388 ac_cv_func_getpgrp_void=yes
11665fi 20389fi
20390
11666rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 20391rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11667 20392
11668fi 20393fi
11669{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getpgrp_void" >&5 20394{ echo "$as_me:$LINENO: result: $ac_cv_func_getpgrp_void" >&5
11670$as_echo "$ac_cv_func_getpgrp_void" >&6; } 20395echo "${ECHO_T}$ac_cv_func_getpgrp_void" >&6; }
11671if test $ac_cv_func_getpgrp_void = yes; then 20396if test $ac_cv_func_getpgrp_void = yes; then
11672 20397
11673$as_echo "#define GETPGRP_VOID 1" >>confdefs.h 20398cat >>confdefs.h <<\_ACEOF
20399#define GETPGRP_VOID 1
20400_ACEOF
11674 20401
11675fi 20402fi
11676 20403
@@ -11680,8 +20407,13 @@ saved_CPPFLAGS="$CPPFLAGS"
11680saved_LDFLAGS="$LDFLAGS" 20407saved_LDFLAGS="$LDFLAGS"
11681 20408
11682# Check whether --with-ssl-dir was given. 20409# Check whether --with-ssl-dir was given.
11683if test "${with_ssl_dir+set}" = set; then : 20410if test "${with_ssl_dir+set}" = set; then
11684 withval=$with_ssl_dir; 20411 withval=$with_ssl_dir;
20412 if test "x$openssl" = "xno" ; then
20413 { { echo "$as_me:$LINENO: error: cannot use --with-ssl-dir when OpenSSL disabled" >&5
20414echo "$as_me: error: cannot use --with-ssl-dir when OpenSSL disabled" >&2;}
20415 { (exit 1); exit 1; }; }
20416 fi
11685 if test "x$withval" != "xno" ; then 20417 if test "x$withval" != "xno" ; then
11686 case "$withval" in 20418 case "$withval" in
11687 # Relative paths 20419 # Relative paths
@@ -11716,8 +20448,44 @@ if test "${with_ssl_dir+set}" = set; then :
11716 20448
11717fi 20449fi
11718 20450
11719LIBS="-lcrypto $LIBS" 20451
11720cat confdefs.h - <<_ACEOF >conftest.$ac_ext 20452
20453# Check whether --with-openssl-header-check was given.
20454if test "${with_openssl_header_check+set}" = set; then
20455 withval=$with_openssl_header_check;
20456 if test "x$withval" = "xno" ; then
20457 openssl_check_nonfatal=1
20458 fi
20459
20460
20461fi
20462
20463
20464openssl_engine=no
20465
20466# Check whether --with-ssl-engine was given.
20467if test "${with_ssl_engine+set}" = set; then
20468 withval=$with_ssl_engine;
20469 if test "x$openssl" = "xno" ; then
20470 { { echo "$as_me:$LINENO: error: cannot use --with-ssl-engine when OpenSSL disabled" >&5
20471echo "$as_me: error: cannot use --with-ssl-engine when OpenSSL disabled" >&2;}
20472 { (exit 1); exit 1; }; }
20473 fi
20474 if test "x$withval" != "xno" ; then
20475 openssl_engine=yes
20476 fi
20477
20478
20479fi
20480
20481
20482if test "x$openssl" = "xyes" ; then
20483 LIBS="-lcrypto $LIBS"
20484 cat >conftest.$ac_ext <<_ACEOF
20485/* confdefs.h. */
20486_ACEOF
20487cat confdefs.h >>conftest.$ac_ext
20488cat >>conftest.$ac_ext <<_ACEOF
11721/* end confdefs.h. */ 20489/* end confdefs.h. */
11722 20490
11723/* Override any GCC internal prototype to avoid an error. 20491/* Override any GCC internal prototype to avoid an error.
@@ -11735,27 +20503,184 @@ return RAND_add ();
11735 return 0; 20503 return 0;
11736} 20504}
11737_ACEOF 20505_ACEOF
11738if ac_fn_c_try_link "$LINENO"; then : 20506rm -f conftest.$ac_objext conftest$ac_exeext
20507if { (ac_try="$ac_link"
20508case "(($ac_try" in
20509 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20510 *) ac_try_echo=$ac_try;;
20511esac
20512eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20513 (eval "$ac_link") 2>conftest.er1
20514 ac_status=$?
20515 grep -v '^ *+' conftest.er1 >conftest.err
20516 rm -f conftest.er1
20517 cat conftest.err >&5
20518 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20519 (exit $ac_status); } && {
20520 test -z "$ac_c_werror_flag" ||
20521 test ! -s conftest.err
20522 } && test -s conftest$ac_exeext &&
20523 $as_test_x conftest$ac_exeext; then
11739 20524
11740$as_echo "#define HAVE_OPENSSL 1" >>confdefs.h 20525cat >>confdefs.h <<\_ACEOF
20526#define HAVE_OPENSSL 1
20527_ACEOF
11741 20528
11742else 20529else
20530 echo "$as_me: failed program was:" >&5
20531sed 's/^/| /' conftest.$ac_ext >&5
11743 20532
11744 if test -n "${need_dash_r}"; then
11745 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
11746 else
11747 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
11748 fi
11749 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
11750 ac_fn_c_check_header_mongrel "$LINENO" "openssl/opensslv.h" "ac_cv_header_openssl_opensslv_h" "$ac_includes_default"
11751if test "x$ac_cv_header_openssl_opensslv_h" = xyes; then :
11752 20533
20534 if test -n "${need_dash_r}"; then
20535 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
20536 else
20537 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
20538 fi
20539 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
20540 if test "${ac_cv_header_openssl_opensslv_h+set}" = set; then
20541 { echo "$as_me:$LINENO: checking for openssl/opensslv.h" >&5
20542echo $ECHO_N "checking for openssl/opensslv.h... $ECHO_C" >&6; }
20543if test "${ac_cv_header_openssl_opensslv_h+set}" = set; then
20544 echo $ECHO_N "(cached) $ECHO_C" >&6
20545fi
20546{ echo "$as_me:$LINENO: result: $ac_cv_header_openssl_opensslv_h" >&5
20547echo "${ECHO_T}$ac_cv_header_openssl_opensslv_h" >&6; }
11753else 20548else
11754 as_fn_error $? "*** OpenSSL headers missing - please install first or check config.log ***" "$LINENO" 5 20549 # Is the header compilable?
20550{ echo "$as_me:$LINENO: checking openssl/opensslv.h usability" >&5
20551echo $ECHO_N "checking openssl/opensslv.h usability... $ECHO_C" >&6; }
20552cat >conftest.$ac_ext <<_ACEOF
20553/* confdefs.h. */
20554_ACEOF
20555cat confdefs.h >>conftest.$ac_ext
20556cat >>conftest.$ac_ext <<_ACEOF
20557/* end confdefs.h. */
20558$ac_includes_default
20559#include <openssl/opensslv.h>
20560_ACEOF
20561rm -f conftest.$ac_objext
20562if { (ac_try="$ac_compile"
20563case "(($ac_try" in
20564 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20565 *) ac_try_echo=$ac_try;;
20566esac
20567eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20568 (eval "$ac_compile") 2>conftest.er1
20569 ac_status=$?
20570 grep -v '^ *+' conftest.er1 >conftest.err
20571 rm -f conftest.er1
20572 cat conftest.err >&5
20573 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20574 (exit $ac_status); } && {
20575 test -z "$ac_c_werror_flag" ||
20576 test ! -s conftest.err
20577 } && test -s conftest.$ac_objext; then
20578 ac_header_compiler=yes
20579else
20580 echo "$as_me: failed program was:" >&5
20581sed 's/^/| /' conftest.$ac_ext >&5
20582
20583 ac_header_compiler=no
11755fi 20584fi
11756 20585
20586rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
20587{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
20588echo "${ECHO_T}$ac_header_compiler" >&6; }
11757 20589
11758 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 20590# Is the header present?
20591{ echo "$as_me:$LINENO: checking openssl/opensslv.h presence" >&5
20592echo $ECHO_N "checking openssl/opensslv.h presence... $ECHO_C" >&6; }
20593cat >conftest.$ac_ext <<_ACEOF
20594/* confdefs.h. */
20595_ACEOF
20596cat confdefs.h >>conftest.$ac_ext
20597cat >>conftest.$ac_ext <<_ACEOF
20598/* end confdefs.h. */
20599#include <openssl/opensslv.h>
20600_ACEOF
20601if { (ac_try="$ac_cpp conftest.$ac_ext"
20602case "(($ac_try" in
20603 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20604 *) ac_try_echo=$ac_try;;
20605esac
20606eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20607 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
20608 ac_status=$?
20609 grep -v '^ *+' conftest.er1 >conftest.err
20610 rm -f conftest.er1
20611 cat conftest.err >&5
20612 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20613 (exit $ac_status); } >/dev/null && {
20614 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
20615 test ! -s conftest.err
20616 }; then
20617 ac_header_preproc=yes
20618else
20619 echo "$as_me: failed program was:" >&5
20620sed 's/^/| /' conftest.$ac_ext >&5
20621
20622 ac_header_preproc=no
20623fi
20624
20625rm -f conftest.err conftest.$ac_ext
20626{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
20627echo "${ECHO_T}$ac_header_preproc" >&6; }
20628
20629# So? What about this header?
20630case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
20631 yes:no: )
20632 { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: accepted by the compiler, rejected by the preprocessor!" >&5
20633echo "$as_me: WARNING: openssl/opensslv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
20634 { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: proceeding with the compiler's result" >&5
20635echo "$as_me: WARNING: openssl/opensslv.h: proceeding with the compiler's result" >&2;}
20636 ac_header_preproc=yes
20637 ;;
20638 no:yes:* )
20639 { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: present but cannot be compiled" >&5
20640echo "$as_me: WARNING: openssl/opensslv.h: present but cannot be compiled" >&2;}
20641 { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: check for missing prerequisite headers?" >&5
20642echo "$as_me: WARNING: openssl/opensslv.h: check for missing prerequisite headers?" >&2;}
20643 { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: see the Autoconf documentation" >&5
20644echo "$as_me: WARNING: openssl/opensslv.h: see the Autoconf documentation" >&2;}
20645 { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: section \"Present But Cannot Be Compiled\"" >&5
20646echo "$as_me: WARNING: openssl/opensslv.h: section \"Present But Cannot Be Compiled\"" >&2;}
20647 { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: proceeding with the preprocessor's result" >&5
20648echo "$as_me: WARNING: openssl/opensslv.h: proceeding with the preprocessor's result" >&2;}
20649 { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: in the future, the compiler will take precedence" >&5
20650echo "$as_me: WARNING: openssl/opensslv.h: in the future, the compiler will take precedence" >&2;}
20651 ( cat <<\_ASBOX
20652## ------------------------------------------- ##
20653## Report this to openssh-unix-dev@mindrot.org ##
20654## ------------------------------------------- ##
20655_ASBOX
20656 ) | sed "s/^/$as_me: WARNING: /" >&2
20657 ;;
20658esac
20659{ echo "$as_me:$LINENO: checking for openssl/opensslv.h" >&5
20660echo $ECHO_N "checking for openssl/opensslv.h... $ECHO_C" >&6; }
20661if test "${ac_cv_header_openssl_opensslv_h+set}" = set; then
20662 echo $ECHO_N "(cached) $ECHO_C" >&6
20663else
20664 ac_cv_header_openssl_opensslv_h=$ac_header_preproc
20665fi
20666{ echo "$as_me:$LINENO: result: $ac_cv_header_openssl_opensslv_h" >&5
20667echo "${ECHO_T}$ac_cv_header_openssl_opensslv_h" >&6; }
20668
20669fi
20670if test $ac_cv_header_openssl_opensslv_h = yes; then
20671 :
20672else
20673 { { echo "$as_me:$LINENO: error: *** OpenSSL headers missing - please install first or check config.log ***" >&5
20674echo "$as_me: error: *** OpenSSL headers missing - please install first or check config.log ***" >&2;}
20675 { (exit 1); exit 1; }; }
20676fi
20677
20678
20679 cat >conftest.$ac_ext <<_ACEOF
20680/* confdefs.h. */
20681_ACEOF
20682cat confdefs.h >>conftest.$ac_ext
20683cat >>conftest.$ac_ext <<_ACEOF
11759/* end confdefs.h. */ 20684/* end confdefs.h. */
11760 20685
11761/* Override any GCC internal prototype to avoid an error. 20686/* Override any GCC internal prototype to avoid an error.
@@ -11773,227 +20698,331 @@ return RAND_add ();
11773 return 0; 20698 return 0;
11774} 20699}
11775_ACEOF 20700_ACEOF
11776if ac_fn_c_try_link "$LINENO"; then : 20701rm -f conftest.$ac_objext conftest$ac_exeext
11777 $as_echo "#define HAVE_OPENSSL 1" >>confdefs.h 20702if { (ac_try="$ac_link"
20703case "(($ac_try" in
20704 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20705 *) ac_try_echo=$ac_try;;
20706esac
20707eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20708 (eval "$ac_link") 2>conftest.er1
20709 ac_status=$?
20710 grep -v '^ *+' conftest.er1 >conftest.err
20711 rm -f conftest.er1
20712 cat conftest.err >&5
20713 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20714 (exit $ac_status); } && {
20715 test -z "$ac_c_werror_flag" ||
20716 test ! -s conftest.err
20717 } && test -s conftest$ac_exeext &&
20718 $as_test_x conftest$ac_exeext; then
20719 cat >>confdefs.h <<\_ACEOF
20720#define HAVE_OPENSSL 1
20721_ACEOF
11778 20722
11779else 20723else
20724 echo "$as_me: failed program was:" >&5
20725sed 's/^/| /' conftest.$ac_ext >&5
20726
11780 20727
11781 as_fn_error $? "*** Can't find recent OpenSSL libcrypto (see config.log for details) ***" "$LINENO" 5 20728 { { echo "$as_me:$LINENO: error: *** Can't find recent OpenSSL libcrypto (see config.log for details) ***" >&5
20729echo "$as_me: error: *** Can't find recent OpenSSL libcrypto (see config.log for details) ***" >&2;}
20730 { (exit 1); exit 1; }; }
11782 20731
11783 20732
11784fi 20733fi
11785rm -f core conftest.err conftest.$ac_objext \ 20734
11786 conftest$ac_exeext conftest.$ac_ext 20735rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
20736 conftest$ac_exeext conftest.$ac_ext
11787 20737
11788 20738
11789fi 20739fi
11790rm -f core conftest.err conftest.$ac_objext \
11791 conftest$ac_exeext conftest.$ac_ext
11792 20740
11793# Determine OpenSSL header version 20741rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11794{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL header version" >&5 20742 conftest$ac_exeext conftest.$ac_ext
11795$as_echo_n "checking OpenSSL header version... " >&6; }
11796if test "$cross_compiling" = yes; then :
11797 20743
11798 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking" >&5 20744 # Determine OpenSSL header version
11799$as_echo "$as_me: WARNING: cross compiling: not checking" >&2;} 20745 { echo "$as_me:$LINENO: checking OpenSSL header version" >&5
20746echo $ECHO_N "checking OpenSSL header version... $ECHO_C" >&6; }
20747 if test "$cross_compiling" = yes; then
20748
20749 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking" >&5
20750echo "$as_me: WARNING: cross compiling: not checking" >&2;}
11800 20751
11801 20752
11802else 20753else
11803 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 20754 cat >conftest.$ac_ext <<_ACEOF
20755/* confdefs.h. */
20756_ACEOF
20757cat confdefs.h >>conftest.$ac_ext
20758cat >>conftest.$ac_ext <<_ACEOF
11804/* end confdefs.h. */ 20759/* end confdefs.h. */
11805 20760
11806#include <stdio.h> 20761 #include <stdio.h>
11807#include <string.h> 20762 #include <string.h>
11808#include <openssl/opensslv.h> 20763 #include <openssl/opensslv.h>
11809#define DATA "conftest.sslincver" 20764 #define DATA "conftest.sslincver"
11810 20765
11811int 20766int
11812main () 20767main ()
11813{ 20768{
11814 20769
11815 FILE *fd; 20770 FILE *fd;
11816 int rc; 20771 int rc;
11817 20772
11818 fd = fopen(DATA,"w"); 20773 fd = fopen(DATA,"w");
11819 if(fd == NULL) 20774 if(fd == NULL)
11820 exit(1); 20775 exit(1);
11821 20776
11822 if ((rc = fprintf(fd ,"%08x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0) 20777 if ((rc = fprintf(fd ,"%08x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
11823 exit(1); 20778 exit(1);
11824 20779
11825 exit(0); 20780 exit(0);
11826 20781
11827 ; 20782 ;
11828 return 0; 20783 return 0;
11829} 20784}
11830_ACEOF 20785_ACEOF
11831if ac_fn_c_try_run "$LINENO"; then : 20786rm -f conftest$ac_exeext
20787if { (ac_try="$ac_link"
20788case "(($ac_try" in
20789 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20790 *) ac_try_echo=$ac_try;;
20791esac
20792eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20793 (eval "$ac_link") 2>&5
20794 ac_status=$?
20795 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20796 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
20797 { (case "(($ac_try" in
20798 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20799 *) ac_try_echo=$ac_try;;
20800esac
20801eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20802 (eval "$ac_try") 2>&5
20803 ac_status=$?
20804 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20805 (exit $ac_status); }; }; then
11832 20806
11833 ssl_header_ver=`cat conftest.sslincver` 20807 ssl_header_ver=`cat conftest.sslincver`
11834 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ssl_header_ver" >&5 20808 { echo "$as_me:$LINENO: result: $ssl_header_ver" >&5
11835$as_echo "$ssl_header_ver" >&6; } 20809echo "${ECHO_T}$ssl_header_ver" >&6; }
11836 20810
11837else 20811else
20812 echo "$as_me: program exited with status $ac_status" >&5
20813echo "$as_me: failed program was:" >&5
20814sed 's/^/| /' conftest.$ac_ext >&5
20815
20816( exit $ac_status )
11838 20817
11839 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 20818 { echo "$as_me:$LINENO: result: not found" >&5
11840$as_echo "not found" >&6; } 20819echo "${ECHO_T}not found" >&6; }
11841 as_fn_error $? "OpenSSL version header not found." "$LINENO" 5 20820 { { echo "$as_me:$LINENO: error: OpenSSL version header not found." >&5
20821echo "$as_me: error: OpenSSL version header not found." >&2;}
20822 { (exit 1); exit 1; }; }
11842 20823
11843fi 20824fi
11844rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 20825rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
11845 conftest.$ac_objext conftest.beam conftest.$ac_ext
11846fi 20826fi
11847 20827
11848 20828
11849# Determine OpenSSL library version
11850{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL library version" >&5
11851$as_echo_n "checking OpenSSL library version... " >&6; }
11852if test "$cross_compiling" = yes; then :
11853 20829
11854 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking" >&5 20830 # Determine OpenSSL library version
11855$as_echo "$as_me: WARNING: cross compiling: not checking" >&2;} 20831 { echo "$as_me:$LINENO: checking OpenSSL library version" >&5
20832echo $ECHO_N "checking OpenSSL library version... $ECHO_C" >&6; }
20833 if test "$cross_compiling" = yes; then
20834
20835 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking" >&5
20836echo "$as_me: WARNING: cross compiling: not checking" >&2;}
11856 20837
11857 20838
11858else 20839else
11859 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 20840 cat >conftest.$ac_ext <<_ACEOF
20841/* confdefs.h. */
20842_ACEOF
20843cat confdefs.h >>conftest.$ac_ext
20844cat >>conftest.$ac_ext <<_ACEOF
11860/* end confdefs.h. */ 20845/* end confdefs.h. */
11861 20846
11862#include <stdio.h> 20847 #include <stdio.h>
11863#include <string.h> 20848 #include <string.h>
11864#include <openssl/opensslv.h> 20849 #include <openssl/opensslv.h>
11865#include <openssl/crypto.h> 20850 #include <openssl/crypto.h>
11866#define DATA "conftest.ssllibver" 20851 #define DATA "conftest.ssllibver"
11867 20852
11868int 20853int
11869main () 20854main ()
11870{ 20855{
11871 20856
11872 FILE *fd; 20857 FILE *fd;
11873 int rc; 20858 int rc;
11874 20859
11875 fd = fopen(DATA,"w"); 20860 fd = fopen(DATA,"w");
11876 if(fd == NULL) 20861 if(fd == NULL)
11877 exit(1); 20862 exit(1);
11878 20863
11879 if ((rc = fprintf(fd ,"%08x (%s)\n", SSLeay(), 20864 if ((rc = fprintf(fd ,"%08x (%s)\n", SSLeay(),
11880 SSLeay_version(SSLEAY_VERSION))) <0) 20865 SSLeay_version(SSLEAY_VERSION))) <0)
11881 exit(1); 20866 exit(1);
11882 20867
11883 exit(0); 20868 exit(0);
11884 20869
11885 ; 20870 ;
11886 return 0; 20871 return 0;
11887} 20872}
11888_ACEOF 20873_ACEOF
11889if ac_fn_c_try_run "$LINENO"; then : 20874rm -f conftest$ac_exeext
11890 20875if { (ac_try="$ac_link"
11891 ssl_library_ver=`cat conftest.ssllibver` 20876case "(($ac_try" in
11892 # Check version is supported. 20877 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11893 case "$ssl_library_ver" in 20878 *) ac_try_echo=$ac_try;;
11894 0090[0-7]*|009080[0-5]*) 20879esac
11895 as_fn_error $? "OpenSSL >= 0.9.8f required" "$LINENO" 5 20880eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11896 ;; 20881 (eval "$ac_link") 2>&5
11897 *) ;; 20882 ac_status=$?
11898 esac 20883 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11899 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ssl_library_ver" >&5 20884 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
11900$as_echo "$ssl_library_ver" >&6; } 20885 { (case "(($ac_try" in
20886 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20887 *) ac_try_echo=$ac_try;;
20888esac
20889eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20890 (eval "$ac_try") 2>&5
20891 ac_status=$?
20892 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20893 (exit $ac_status); }; }; then
20894
20895 ssl_library_ver=`cat conftest.ssllibver`
20896 # Check version is supported.
20897 case "$ssl_library_ver" in
20898 0090[0-7]*|009080[0-5]*)
20899 { { echo "$as_me:$LINENO: error: OpenSSL >= 0.9.8f required (have \"$ssl_library_ver\")" >&5
20900echo "$as_me: error: OpenSSL >= 0.9.8f required (have \"$ssl_library_ver\")" >&2;}
20901 { (exit 1); exit 1; }; }
20902 ;;
20903 *) ;;
20904 esac
20905 { echo "$as_me:$LINENO: result: $ssl_library_ver" >&5
20906echo "${ECHO_T}$ssl_library_ver" >&6; }
11901 20907
11902else 20908else
20909 echo "$as_me: program exited with status $ac_status" >&5
20910echo "$as_me: failed program was:" >&5
20911sed 's/^/| /' conftest.$ac_ext >&5
11903 20912
11904 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 20913( exit $ac_status )
11905$as_echo "not found" >&6; } 20914
11906 as_fn_error $? "OpenSSL library not found." "$LINENO" 5 20915 { echo "$as_me:$LINENO: result: not found" >&5
20916echo "${ECHO_T}not found" >&6; }
20917 { { echo "$as_me:$LINENO: error: OpenSSL library not found." >&5
20918echo "$as_me: error: OpenSSL library not found." >&2;}
20919 { (exit 1); exit 1; }; }
11907 20920
11908fi 20921fi
11909rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 20922rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
11910 conftest.$ac_objext conftest.beam conftest.$ac_ext
11911fi 20923fi
11912 20924
11913 20925
11914# XXX make --without-openssl work
11915
11916cat >>confdefs.h <<_ACEOF
11917#define WITH_OPENSSL 1
11918_ACEOF
11919 20926
20927 # Sanity check OpenSSL headers
20928 { echo "$as_me:$LINENO: checking whether OpenSSL's headers match the library" >&5
20929echo $ECHO_N "checking whether OpenSSL's headers match the library... $ECHO_C" >&6; }
20930 if test "$cross_compiling" = yes; then
11920 20931
11921cat >>confdefs.h <<_ACEOF 20932 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking" >&5
11922#define WITH_SSH1 1 20933echo "$as_me: WARNING: cross compiling: not checking" >&2;}
11923_ACEOF
11924
11925
11926
11927# Check whether --with-openssl-header-check was given.
11928if test "${with_openssl_header_check+set}" = set; then :
11929 withval=$with_openssl_header_check; if test "x$withval" = "xno" ; then
11930 openssl_check_nonfatal=1
11931 fi
11932
11933
11934fi
11935
11936
11937# Sanity check OpenSSL headers
11938{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL's headers match the library" >&5
11939$as_echo_n "checking whether OpenSSL's headers match the library... " >&6; }
11940if test "$cross_compiling" = yes; then :
11941
11942 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking" >&5
11943$as_echo "$as_me: WARNING: cross compiling: not checking" >&2;}
11944 20934
11945 20935
11946else 20936else
11947 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 20937 cat >conftest.$ac_ext <<_ACEOF
20938/* confdefs.h. */
20939_ACEOF
20940cat confdefs.h >>conftest.$ac_ext
20941cat >>conftest.$ac_ext <<_ACEOF
11948/* end confdefs.h. */ 20942/* end confdefs.h. */
11949 20943
11950#include <string.h> 20944 #include <string.h>
11951#include <openssl/opensslv.h> 20945 #include <openssl/opensslv.h>
11952 20946
11953int 20947int
11954main () 20948main ()
11955{ 20949{
11956 20950
11957 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); 20951 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
11958 20952
11959 ; 20953 ;
11960 return 0; 20954 return 0;
11961} 20955}
11962_ACEOF 20956_ACEOF
11963if ac_fn_c_try_run "$LINENO"; then : 20957rm -f conftest$ac_exeext
20958if { (ac_try="$ac_link"
20959case "(($ac_try" in
20960 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20961 *) ac_try_echo=$ac_try;;
20962esac
20963eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20964 (eval "$ac_link") 2>&5
20965 ac_status=$?
20966 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20967 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
20968 { (case "(($ac_try" in
20969 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20970 *) ac_try_echo=$ac_try;;
20971esac
20972eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20973 (eval "$ac_try") 2>&5
20974 ac_status=$?
20975 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20976 (exit $ac_status); }; }; then
11964 20977
11965 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 20978 { echo "$as_me:$LINENO: result: yes" >&5
11966$as_echo "yes" >&6; } 20979echo "${ECHO_T}yes" >&6; }
11967 20980
11968else 20981else
20982 echo "$as_me: program exited with status $ac_status" >&5
20983echo "$as_me: failed program was:" >&5
20984sed 's/^/| /' conftest.$ac_ext >&5
11969 20985
11970 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 20986( exit $ac_status )
11971$as_echo "no" >&6; } 20987
11972 if test "x$openssl_check_nonfatal" = "x"; then 20988 { echo "$as_me:$LINENO: result: no" >&5
11973 as_fn_error $? "Your OpenSSL headers do not match your 20989echo "${ECHO_T}no" >&6; }
11974library. Check config.log for details. 20990 if test "x$openssl_check_nonfatal" = "x"; then
11975If you are sure your installation is consistent, you can disable the check 20991 { { echo "$as_me:$LINENO: error: Your OpenSSL headers do not match your
11976by running \"./configure --without-openssl-header-check\". 20992 library. Check config.log for details.
11977Also see contrib/findssl.sh for help identifying header/library mismatches. 20993 If you are sure your installation is consistent, you can disable the check
11978" "$LINENO" 5 20994 by running \"./configure --without-openssl-header-check\".
11979 else 20995 Also see contrib/findssl.sh for help identifying header/library mismatches.
11980 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Your OpenSSL headers do not match your 20996 " >&5
11981library. Check config.log for details. 20997echo "$as_me: error: Your OpenSSL headers do not match your
11982Also see contrib/findssl.sh for help identifying header/library mismatches." >&5 20998 library. Check config.log for details.
11983$as_echo "$as_me: WARNING: Your OpenSSL headers do not match your 20999 If you are sure your installation is consistent, you can disable the check
11984library. Check config.log for details. 21000 by running \"./configure --without-openssl-header-check\".
11985Also see contrib/findssl.sh for help identifying header/library mismatches." >&2;} 21001 Also see contrib/findssl.sh for help identifying header/library mismatches.
11986 fi 21002 " >&2;}
21003 { (exit 1); exit 1; }; }
21004 else
21005 { echo "$as_me:$LINENO: WARNING: Your OpenSSL headers do not match your
21006 library. Check config.log for details.
21007 Also see contrib/findssl.sh for help identifying header/library mismatches." >&5
21008echo "$as_me: WARNING: Your OpenSSL headers do not match your
21009 library. Check config.log for details.
21010 Also see contrib/findssl.sh for help identifying header/library mismatches." >&2;}
21011 fi
11987 21012
11988fi 21013fi
11989rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 21014rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
11990 conftest.$ac_objext conftest.beam conftest.$ac_ext
11991fi 21015fi
11992 21016
11993 21017
11994{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if programs using OpenSSL functions will link" >&5 21018
11995$as_echo_n "checking if programs using OpenSSL functions will link... " >&6; } 21019 { echo "$as_me:$LINENO: checking if programs using OpenSSL functions will link" >&5
11996cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21020echo $ECHO_N "checking if programs using OpenSSL functions will link... $ECHO_C" >&6; }
21021 cat >conftest.$ac_ext <<_ACEOF
21022/* confdefs.h. */
21023_ACEOF
21024cat confdefs.h >>conftest.$ac_ext
21025cat >>conftest.$ac_ext <<_ACEOF
11997/* end confdefs.h. */ 21026/* end confdefs.h. */
11998 #include <openssl/evp.h> 21027 #include <openssl/evp.h>
11999int 21028int
@@ -12004,20 +21033,44 @@ main ()
12004 return 0; 21033 return 0;
12005} 21034}
12006_ACEOF 21035_ACEOF
12007if ac_fn_c_try_link "$LINENO"; then : 21036rm -f conftest.$ac_objext conftest$ac_exeext
21037if { (ac_try="$ac_link"
21038case "(($ac_try" in
21039 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21040 *) ac_try_echo=$ac_try;;
21041esac
21042eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21043 (eval "$ac_link") 2>conftest.er1
21044 ac_status=$?
21045 grep -v '^ *+' conftest.er1 >conftest.err
21046 rm -f conftest.er1
21047 cat conftest.err >&5
21048 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21049 (exit $ac_status); } && {
21050 test -z "$ac_c_werror_flag" ||
21051 test ! -s conftest.err
21052 } && test -s conftest$ac_exeext &&
21053 $as_test_x conftest$ac_exeext; then
12008 21054
12009 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21055 { echo "$as_me:$LINENO: result: yes" >&5
12010$as_echo "yes" >&6; } 21056echo "${ECHO_T}yes" >&6; }
12011 21057
12012else 21058else
21059 echo "$as_me: failed program was:" >&5
21060sed 's/^/| /' conftest.$ac_ext >&5
12013 21061
12014 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21062
12015$as_echo "no" >&6; } 21063 { echo "$as_me:$LINENO: result: no" >&5
12016 saved_LIBS="$LIBS" 21064echo "${ECHO_T}no" >&6; }
12017 LIBS="$LIBS -ldl" 21065 saved_LIBS="$LIBS"
12018 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if programs using OpenSSL need -ldl" >&5 21066 LIBS="$LIBS -ldl"
12019$as_echo_n "checking if programs using OpenSSL need -ldl... " >&6; } 21067 { echo "$as_me:$LINENO: checking if programs using OpenSSL need -ldl" >&5
12020 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21068echo $ECHO_N "checking if programs using OpenSSL need -ldl... $ECHO_C" >&6; }
21069 cat >conftest.$ac_ext <<_ACEOF
21070/* confdefs.h. */
21071_ACEOF
21072cat confdefs.h >>conftest.$ac_ext
21073cat >>conftest.$ac_ext <<_ACEOF
12021/* end confdefs.h. */ 21074/* end confdefs.h. */
12022 #include <openssl/evp.h> 21075 #include <openssl/evp.h>
12023int 21076int
@@ -12028,218 +21081,438 @@ main ()
12028 return 0; 21081 return 0;
12029} 21082}
12030_ACEOF 21083_ACEOF
12031if ac_fn_c_try_link "$LINENO"; then : 21084rm -f conftest.$ac_objext conftest$ac_exeext
21085if { (ac_try="$ac_link"
21086case "(($ac_try" in
21087 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21088 *) ac_try_echo=$ac_try;;
21089esac
21090eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21091 (eval "$ac_link") 2>conftest.er1
21092 ac_status=$?
21093 grep -v '^ *+' conftest.er1 >conftest.err
21094 rm -f conftest.er1
21095 cat conftest.err >&5
21096 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21097 (exit $ac_status); } && {
21098 test -z "$ac_c_werror_flag" ||
21099 test ! -s conftest.err
21100 } && test -s conftest$ac_exeext &&
21101 $as_test_x conftest$ac_exeext; then
12032 21102
12033 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21103 { echo "$as_me:$LINENO: result: yes" >&5
12034$as_echo "yes" >&6; } 21104echo "${ECHO_T}yes" >&6; }
12035 21105
12036else 21106else
21107 echo "$as_me: failed program was:" >&5
21108sed 's/^/| /' conftest.$ac_ext >&5
12037 21109
12038 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21110
12039$as_echo "no" >&6; } 21111 { echo "$as_me:$LINENO: result: no" >&5
12040 LIBS="$saved_LIBS" 21112echo "${ECHO_T}no" >&6; }
21113 LIBS="$saved_LIBS"
12041 21114
12042 21115
12043fi 21116fi
12044rm -f core conftest.err conftest.$ac_objext \ 21117
12045 conftest$ac_exeext conftest.$ac_ext 21118rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
21119 conftest$ac_exeext conftest.$ac_ext
12046 21120
12047 21121
12048fi 21122fi
12049rm -f core conftest.err conftest.$ac_objext \ 21123
12050 conftest$ac_exeext conftest.$ac_ext 21124rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
21125 conftest$ac_exeext conftest.$ac_ext
21126
21127
21128
21129
21130
21131
21132
21133
21134
21135
12051 21136
12052for ac_func in \ 21137for ac_func in \
12053 BN_is_prime_ex \ 21138 BN_is_prime_ex \
12054 DSA_generate_parameters_ex \ 21139 DSA_generate_parameters_ex \
12055 EVP_DigestInit_ex \ 21140 EVP_DigestInit_ex \
12056 EVP_DigestFinal_ex \ 21141 EVP_DigestFinal_ex \
12057 EVP_MD_CTX_init \ 21142 EVP_MD_CTX_init \
12058 EVP_MD_CTX_cleanup \ 21143 EVP_MD_CTX_cleanup \
12059 EVP_MD_CTX_copy_ex \ 21144 EVP_MD_CTX_copy_ex \
12060 HMAC_CTX_init \ 21145 HMAC_CTX_init \
12061 RSA_generate_key_ex \ 21146 RSA_generate_key_ex \
12062 RSA_get_default_method \ 21147 RSA_get_default_method \
12063 21148
12064do : 21149do
12065 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 21150as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
12066ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 21151{ echo "$as_me:$LINENO: checking for $ac_func" >&5
12067if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 21152echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
21153if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
21154 echo $ECHO_N "(cached) $ECHO_C" >&6
21155else
21156 cat >conftest.$ac_ext <<_ACEOF
21157/* confdefs.h. */
21158_ACEOF
21159cat confdefs.h >>conftest.$ac_ext
21160cat >>conftest.$ac_ext <<_ACEOF
21161/* end confdefs.h. */
21162/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
21163 For example, HP-UX 11i <limits.h> declares gettimeofday. */
21164#define $ac_func innocuous_$ac_func
21165
21166/* System header to define __stub macros and hopefully few prototypes,
21167 which can conflict with char $ac_func (); below.
21168 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
21169 <limits.h> exists even on freestanding compilers. */
21170
21171#ifdef __STDC__
21172# include <limits.h>
21173#else
21174# include <assert.h>
21175#endif
21176
21177#undef $ac_func
21178
21179/* Override any GCC internal prototype to avoid an error.
21180 Use char because int might match the return type of a GCC
21181 builtin and then its argument prototype would still apply. */
21182#ifdef __cplusplus
21183extern "C"
21184#endif
21185char $ac_func ();
21186/* The GNU C library defines this for functions which it implements
21187 to always fail with ENOSYS. Some functions are actually named
21188 something starting with __ and the normal name is an alias. */
21189#if defined __stub_$ac_func || defined __stub___$ac_func
21190choke me
21191#endif
21192
21193int
21194main ()
21195{
21196return $ac_func ();
21197 ;
21198 return 0;
21199}
21200_ACEOF
21201rm -f conftest.$ac_objext conftest$ac_exeext
21202if { (ac_try="$ac_link"
21203case "(($ac_try" in
21204 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21205 *) ac_try_echo=$ac_try;;
21206esac
21207eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21208 (eval "$ac_link") 2>conftest.er1
21209 ac_status=$?
21210 grep -v '^ *+' conftest.er1 >conftest.err
21211 rm -f conftest.er1
21212 cat conftest.err >&5
21213 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21214 (exit $ac_status); } && {
21215 test -z "$ac_c_werror_flag" ||
21216 test ! -s conftest.err
21217 } && test -s conftest$ac_exeext &&
21218 $as_test_x conftest$ac_exeext; then
21219 eval "$as_ac_var=yes"
21220else
21221 echo "$as_me: failed program was:" >&5
21222sed 's/^/| /' conftest.$ac_ext >&5
21223
21224 eval "$as_ac_var=no"
21225fi
21226
21227rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
21228 conftest$ac_exeext conftest.$ac_ext
21229fi
21230ac_res=`eval echo '${'$as_ac_var'}'`
21231 { echo "$as_me:$LINENO: result: $ac_res" >&5
21232echo "${ECHO_T}$ac_res" >&6; }
21233if test `eval echo '${'$as_ac_var'}'` = yes; then
12068 cat >>confdefs.h <<_ACEOF 21234 cat >>confdefs.h <<_ACEOF
12069#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 21235#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12070_ACEOF 21236_ACEOF
12071 21237
12072fi 21238fi
12073done 21239done
12074 21240
12075 21241
12076 21242 if test "x$openssl_engine" = "xyes" ; then
12077# Check whether --with-ssl-engine was given. 21243 { echo "$as_me:$LINENO: checking for OpenSSL ENGINE support" >&5
12078if test "${with_ssl_engine+set}" = set; then : 21244echo $ECHO_N "checking for OpenSSL ENGINE support... $ECHO_C" >&6; }
12079 withval=$with_ssl_engine; if test "x$withval" != "xno" ; then 21245 cat >conftest.$ac_ext <<_ACEOF
12080 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL ENGINE support" >&5 21246/* confdefs.h. */
12081$as_echo_n "checking for OpenSSL ENGINE support... " >&6; } 21247_ACEOF
12082 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21248cat confdefs.h >>conftest.$ac_ext
21249cat >>conftest.$ac_ext <<_ACEOF
12083/* end confdefs.h. */ 21250/* end confdefs.h. */
12084 21251
12085#include <openssl/engine.h> 21252 #include <openssl/engine.h>
12086 21253
12087int 21254int
12088main () 21255main ()
12089{ 21256{
12090 21257
12091 ENGINE_load_builtin_engines(); 21258 ENGINE_load_builtin_engines();
12092 ENGINE_register_all_complete(); 21259 ENGINE_register_all_complete();
12093 21260
12094 ; 21261 ;
12095 return 0; 21262 return 0;
12096} 21263}
12097_ACEOF 21264_ACEOF
12098if ac_fn_c_try_compile "$LINENO"; then : 21265rm -f conftest.$ac_objext
12099 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21266if { (ac_try="$ac_compile"
12100$as_echo "yes" >&6; } 21267case "(($ac_try" in
21268 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21269 *) ac_try_echo=$ac_try;;
21270esac
21271eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21272 (eval "$ac_compile") 2>conftest.er1
21273 ac_status=$?
21274 grep -v '^ *+' conftest.er1 >conftest.err
21275 rm -f conftest.er1
21276 cat conftest.err >&5
21277 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21278 (exit $ac_status); } && {
21279 test -z "$ac_c_werror_flag" ||
21280 test ! -s conftest.err
21281 } && test -s conftest.$ac_objext; then
21282 { echo "$as_me:$LINENO: result: yes" >&5
21283echo "${ECHO_T}yes" >&6; }
12101 21284
12102$as_echo "#define USE_OPENSSL_ENGINE 1" >>confdefs.h 21285cat >>confdefs.h <<\_ACEOF
21286#define USE_OPENSSL_ENGINE 1
21287_ACEOF
12103 21288
12104 21289
12105else 21290else
12106 as_fn_error $? "OpenSSL ENGINE support not found" "$LINENO" 5 21291 echo "$as_me: failed program was:" >&5
21292sed 's/^/| /' conftest.$ac_ext >&5
12107 21293
12108fi 21294 { { echo "$as_me:$LINENO: error: OpenSSL ENGINE support not found" >&5
12109rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 21295echo "$as_me: error: OpenSSL ENGINE support not found" >&2;}
12110 fi 21296 { (exit 1); exit 1; }; }
12111 21297
12112fi 21298fi
12113 21299
21300rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
21301 fi
12114 21302
12115# Check for OpenSSL without EVP_aes_{192,256}_cbc 21303 # Check for OpenSSL without EVP_aes_{192,256}_cbc
12116{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL has crippled AES support" >&5 21304 { echo "$as_me:$LINENO: checking whether OpenSSL has crippled AES support" >&5
12117$as_echo_n "checking whether OpenSSL has crippled AES support... " >&6; } 21305echo $ECHO_N "checking whether OpenSSL has crippled AES support... $ECHO_C" >&6; }
12118cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21306 cat >conftest.$ac_ext <<_ACEOF
21307/* confdefs.h. */
21308_ACEOF
21309cat confdefs.h >>conftest.$ac_ext
21310cat >>conftest.$ac_ext <<_ACEOF
12119/* end confdefs.h. */ 21311/* end confdefs.h. */
12120 21312
12121#include <string.h> 21313 #include <string.h>
12122#include <openssl/evp.h> 21314 #include <openssl/evp.h>
12123 21315
12124int 21316int
12125main () 21317main ()
12126{ 21318{
12127 21319
12128 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL); 21320 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
12129 21321
12130 ; 21322 ;
12131 return 0; 21323 return 0;
12132} 21324}
12133_ACEOF 21325_ACEOF
12134if ac_fn_c_try_link "$LINENO"; then : 21326rm -f conftest.$ac_objext conftest$ac_exeext
21327if { (ac_try="$ac_link"
21328case "(($ac_try" in
21329 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21330 *) ac_try_echo=$ac_try;;
21331esac
21332eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21333 (eval "$ac_link") 2>conftest.er1
21334 ac_status=$?
21335 grep -v '^ *+' conftest.er1 >conftest.err
21336 rm -f conftest.er1
21337 cat conftest.err >&5
21338 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21339 (exit $ac_status); } && {
21340 test -z "$ac_c_werror_flag" ||
21341 test ! -s conftest.err
21342 } && test -s conftest$ac_exeext &&
21343 $as_test_x conftest$ac_exeext; then
12135 21344
12136 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21345 { echo "$as_me:$LINENO: result: no" >&5
12137$as_echo "no" >&6; } 21346echo "${ECHO_T}no" >&6; }
12138 21347
12139else 21348else
21349 echo "$as_me: failed program was:" >&5
21350sed 's/^/| /' conftest.$ac_ext >&5
12140 21351
12141 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
12142$as_echo "yes" >&6; }
12143 21352
12144$as_echo "#define OPENSSL_LOBOTOMISED_AES 1" >>confdefs.h 21353 { echo "$as_me:$LINENO: result: yes" >&5
21354echo "${ECHO_T}yes" >&6; }
21355
21356cat >>confdefs.h <<\_ACEOF
21357#define OPENSSL_LOBOTOMISED_AES 1
21358_ACEOF
12145 21359
12146 21360
12147 21361
12148fi 21362fi
12149rm -f core conftest.err conftest.$ac_objext \
12150 conftest$ac_exeext conftest.$ac_ext
12151 21363
12152# Check for OpenSSL with EVP_aes_*ctr 21364rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12153{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL has AES CTR via EVP" >&5 21365 conftest$ac_exeext conftest.$ac_ext
12154$as_echo_n "checking whether OpenSSL has AES CTR via EVP... " >&6; } 21366
12155cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21367 # Check for OpenSSL with EVP_aes_*ctr
21368 { echo "$as_me:$LINENO: checking whether OpenSSL has AES CTR via EVP" >&5
21369echo $ECHO_N "checking whether OpenSSL has AES CTR via EVP... $ECHO_C" >&6; }
21370 cat >conftest.$ac_ext <<_ACEOF
21371/* confdefs.h. */
21372_ACEOF
21373cat confdefs.h >>conftest.$ac_ext
21374cat >>conftest.$ac_ext <<_ACEOF
12156/* end confdefs.h. */ 21375/* end confdefs.h. */
12157 21376
12158#include <string.h> 21377 #include <string.h>
12159#include <openssl/evp.h> 21378 #include <openssl/evp.h>
12160 21379
12161int 21380int
12162main () 21381main ()
12163{ 21382{
12164 21383
12165 exit(EVP_aes_128_ctr() == NULL || 21384 exit(EVP_aes_128_ctr() == NULL ||
12166 EVP_aes_192_cbc() == NULL || 21385 EVP_aes_192_cbc() == NULL ||
12167 EVP_aes_256_cbc() == NULL); 21386 EVP_aes_256_cbc() == NULL);
12168 21387
12169 ; 21388 ;
12170 return 0; 21389 return 0;
12171} 21390}
12172_ACEOF 21391_ACEOF
12173if ac_fn_c_try_link "$LINENO"; then : 21392rm -f conftest.$ac_objext conftest$ac_exeext
21393if { (ac_try="$ac_link"
21394case "(($ac_try" in
21395 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21396 *) ac_try_echo=$ac_try;;
21397esac
21398eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21399 (eval "$ac_link") 2>conftest.er1
21400 ac_status=$?
21401 grep -v '^ *+' conftest.er1 >conftest.err
21402 rm -f conftest.er1
21403 cat conftest.err >&5
21404 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21405 (exit $ac_status); } && {
21406 test -z "$ac_c_werror_flag" ||
21407 test ! -s conftest.err
21408 } && test -s conftest$ac_exeext &&
21409 $as_test_x conftest$ac_exeext; then
12174 21410
12175 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21411 { echo "$as_me:$LINENO: result: yes" >&5
12176$as_echo "yes" >&6; } 21412echo "${ECHO_T}yes" >&6; }
12177 21413
12178$as_echo "#define OPENSSL_HAVE_EVPCTR 1" >>confdefs.h 21414cat >>confdefs.h <<\_ACEOF
21415#define OPENSSL_HAVE_EVPCTR 1
21416_ACEOF
12179 21417
12180 21418
12181else 21419else
21420 echo "$as_me: failed program was:" >&5
21421sed 's/^/| /' conftest.$ac_ext >&5
12182 21422
12183 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21423
12184$as_echo "no" >&6; } 21424 { echo "$as_me:$LINENO: result: no" >&5
21425echo "${ECHO_T}no" >&6; }
12185 21426
12186 21427
12187fi 21428fi
12188rm -f core conftest.err conftest.$ac_objext \
12189 conftest$ac_exeext conftest.$ac_ext
12190 21429
12191# Check for OpenSSL with EVP_aes_*gcm 21430rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12192{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL has AES GCM via EVP" >&5 21431 conftest$ac_exeext conftest.$ac_ext
12193$as_echo_n "checking whether OpenSSL has AES GCM via EVP... " >&6; } 21432
12194cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21433 # Check for OpenSSL with EVP_aes_*gcm
21434 { echo "$as_me:$LINENO: checking whether OpenSSL has AES GCM via EVP" >&5
21435echo $ECHO_N "checking whether OpenSSL has AES GCM via EVP... $ECHO_C" >&6; }
21436 cat >conftest.$ac_ext <<_ACEOF
21437/* confdefs.h. */
21438_ACEOF
21439cat confdefs.h >>conftest.$ac_ext
21440cat >>conftest.$ac_ext <<_ACEOF
12195/* end confdefs.h. */ 21441/* end confdefs.h. */
12196 21442
12197#include <string.h> 21443 #include <string.h>
12198#include <openssl/evp.h> 21444 #include <openssl/evp.h>
12199 21445
12200int 21446int
12201main () 21447main ()
12202{ 21448{
12203 21449
12204 exit(EVP_aes_128_gcm() == NULL || 21450 exit(EVP_aes_128_gcm() == NULL ||
12205 EVP_aes_256_gcm() == NULL || 21451 EVP_aes_256_gcm() == NULL ||
12206 EVP_CTRL_GCM_SET_IV_FIXED == 0 || 21452 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
12207 EVP_CTRL_GCM_IV_GEN == 0 || 21453 EVP_CTRL_GCM_IV_GEN == 0 ||
12208 EVP_CTRL_GCM_SET_TAG == 0 || 21454 EVP_CTRL_GCM_SET_TAG == 0 ||
12209 EVP_CTRL_GCM_GET_TAG == 0 || 21455 EVP_CTRL_GCM_GET_TAG == 0 ||
12210 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0); 21456 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
12211 21457
12212 ; 21458 ;
12213 return 0; 21459 return 0;
12214} 21460}
12215_ACEOF 21461_ACEOF
12216if ac_fn_c_try_link "$LINENO"; then : 21462rm -f conftest.$ac_objext conftest$ac_exeext
21463if { (ac_try="$ac_link"
21464case "(($ac_try" in
21465 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21466 *) ac_try_echo=$ac_try;;
21467esac
21468eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21469 (eval "$ac_link") 2>conftest.er1
21470 ac_status=$?
21471 grep -v '^ *+' conftest.er1 >conftest.err
21472 rm -f conftest.er1
21473 cat conftest.err >&5
21474 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21475 (exit $ac_status); } && {
21476 test -z "$ac_c_werror_flag" ||
21477 test ! -s conftest.err
21478 } && test -s conftest$ac_exeext &&
21479 $as_test_x conftest$ac_exeext; then
12217 21480
12218 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21481 { echo "$as_me:$LINENO: result: yes" >&5
12219$as_echo "yes" >&6; } 21482echo "${ECHO_T}yes" >&6; }
12220 21483
12221$as_echo "#define OPENSSL_HAVE_EVPGCM 1" >>confdefs.h 21484cat >>confdefs.h <<\_ACEOF
21485#define OPENSSL_HAVE_EVPGCM 1
21486_ACEOF
12222 21487
12223 21488
12224else 21489else
21490 echo "$as_me: failed program was:" >&5
21491sed 's/^/| /' conftest.$ac_ext >&5
21492
12225 21493
12226 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21494 { echo "$as_me:$LINENO: result: no" >&5
12227$as_echo "no" >&6; } 21495echo "${ECHO_T}no" >&6; }
12228 unsupported_algorithms="$unsupported_cipers \ 21496 unsupported_algorithms="$unsupported_cipers \
12229 aes128-gcm@openssh.com aes256-gcm@openssh.com" 21497 aes128-gcm@openssh.com aes256-gcm@openssh.com"
12230 21498
12231 21499
12232fi 21500fi
12233rm -f core conftest.err conftest.$ac_objext \
12234 conftest$ac_exeext conftest.$ac_ext
12235 21501
12236{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing EVP_CIPHER_CTX_ctrl" >&5 21502rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12237$as_echo_n "checking for library containing EVP_CIPHER_CTX_ctrl... " >&6; } 21503 conftest$ac_exeext conftest.$ac_ext
12238if ${ac_cv_search_EVP_CIPHER_CTX_ctrl+:} false; then : 21504
12239 $as_echo_n "(cached) " >&6 21505 { echo "$as_me:$LINENO: checking for library containing EVP_CIPHER_CTX_ctrl" >&5
21506echo $ECHO_N "checking for library containing EVP_CIPHER_CTX_ctrl... $ECHO_C" >&6; }
21507if test "${ac_cv_search_EVP_CIPHER_CTX_ctrl+set}" = set; then
21508 echo $ECHO_N "(cached) $ECHO_C" >&6
12240else 21509else
12241 ac_func_search_save_LIBS=$LIBS 21510 ac_func_search_save_LIBS=$LIBS
12242cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21511cat >conftest.$ac_ext <<_ACEOF
21512/* confdefs.h. */
21513_ACEOF
21514cat confdefs.h >>conftest.$ac_ext
21515cat >>conftest.$ac_ext <<_ACEOF
12243/* end confdefs.h. */ 21516/* end confdefs.h. */
12244 21517
12245/* Override any GCC internal prototype to avoid an error. 21518/* Override any GCC internal prototype to avoid an error.
@@ -12264,82 +21537,139 @@ for ac_lib in '' crypto; do
12264 ac_res=-l$ac_lib 21537 ac_res=-l$ac_lib
12265 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 21538 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
12266 fi 21539 fi
12267 if ac_fn_c_try_link "$LINENO"; then : 21540 rm -f conftest.$ac_objext conftest$ac_exeext
21541if { (ac_try="$ac_link"
21542case "(($ac_try" in
21543 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21544 *) ac_try_echo=$ac_try;;
21545esac
21546eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21547 (eval "$ac_link") 2>conftest.er1
21548 ac_status=$?
21549 grep -v '^ *+' conftest.er1 >conftest.err
21550 rm -f conftest.er1
21551 cat conftest.err >&5
21552 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21553 (exit $ac_status); } && {
21554 test -z "$ac_c_werror_flag" ||
21555 test ! -s conftest.err
21556 } && test -s conftest$ac_exeext &&
21557 $as_test_x conftest$ac_exeext; then
12268 ac_cv_search_EVP_CIPHER_CTX_ctrl=$ac_res 21558 ac_cv_search_EVP_CIPHER_CTX_ctrl=$ac_res
21559else
21560 echo "$as_me: failed program was:" >&5
21561sed 's/^/| /' conftest.$ac_ext >&5
21562
21563
12269fi 21564fi
12270rm -f core conftest.err conftest.$ac_objext \ 21565
12271 conftest$ac_exeext 21566rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12272 if ${ac_cv_search_EVP_CIPHER_CTX_ctrl+:} false; then : 21567 conftest$ac_exeext
21568 if test "${ac_cv_search_EVP_CIPHER_CTX_ctrl+set}" = set; then
12273 break 21569 break
12274fi 21570fi
12275done 21571done
12276if ${ac_cv_search_EVP_CIPHER_CTX_ctrl+:} false; then : 21572if test "${ac_cv_search_EVP_CIPHER_CTX_ctrl+set}" = set; then
12277 21573 :
12278else 21574else
12279 ac_cv_search_EVP_CIPHER_CTX_ctrl=no 21575 ac_cv_search_EVP_CIPHER_CTX_ctrl=no
12280fi 21576fi
12281rm conftest.$ac_ext 21577rm conftest.$ac_ext
12282LIBS=$ac_func_search_save_LIBS 21578LIBS=$ac_func_search_save_LIBS
12283fi 21579fi
12284{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_EVP_CIPHER_CTX_ctrl" >&5 21580{ echo "$as_me:$LINENO: result: $ac_cv_search_EVP_CIPHER_CTX_ctrl" >&5
12285$as_echo "$ac_cv_search_EVP_CIPHER_CTX_ctrl" >&6; } 21581echo "${ECHO_T}$ac_cv_search_EVP_CIPHER_CTX_ctrl" >&6; }
12286ac_res=$ac_cv_search_EVP_CIPHER_CTX_ctrl 21582ac_res=$ac_cv_search_EVP_CIPHER_CTX_ctrl
12287if test "$ac_res" != no; then : 21583if test "$ac_res" != no; then
12288 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 21584 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
12289 21585
12290$as_echo "#define HAVE_EVP_CIPHER_CTX_CTRL 1" >>confdefs.h 21586cat >>confdefs.h <<\_ACEOF
21587#define HAVE_EVP_CIPHER_CTX_CTRL 1
21588_ACEOF
12291 21589
12292fi 21590fi
12293 21591
12294 21592
12295{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if EVP_DigestUpdate returns an int" >&5 21593 { echo "$as_me:$LINENO: checking if EVP_DigestUpdate returns an int" >&5
12296$as_echo_n "checking if EVP_DigestUpdate returns an int... " >&6; } 21594echo $ECHO_N "checking if EVP_DigestUpdate returns an int... $ECHO_C" >&6; }
12297cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21595 cat >conftest.$ac_ext <<_ACEOF
21596/* confdefs.h. */
21597_ACEOF
21598cat confdefs.h >>conftest.$ac_ext
21599cat >>conftest.$ac_ext <<_ACEOF
12298/* end confdefs.h. */ 21600/* end confdefs.h. */
12299 21601
12300#include <string.h> 21602 #include <string.h>
12301#include <openssl/evp.h> 21603 #include <openssl/evp.h>
12302 21604
12303int 21605int
12304main () 21606main ()
12305{ 21607{
12306 21608
12307 if(EVP_DigestUpdate(NULL, NULL,0)) 21609 if(EVP_DigestUpdate(NULL, NULL,0))
12308 exit(0); 21610 exit(0);
12309 21611
12310 ; 21612 ;
12311 return 0; 21613 return 0;
12312} 21614}
12313_ACEOF 21615_ACEOF
12314if ac_fn_c_try_link "$LINENO"; then : 21616rm -f conftest.$ac_objext conftest$ac_exeext
21617if { (ac_try="$ac_link"
21618case "(($ac_try" in
21619 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21620 *) ac_try_echo=$ac_try;;
21621esac
21622eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21623 (eval "$ac_link") 2>conftest.er1
21624 ac_status=$?
21625 grep -v '^ *+' conftest.er1 >conftest.err
21626 rm -f conftest.er1
21627 cat conftest.err >&5
21628 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21629 (exit $ac_status); } && {
21630 test -z "$ac_c_werror_flag" ||
21631 test ! -s conftest.err
21632 } && test -s conftest$ac_exeext &&
21633 $as_test_x conftest$ac_exeext; then
12315 21634
12316 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21635 { echo "$as_me:$LINENO: result: yes" >&5
12317$as_echo "yes" >&6; } 21636echo "${ECHO_T}yes" >&6; }
12318 21637
12319else 21638else
21639 echo "$as_me: failed program was:" >&5
21640sed 's/^/| /' conftest.$ac_ext >&5
12320 21641
12321 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12322$as_echo "no" >&6; }
12323 21642
12324$as_echo "#define OPENSSL_EVP_DIGESTUPDATE_VOID 1" >>confdefs.h 21643 { echo "$as_me:$LINENO: result: no" >&5
21644echo "${ECHO_T}no" >&6; }
21645
21646cat >>confdefs.h <<\_ACEOF
21647#define OPENSSL_EVP_DIGESTUPDATE_VOID 1
21648_ACEOF
12325 21649
12326 21650
12327 21651
12328fi 21652fi
12329rm -f core conftest.err conftest.$ac_objext \
12330 conftest$ac_exeext conftest.$ac_ext
12331 21653
12332# Some systems want crypt() from libcrypt, *not* the version in OpenSSL, 21654rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12333# because the system crypt() is more featureful. 21655 conftest$ac_exeext conftest.$ac_ext
12334if test "x$check_for_libcrypt_before" = "x1"; then 21656
12335 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 21657 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
12336$as_echo_n "checking for crypt in -lcrypt... " >&6; } 21658 # because the system crypt() is more featureful.
12337if ${ac_cv_lib_crypt_crypt+:} false; then : 21659 if test "x$check_for_libcrypt_before" = "x1"; then
12338 $as_echo_n "(cached) " >&6 21660
21661{ echo "$as_me:$LINENO: checking for crypt in -lcrypt" >&5
21662echo $ECHO_N "checking for crypt in -lcrypt... $ECHO_C" >&6; }
21663if test "${ac_cv_lib_crypt_crypt+set}" = set; then
21664 echo $ECHO_N "(cached) $ECHO_C" >&6
12339else 21665else
12340 ac_check_lib_save_LIBS=$LIBS 21666 ac_check_lib_save_LIBS=$LIBS
12341LIBS="-lcrypt $LIBS" 21667LIBS="-lcrypt $LIBS"
12342cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21668cat >conftest.$ac_ext <<_ACEOF
21669/* confdefs.h. */
21670_ACEOF
21671cat confdefs.h >>conftest.$ac_ext
21672cat >>conftest.$ac_ext <<_ACEOF
12343/* end confdefs.h. */ 21673/* end confdefs.h. */
12344 21674
12345/* Override any GCC internal prototype to avoid an error. 21675/* Override any GCC internal prototype to avoid an error.
@@ -12357,18 +21687,39 @@ return crypt ();
12357 return 0; 21687 return 0;
12358} 21688}
12359_ACEOF 21689_ACEOF
12360if ac_fn_c_try_link "$LINENO"; then : 21690rm -f conftest.$ac_objext conftest$ac_exeext
21691if { (ac_try="$ac_link"
21692case "(($ac_try" in
21693 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21694 *) ac_try_echo=$ac_try;;
21695esac
21696eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21697 (eval "$ac_link") 2>conftest.er1
21698 ac_status=$?
21699 grep -v '^ *+' conftest.er1 >conftest.err
21700 rm -f conftest.er1
21701 cat conftest.err >&5
21702 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21703 (exit $ac_status); } && {
21704 test -z "$ac_c_werror_flag" ||
21705 test ! -s conftest.err
21706 } && test -s conftest$ac_exeext &&
21707 $as_test_x conftest$ac_exeext; then
12361 ac_cv_lib_crypt_crypt=yes 21708 ac_cv_lib_crypt_crypt=yes
12362else 21709else
12363 ac_cv_lib_crypt_crypt=no 21710 echo "$as_me: failed program was:" >&5
21711sed 's/^/| /' conftest.$ac_ext >&5
21712
21713 ac_cv_lib_crypt_crypt=no
12364fi 21714fi
12365rm -f core conftest.err conftest.$ac_objext \ 21715
12366 conftest$ac_exeext conftest.$ac_ext 21716rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
21717 conftest$ac_exeext conftest.$ac_ext
12367LIBS=$ac_check_lib_save_LIBS 21718LIBS=$ac_check_lib_save_LIBS
12368fi 21719fi
12369{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 21720{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypt_crypt" >&5
12370$as_echo "$ac_cv_lib_crypt_crypt" >&6; } 21721echo "${ECHO_T}$ac_cv_lib_crypt_crypt" >&6; }
12371if test "x$ac_cv_lib_crypt_crypt" = xyes; then : 21722if test $ac_cv_lib_crypt_crypt = yes; then
12372 cat >>confdefs.h <<_ACEOF 21723 cat >>confdefs.h <<_ACEOF
12373#define HAVE_LIBCRYPT 1 21724#define HAVE_LIBCRYPT 1
12374_ACEOF 21725_ACEOF
@@ -12377,19 +21728,23 @@ _ACEOF
12377 21728
12378fi 21729fi
12379 21730
12380fi 21731 fi
12381 21732
12382# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the 21733 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
12383# version in OpenSSL. 21734 # version in OpenSSL.
12384if test "x$check_for_libcrypt_later" = "x1"; then 21735 if test "x$check_for_libcrypt_later" = "x1"; then
12385 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 21736 { echo "$as_me:$LINENO: checking for crypt in -lcrypt" >&5
12386$as_echo_n "checking for crypt in -lcrypt... " >&6; } 21737echo $ECHO_N "checking for crypt in -lcrypt... $ECHO_C" >&6; }
12387if ${ac_cv_lib_crypt_crypt+:} false; then : 21738if test "${ac_cv_lib_crypt_crypt+set}" = set; then
12388 $as_echo_n "(cached) " >&6 21739 echo $ECHO_N "(cached) $ECHO_C" >&6
12389else 21740else
12390 ac_check_lib_save_LIBS=$LIBS 21741 ac_check_lib_save_LIBS=$LIBS
12391LIBS="-lcrypt $LIBS" 21742LIBS="-lcrypt $LIBS"
12392cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21743cat >conftest.$ac_ext <<_ACEOF
21744/* confdefs.h. */
21745_ACEOF
21746cat confdefs.h >>conftest.$ac_ext
21747cat >>conftest.$ac_ext <<_ACEOF
12393/* end confdefs.h. */ 21748/* end confdefs.h. */
12394 21749
12395/* Override any GCC internal prototype to avoid an error. 21750/* Override any GCC internal prototype to avoid an error.
@@ -12407,286 +21762,913 @@ return crypt ();
12407 return 0; 21762 return 0;
12408} 21763}
12409_ACEOF 21764_ACEOF
12410if ac_fn_c_try_link "$LINENO"; then : 21765rm -f conftest.$ac_objext conftest$ac_exeext
21766if { (ac_try="$ac_link"
21767case "(($ac_try" in
21768 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21769 *) ac_try_echo=$ac_try;;
21770esac
21771eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21772 (eval "$ac_link") 2>conftest.er1
21773 ac_status=$?
21774 grep -v '^ *+' conftest.er1 >conftest.err
21775 rm -f conftest.er1
21776 cat conftest.err >&5
21777 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21778 (exit $ac_status); } && {
21779 test -z "$ac_c_werror_flag" ||
21780 test ! -s conftest.err
21781 } && test -s conftest$ac_exeext &&
21782 $as_test_x conftest$ac_exeext; then
12411 ac_cv_lib_crypt_crypt=yes 21783 ac_cv_lib_crypt_crypt=yes
12412else 21784else
12413 ac_cv_lib_crypt_crypt=no 21785 echo "$as_me: failed program was:" >&5
21786sed 's/^/| /' conftest.$ac_ext >&5
21787
21788 ac_cv_lib_crypt_crypt=no
12414fi 21789fi
12415rm -f core conftest.err conftest.$ac_objext \ 21790
12416 conftest$ac_exeext conftest.$ac_ext 21791rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
21792 conftest$ac_exeext conftest.$ac_ext
12417LIBS=$ac_check_lib_save_LIBS 21793LIBS=$ac_check_lib_save_LIBS
12418fi 21794fi
12419{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 21795{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypt_crypt" >&5
12420$as_echo "$ac_cv_lib_crypt_crypt" >&6; } 21796echo "${ECHO_T}$ac_cv_lib_crypt_crypt" >&6; }
12421if test "x$ac_cv_lib_crypt_crypt" = xyes; then : 21797if test $ac_cv_lib_crypt_crypt = yes; then
12422 LIBS="$LIBS -lcrypt" 21798 LIBS="$LIBS -lcrypt"
12423fi 21799fi
12424 21800
12425fi 21801 fi
21802
21803
12426for ac_func in crypt DES_crypt 21804for ac_func in crypt DES_crypt
12427do : 21805do
12428 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 21806as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
12429ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 21807{ echo "$as_me:$LINENO: checking for $ac_func" >&5
12430if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 21808echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
21809if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
21810 echo $ECHO_N "(cached) $ECHO_C" >&6
21811else
21812 cat >conftest.$ac_ext <<_ACEOF
21813/* confdefs.h. */
21814_ACEOF
21815cat confdefs.h >>conftest.$ac_ext
21816cat >>conftest.$ac_ext <<_ACEOF
21817/* end confdefs.h. */
21818/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
21819 For example, HP-UX 11i <limits.h> declares gettimeofday. */
21820#define $ac_func innocuous_$ac_func
21821
21822/* System header to define __stub macros and hopefully few prototypes,
21823 which can conflict with char $ac_func (); below.
21824 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
21825 <limits.h> exists even on freestanding compilers. */
21826
21827#ifdef __STDC__
21828# include <limits.h>
21829#else
21830# include <assert.h>
21831#endif
21832
21833#undef $ac_func
21834
21835/* Override any GCC internal prototype to avoid an error.
21836 Use char because int might match the return type of a GCC
21837 builtin and then its argument prototype would still apply. */
21838#ifdef __cplusplus
21839extern "C"
21840#endif
21841char $ac_func ();
21842/* The GNU C library defines this for functions which it implements
21843 to always fail with ENOSYS. Some functions are actually named
21844 something starting with __ and the normal name is an alias. */
21845#if defined __stub_$ac_func || defined __stub___$ac_func
21846choke me
21847#endif
21848
21849int
21850main ()
21851{
21852return $ac_func ();
21853 ;
21854 return 0;
21855}
21856_ACEOF
21857rm -f conftest.$ac_objext conftest$ac_exeext
21858if { (ac_try="$ac_link"
21859case "(($ac_try" in
21860 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21861 *) ac_try_echo=$ac_try;;
21862esac
21863eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21864 (eval "$ac_link") 2>conftest.er1
21865 ac_status=$?
21866 grep -v '^ *+' conftest.er1 >conftest.err
21867 rm -f conftest.er1
21868 cat conftest.err >&5
21869 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21870 (exit $ac_status); } && {
21871 test -z "$ac_c_werror_flag" ||
21872 test ! -s conftest.err
21873 } && test -s conftest$ac_exeext &&
21874 $as_test_x conftest$ac_exeext; then
21875 eval "$as_ac_var=yes"
21876else
21877 echo "$as_me: failed program was:" >&5
21878sed 's/^/| /' conftest.$ac_ext >&5
21879
21880 eval "$as_ac_var=no"
21881fi
21882
21883rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
21884 conftest$ac_exeext conftest.$ac_ext
21885fi
21886ac_res=`eval echo '${'$as_ac_var'}'`
21887 { echo "$as_me:$LINENO: result: $ac_res" >&5
21888echo "${ECHO_T}$ac_res" >&6; }
21889if test `eval echo '${'$as_ac_var'}'` = yes; then
12431 cat >>confdefs.h <<_ACEOF 21890 cat >>confdefs.h <<_ACEOF
12432#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 21891#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12433_ACEOF 21892_ACEOF
12434 21893
12435fi 21894fi
12436done 21895done
12437 21896
12438 21897
12439# Search for SHA256 support in libc and/or OpenSSL 21898 # Search for SHA256 support in libc and/or OpenSSL
21899
21900
12440for ac_func in SHA256_Update EVP_sha256 21901for ac_func in SHA256_Update EVP_sha256
12441do : 21902do
12442 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 21903as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
12443ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 21904{ echo "$as_me:$LINENO: checking for $ac_func" >&5
12444if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 21905echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
21906if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
21907 echo $ECHO_N "(cached) $ECHO_C" >&6
21908else
21909 cat >conftest.$ac_ext <<_ACEOF
21910/* confdefs.h. */
21911_ACEOF
21912cat confdefs.h >>conftest.$ac_ext
21913cat >>conftest.$ac_ext <<_ACEOF
21914/* end confdefs.h. */
21915/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
21916 For example, HP-UX 11i <limits.h> declares gettimeofday. */
21917#define $ac_func innocuous_$ac_func
21918
21919/* System header to define __stub macros and hopefully few prototypes,
21920 which can conflict with char $ac_func (); below.
21921 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
21922 <limits.h> exists even on freestanding compilers. */
21923
21924#ifdef __STDC__
21925# include <limits.h>
21926#else
21927# include <assert.h>
21928#endif
21929
21930#undef $ac_func
21931
21932/* Override any GCC internal prototype to avoid an error.
21933 Use char because int might match the return type of a GCC
21934 builtin and then its argument prototype would still apply. */
21935#ifdef __cplusplus
21936extern "C"
21937#endif
21938char $ac_func ();
21939/* The GNU C library defines this for functions which it implements
21940 to always fail with ENOSYS. Some functions are actually named
21941 something starting with __ and the normal name is an alias. */
21942#if defined __stub_$ac_func || defined __stub___$ac_func
21943choke me
21944#endif
21945
21946int
21947main ()
21948{
21949return $ac_func ();
21950 ;
21951 return 0;
21952}
21953_ACEOF
21954rm -f conftest.$ac_objext conftest$ac_exeext
21955if { (ac_try="$ac_link"
21956case "(($ac_try" in
21957 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21958 *) ac_try_echo=$ac_try;;
21959esac
21960eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
21961 (eval "$ac_link") 2>conftest.er1
21962 ac_status=$?
21963 grep -v '^ *+' conftest.er1 >conftest.err
21964 rm -f conftest.er1
21965 cat conftest.err >&5
21966 echo "$as_me:$LINENO: \$? = $ac_status" >&5
21967 (exit $ac_status); } && {
21968 test -z "$ac_c_werror_flag" ||
21969 test ! -s conftest.err
21970 } && test -s conftest$ac_exeext &&
21971 $as_test_x conftest$ac_exeext; then
21972 eval "$as_ac_var=yes"
21973else
21974 echo "$as_me: failed program was:" >&5
21975sed 's/^/| /' conftest.$ac_ext >&5
21976
21977 eval "$as_ac_var=no"
21978fi
21979
21980rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
21981 conftest$ac_exeext conftest.$ac_ext
21982fi
21983ac_res=`eval echo '${'$as_ac_var'}'`
21984 { echo "$as_me:$LINENO: result: $ac_res" >&5
21985echo "${ECHO_T}$ac_res" >&6; }
21986if test `eval echo '${'$as_ac_var'}'` = yes; then
12445 cat >>confdefs.h <<_ACEOF 21987 cat >>confdefs.h <<_ACEOF
12446#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 21988#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12447_ACEOF 21989_ACEOF
12448 21990
12449else 21991else
12450 unsupported_algorithms="$unsupported_algorithms \ 21992 unsupported_algorithms="$unsupported_algorithms \
12451 hmac-sha2-256 hmac-sha2-512 \ 21993 hmac-sha2-256 hmac-sha2-512 \
12452 diffie-hellman-group-exchange-sha256 \ 21994 diffie-hellman-group-exchange-sha256 \
12453 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com" 21995 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com"
12454 21996
12455 21997
12456fi 21998fi
12457done 21999done
12458 22000
12459# Search for RIPE-MD support in OpenSSL 22001 # Search for RIPE-MD support in OpenSSL
22002
12460for ac_func in EVP_ripemd160 22003for ac_func in EVP_ripemd160
12461do : 22004do
12462 ac_fn_c_check_func "$LINENO" "EVP_ripemd160" "ac_cv_func_EVP_ripemd160" 22005as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
12463if test "x$ac_cv_func_EVP_ripemd160" = xyes; then : 22006{ echo "$as_me:$LINENO: checking for $ac_func" >&5
22007echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
22008if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
22009 echo $ECHO_N "(cached) $ECHO_C" >&6
22010else
22011 cat >conftest.$ac_ext <<_ACEOF
22012/* confdefs.h. */
22013_ACEOF
22014cat confdefs.h >>conftest.$ac_ext
22015cat >>conftest.$ac_ext <<_ACEOF
22016/* end confdefs.h. */
22017/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
22018 For example, HP-UX 11i <limits.h> declares gettimeofday. */
22019#define $ac_func innocuous_$ac_func
22020
22021/* System header to define __stub macros and hopefully few prototypes,
22022 which can conflict with char $ac_func (); below.
22023 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
22024 <limits.h> exists even on freestanding compilers. */
22025
22026#ifdef __STDC__
22027# include <limits.h>
22028#else
22029# include <assert.h>
22030#endif
22031
22032#undef $ac_func
22033
22034/* Override any GCC internal prototype to avoid an error.
22035 Use char because int might match the return type of a GCC
22036 builtin and then its argument prototype would still apply. */
22037#ifdef __cplusplus
22038extern "C"
22039#endif
22040char $ac_func ();
22041/* The GNU C library defines this for functions which it implements
22042 to always fail with ENOSYS. Some functions are actually named
22043 something starting with __ and the normal name is an alias. */
22044#if defined __stub_$ac_func || defined __stub___$ac_func
22045choke me
22046#endif
22047
22048int
22049main ()
22050{
22051return $ac_func ();
22052 ;
22053 return 0;
22054}
22055_ACEOF
22056rm -f conftest.$ac_objext conftest$ac_exeext
22057if { (ac_try="$ac_link"
22058case "(($ac_try" in
22059 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22060 *) ac_try_echo=$ac_try;;
22061esac
22062eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22063 (eval "$ac_link") 2>conftest.er1
22064 ac_status=$?
22065 grep -v '^ *+' conftest.er1 >conftest.err
22066 rm -f conftest.er1
22067 cat conftest.err >&5
22068 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22069 (exit $ac_status); } && {
22070 test -z "$ac_c_werror_flag" ||
22071 test ! -s conftest.err
22072 } && test -s conftest$ac_exeext &&
22073 $as_test_x conftest$ac_exeext; then
22074 eval "$as_ac_var=yes"
22075else
22076 echo "$as_me: failed program was:" >&5
22077sed 's/^/| /' conftest.$ac_ext >&5
22078
22079 eval "$as_ac_var=no"
22080fi
22081
22082rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22083 conftest$ac_exeext conftest.$ac_ext
22084fi
22085ac_res=`eval echo '${'$as_ac_var'}'`
22086 { echo "$as_me:$LINENO: result: $ac_res" >&5
22087echo "${ECHO_T}$ac_res" >&6; }
22088if test `eval echo '${'$as_ac_var'}'` = yes; then
12464 cat >>confdefs.h <<_ACEOF 22089 cat >>confdefs.h <<_ACEOF
12465#define HAVE_EVP_RIPEMD160 1 22090#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12466_ACEOF 22091_ACEOF
12467 22092
12468else 22093else
12469 unsupported_algorithms="$unsupported_algorithms \ 22094 unsupported_algorithms="$unsupported_algorithms \
12470 hmac-ripemd160 22095 hmac-ripemd160
12471 hmac-ripemd160@openssh.com 22096 hmac-ripemd160@openssh.com
12472 hmac-ripemd160-etm@openssh.com" 22097 hmac-ripemd160-etm@openssh.com"
12473 22098
12474 22099
12475fi 22100fi
12476done 22101done
12477 22102
12478 22103
12479# Check complete ECC support in OpenSSL 22104 # Check complete ECC support in OpenSSL
12480{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL has NID_X9_62_prime256v1" >&5 22105 { echo "$as_me:$LINENO: checking whether OpenSSL has NID_X9_62_prime256v1" >&5
12481$as_echo_n "checking whether OpenSSL has NID_X9_62_prime256v1... " >&6; } 22106echo $ECHO_N "checking whether OpenSSL has NID_X9_62_prime256v1... $ECHO_C" >&6; }
12482cat confdefs.h - <<_ACEOF >conftest.$ac_ext 22107 cat >conftest.$ac_ext <<_ACEOF
22108/* confdefs.h. */
22109_ACEOF
22110cat confdefs.h >>conftest.$ac_ext
22111cat >>conftest.$ac_ext <<_ACEOF
12483/* end confdefs.h. */ 22112/* end confdefs.h. */
12484 22113
12485#include <openssl/ec.h> 22114 #include <openssl/ec.h>
12486#include <openssl/ecdh.h> 22115 #include <openssl/ecdh.h>
12487#include <openssl/ecdsa.h> 22116 #include <openssl/ecdsa.h>
12488#include <openssl/evp.h> 22117 #include <openssl/evp.h>
12489#include <openssl/objects.h> 22118 #include <openssl/objects.h>
12490#include <openssl/opensslv.h> 22119 #include <openssl/opensslv.h>
12491#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */ 22120 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
12492# error "OpenSSL < 0.9.8g has unreliable ECC code" 22121 # error "OpenSSL < 0.9.8g has unreliable ECC code"
12493#endif 22122 #endif
12494 22123
12495int 22124int
12496main () 22125main ()
12497{ 22126{
12498 22127
12499 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); 22128 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
12500 const EVP_MD *m = EVP_sha256(); /* We need this too */ 22129 const EVP_MD *m = EVP_sha256(); /* We need this too */
12501 22130
12502 ; 22131 ;
12503 return 0; 22132 return 0;
12504} 22133}
12505_ACEOF 22134_ACEOF
12506if ac_fn_c_try_link "$LINENO"; then : 22135rm -f conftest.$ac_objext conftest$ac_exeext
12507 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 22136if { (ac_try="$ac_link"
12508$as_echo "yes" >&6; } 22137case "(($ac_try" in
12509 enable_nistp256=1 22138 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22139 *) ac_try_echo=$ac_try;;
22140esac
22141eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22142 (eval "$ac_link") 2>conftest.er1
22143 ac_status=$?
22144 grep -v '^ *+' conftest.er1 >conftest.err
22145 rm -f conftest.er1
22146 cat conftest.err >&5
22147 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22148 (exit $ac_status); } && {
22149 test -z "$ac_c_werror_flag" ||
22150 test ! -s conftest.err
22151 } && test -s conftest$ac_exeext &&
22152 $as_test_x conftest$ac_exeext; then
22153 { echo "$as_me:$LINENO: result: yes" >&5
22154echo "${ECHO_T}yes" >&6; }
22155 enable_nistp256=1
12510else 22156else
12511 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 22157 echo "$as_me: failed program was:" >&5
12512$as_echo "no" >&6; } 22158sed 's/^/| /' conftest.$ac_ext >&5
22159
22160 { echo "$as_me:$LINENO: result: no" >&5
22161echo "${ECHO_T}no" >&6; }
12513 22162
12514fi 22163fi
12515rm -f core conftest.err conftest.$ac_objext \
12516 conftest$ac_exeext conftest.$ac_ext
12517 22164
12518{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL has NID_secp384r1" >&5 22165rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12519$as_echo_n "checking whether OpenSSL has NID_secp384r1... " >&6; } 22166 conftest$ac_exeext conftest.$ac_ext
12520cat confdefs.h - <<_ACEOF >conftest.$ac_ext 22167
22168 { echo "$as_me:$LINENO: checking whether OpenSSL has NID_secp384r1" >&5
22169echo $ECHO_N "checking whether OpenSSL has NID_secp384r1... $ECHO_C" >&6; }
22170 cat >conftest.$ac_ext <<_ACEOF
22171/* confdefs.h. */
22172_ACEOF
22173cat confdefs.h >>conftest.$ac_ext
22174cat >>conftest.$ac_ext <<_ACEOF
12521/* end confdefs.h. */ 22175/* end confdefs.h. */
12522 22176
12523#include <openssl/ec.h> 22177 #include <openssl/ec.h>
12524#include <openssl/ecdh.h> 22178 #include <openssl/ecdh.h>
12525#include <openssl/ecdsa.h> 22179 #include <openssl/ecdsa.h>
12526#include <openssl/evp.h> 22180 #include <openssl/evp.h>
12527#include <openssl/objects.h> 22181 #include <openssl/objects.h>
12528#include <openssl/opensslv.h> 22182 #include <openssl/opensslv.h>
12529#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */ 22183 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
12530# error "OpenSSL < 0.9.8g has unreliable ECC code" 22184 # error "OpenSSL < 0.9.8g has unreliable ECC code"
12531#endif 22185 #endif
12532 22186
12533int 22187int
12534main () 22188main ()
12535{ 22189{
12536 22190
12537 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1); 22191 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
12538 const EVP_MD *m = EVP_sha384(); /* We need this too */ 22192 const EVP_MD *m = EVP_sha384(); /* We need this too */
12539 22193
12540 ; 22194 ;
12541 return 0; 22195 return 0;
12542} 22196}
12543_ACEOF 22197_ACEOF
12544if ac_fn_c_try_link "$LINENO"; then : 22198rm -f conftest.$ac_objext conftest$ac_exeext
12545 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 22199if { (ac_try="$ac_link"
12546$as_echo "yes" >&6; } 22200case "(($ac_try" in
12547 enable_nistp384=1 22201 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22202 *) ac_try_echo=$ac_try;;
22203esac
22204eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22205 (eval "$ac_link") 2>conftest.er1
22206 ac_status=$?
22207 grep -v '^ *+' conftest.er1 >conftest.err
22208 rm -f conftest.er1
22209 cat conftest.err >&5
22210 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22211 (exit $ac_status); } && {
22212 test -z "$ac_c_werror_flag" ||
22213 test ! -s conftest.err
22214 } && test -s conftest$ac_exeext &&
22215 $as_test_x conftest$ac_exeext; then
22216 { echo "$as_me:$LINENO: result: yes" >&5
22217echo "${ECHO_T}yes" >&6; }
22218 enable_nistp384=1
12548else 22219else
12549 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 22220 echo "$as_me: failed program was:" >&5
12550$as_echo "no" >&6; } 22221sed 's/^/| /' conftest.$ac_ext >&5
22222
22223 { echo "$as_me:$LINENO: result: no" >&5
22224echo "${ECHO_T}no" >&6; }
12551 22225
12552fi 22226fi
12553rm -f core conftest.err conftest.$ac_objext \
12554 conftest$ac_exeext conftest.$ac_ext
12555 22227
12556{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL has NID_secp521r1" >&5 22228rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12557$as_echo_n "checking whether OpenSSL has NID_secp521r1... " >&6; } 22229 conftest$ac_exeext conftest.$ac_ext
12558cat confdefs.h - <<_ACEOF >conftest.$ac_ext 22230
22231 { echo "$as_me:$LINENO: checking whether OpenSSL has NID_secp521r1" >&5
22232echo $ECHO_N "checking whether OpenSSL has NID_secp521r1... $ECHO_C" >&6; }
22233 cat >conftest.$ac_ext <<_ACEOF
22234/* confdefs.h. */
22235_ACEOF
22236cat confdefs.h >>conftest.$ac_ext
22237cat >>conftest.$ac_ext <<_ACEOF
12559/* end confdefs.h. */ 22238/* end confdefs.h. */
12560 22239
12561#include <openssl/ec.h> 22240 #include <openssl/ec.h>
12562#include <openssl/ecdh.h> 22241 #include <openssl/ecdh.h>
12563#include <openssl/ecdsa.h> 22242 #include <openssl/ecdsa.h>
12564#include <openssl/evp.h> 22243 #include <openssl/evp.h>
12565#include <openssl/objects.h> 22244 #include <openssl/objects.h>
12566#include <openssl/opensslv.h> 22245 #include <openssl/opensslv.h>
12567#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */ 22246 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
12568# error "OpenSSL < 0.9.8g has unreliable ECC code" 22247 # error "OpenSSL < 0.9.8g has unreliable ECC code"
12569#endif 22248 #endif
12570 22249
12571int 22250int
12572main () 22251main ()
12573{ 22252{
12574 22253
12575 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); 22254 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
12576 const EVP_MD *m = EVP_sha512(); /* We need this too */ 22255 const EVP_MD *m = EVP_sha512(); /* We need this too */
12577 22256
12578 ; 22257 ;
12579 return 0; 22258 return 0;
12580} 22259}
12581_ACEOF 22260_ACEOF
12582if ac_fn_c_try_link "$LINENO"; then : 22261rm -f conftest.$ac_objext conftest$ac_exeext
12583 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 22262if { (ac_try="$ac_link"
12584$as_echo "yes" >&6; } 22263case "(($ac_try" in
12585 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OpenSSL's NID_secp521r1 is functional" >&5 22264 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12586$as_echo_n "checking if OpenSSL's NID_secp521r1 is functional... " >&6; } 22265 *) ac_try_echo=$ac_try;;
12587 if test "$cross_compiling" = yes; then : 22266esac
12588 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: assuming yes" >&5 22267eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12589$as_echo "$as_me: WARNING: cross-compiling: assuming yes" >&2;} 22268 (eval "$ac_link") 2>conftest.er1
12590 enable_nistp521=1 22269 ac_status=$?
12591 22270 grep -v '^ *+' conftest.er1 >conftest.err
12592else 22271 rm -f conftest.er1
12593 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 22272 cat conftest.err >&5
22273 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22274 (exit $ac_status); } && {
22275 test -z "$ac_c_werror_flag" ||
22276 test ! -s conftest.err
22277 } && test -s conftest$ac_exeext &&
22278 $as_test_x conftest$ac_exeext; then
22279 { echo "$as_me:$LINENO: result: yes" >&5
22280echo "${ECHO_T}yes" >&6; }
22281 { echo "$as_me:$LINENO: checking if OpenSSL's NID_secp521r1 is functional" >&5
22282echo $ECHO_N "checking if OpenSSL's NID_secp521r1 is functional... $ECHO_C" >&6; }
22283 if test "$cross_compiling" = yes; then
22284 { echo "$as_me:$LINENO: WARNING: cross-compiling: assuming yes" >&5
22285echo "$as_me: WARNING: cross-compiling: assuming yes" >&2;}
22286 enable_nistp521=1
22287
22288else
22289 cat >conftest.$ac_ext <<_ACEOF
22290/* confdefs.h. */
22291_ACEOF
22292cat confdefs.h >>conftest.$ac_ext
22293cat >>conftest.$ac_ext <<_ACEOF
12594/* end confdefs.h. */ 22294/* end confdefs.h. */
12595 22295
12596#include <openssl/ec.h> 22296 #include <openssl/ec.h>
12597#include <openssl/ecdh.h> 22297 #include <openssl/ecdh.h>
12598#include <openssl/ecdsa.h> 22298 #include <openssl/ecdsa.h>
12599#include <openssl/evp.h> 22299 #include <openssl/evp.h>
12600#include <openssl/objects.h> 22300 #include <openssl/objects.h>
12601#include <openssl/opensslv.h> 22301 #include <openssl/opensslv.h>
12602 22302
12603int 22303int
12604main () 22304main ()
12605{ 22305{
12606 22306
12607 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); 22307 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
12608 const EVP_MD *m = EVP_sha512(); /* We need this too */ 22308 const EVP_MD *m = EVP_sha512(); /* We need this too */
12609 exit(e == NULL || m == NULL); 22309 exit(e == NULL || m == NULL);
12610 22310
12611 ; 22311 ;
12612 return 0; 22312 return 0;
12613} 22313}
12614_ACEOF 22314_ACEOF
12615if ac_fn_c_try_run "$LINENO"; then : 22315rm -f conftest$ac_exeext
12616 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 22316if { (ac_try="$ac_link"
12617$as_echo "yes" >&6; } 22317case "(($ac_try" in
12618 enable_nistp521=1 22318 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12619else 22319 *) ac_try_echo=$ac_try;;
12620 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 22320esac
12621$as_echo "no" >&6; } 22321eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22322 (eval "$ac_link") 2>&5
22323 ac_status=$?
22324 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22325 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
22326 { (case "(($ac_try" in
22327 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22328 *) ac_try_echo=$ac_try;;
22329esac
22330eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22331 (eval "$ac_try") 2>&5
22332 ac_status=$?
22333 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22334 (exit $ac_status); }; }; then
22335 { echo "$as_me:$LINENO: result: yes" >&5
22336echo "${ECHO_T}yes" >&6; }
22337 enable_nistp521=1
22338else
22339 echo "$as_me: program exited with status $ac_status" >&5
22340echo "$as_me: failed program was:" >&5
22341sed 's/^/| /' conftest.$ac_ext >&5
22342
22343( exit $ac_status )
22344 { echo "$as_me:$LINENO: result: no" >&5
22345echo "${ECHO_T}no" >&6; }
12622fi 22346fi
12623rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 22347rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
12624 conftest.$ac_objext conftest.beam conftest.$ac_ext
12625fi 22348fi
12626 22349
22350
12627else 22351else
12628 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 22352 echo "$as_me: failed program was:" >&5
12629$as_echo "no" >&6; } 22353sed 's/^/| /' conftest.$ac_ext >&5
22354
22355 { echo "$as_me:$LINENO: result: no" >&5
22356echo "${ECHO_T}no" >&6; }
12630 22357
12631fi 22358fi
12632rm -f core conftest.err conftest.$ac_objext \
12633 conftest$ac_exeext conftest.$ac_ext
12634 22359
12635COMMENT_OUT_ECC="#no ecc#" 22360rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12636TEST_SSH_ECC=no 22361 conftest$ac_exeext conftest.$ac_ext
12637 22362
12638if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \ 22363 COMMENT_OUT_ECC="#no ecc#"
12639 test x$enable_nistp521 = x1; then 22364 TEST_SSH_ECC=no
12640 22365
12641$as_echo "#define OPENSSL_HAS_ECC 1" >>confdefs.h 22366 if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
22367 test x$enable_nistp521 = x1; then
22368
22369cat >>confdefs.h <<\_ACEOF
22370#define OPENSSL_HAS_ECC 1
22371_ACEOF
22372
22373 fi
22374 if test x$enable_nistp256 = x1; then
22375
22376cat >>confdefs.h <<\_ACEOF
22377#define OPENSSL_HAS_NISTP256 1
22378_ACEOF
22379
22380 TEST_SSH_ECC=yes
22381 COMMENT_OUT_ECC=""
22382 else
22383 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \
22384 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com"
22385 fi
22386 if test x$enable_nistp384 = x1; then
22387
22388cat >>confdefs.h <<\_ACEOF
22389#define OPENSSL_HAS_NISTP384 1
22390_ACEOF
22391
22392 TEST_SSH_ECC=yes
22393 COMMENT_OUT_ECC=""
22394 else
22395 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \
22396 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com"
22397 fi
22398 if test x$enable_nistp521 = x1; then
22399
22400cat >>confdefs.h <<\_ACEOF
22401#define OPENSSL_HAS_NISTP521 1
22402_ACEOF
22403
22404 TEST_SSH_ECC=yes
22405 COMMENT_OUT_ECC=""
22406 else
22407 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \
22408 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com"
22409 fi
12642 22410
12643fi
12644if test x$enable_nistp256 = x1; then
12645 22411
12646$as_echo "#define OPENSSL_HAS_NISTP256 1" >>confdefs.h
12647 22412
12648 TEST_SSH_ECC=yes
12649 COMMENT_OUT_ECC=""
12650else 22413else
12651 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \ 22414 { echo "$as_me:$LINENO: checking for crypt in -lcrypt" >&5
12652 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com" 22415echo $ECHO_N "checking for crypt in -lcrypt... $ECHO_C" >&6; }
22416if test "${ac_cv_lib_crypt_crypt+set}" = set; then
22417 echo $ECHO_N "(cached) $ECHO_C" >&6
22418else
22419 ac_check_lib_save_LIBS=$LIBS
22420LIBS="-lcrypt $LIBS"
22421cat >conftest.$ac_ext <<_ACEOF
22422/* confdefs.h. */
22423_ACEOF
22424cat confdefs.h >>conftest.$ac_ext
22425cat >>conftest.$ac_ext <<_ACEOF
22426/* end confdefs.h. */
22427
22428/* Override any GCC internal prototype to avoid an error.
22429 Use char because int might match the return type of a GCC
22430 builtin and then its argument prototype would still apply. */
22431#ifdef __cplusplus
22432extern "C"
22433#endif
22434char crypt ();
22435int
22436main ()
22437{
22438return crypt ();
22439 ;
22440 return 0;
22441}
22442_ACEOF
22443rm -f conftest.$ac_objext conftest$ac_exeext
22444if { (ac_try="$ac_link"
22445case "(($ac_try" in
22446 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22447 *) ac_try_echo=$ac_try;;
22448esac
22449eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22450 (eval "$ac_link") 2>conftest.er1
22451 ac_status=$?
22452 grep -v '^ *+' conftest.er1 >conftest.err
22453 rm -f conftest.er1
22454 cat conftest.err >&5
22455 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22456 (exit $ac_status); } && {
22457 test -z "$ac_c_werror_flag" ||
22458 test ! -s conftest.err
22459 } && test -s conftest$ac_exeext &&
22460 $as_test_x conftest$ac_exeext; then
22461 ac_cv_lib_crypt_crypt=yes
22462else
22463 echo "$as_me: failed program was:" >&5
22464sed 's/^/| /' conftest.$ac_ext >&5
22465
22466 ac_cv_lib_crypt_crypt=no
22467fi
22468
22469rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22470 conftest$ac_exeext conftest.$ac_ext
22471LIBS=$ac_check_lib_save_LIBS
22472fi
22473{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypt_crypt" >&5
22474echo "${ECHO_T}$ac_cv_lib_crypt_crypt" >&6; }
22475if test $ac_cv_lib_crypt_crypt = yes; then
22476 LIBS="$LIBS -lcrypt"
12653fi 22477fi
12654if test x$enable_nistp384 = x1; then
12655 22478
12656$as_echo "#define OPENSSL_HAS_NISTP384 1" >>confdefs.h
12657 22479
12658 TEST_SSH_ECC=yes 22480for ac_func in crypt
12659 COMMENT_OUT_ECC="" 22481do
22482as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
22483{ echo "$as_me:$LINENO: checking for $ac_func" >&5
22484echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
22485if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
22486 echo $ECHO_N "(cached) $ECHO_C" >&6
12660else 22487else
12661 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \ 22488 cat >conftest.$ac_ext <<_ACEOF
12662 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com" 22489/* confdefs.h. */
12663fi 22490_ACEOF
12664if test x$enable_nistp521 = x1; then 22491cat confdefs.h >>conftest.$ac_ext
22492cat >>conftest.$ac_ext <<_ACEOF
22493/* end confdefs.h. */
22494/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
22495 For example, HP-UX 11i <limits.h> declares gettimeofday. */
22496#define $ac_func innocuous_$ac_func
22497
22498/* System header to define __stub macros and hopefully few prototypes,
22499 which can conflict with char $ac_func (); below.
22500 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
22501 <limits.h> exists even on freestanding compilers. */
12665 22502
12666$as_echo "#define OPENSSL_HAS_NISTP521 1" >>confdefs.h 22503#ifdef __STDC__
22504# include <limits.h>
22505#else
22506# include <assert.h>
22507#endif
12667 22508
12668 TEST_SSH_ECC=yes 22509#undef $ac_func
12669 COMMENT_OUT_ECC="" 22510
22511/* Override any GCC internal prototype to avoid an error.
22512 Use char because int might match the return type of a GCC
22513 builtin and then its argument prototype would still apply. */
22514#ifdef __cplusplus
22515extern "C"
22516#endif
22517char $ac_func ();
22518/* The GNU C library defines this for functions which it implements
22519 to always fail with ENOSYS. Some functions are actually named
22520 something starting with __ and the normal name is an alias. */
22521#if defined __stub_$ac_func || defined __stub___$ac_func
22522choke me
22523#endif
22524
22525int
22526main ()
22527{
22528return $ac_func ();
22529 ;
22530 return 0;
22531}
22532_ACEOF
22533rm -f conftest.$ac_objext conftest$ac_exeext
22534if { (ac_try="$ac_link"
22535case "(($ac_try" in
22536 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22537 *) ac_try_echo=$ac_try;;
22538esac
22539eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22540 (eval "$ac_link") 2>conftest.er1
22541 ac_status=$?
22542 grep -v '^ *+' conftest.er1 >conftest.err
22543 rm -f conftest.er1
22544 cat conftest.err >&5
22545 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22546 (exit $ac_status); } && {
22547 test -z "$ac_c_werror_flag" ||
22548 test ! -s conftest.err
22549 } && test -s conftest$ac_exeext &&
22550 $as_test_x conftest$ac_exeext; then
22551 eval "$as_ac_var=yes"
12670else 22552else
12671 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \ 22553 echo "$as_me: failed program was:" >&5
12672 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com" 22554sed 's/^/| /' conftest.$ac_ext >&5
22555
22556 eval "$as_ac_var=no"
22557fi
22558
22559rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22560 conftest$ac_exeext conftest.$ac_ext
22561fi
22562ac_res=`eval echo '${'$as_ac_var'}'`
22563 { echo "$as_me:$LINENO: result: $ac_res" >&5
22564echo "${ECHO_T}$ac_res" >&6; }
22565if test `eval echo '${'$as_ac_var'}'` = yes; then
22566 cat >>confdefs.h <<_ACEOF
22567#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
22568_ACEOF
22569
22570fi
22571done
22572
12673fi 22573fi
12674 22574
12675 22575
12676 22576
12677 22577
22578
12678for ac_func in \ 22579for ac_func in \
12679 arc4random \ 22580 arc4random \
12680 arc4random_buf \ 22581 arc4random_buf \
12681 arc4random_stir \ 22582 arc4random_stir \
12682 arc4random_uniform \ 22583 arc4random_uniform \
12683 22584
12684do : 22585do
12685 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 22586as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
12686ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 22587{ echo "$as_me:$LINENO: checking for $ac_func" >&5
12687if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 22588echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
22589if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
22590 echo $ECHO_N "(cached) $ECHO_C" >&6
22591else
22592 cat >conftest.$ac_ext <<_ACEOF
22593/* confdefs.h. */
22594_ACEOF
22595cat confdefs.h >>conftest.$ac_ext
22596cat >>conftest.$ac_ext <<_ACEOF
22597/* end confdefs.h. */
22598/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
22599 For example, HP-UX 11i <limits.h> declares gettimeofday. */
22600#define $ac_func innocuous_$ac_func
22601
22602/* System header to define __stub macros and hopefully few prototypes,
22603 which can conflict with char $ac_func (); below.
22604 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
22605 <limits.h> exists even on freestanding compilers. */
22606
22607#ifdef __STDC__
22608# include <limits.h>
22609#else
22610# include <assert.h>
22611#endif
22612
22613#undef $ac_func
22614
22615/* Override any GCC internal prototype to avoid an error.
22616 Use char because int might match the return type of a GCC
22617 builtin and then its argument prototype would still apply. */
22618#ifdef __cplusplus
22619extern "C"
22620#endif
22621char $ac_func ();
22622/* The GNU C library defines this for functions which it implements
22623 to always fail with ENOSYS. Some functions are actually named
22624 something starting with __ and the normal name is an alias. */
22625#if defined __stub_$ac_func || defined __stub___$ac_func
22626choke me
22627#endif
22628
22629int
22630main ()
22631{
22632return $ac_func ();
22633 ;
22634 return 0;
22635}
22636_ACEOF
22637rm -f conftest.$ac_objext conftest$ac_exeext
22638if { (ac_try="$ac_link"
22639case "(($ac_try" in
22640 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22641 *) ac_try_echo=$ac_try;;
22642esac
22643eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22644 (eval "$ac_link") 2>conftest.er1
22645 ac_status=$?
22646 grep -v '^ *+' conftest.er1 >conftest.err
22647 rm -f conftest.er1
22648 cat conftest.err >&5
22649 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22650 (exit $ac_status); } && {
22651 test -z "$ac_c_werror_flag" ||
22652 test ! -s conftest.err
22653 } && test -s conftest$ac_exeext &&
22654 $as_test_x conftest$ac_exeext; then
22655 eval "$as_ac_var=yes"
22656else
22657 echo "$as_me: failed program was:" >&5
22658sed 's/^/| /' conftest.$ac_ext >&5
22659
22660 eval "$as_ac_var=no"
22661fi
22662
22663rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22664 conftest$ac_exeext conftest.$ac_ext
22665fi
22666ac_res=`eval echo '${'$as_ac_var'}'`
22667 { echo "$as_me:$LINENO: result: $ac_res" >&5
22668echo "${ECHO_T}$ac_res" >&6; }
22669if test `eval echo '${'$as_ac_var'}'` = yes; then
12688 cat >>confdefs.h <<_ACEOF 22670 cat >>confdefs.h <<_ACEOF
12689#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 22671#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12690_ACEOF 22672_ACEOF
12691 22673
12692fi 22674fi
@@ -12694,14 +22676,18 @@ done
12694 22676
12695 22677
12696saved_LIBS="$LIBS" 22678saved_LIBS="$LIBS"
12697{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ia_openinfo in -liaf" >&5 22679{ echo "$as_me:$LINENO: checking for ia_openinfo in -liaf" >&5
12698$as_echo_n "checking for ia_openinfo in -liaf... " >&6; } 22680echo $ECHO_N "checking for ia_openinfo in -liaf... $ECHO_C" >&6; }
12699if ${ac_cv_lib_iaf_ia_openinfo+:} false; then : 22681if test "${ac_cv_lib_iaf_ia_openinfo+set}" = set; then
12700 $as_echo_n "(cached) " >&6 22682 echo $ECHO_N "(cached) $ECHO_C" >&6
12701else 22683else
12702 ac_check_lib_save_LIBS=$LIBS 22684 ac_check_lib_save_LIBS=$LIBS
12703LIBS="-liaf $LIBS" 22685LIBS="-liaf $LIBS"
12704cat confdefs.h - <<_ACEOF >conftest.$ac_ext 22686cat >conftest.$ac_ext <<_ACEOF
22687/* confdefs.h. */
22688_ACEOF
22689cat confdefs.h >>conftest.$ac_ext
22690cat >>conftest.$ac_ext <<_ACEOF
12705/* end confdefs.h. */ 22691/* end confdefs.h. */
12706 22692
12707/* Override any GCC internal prototype to avoid an error. 22693/* Override any GCC internal prototype to avoid an error.
@@ -12719,30 +22705,136 @@ return ia_openinfo ();
12719 return 0; 22705 return 0;
12720} 22706}
12721_ACEOF 22707_ACEOF
12722if ac_fn_c_try_link "$LINENO"; then : 22708rm -f conftest.$ac_objext conftest$ac_exeext
22709if { (ac_try="$ac_link"
22710case "(($ac_try" in
22711 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22712 *) ac_try_echo=$ac_try;;
22713esac
22714eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22715 (eval "$ac_link") 2>conftest.er1
22716 ac_status=$?
22717 grep -v '^ *+' conftest.er1 >conftest.err
22718 rm -f conftest.er1
22719 cat conftest.err >&5
22720 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22721 (exit $ac_status); } && {
22722 test -z "$ac_c_werror_flag" ||
22723 test ! -s conftest.err
22724 } && test -s conftest$ac_exeext &&
22725 $as_test_x conftest$ac_exeext; then
12723 ac_cv_lib_iaf_ia_openinfo=yes 22726 ac_cv_lib_iaf_ia_openinfo=yes
12724else 22727else
12725 ac_cv_lib_iaf_ia_openinfo=no 22728 echo "$as_me: failed program was:" >&5
22729sed 's/^/| /' conftest.$ac_ext >&5
22730
22731 ac_cv_lib_iaf_ia_openinfo=no
12726fi 22732fi
12727rm -f core conftest.err conftest.$ac_objext \ 22733
12728 conftest$ac_exeext conftest.$ac_ext 22734rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22735 conftest$ac_exeext conftest.$ac_ext
12729LIBS=$ac_check_lib_save_LIBS 22736LIBS=$ac_check_lib_save_LIBS
12730fi 22737fi
12731{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iaf_ia_openinfo" >&5 22738{ echo "$as_me:$LINENO: result: $ac_cv_lib_iaf_ia_openinfo" >&5
12732$as_echo "$ac_cv_lib_iaf_ia_openinfo" >&6; } 22739echo "${ECHO_T}$ac_cv_lib_iaf_ia_openinfo" >&6; }
12733if test "x$ac_cv_lib_iaf_ia_openinfo" = xyes; then : 22740if test $ac_cv_lib_iaf_ia_openinfo = yes; then
12734 22741
12735 LIBS="$LIBS -liaf" 22742 LIBS="$LIBS -liaf"
12736 for ac_func in set_id 22743
12737do : 22744for ac_func in set_id
12738 ac_fn_c_check_func "$LINENO" "set_id" "ac_cv_func_set_id" 22745do
12739if test "x$ac_cv_func_set_id" = xyes; then : 22746as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
22747{ echo "$as_me:$LINENO: checking for $ac_func" >&5
22748echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
22749if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
22750 echo $ECHO_N "(cached) $ECHO_C" >&6
22751else
22752 cat >conftest.$ac_ext <<_ACEOF
22753/* confdefs.h. */
22754_ACEOF
22755cat confdefs.h >>conftest.$ac_ext
22756cat >>conftest.$ac_ext <<_ACEOF
22757/* end confdefs.h. */
22758/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
22759 For example, HP-UX 11i <limits.h> declares gettimeofday. */
22760#define $ac_func innocuous_$ac_func
22761
22762/* System header to define __stub macros and hopefully few prototypes,
22763 which can conflict with char $ac_func (); below.
22764 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
22765 <limits.h> exists even on freestanding compilers. */
22766
22767#ifdef __STDC__
22768# include <limits.h>
22769#else
22770# include <assert.h>
22771#endif
22772
22773#undef $ac_func
22774
22775/* Override any GCC internal prototype to avoid an error.
22776 Use char because int might match the return type of a GCC
22777 builtin and then its argument prototype would still apply. */
22778#ifdef __cplusplus
22779extern "C"
22780#endif
22781char $ac_func ();
22782/* The GNU C library defines this for functions which it implements
22783 to always fail with ENOSYS. Some functions are actually named
22784 something starting with __ and the normal name is an alias. */
22785#if defined __stub_$ac_func || defined __stub___$ac_func
22786choke me
22787#endif
22788
22789int
22790main ()
22791{
22792return $ac_func ();
22793 ;
22794 return 0;
22795}
22796_ACEOF
22797rm -f conftest.$ac_objext conftest$ac_exeext
22798if { (ac_try="$ac_link"
22799case "(($ac_try" in
22800 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22801 *) ac_try_echo=$ac_try;;
22802esac
22803eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22804 (eval "$ac_link") 2>conftest.er1
22805 ac_status=$?
22806 grep -v '^ *+' conftest.er1 >conftest.err
22807 rm -f conftest.er1
22808 cat conftest.err >&5
22809 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22810 (exit $ac_status); } && {
22811 test -z "$ac_c_werror_flag" ||
22812 test ! -s conftest.err
22813 } && test -s conftest$ac_exeext &&
22814 $as_test_x conftest$ac_exeext; then
22815 eval "$as_ac_var=yes"
22816else
22817 echo "$as_me: failed program was:" >&5
22818sed 's/^/| /' conftest.$ac_ext >&5
22819
22820 eval "$as_ac_var=no"
22821fi
22822
22823rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22824 conftest$ac_exeext conftest.$ac_ext
22825fi
22826ac_res=`eval echo '${'$as_ac_var'}'`
22827 { echo "$as_me:$LINENO: result: $ac_res" >&5
22828echo "${ECHO_T}$ac_res" >&6; }
22829if test `eval echo '${'$as_ac_var'}'` = yes; then
12740 cat >>confdefs.h <<_ACEOF 22830 cat >>confdefs.h <<_ACEOF
12741#define HAVE_SET_ID 1 22831#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12742_ACEOF 22832_ACEOF
12743 SSHDLIBS="$SSHDLIBS -liaf" 22833 SSHDLIBS="$SSHDLIBS -liaf"
12744 22834
12745$as_echo "#define HAVE_LIBIAF 1" >>confdefs.h 22835cat >>confdefs.h <<\_ACEOF
22836#define HAVE_LIBIAF 1
22837_ACEOF
12746 22838
12747 22839
12748fi 22840fi
@@ -12756,55 +22848,85 @@ LIBS="$saved_LIBS"
12756### Configure cryptographic random number support 22848### Configure cryptographic random number support
12757 22849
12758# Check wheter OpenSSL seeds itself 22850# Check wheter OpenSSL seeds itself
12759{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL's PRNG is internally seeded" >&5 22851if test "x$openssl" = "xyes" ; then
12760$as_echo_n "checking whether OpenSSL's PRNG is internally seeded... " >&6; } 22852 { echo "$as_me:$LINENO: checking whether OpenSSL's PRNG is internally seeded" >&5
12761if test "$cross_compiling" = yes; then : 22853echo $ECHO_N "checking whether OpenSSL's PRNG is internally seeded... $ECHO_C" >&6; }
22854 if test "$cross_compiling" = yes; then
12762 22855
12763 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: assuming yes" >&5 22856 { echo "$as_me:$LINENO: WARNING: cross compiling: assuming yes" >&5
12764$as_echo "$as_me: WARNING: cross compiling: assuming yes" >&2;} 22857echo "$as_me: WARNING: cross compiling: assuming yes" >&2;}
12765 # This is safe, since we will fatal() at runtime if 22858 # This is safe, since we will fatal() at runtime if
12766 # OpenSSL is not seeded correctly. 22859 # OpenSSL is not seeded correctly.
12767 OPENSSL_SEEDS_ITSELF=yes 22860 OPENSSL_SEEDS_ITSELF=yes
12768 22861
12769 22862
12770else 22863else
12771 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 22864 cat >conftest.$ac_ext <<_ACEOF
22865/* confdefs.h. */
22866_ACEOF
22867cat confdefs.h >>conftest.$ac_ext
22868cat >>conftest.$ac_ext <<_ACEOF
12772/* end confdefs.h. */ 22869/* end confdefs.h. */
12773 22870
12774#include <string.h> 22871 #include <string.h>
12775#include <openssl/rand.h> 22872 #include <openssl/rand.h>
12776 22873
12777int 22874int
12778main () 22875main ()
12779{ 22876{
12780 22877
12781 exit(RAND_status() == 1 ? 0 : 1); 22878 exit(RAND_status() == 1 ? 0 : 1);
12782 22879
12783 ; 22880 ;
12784 return 0; 22881 return 0;
12785} 22882}
12786_ACEOF 22883_ACEOF
12787if ac_fn_c_try_run "$LINENO"; then : 22884rm -f conftest$ac_exeext
22885if { (ac_try="$ac_link"
22886case "(($ac_try" in
22887 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22888 *) ac_try_echo=$ac_try;;
22889esac
22890eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22891 (eval "$ac_link") 2>&5
22892 ac_status=$?
22893 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22894 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
22895 { (case "(($ac_try" in
22896 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22897 *) ac_try_echo=$ac_try;;
22898esac
22899eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
22900 (eval "$ac_try") 2>&5
22901 ac_status=$?
22902 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22903 (exit $ac_status); }; }; then
12788 22904
12789 OPENSSL_SEEDS_ITSELF=yes 22905 OPENSSL_SEEDS_ITSELF=yes
12790 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 22906 { echo "$as_me:$LINENO: result: yes" >&5
12791$as_echo "yes" >&6; } 22907echo "${ECHO_T}yes" >&6; }
12792 22908
12793else 22909else
22910 echo "$as_me: program exited with status $ac_status" >&5
22911echo "$as_me: failed program was:" >&5
22912sed 's/^/| /' conftest.$ac_ext >&5
12794 22913
12795 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 22914( exit $ac_status )
12796$as_echo "no" >&6; } 22915
22916 { echo "$as_me:$LINENO: result: no" >&5
22917echo "${ECHO_T}no" >&6; }
12797 22918
12798fi 22919fi
12799rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 22920rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
12800 conftest.$ac_objext conftest.beam conftest.$ac_ext
12801fi 22921fi
12802 22922
12803 22923
22924fi
22925
12804# PRNGD TCP socket 22926# PRNGD TCP socket
12805 22927
12806# Check whether --with-prngd-port was given. 22928# Check whether --with-prngd-port was given.
12807if test "${with_prngd_port+set}" = set; then : 22929if test "${with_prngd_port+set}" = set; then
12808 withval=$with_prngd_port; 22930 withval=$with_prngd_port;
12809 case "$withval" in 22931 case "$withval" in
12810 no) 22932 no)
@@ -12813,7 +22935,9 @@ if test "${with_prngd_port+set}" = set; then :
12813 [0-9]*) 22935 [0-9]*)
12814 ;; 22936 ;;
12815 *) 22937 *)
12816 as_fn_error $? "You must specify a numeric port number for --with-prngd-port" "$LINENO" 5 22938 { { echo "$as_me:$LINENO: error: You must specify a numeric port number for --with-prngd-port" >&5
22939echo "$as_me: error: You must specify a numeric port number for --with-prngd-port" >&2;}
22940 { (exit 1); exit 1; }; }
12817 ;; 22941 ;;
12818 esac 22942 esac
12819 if test ! -z "$withval" ; then 22943 if test ! -z "$withval" ; then
@@ -12832,7 +22956,7 @@ fi
12832# PRNGD Unix domain socket 22956# PRNGD Unix domain socket
12833 22957
12834# Check whether --with-prngd-socket was given. 22958# Check whether --with-prngd-socket was given.
12835if test "${with_prngd_socket+set}" = set; then : 22959if test "${with_prngd_socket+set}" = set; then
12836 withval=$with_prngd_socket; 22960 withval=$with_prngd_socket;
12837 case "$withval" in 22961 case "$withval" in
12838 yes) 22962 yes)
@@ -12844,17 +22968,21 @@ if test "${with_prngd_socket+set}" = set; then :
12844 /*) 22968 /*)
12845 ;; 22969 ;;
12846 *) 22970 *)
12847 as_fn_error $? "You must specify an absolute path to the entropy socket" "$LINENO" 5 22971 { { echo "$as_me:$LINENO: error: You must specify an absolute path to the entropy socket" >&5
22972echo "$as_me: error: You must specify an absolute path to the entropy socket" >&2;}
22973 { (exit 1); exit 1; }; }
12848 ;; 22974 ;;
12849 esac 22975 esac
12850 22976
12851 if test ! -z "$withval" ; then 22977 if test ! -z "$withval" ; then
12852 if test ! -z "$PRNGD_PORT" ; then 22978 if test ! -z "$PRNGD_PORT" ; then
12853 as_fn_error $? "You may not specify both a PRNGD/EGD port and socket" "$LINENO" 5 22979 { { echo "$as_me:$LINENO: error: You may not specify both a PRNGD/EGD port and socket" >&5
22980echo "$as_me: error: You may not specify both a PRNGD/EGD port and socket" >&2;}
22981 { (exit 1); exit 1; }; }
12854 fi 22982 fi
12855 if test ! -r "$withval" ; then 22983 if test ! -r "$withval" ; then
12856 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Entropy socket is not readable" >&5 22984 { echo "$as_me:$LINENO: WARNING: Entropy socket is not readable" >&5
12857$as_echo "$as_me: WARNING: Entropy socket is not readable" >&2;} 22985echo "$as_me: WARNING: Entropy socket is not readable" >&2;}
12858 fi 22986 fi
12859 PRNGD_SOCKET="$withval" 22987 PRNGD_SOCKET="$withval"
12860 22988
@@ -12868,8 +22996,8 @@ else
12868 22996
12869 # Check for existing socket only if we don't have a random device already 22997 # Check for existing socket only if we don't have a random device already
12870 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then 22998 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
12871 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PRNGD/EGD socket" >&5 22999 { echo "$as_me:$LINENO: checking for PRNGD/EGD socket" >&5
12872$as_echo_n "checking for PRNGD/EGD socket... " >&6; } 23000echo $ECHO_N "checking for PRNGD/EGD socket... $ECHO_C" >&6; }
12873 # Insert other locations here 23001 # Insert other locations here
12874 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do 23002 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
12875 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then 23003 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
@@ -12882,11 +23010,11 @@ _ACEOF
12882 fi 23010 fi
12883 done 23011 done
12884 if test ! -z "$PRNGD_SOCKET" ; then 23012 if test ! -z "$PRNGD_SOCKET" ; then
12885 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PRNGD_SOCKET" >&5 23013 { echo "$as_me:$LINENO: result: $PRNGD_SOCKET" >&5
12886$as_echo "$PRNGD_SOCKET" >&6; } 23014echo "${ECHO_T}$PRNGD_SOCKET" >&6; }
12887 else 23015 else
12888 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 23016 { echo "$as_me:$LINENO: result: not found" >&5
12889$as_echo "not found" >&6; } 23017echo "${ECHO_T}not found" >&6; }
12890 fi 23018 fi
12891 fi 23019 fi
12892 23020
@@ -12901,34 +23029,48 @@ elif test ! -z "$PRNGD_SOCKET" ; then
12901 RAND_MSG="PRNGd socket $PRNGD_SOCKET" 23029 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
12902elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then 23030elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
12903 23031
12904$as_echo "#define OPENSSL_PRNG_ONLY 1" >>confdefs.h 23032cat >>confdefs.h <<\_ACEOF
23033#define OPENSSL_PRNG_ONLY 1
23034_ACEOF
12905 23035
12906 RAND_MSG="OpenSSL internal ONLY" 23036 RAND_MSG="OpenSSL internal ONLY"
23037elif test "x$openssl" = "xno" ; then
23038 { echo "$as_me:$LINENO: WARNING: OpenSSH will use /dev/urandom as a source of random numbers. It will fail if this device is not supported or accessible" >&5
23039echo "$as_me: WARNING: OpenSSH will use /dev/urandom as a source of random numbers. It will fail if this device is not supported or accessible" >&2;}
12907else 23040else
12908 as_fn_error $? "OpenSSH has no source of random numbers. Please configure OpenSSL with an entropy source or re-run configure using one of the --with-prngd-port or --with-prngd-socket options" "$LINENO" 5 23041 { { echo "$as_me:$LINENO: error: OpenSSH has no source of random numbers. Please configure OpenSSL with an entropy source or re-run configure using one of the --with-prngd-port or --with-prngd-socket options" >&5
23042echo "$as_me: error: OpenSSH has no source of random numbers. Please configure OpenSSL with an entropy source or re-run configure using one of the --with-prngd-port or --with-prngd-socket options" >&2;}
23043 { (exit 1); exit 1; }; }
12909fi 23044fi
12910 23045
12911# Check for PAM libs 23046# Check for PAM libs
12912PAM_MSG="no" 23047PAM_MSG="no"
12913 23048
12914# Check whether --with-pam was given. 23049# Check whether --with-pam was given.
12915if test "${with_pam+set}" = set; then : 23050if test "${with_pam+set}" = set; then
12916 withval=$with_pam; 23051 withval=$with_pam;
12917 if test "x$withval" != "xno" ; then 23052 if test "x$withval" != "xno" ; then
12918 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \ 23053 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
12919 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then 23054 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
12920 as_fn_error $? "PAM headers not found" "$LINENO" 5 23055 { { echo "$as_me:$LINENO: error: PAM headers not found" >&5
23056echo "$as_me: error: PAM headers not found" >&2;}
23057 { (exit 1); exit 1; }; }
12921 fi 23058 fi
12922 23059
12923 saved_LIBS="$LIBS" 23060 saved_LIBS="$LIBS"
12924 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 23061
12925$as_echo_n "checking for dlopen in -ldl... " >&6; } 23062{ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
12926if ${ac_cv_lib_dl_dlopen+:} false; then : 23063echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
12927 $as_echo_n "(cached) " >&6 23064if test "${ac_cv_lib_dl_dlopen+set}" = set; then
23065 echo $ECHO_N "(cached) $ECHO_C" >&6
12928else 23066else
12929 ac_check_lib_save_LIBS=$LIBS 23067 ac_check_lib_save_LIBS=$LIBS
12930LIBS="-ldl $LIBS" 23068LIBS="-ldl $LIBS"
12931cat confdefs.h - <<_ACEOF >conftest.$ac_ext 23069cat >conftest.$ac_ext <<_ACEOF
23070/* confdefs.h. */
23071_ACEOF
23072cat confdefs.h >>conftest.$ac_ext
23073cat >>conftest.$ac_ext <<_ACEOF
12932/* end confdefs.h. */ 23074/* end confdefs.h. */
12933 23075
12934/* Override any GCC internal prototype to avoid an error. 23076/* Override any GCC internal prototype to avoid an error.
@@ -12946,18 +23088,39 @@ return dlopen ();
12946 return 0; 23088 return 0;
12947} 23089}
12948_ACEOF 23090_ACEOF
12949if ac_fn_c_try_link "$LINENO"; then : 23091rm -f conftest.$ac_objext conftest$ac_exeext
23092if { (ac_try="$ac_link"
23093case "(($ac_try" in
23094 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23095 *) ac_try_echo=$ac_try;;
23096esac
23097eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23098 (eval "$ac_link") 2>conftest.er1
23099 ac_status=$?
23100 grep -v '^ *+' conftest.er1 >conftest.err
23101 rm -f conftest.er1
23102 cat conftest.err >&5
23103 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23104 (exit $ac_status); } && {
23105 test -z "$ac_c_werror_flag" ||
23106 test ! -s conftest.err
23107 } && test -s conftest$ac_exeext &&
23108 $as_test_x conftest$ac_exeext; then
12950 ac_cv_lib_dl_dlopen=yes 23109 ac_cv_lib_dl_dlopen=yes
12951else 23110else
12952 ac_cv_lib_dl_dlopen=no 23111 echo "$as_me: failed program was:" >&5
23112sed 's/^/| /' conftest.$ac_ext >&5
23113
23114 ac_cv_lib_dl_dlopen=no
12953fi 23115fi
12954rm -f core conftest.err conftest.$ac_objext \ 23116
12955 conftest$ac_exeext conftest.$ac_ext 23117rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
23118 conftest$ac_exeext conftest.$ac_ext
12956LIBS=$ac_check_lib_save_LIBS 23119LIBS=$ac_check_lib_save_LIBS
12957fi 23120fi
12958{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 23121{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
12959$as_echo "$ac_cv_lib_dl_dlopen" >&6; } 23122echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
12960if test "x$ac_cv_lib_dl_dlopen" = xyes; then : 23123if test $ac_cv_lib_dl_dlopen = yes; then
12961 cat >>confdefs.h <<_ACEOF 23124 cat >>confdefs.h <<_ACEOF
12962#define HAVE_LIBDL 1 23125#define HAVE_LIBDL 1
12963_ACEOF 23126_ACEOF
@@ -12966,14 +23129,19 @@ _ACEOF
12966 23129
12967fi 23130fi
12968 23131
12969 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_set_item in -lpam" >&5 23132
12970$as_echo_n "checking for pam_set_item in -lpam... " >&6; } 23133{ echo "$as_me:$LINENO: checking for pam_set_item in -lpam" >&5
12971if ${ac_cv_lib_pam_pam_set_item+:} false; then : 23134echo $ECHO_N "checking for pam_set_item in -lpam... $ECHO_C" >&6; }
12972 $as_echo_n "(cached) " >&6 23135if test "${ac_cv_lib_pam_pam_set_item+set}" = set; then
23136 echo $ECHO_N "(cached) $ECHO_C" >&6
12973else 23137else
12974 ac_check_lib_save_LIBS=$LIBS 23138 ac_check_lib_save_LIBS=$LIBS
12975LIBS="-lpam $LIBS" 23139LIBS="-lpam $LIBS"
12976cat confdefs.h - <<_ACEOF >conftest.$ac_ext 23140cat >conftest.$ac_ext <<_ACEOF
23141/* confdefs.h. */
23142_ACEOF
23143cat confdefs.h >>conftest.$ac_ext
23144cat >>conftest.$ac_ext <<_ACEOF
12977/* end confdefs.h. */ 23145/* end confdefs.h. */
12978 23146
12979/* Override any GCC internal prototype to avoid an error. 23147/* Override any GCC internal prototype to avoid an error.
@@ -12991,18 +23159,39 @@ return pam_set_item ();
12991 return 0; 23159 return 0;
12992} 23160}
12993_ACEOF 23161_ACEOF
12994if ac_fn_c_try_link "$LINENO"; then : 23162rm -f conftest.$ac_objext conftest$ac_exeext
23163if { (ac_try="$ac_link"
23164case "(($ac_try" in
23165 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23166 *) ac_try_echo=$ac_try;;
23167esac
23168eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23169 (eval "$ac_link") 2>conftest.er1
23170 ac_status=$?
23171 grep -v '^ *+' conftest.er1 >conftest.err
23172 rm -f conftest.er1
23173 cat conftest.err >&5
23174 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23175 (exit $ac_status); } && {
23176 test -z "$ac_c_werror_flag" ||
23177 test ! -s conftest.err
23178 } && test -s conftest$ac_exeext &&
23179 $as_test_x conftest$ac_exeext; then
12995 ac_cv_lib_pam_pam_set_item=yes 23180 ac_cv_lib_pam_pam_set_item=yes
12996else 23181else
12997 ac_cv_lib_pam_pam_set_item=no 23182 echo "$as_me: failed program was:" >&5
23183sed 's/^/| /' conftest.$ac_ext >&5
23184
23185 ac_cv_lib_pam_pam_set_item=no
12998fi 23186fi
12999rm -f core conftest.err conftest.$ac_objext \ 23187
13000 conftest$ac_exeext conftest.$ac_ext 23188rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
23189 conftest$ac_exeext conftest.$ac_ext
13001LIBS=$ac_check_lib_save_LIBS 23190LIBS=$ac_check_lib_save_LIBS
13002fi 23191fi
13003{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_set_item" >&5 23192{ echo "$as_me:$LINENO: result: $ac_cv_lib_pam_pam_set_item" >&5
13004$as_echo "$ac_cv_lib_pam_pam_set_item" >&6; } 23193echo "${ECHO_T}$ac_cv_lib_pam_pam_set_item" >&6; }
13005if test "x$ac_cv_lib_pam_pam_set_item" = xyes; then : 23194if test $ac_cv_lib_pam_pam_set_item = yes; then
13006 cat >>confdefs.h <<_ACEOF 23195 cat >>confdefs.h <<_ACEOF
13007#define HAVE_LIBPAM 1 23196#define HAVE_LIBPAM 1
13008_ACEOF 23197_ACEOF
@@ -13010,26 +23199,194 @@ _ACEOF
13010 LIBS="-lpam $LIBS" 23199 LIBS="-lpam $LIBS"
13011 23200
13012else 23201else
13013 as_fn_error $? "*** libpam missing" "$LINENO" 5 23202 { { echo "$as_me:$LINENO: error: *** libpam missing" >&5
23203echo "$as_me: error: *** libpam missing" >&2;}
23204 { (exit 1); exit 1; }; }
13014fi 23205fi
13015 23206
13016 for ac_func in pam_getenvlist 23207
13017do : 23208for ac_func in pam_getenvlist
13018 ac_fn_c_check_func "$LINENO" "pam_getenvlist" "ac_cv_func_pam_getenvlist" 23209do
13019if test "x$ac_cv_func_pam_getenvlist" = xyes; then : 23210as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
23211{ echo "$as_me:$LINENO: checking for $ac_func" >&5
23212echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
23213if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
23214 echo $ECHO_N "(cached) $ECHO_C" >&6
23215else
23216 cat >conftest.$ac_ext <<_ACEOF
23217/* confdefs.h. */
23218_ACEOF
23219cat confdefs.h >>conftest.$ac_ext
23220cat >>conftest.$ac_ext <<_ACEOF
23221/* end confdefs.h. */
23222/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
23223 For example, HP-UX 11i <limits.h> declares gettimeofday. */
23224#define $ac_func innocuous_$ac_func
23225
23226/* System header to define __stub macros and hopefully few prototypes,
23227 which can conflict with char $ac_func (); below.
23228 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
23229 <limits.h> exists even on freestanding compilers. */
23230
23231#ifdef __STDC__
23232# include <limits.h>
23233#else
23234# include <assert.h>
23235#endif
23236
23237#undef $ac_func
23238
23239/* Override any GCC internal prototype to avoid an error.
23240 Use char because int might match the return type of a GCC
23241 builtin and then its argument prototype would still apply. */
23242#ifdef __cplusplus
23243extern "C"
23244#endif
23245char $ac_func ();
23246/* The GNU C library defines this for functions which it implements
23247 to always fail with ENOSYS. Some functions are actually named
23248 something starting with __ and the normal name is an alias. */
23249#if defined __stub_$ac_func || defined __stub___$ac_func
23250choke me
23251#endif
23252
23253int
23254main ()
23255{
23256return $ac_func ();
23257 ;
23258 return 0;
23259}
23260_ACEOF
23261rm -f conftest.$ac_objext conftest$ac_exeext
23262if { (ac_try="$ac_link"
23263case "(($ac_try" in
23264 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23265 *) ac_try_echo=$ac_try;;
23266esac
23267eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23268 (eval "$ac_link") 2>conftest.er1
23269 ac_status=$?
23270 grep -v '^ *+' conftest.er1 >conftest.err
23271 rm -f conftest.er1
23272 cat conftest.err >&5
23273 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23274 (exit $ac_status); } && {
23275 test -z "$ac_c_werror_flag" ||
23276 test ! -s conftest.err
23277 } && test -s conftest$ac_exeext &&
23278 $as_test_x conftest$ac_exeext; then
23279 eval "$as_ac_var=yes"
23280else
23281 echo "$as_me: failed program was:" >&5
23282sed 's/^/| /' conftest.$ac_ext >&5
23283
23284 eval "$as_ac_var=no"
23285fi
23286
23287rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
23288 conftest$ac_exeext conftest.$ac_ext
23289fi
23290ac_res=`eval echo '${'$as_ac_var'}'`
23291 { echo "$as_me:$LINENO: result: $ac_res" >&5
23292echo "${ECHO_T}$ac_res" >&6; }
23293if test `eval echo '${'$as_ac_var'}'` = yes; then
13020 cat >>confdefs.h <<_ACEOF 23294 cat >>confdefs.h <<_ACEOF
13021#define HAVE_PAM_GETENVLIST 1 23295#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
13022_ACEOF 23296_ACEOF
13023 23297
13024fi 23298fi
13025done 23299done
13026 23300
13027 for ac_func in pam_putenv 23301
13028do : 23302for ac_func in pam_putenv
13029 ac_fn_c_check_func "$LINENO" "pam_putenv" "ac_cv_func_pam_putenv" 23303do
13030if test "x$ac_cv_func_pam_putenv" = xyes; then : 23304as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
23305{ echo "$as_me:$LINENO: checking for $ac_func" >&5
23306echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
23307if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
23308 echo $ECHO_N "(cached) $ECHO_C" >&6
23309else
23310 cat >conftest.$ac_ext <<_ACEOF
23311/* confdefs.h. */
23312_ACEOF
23313cat confdefs.h >>conftest.$ac_ext
23314cat >>conftest.$ac_ext <<_ACEOF
23315/* end confdefs.h. */
23316/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
23317 For example, HP-UX 11i <limits.h> declares gettimeofday. */
23318#define $ac_func innocuous_$ac_func
23319
23320/* System header to define __stub macros and hopefully few prototypes,
23321 which can conflict with char $ac_func (); below.
23322 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
23323 <limits.h> exists even on freestanding compilers. */
23324
23325#ifdef __STDC__
23326# include <limits.h>
23327#else
23328# include <assert.h>
23329#endif
23330
23331#undef $ac_func
23332
23333/* Override any GCC internal prototype to avoid an error.
23334 Use char because int might match the return type of a GCC
23335 builtin and then its argument prototype would still apply. */
23336#ifdef __cplusplus
23337extern "C"
23338#endif
23339char $ac_func ();
23340/* The GNU C library defines this for functions which it implements
23341 to always fail with ENOSYS. Some functions are actually named
23342 something starting with __ and the normal name is an alias. */
23343#if defined __stub_$ac_func || defined __stub___$ac_func
23344choke me
23345#endif
23346
23347int
23348main ()
23349{
23350return $ac_func ();
23351 ;
23352 return 0;
23353}
23354_ACEOF
23355rm -f conftest.$ac_objext conftest$ac_exeext
23356if { (ac_try="$ac_link"
23357case "(($ac_try" in
23358 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23359 *) ac_try_echo=$ac_try;;
23360esac
23361eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23362 (eval "$ac_link") 2>conftest.er1
23363 ac_status=$?
23364 grep -v '^ *+' conftest.er1 >conftest.err
23365 rm -f conftest.er1
23366 cat conftest.err >&5
23367 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23368 (exit $ac_status); } && {
23369 test -z "$ac_c_werror_flag" ||
23370 test ! -s conftest.err
23371 } && test -s conftest$ac_exeext &&
23372 $as_test_x conftest$ac_exeext; then
23373 eval "$as_ac_var=yes"
23374else
23375 echo "$as_me: failed program was:" >&5
23376sed 's/^/| /' conftest.$ac_ext >&5
23377
23378 eval "$as_ac_var=no"
23379fi
23380
23381rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
23382 conftest$ac_exeext conftest.$ac_ext
23383fi
23384ac_res=`eval echo '${'$as_ac_var'}'`
23385 { echo "$as_me:$LINENO: result: $ac_res" >&5
23386echo "${ECHO_T}$ac_res" >&6; }
23387if test `eval echo '${'$as_ac_var'}'` = yes; then
13031 cat >>confdefs.h <<_ACEOF 23388 cat >>confdefs.h <<_ACEOF
13032#define HAVE_PAM_PUTENV 1 23389#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
13033_ACEOF 23390_ACEOF
13034 23391
13035fi 23392fi
@@ -13041,7 +23398,9 @@ done
13041 23398
13042 SSHDLIBS="$SSHDLIBS -lpam" 23399 SSHDLIBS="$SSHDLIBS -lpam"
13043 23400
13044$as_echo "#define USE_PAM 1" >>confdefs.h 23401cat >>confdefs.h <<\_ACEOF
23402#define USE_PAM 1
23403_ACEOF
13045 23404
13046 23405
13047 if test $ac_cv_lib_dl_dlopen = yes; then 23406 if test $ac_cv_lib_dl_dlopen = yes; then
@@ -13063,9 +23422,13 @@ fi
13063# Check for older PAM 23422# Check for older PAM
13064if test "x$PAM_MSG" = "xyes" ; then 23423if test "x$PAM_MSG" = "xyes" ; then
13065 # Check PAM strerror arguments (old PAM) 23424 # Check PAM strerror arguments (old PAM)
13066 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pam_strerror takes only one argument" >&5 23425 { echo "$as_me:$LINENO: checking whether pam_strerror takes only one argument" >&5
13067$as_echo_n "checking whether pam_strerror takes only one argument... " >&6; } 23426echo $ECHO_N "checking whether pam_strerror takes only one argument... $ECHO_C" >&6; }
13068 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 23427 cat >conftest.$ac_ext <<_ACEOF
23428/* confdefs.h. */
23429_ACEOF
23430cat confdefs.h >>conftest.$ac_ext
23431cat >>conftest.$ac_ext <<_ACEOF
13069/* end confdefs.h. */ 23432/* end confdefs.h. */
13070 23433
13071#include <stdlib.h> 23434#include <stdlib.h>
@@ -13085,20 +23448,42 @@ main ()
13085 return 0; 23448 return 0;
13086} 23449}
13087_ACEOF 23450_ACEOF
13088if ac_fn_c_try_compile "$LINENO"; then : 23451rm -f conftest.$ac_objext
13089 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 23452if { (ac_try="$ac_compile"
13090$as_echo "no" >&6; } 23453case "(($ac_try" in
23454 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23455 *) ac_try_echo=$ac_try;;
23456esac
23457eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23458 (eval "$ac_compile") 2>conftest.er1
23459 ac_status=$?
23460 grep -v '^ *+' conftest.er1 >conftest.err
23461 rm -f conftest.er1
23462 cat conftest.err >&5
23463 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23464 (exit $ac_status); } && {
23465 test -z "$ac_c_werror_flag" ||
23466 test ! -s conftest.err
23467 } && test -s conftest.$ac_objext; then
23468 { echo "$as_me:$LINENO: result: no" >&5
23469echo "${ECHO_T}no" >&6; }
13091else 23470else
23471 echo "$as_me: failed program was:" >&5
23472sed 's/^/| /' conftest.$ac_ext >&5
23473
13092 23474
13093 23475
13094$as_echo "#define HAVE_OLD_PAM 1" >>confdefs.h 23476cat >>confdefs.h <<\_ACEOF
23477#define HAVE_OLD_PAM 1
23478_ACEOF
13095 23479
13096 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 23480 { echo "$as_me:$LINENO: result: yes" >&5
13097$as_echo "yes" >&6; } 23481echo "${ECHO_T}yes" >&6; }
13098 PAM_MSG="yes (old library)" 23482 PAM_MSG="yes (old library)"
13099 23483
13100 23484
13101fi 23485fi
23486
13102rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 23487rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13103fi 23488fi
13104 23489
@@ -13112,7 +23497,7 @@ case "$host" in
13112esac 23497esac
13113 23498
13114# Check whether --with-privsep-user was given. 23499# Check whether --with-privsep-user was given.
13115if test "${with_privsep_user+set}" = set; then : 23500if test "${with_privsep_user+set}" = set; then
13116 withval=$with_privsep_user; 23501 withval=$with_privsep_user;
13117 if test -n "$withval" && test "x$withval" != "xno" && \ 23502 if test -n "$withval" && test "x$withval" != "xno" && \
13118 test "x${withval}" != "xyes"; then 23503 test "x${withval}" != "xyes"; then
@@ -13138,20 +23523,75 @@ fi
13138 23523
13139 23524
13140if test "x$have_linux_no_new_privs" = "x1" ; then 23525if test "x$have_linux_no_new_privs" = "x1" ; then
13141ac_fn_c_check_decl "$LINENO" "SECCOMP_MODE_FILTER" "ac_cv_have_decl_SECCOMP_MODE_FILTER" " 23526{ echo "$as_me:$LINENO: checking whether SECCOMP_MODE_FILTER is declared" >&5
23527echo $ECHO_N "checking whether SECCOMP_MODE_FILTER is declared... $ECHO_C" >&6; }
23528if test "${ac_cv_have_decl_SECCOMP_MODE_FILTER+set}" = set; then
23529 echo $ECHO_N "(cached) $ECHO_C" >&6
23530else
23531 cat >conftest.$ac_ext <<_ACEOF
23532/* confdefs.h. */
23533_ACEOF
23534cat confdefs.h >>conftest.$ac_ext
23535cat >>conftest.$ac_ext <<_ACEOF
23536/* end confdefs.h. */
23537
13142 #include <sys/types.h> 23538 #include <sys/types.h>
13143 #include <linux/seccomp.h> 23539 #include <linux/seccomp.h>
13144 23540
13145" 23541
13146if test "x$ac_cv_have_decl_SECCOMP_MODE_FILTER" = xyes; then : 23542int
23543main ()
23544{
23545#ifndef SECCOMP_MODE_FILTER
23546 (void) SECCOMP_MODE_FILTER;
23547#endif
23548
23549 ;
23550 return 0;
23551}
23552_ACEOF
23553rm -f conftest.$ac_objext
23554if { (ac_try="$ac_compile"
23555case "(($ac_try" in
23556 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23557 *) ac_try_echo=$ac_try;;
23558esac
23559eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23560 (eval "$ac_compile") 2>conftest.er1
23561 ac_status=$?
23562 grep -v '^ *+' conftest.er1 >conftest.err
23563 rm -f conftest.er1
23564 cat conftest.err >&5
23565 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23566 (exit $ac_status); } && {
23567 test -z "$ac_c_werror_flag" ||
23568 test ! -s conftest.err
23569 } && test -s conftest.$ac_objext; then
23570 ac_cv_have_decl_SECCOMP_MODE_FILTER=yes
23571else
23572 echo "$as_me: failed program was:" >&5
23573sed 's/^/| /' conftest.$ac_ext >&5
23574
23575 ac_cv_have_decl_SECCOMP_MODE_FILTER=no
23576fi
23577
23578rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
23579fi
23580{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_SECCOMP_MODE_FILTER" >&5
23581echo "${ECHO_T}$ac_cv_have_decl_SECCOMP_MODE_FILTER" >&6; }
23582if test $ac_cv_have_decl_SECCOMP_MODE_FILTER = yes; then
13147 have_seccomp_filter=1 23583 have_seccomp_filter=1
13148fi 23584fi
13149 23585
13150fi 23586fi
13151if test "x$have_seccomp_filter" = "x1" ; then 23587if test "x$have_seccomp_filter" = "x1" ; then
13152{ $as_echo "$as_me:${as_lineno-$LINENO}: checking kernel for seccomp_filter support" >&5 23588{ echo "$as_me:$LINENO: checking kernel for seccomp_filter support" >&5
13153$as_echo_n "checking kernel for seccomp_filter support... " >&6; } 23589echo $ECHO_N "checking kernel for seccomp_filter support... $ECHO_C" >&6; }
13154cat confdefs.h - <<_ACEOF >conftest.$ac_ext 23590cat >conftest.$ac_ext <<_ACEOF
23591/* confdefs.h. */
23592_ACEOF
23593cat confdefs.h >>conftest.$ac_ext
23594cat >>conftest.$ac_ext <<_ACEOF
13155/* end confdefs.h. */ 23595/* end confdefs.h. */
13156 23596
13157 #include <errno.h> 23597 #include <errno.h>
@@ -13172,27 +23612,48 @@ main ()
13172 return 0; 23612 return 0;
13173} 23613}
13174_ACEOF 23614_ACEOF
13175if ac_fn_c_try_link "$LINENO"; then : 23615rm -f conftest.$ac_objext conftest$ac_exeext
13176 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 23616if { (ac_try="$ac_link"
13177$as_echo "yes" >&6; } 23617case "(($ac_try" in
23618 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23619 *) ac_try_echo=$ac_try;;
23620esac
23621eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23622 (eval "$ac_link") 2>conftest.er1
23623 ac_status=$?
23624 grep -v '^ *+' conftest.er1 >conftest.err
23625 rm -f conftest.er1
23626 cat conftest.err >&5
23627 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23628 (exit $ac_status); } && {
23629 test -z "$ac_c_werror_flag" ||
23630 test ! -s conftest.err
23631 } && test -s conftest$ac_exeext &&
23632 $as_test_x conftest$ac_exeext; then
23633 { echo "$as_me:$LINENO: result: yes" >&5
23634echo "${ECHO_T}yes" >&6; }
13178else 23635else
23636 echo "$as_me: failed program was:" >&5
23637sed 's/^/| /' conftest.$ac_ext >&5
23638
13179 23639
13180 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 23640 { echo "$as_me:$LINENO: result: no" >&5
13181$as_echo "no" >&6; } 23641echo "${ECHO_T}no" >&6; }
13182 # Disable seccomp filter as a target 23642 # Disable seccomp filter as a target
13183 have_seccomp_filter=0 23643 have_seccomp_filter=0
13184 23644
13185 23645
13186fi 23646fi
13187rm -f core conftest.err conftest.$ac_objext \ 23647
13188 conftest$ac_exeext conftest.$ac_ext 23648rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
23649 conftest$ac_exeext conftest.$ac_ext
13189fi 23650fi
13190 23651
13191# Decide which sandbox style to use 23652# Decide which sandbox style to use
13192sandbox_arg="" 23653sandbox_arg=""
13193 23654
13194# Check whether --with-sandbox was given. 23655# Check whether --with-sandbox was given.
13195if test "${with_sandbox+set}" = set; then : 23656if test "${with_sandbox+set}" = set; then
13196 withval=$with_sandbox; 23657 withval=$with_sandbox;
13197 if test "x$withval" = "xyes" ; then 23658 if test "x$withval" = "xyes" ; then
13198 sandbox_arg="" 23659 sandbox_arg=""
@@ -13207,14 +23668,18 @@ fi
13207# Some platforms (seems to be the ones that have a kernel poll(2)-type 23668# Some platforms (seems to be the ones that have a kernel poll(2)-type
13208# function with which they implement select(2)) use an extra file descriptor 23669# function with which they implement select(2)) use an extra file descriptor
13209# when calling select(2), which means we can't use the rlimit sandbox. 23670# when calling select(2), which means we can't use the rlimit sandbox.
13210{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if select works with descriptor rlimit" >&5 23671{ echo "$as_me:$LINENO: checking if select works with descriptor rlimit" >&5
13211$as_echo_n "checking if select works with descriptor rlimit... " >&6; } 23672echo $ECHO_N "checking if select works with descriptor rlimit... $ECHO_C" >&6; }
13212if test "$cross_compiling" = yes; then : 23673if test "$cross_compiling" = yes; then
13213 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: assuming yes" >&5 23674 { echo "$as_me:$LINENO: WARNING: cross compiling: assuming yes" >&5
13214$as_echo "$as_me: WARNING: cross compiling: assuming yes" >&2;} 23675echo "$as_me: WARNING: cross compiling: assuming yes" >&2;}
13215 23676
13216else 23677else
13217 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 23678 cat >conftest.$ac_ext <<_ACEOF
23679/* confdefs.h. */
23680_ACEOF
23681cat confdefs.h >>conftest.$ac_ext
23682cat >>conftest.$ac_ext <<_ACEOF
13218/* end confdefs.h. */ 23683/* end confdefs.h. */
13219 23684
13220#include <sys/types.h> 23685#include <sys/types.h>
@@ -13253,28 +23718,56 @@ main ()
13253 return 0; 23718 return 0;
13254} 23719}
13255_ACEOF 23720_ACEOF
13256if ac_fn_c_try_run "$LINENO"; then : 23721rm -f conftest$ac_exeext
13257 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 23722if { (ac_try="$ac_link"
13258$as_echo "yes" >&6; } 23723case "(($ac_try" in
23724 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23725 *) ac_try_echo=$ac_try;;
23726esac
23727eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23728 (eval "$ac_link") 2>&5
23729 ac_status=$?
23730 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23731 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
23732 { (case "(($ac_try" in
23733 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23734 *) ac_try_echo=$ac_try;;
23735esac
23736eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23737 (eval "$ac_try") 2>&5
23738 ac_status=$?
23739 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23740 (exit $ac_status); }; }; then
23741 { echo "$as_me:$LINENO: result: yes" >&5
23742echo "${ECHO_T}yes" >&6; }
13259 select_works_with_rlimit=yes 23743 select_works_with_rlimit=yes
13260else 23744else
13261 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 23745 echo "$as_me: program exited with status $ac_status" >&5
13262$as_echo "no" >&6; } 23746echo "$as_me: failed program was:" >&5
23747sed 's/^/| /' conftest.$ac_ext >&5
23748
23749( exit $ac_status )
23750{ echo "$as_me:$LINENO: result: no" >&5
23751echo "${ECHO_T}no" >&6; }
13263 select_works_with_rlimit=no 23752 select_works_with_rlimit=no
13264fi 23753fi
13265rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 23754rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
13266 conftest.$ac_objext conftest.beam conftest.$ac_ext
13267fi 23755fi
13268 23756
13269 23757
13270{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if setrlimit(RLIMIT_NOFILE,{0,0}) works" >&5 23758
13271$as_echo_n "checking if setrlimit(RLIMIT_NOFILE,{0,0}) works... " >&6; } 23759{ echo "$as_me:$LINENO: checking if setrlimit(RLIMIT_NOFILE,{0,0}) works" >&5
13272if test "$cross_compiling" = yes; then : 23760echo $ECHO_N "checking if setrlimit(RLIMIT_NOFILE,{0,0}) works... $ECHO_C" >&6; }
13273 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: assuming yes" >&5 23761if test "$cross_compiling" = yes; then
13274$as_echo "$as_me: WARNING: cross compiling: assuming yes" >&2;} 23762 { echo "$as_me:$LINENO: WARNING: cross compiling: assuming yes" >&5
23763echo "$as_me: WARNING: cross compiling: assuming yes" >&2;}
13275 23764
13276else 23765else
13277 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 23766 cat >conftest.$ac_ext <<_ACEOF
23767/* confdefs.h. */
23768_ACEOF
23769cat confdefs.h >>conftest.$ac_ext
23770cat >>conftest.$ac_ext <<_ACEOF
13278/* end confdefs.h. */ 23771/* end confdefs.h. */
13279 23772
13280#include <sys/types.h> 23773#include <sys/types.h>
@@ -13301,28 +23794,56 @@ main ()
13301 return 0; 23794 return 0;
13302} 23795}
13303_ACEOF 23796_ACEOF
13304if ac_fn_c_try_run "$LINENO"; then : 23797rm -f conftest$ac_exeext
13305 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 23798if { (ac_try="$ac_link"
13306$as_echo "yes" >&6; } 23799case "(($ac_try" in
23800 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23801 *) ac_try_echo=$ac_try;;
23802esac
23803eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23804 (eval "$ac_link") 2>&5
23805 ac_status=$?
23806 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23807 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
23808 { (case "(($ac_try" in
23809 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23810 *) ac_try_echo=$ac_try;;
23811esac
23812eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23813 (eval "$ac_try") 2>&5
23814 ac_status=$?
23815 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23816 (exit $ac_status); }; }; then
23817 { echo "$as_me:$LINENO: result: yes" >&5
23818echo "${ECHO_T}yes" >&6; }
13307 rlimit_nofile_zero_works=yes 23819 rlimit_nofile_zero_works=yes
13308else 23820else
13309 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 23821 echo "$as_me: program exited with status $ac_status" >&5
13310$as_echo "no" >&6; } 23822echo "$as_me: failed program was:" >&5
23823sed 's/^/| /' conftest.$ac_ext >&5
23824
23825( exit $ac_status )
23826{ echo "$as_me:$LINENO: result: no" >&5
23827echo "${ECHO_T}no" >&6; }
13311 rlimit_nofile_zero_works=no 23828 rlimit_nofile_zero_works=no
13312fi 23829fi
13313rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 23830rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
13314 conftest.$ac_objext conftest.beam conftest.$ac_ext
13315fi 23831fi
13316 23832
13317 23833
13318{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if setrlimit RLIMIT_FSIZE works" >&5 23834
13319$as_echo_n "checking if setrlimit RLIMIT_FSIZE works... " >&6; } 23835{ echo "$as_me:$LINENO: checking if setrlimit RLIMIT_FSIZE works" >&5
13320if test "$cross_compiling" = yes; then : 23836echo $ECHO_N "checking if setrlimit RLIMIT_FSIZE works... $ECHO_C" >&6; }
13321 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: assuming yes" >&5 23837if test "$cross_compiling" = yes; then
13322$as_echo "$as_me: WARNING: cross compiling: assuming yes" >&2;} 23838 { echo "$as_me:$LINENO: WARNING: cross compiling: assuming yes" >&5
23839echo "$as_me: WARNING: cross compiling: assuming yes" >&2;}
13323 23840
13324else 23841else
13325 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 23842 cat >conftest.$ac_ext <<_ACEOF
23843/* confdefs.h. */
23844_ACEOF
23845cat confdefs.h >>conftest.$ac_ext
23846cat >>conftest.$ac_ext <<_ACEOF
13326/* end confdefs.h. */ 23847/* end confdefs.h. */
13327 23848
13328#include <sys/types.h> 23849#include <sys/types.h>
@@ -13342,38 +23863,72 @@ main ()
13342 return 0; 23863 return 0;
13343} 23864}
13344_ACEOF 23865_ACEOF
13345if ac_fn_c_try_run "$LINENO"; then : 23866rm -f conftest$ac_exeext
13346 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 23867if { (ac_try="$ac_link"
13347$as_echo "yes" >&6; } 23868case "(($ac_try" in
23869 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23870 *) ac_try_echo=$ac_try;;
23871esac
23872eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23873 (eval "$ac_link") 2>&5
23874 ac_status=$?
23875 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23876 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
23877 { (case "(($ac_try" in
23878 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23879 *) ac_try_echo=$ac_try;;
23880esac
23881eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
23882 (eval "$ac_try") 2>&5
23883 ac_status=$?
23884 echo "$as_me:$LINENO: \$? = $ac_status" >&5
23885 (exit $ac_status); }; }; then
23886 { echo "$as_me:$LINENO: result: yes" >&5
23887echo "${ECHO_T}yes" >&6; }
13348else 23888else
13349 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 23889 echo "$as_me: program exited with status $ac_status" >&5
13350$as_echo "no" >&6; } 23890echo "$as_me: failed program was:" >&5
23891sed 's/^/| /' conftest.$ac_ext >&5
23892
23893( exit $ac_status )
23894{ echo "$as_me:$LINENO: result: no" >&5
23895echo "${ECHO_T}no" >&6; }
13351 23896
13352$as_echo "#define SANDBOX_SKIP_RLIMIT_FSIZE 1" >>confdefs.h 23897cat >>confdefs.h <<\_ACEOF
23898#define SANDBOX_SKIP_RLIMIT_FSIZE 1
23899_ACEOF
13353 23900
13354fi 23901fi
13355rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 23902rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
13356 conftest.$ac_objext conftest.beam conftest.$ac_ext
13357fi 23903fi
13358 23904
13359 23905
23906
13360if test "x$sandbox_arg" = "xsystrace" || \ 23907if test "x$sandbox_arg" = "xsystrace" || \
13361 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then 23908 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
13362 test "x$have_systr_policy_kill" != "x1" && \ 23909 test "x$have_systr_policy_kill" != "x1" && \
13363 as_fn_error $? "systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support" "$LINENO" 5 23910 { { echo "$as_me:$LINENO: error: systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support" >&5
23911echo "$as_me: error: systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support" >&2;}
23912 { (exit 1); exit 1; }; }
13364 SANDBOX_STYLE="systrace" 23913 SANDBOX_STYLE="systrace"
13365 23914
13366$as_echo "#define SANDBOX_SYSTRACE 1" >>confdefs.h 23915cat >>confdefs.h <<\_ACEOF
23916#define SANDBOX_SYSTRACE 1
23917_ACEOF
13367 23918
13368elif test "x$sandbox_arg" = "xdarwin" || \ 23919elif test "x$sandbox_arg" = "xdarwin" || \
13369 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \ 23920 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
13370 test "x$ac_cv_header_sandbox_h" = "xyes") ; then 23921 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
13371 test "x$ac_cv_func_sandbox_init" != "xyes" -o \ 23922 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
13372 "x$ac_cv_header_sandbox_h" != "xyes" && \ 23923 "x$ac_cv_header_sandbox_h" != "xyes" && \
13373 as_fn_error $? "Darwin seatbelt sandbox requires sandbox.h and sandbox_init function" "$LINENO" 5 23924 { { echo "$as_me:$LINENO: error: Darwin seatbelt sandbox requires sandbox.h and sandbox_init function" >&5
23925echo "$as_me: error: Darwin seatbelt sandbox requires sandbox.h and sandbox_init function" >&2;}
23926 { (exit 1); exit 1; }; }
13374 SANDBOX_STYLE="darwin" 23927 SANDBOX_STYLE="darwin"
13375 23928
13376$as_echo "#define SANDBOX_DARWIN 1" >>confdefs.h 23929cat >>confdefs.h <<\_ACEOF
23930#define SANDBOX_DARWIN 1
23931_ACEOF
13377 23932
13378elif test "x$sandbox_arg" = "xseccomp_filter" || \ 23933elif test "x$sandbox_arg" = "xseccomp_filter" || \
13379 ( test -z "$sandbox_arg" && \ 23934 ( test -z "$sandbox_arg" && \
@@ -13385,49 +23940,75 @@ elif test "x$sandbox_arg" = "xseccomp_filter" || \
13385 test "x$have_linux_no_new_privs" = "x1" && \ 23940 test "x$have_linux_no_new_privs" = "x1" && \
13386 test "x$ac_cv_func_prctl" = "xyes" ) ; then 23941 test "x$ac_cv_func_prctl" = "xyes" ) ; then
13387 test "x$seccomp_audit_arch" = "x" && \ 23942 test "x$seccomp_audit_arch" = "x" && \
13388 as_fn_error $? "seccomp_filter sandbox not supported on $host" "$LINENO" 5 23943 { { echo "$as_me:$LINENO: error: seccomp_filter sandbox not supported on $host" >&5
23944echo "$as_me: error: seccomp_filter sandbox not supported on $host" >&2;}
23945 { (exit 1); exit 1; }; }
13389 test "x$have_linux_no_new_privs" != "x1" && \ 23946 test "x$have_linux_no_new_privs" != "x1" && \
13390 as_fn_error $? "seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS" "$LINENO" 5 23947 { { echo "$as_me:$LINENO: error: seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS" >&5
23948echo "$as_me: error: seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS" >&2;}
23949 { (exit 1); exit 1; }; }
13391 test "x$have_seccomp_filter" != "x1" && \ 23950 test "x$have_seccomp_filter" != "x1" && \
13392 as_fn_error $? "seccomp_filter sandbox requires seccomp headers" "$LINENO" 5 23951 { { echo "$as_me:$LINENO: error: seccomp_filter sandbox requires seccomp headers" >&5
23952echo "$as_me: error: seccomp_filter sandbox requires seccomp headers" >&2;}
23953 { (exit 1); exit 1; }; }
13393 test "x$ac_cv_func_prctl" != "xyes" && \ 23954 test "x$ac_cv_func_prctl" != "xyes" && \
13394 as_fn_error $? "seccomp_filter sandbox requires prctl function" "$LINENO" 5 23955 { { echo "$as_me:$LINENO: error: seccomp_filter sandbox requires prctl function" >&5
23956echo "$as_me: error: seccomp_filter sandbox requires prctl function" >&2;}
23957 { (exit 1); exit 1; }; }
13395 SANDBOX_STYLE="seccomp_filter" 23958 SANDBOX_STYLE="seccomp_filter"
13396 23959
13397$as_echo "#define SANDBOX_SECCOMP_FILTER 1" >>confdefs.h 23960cat >>confdefs.h <<\_ACEOF
23961#define SANDBOX_SECCOMP_FILTER 1
23962_ACEOF
13398 23963
13399elif test "x$sandbox_arg" = "xcapsicum" || \ 23964elif test "x$sandbox_arg" = "xcapsicum" || \
13400 ( test -z "$sandbox_arg" && \ 23965 ( test -z "$sandbox_arg" && \
13401 test "x$ac_cv_header_sys_capability_h" = "xyes" && \ 23966 test "x$ac_cv_header_sys_capability_h" = "xyes" && \
13402 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then 23967 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then
13403 test "x$ac_cv_header_sys_capability_h" != "xyes" && \ 23968 test "x$ac_cv_header_sys_capability_h" != "xyes" && \
13404 as_fn_error $? "capsicum sandbox requires sys/capability.h header" "$LINENO" 5 23969 { { echo "$as_me:$LINENO: error: capsicum sandbox requires sys/capability.h header" >&5
23970echo "$as_me: error: capsicum sandbox requires sys/capability.h header" >&2;}
23971 { (exit 1); exit 1; }; }
13405 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \ 23972 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \
13406 as_fn_error $? "capsicum sandbox requires cap_rights_limit function" "$LINENO" 5 23973 { { echo "$as_me:$LINENO: error: capsicum sandbox requires cap_rights_limit function" >&5
23974echo "$as_me: error: capsicum sandbox requires cap_rights_limit function" >&2;}
23975 { (exit 1); exit 1; }; }
13407 SANDBOX_STYLE="capsicum" 23976 SANDBOX_STYLE="capsicum"
13408 23977
13409$as_echo "#define SANDBOX_CAPSICUM 1" >>confdefs.h 23978cat >>confdefs.h <<\_ACEOF
23979#define SANDBOX_CAPSICUM 1
23980_ACEOF
13410 23981
13411elif test "x$sandbox_arg" = "xrlimit" || \ 23982elif test "x$sandbox_arg" = "xrlimit" || \
13412 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \ 23983 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
13413 test "x$select_works_with_rlimit" = "xyes" && \ 23984 test "x$select_works_with_rlimit" = "xyes" && \
13414 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then 23985 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
13415 test "x$ac_cv_func_setrlimit" != "xyes" && \ 23986 test "x$ac_cv_func_setrlimit" != "xyes" && \
13416 as_fn_error $? "rlimit sandbox requires setrlimit function" "$LINENO" 5 23987 { { echo "$as_me:$LINENO: error: rlimit sandbox requires setrlimit function" >&5
23988echo "$as_me: error: rlimit sandbox requires setrlimit function" >&2;}
23989 { (exit 1); exit 1; }; }
13417 test "x$select_works_with_rlimit" != "xyes" && \ 23990 test "x$select_works_with_rlimit" != "xyes" && \
13418 as_fn_error $? "rlimit sandbox requires select to work with rlimit" "$LINENO" 5 23991 { { echo "$as_me:$LINENO: error: rlimit sandbox requires select to work with rlimit" >&5
23992echo "$as_me: error: rlimit sandbox requires select to work with rlimit" >&2;}
23993 { (exit 1); exit 1; }; }
13419 SANDBOX_STYLE="rlimit" 23994 SANDBOX_STYLE="rlimit"
13420 23995
13421$as_echo "#define SANDBOX_RLIMIT 1" >>confdefs.h 23996cat >>confdefs.h <<\_ACEOF
23997#define SANDBOX_RLIMIT 1
23998_ACEOF
13422 23999
13423elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \ 24000elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
13424 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then 24001 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
13425 SANDBOX_STYLE="none" 24002 SANDBOX_STYLE="none"
13426 24003
13427$as_echo "#define SANDBOX_NULL 1" >>confdefs.h 24004cat >>confdefs.h <<\_ACEOF
24005#define SANDBOX_NULL 1
24006_ACEOF
13428 24007
13429else 24008else
13430 as_fn_error $? "unsupported --with-sandbox" "$LINENO" 5 24009 { { echo "$as_me:$LINENO: error: unsupported --with-sandbox" >&5
24010echo "$as_me: error: unsupported --with-sandbox" >&2;}
24011 { (exit 1); exit 1; }; }
13431fi 24012fi
13432 24013
13433# Cheap hack to ensure NEWS-OS libraries are arranged right. 24014# Cheap hack to ensure NEWS-OS libraries are arranged right.
@@ -13436,8 +24017,60 @@ if test ! -z "$SONY" ; then
13436fi 24017fi
13437 24018
13438# Check for long long datatypes 24019# Check for long long datatypes
13439ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default" 24020{ echo "$as_me:$LINENO: checking for long long" >&5
13440if test "x$ac_cv_type_long_long" = xyes; then : 24021echo $ECHO_N "checking for long long... $ECHO_C" >&6; }
24022if test "${ac_cv_type_long_long+set}" = set; then
24023 echo $ECHO_N "(cached) $ECHO_C" >&6
24024else
24025 cat >conftest.$ac_ext <<_ACEOF
24026/* confdefs.h. */
24027_ACEOF
24028cat confdefs.h >>conftest.$ac_ext
24029cat >>conftest.$ac_ext <<_ACEOF
24030/* end confdefs.h. */
24031$ac_includes_default
24032typedef long long ac__type_new_;
24033int
24034main ()
24035{
24036if ((ac__type_new_ *) 0)
24037 return 0;
24038if (sizeof (ac__type_new_))
24039 return 0;
24040 ;
24041 return 0;
24042}
24043_ACEOF
24044rm -f conftest.$ac_objext
24045if { (ac_try="$ac_compile"
24046case "(($ac_try" in
24047 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24048 *) ac_try_echo=$ac_try;;
24049esac
24050eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24051 (eval "$ac_compile") 2>conftest.er1
24052 ac_status=$?
24053 grep -v '^ *+' conftest.er1 >conftest.err
24054 rm -f conftest.er1
24055 cat conftest.err >&5
24056 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24057 (exit $ac_status); } && {
24058 test -z "$ac_c_werror_flag" ||
24059 test ! -s conftest.err
24060 } && test -s conftest.$ac_objext; then
24061 ac_cv_type_long_long=yes
24062else
24063 echo "$as_me: failed program was:" >&5
24064sed 's/^/| /' conftest.$ac_ext >&5
24065
24066 ac_cv_type_long_long=no
24067fi
24068
24069rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24070fi
24071{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
24072echo "${ECHO_T}$ac_cv_type_long_long" >&6; }
24073if test $ac_cv_type_long_long = yes; then
13441 24074
13442cat >>confdefs.h <<_ACEOF 24075cat >>confdefs.h <<_ACEOF
13443#define HAVE_LONG_LONG 1 24076#define HAVE_LONG_LONG 1
@@ -13445,8 +24078,60 @@ _ACEOF
13445 24078
13446 24079
13447fi 24080fi
13448ac_fn_c_check_type "$LINENO" "unsigned long long" "ac_cv_type_unsigned_long_long" "$ac_includes_default" 24081{ echo "$as_me:$LINENO: checking for unsigned long long" >&5
13449if test "x$ac_cv_type_unsigned_long_long" = xyes; then : 24082echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6; }
24083if test "${ac_cv_type_unsigned_long_long+set}" = set; then
24084 echo $ECHO_N "(cached) $ECHO_C" >&6
24085else
24086 cat >conftest.$ac_ext <<_ACEOF
24087/* confdefs.h. */
24088_ACEOF
24089cat confdefs.h >>conftest.$ac_ext
24090cat >>conftest.$ac_ext <<_ACEOF
24091/* end confdefs.h. */
24092$ac_includes_default
24093typedef unsigned long long ac__type_new_;
24094int
24095main ()
24096{
24097if ((ac__type_new_ *) 0)
24098 return 0;
24099if (sizeof (ac__type_new_))
24100 return 0;
24101 ;
24102 return 0;
24103}
24104_ACEOF
24105rm -f conftest.$ac_objext
24106if { (ac_try="$ac_compile"
24107case "(($ac_try" in
24108 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24109 *) ac_try_echo=$ac_try;;
24110esac
24111eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24112 (eval "$ac_compile") 2>conftest.er1
24113 ac_status=$?
24114 grep -v '^ *+' conftest.er1 >conftest.err
24115 rm -f conftest.er1
24116 cat conftest.err >&5
24117 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24118 (exit $ac_status); } && {
24119 test -z "$ac_c_werror_flag" ||
24120 test ! -s conftest.err
24121 } && test -s conftest.$ac_objext; then
24122 ac_cv_type_unsigned_long_long=yes
24123else
24124 echo "$as_me: failed program was:" >&5
24125sed 's/^/| /' conftest.$ac_ext >&5
24126
24127 ac_cv_type_unsigned_long_long=no
24128fi
24129
24130rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24131fi
24132{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5
24133echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6; }
24134if test $ac_cv_type_unsigned_long_long = yes; then
13450 24135
13451cat >>confdefs.h <<_ACEOF 24136cat >>confdefs.h <<_ACEOF
13452#define HAVE_UNSIGNED_LONG_LONG 1 24137#define HAVE_UNSIGNED_LONG_LONG 1
@@ -13454,8 +24139,60 @@ _ACEOF
13454 24139
13455 24140
13456fi 24141fi
13457ac_fn_c_check_type "$LINENO" "long double" "ac_cv_type_long_double" "$ac_includes_default" 24142{ echo "$as_me:$LINENO: checking for long double" >&5
13458if test "x$ac_cv_type_long_double" = xyes; then : 24143echo $ECHO_N "checking for long double... $ECHO_C" >&6; }
24144if test "${ac_cv_type_long_double+set}" = set; then
24145 echo $ECHO_N "(cached) $ECHO_C" >&6
24146else
24147 cat >conftest.$ac_ext <<_ACEOF
24148/* confdefs.h. */
24149_ACEOF
24150cat confdefs.h >>conftest.$ac_ext
24151cat >>conftest.$ac_ext <<_ACEOF
24152/* end confdefs.h. */
24153$ac_includes_default
24154typedef long double ac__type_new_;
24155int
24156main ()
24157{
24158if ((ac__type_new_ *) 0)
24159 return 0;
24160if (sizeof (ac__type_new_))
24161 return 0;
24162 ;
24163 return 0;
24164}
24165_ACEOF
24166rm -f conftest.$ac_objext
24167if { (ac_try="$ac_compile"
24168case "(($ac_try" in
24169 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24170 *) ac_try_echo=$ac_try;;
24171esac
24172eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24173 (eval "$ac_compile") 2>conftest.er1
24174 ac_status=$?
24175 grep -v '^ *+' conftest.er1 >conftest.err
24176 rm -f conftest.er1
24177 cat conftest.err >&5
24178 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24179 (exit $ac_status); } && {
24180 test -z "$ac_c_werror_flag" ||
24181 test ! -s conftest.err
24182 } && test -s conftest.$ac_objext; then
24183 ac_cv_type_long_double=yes
24184else
24185 echo "$as_me: failed program was:" >&5
24186sed 's/^/| /' conftest.$ac_ext >&5
24187
24188 ac_cv_type_long_double=no
24189fi
24190
24191rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24192fi
24193{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5
24194echo "${ECHO_T}$ac_cv_type_long_double" >&6; }
24195if test $ac_cv_type_long_double = yes; then
13459 24196
13460cat >>confdefs.h <<_ACEOF 24197cat >>confdefs.h <<_ACEOF
13461#define HAVE_LONG_DOUBLE 1 24198#define HAVE_LONG_DOUBLE 1
@@ -13466,31 +24203,403 @@ fi
13466 24203
13467 24204
13468# Check datatype sizes 24205# Check datatype sizes
24206{ echo "$as_me:$LINENO: checking for short int" >&5
24207echo $ECHO_N "checking for short int... $ECHO_C" >&6; }
24208if test "${ac_cv_type_short_int+set}" = set; then
24209 echo $ECHO_N "(cached) $ECHO_C" >&6
24210else
24211 cat >conftest.$ac_ext <<_ACEOF
24212/* confdefs.h. */
24213_ACEOF
24214cat confdefs.h >>conftest.$ac_ext
24215cat >>conftest.$ac_ext <<_ACEOF
24216/* end confdefs.h. */
24217$ac_includes_default
24218typedef short int ac__type_new_;
24219int
24220main ()
24221{
24222if ((ac__type_new_ *) 0)
24223 return 0;
24224if (sizeof (ac__type_new_))
24225 return 0;
24226 ;
24227 return 0;
24228}
24229_ACEOF
24230rm -f conftest.$ac_objext
24231if { (ac_try="$ac_compile"
24232case "(($ac_try" in
24233 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24234 *) ac_try_echo=$ac_try;;
24235esac
24236eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24237 (eval "$ac_compile") 2>conftest.er1
24238 ac_status=$?
24239 grep -v '^ *+' conftest.er1 >conftest.err
24240 rm -f conftest.er1
24241 cat conftest.err >&5
24242 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24243 (exit $ac_status); } && {
24244 test -z "$ac_c_werror_flag" ||
24245 test ! -s conftest.err
24246 } && test -s conftest.$ac_objext; then
24247 ac_cv_type_short_int=yes
24248else
24249 echo "$as_me: failed program was:" >&5
24250sed 's/^/| /' conftest.$ac_ext >&5
24251
24252 ac_cv_type_short_int=no
24253fi
24254
24255rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24256fi
24257{ echo "$as_me:$LINENO: result: $ac_cv_type_short_int" >&5
24258echo "${ECHO_T}$ac_cv_type_short_int" >&6; }
24259
13469# The cast to long int works around a bug in the HP C Compiler 24260# The cast to long int works around a bug in the HP C Compiler
13470# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 24261# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
13471# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 24262# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
13472# This bug is HP SR number 8606223364. 24263# This bug is HP SR number 8606223364.
13473{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short int" >&5 24264{ echo "$as_me:$LINENO: checking size of short int" >&5
13474$as_echo_n "checking size of short int... " >&6; } 24265echo $ECHO_N "checking size of short int... $ECHO_C" >&6; }
13475if ${ac_cv_sizeof_short_int+:} false; then : 24266if test "${ac_cv_sizeof_short_int+set}" = set; then
13476 $as_echo_n "(cached) " >&6 24267 echo $ECHO_N "(cached) $ECHO_C" >&6
24268else
24269 if test "$cross_compiling" = yes; then
24270 # Depending upon the size, compute the lo and hi bounds.
24271cat >conftest.$ac_ext <<_ACEOF
24272/* confdefs.h. */
24273_ACEOF
24274cat confdefs.h >>conftest.$ac_ext
24275cat >>conftest.$ac_ext <<_ACEOF
24276/* end confdefs.h. */
24277$ac_includes_default
24278 typedef short int ac__type_sizeof_;
24279int
24280main ()
24281{
24282static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
24283test_array [0] = 0
24284
24285 ;
24286 return 0;
24287}
24288_ACEOF
24289rm -f conftest.$ac_objext
24290if { (ac_try="$ac_compile"
24291case "(($ac_try" in
24292 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24293 *) ac_try_echo=$ac_try;;
24294esac
24295eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24296 (eval "$ac_compile") 2>conftest.er1
24297 ac_status=$?
24298 grep -v '^ *+' conftest.er1 >conftest.err
24299 rm -f conftest.er1
24300 cat conftest.err >&5
24301 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24302 (exit $ac_status); } && {
24303 test -z "$ac_c_werror_flag" ||
24304 test ! -s conftest.err
24305 } && test -s conftest.$ac_objext; then
24306 ac_lo=0 ac_mid=0
24307 while :; do
24308 cat >conftest.$ac_ext <<_ACEOF
24309/* confdefs.h. */
24310_ACEOF
24311cat confdefs.h >>conftest.$ac_ext
24312cat >>conftest.$ac_ext <<_ACEOF
24313/* end confdefs.h. */
24314$ac_includes_default
24315 typedef short int ac__type_sizeof_;
24316int
24317main ()
24318{
24319static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
24320test_array [0] = 0
24321
24322 ;
24323 return 0;
24324}
24325_ACEOF
24326rm -f conftest.$ac_objext
24327if { (ac_try="$ac_compile"
24328case "(($ac_try" in
24329 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24330 *) ac_try_echo=$ac_try;;
24331esac
24332eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24333 (eval "$ac_compile") 2>conftest.er1
24334 ac_status=$?
24335 grep -v '^ *+' conftest.er1 >conftest.err
24336 rm -f conftest.er1
24337 cat conftest.err >&5
24338 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24339 (exit $ac_status); } && {
24340 test -z "$ac_c_werror_flag" ||
24341 test ! -s conftest.err
24342 } && test -s conftest.$ac_objext; then
24343 ac_hi=$ac_mid; break
24344else
24345 echo "$as_me: failed program was:" >&5
24346sed 's/^/| /' conftest.$ac_ext >&5
24347
24348 ac_lo=`expr $ac_mid + 1`
24349 if test $ac_lo -le $ac_mid; then
24350 ac_lo= ac_hi=
24351 break
24352 fi
24353 ac_mid=`expr 2 '*' $ac_mid + 1`
24354fi
24355
24356rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24357 done
24358else
24359 echo "$as_me: failed program was:" >&5
24360sed 's/^/| /' conftest.$ac_ext >&5
24361
24362 cat >conftest.$ac_ext <<_ACEOF
24363/* confdefs.h. */
24364_ACEOF
24365cat confdefs.h >>conftest.$ac_ext
24366cat >>conftest.$ac_ext <<_ACEOF
24367/* end confdefs.h. */
24368$ac_includes_default
24369 typedef short int ac__type_sizeof_;
24370int
24371main ()
24372{
24373static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
24374test_array [0] = 0
24375
24376 ;
24377 return 0;
24378}
24379_ACEOF
24380rm -f conftest.$ac_objext
24381if { (ac_try="$ac_compile"
24382case "(($ac_try" in
24383 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24384 *) ac_try_echo=$ac_try;;
24385esac
24386eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24387 (eval "$ac_compile") 2>conftest.er1
24388 ac_status=$?
24389 grep -v '^ *+' conftest.er1 >conftest.err
24390 rm -f conftest.er1
24391 cat conftest.err >&5
24392 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24393 (exit $ac_status); } && {
24394 test -z "$ac_c_werror_flag" ||
24395 test ! -s conftest.err
24396 } && test -s conftest.$ac_objext; then
24397 ac_hi=-1 ac_mid=-1
24398 while :; do
24399 cat >conftest.$ac_ext <<_ACEOF
24400/* confdefs.h. */
24401_ACEOF
24402cat confdefs.h >>conftest.$ac_ext
24403cat >>conftest.$ac_ext <<_ACEOF
24404/* end confdefs.h. */
24405$ac_includes_default
24406 typedef short int ac__type_sizeof_;
24407int
24408main ()
24409{
24410static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
24411test_array [0] = 0
24412
24413 ;
24414 return 0;
24415}
24416_ACEOF
24417rm -f conftest.$ac_objext
24418if { (ac_try="$ac_compile"
24419case "(($ac_try" in
24420 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24421 *) ac_try_echo=$ac_try;;
24422esac
24423eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24424 (eval "$ac_compile") 2>conftest.er1
24425 ac_status=$?
24426 grep -v '^ *+' conftest.er1 >conftest.err
24427 rm -f conftest.er1
24428 cat conftest.err >&5
24429 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24430 (exit $ac_status); } && {
24431 test -z "$ac_c_werror_flag" ||
24432 test ! -s conftest.err
24433 } && test -s conftest.$ac_objext; then
24434 ac_lo=$ac_mid; break
13477else 24435else
13478 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short int))" "ac_cv_sizeof_short_int" "$ac_includes_default"; then : 24436 echo "$as_me: failed program was:" >&5
24437sed 's/^/| /' conftest.$ac_ext >&5
13479 24438
24439 ac_hi=`expr '(' $ac_mid ')' - 1`
24440 if test $ac_mid -le $ac_hi; then
24441 ac_lo= ac_hi=
24442 break
24443 fi
24444 ac_mid=`expr 2 '*' $ac_mid`
24445fi
24446
24447rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24448 done
13480else 24449else
13481 if test "$ac_cv_type_short_int" = yes; then 24450 echo "$as_me: failed program was:" >&5
13482 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 24451sed 's/^/| /' conftest.$ac_ext >&5
13483$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 24452
13484as_fn_error 77 "cannot compute sizeof (short int) 24453 ac_lo= ac_hi=
13485See \`config.log' for more details" "$LINENO" 5; } 24454fi
24455
24456rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24457fi
24458
24459rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24460# Binary search between lo and hi bounds.
24461while test "x$ac_lo" != "x$ac_hi"; do
24462 ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
24463 cat >conftest.$ac_ext <<_ACEOF
24464/* confdefs.h. */
24465_ACEOF
24466cat confdefs.h >>conftest.$ac_ext
24467cat >>conftest.$ac_ext <<_ACEOF
24468/* end confdefs.h. */
24469$ac_includes_default
24470 typedef short int ac__type_sizeof_;
24471int
24472main ()
24473{
24474static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
24475test_array [0] = 0
24476
24477 ;
24478 return 0;
24479}
24480_ACEOF
24481rm -f conftest.$ac_objext
24482if { (ac_try="$ac_compile"
24483case "(($ac_try" in
24484 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24485 *) ac_try_echo=$ac_try;;
24486esac
24487eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24488 (eval "$ac_compile") 2>conftest.er1
24489 ac_status=$?
24490 grep -v '^ *+' conftest.er1 >conftest.err
24491 rm -f conftest.er1
24492 cat conftest.err >&5
24493 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24494 (exit $ac_status); } && {
24495 test -z "$ac_c_werror_flag" ||
24496 test ! -s conftest.err
24497 } && test -s conftest.$ac_objext; then
24498 ac_hi=$ac_mid
24499else
24500 echo "$as_me: failed program was:" >&5
24501sed 's/^/| /' conftest.$ac_ext >&5
24502
24503 ac_lo=`expr '(' $ac_mid ')' + 1`
24504fi
24505
24506rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24507done
24508case $ac_lo in
24509?*) ac_cv_sizeof_short_int=$ac_lo;;
24510'') if test "$ac_cv_type_short_int" = yes; then
24511 { { echo "$as_me:$LINENO: error: cannot compute sizeof (short int)
24512See \`config.log' for more details." >&5
24513echo "$as_me: error: cannot compute sizeof (short int)
24514See \`config.log' for more details." >&2;}
24515 { (exit 77); exit 77; }; }
24516 else
24517 ac_cv_sizeof_short_int=0
24518 fi ;;
24519esac
24520else
24521 cat >conftest.$ac_ext <<_ACEOF
24522/* confdefs.h. */
24523_ACEOF
24524cat confdefs.h >>conftest.$ac_ext
24525cat >>conftest.$ac_ext <<_ACEOF
24526/* end confdefs.h. */
24527$ac_includes_default
24528 typedef short int ac__type_sizeof_;
24529static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
24530static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
24531#include <stdio.h>
24532#include <stdlib.h>
24533int
24534main ()
24535{
24536
24537 FILE *f = fopen ("conftest.val", "w");
24538 if (! f)
24539 return 1;
24540 if (((long int) (sizeof (ac__type_sizeof_))) < 0)
24541 {
24542 long int i = longval ();
24543 if (i != ((long int) (sizeof (ac__type_sizeof_))))
24544 return 1;
24545 fprintf (f, "%ld\n", i);
24546 }
24547 else
24548 {
24549 unsigned long int i = ulongval ();
24550 if (i != ((long int) (sizeof (ac__type_sizeof_))))
24551 return 1;
24552 fprintf (f, "%lu\n", i);
24553 }
24554 return ferror (f) || fclose (f) != 0;
24555
24556 ;
24557 return 0;
24558}
24559_ACEOF
24560rm -f conftest$ac_exeext
24561if { (ac_try="$ac_link"
24562case "(($ac_try" in
24563 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24564 *) ac_try_echo=$ac_try;;
24565esac
24566eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24567 (eval "$ac_link") 2>&5
24568 ac_status=$?
24569 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24570 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
24571 { (case "(($ac_try" in
24572 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24573 *) ac_try_echo=$ac_try;;
24574esac
24575eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24576 (eval "$ac_try") 2>&5
24577 ac_status=$?
24578 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24579 (exit $ac_status); }; }; then
24580 ac_cv_sizeof_short_int=`cat conftest.val`
24581else
24582 echo "$as_me: program exited with status $ac_status" >&5
24583echo "$as_me: failed program was:" >&5
24584sed 's/^/| /' conftest.$ac_ext >&5
24585
24586( exit $ac_status )
24587if test "$ac_cv_type_short_int" = yes; then
24588 { { echo "$as_me:$LINENO: error: cannot compute sizeof (short int)
24589See \`config.log' for more details." >&5
24590echo "$as_me: error: cannot compute sizeof (short int)
24591See \`config.log' for more details." >&2;}
24592 { (exit 77); exit 77; }; }
13486 else 24593 else
13487 ac_cv_sizeof_short_int=0 24594 ac_cv_sizeof_short_int=0
13488 fi 24595 fi
13489fi 24596fi
13490 24597rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
24598fi
24599rm -f conftest.val
13491fi 24600fi
13492{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short_int" >&5 24601{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_short_int" >&5
13493$as_echo "$ac_cv_sizeof_short_int" >&6; } 24602echo "${ECHO_T}$ac_cv_sizeof_short_int" >&6; }
13494 24603
13495 24604
13496 24605
@@ -13499,31 +24608,403 @@ cat >>confdefs.h <<_ACEOF
13499_ACEOF 24608_ACEOF
13500 24609
13501 24610
24611{ echo "$as_me:$LINENO: checking for int" >&5
24612echo $ECHO_N "checking for int... $ECHO_C" >&6; }
24613if test "${ac_cv_type_int+set}" = set; then
24614 echo $ECHO_N "(cached) $ECHO_C" >&6
24615else
24616 cat >conftest.$ac_ext <<_ACEOF
24617/* confdefs.h. */
24618_ACEOF
24619cat confdefs.h >>conftest.$ac_ext
24620cat >>conftest.$ac_ext <<_ACEOF
24621/* end confdefs.h. */
24622$ac_includes_default
24623typedef int ac__type_new_;
24624int
24625main ()
24626{
24627if ((ac__type_new_ *) 0)
24628 return 0;
24629if (sizeof (ac__type_new_))
24630 return 0;
24631 ;
24632 return 0;
24633}
24634_ACEOF
24635rm -f conftest.$ac_objext
24636if { (ac_try="$ac_compile"
24637case "(($ac_try" in
24638 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24639 *) ac_try_echo=$ac_try;;
24640esac
24641eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24642 (eval "$ac_compile") 2>conftest.er1
24643 ac_status=$?
24644 grep -v '^ *+' conftest.er1 >conftest.err
24645 rm -f conftest.er1
24646 cat conftest.err >&5
24647 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24648 (exit $ac_status); } && {
24649 test -z "$ac_c_werror_flag" ||
24650 test ! -s conftest.err
24651 } && test -s conftest.$ac_objext; then
24652 ac_cv_type_int=yes
24653else
24654 echo "$as_me: failed program was:" >&5
24655sed 's/^/| /' conftest.$ac_ext >&5
24656
24657 ac_cv_type_int=no
24658fi
24659
24660rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24661fi
24662{ echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
24663echo "${ECHO_T}$ac_cv_type_int" >&6; }
24664
13502# The cast to long int works around a bug in the HP C Compiler 24665# The cast to long int works around a bug in the HP C Compiler
13503# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 24666# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
13504# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 24667# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
13505# This bug is HP SR number 8606223364. 24668# This bug is HP SR number 8606223364.
13506{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 24669{ echo "$as_me:$LINENO: checking size of int" >&5
13507$as_echo_n "checking size of int... " >&6; } 24670echo $ECHO_N "checking size of int... $ECHO_C" >&6; }
13508if ${ac_cv_sizeof_int+:} false; then : 24671if test "${ac_cv_sizeof_int+set}" = set; then
13509 $as_echo_n "(cached) " >&6 24672 echo $ECHO_N "(cached) $ECHO_C" >&6
13510else 24673else
13511 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : 24674 if test "$cross_compiling" = yes; then
24675 # Depending upon the size, compute the lo and hi bounds.
24676cat >conftest.$ac_ext <<_ACEOF
24677/* confdefs.h. */
24678_ACEOF
24679cat confdefs.h >>conftest.$ac_ext
24680cat >>conftest.$ac_ext <<_ACEOF
24681/* end confdefs.h. */
24682$ac_includes_default
24683 typedef int ac__type_sizeof_;
24684int
24685main ()
24686{
24687static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
24688test_array [0] = 0
13512 24689
24690 ;
24691 return 0;
24692}
24693_ACEOF
24694rm -f conftest.$ac_objext
24695if { (ac_try="$ac_compile"
24696case "(($ac_try" in
24697 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24698 *) ac_try_echo=$ac_try;;
24699esac
24700eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24701 (eval "$ac_compile") 2>conftest.er1
24702 ac_status=$?
24703 grep -v '^ *+' conftest.er1 >conftest.err
24704 rm -f conftest.er1
24705 cat conftest.err >&5
24706 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24707 (exit $ac_status); } && {
24708 test -z "$ac_c_werror_flag" ||
24709 test ! -s conftest.err
24710 } && test -s conftest.$ac_objext; then
24711 ac_lo=0 ac_mid=0
24712 while :; do
24713 cat >conftest.$ac_ext <<_ACEOF
24714/* confdefs.h. */
24715_ACEOF
24716cat confdefs.h >>conftest.$ac_ext
24717cat >>conftest.$ac_ext <<_ACEOF
24718/* end confdefs.h. */
24719$ac_includes_default
24720 typedef int ac__type_sizeof_;
24721int
24722main ()
24723{
24724static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
24725test_array [0] = 0
24726
24727 ;
24728 return 0;
24729}
24730_ACEOF
24731rm -f conftest.$ac_objext
24732if { (ac_try="$ac_compile"
24733case "(($ac_try" in
24734 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24735 *) ac_try_echo=$ac_try;;
24736esac
24737eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24738 (eval "$ac_compile") 2>conftest.er1
24739 ac_status=$?
24740 grep -v '^ *+' conftest.er1 >conftest.err
24741 rm -f conftest.er1
24742 cat conftest.err >&5
24743 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24744 (exit $ac_status); } && {
24745 test -z "$ac_c_werror_flag" ||
24746 test ! -s conftest.err
24747 } && test -s conftest.$ac_objext; then
24748 ac_hi=$ac_mid; break
24749else
24750 echo "$as_me: failed program was:" >&5
24751sed 's/^/| /' conftest.$ac_ext >&5
24752
24753 ac_lo=`expr $ac_mid + 1`
24754 if test $ac_lo -le $ac_mid; then
24755 ac_lo= ac_hi=
24756 break
24757 fi
24758 ac_mid=`expr 2 '*' $ac_mid + 1`
24759fi
24760
24761rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24762 done
24763else
24764 echo "$as_me: failed program was:" >&5
24765sed 's/^/| /' conftest.$ac_ext >&5
24766
24767 cat >conftest.$ac_ext <<_ACEOF
24768/* confdefs.h. */
24769_ACEOF
24770cat confdefs.h >>conftest.$ac_ext
24771cat >>conftest.$ac_ext <<_ACEOF
24772/* end confdefs.h. */
24773$ac_includes_default
24774 typedef int ac__type_sizeof_;
24775int
24776main ()
24777{
24778static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
24779test_array [0] = 0
24780
24781 ;
24782 return 0;
24783}
24784_ACEOF
24785rm -f conftest.$ac_objext
24786if { (ac_try="$ac_compile"
24787case "(($ac_try" in
24788 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24789 *) ac_try_echo=$ac_try;;
24790esac
24791eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24792 (eval "$ac_compile") 2>conftest.er1
24793 ac_status=$?
24794 grep -v '^ *+' conftest.er1 >conftest.err
24795 rm -f conftest.er1
24796 cat conftest.err >&5
24797 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24798 (exit $ac_status); } && {
24799 test -z "$ac_c_werror_flag" ||
24800 test ! -s conftest.err
24801 } && test -s conftest.$ac_objext; then
24802 ac_hi=-1 ac_mid=-1
24803 while :; do
24804 cat >conftest.$ac_ext <<_ACEOF
24805/* confdefs.h. */
24806_ACEOF
24807cat confdefs.h >>conftest.$ac_ext
24808cat >>conftest.$ac_ext <<_ACEOF
24809/* end confdefs.h. */
24810$ac_includes_default
24811 typedef int ac__type_sizeof_;
24812int
24813main ()
24814{
24815static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
24816test_array [0] = 0
24817
24818 ;
24819 return 0;
24820}
24821_ACEOF
24822rm -f conftest.$ac_objext
24823if { (ac_try="$ac_compile"
24824case "(($ac_try" in
24825 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24826 *) ac_try_echo=$ac_try;;
24827esac
24828eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24829 (eval "$ac_compile") 2>conftest.er1
24830 ac_status=$?
24831 grep -v '^ *+' conftest.er1 >conftest.err
24832 rm -f conftest.er1
24833 cat conftest.err >&5
24834 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24835 (exit $ac_status); } && {
24836 test -z "$ac_c_werror_flag" ||
24837 test ! -s conftest.err
24838 } && test -s conftest.$ac_objext; then
24839 ac_lo=$ac_mid; break
24840else
24841 echo "$as_me: failed program was:" >&5
24842sed 's/^/| /' conftest.$ac_ext >&5
24843
24844 ac_hi=`expr '(' $ac_mid ')' - 1`
24845 if test $ac_mid -le $ac_hi; then
24846 ac_lo= ac_hi=
24847 break
24848 fi
24849 ac_mid=`expr 2 '*' $ac_mid`
24850fi
24851
24852rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24853 done
24854else
24855 echo "$as_me: failed program was:" >&5
24856sed 's/^/| /' conftest.$ac_ext >&5
24857
24858 ac_lo= ac_hi=
24859fi
24860
24861rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24862fi
24863
24864rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24865# Binary search between lo and hi bounds.
24866while test "x$ac_lo" != "x$ac_hi"; do
24867 ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
24868 cat >conftest.$ac_ext <<_ACEOF
24869/* confdefs.h. */
24870_ACEOF
24871cat confdefs.h >>conftest.$ac_ext
24872cat >>conftest.$ac_ext <<_ACEOF
24873/* end confdefs.h. */
24874$ac_includes_default
24875 typedef int ac__type_sizeof_;
24876int
24877main ()
24878{
24879static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
24880test_array [0] = 0
24881
24882 ;
24883 return 0;
24884}
24885_ACEOF
24886rm -f conftest.$ac_objext
24887if { (ac_try="$ac_compile"
24888case "(($ac_try" in
24889 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24890 *) ac_try_echo=$ac_try;;
24891esac
24892eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24893 (eval "$ac_compile") 2>conftest.er1
24894 ac_status=$?
24895 grep -v '^ *+' conftest.er1 >conftest.err
24896 rm -f conftest.er1
24897 cat conftest.err >&5
24898 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24899 (exit $ac_status); } && {
24900 test -z "$ac_c_werror_flag" ||
24901 test ! -s conftest.err
24902 } && test -s conftest.$ac_objext; then
24903 ac_hi=$ac_mid
24904else
24905 echo "$as_me: failed program was:" >&5
24906sed 's/^/| /' conftest.$ac_ext >&5
24907
24908 ac_lo=`expr '(' $ac_mid ')' + 1`
24909fi
24910
24911rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24912done
24913case $ac_lo in
24914?*) ac_cv_sizeof_int=$ac_lo;;
24915'') if test "$ac_cv_type_int" = yes; then
24916 { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
24917See \`config.log' for more details." >&5
24918echo "$as_me: error: cannot compute sizeof (int)
24919See \`config.log' for more details." >&2;}
24920 { (exit 77); exit 77; }; }
24921 else
24922 ac_cv_sizeof_int=0
24923 fi ;;
24924esac
24925else
24926 cat >conftest.$ac_ext <<_ACEOF
24927/* confdefs.h. */
24928_ACEOF
24929cat confdefs.h >>conftest.$ac_ext
24930cat >>conftest.$ac_ext <<_ACEOF
24931/* end confdefs.h. */
24932$ac_includes_default
24933 typedef int ac__type_sizeof_;
24934static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
24935static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
24936#include <stdio.h>
24937#include <stdlib.h>
24938int
24939main ()
24940{
24941
24942 FILE *f = fopen ("conftest.val", "w");
24943 if (! f)
24944 return 1;
24945 if (((long int) (sizeof (ac__type_sizeof_))) < 0)
24946 {
24947 long int i = longval ();
24948 if (i != ((long int) (sizeof (ac__type_sizeof_))))
24949 return 1;
24950 fprintf (f, "%ld\n", i);
24951 }
24952 else
24953 {
24954 unsigned long int i = ulongval ();
24955 if (i != ((long int) (sizeof (ac__type_sizeof_))))
24956 return 1;
24957 fprintf (f, "%lu\n", i);
24958 }
24959 return ferror (f) || fclose (f) != 0;
24960
24961 ;
24962 return 0;
24963}
24964_ACEOF
24965rm -f conftest$ac_exeext
24966if { (ac_try="$ac_link"
24967case "(($ac_try" in
24968 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24969 *) ac_try_echo=$ac_try;;
24970esac
24971eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24972 (eval "$ac_link") 2>&5
24973 ac_status=$?
24974 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24975 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
24976 { (case "(($ac_try" in
24977 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
24978 *) ac_try_echo=$ac_try;;
24979esac
24980eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
24981 (eval "$ac_try") 2>&5
24982 ac_status=$?
24983 echo "$as_me:$LINENO: \$? = $ac_status" >&5
24984 (exit $ac_status); }; }; then
24985 ac_cv_sizeof_int=`cat conftest.val`
13513else 24986else
13514 if test "$ac_cv_type_int" = yes; then 24987 echo "$as_me: program exited with status $ac_status" >&5
13515 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 24988echo "$as_me: failed program was:" >&5
13516$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 24989sed 's/^/| /' conftest.$ac_ext >&5
13517as_fn_error 77 "cannot compute sizeof (int) 24990
13518See \`config.log' for more details" "$LINENO" 5; } 24991( exit $ac_status )
24992if test "$ac_cv_type_int" = yes; then
24993 { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
24994See \`config.log' for more details." >&5
24995echo "$as_me: error: cannot compute sizeof (int)
24996See \`config.log' for more details." >&2;}
24997 { (exit 77); exit 77; }; }
13519 else 24998 else
13520 ac_cv_sizeof_int=0 24999 ac_cv_sizeof_int=0
13521 fi 25000 fi
13522fi 25001fi
13523 25002rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
25003fi
25004rm -f conftest.val
13524fi 25005fi
13525{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 25006{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
13526$as_echo "$ac_cv_sizeof_int" >&6; } 25007echo "${ECHO_T}$ac_cv_sizeof_int" >&6; }
13527 25008
13528 25009
13529 25010
@@ -13532,31 +25013,403 @@ cat >>confdefs.h <<_ACEOF
13532_ACEOF 25013_ACEOF
13533 25014
13534 25015
25016{ echo "$as_me:$LINENO: checking for long int" >&5
25017echo $ECHO_N "checking for long int... $ECHO_C" >&6; }
25018if test "${ac_cv_type_long_int+set}" = set; then
25019 echo $ECHO_N "(cached) $ECHO_C" >&6
25020else
25021 cat >conftest.$ac_ext <<_ACEOF
25022/* confdefs.h. */
25023_ACEOF
25024cat confdefs.h >>conftest.$ac_ext
25025cat >>conftest.$ac_ext <<_ACEOF
25026/* end confdefs.h. */
25027$ac_includes_default
25028typedef long int ac__type_new_;
25029int
25030main ()
25031{
25032if ((ac__type_new_ *) 0)
25033 return 0;
25034if (sizeof (ac__type_new_))
25035 return 0;
25036 ;
25037 return 0;
25038}
25039_ACEOF
25040rm -f conftest.$ac_objext
25041if { (ac_try="$ac_compile"
25042case "(($ac_try" in
25043 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25044 *) ac_try_echo=$ac_try;;
25045esac
25046eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25047 (eval "$ac_compile") 2>conftest.er1
25048 ac_status=$?
25049 grep -v '^ *+' conftest.er1 >conftest.err
25050 rm -f conftest.er1
25051 cat conftest.err >&5
25052 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25053 (exit $ac_status); } && {
25054 test -z "$ac_c_werror_flag" ||
25055 test ! -s conftest.err
25056 } && test -s conftest.$ac_objext; then
25057 ac_cv_type_long_int=yes
25058else
25059 echo "$as_me: failed program was:" >&5
25060sed 's/^/| /' conftest.$ac_ext >&5
25061
25062 ac_cv_type_long_int=no
25063fi
25064
25065rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25066fi
25067{ echo "$as_me:$LINENO: result: $ac_cv_type_long_int" >&5
25068echo "${ECHO_T}$ac_cv_type_long_int" >&6; }
25069
13535# The cast to long int works around a bug in the HP C Compiler 25070# The cast to long int works around a bug in the HP C Compiler
13536# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 25071# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
13537# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 25072# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
13538# This bug is HP SR number 8606223364. 25073# This bug is HP SR number 8606223364.
13539{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long int" >&5 25074{ echo "$as_me:$LINENO: checking size of long int" >&5
13540$as_echo_n "checking size of long int... " >&6; } 25075echo $ECHO_N "checking size of long int... $ECHO_C" >&6; }
13541if ${ac_cv_sizeof_long_int+:} false; then : 25076if test "${ac_cv_sizeof_long_int+set}" = set; then
13542 $as_echo_n "(cached) " >&6 25077 echo $ECHO_N "(cached) $ECHO_C" >&6
25078else
25079 if test "$cross_compiling" = yes; then
25080 # Depending upon the size, compute the lo and hi bounds.
25081cat >conftest.$ac_ext <<_ACEOF
25082/* confdefs.h. */
25083_ACEOF
25084cat confdefs.h >>conftest.$ac_ext
25085cat >>conftest.$ac_ext <<_ACEOF
25086/* end confdefs.h. */
25087$ac_includes_default
25088 typedef long int ac__type_sizeof_;
25089int
25090main ()
25091{
25092static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
25093test_array [0] = 0
25094
25095 ;
25096 return 0;
25097}
25098_ACEOF
25099rm -f conftest.$ac_objext
25100if { (ac_try="$ac_compile"
25101case "(($ac_try" in
25102 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25103 *) ac_try_echo=$ac_try;;
25104esac
25105eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25106 (eval "$ac_compile") 2>conftest.er1
25107 ac_status=$?
25108 grep -v '^ *+' conftest.er1 >conftest.err
25109 rm -f conftest.er1
25110 cat conftest.err >&5
25111 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25112 (exit $ac_status); } && {
25113 test -z "$ac_c_werror_flag" ||
25114 test ! -s conftest.err
25115 } && test -s conftest.$ac_objext; then
25116 ac_lo=0 ac_mid=0
25117 while :; do
25118 cat >conftest.$ac_ext <<_ACEOF
25119/* confdefs.h. */
25120_ACEOF
25121cat confdefs.h >>conftest.$ac_ext
25122cat >>conftest.$ac_ext <<_ACEOF
25123/* end confdefs.h. */
25124$ac_includes_default
25125 typedef long int ac__type_sizeof_;
25126int
25127main ()
25128{
25129static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
25130test_array [0] = 0
25131
25132 ;
25133 return 0;
25134}
25135_ACEOF
25136rm -f conftest.$ac_objext
25137if { (ac_try="$ac_compile"
25138case "(($ac_try" in
25139 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25140 *) ac_try_echo=$ac_try;;
25141esac
25142eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25143 (eval "$ac_compile") 2>conftest.er1
25144 ac_status=$?
25145 grep -v '^ *+' conftest.er1 >conftest.err
25146 rm -f conftest.er1
25147 cat conftest.err >&5
25148 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25149 (exit $ac_status); } && {
25150 test -z "$ac_c_werror_flag" ||
25151 test ! -s conftest.err
25152 } && test -s conftest.$ac_objext; then
25153 ac_hi=$ac_mid; break
25154else
25155 echo "$as_me: failed program was:" >&5
25156sed 's/^/| /' conftest.$ac_ext >&5
25157
25158 ac_lo=`expr $ac_mid + 1`
25159 if test $ac_lo -le $ac_mid; then
25160 ac_lo= ac_hi=
25161 break
25162 fi
25163 ac_mid=`expr 2 '*' $ac_mid + 1`
25164fi
25165
25166rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25167 done
25168else
25169 echo "$as_me: failed program was:" >&5
25170sed 's/^/| /' conftest.$ac_ext >&5
25171
25172 cat >conftest.$ac_ext <<_ACEOF
25173/* confdefs.h. */
25174_ACEOF
25175cat confdefs.h >>conftest.$ac_ext
25176cat >>conftest.$ac_ext <<_ACEOF
25177/* end confdefs.h. */
25178$ac_includes_default
25179 typedef long int ac__type_sizeof_;
25180int
25181main ()
25182{
25183static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
25184test_array [0] = 0
25185
25186 ;
25187 return 0;
25188}
25189_ACEOF
25190rm -f conftest.$ac_objext
25191if { (ac_try="$ac_compile"
25192case "(($ac_try" in
25193 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25194 *) ac_try_echo=$ac_try;;
25195esac
25196eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25197 (eval "$ac_compile") 2>conftest.er1
25198 ac_status=$?
25199 grep -v '^ *+' conftest.er1 >conftest.err
25200 rm -f conftest.er1
25201 cat conftest.err >&5
25202 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25203 (exit $ac_status); } && {
25204 test -z "$ac_c_werror_flag" ||
25205 test ! -s conftest.err
25206 } && test -s conftest.$ac_objext; then
25207 ac_hi=-1 ac_mid=-1
25208 while :; do
25209 cat >conftest.$ac_ext <<_ACEOF
25210/* confdefs.h. */
25211_ACEOF
25212cat confdefs.h >>conftest.$ac_ext
25213cat >>conftest.$ac_ext <<_ACEOF
25214/* end confdefs.h. */
25215$ac_includes_default
25216 typedef long int ac__type_sizeof_;
25217int
25218main ()
25219{
25220static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
25221test_array [0] = 0
25222
25223 ;
25224 return 0;
25225}
25226_ACEOF
25227rm -f conftest.$ac_objext
25228if { (ac_try="$ac_compile"
25229case "(($ac_try" in
25230 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25231 *) ac_try_echo=$ac_try;;
25232esac
25233eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25234 (eval "$ac_compile") 2>conftest.er1
25235 ac_status=$?
25236 grep -v '^ *+' conftest.er1 >conftest.err
25237 rm -f conftest.er1
25238 cat conftest.err >&5
25239 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25240 (exit $ac_status); } && {
25241 test -z "$ac_c_werror_flag" ||
25242 test ! -s conftest.err
25243 } && test -s conftest.$ac_objext; then
25244 ac_lo=$ac_mid; break
25245else
25246 echo "$as_me: failed program was:" >&5
25247sed 's/^/| /' conftest.$ac_ext >&5
25248
25249 ac_hi=`expr '(' $ac_mid ')' - 1`
25250 if test $ac_mid -le $ac_hi; then
25251 ac_lo= ac_hi=
25252 break
25253 fi
25254 ac_mid=`expr 2 '*' $ac_mid`
25255fi
25256
25257rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25258 done
13543else 25259else
13544 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long int))" "ac_cv_sizeof_long_int" "$ac_includes_default"; then : 25260 echo "$as_me: failed program was:" >&5
25261sed 's/^/| /' conftest.$ac_ext >&5
25262
25263 ac_lo= ac_hi=
25264fi
25265
25266rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25267fi
25268
25269rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25270# Binary search between lo and hi bounds.
25271while test "x$ac_lo" != "x$ac_hi"; do
25272 ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
25273 cat >conftest.$ac_ext <<_ACEOF
25274/* confdefs.h. */
25275_ACEOF
25276cat confdefs.h >>conftest.$ac_ext
25277cat >>conftest.$ac_ext <<_ACEOF
25278/* end confdefs.h. */
25279$ac_includes_default
25280 typedef long int ac__type_sizeof_;
25281int
25282main ()
25283{
25284static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
25285test_array [0] = 0
25286
25287 ;
25288 return 0;
25289}
25290_ACEOF
25291rm -f conftest.$ac_objext
25292if { (ac_try="$ac_compile"
25293case "(($ac_try" in
25294 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25295 *) ac_try_echo=$ac_try;;
25296esac
25297eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25298 (eval "$ac_compile") 2>conftest.er1
25299 ac_status=$?
25300 grep -v '^ *+' conftest.er1 >conftest.err
25301 rm -f conftest.er1
25302 cat conftest.err >&5
25303 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25304 (exit $ac_status); } && {
25305 test -z "$ac_c_werror_flag" ||
25306 test ! -s conftest.err
25307 } && test -s conftest.$ac_objext; then
25308 ac_hi=$ac_mid
25309else
25310 echo "$as_me: failed program was:" >&5
25311sed 's/^/| /' conftest.$ac_ext >&5
25312
25313 ac_lo=`expr '(' $ac_mid ')' + 1`
25314fi
25315
25316rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25317done
25318case $ac_lo in
25319?*) ac_cv_sizeof_long_int=$ac_lo;;
25320'') if test "$ac_cv_type_long_int" = yes; then
25321 { { echo "$as_me:$LINENO: error: cannot compute sizeof (long int)
25322See \`config.log' for more details." >&5
25323echo "$as_me: error: cannot compute sizeof (long int)
25324See \`config.log' for more details." >&2;}
25325 { (exit 77); exit 77; }; }
25326 else
25327 ac_cv_sizeof_long_int=0
25328 fi ;;
25329esac
25330else
25331 cat >conftest.$ac_ext <<_ACEOF
25332/* confdefs.h. */
25333_ACEOF
25334cat confdefs.h >>conftest.$ac_ext
25335cat >>conftest.$ac_ext <<_ACEOF
25336/* end confdefs.h. */
25337$ac_includes_default
25338 typedef long int ac__type_sizeof_;
25339static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
25340static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
25341#include <stdio.h>
25342#include <stdlib.h>
25343int
25344main ()
25345{
25346
25347 FILE *f = fopen ("conftest.val", "w");
25348 if (! f)
25349 return 1;
25350 if (((long int) (sizeof (ac__type_sizeof_))) < 0)
25351 {
25352 long int i = longval ();
25353 if (i != ((long int) (sizeof (ac__type_sizeof_))))
25354 return 1;
25355 fprintf (f, "%ld\n", i);
25356 }
25357 else
25358 {
25359 unsigned long int i = ulongval ();
25360 if (i != ((long int) (sizeof (ac__type_sizeof_))))
25361 return 1;
25362 fprintf (f, "%lu\n", i);
25363 }
25364 return ferror (f) || fclose (f) != 0;
13545 25365
25366 ;
25367 return 0;
25368}
25369_ACEOF
25370rm -f conftest$ac_exeext
25371if { (ac_try="$ac_link"
25372case "(($ac_try" in
25373 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25374 *) ac_try_echo=$ac_try;;
25375esac
25376eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25377 (eval "$ac_link") 2>&5
25378 ac_status=$?
25379 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25380 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
25381 { (case "(($ac_try" in
25382 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25383 *) ac_try_echo=$ac_try;;
25384esac
25385eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25386 (eval "$ac_try") 2>&5
25387 ac_status=$?
25388 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25389 (exit $ac_status); }; }; then
25390 ac_cv_sizeof_long_int=`cat conftest.val`
13546else 25391else
13547 if test "$ac_cv_type_long_int" = yes; then 25392 echo "$as_me: program exited with status $ac_status" >&5
13548 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 25393echo "$as_me: failed program was:" >&5
13549$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 25394sed 's/^/| /' conftest.$ac_ext >&5
13550as_fn_error 77 "cannot compute sizeof (long int) 25395
13551See \`config.log' for more details" "$LINENO" 5; } 25396( exit $ac_status )
25397if test "$ac_cv_type_long_int" = yes; then
25398 { { echo "$as_me:$LINENO: error: cannot compute sizeof (long int)
25399See \`config.log' for more details." >&5
25400echo "$as_me: error: cannot compute sizeof (long int)
25401See \`config.log' for more details." >&2;}
25402 { (exit 77); exit 77; }; }
13552 else 25403 else
13553 ac_cv_sizeof_long_int=0 25404 ac_cv_sizeof_long_int=0
13554 fi 25405 fi
13555fi 25406fi
13556 25407rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
25408fi
25409rm -f conftest.val
13557fi 25410fi
13558{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_int" >&5 25411{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_int" >&5
13559$as_echo "$ac_cv_sizeof_long_int" >&6; } 25412echo "${ECHO_T}$ac_cv_sizeof_long_int" >&6; }
13560 25413
13561 25414
13562 25415
@@ -13565,31 +25418,403 @@ cat >>confdefs.h <<_ACEOF
13565_ACEOF 25418_ACEOF
13566 25419
13567 25420
25421{ echo "$as_me:$LINENO: checking for long long int" >&5
25422echo $ECHO_N "checking for long long int... $ECHO_C" >&6; }
25423if test "${ac_cv_type_long_long_int+set}" = set; then
25424 echo $ECHO_N "(cached) $ECHO_C" >&6
25425else
25426 cat >conftest.$ac_ext <<_ACEOF
25427/* confdefs.h. */
25428_ACEOF
25429cat confdefs.h >>conftest.$ac_ext
25430cat >>conftest.$ac_ext <<_ACEOF
25431/* end confdefs.h. */
25432$ac_includes_default
25433typedef long long int ac__type_new_;
25434int
25435main ()
25436{
25437if ((ac__type_new_ *) 0)
25438 return 0;
25439if (sizeof (ac__type_new_))
25440 return 0;
25441 ;
25442 return 0;
25443}
25444_ACEOF
25445rm -f conftest.$ac_objext
25446if { (ac_try="$ac_compile"
25447case "(($ac_try" in
25448 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25449 *) ac_try_echo=$ac_try;;
25450esac
25451eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25452 (eval "$ac_compile") 2>conftest.er1
25453 ac_status=$?
25454 grep -v '^ *+' conftest.er1 >conftest.err
25455 rm -f conftest.er1
25456 cat conftest.err >&5
25457 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25458 (exit $ac_status); } && {
25459 test -z "$ac_c_werror_flag" ||
25460 test ! -s conftest.err
25461 } && test -s conftest.$ac_objext; then
25462 ac_cv_type_long_long_int=yes
25463else
25464 echo "$as_me: failed program was:" >&5
25465sed 's/^/| /' conftest.$ac_ext >&5
25466
25467 ac_cv_type_long_long_int=no
25468fi
25469
25470rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25471fi
25472{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5
25473echo "${ECHO_T}$ac_cv_type_long_long_int" >&6; }
25474
13568# The cast to long int works around a bug in the HP C Compiler 25475# The cast to long int works around a bug in the HP C Compiler
13569# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 25476# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
13570# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 25477# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
13571# This bug is HP SR number 8606223364. 25478# This bug is HP SR number 8606223364.
13572{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long int" >&5 25479{ echo "$as_me:$LINENO: checking size of long long int" >&5
13573$as_echo_n "checking size of long long int... " >&6; } 25480echo $ECHO_N "checking size of long long int... $ECHO_C" >&6; }
13574if ${ac_cv_sizeof_long_long_int+:} false; then : 25481if test "${ac_cv_sizeof_long_long_int+set}" = set; then
13575 $as_echo_n "(cached) " >&6 25482 echo $ECHO_N "(cached) $ECHO_C" >&6
25483else
25484 if test "$cross_compiling" = yes; then
25485 # Depending upon the size, compute the lo and hi bounds.
25486cat >conftest.$ac_ext <<_ACEOF
25487/* confdefs.h. */
25488_ACEOF
25489cat confdefs.h >>conftest.$ac_ext
25490cat >>conftest.$ac_ext <<_ACEOF
25491/* end confdefs.h. */
25492$ac_includes_default
25493 typedef long long int ac__type_sizeof_;
25494int
25495main ()
25496{
25497static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
25498test_array [0] = 0
25499
25500 ;
25501 return 0;
25502}
25503_ACEOF
25504rm -f conftest.$ac_objext
25505if { (ac_try="$ac_compile"
25506case "(($ac_try" in
25507 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25508 *) ac_try_echo=$ac_try;;
25509esac
25510eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25511 (eval "$ac_compile") 2>conftest.er1
25512 ac_status=$?
25513 grep -v '^ *+' conftest.er1 >conftest.err
25514 rm -f conftest.er1
25515 cat conftest.err >&5
25516 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25517 (exit $ac_status); } && {
25518 test -z "$ac_c_werror_flag" ||
25519 test ! -s conftest.err
25520 } && test -s conftest.$ac_objext; then
25521 ac_lo=0 ac_mid=0
25522 while :; do
25523 cat >conftest.$ac_ext <<_ACEOF
25524/* confdefs.h. */
25525_ACEOF
25526cat confdefs.h >>conftest.$ac_ext
25527cat >>conftest.$ac_ext <<_ACEOF
25528/* end confdefs.h. */
25529$ac_includes_default
25530 typedef long long int ac__type_sizeof_;
25531int
25532main ()
25533{
25534static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
25535test_array [0] = 0
25536
25537 ;
25538 return 0;
25539}
25540_ACEOF
25541rm -f conftest.$ac_objext
25542if { (ac_try="$ac_compile"
25543case "(($ac_try" in
25544 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25545 *) ac_try_echo=$ac_try;;
25546esac
25547eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25548 (eval "$ac_compile") 2>conftest.er1
25549 ac_status=$?
25550 grep -v '^ *+' conftest.er1 >conftest.err
25551 rm -f conftest.er1
25552 cat conftest.err >&5
25553 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25554 (exit $ac_status); } && {
25555 test -z "$ac_c_werror_flag" ||
25556 test ! -s conftest.err
25557 } && test -s conftest.$ac_objext; then
25558 ac_hi=$ac_mid; break
13576else 25559else
13577 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long int))" "ac_cv_sizeof_long_long_int" "$ac_includes_default"; then : 25560 echo "$as_me: failed program was:" >&5
25561sed 's/^/| /' conftest.$ac_ext >&5
25562
25563 ac_lo=`expr $ac_mid + 1`
25564 if test $ac_lo -le $ac_mid; then
25565 ac_lo= ac_hi=
25566 break
25567 fi
25568 ac_mid=`expr 2 '*' $ac_mid + 1`
25569fi
25570
25571rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25572 done
25573else
25574 echo "$as_me: failed program was:" >&5
25575sed 's/^/| /' conftest.$ac_ext >&5
25576
25577 cat >conftest.$ac_ext <<_ACEOF
25578/* confdefs.h. */
25579_ACEOF
25580cat confdefs.h >>conftest.$ac_ext
25581cat >>conftest.$ac_ext <<_ACEOF
25582/* end confdefs.h. */
25583$ac_includes_default
25584 typedef long long int ac__type_sizeof_;
25585int
25586main ()
25587{
25588static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
25589test_array [0] = 0
13578 25590
25591 ;
25592 return 0;
25593}
25594_ACEOF
25595rm -f conftest.$ac_objext
25596if { (ac_try="$ac_compile"
25597case "(($ac_try" in
25598 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25599 *) ac_try_echo=$ac_try;;
25600esac
25601eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25602 (eval "$ac_compile") 2>conftest.er1
25603 ac_status=$?
25604 grep -v '^ *+' conftest.er1 >conftest.err
25605 rm -f conftest.er1
25606 cat conftest.err >&5
25607 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25608 (exit $ac_status); } && {
25609 test -z "$ac_c_werror_flag" ||
25610 test ! -s conftest.err
25611 } && test -s conftest.$ac_objext; then
25612 ac_hi=-1 ac_mid=-1
25613 while :; do
25614 cat >conftest.$ac_ext <<_ACEOF
25615/* confdefs.h. */
25616_ACEOF
25617cat confdefs.h >>conftest.$ac_ext
25618cat >>conftest.$ac_ext <<_ACEOF
25619/* end confdefs.h. */
25620$ac_includes_default
25621 typedef long long int ac__type_sizeof_;
25622int
25623main ()
25624{
25625static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
25626test_array [0] = 0
25627
25628 ;
25629 return 0;
25630}
25631_ACEOF
25632rm -f conftest.$ac_objext
25633if { (ac_try="$ac_compile"
25634case "(($ac_try" in
25635 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25636 *) ac_try_echo=$ac_try;;
25637esac
25638eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25639 (eval "$ac_compile") 2>conftest.er1
25640 ac_status=$?
25641 grep -v '^ *+' conftest.er1 >conftest.err
25642 rm -f conftest.er1
25643 cat conftest.err >&5
25644 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25645 (exit $ac_status); } && {
25646 test -z "$ac_c_werror_flag" ||
25647 test ! -s conftest.err
25648 } && test -s conftest.$ac_objext; then
25649 ac_lo=$ac_mid; break
13579else 25650else
13580 if test "$ac_cv_type_long_long_int" = yes; then 25651 echo "$as_me: failed program was:" >&5
13581 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 25652sed 's/^/| /' conftest.$ac_ext >&5
13582$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 25653
13583as_fn_error 77 "cannot compute sizeof (long long int) 25654 ac_hi=`expr '(' $ac_mid ')' - 1`
13584See \`config.log' for more details" "$LINENO" 5; } 25655 if test $ac_mid -le $ac_hi; then
25656 ac_lo= ac_hi=
25657 break
25658 fi
25659 ac_mid=`expr 2 '*' $ac_mid`
25660fi
25661
25662rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25663 done
25664else
25665 echo "$as_me: failed program was:" >&5
25666sed 's/^/| /' conftest.$ac_ext >&5
25667
25668 ac_lo= ac_hi=
25669fi
25670
25671rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25672fi
25673
25674rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25675# Binary search between lo and hi bounds.
25676while test "x$ac_lo" != "x$ac_hi"; do
25677 ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
25678 cat >conftest.$ac_ext <<_ACEOF
25679/* confdefs.h. */
25680_ACEOF
25681cat confdefs.h >>conftest.$ac_ext
25682cat >>conftest.$ac_ext <<_ACEOF
25683/* end confdefs.h. */
25684$ac_includes_default
25685 typedef long long int ac__type_sizeof_;
25686int
25687main ()
25688{
25689static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
25690test_array [0] = 0
25691
25692 ;
25693 return 0;
25694}
25695_ACEOF
25696rm -f conftest.$ac_objext
25697if { (ac_try="$ac_compile"
25698case "(($ac_try" in
25699 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25700 *) ac_try_echo=$ac_try;;
25701esac
25702eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25703 (eval "$ac_compile") 2>conftest.er1
25704 ac_status=$?
25705 grep -v '^ *+' conftest.er1 >conftest.err
25706 rm -f conftest.er1
25707 cat conftest.err >&5
25708 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25709 (exit $ac_status); } && {
25710 test -z "$ac_c_werror_flag" ||
25711 test ! -s conftest.err
25712 } && test -s conftest.$ac_objext; then
25713 ac_hi=$ac_mid
25714else
25715 echo "$as_me: failed program was:" >&5
25716sed 's/^/| /' conftest.$ac_ext >&5
25717
25718 ac_lo=`expr '(' $ac_mid ')' + 1`
25719fi
25720
25721rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25722done
25723case $ac_lo in
25724?*) ac_cv_sizeof_long_long_int=$ac_lo;;
25725'') if test "$ac_cv_type_long_long_int" = yes; then
25726 { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long int)
25727See \`config.log' for more details." >&5
25728echo "$as_me: error: cannot compute sizeof (long long int)
25729See \`config.log' for more details." >&2;}
25730 { (exit 77); exit 77; }; }
25731 else
25732 ac_cv_sizeof_long_long_int=0
25733 fi ;;
25734esac
25735else
25736 cat >conftest.$ac_ext <<_ACEOF
25737/* confdefs.h. */
25738_ACEOF
25739cat confdefs.h >>conftest.$ac_ext
25740cat >>conftest.$ac_ext <<_ACEOF
25741/* end confdefs.h. */
25742$ac_includes_default
25743 typedef long long int ac__type_sizeof_;
25744static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
25745static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
25746#include <stdio.h>
25747#include <stdlib.h>
25748int
25749main ()
25750{
25751
25752 FILE *f = fopen ("conftest.val", "w");
25753 if (! f)
25754 return 1;
25755 if (((long int) (sizeof (ac__type_sizeof_))) < 0)
25756 {
25757 long int i = longval ();
25758 if (i != ((long int) (sizeof (ac__type_sizeof_))))
25759 return 1;
25760 fprintf (f, "%ld\n", i);
25761 }
25762 else
25763 {
25764 unsigned long int i = ulongval ();
25765 if (i != ((long int) (sizeof (ac__type_sizeof_))))
25766 return 1;
25767 fprintf (f, "%lu\n", i);
25768 }
25769 return ferror (f) || fclose (f) != 0;
25770
25771 ;
25772 return 0;
25773}
25774_ACEOF
25775rm -f conftest$ac_exeext
25776if { (ac_try="$ac_link"
25777case "(($ac_try" in
25778 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25779 *) ac_try_echo=$ac_try;;
25780esac
25781eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25782 (eval "$ac_link") 2>&5
25783 ac_status=$?
25784 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25785 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
25786 { (case "(($ac_try" in
25787 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25788 *) ac_try_echo=$ac_try;;
25789esac
25790eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25791 (eval "$ac_try") 2>&5
25792 ac_status=$?
25793 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25794 (exit $ac_status); }; }; then
25795 ac_cv_sizeof_long_long_int=`cat conftest.val`
25796else
25797 echo "$as_me: program exited with status $ac_status" >&5
25798echo "$as_me: failed program was:" >&5
25799sed 's/^/| /' conftest.$ac_ext >&5
25800
25801( exit $ac_status )
25802if test "$ac_cv_type_long_long_int" = yes; then
25803 { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long int)
25804See \`config.log' for more details." >&5
25805echo "$as_me: error: cannot compute sizeof (long long int)
25806See \`config.log' for more details." >&2;}
25807 { (exit 77); exit 77; }; }
13585 else 25808 else
13586 ac_cv_sizeof_long_long_int=0 25809 ac_cv_sizeof_long_long_int=0
13587 fi 25810 fi
13588fi 25811fi
13589 25812rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
13590fi 25813fi
13591{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long_int" >&5 25814rm -f conftest.val
13592$as_echo "$ac_cv_sizeof_long_long_int" >&6; } 25815fi
25816{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long_int" >&5
25817echo "${ECHO_T}$ac_cv_sizeof_long_long_int" >&6; }
13593 25818
13594 25819
13595 25820
@@ -13606,16 +25831,20 @@ fi
13606 25831
13607# compute LLONG_MIN and LLONG_MAX if we don't know them. 25832# compute LLONG_MIN and LLONG_MAX if we don't know them.
13608if test -z "$have_llong_max"; then 25833if test -z "$have_llong_max"; then
13609 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for max value of long long" >&5 25834 { echo "$as_me:$LINENO: checking for max value of long long" >&5
13610$as_echo_n "checking for max value of long long... " >&6; } 25835echo $ECHO_N "checking for max value of long long... $ECHO_C" >&6; }
13611 if test "$cross_compiling" = yes; then : 25836 if test "$cross_compiling" = yes; then
13612 25837
13613 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking" >&5 25838 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking" >&5
13614$as_echo "$as_me: WARNING: cross compiling: not checking" >&2;} 25839echo "$as_me: WARNING: cross compiling: not checking" >&2;}
13615 25840
13616 25841
13617else 25842else
13618 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 25843 cat >conftest.$ac_ext <<_ACEOF
25844/* confdefs.h. */
25845_ACEOF
25846cat confdefs.h >>conftest.$ac_ext
25847cat >>conftest.$ac_ext <<_ACEOF
13619/* end confdefs.h. */ 25848/* end confdefs.h. */
13620 25849
13621#include <stdio.h> 25850#include <stdio.h>
@@ -13696,22 +25925,41 @@ main ()
13696 return 0; 25925 return 0;
13697} 25926}
13698_ACEOF 25927_ACEOF
13699if ac_fn_c_try_run "$LINENO"; then : 25928rm -f conftest$ac_exeext
25929if { (ac_try="$ac_link"
25930case "(($ac_try" in
25931 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25932 *) ac_try_echo=$ac_try;;
25933esac
25934eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25935 (eval "$ac_link") 2>&5
25936 ac_status=$?
25937 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25938 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
25939 { (case "(($ac_try" in
25940 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
25941 *) ac_try_echo=$ac_try;;
25942esac
25943eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
25944 (eval "$ac_try") 2>&5
25945 ac_status=$?
25946 echo "$as_me:$LINENO: \$? = $ac_status" >&5
25947 (exit $ac_status); }; }; then
13700 25948
13701 llong_min=`$AWK '{print $1}' conftest.llminmax` 25949 llong_min=`$AWK '{print $1}' conftest.llminmax`
13702 llong_max=`$AWK '{print $2}' conftest.llminmax` 25950 llong_max=`$AWK '{print $2}' conftest.llminmax`
13703 25951
13704 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $llong_max" >&5 25952 { echo "$as_me:$LINENO: result: $llong_max" >&5
13705$as_echo "$llong_max" >&6; } 25953echo "${ECHO_T}$llong_max" >&6; }
13706 25954
13707cat >>confdefs.h <<_ACEOF 25955cat >>confdefs.h <<_ACEOF
13708#define LLONG_MAX ${llong_max}LL 25956#define LLONG_MAX ${llong_max}LL
13709_ACEOF 25957_ACEOF
13710 25958
13711 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for min value of long long" >&5 25959 { echo "$as_me:$LINENO: checking for min value of long long" >&5
13712$as_echo_n "checking for min value of long long... " >&6; } 25960echo $ECHO_N "checking for min value of long long... $ECHO_C" >&6; }
13713 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $llong_min" >&5 25961 { echo "$as_me:$LINENO: result: $llong_min" >&5
13714$as_echo "$llong_min" >&6; } 25962echo "${ECHO_T}$llong_min" >&6; }
13715 25963
13716cat >>confdefs.h <<_ACEOF 25964cat >>confdefs.h <<_ACEOF
13717#define LLONG_MIN ${llong_min}LL 25965#define LLONG_MIN ${llong_min}LL
@@ -13719,26 +25967,35 @@ _ACEOF
13719 25967
13720 25968
13721else 25969else
25970 echo "$as_me: program exited with status $ac_status" >&5
25971echo "$as_me: failed program was:" >&5
25972sed 's/^/| /' conftest.$ac_ext >&5
25973
25974( exit $ac_status )
13722 25975
13723 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 25976 { echo "$as_me:$LINENO: result: not found" >&5
13724$as_echo "not found" >&6; } 25977echo "${ECHO_T}not found" >&6; }
13725 25978
13726fi 25979fi
13727rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 25980rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
13728 conftest.$ac_objext conftest.beam conftest.$ac_ext
13729fi 25981fi
13730 25982
25983
13731fi 25984fi
13732 25985
13733 25986
13734# More checks for data types 25987# More checks for data types
13735{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for u_int type" >&5 25988{ echo "$as_me:$LINENO: checking for u_int type" >&5
13736$as_echo_n "checking for u_int type... " >&6; } 25989echo $ECHO_N "checking for u_int type... $ECHO_C" >&6; }
13737if ${ac_cv_have_u_int+:} false; then : 25990if test "${ac_cv_have_u_int+set}" = set; then
13738 $as_echo_n "(cached) " >&6 25991 echo $ECHO_N "(cached) $ECHO_C" >&6
13739else 25992else
13740 25993
13741 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 25994 cat >conftest.$ac_ext <<_ACEOF
25995/* confdefs.h. */
25996_ACEOF
25997cat confdefs.h >>conftest.$ac_ext
25998cat >>conftest.$ac_ext <<_ACEOF
13742/* end confdefs.h. */ 25999/* end confdefs.h. */
13743 #include <sys/types.h> 26000 #include <sys/types.h>
13744int 26001int
@@ -13749,31 +26006,57 @@ main ()
13749 return 0; 26006 return 0;
13750} 26007}
13751_ACEOF 26008_ACEOF
13752if ac_fn_c_try_compile "$LINENO"; then : 26009rm -f conftest.$ac_objext
26010if { (ac_try="$ac_compile"
26011case "(($ac_try" in
26012 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26013 *) ac_try_echo=$ac_try;;
26014esac
26015eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26016 (eval "$ac_compile") 2>conftest.er1
26017 ac_status=$?
26018 grep -v '^ *+' conftest.er1 >conftest.err
26019 rm -f conftest.er1
26020 cat conftest.err >&5
26021 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26022 (exit $ac_status); } && {
26023 test -z "$ac_c_werror_flag" ||
26024 test ! -s conftest.err
26025 } && test -s conftest.$ac_objext; then
13753 ac_cv_have_u_int="yes" 26026 ac_cv_have_u_int="yes"
13754else 26027else
13755 ac_cv_have_u_int="no" 26028 echo "$as_me: failed program was:" >&5
26029sed 's/^/| /' conftest.$ac_ext >&5
26030
26031 ac_cv_have_u_int="no"
13756 26032
13757fi 26033fi
26034
13758rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26035rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13759 26036
13760fi 26037fi
13761{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_u_int" >&5 26038{ echo "$as_me:$LINENO: result: $ac_cv_have_u_int" >&5
13762$as_echo "$ac_cv_have_u_int" >&6; } 26039echo "${ECHO_T}$ac_cv_have_u_int" >&6; }
13763if test "x$ac_cv_have_u_int" = "xyes" ; then 26040if test "x$ac_cv_have_u_int" = "xyes" ; then
13764 26041
13765$as_echo "#define HAVE_U_INT 1" >>confdefs.h 26042cat >>confdefs.h <<\_ACEOF
26043#define HAVE_U_INT 1
26044_ACEOF
13766 26045
13767 have_u_int=1 26046 have_u_int=1
13768fi 26047fi
13769 26048
13770{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for intXX_t types" >&5 26049{ echo "$as_me:$LINENO: checking for intXX_t types" >&5
13771$as_echo_n "checking for intXX_t types... " >&6; } 26050echo $ECHO_N "checking for intXX_t types... $ECHO_C" >&6; }
13772if ${ac_cv_have_intxx_t+:} false; then : 26051if test "${ac_cv_have_intxx_t+set}" = set; then
13773 $as_echo_n "(cached) " >&6 26052 echo $ECHO_N "(cached) $ECHO_C" >&6
13774else 26053else
13775 26054
13776 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26055 cat >conftest.$ac_ext <<_ACEOF
26056/* confdefs.h. */
26057_ACEOF
26058cat confdefs.h >>conftest.$ac_ext
26059cat >>conftest.$ac_ext <<_ACEOF
13777/* end confdefs.h. */ 26060/* end confdefs.h. */
13778 #include <sys/types.h> 26061 #include <sys/types.h>
13779int 26062int
@@ -13784,20 +26067,42 @@ main ()
13784 return 0; 26067 return 0;
13785} 26068}
13786_ACEOF 26069_ACEOF
13787if ac_fn_c_try_compile "$LINENO"; then : 26070rm -f conftest.$ac_objext
26071if { (ac_try="$ac_compile"
26072case "(($ac_try" in
26073 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26074 *) ac_try_echo=$ac_try;;
26075esac
26076eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26077 (eval "$ac_compile") 2>conftest.er1
26078 ac_status=$?
26079 grep -v '^ *+' conftest.er1 >conftest.err
26080 rm -f conftest.er1
26081 cat conftest.err >&5
26082 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26083 (exit $ac_status); } && {
26084 test -z "$ac_c_werror_flag" ||
26085 test ! -s conftest.err
26086 } && test -s conftest.$ac_objext; then
13788 ac_cv_have_intxx_t="yes" 26087 ac_cv_have_intxx_t="yes"
13789else 26088else
13790 ac_cv_have_intxx_t="no" 26089 echo "$as_me: failed program was:" >&5
26090sed 's/^/| /' conftest.$ac_ext >&5
26091
26092 ac_cv_have_intxx_t="no"
13791 26093
13792fi 26094fi
26095
13793rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26096rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13794 26097
13795fi 26098fi
13796{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_intxx_t" >&5 26099{ echo "$as_me:$LINENO: result: $ac_cv_have_intxx_t" >&5
13797$as_echo "$ac_cv_have_intxx_t" >&6; } 26100echo "${ECHO_T}$ac_cv_have_intxx_t" >&6; }
13798if test "x$ac_cv_have_intxx_t" = "xyes" ; then 26101if test "x$ac_cv_have_intxx_t" = "xyes" ; then
13799 26102
13800$as_echo "#define HAVE_INTXX_T 1" >>confdefs.h 26103cat >>confdefs.h <<\_ACEOF
26104#define HAVE_INTXX_T 1
26105_ACEOF
13801 26106
13802 have_intxx_t=1 26107 have_intxx_t=1
13803fi 26108fi
@@ -13805,9 +26110,13 @@ fi
13805if (test -z "$have_intxx_t" && \ 26110if (test -z "$have_intxx_t" && \
13806 test "x$ac_cv_header_stdint_h" = "xyes") 26111 test "x$ac_cv_header_stdint_h" = "xyes")
13807then 26112then
13808 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intXX_t types in stdint.h" >&5 26113 { echo "$as_me:$LINENO: checking for intXX_t types in stdint.h" >&5
13809$as_echo_n "checking for intXX_t types in stdint.h... " >&6; } 26114echo $ECHO_N "checking for intXX_t types in stdint.h... $ECHO_C" >&6; }
13810 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26115 cat >conftest.$ac_ext <<_ACEOF
26116/* confdefs.h. */
26117_ACEOF
26118cat confdefs.h >>conftest.$ac_ext
26119cat >>conftest.$ac_ext <<_ACEOF
13811/* end confdefs.h. */ 26120/* end confdefs.h. */
13812 #include <stdint.h> 26121 #include <stdint.h>
13813int 26122int
@@ -13818,28 +26127,54 @@ main ()
13818 return 0; 26127 return 0;
13819} 26128}
13820_ACEOF 26129_ACEOF
13821if ac_fn_c_try_compile "$LINENO"; then : 26130rm -f conftest.$ac_objext
26131if { (ac_try="$ac_compile"
26132case "(($ac_try" in
26133 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26134 *) ac_try_echo=$ac_try;;
26135esac
26136eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26137 (eval "$ac_compile") 2>conftest.er1
26138 ac_status=$?
26139 grep -v '^ *+' conftest.er1 >conftest.err
26140 rm -f conftest.er1
26141 cat conftest.err >&5
26142 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26143 (exit $ac_status); } && {
26144 test -z "$ac_c_werror_flag" ||
26145 test ! -s conftest.err
26146 } && test -s conftest.$ac_objext; then
13822 26147
13823 $as_echo "#define HAVE_INTXX_T 1" >>confdefs.h 26148 cat >>confdefs.h <<\_ACEOF
26149#define HAVE_INTXX_T 1
26150_ACEOF
13824 26151
13825 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26152 { echo "$as_me:$LINENO: result: yes" >&5
13826$as_echo "yes" >&6; } 26153echo "${ECHO_T}yes" >&6; }
13827 26154
13828else 26155else
13829 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26156 echo "$as_me: failed program was:" >&5
13830$as_echo "no" >&6; } 26157sed 's/^/| /' conftest.$ac_ext >&5
26158
26159 { echo "$as_me:$LINENO: result: no" >&5
26160echo "${ECHO_T}no" >&6; }
13831 26161
13832fi 26162fi
26163
13833rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26164rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13834fi 26165fi
13835 26166
13836{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for int64_t type" >&5 26167{ echo "$as_me:$LINENO: checking for int64_t type" >&5
13837$as_echo_n "checking for int64_t type... " >&6; } 26168echo $ECHO_N "checking for int64_t type... $ECHO_C" >&6; }
13838if ${ac_cv_have_int64_t+:} false; then : 26169if test "${ac_cv_have_int64_t+set}" = set; then
13839 $as_echo_n "(cached) " >&6 26170 echo $ECHO_N "(cached) $ECHO_C" >&6
13840else 26171else
13841 26172
13842 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26173 cat >conftest.$ac_ext <<_ACEOF
26174/* confdefs.h. */
26175_ACEOF
26176cat confdefs.h >>conftest.$ac_ext
26177cat >>conftest.$ac_ext <<_ACEOF
13843/* end confdefs.h. */ 26178/* end confdefs.h. */
13844 26179
13845#include <sys/types.h> 26180#include <sys/types.h>
@@ -13861,30 +26196,56 @@ int64_t a; a = 1;
13861 return 0; 26196 return 0;
13862} 26197}
13863_ACEOF 26198_ACEOF
13864if ac_fn_c_try_compile "$LINENO"; then : 26199rm -f conftest.$ac_objext
26200if { (ac_try="$ac_compile"
26201case "(($ac_try" in
26202 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26203 *) ac_try_echo=$ac_try;;
26204esac
26205eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26206 (eval "$ac_compile") 2>conftest.er1
26207 ac_status=$?
26208 grep -v '^ *+' conftest.er1 >conftest.err
26209 rm -f conftest.er1
26210 cat conftest.err >&5
26211 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26212 (exit $ac_status); } && {
26213 test -z "$ac_c_werror_flag" ||
26214 test ! -s conftest.err
26215 } && test -s conftest.$ac_objext; then
13865 ac_cv_have_int64_t="yes" 26216 ac_cv_have_int64_t="yes"
13866else 26217else
13867 ac_cv_have_int64_t="no" 26218 echo "$as_me: failed program was:" >&5
26219sed 's/^/| /' conftest.$ac_ext >&5
26220
26221 ac_cv_have_int64_t="no"
13868 26222
13869fi 26223fi
26224
13870rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26225rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13871 26226
13872fi 26227fi
13873{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_int64_t" >&5 26228{ echo "$as_me:$LINENO: result: $ac_cv_have_int64_t" >&5
13874$as_echo "$ac_cv_have_int64_t" >&6; } 26229echo "${ECHO_T}$ac_cv_have_int64_t" >&6; }
13875if test "x$ac_cv_have_int64_t" = "xyes" ; then 26230if test "x$ac_cv_have_int64_t" = "xyes" ; then
13876 26231
13877$as_echo "#define HAVE_INT64_T 1" >>confdefs.h 26232cat >>confdefs.h <<\_ACEOF
26233#define HAVE_INT64_T 1
26234_ACEOF
13878 26235
13879fi 26236fi
13880 26237
13881{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for u_intXX_t types" >&5 26238{ echo "$as_me:$LINENO: checking for u_intXX_t types" >&5
13882$as_echo_n "checking for u_intXX_t types... " >&6; } 26239echo $ECHO_N "checking for u_intXX_t types... $ECHO_C" >&6; }
13883if ${ac_cv_have_u_intxx_t+:} false; then : 26240if test "${ac_cv_have_u_intxx_t+set}" = set; then
13884 $as_echo_n "(cached) " >&6 26241 echo $ECHO_N "(cached) $ECHO_C" >&6
13885else 26242else
13886 26243
13887 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26244 cat >conftest.$ac_ext <<_ACEOF
26245/* confdefs.h. */
26246_ACEOF
26247cat confdefs.h >>conftest.$ac_ext
26248cat >>conftest.$ac_ext <<_ACEOF
13888/* end confdefs.h. */ 26249/* end confdefs.h. */
13889 #include <sys/types.h> 26250 #include <sys/types.h>
13890int 26251int
@@ -13895,28 +26256,54 @@ main ()
13895 return 0; 26256 return 0;
13896} 26257}
13897_ACEOF 26258_ACEOF
13898if ac_fn_c_try_compile "$LINENO"; then : 26259rm -f conftest.$ac_objext
26260if { (ac_try="$ac_compile"
26261case "(($ac_try" in
26262 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26263 *) ac_try_echo=$ac_try;;
26264esac
26265eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26266 (eval "$ac_compile") 2>conftest.er1
26267 ac_status=$?
26268 grep -v '^ *+' conftest.er1 >conftest.err
26269 rm -f conftest.er1
26270 cat conftest.err >&5
26271 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26272 (exit $ac_status); } && {
26273 test -z "$ac_c_werror_flag" ||
26274 test ! -s conftest.err
26275 } && test -s conftest.$ac_objext; then
13899 ac_cv_have_u_intxx_t="yes" 26276 ac_cv_have_u_intxx_t="yes"
13900else 26277else
13901 ac_cv_have_u_intxx_t="no" 26278 echo "$as_me: failed program was:" >&5
26279sed 's/^/| /' conftest.$ac_ext >&5
26280
26281 ac_cv_have_u_intxx_t="no"
13902 26282
13903fi 26283fi
26284
13904rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26285rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13905 26286
13906fi 26287fi
13907{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_u_intxx_t" >&5 26288{ echo "$as_me:$LINENO: result: $ac_cv_have_u_intxx_t" >&5
13908$as_echo "$ac_cv_have_u_intxx_t" >&6; } 26289echo "${ECHO_T}$ac_cv_have_u_intxx_t" >&6; }
13909if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then 26290if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
13910 26291
13911$as_echo "#define HAVE_U_INTXX_T 1" >>confdefs.h 26292cat >>confdefs.h <<\_ACEOF
26293#define HAVE_U_INTXX_T 1
26294_ACEOF
13912 26295
13913 have_u_intxx_t=1 26296 have_u_intxx_t=1
13914fi 26297fi
13915 26298
13916if test -z "$have_u_intxx_t" ; then 26299if test -z "$have_u_intxx_t" ; then
13917 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for u_intXX_t types in sys/socket.h" >&5 26300 { echo "$as_me:$LINENO: checking for u_intXX_t types in sys/socket.h" >&5
13918$as_echo_n "checking for u_intXX_t types in sys/socket.h... " >&6; } 26301echo $ECHO_N "checking for u_intXX_t types in sys/socket.h... $ECHO_C" >&6; }
13919 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26302 cat >conftest.$ac_ext <<_ACEOF
26303/* confdefs.h. */
26304_ACEOF
26305cat confdefs.h >>conftest.$ac_ext
26306cat >>conftest.$ac_ext <<_ACEOF
13920/* end confdefs.h. */ 26307/* end confdefs.h. */
13921 #include <sys/socket.h> 26308 #include <sys/socket.h>
13922int 26309int
@@ -13927,28 +26314,54 @@ main ()
13927 return 0; 26314 return 0;
13928} 26315}
13929_ACEOF 26316_ACEOF
13930if ac_fn_c_try_compile "$LINENO"; then : 26317rm -f conftest.$ac_objext
26318if { (ac_try="$ac_compile"
26319case "(($ac_try" in
26320 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26321 *) ac_try_echo=$ac_try;;
26322esac
26323eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26324 (eval "$ac_compile") 2>conftest.er1
26325 ac_status=$?
26326 grep -v '^ *+' conftest.er1 >conftest.err
26327 rm -f conftest.er1
26328 cat conftest.err >&5
26329 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26330 (exit $ac_status); } && {
26331 test -z "$ac_c_werror_flag" ||
26332 test ! -s conftest.err
26333 } && test -s conftest.$ac_objext; then
13931 26334
13932 $as_echo "#define HAVE_U_INTXX_T 1" >>confdefs.h 26335 cat >>confdefs.h <<\_ACEOF
26336#define HAVE_U_INTXX_T 1
26337_ACEOF
13933 26338
13934 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26339 { echo "$as_me:$LINENO: result: yes" >&5
13935$as_echo "yes" >&6; } 26340echo "${ECHO_T}yes" >&6; }
13936 26341
13937else 26342else
13938 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26343 echo "$as_me: failed program was:" >&5
13939$as_echo "no" >&6; } 26344sed 's/^/| /' conftest.$ac_ext >&5
26345
26346 { echo "$as_me:$LINENO: result: no" >&5
26347echo "${ECHO_T}no" >&6; }
13940 26348
13941fi 26349fi
26350
13942rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26351rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13943fi 26352fi
13944 26353
13945{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for u_int64_t types" >&5 26354{ echo "$as_me:$LINENO: checking for u_int64_t types" >&5
13946$as_echo_n "checking for u_int64_t types... " >&6; } 26355echo $ECHO_N "checking for u_int64_t types... $ECHO_C" >&6; }
13947if ${ac_cv_have_u_int64_t+:} false; then : 26356if test "${ac_cv_have_u_int64_t+set}" = set; then
13948 $as_echo_n "(cached) " >&6 26357 echo $ECHO_N "(cached) $ECHO_C" >&6
13949else 26358else
13950 26359
13951 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26360 cat >conftest.$ac_ext <<_ACEOF
26361/* confdefs.h. */
26362_ACEOF
26363cat confdefs.h >>conftest.$ac_ext
26364cat >>conftest.$ac_ext <<_ACEOF
13952/* end confdefs.h. */ 26365/* end confdefs.h. */
13953 #include <sys/types.h> 26366 #include <sys/types.h>
13954int 26367int
@@ -13959,20 +26372,42 @@ main ()
13959 return 0; 26372 return 0;
13960} 26373}
13961_ACEOF 26374_ACEOF
13962if ac_fn_c_try_compile "$LINENO"; then : 26375rm -f conftest.$ac_objext
26376if { (ac_try="$ac_compile"
26377case "(($ac_try" in
26378 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26379 *) ac_try_echo=$ac_try;;
26380esac
26381eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26382 (eval "$ac_compile") 2>conftest.er1
26383 ac_status=$?
26384 grep -v '^ *+' conftest.er1 >conftest.err
26385 rm -f conftest.er1
26386 cat conftest.err >&5
26387 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26388 (exit $ac_status); } && {
26389 test -z "$ac_c_werror_flag" ||
26390 test ! -s conftest.err
26391 } && test -s conftest.$ac_objext; then
13963 ac_cv_have_u_int64_t="yes" 26392 ac_cv_have_u_int64_t="yes"
13964else 26393else
13965 ac_cv_have_u_int64_t="no" 26394 echo "$as_me: failed program was:" >&5
26395sed 's/^/| /' conftest.$ac_ext >&5
26396
26397 ac_cv_have_u_int64_t="no"
13966 26398
13967fi 26399fi
26400
13968rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26401rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13969 26402
13970fi 26403fi
13971{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_u_int64_t" >&5 26404{ echo "$as_me:$LINENO: result: $ac_cv_have_u_int64_t" >&5
13972$as_echo "$ac_cv_have_u_int64_t" >&6; } 26405echo "${ECHO_T}$ac_cv_have_u_int64_t" >&6; }
13973if test "x$ac_cv_have_u_int64_t" = "xyes" ; then 26406if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
13974 26407
13975$as_echo "#define HAVE_U_INT64_T 1" >>confdefs.h 26408cat >>confdefs.h <<\_ACEOF
26409#define HAVE_U_INT64_T 1
26410_ACEOF
13976 26411
13977 have_u_int64_t=1 26412 have_u_int64_t=1
13978fi 26413fi
@@ -13980,9 +26415,13 @@ fi
13980if (test -z "$have_u_int64_t" && \ 26415if (test -z "$have_u_int64_t" && \
13981 test "x$ac_cv_header_sys_bitypes_h" = "xyes") 26416 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
13982then 26417then
13983 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for u_int64_t type in sys/bitypes.h" >&5 26418 { echo "$as_me:$LINENO: checking for u_int64_t type in sys/bitypes.h" >&5
13984$as_echo_n "checking for u_int64_t type in sys/bitypes.h... " >&6; } 26419echo $ECHO_N "checking for u_int64_t type in sys/bitypes.h... $ECHO_C" >&6; }
13985 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26420 cat >conftest.$ac_ext <<_ACEOF
26421/* confdefs.h. */
26422_ACEOF
26423cat confdefs.h >>conftest.$ac_ext
26424cat >>conftest.$ac_ext <<_ACEOF
13986/* end confdefs.h. */ 26425/* end confdefs.h. */
13987 #include <sys/bitypes.h> 26426 #include <sys/bitypes.h>
13988int 26427int
@@ -13993,29 +26432,55 @@ main ()
13993 return 0; 26432 return 0;
13994} 26433}
13995_ACEOF 26434_ACEOF
13996if ac_fn_c_try_compile "$LINENO"; then : 26435rm -f conftest.$ac_objext
26436if { (ac_try="$ac_compile"
26437case "(($ac_try" in
26438 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26439 *) ac_try_echo=$ac_try;;
26440esac
26441eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26442 (eval "$ac_compile") 2>conftest.er1
26443 ac_status=$?
26444 grep -v '^ *+' conftest.er1 >conftest.err
26445 rm -f conftest.er1
26446 cat conftest.err >&5
26447 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26448 (exit $ac_status); } && {
26449 test -z "$ac_c_werror_flag" ||
26450 test ! -s conftest.err
26451 } && test -s conftest.$ac_objext; then
13997 26452
13998 $as_echo "#define HAVE_U_INT64_T 1" >>confdefs.h 26453 cat >>confdefs.h <<\_ACEOF
26454#define HAVE_U_INT64_T 1
26455_ACEOF
13999 26456
14000 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26457 { echo "$as_me:$LINENO: result: yes" >&5
14001$as_echo "yes" >&6; } 26458echo "${ECHO_T}yes" >&6; }
14002 26459
14003else 26460else
14004 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26461 echo "$as_me: failed program was:" >&5
14005$as_echo "no" >&6; } 26462sed 's/^/| /' conftest.$ac_ext >&5
26463
26464 { echo "$as_me:$LINENO: result: no" >&5
26465echo "${ECHO_T}no" >&6; }
14006 26466
14007fi 26467fi
26468
14008rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26469rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14009fi 26470fi
14010 26471
14011if test -z "$have_u_intxx_t" ; then 26472if test -z "$have_u_intxx_t" ; then
14012 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uintXX_t types" >&5 26473 { echo "$as_me:$LINENO: checking for uintXX_t types" >&5
14013$as_echo_n "checking for uintXX_t types... " >&6; } 26474echo $ECHO_N "checking for uintXX_t types... $ECHO_C" >&6; }
14014if ${ac_cv_have_uintxx_t+:} false; then : 26475if test "${ac_cv_have_uintxx_t+set}" = set; then
14015 $as_echo_n "(cached) " >&6 26476 echo $ECHO_N "(cached) $ECHO_C" >&6
14016else 26477else
14017 26478
14018 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26479 cat >conftest.$ac_ext <<_ACEOF
26480/* confdefs.h. */
26481_ACEOF
26482cat confdefs.h >>conftest.$ac_ext
26483cat >>conftest.$ac_ext <<_ACEOF
14019/* end confdefs.h. */ 26484/* end confdefs.h. */
14020 26485
14021#include <sys/types.h> 26486#include <sys/types.h>
@@ -14033,20 +26498,42 @@ main ()
14033 return 0; 26498 return 0;
14034} 26499}
14035_ACEOF 26500_ACEOF
14036if ac_fn_c_try_compile "$LINENO"; then : 26501rm -f conftest.$ac_objext
26502if { (ac_try="$ac_compile"
26503case "(($ac_try" in
26504 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26505 *) ac_try_echo=$ac_try;;
26506esac
26507eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26508 (eval "$ac_compile") 2>conftest.er1
26509 ac_status=$?
26510 grep -v '^ *+' conftest.er1 >conftest.err
26511 rm -f conftest.er1
26512 cat conftest.err >&5
26513 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26514 (exit $ac_status); } && {
26515 test -z "$ac_c_werror_flag" ||
26516 test ! -s conftest.err
26517 } && test -s conftest.$ac_objext; then
14037 ac_cv_have_uintxx_t="yes" 26518 ac_cv_have_uintxx_t="yes"
14038else 26519else
14039 ac_cv_have_uintxx_t="no" 26520 echo "$as_me: failed program was:" >&5
26521sed 's/^/| /' conftest.$ac_ext >&5
26522
26523 ac_cv_have_uintxx_t="no"
14040 26524
14041fi 26525fi
26526
14042rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26527rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14043 26528
14044fi 26529fi
14045{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_uintxx_t" >&5 26530{ echo "$as_me:$LINENO: result: $ac_cv_have_uintxx_t" >&5
14046$as_echo "$ac_cv_have_uintxx_t" >&6; } 26531echo "${ECHO_T}$ac_cv_have_uintxx_t" >&6; }
14047 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then 26532 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
14048 26533
14049$as_echo "#define HAVE_UINTXX_T 1" >>confdefs.h 26534cat >>confdefs.h <<\_ACEOF
26535#define HAVE_UINTXX_T 1
26536_ACEOF
14050 26537
14051 fi 26538 fi
14052fi 26539fi
@@ -14054,9 +26541,13 @@ fi
14054if (test -z "$have_uintxx_t" && \ 26541if (test -z "$have_uintxx_t" && \
14055 test "x$ac_cv_header_stdint_h" = "xyes") 26542 test "x$ac_cv_header_stdint_h" = "xyes")
14056then 26543then
14057 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uintXX_t types in stdint.h" >&5 26544 { echo "$as_me:$LINENO: checking for uintXX_t types in stdint.h" >&5
14058$as_echo_n "checking for uintXX_t types in stdint.h... " >&6; } 26545echo $ECHO_N "checking for uintXX_t types in stdint.h... $ECHO_C" >&6; }
14059 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26546 cat >conftest.$ac_ext <<_ACEOF
26547/* confdefs.h. */
26548_ACEOF
26549cat confdefs.h >>conftest.$ac_ext
26550cat >>conftest.$ac_ext <<_ACEOF
14060/* end confdefs.h. */ 26551/* end confdefs.h. */
14061 #include <stdint.h> 26552 #include <stdint.h>
14062int 26553int
@@ -14067,27 +26558,53 @@ main ()
14067 return 0; 26558 return 0;
14068} 26559}
14069_ACEOF 26560_ACEOF
14070if ac_fn_c_try_compile "$LINENO"; then : 26561rm -f conftest.$ac_objext
26562if { (ac_try="$ac_compile"
26563case "(($ac_try" in
26564 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26565 *) ac_try_echo=$ac_try;;
26566esac
26567eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26568 (eval "$ac_compile") 2>conftest.er1
26569 ac_status=$?
26570 grep -v '^ *+' conftest.er1 >conftest.err
26571 rm -f conftest.er1
26572 cat conftest.err >&5
26573 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26574 (exit $ac_status); } && {
26575 test -z "$ac_c_werror_flag" ||
26576 test ! -s conftest.err
26577 } && test -s conftest.$ac_objext; then
14071 26578
14072 $as_echo "#define HAVE_UINTXX_T 1" >>confdefs.h 26579 cat >>confdefs.h <<\_ACEOF
26580#define HAVE_UINTXX_T 1
26581_ACEOF
14073 26582
14074 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26583 { echo "$as_me:$LINENO: result: yes" >&5
14075$as_echo "yes" >&6; } 26584echo "${ECHO_T}yes" >&6; }
14076 26585
14077else 26586else
14078 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26587 echo "$as_me: failed program was:" >&5
14079$as_echo "no" >&6; } 26588sed 's/^/| /' conftest.$ac_ext >&5
26589
26590 { echo "$as_me:$LINENO: result: no" >&5
26591echo "${ECHO_T}no" >&6; }
14080 26592
14081fi 26593fi
26594
14082rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26595rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14083fi 26596fi
14084 26597
14085if (test -z "$have_uintxx_t" && \ 26598if (test -z "$have_uintxx_t" && \
14086 test "x$ac_cv_header_inttypes_h" = "xyes") 26599 test "x$ac_cv_header_inttypes_h" = "xyes")
14087then 26600then
14088 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uintXX_t types in inttypes.h" >&5 26601 { echo "$as_me:$LINENO: checking for uintXX_t types in inttypes.h" >&5
14089$as_echo_n "checking for uintXX_t types in inttypes.h... " >&6; } 26602echo $ECHO_N "checking for uintXX_t types in inttypes.h... $ECHO_C" >&6; }
14090 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26603 cat >conftest.$ac_ext <<_ACEOF
26604/* confdefs.h. */
26605_ACEOF
26606cat confdefs.h >>conftest.$ac_ext
26607cat >>conftest.$ac_ext <<_ACEOF
14091/* end confdefs.h. */ 26608/* end confdefs.h. */
14092 #include <inttypes.h> 26609 #include <inttypes.h>
14093int 26610int
@@ -14098,27 +26615,53 @@ main ()
14098 return 0; 26615 return 0;
14099} 26616}
14100_ACEOF 26617_ACEOF
14101if ac_fn_c_try_compile "$LINENO"; then : 26618rm -f conftest.$ac_objext
26619if { (ac_try="$ac_compile"
26620case "(($ac_try" in
26621 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26622 *) ac_try_echo=$ac_try;;
26623esac
26624eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26625 (eval "$ac_compile") 2>conftest.er1
26626 ac_status=$?
26627 grep -v '^ *+' conftest.er1 >conftest.err
26628 rm -f conftest.er1
26629 cat conftest.err >&5
26630 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26631 (exit $ac_status); } && {
26632 test -z "$ac_c_werror_flag" ||
26633 test ! -s conftest.err
26634 } && test -s conftest.$ac_objext; then
14102 26635
14103 $as_echo "#define HAVE_UINTXX_T 1" >>confdefs.h 26636 cat >>confdefs.h <<\_ACEOF
26637#define HAVE_UINTXX_T 1
26638_ACEOF
14104 26639
14105 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26640 { echo "$as_me:$LINENO: result: yes" >&5
14106$as_echo "yes" >&6; } 26641echo "${ECHO_T}yes" >&6; }
14107 26642
14108else 26643else
14109 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26644 echo "$as_me: failed program was:" >&5
14110$as_echo "no" >&6; } 26645sed 's/^/| /' conftest.$ac_ext >&5
26646
26647 { echo "$as_me:$LINENO: result: no" >&5
26648echo "${ECHO_T}no" >&6; }
14111 26649
14112fi 26650fi
26651
14113rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26652rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14114fi 26653fi
14115 26654
14116if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ 26655if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
14117 test "x$ac_cv_header_sys_bitypes_h" = "xyes") 26656 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
14118then 26657then
14119 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intXX_t and u_intXX_t types in sys/bitypes.h" >&5 26658 { echo "$as_me:$LINENO: checking for intXX_t and u_intXX_t types in sys/bitypes.h" >&5
14120$as_echo_n "checking for intXX_t and u_intXX_t types in sys/bitypes.h... " >&6; } 26659echo $ECHO_N "checking for intXX_t and u_intXX_t types in sys/bitypes.h... $ECHO_C" >&6; }
14121 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26660 cat >conftest.$ac_ext <<_ACEOF
26661/* confdefs.h. */
26662_ACEOF
26663cat confdefs.h >>conftest.$ac_ext
26664cat >>conftest.$ac_ext <<_ACEOF
14122/* end confdefs.h. */ 26665/* end confdefs.h. */
14123 26666
14124#include <sys/bitypes.h> 26667#include <sys/bitypes.h>
@@ -14135,31 +26678,59 @@ main ()
14135 return 0; 26678 return 0;
14136} 26679}
14137_ACEOF 26680_ACEOF
14138if ac_fn_c_try_compile "$LINENO"; then : 26681rm -f conftest.$ac_objext
26682if { (ac_try="$ac_compile"
26683case "(($ac_try" in
26684 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26685 *) ac_try_echo=$ac_try;;
26686esac
26687eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26688 (eval "$ac_compile") 2>conftest.er1
26689 ac_status=$?
26690 grep -v '^ *+' conftest.er1 >conftest.err
26691 rm -f conftest.er1
26692 cat conftest.err >&5
26693 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26694 (exit $ac_status); } && {
26695 test -z "$ac_c_werror_flag" ||
26696 test ! -s conftest.err
26697 } && test -s conftest.$ac_objext; then
14139 26698
14140 $as_echo "#define HAVE_U_INTXX_T 1" >>confdefs.h 26699 cat >>confdefs.h <<\_ACEOF
26700#define HAVE_U_INTXX_T 1
26701_ACEOF
14141 26702
14142 $as_echo "#define HAVE_INTXX_T 1" >>confdefs.h 26703 cat >>confdefs.h <<\_ACEOF
26704#define HAVE_INTXX_T 1
26705_ACEOF
14143 26706
14144 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26707 { echo "$as_me:$LINENO: result: yes" >&5
14145$as_echo "yes" >&6; } 26708echo "${ECHO_T}yes" >&6; }
14146 26709
14147else 26710else
14148 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26711 echo "$as_me: failed program was:" >&5
14149$as_echo "no" >&6; } 26712sed 's/^/| /' conftest.$ac_ext >&5
26713
26714 { echo "$as_me:$LINENO: result: no" >&5
26715echo "${ECHO_T}no" >&6; }
14150 26716
14151fi 26717fi
26718
14152rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26719rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14153fi 26720fi
14154 26721
14155 26722
14156{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for u_char" >&5 26723{ echo "$as_me:$LINENO: checking for u_char" >&5
14157$as_echo_n "checking for u_char... " >&6; } 26724echo $ECHO_N "checking for u_char... $ECHO_C" >&6; }
14158if ${ac_cv_have_u_char+:} false; then : 26725if test "${ac_cv_have_u_char+set}" = set; then
14159 $as_echo_n "(cached) " >&6 26726 echo $ECHO_N "(cached) $ECHO_C" >&6
14160else 26727else
14161 26728
14162 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26729 cat >conftest.$ac_ext <<_ACEOF
26730/* confdefs.h. */
26731_ACEOF
26732cat confdefs.h >>conftest.$ac_ext
26733cat >>conftest.$ac_ext <<_ACEOF
14163/* end confdefs.h. */ 26734/* end confdefs.h. */
14164 #include <sys/types.h> 26735 #include <sys/types.h>
14165int 26736int
@@ -14170,29 +26741,103 @@ main ()
14170 return 0; 26741 return 0;
14171} 26742}
14172_ACEOF 26743_ACEOF
14173if ac_fn_c_try_compile "$LINENO"; then : 26744rm -f conftest.$ac_objext
26745if { (ac_try="$ac_compile"
26746case "(($ac_try" in
26747 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26748 *) ac_try_echo=$ac_try;;
26749esac
26750eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26751 (eval "$ac_compile") 2>conftest.er1
26752 ac_status=$?
26753 grep -v '^ *+' conftest.er1 >conftest.err
26754 rm -f conftest.er1
26755 cat conftest.err >&5
26756 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26757 (exit $ac_status); } && {
26758 test -z "$ac_c_werror_flag" ||
26759 test ! -s conftest.err
26760 } && test -s conftest.$ac_objext; then
14174 ac_cv_have_u_char="yes" 26761 ac_cv_have_u_char="yes"
14175else 26762else
14176 ac_cv_have_u_char="no" 26763 echo "$as_me: failed program was:" >&5
26764sed 's/^/| /' conftest.$ac_ext >&5
26765
26766 ac_cv_have_u_char="no"
14177 26767
14178fi 26768fi
26769
14179rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26770rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14180 26771
14181fi 26772fi
14182{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_u_char" >&5 26773{ echo "$as_me:$LINENO: result: $ac_cv_have_u_char" >&5
14183$as_echo "$ac_cv_have_u_char" >&6; } 26774echo "${ECHO_T}$ac_cv_have_u_char" >&6; }
14184if test "x$ac_cv_have_u_char" = "xyes" ; then 26775if test "x$ac_cv_have_u_char" = "xyes" ; then
14185 26776
14186$as_echo "#define HAVE_U_CHAR 1" >>confdefs.h 26777cat >>confdefs.h <<\_ACEOF
26778#define HAVE_U_CHAR 1
26779_ACEOF
14187 26780
14188fi 26781fi
14189 26782
14190ac_fn_c_check_type "$LINENO" "intmax_t" "ac_cv_type_intmax_t" " 26783{ echo "$as_me:$LINENO: checking for intmax_t" >&5
26784echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6; }
26785if test "${ac_cv_type_intmax_t+set}" = set; then
26786 echo $ECHO_N "(cached) $ECHO_C" >&6
26787else
26788 cat >conftest.$ac_ext <<_ACEOF
26789/* confdefs.h. */
26790_ACEOF
26791cat confdefs.h >>conftest.$ac_ext
26792cat >>conftest.$ac_ext <<_ACEOF
26793/* end confdefs.h. */
26794
14191#include <sys/types.h> 26795#include <sys/types.h>
14192#include <stdint.h> 26796#include <stdint.h>
14193 26797
14194" 26798
14195if test "x$ac_cv_type_intmax_t" = xyes; then : 26799typedef intmax_t ac__type_new_;
26800int
26801main ()
26802{
26803if ((ac__type_new_ *) 0)
26804 return 0;
26805if (sizeof (ac__type_new_))
26806 return 0;
26807 ;
26808 return 0;
26809}
26810_ACEOF
26811rm -f conftest.$ac_objext
26812if { (ac_try="$ac_compile"
26813case "(($ac_try" in
26814 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26815 *) ac_try_echo=$ac_try;;
26816esac
26817eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26818 (eval "$ac_compile") 2>conftest.er1
26819 ac_status=$?
26820 grep -v '^ *+' conftest.er1 >conftest.err
26821 rm -f conftest.er1
26822 cat conftest.err >&5
26823 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26824 (exit $ac_status); } && {
26825 test -z "$ac_c_werror_flag" ||
26826 test ! -s conftest.err
26827 } && test -s conftest.$ac_objext; then
26828 ac_cv_type_intmax_t=yes
26829else
26830 echo "$as_me: failed program was:" >&5
26831sed 's/^/| /' conftest.$ac_ext >&5
26832
26833 ac_cv_type_intmax_t=no
26834fi
26835
26836rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
26837fi
26838{ echo "$as_me:$LINENO: result: $ac_cv_type_intmax_t" >&5
26839echo "${ECHO_T}$ac_cv_type_intmax_t" >&6; }
26840if test $ac_cv_type_intmax_t = yes; then
14196 26841
14197cat >>confdefs.h <<_ACEOF 26842cat >>confdefs.h <<_ACEOF
14198#define HAVE_INTMAX_T 1 26843#define HAVE_INTMAX_T 1
@@ -14200,12 +26845,64 @@ _ACEOF
14200 26845
14201 26846
14202fi 26847fi
14203ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" " 26848{ echo "$as_me:$LINENO: checking for uintmax_t" >&5
26849echo $ECHO_N "checking for uintmax_t... $ECHO_C" >&6; }
26850if test "${ac_cv_type_uintmax_t+set}" = set; then
26851 echo $ECHO_N "(cached) $ECHO_C" >&6
26852else
26853 cat >conftest.$ac_ext <<_ACEOF
26854/* confdefs.h. */
26855_ACEOF
26856cat confdefs.h >>conftest.$ac_ext
26857cat >>conftest.$ac_ext <<_ACEOF
26858/* end confdefs.h. */
26859
14204#include <sys/types.h> 26860#include <sys/types.h>
14205#include <stdint.h> 26861#include <stdint.h>
14206 26862
14207" 26863
14208if test "x$ac_cv_type_uintmax_t" = xyes; then : 26864typedef uintmax_t ac__type_new_;
26865int
26866main ()
26867{
26868if ((ac__type_new_ *) 0)
26869 return 0;
26870if (sizeof (ac__type_new_))
26871 return 0;
26872 ;
26873 return 0;
26874}
26875_ACEOF
26876rm -f conftest.$ac_objext
26877if { (ac_try="$ac_compile"
26878case "(($ac_try" in
26879 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26880 *) ac_try_echo=$ac_try;;
26881esac
26882eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26883 (eval "$ac_compile") 2>conftest.er1
26884 ac_status=$?
26885 grep -v '^ *+' conftest.er1 >conftest.err
26886 rm -f conftest.er1
26887 cat conftest.err >&5
26888 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26889 (exit $ac_status); } && {
26890 test -z "$ac_c_werror_flag" ||
26891 test ! -s conftest.err
26892 } && test -s conftest.$ac_objext; then
26893 ac_cv_type_uintmax_t=yes
26894else
26895 echo "$as_me: failed program was:" >&5
26896sed 's/^/| /' conftest.$ac_ext >&5
26897
26898 ac_cv_type_uintmax_t=no
26899fi
26900
26901rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
26902fi
26903{ echo "$as_me:$LINENO: result: $ac_cv_type_uintmax_t" >&5
26904echo "${ECHO_T}$ac_cv_type_uintmax_t" >&6; }
26905if test $ac_cv_type_uintmax_t = yes; then
14209 26906
14210cat >>confdefs.h <<_ACEOF 26907cat >>confdefs.h <<_ACEOF
14211#define HAVE_UINTMAX_T 1 26908#define HAVE_UINTMAX_T 1
@@ -14216,17 +26913,69 @@ fi
14216 26913
14217 26914
14218 26915
14219 ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include <sys/types.h> 26916 { echo "$as_me:$LINENO: checking for socklen_t" >&5
26917echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; }
26918if test "${ac_cv_type_socklen_t+set}" = set; then
26919 echo $ECHO_N "(cached) $ECHO_C" >&6
26920else
26921 cat >conftest.$ac_ext <<_ACEOF
26922/* confdefs.h. */
26923_ACEOF
26924cat confdefs.h >>conftest.$ac_ext
26925cat >>conftest.$ac_ext <<_ACEOF
26926/* end confdefs.h. */
26927#include <sys/types.h>
14220#include <sys/socket.h> 26928#include <sys/socket.h>
14221"
14222if test "x$ac_cv_type_socklen_t" = xyes; then :
14223 26929
26930typedef socklen_t ac__type_new_;
26931int
26932main ()
26933{
26934if ((ac__type_new_ *) 0)
26935 return 0;
26936if (sizeof (ac__type_new_))
26937 return 0;
26938 ;
26939 return 0;
26940}
26941_ACEOF
26942rm -f conftest.$ac_objext
26943if { (ac_try="$ac_compile"
26944case "(($ac_try" in
26945 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
26946 *) ac_try_echo=$ac_try;;
26947esac
26948eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
26949 (eval "$ac_compile") 2>conftest.er1
26950 ac_status=$?
26951 grep -v '^ *+' conftest.er1 >conftest.err
26952 rm -f conftest.er1
26953 cat conftest.err >&5
26954 echo "$as_me:$LINENO: \$? = $ac_status" >&5
26955 (exit $ac_status); } && {
26956 test -z "$ac_c_werror_flag" ||
26957 test ! -s conftest.err
26958 } && test -s conftest.$ac_objext; then
26959 ac_cv_type_socklen_t=yes
14224else 26960else
26961 echo "$as_me: failed program was:" >&5
26962sed 's/^/| /' conftest.$ac_ext >&5
26963
26964 ac_cv_type_socklen_t=no
26965fi
14225 26966
14226 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5 26967rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14227$as_echo_n "checking for socklen_t equivalent... " >&6; } 26968fi
14228 if ${curl_cv_socklen_t_equiv+:} false; then : 26969{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
14229 $as_echo_n "(cached) " >&6 26970echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; }
26971if test $ac_cv_type_socklen_t = yes; then
26972 :
26973else
26974
26975 { echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5
26976echo $ECHO_N "checking for socklen_t equivalent... $ECHO_C" >&6; }
26977 if test "${curl_cv_socklen_t_equiv+set}" = set; then
26978 echo $ECHO_N "(cached) $ECHO_C" >&6
14230else 26979else
14231 26980
14232 # Systems have either "struct sockaddr *" or 26981 # Systems have either "struct sockaddr *" or
@@ -14234,7 +26983,11 @@ else
14234 curl_cv_socklen_t_equiv= 26983 curl_cv_socklen_t_equiv=
14235 for arg2 in "struct sockaddr" void; do 26984 for arg2 in "struct sockaddr" void; do
14236 for t in int size_t unsigned long "unsigned long"; do 26985 for t in int size_t unsigned long "unsigned long"; do
14237 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 26986 cat >conftest.$ac_ext <<_ACEOF
26987/* confdefs.h. */
26988_ACEOF
26989cat confdefs.h >>conftest.$ac_ext
26990cat >>conftest.$ac_ext <<_ACEOF
14238/* end confdefs.h. */ 26991/* end confdefs.h. */
14239 26992
14240 #include <sys/types.h> 26993 #include <sys/types.h>
@@ -14253,24 +27006,48 @@ main ()
14253 return 0; 27006 return 0;
14254} 27007}
14255_ACEOF 27008_ACEOF
14256if ac_fn_c_try_compile "$LINENO"; then : 27009rm -f conftest.$ac_objext
27010if { (ac_try="$ac_compile"
27011case "(($ac_try" in
27012 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27013 *) ac_try_echo=$ac_try;;
27014esac
27015eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27016 (eval "$ac_compile") 2>conftest.er1
27017 ac_status=$?
27018 grep -v '^ *+' conftest.er1 >conftest.err
27019 rm -f conftest.er1
27020 cat conftest.err >&5
27021 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27022 (exit $ac_status); } && {
27023 test -z "$ac_c_werror_flag" ||
27024 test ! -s conftest.err
27025 } && test -s conftest.$ac_objext; then
14257 27026
14258 curl_cv_socklen_t_equiv="$t" 27027 curl_cv_socklen_t_equiv="$t"
14259 break 27028 break
14260 27029
27030else
27031 echo "$as_me: failed program was:" >&5
27032sed 's/^/| /' conftest.$ac_ext >&5
27033
27034
14261fi 27035fi
27036
14262rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27037rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14263 done 27038 done
14264 done 27039 done
14265 27040
14266 if test "x$curl_cv_socklen_t_equiv" = x; then 27041 if test "x$curl_cv_socklen_t_equiv" = x; then
14267 as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5 27042 { { echo "$as_me:$LINENO: error: Cannot find a type to use in place of socklen_t" >&5
27043echo "$as_me: error: Cannot find a type to use in place of socklen_t" >&2;}
27044 { (exit 1); exit 1; }; }
14268 fi 27045 fi
14269 27046
14270fi 27047fi
14271 27048
14272 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_socklen_t_equiv" >&5 27049 { echo "$as_me:$LINENO: result: $curl_cv_socklen_t_equiv" >&5
14273$as_echo "$curl_cv_socklen_t_equiv" >&6; } 27050echo "${ECHO_T}$curl_cv_socklen_t_equiv" >&6; }
14274 27051
14275cat >>confdefs.h <<_ACEOF 27052cat >>confdefs.h <<_ACEOF
14276#define socklen_t $curl_cv_socklen_t_equiv 27053#define socklen_t $curl_cv_socklen_t_equiv
@@ -14280,9 +27057,61 @@ fi
14280 27057
14281 27058
14282 27059
14283ac_fn_c_check_type "$LINENO" "sig_atomic_t" "ac_cv_type_sig_atomic_t" "#include <signal.h> 27060{ echo "$as_me:$LINENO: checking for sig_atomic_t" >&5
14284" 27061echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6; }
14285if test "x$ac_cv_type_sig_atomic_t" = xyes; then : 27062if test "${ac_cv_type_sig_atomic_t+set}" = set; then
27063 echo $ECHO_N "(cached) $ECHO_C" >&6
27064else
27065 cat >conftest.$ac_ext <<_ACEOF
27066/* confdefs.h. */
27067_ACEOF
27068cat confdefs.h >>conftest.$ac_ext
27069cat >>conftest.$ac_ext <<_ACEOF
27070/* end confdefs.h. */
27071#include <signal.h>
27072
27073typedef sig_atomic_t ac__type_new_;
27074int
27075main ()
27076{
27077if ((ac__type_new_ *) 0)
27078 return 0;
27079if (sizeof (ac__type_new_))
27080 return 0;
27081 ;
27082 return 0;
27083}
27084_ACEOF
27085rm -f conftest.$ac_objext
27086if { (ac_try="$ac_compile"
27087case "(($ac_try" in
27088 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27089 *) ac_try_echo=$ac_try;;
27090esac
27091eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27092 (eval "$ac_compile") 2>conftest.er1
27093 ac_status=$?
27094 grep -v '^ *+' conftest.er1 >conftest.err
27095 rm -f conftest.er1
27096 cat conftest.err >&5
27097 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27098 (exit $ac_status); } && {
27099 test -z "$ac_c_werror_flag" ||
27100 test ! -s conftest.err
27101 } && test -s conftest.$ac_objext; then
27102 ac_cv_type_sig_atomic_t=yes
27103else
27104 echo "$as_me: failed program was:" >&5
27105sed 's/^/| /' conftest.$ac_ext >&5
27106
27107 ac_cv_type_sig_atomic_t=no
27108fi
27109
27110rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
27111fi
27112{ echo "$as_me:$LINENO: result: $ac_cv_type_sig_atomic_t" >&5
27113echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6; }
27114if test $ac_cv_type_sig_atomic_t = yes; then
14286 27115
14287cat >>confdefs.h <<_ACEOF 27116cat >>confdefs.h <<_ACEOF
14288#define HAVE_SIG_ATOMIC_T 1 27117#define HAVE_SIG_ATOMIC_T 1
@@ -14291,7 +27120,18 @@ _ACEOF
14291 27120
14292fi 27121fi
14293 27122
14294ac_fn_c_check_type "$LINENO" "fsblkcnt_t" "ac_cv_type_fsblkcnt_t" " 27123{ echo "$as_me:$LINENO: checking for fsblkcnt_t" >&5
27124echo $ECHO_N "checking for fsblkcnt_t... $ECHO_C" >&6; }
27125if test "${ac_cv_type_fsblkcnt_t+set}" = set; then
27126 echo $ECHO_N "(cached) $ECHO_C" >&6
27127else
27128 cat >conftest.$ac_ext <<_ACEOF
27129/* confdefs.h. */
27130_ACEOF
27131cat confdefs.h >>conftest.$ac_ext
27132cat >>conftest.$ac_ext <<_ACEOF
27133/* end confdefs.h. */
27134
14295#include <sys/types.h> 27135#include <sys/types.h>
14296#ifdef HAVE_SYS_BITYPES_H 27136#ifdef HAVE_SYS_BITYPES_H
14297#include <sys/bitypes.h> 27137#include <sys/bitypes.h>
@@ -14303,8 +27143,49 @@ ac_fn_c_check_type "$LINENO" "fsblkcnt_t" "ac_cv_type_fsblkcnt_t" "
14303#include <sys/statvfs.h> 27143#include <sys/statvfs.h>
14304#endif 27144#endif
14305 27145
14306" 27146
14307if test "x$ac_cv_type_fsblkcnt_t" = xyes; then : 27147typedef fsblkcnt_t ac__type_new_;
27148int
27149main ()
27150{
27151if ((ac__type_new_ *) 0)
27152 return 0;
27153if (sizeof (ac__type_new_))
27154 return 0;
27155 ;
27156 return 0;
27157}
27158_ACEOF
27159rm -f conftest.$ac_objext
27160if { (ac_try="$ac_compile"
27161case "(($ac_try" in
27162 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27163 *) ac_try_echo=$ac_try;;
27164esac
27165eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27166 (eval "$ac_compile") 2>conftest.er1
27167 ac_status=$?
27168 grep -v '^ *+' conftest.er1 >conftest.err
27169 rm -f conftest.er1
27170 cat conftest.err >&5
27171 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27172 (exit $ac_status); } && {
27173 test -z "$ac_c_werror_flag" ||
27174 test ! -s conftest.err
27175 } && test -s conftest.$ac_objext; then
27176 ac_cv_type_fsblkcnt_t=yes
27177else
27178 echo "$as_me: failed program was:" >&5
27179sed 's/^/| /' conftest.$ac_ext >&5
27180
27181 ac_cv_type_fsblkcnt_t=no
27182fi
27183
27184rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
27185fi
27186{ echo "$as_me:$LINENO: result: $ac_cv_type_fsblkcnt_t" >&5
27187echo "${ECHO_T}$ac_cv_type_fsblkcnt_t" >&6; }
27188if test $ac_cv_type_fsblkcnt_t = yes; then
14308 27189
14309cat >>confdefs.h <<_ACEOF 27190cat >>confdefs.h <<_ACEOF
14310#define HAVE_FSBLKCNT_T 1 27191#define HAVE_FSBLKCNT_T 1
@@ -14312,7 +27193,18 @@ _ACEOF
14312 27193
14313 27194
14314fi 27195fi
14315ac_fn_c_check_type "$LINENO" "fsfilcnt_t" "ac_cv_type_fsfilcnt_t" " 27196{ echo "$as_me:$LINENO: checking for fsfilcnt_t" >&5
27197echo $ECHO_N "checking for fsfilcnt_t... $ECHO_C" >&6; }
27198if test "${ac_cv_type_fsfilcnt_t+set}" = set; then
27199 echo $ECHO_N "(cached) $ECHO_C" >&6
27200else
27201 cat >conftest.$ac_ext <<_ACEOF
27202/* confdefs.h. */
27203_ACEOF
27204cat confdefs.h >>conftest.$ac_ext
27205cat >>conftest.$ac_ext <<_ACEOF
27206/* end confdefs.h. */
27207
14316#include <sys/types.h> 27208#include <sys/types.h>
14317#ifdef HAVE_SYS_BITYPES_H 27209#ifdef HAVE_SYS_BITYPES_H
14318#include <sys/bitypes.h> 27210#include <sys/bitypes.h>
@@ -14324,8 +27216,49 @@ ac_fn_c_check_type "$LINENO" "fsfilcnt_t" "ac_cv_type_fsfilcnt_t" "
14324#include <sys/statvfs.h> 27216#include <sys/statvfs.h>
14325#endif 27217#endif
14326 27218
14327" 27219
14328if test "x$ac_cv_type_fsfilcnt_t" = xyes; then : 27220typedef fsfilcnt_t ac__type_new_;
27221int
27222main ()
27223{
27224if ((ac__type_new_ *) 0)
27225 return 0;
27226if (sizeof (ac__type_new_))
27227 return 0;
27228 ;
27229 return 0;
27230}
27231_ACEOF
27232rm -f conftest.$ac_objext
27233if { (ac_try="$ac_compile"
27234case "(($ac_try" in
27235 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27236 *) ac_try_echo=$ac_try;;
27237esac
27238eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27239 (eval "$ac_compile") 2>conftest.er1
27240 ac_status=$?
27241 grep -v '^ *+' conftest.er1 >conftest.err
27242 rm -f conftest.er1
27243 cat conftest.err >&5
27244 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27245 (exit $ac_status); } && {
27246 test -z "$ac_c_werror_flag" ||
27247 test ! -s conftest.err
27248 } && test -s conftest.$ac_objext; then
27249 ac_cv_type_fsfilcnt_t=yes
27250else
27251 echo "$as_me: failed program was:" >&5
27252sed 's/^/| /' conftest.$ac_ext >&5
27253
27254 ac_cv_type_fsfilcnt_t=no
27255fi
27256
27257rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
27258fi
27259{ echo "$as_me:$LINENO: result: $ac_cv_type_fsfilcnt_t" >&5
27260echo "${ECHO_T}$ac_cv_type_fsfilcnt_t" >&6; }
27261if test $ac_cv_type_fsfilcnt_t = yes; then
14329 27262
14330cat >>confdefs.h <<_ACEOF 27263cat >>confdefs.h <<_ACEOF
14331#define HAVE_FSFILCNT_T 1 27264#define HAVE_FSFILCNT_T 1
@@ -14335,10 +27268,62 @@ _ACEOF
14335fi 27268fi
14336 27269
14337 27270
14338ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" "#include <sys/types.h> 27271{ echo "$as_me:$LINENO: checking for in_addr_t" >&5
27272echo $ECHO_N "checking for in_addr_t... $ECHO_C" >&6; }
27273if test "${ac_cv_type_in_addr_t+set}" = set; then
27274 echo $ECHO_N "(cached) $ECHO_C" >&6
27275else
27276 cat >conftest.$ac_ext <<_ACEOF
27277/* confdefs.h. */
27278_ACEOF
27279cat confdefs.h >>conftest.$ac_ext
27280cat >>conftest.$ac_ext <<_ACEOF
27281/* end confdefs.h. */
27282#include <sys/types.h>
14339#include <netinet/in.h> 27283#include <netinet/in.h>
14340" 27284
14341if test "x$ac_cv_type_in_addr_t" = xyes; then : 27285typedef in_addr_t ac__type_new_;
27286int
27287main ()
27288{
27289if ((ac__type_new_ *) 0)
27290 return 0;
27291if (sizeof (ac__type_new_))
27292 return 0;
27293 ;
27294 return 0;
27295}
27296_ACEOF
27297rm -f conftest.$ac_objext
27298if { (ac_try="$ac_compile"
27299case "(($ac_try" in
27300 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27301 *) ac_try_echo=$ac_try;;
27302esac
27303eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27304 (eval "$ac_compile") 2>conftest.er1
27305 ac_status=$?
27306 grep -v '^ *+' conftest.er1 >conftest.err
27307 rm -f conftest.er1
27308 cat conftest.err >&5
27309 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27310 (exit $ac_status); } && {
27311 test -z "$ac_c_werror_flag" ||
27312 test ! -s conftest.err
27313 } && test -s conftest.$ac_objext; then
27314 ac_cv_type_in_addr_t=yes
27315else
27316 echo "$as_me: failed program was:" >&5
27317sed 's/^/| /' conftest.$ac_ext >&5
27318
27319 ac_cv_type_in_addr_t=no
27320fi
27321
27322rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
27323fi
27324{ echo "$as_me:$LINENO: result: $ac_cv_type_in_addr_t" >&5
27325echo "${ECHO_T}$ac_cv_type_in_addr_t" >&6; }
27326if test $ac_cv_type_in_addr_t = yes; then
14342 27327
14343cat >>confdefs.h <<_ACEOF 27328cat >>confdefs.h <<_ACEOF
14344#define HAVE_IN_ADDR_T 1 27329#define HAVE_IN_ADDR_T 1
@@ -14346,10 +27331,62 @@ _ACEOF
14346 27331
14347 27332
14348fi 27333fi
14349ac_fn_c_check_type "$LINENO" "in_port_t" "ac_cv_type_in_port_t" "#include <sys/types.h> 27334{ echo "$as_me:$LINENO: checking for in_port_t" >&5
27335echo $ECHO_N "checking for in_port_t... $ECHO_C" >&6; }
27336if test "${ac_cv_type_in_port_t+set}" = set; then
27337 echo $ECHO_N "(cached) $ECHO_C" >&6
27338else
27339 cat >conftest.$ac_ext <<_ACEOF
27340/* confdefs.h. */
27341_ACEOF
27342cat confdefs.h >>conftest.$ac_ext
27343cat >>conftest.$ac_ext <<_ACEOF
27344/* end confdefs.h. */
27345#include <sys/types.h>
14350#include <netinet/in.h> 27346#include <netinet/in.h>
14351" 27347
14352if test "x$ac_cv_type_in_port_t" = xyes; then : 27348typedef in_port_t ac__type_new_;
27349int
27350main ()
27351{
27352if ((ac__type_new_ *) 0)
27353 return 0;
27354if (sizeof (ac__type_new_))
27355 return 0;
27356 ;
27357 return 0;
27358}
27359_ACEOF
27360rm -f conftest.$ac_objext
27361if { (ac_try="$ac_compile"
27362case "(($ac_try" in
27363 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27364 *) ac_try_echo=$ac_try;;
27365esac
27366eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27367 (eval "$ac_compile") 2>conftest.er1
27368 ac_status=$?
27369 grep -v '^ *+' conftest.er1 >conftest.err
27370 rm -f conftest.er1
27371 cat conftest.err >&5
27372 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27373 (exit $ac_status); } && {
27374 test -z "$ac_c_werror_flag" ||
27375 test ! -s conftest.err
27376 } && test -s conftest.$ac_objext; then
27377 ac_cv_type_in_port_t=yes
27378else
27379 echo "$as_me: failed program was:" >&5
27380sed 's/^/| /' conftest.$ac_ext >&5
27381
27382 ac_cv_type_in_port_t=no
27383fi
27384
27385rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
27386fi
27387{ echo "$as_me:$LINENO: result: $ac_cv_type_in_port_t" >&5
27388echo "${ECHO_T}$ac_cv_type_in_port_t" >&6; }
27389if test $ac_cv_type_in_port_t = yes; then
14353 27390
14354cat >>confdefs.h <<_ACEOF 27391cat >>confdefs.h <<_ACEOF
14355#define HAVE_IN_PORT_T 1 27392#define HAVE_IN_PORT_T 1
@@ -14359,13 +27396,17 @@ _ACEOF
14359fi 27396fi
14360 27397
14361 27398
14362{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for size_t" >&5 27399{ echo "$as_me:$LINENO: checking for size_t" >&5
14363$as_echo_n "checking for size_t... " >&6; } 27400echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
14364if ${ac_cv_have_size_t+:} false; then : 27401if test "${ac_cv_have_size_t+set}" = set; then
14365 $as_echo_n "(cached) " >&6 27402 echo $ECHO_N "(cached) $ECHO_C" >&6
14366else 27403else
14367 27404
14368 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 27405 cat >conftest.$ac_ext <<_ACEOF
27406/* confdefs.h. */
27407_ACEOF
27408cat confdefs.h >>conftest.$ac_ext
27409cat >>conftest.$ac_ext <<_ACEOF
14369/* end confdefs.h. */ 27410/* end confdefs.h. */
14370 #include <sys/types.h> 27411 #include <sys/types.h>
14371int 27412int
@@ -14376,30 +27417,56 @@ main ()
14376 return 0; 27417 return 0;
14377} 27418}
14378_ACEOF 27419_ACEOF
14379if ac_fn_c_try_compile "$LINENO"; then : 27420rm -f conftest.$ac_objext
27421if { (ac_try="$ac_compile"
27422case "(($ac_try" in
27423 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27424 *) ac_try_echo=$ac_try;;
27425esac
27426eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27427 (eval "$ac_compile") 2>conftest.er1
27428 ac_status=$?
27429 grep -v '^ *+' conftest.er1 >conftest.err
27430 rm -f conftest.er1
27431 cat conftest.err >&5
27432 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27433 (exit $ac_status); } && {
27434 test -z "$ac_c_werror_flag" ||
27435 test ! -s conftest.err
27436 } && test -s conftest.$ac_objext; then
14380 ac_cv_have_size_t="yes" 27437 ac_cv_have_size_t="yes"
14381else 27438else
14382 ac_cv_have_size_t="no" 27439 echo "$as_me: failed program was:" >&5
27440sed 's/^/| /' conftest.$ac_ext >&5
27441
27442 ac_cv_have_size_t="no"
14383 27443
14384fi 27444fi
27445
14385rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27446rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14386 27447
14387fi 27448fi
14388{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_size_t" >&5 27449{ echo "$as_me:$LINENO: result: $ac_cv_have_size_t" >&5
14389$as_echo "$ac_cv_have_size_t" >&6; } 27450echo "${ECHO_T}$ac_cv_have_size_t" >&6; }
14390if test "x$ac_cv_have_size_t" = "xyes" ; then 27451if test "x$ac_cv_have_size_t" = "xyes" ; then
14391 27452
14392$as_echo "#define HAVE_SIZE_T 1" >>confdefs.h 27453cat >>confdefs.h <<\_ACEOF
27454#define HAVE_SIZE_T 1
27455_ACEOF
14393 27456
14394fi 27457fi
14395 27458
14396{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5 27459{ echo "$as_me:$LINENO: checking for ssize_t" >&5
14397$as_echo_n "checking for ssize_t... " >&6; } 27460echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; }
14398if ${ac_cv_have_ssize_t+:} false; then : 27461if test "${ac_cv_have_ssize_t+set}" = set; then
14399 $as_echo_n "(cached) " >&6 27462 echo $ECHO_N "(cached) $ECHO_C" >&6
14400else 27463else
14401 27464
14402 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 27465 cat >conftest.$ac_ext <<_ACEOF
27466/* confdefs.h. */
27467_ACEOF
27468cat confdefs.h >>conftest.$ac_ext
27469cat >>conftest.$ac_ext <<_ACEOF
14403/* end confdefs.h. */ 27470/* end confdefs.h. */
14404 #include <sys/types.h> 27471 #include <sys/types.h>
14405int 27472int
@@ -14410,30 +27477,56 @@ main ()
14410 return 0; 27477 return 0;
14411} 27478}
14412_ACEOF 27479_ACEOF
14413if ac_fn_c_try_compile "$LINENO"; then : 27480rm -f conftest.$ac_objext
27481if { (ac_try="$ac_compile"
27482case "(($ac_try" in
27483 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27484 *) ac_try_echo=$ac_try;;
27485esac
27486eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27487 (eval "$ac_compile") 2>conftest.er1
27488 ac_status=$?
27489 grep -v '^ *+' conftest.er1 >conftest.err
27490 rm -f conftest.er1
27491 cat conftest.err >&5
27492 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27493 (exit $ac_status); } && {
27494 test -z "$ac_c_werror_flag" ||
27495 test ! -s conftest.err
27496 } && test -s conftest.$ac_objext; then
14414 ac_cv_have_ssize_t="yes" 27497 ac_cv_have_ssize_t="yes"
14415else 27498else
14416 ac_cv_have_ssize_t="no" 27499 echo "$as_me: failed program was:" >&5
27500sed 's/^/| /' conftest.$ac_ext >&5
27501
27502 ac_cv_have_ssize_t="no"
14417 27503
14418fi 27504fi
27505
14419rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27506rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14420 27507
14421fi 27508fi
14422{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_ssize_t" >&5 27509{ echo "$as_me:$LINENO: result: $ac_cv_have_ssize_t" >&5
14423$as_echo "$ac_cv_have_ssize_t" >&6; } 27510echo "${ECHO_T}$ac_cv_have_ssize_t" >&6; }
14424if test "x$ac_cv_have_ssize_t" = "xyes" ; then 27511if test "x$ac_cv_have_ssize_t" = "xyes" ; then
14425 27512
14426$as_echo "#define HAVE_SSIZE_T 1" >>confdefs.h 27513cat >>confdefs.h <<\_ACEOF
27514#define HAVE_SSIZE_T 1
27515_ACEOF
14427 27516
14428fi 27517fi
14429 27518
14430{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_t" >&5 27519{ echo "$as_me:$LINENO: checking for clock_t" >&5
14431$as_echo_n "checking for clock_t... " >&6; } 27520echo $ECHO_N "checking for clock_t... $ECHO_C" >&6; }
14432if ${ac_cv_have_clock_t+:} false; then : 27521if test "${ac_cv_have_clock_t+set}" = set; then
14433 $as_echo_n "(cached) " >&6 27522 echo $ECHO_N "(cached) $ECHO_C" >&6
14434else 27523else
14435 27524
14436 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 27525 cat >conftest.$ac_ext <<_ACEOF
27526/* confdefs.h. */
27527_ACEOF
27528cat confdefs.h >>conftest.$ac_ext
27529cat >>conftest.$ac_ext <<_ACEOF
14437/* end confdefs.h. */ 27530/* end confdefs.h. */
14438 #include <time.h> 27531 #include <time.h>
14439int 27532int
@@ -14444,30 +27537,56 @@ main ()
14444 return 0; 27537 return 0;
14445} 27538}
14446_ACEOF 27539_ACEOF
14447if ac_fn_c_try_compile "$LINENO"; then : 27540rm -f conftest.$ac_objext
27541if { (ac_try="$ac_compile"
27542case "(($ac_try" in
27543 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27544 *) ac_try_echo=$ac_try;;
27545esac
27546eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27547 (eval "$ac_compile") 2>conftest.er1
27548 ac_status=$?
27549 grep -v '^ *+' conftest.er1 >conftest.err
27550 rm -f conftest.er1
27551 cat conftest.err >&5
27552 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27553 (exit $ac_status); } && {
27554 test -z "$ac_c_werror_flag" ||
27555 test ! -s conftest.err
27556 } && test -s conftest.$ac_objext; then
14448 ac_cv_have_clock_t="yes" 27557 ac_cv_have_clock_t="yes"
14449else 27558else
14450 ac_cv_have_clock_t="no" 27559 echo "$as_me: failed program was:" >&5
27560sed 's/^/| /' conftest.$ac_ext >&5
27561
27562 ac_cv_have_clock_t="no"
14451 27563
14452fi 27564fi
27565
14453rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27566rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14454 27567
14455fi 27568fi
14456{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_clock_t" >&5 27569{ echo "$as_me:$LINENO: result: $ac_cv_have_clock_t" >&5
14457$as_echo "$ac_cv_have_clock_t" >&6; } 27570echo "${ECHO_T}$ac_cv_have_clock_t" >&6; }
14458if test "x$ac_cv_have_clock_t" = "xyes" ; then 27571if test "x$ac_cv_have_clock_t" = "xyes" ; then
14459 27572
14460$as_echo "#define HAVE_CLOCK_T 1" >>confdefs.h 27573cat >>confdefs.h <<\_ACEOF
27574#define HAVE_CLOCK_T 1
27575_ACEOF
14461 27576
14462fi 27577fi
14463 27578
14464{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sa_family_t" >&5 27579{ echo "$as_me:$LINENO: checking for sa_family_t" >&5
14465$as_echo_n "checking for sa_family_t... " >&6; } 27580echo $ECHO_N "checking for sa_family_t... $ECHO_C" >&6; }
14466if ${ac_cv_have_sa_family_t+:} false; then : 27581if test "${ac_cv_have_sa_family_t+set}" = set; then
14467 $as_echo_n "(cached) " >&6 27582 echo $ECHO_N "(cached) $ECHO_C" >&6
14468else 27583else
14469 27584
14470 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 27585 cat >conftest.$ac_ext <<_ACEOF
27586/* confdefs.h. */
27587_ACEOF
27588cat confdefs.h >>conftest.$ac_ext
27589cat >>conftest.$ac_ext <<_ACEOF
14471/* end confdefs.h. */ 27590/* end confdefs.h. */
14472 27591
14473#include <sys/types.h> 27592#include <sys/types.h>
@@ -14481,10 +27600,33 @@ main ()
14481 return 0; 27600 return 0;
14482} 27601}
14483_ACEOF 27602_ACEOF
14484if ac_fn_c_try_compile "$LINENO"; then : 27603rm -f conftest.$ac_objext
27604if { (ac_try="$ac_compile"
27605case "(($ac_try" in
27606 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27607 *) ac_try_echo=$ac_try;;
27608esac
27609eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27610 (eval "$ac_compile") 2>conftest.er1
27611 ac_status=$?
27612 grep -v '^ *+' conftest.er1 >conftest.err
27613 rm -f conftest.er1
27614 cat conftest.err >&5
27615 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27616 (exit $ac_status); } && {
27617 test -z "$ac_c_werror_flag" ||
27618 test ! -s conftest.err
27619 } && test -s conftest.$ac_objext; then
14485 ac_cv_have_sa_family_t="yes" 27620 ac_cv_have_sa_family_t="yes"
14486else 27621else
14487 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 27622 echo "$as_me: failed program was:" >&5
27623sed 's/^/| /' conftest.$ac_ext >&5
27624
27625 cat >conftest.$ac_ext <<_ACEOF
27626/* confdefs.h. */
27627_ACEOF
27628cat confdefs.h >>conftest.$ac_ext
27629cat >>conftest.$ac_ext <<_ACEOF
14488/* end confdefs.h. */ 27630/* end confdefs.h. */
14489 27631
14490#include <sys/types.h> 27632#include <sys/types.h>
@@ -14499,33 +27641,60 @@ main ()
14499 return 0; 27641 return 0;
14500} 27642}
14501_ACEOF 27643_ACEOF
14502if ac_fn_c_try_compile "$LINENO"; then : 27644rm -f conftest.$ac_objext
27645if { (ac_try="$ac_compile"
27646case "(($ac_try" in
27647 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27648 *) ac_try_echo=$ac_try;;
27649esac
27650eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27651 (eval "$ac_compile") 2>conftest.er1
27652 ac_status=$?
27653 grep -v '^ *+' conftest.er1 >conftest.err
27654 rm -f conftest.er1
27655 cat conftest.err >&5
27656 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27657 (exit $ac_status); } && {
27658 test -z "$ac_c_werror_flag" ||
27659 test ! -s conftest.err
27660 } && test -s conftest.$ac_objext; then
14503 ac_cv_have_sa_family_t="yes" 27661 ac_cv_have_sa_family_t="yes"
14504else 27662else
14505 ac_cv_have_sa_family_t="no" 27663 echo "$as_me: failed program was:" >&5
27664sed 's/^/| /' conftest.$ac_ext >&5
27665
27666 ac_cv_have_sa_family_t="no"
14506 27667
14507fi 27668fi
27669
14508rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27670rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14509 27671
14510fi 27672fi
27673
14511rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27674rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14512 27675
14513fi 27676fi
14514{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_sa_family_t" >&5 27677{ echo "$as_me:$LINENO: result: $ac_cv_have_sa_family_t" >&5
14515$as_echo "$ac_cv_have_sa_family_t" >&6; } 27678echo "${ECHO_T}$ac_cv_have_sa_family_t" >&6; }
14516if test "x$ac_cv_have_sa_family_t" = "xyes" ; then 27679if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
14517 27680
14518$as_echo "#define HAVE_SA_FAMILY_T 1" >>confdefs.h 27681cat >>confdefs.h <<\_ACEOF
27682#define HAVE_SA_FAMILY_T 1
27683_ACEOF
14519 27684
14520fi 27685fi
14521 27686
14522{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pid_t" >&5 27687{ echo "$as_me:$LINENO: checking for pid_t" >&5
14523$as_echo_n "checking for pid_t... " >&6; } 27688echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; }
14524if ${ac_cv_have_pid_t+:} false; then : 27689if test "${ac_cv_have_pid_t+set}" = set; then
14525 $as_echo_n "(cached) " >&6 27690 echo $ECHO_N "(cached) $ECHO_C" >&6
14526else 27691else
14527 27692
14528 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 27693 cat >conftest.$ac_ext <<_ACEOF
27694/* confdefs.h. */
27695_ACEOF
27696cat confdefs.h >>conftest.$ac_ext
27697cat >>conftest.$ac_ext <<_ACEOF
14529/* end confdefs.h. */ 27698/* end confdefs.h. */
14530 #include <sys/types.h> 27699 #include <sys/types.h>
14531int 27700int
@@ -14536,30 +27705,56 @@ main ()
14536 return 0; 27705 return 0;
14537} 27706}
14538_ACEOF 27707_ACEOF
14539if ac_fn_c_try_compile "$LINENO"; then : 27708rm -f conftest.$ac_objext
27709if { (ac_try="$ac_compile"
27710case "(($ac_try" in
27711 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27712 *) ac_try_echo=$ac_try;;
27713esac
27714eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27715 (eval "$ac_compile") 2>conftest.er1
27716 ac_status=$?
27717 grep -v '^ *+' conftest.er1 >conftest.err
27718 rm -f conftest.er1
27719 cat conftest.err >&5
27720 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27721 (exit $ac_status); } && {
27722 test -z "$ac_c_werror_flag" ||
27723 test ! -s conftest.err
27724 } && test -s conftest.$ac_objext; then
14540 ac_cv_have_pid_t="yes" 27725 ac_cv_have_pid_t="yes"
14541else 27726else
14542 ac_cv_have_pid_t="no" 27727 echo "$as_me: failed program was:" >&5
27728sed 's/^/| /' conftest.$ac_ext >&5
27729
27730 ac_cv_have_pid_t="no"
14543 27731
14544fi 27732fi
27733
14545rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27734rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14546 27735
14547fi 27736fi
14548{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_pid_t" >&5 27737{ echo "$as_me:$LINENO: result: $ac_cv_have_pid_t" >&5
14549$as_echo "$ac_cv_have_pid_t" >&6; } 27738echo "${ECHO_T}$ac_cv_have_pid_t" >&6; }
14550if test "x$ac_cv_have_pid_t" = "xyes" ; then 27739if test "x$ac_cv_have_pid_t" = "xyes" ; then
14551 27740
14552$as_echo "#define HAVE_PID_T 1" >>confdefs.h 27741cat >>confdefs.h <<\_ACEOF
27742#define HAVE_PID_T 1
27743_ACEOF
14553 27744
14554fi 27745fi
14555 27746
14556{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mode_t" >&5 27747{ echo "$as_me:$LINENO: checking for mode_t" >&5
14557$as_echo_n "checking for mode_t... " >&6; } 27748echo $ECHO_N "checking for mode_t... $ECHO_C" >&6; }
14558if ${ac_cv_have_mode_t+:} false; then : 27749if test "${ac_cv_have_mode_t+set}" = set; then
14559 $as_echo_n "(cached) " >&6 27750 echo $ECHO_N "(cached) $ECHO_C" >&6
14560else 27751else
14561 27752
14562 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 27753 cat >conftest.$ac_ext <<_ACEOF
27754/* confdefs.h. */
27755_ACEOF
27756cat confdefs.h >>conftest.$ac_ext
27757cat >>conftest.$ac_ext <<_ACEOF
14563/* end confdefs.h. */ 27758/* end confdefs.h. */
14564 #include <sys/types.h> 27759 #include <sys/types.h>
14565int 27760int
@@ -14570,31 +27765,57 @@ main ()
14570 return 0; 27765 return 0;
14571} 27766}
14572_ACEOF 27767_ACEOF
14573if ac_fn_c_try_compile "$LINENO"; then : 27768rm -f conftest.$ac_objext
27769if { (ac_try="$ac_compile"
27770case "(($ac_try" in
27771 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27772 *) ac_try_echo=$ac_try;;
27773esac
27774eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27775 (eval "$ac_compile") 2>conftest.er1
27776 ac_status=$?
27777 grep -v '^ *+' conftest.er1 >conftest.err
27778 rm -f conftest.er1
27779 cat conftest.err >&5
27780 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27781 (exit $ac_status); } && {
27782 test -z "$ac_c_werror_flag" ||
27783 test ! -s conftest.err
27784 } && test -s conftest.$ac_objext; then
14574 ac_cv_have_mode_t="yes" 27785 ac_cv_have_mode_t="yes"
14575else 27786else
14576 ac_cv_have_mode_t="no" 27787 echo "$as_me: failed program was:" >&5
27788sed 's/^/| /' conftest.$ac_ext >&5
27789
27790 ac_cv_have_mode_t="no"
14577 27791
14578fi 27792fi
27793
14579rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27794rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14580 27795
14581fi 27796fi
14582{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_mode_t" >&5 27797{ echo "$as_me:$LINENO: result: $ac_cv_have_mode_t" >&5
14583$as_echo "$ac_cv_have_mode_t" >&6; } 27798echo "${ECHO_T}$ac_cv_have_mode_t" >&6; }
14584if test "x$ac_cv_have_mode_t" = "xyes" ; then 27799if test "x$ac_cv_have_mode_t" = "xyes" ; then
14585 27800
14586$as_echo "#define HAVE_MODE_T 1" >>confdefs.h 27801cat >>confdefs.h <<\_ACEOF
27802#define HAVE_MODE_T 1
27803_ACEOF
14587 27804
14588fi 27805fi
14589 27806
14590 27807
14591{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_storage" >&5 27808{ echo "$as_me:$LINENO: checking for struct sockaddr_storage" >&5
14592$as_echo_n "checking for struct sockaddr_storage... " >&6; } 27809echo $ECHO_N "checking for struct sockaddr_storage... $ECHO_C" >&6; }
14593if ${ac_cv_have_struct_sockaddr_storage+:} false; then : 27810if test "${ac_cv_have_struct_sockaddr_storage+set}" = set; then
14594 $as_echo_n "(cached) " >&6 27811 echo $ECHO_N "(cached) $ECHO_C" >&6
14595else 27812else
14596 27813
14597 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 27814 cat >conftest.$ac_ext <<_ACEOF
27815/* confdefs.h. */
27816_ACEOF
27817cat confdefs.h >>conftest.$ac_ext
27818cat >>conftest.$ac_ext <<_ACEOF
14598/* end confdefs.h. */ 27819/* end confdefs.h. */
14599 27820
14600#include <sys/types.h> 27821#include <sys/types.h>
@@ -14608,30 +27829,56 @@ main ()
14608 return 0; 27829 return 0;
14609} 27830}
14610_ACEOF 27831_ACEOF
14611if ac_fn_c_try_compile "$LINENO"; then : 27832rm -f conftest.$ac_objext
27833if { (ac_try="$ac_compile"
27834case "(($ac_try" in
27835 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27836 *) ac_try_echo=$ac_try;;
27837esac
27838eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27839 (eval "$ac_compile") 2>conftest.er1
27840 ac_status=$?
27841 grep -v '^ *+' conftest.er1 >conftest.err
27842 rm -f conftest.er1
27843 cat conftest.err >&5
27844 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27845 (exit $ac_status); } && {
27846 test -z "$ac_c_werror_flag" ||
27847 test ! -s conftest.err
27848 } && test -s conftest.$ac_objext; then
14612 ac_cv_have_struct_sockaddr_storage="yes" 27849 ac_cv_have_struct_sockaddr_storage="yes"
14613else 27850else
14614 ac_cv_have_struct_sockaddr_storage="no" 27851 echo "$as_me: failed program was:" >&5
27852sed 's/^/| /' conftest.$ac_ext >&5
27853
27854 ac_cv_have_struct_sockaddr_storage="no"
14615 27855
14616fi 27856fi
27857
14617rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27858rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14618 27859
14619fi 27860fi
14620{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_struct_sockaddr_storage" >&5 27861{ echo "$as_me:$LINENO: result: $ac_cv_have_struct_sockaddr_storage" >&5
14621$as_echo "$ac_cv_have_struct_sockaddr_storage" >&6; } 27862echo "${ECHO_T}$ac_cv_have_struct_sockaddr_storage" >&6; }
14622if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then 27863if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
14623 27864
14624$as_echo "#define HAVE_STRUCT_SOCKADDR_STORAGE 1" >>confdefs.h 27865cat >>confdefs.h <<\_ACEOF
27866#define HAVE_STRUCT_SOCKADDR_STORAGE 1
27867_ACEOF
14625 27868
14626fi 27869fi
14627 27870
14628{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_in6" >&5 27871{ echo "$as_me:$LINENO: checking for struct sockaddr_in6" >&5
14629$as_echo_n "checking for struct sockaddr_in6... " >&6; } 27872echo $ECHO_N "checking for struct sockaddr_in6... $ECHO_C" >&6; }
14630if ${ac_cv_have_struct_sockaddr_in6+:} false; then : 27873if test "${ac_cv_have_struct_sockaddr_in6+set}" = set; then
14631 $as_echo_n "(cached) " >&6 27874 echo $ECHO_N "(cached) $ECHO_C" >&6
14632else 27875else
14633 27876
14634 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 27877 cat >conftest.$ac_ext <<_ACEOF
27878/* confdefs.h. */
27879_ACEOF
27880cat confdefs.h >>conftest.$ac_ext
27881cat >>conftest.$ac_ext <<_ACEOF
14635/* end confdefs.h. */ 27882/* end confdefs.h. */
14636 27883
14637#include <sys/types.h> 27884#include <sys/types.h>
@@ -14645,30 +27892,56 @@ main ()
14645 return 0; 27892 return 0;
14646} 27893}
14647_ACEOF 27894_ACEOF
14648if ac_fn_c_try_compile "$LINENO"; then : 27895rm -f conftest.$ac_objext
27896if { (ac_try="$ac_compile"
27897case "(($ac_try" in
27898 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27899 *) ac_try_echo=$ac_try;;
27900esac
27901eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27902 (eval "$ac_compile") 2>conftest.er1
27903 ac_status=$?
27904 grep -v '^ *+' conftest.er1 >conftest.err
27905 rm -f conftest.er1
27906 cat conftest.err >&5
27907 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27908 (exit $ac_status); } && {
27909 test -z "$ac_c_werror_flag" ||
27910 test ! -s conftest.err
27911 } && test -s conftest.$ac_objext; then
14649 ac_cv_have_struct_sockaddr_in6="yes" 27912 ac_cv_have_struct_sockaddr_in6="yes"
14650else 27913else
14651 ac_cv_have_struct_sockaddr_in6="no" 27914 echo "$as_me: failed program was:" >&5
27915sed 's/^/| /' conftest.$ac_ext >&5
27916
27917 ac_cv_have_struct_sockaddr_in6="no"
14652 27918
14653fi 27919fi
27920
14654rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27921rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14655 27922
14656fi 27923fi
14657{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_struct_sockaddr_in6" >&5 27924{ echo "$as_me:$LINENO: result: $ac_cv_have_struct_sockaddr_in6" >&5
14658$as_echo "$ac_cv_have_struct_sockaddr_in6" >&6; } 27925echo "${ECHO_T}$ac_cv_have_struct_sockaddr_in6" >&6; }
14659if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then 27926if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
14660 27927
14661$as_echo "#define HAVE_STRUCT_SOCKADDR_IN6 1" >>confdefs.h 27928cat >>confdefs.h <<\_ACEOF
27929#define HAVE_STRUCT_SOCKADDR_IN6 1
27930_ACEOF
14662 27931
14663fi 27932fi
14664 27933
14665{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct in6_addr" >&5 27934{ echo "$as_me:$LINENO: checking for struct in6_addr" >&5
14666$as_echo_n "checking for struct in6_addr... " >&6; } 27935echo $ECHO_N "checking for struct in6_addr... $ECHO_C" >&6; }
14667if ${ac_cv_have_struct_in6_addr+:} false; then : 27936if test "${ac_cv_have_struct_in6_addr+set}" = set; then
14668 $as_echo_n "(cached) " >&6 27937 echo $ECHO_N "(cached) $ECHO_C" >&6
14669else 27938else
14670 27939
14671 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 27940 cat >conftest.$ac_ext <<_ACEOF
27941/* confdefs.h. */
27942_ACEOF
27943cat confdefs.h >>conftest.$ac_ext
27944cat >>conftest.$ac_ext <<_ACEOF
14672/* end confdefs.h. */ 27945/* end confdefs.h. */
14673 27946
14674#include <sys/types.h> 27947#include <sys/types.h>
@@ -14682,30 +27955,150 @@ main ()
14682 return 0; 27955 return 0;
14683} 27956}
14684_ACEOF 27957_ACEOF
14685if ac_fn_c_try_compile "$LINENO"; then : 27958rm -f conftest.$ac_objext
27959if { (ac_try="$ac_compile"
27960case "(($ac_try" in
27961 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
27962 *) ac_try_echo=$ac_try;;
27963esac
27964eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
27965 (eval "$ac_compile") 2>conftest.er1
27966 ac_status=$?
27967 grep -v '^ *+' conftest.er1 >conftest.err
27968 rm -f conftest.er1
27969 cat conftest.err >&5
27970 echo "$as_me:$LINENO: \$? = $ac_status" >&5
27971 (exit $ac_status); } && {
27972 test -z "$ac_c_werror_flag" ||
27973 test ! -s conftest.err
27974 } && test -s conftest.$ac_objext; then
14686 ac_cv_have_struct_in6_addr="yes" 27975 ac_cv_have_struct_in6_addr="yes"
14687else 27976else
14688 ac_cv_have_struct_in6_addr="no" 27977 echo "$as_me: failed program was:" >&5
27978sed 's/^/| /' conftest.$ac_ext >&5
27979
27980 ac_cv_have_struct_in6_addr="no"
14689 27981
14690fi 27982fi
27983
14691rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27984rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14692 27985
14693fi 27986fi
14694{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_struct_in6_addr" >&5 27987{ echo "$as_me:$LINENO: result: $ac_cv_have_struct_in6_addr" >&5
14695$as_echo "$ac_cv_have_struct_in6_addr" >&6; } 27988echo "${ECHO_T}$ac_cv_have_struct_in6_addr" >&6; }
14696if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then 27989if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
14697 27990
14698$as_echo "#define HAVE_STRUCT_IN6_ADDR 1" >>confdefs.h 27991cat >>confdefs.h <<\_ACEOF
27992#define HAVE_STRUCT_IN6_ADDR 1
27993_ACEOF
14699 27994
14700 27995
14701 ac_fn_c_check_member "$LINENO" "struct sockaddr_in6" "sin6_scope_id" "ac_cv_member_struct_sockaddr_in6_sin6_scope_id" " 27996 { echo "$as_me:$LINENO: checking for struct sockaddr_in6.sin6_scope_id" >&5
27997echo $ECHO_N "checking for struct sockaddr_in6.sin6_scope_id... $ECHO_C" >&6; }
27998if test "${ac_cv_member_struct_sockaddr_in6_sin6_scope_id+set}" = set; then
27999 echo $ECHO_N "(cached) $ECHO_C" >&6
28000else
28001 cat >conftest.$ac_ext <<_ACEOF
28002/* confdefs.h. */
28003_ACEOF
28004cat confdefs.h >>conftest.$ac_ext
28005cat >>conftest.$ac_ext <<_ACEOF
28006/* end confdefs.h. */
28007
14702#ifdef HAVE_SYS_TYPES_H 28008#ifdef HAVE_SYS_TYPES_H
14703#include <sys/types.h> 28009#include <sys/types.h>
14704#endif 28010#endif
14705#include <netinet/in.h> 28011#include <netinet/in.h>
14706 28012
14707" 28013
14708if test "x$ac_cv_member_struct_sockaddr_in6_sin6_scope_id" = xyes; then : 28014int
28015main ()
28016{
28017static struct sockaddr_in6 ac_aggr;
28018if (ac_aggr.sin6_scope_id)
28019return 0;
28020 ;
28021 return 0;
28022}
28023_ACEOF
28024rm -f conftest.$ac_objext
28025if { (ac_try="$ac_compile"
28026case "(($ac_try" in
28027 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
28028 *) ac_try_echo=$ac_try;;
28029esac
28030eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
28031 (eval "$ac_compile") 2>conftest.er1
28032 ac_status=$?
28033 grep -v '^ *+' conftest.er1 >conftest.err
28034 rm -f conftest.er1
28035 cat conftest.err >&5
28036 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28037 (exit $ac_status); } && {
28038 test -z "$ac_c_werror_flag" ||
28039 test ! -s conftest.err
28040 } && test -s conftest.$ac_objext; then
28041 ac_cv_member_struct_sockaddr_in6_sin6_scope_id=yes
28042else
28043 echo "$as_me: failed program was:" >&5
28044sed 's/^/| /' conftest.$ac_ext >&5
28045
28046 cat >conftest.$ac_ext <<_ACEOF
28047/* confdefs.h. */
28048_ACEOF
28049cat confdefs.h >>conftest.$ac_ext
28050cat >>conftest.$ac_ext <<_ACEOF
28051/* end confdefs.h. */
28052
28053#ifdef HAVE_SYS_TYPES_H
28054#include <sys/types.h>
28055#endif
28056#include <netinet/in.h>
28057
28058
28059int
28060main ()
28061{
28062static struct sockaddr_in6 ac_aggr;
28063if (sizeof ac_aggr.sin6_scope_id)
28064return 0;
28065 ;
28066 return 0;
28067}
28068_ACEOF
28069rm -f conftest.$ac_objext
28070if { (ac_try="$ac_compile"
28071case "(($ac_try" in
28072 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
28073 *) ac_try_echo=$ac_try;;
28074esac
28075eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
28076 (eval "$ac_compile") 2>conftest.er1
28077 ac_status=$?
28078 grep -v '^ *+' conftest.er1 >conftest.err
28079 rm -f conftest.er1
28080 cat conftest.err >&5
28081 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28082 (exit $ac_status); } && {
28083 test -z "$ac_c_werror_flag" ||
28084 test ! -s conftest.err
28085 } && test -s conftest.$ac_objext; then
28086 ac_cv_member_struct_sockaddr_in6_sin6_scope_id=yes
28087else
28088 echo "$as_me: failed program was:" >&5
28089sed 's/^/| /' conftest.$ac_ext >&5
28090
28091 ac_cv_member_struct_sockaddr_in6_sin6_scope_id=no
28092fi
28093
28094rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
28095fi
28096
28097rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
28098fi
28099{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_in6_sin6_scope_id" >&5
28100echo "${ECHO_T}$ac_cv_member_struct_sockaddr_in6_sin6_scope_id" >&6; }
28101if test $ac_cv_member_struct_sockaddr_in6_sin6_scope_id = yes; then
14709 28102
14710cat >>confdefs.h <<_ACEOF 28103cat >>confdefs.h <<_ACEOF
14711#define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1 28104#define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1
@@ -14716,13 +28109,17 @@ fi
14716 28109
14717fi 28110fi
14718 28111
14719{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct addrinfo" >&5 28112{ echo "$as_me:$LINENO: checking for struct addrinfo" >&5
14720$as_echo_n "checking for struct addrinfo... " >&6; } 28113echo $ECHO_N "checking for struct addrinfo... $ECHO_C" >&6; }
14721if ${ac_cv_have_struct_addrinfo+:} false; then : 28114if test "${ac_cv_have_struct_addrinfo+set}" = set; then
14722 $as_echo_n "(cached) " >&6 28115 echo $ECHO_N "(cached) $ECHO_C" >&6
14723else 28116else
14724 28117
14725 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28118 cat >conftest.$ac_ext <<_ACEOF
28119/* confdefs.h. */
28120_ACEOF
28121cat confdefs.h >>conftest.$ac_ext
28122cat >>conftest.$ac_ext <<_ACEOF
14726/* end confdefs.h. */ 28123/* end confdefs.h. */
14727 28124
14728#include <sys/types.h> 28125#include <sys/types.h>
@@ -14737,30 +28134,56 @@ main ()
14737 return 0; 28134 return 0;
14738} 28135}
14739_ACEOF 28136_ACEOF
14740if ac_fn_c_try_compile "$LINENO"; then : 28137rm -f conftest.$ac_objext
28138if { (ac_try="$ac_compile"
28139case "(($ac_try" in
28140 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
28141 *) ac_try_echo=$ac_try;;
28142esac
28143eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
28144 (eval "$ac_compile") 2>conftest.er1
28145 ac_status=$?
28146 grep -v '^ *+' conftest.er1 >conftest.err
28147 rm -f conftest.er1
28148 cat conftest.err >&5
28149 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28150 (exit $ac_status); } && {
28151 test -z "$ac_c_werror_flag" ||
28152 test ! -s conftest.err
28153 } && test -s conftest.$ac_objext; then
14741 ac_cv_have_struct_addrinfo="yes" 28154 ac_cv_have_struct_addrinfo="yes"
14742else 28155else
14743 ac_cv_have_struct_addrinfo="no" 28156 echo "$as_me: failed program was:" >&5
28157sed 's/^/| /' conftest.$ac_ext >&5
28158
28159 ac_cv_have_struct_addrinfo="no"
14744 28160
14745fi 28161fi
28162
14746rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 28163rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14747 28164
14748fi 28165fi
14749{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_struct_addrinfo" >&5 28166{ echo "$as_me:$LINENO: result: $ac_cv_have_struct_addrinfo" >&5
14750$as_echo "$ac_cv_have_struct_addrinfo" >&6; } 28167echo "${ECHO_T}$ac_cv_have_struct_addrinfo" >&6; }
14751if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then 28168if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
14752 28169
14753$as_echo "#define HAVE_STRUCT_ADDRINFO 1" >>confdefs.h 28170cat >>confdefs.h <<\_ACEOF
28171#define HAVE_STRUCT_ADDRINFO 1
28172_ACEOF
14754 28173
14755fi 28174fi
14756 28175
14757{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5 28176{ echo "$as_me:$LINENO: checking for struct timeval" >&5
14758$as_echo_n "checking for struct timeval... " >&6; } 28177echo $ECHO_N "checking for struct timeval... $ECHO_C" >&6; }
14759if ${ac_cv_have_struct_timeval+:} false; then : 28178if test "${ac_cv_have_struct_timeval+set}" = set; then
14760 $as_echo_n "(cached) " >&6 28179 echo $ECHO_N "(cached) $ECHO_C" >&6
14761else 28180else
14762 28181
14763 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28182 cat >conftest.$ac_ext <<_ACEOF
28183/* confdefs.h. */
28184_ACEOF
28185cat confdefs.h >>conftest.$ac_ext
28186cat >>conftest.$ac_ext <<_ACEOF
14764/* end confdefs.h. */ 28187/* end confdefs.h. */
14765 #include <sys/time.h> 28188 #include <sys/time.h>
14766int 28189int
@@ -14771,26 +28194,100 @@ main ()
14771 return 0; 28194 return 0;
14772} 28195}
14773_ACEOF 28196_ACEOF
14774if ac_fn_c_try_compile "$LINENO"; then : 28197rm -f conftest.$ac_objext
28198if { (ac_try="$ac_compile"
28199case "(($ac_try" in
28200 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
28201 *) ac_try_echo=$ac_try;;
28202esac
28203eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
28204 (eval "$ac_compile") 2>conftest.er1
28205 ac_status=$?
28206 grep -v '^ *+' conftest.er1 >conftest.err
28207 rm -f conftest.er1
28208 cat conftest.err >&5
28209 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28210 (exit $ac_status); } && {
28211 test -z "$ac_c_werror_flag" ||
28212 test ! -s conftest.err
28213 } && test -s conftest.$ac_objext; then
14775 ac_cv_have_struct_timeval="yes" 28214 ac_cv_have_struct_timeval="yes"
14776else 28215else
14777 ac_cv_have_struct_timeval="no" 28216 echo "$as_me: failed program was:" >&5
28217sed 's/^/| /' conftest.$ac_ext >&5
28218
28219 ac_cv_have_struct_timeval="no"
14778 28220
14779fi 28221fi
28222
14780rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 28223rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14781 28224
14782fi 28225fi
14783{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_struct_timeval" >&5 28226{ echo "$as_me:$LINENO: result: $ac_cv_have_struct_timeval" >&5
14784$as_echo "$ac_cv_have_struct_timeval" >&6; } 28227echo "${ECHO_T}$ac_cv_have_struct_timeval" >&6; }
14785if test "x$ac_cv_have_struct_timeval" = "xyes" ; then 28228if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
14786 28229
14787$as_echo "#define HAVE_STRUCT_TIMEVAL 1" >>confdefs.h 28230cat >>confdefs.h <<\_ACEOF
28231#define HAVE_STRUCT_TIMEVAL 1
28232_ACEOF
14788 28233
14789 have_struct_timeval=1 28234 have_struct_timeval=1
14790fi 28235fi
14791 28236
14792ac_fn_c_check_type "$LINENO" "struct timespec" "ac_cv_type_struct_timespec" "$ac_includes_default" 28237{ echo "$as_me:$LINENO: checking for struct timespec" >&5
14793if test "x$ac_cv_type_struct_timespec" = xyes; then : 28238echo $ECHO_N "checking for struct timespec... $ECHO_C" >&6; }
28239if test "${ac_cv_type_struct_timespec+set}" = set; then
28240 echo $ECHO_N "(cached) $ECHO_C" >&6
28241else
28242 cat >conftest.$ac_ext <<_ACEOF
28243/* confdefs.h. */
28244_ACEOF
28245cat confdefs.h >>conftest.$ac_ext
28246cat >>conftest.$ac_ext <<_ACEOF
28247/* end confdefs.h. */
28248$ac_includes_default
28249typedef struct timespec ac__type_new_;
28250int
28251main ()
28252{
28253if ((ac__type_new_ *) 0)
28254 return 0;
28255if (sizeof (ac__type_new_))
28256 return 0;
28257 ;
28258 return 0;
28259}
28260_ACEOF
28261rm -f conftest.$ac_objext
28262if { (ac_try="$ac_compile"
28263case "(($ac_try" in
28264 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
28265 *) ac_try_echo=$ac_try;;
28266esac
28267eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
28268 (eval "$ac_compile") 2>conftest.er1
28269 ac_status=$?
28270 grep -v '^ *+' conftest.er1 >conftest.err
28271 rm -f conftest.er1
28272 cat conftest.err >&5
28273 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28274 (exit $ac_status); } && {
28275 test -z "$ac_c_werror_flag" ||
28276 test ! -s conftest.err
28277 } && test -s conftest.$ac_objext; then
28278 ac_cv_type_struct_timespec=yes
28279else
28280 echo "$as_me: failed program was:" >&5
28281sed 's/^/| /' conftest.$ac_ext >&5
28282
28283 ac_cv_type_struct_timespec=no
28284fi
28285
28286rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
28287fi
28288{ echo "$as_me:$LINENO: result: $ac_cv_type_struct_timespec" >&5
28289echo "${ECHO_T}$ac_cv_type_struct_timespec" >&6; }
28290if test $ac_cv_type_struct_timespec = yes; then
14794 28291
14795cat >>confdefs.h <<_ACEOF 28292cat >>confdefs.h <<_ACEOF
14796#define HAVE_STRUCT_TIMESPEC 1 28293#define HAVE_STRUCT_TIMESPEC 1
@@ -14809,12 +28306,16 @@ if test "x$ac_cv_have_int64_t" = "xno" && \
14809 echo "" 28306 echo ""
14810 exit 1; 28307 exit 1;
14811else 28308else
14812 if test "$cross_compiling" = yes; then : 28309 if test "$cross_compiling" = yes; then
14813 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: Assuming working snprintf()" >&5 28310 { echo "$as_me:$LINENO: WARNING: cross compiling: Assuming working snprintf()" >&5
14814$as_echo "$as_me: WARNING: cross compiling: Assuming working snprintf()" >&2;} 28311echo "$as_me: WARNING: cross compiling: Assuming working snprintf()" >&2;}
14815 28312
14816else 28313else
14817 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28314 cat >conftest.$ac_ext <<_ACEOF
28315/* confdefs.h. */
28316_ACEOF
28317cat confdefs.h >>conftest.$ac_ext
28318cat >>conftest.$ac_ext <<_ACEOF
14818/* end confdefs.h. */ 28319/* end confdefs.h. */
14819 28320
14820#include <stdio.h> 28321#include <stdio.h>
@@ -14841,35 +28342,65 @@ main() { exit(0); }
14841#endif 28342#endif
14842 28343
14843_ACEOF 28344_ACEOF
14844if ac_fn_c_try_run "$LINENO"; then : 28345rm -f conftest$ac_exeext
28346if { (ac_try="$ac_link"
28347case "(($ac_try" in
28348 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
28349 *) ac_try_echo=$ac_try;;
28350esac
28351eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
28352 (eval "$ac_link") 2>&5
28353 ac_status=$?
28354 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28355 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
28356 { (case "(($ac_try" in
28357 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
28358 *) ac_try_echo=$ac_try;;
28359esac
28360eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
28361 (eval "$ac_try") 2>&5
28362 ac_status=$?
28363 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28364 (exit $ac_status); }; }; then
14845 true 28365 true
14846else 28366else
14847 $as_echo "#define BROKEN_SNPRINTF 1" >>confdefs.h 28367 echo "$as_me: program exited with status $ac_status" >&5
28368echo "$as_me: failed program was:" >&5
28369sed 's/^/| /' conftest.$ac_ext >&5
28370
28371( exit $ac_status )
28372 cat >>confdefs.h <<\_ACEOF
28373#define BROKEN_SNPRINTF 1
28374_ACEOF
14848 28375
14849fi 28376fi
14850rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 28377rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
14851 conftest.$ac_objext conftest.beam conftest.$ac_ext
14852fi 28378fi
14853 28379
28380
14854fi 28381fi
14855 28382
14856 28383
14857# look for field 'ut_host' in header 'utmp.h' 28384# look for field 'ut_host' in header 'utmp.h'
14858 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28385 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
14859 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_host 28386 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_host
14860 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_host field in utmp.h" >&5 28387 { echo "$as_me:$LINENO: checking for ut_host field in utmp.h" >&5
14861$as_echo_n "checking for ut_host field in utmp.h... " >&6; } 28388echo $ECHO_N "checking for ut_host field in utmp.h... $ECHO_C" >&6; }
14862 if eval \${$ossh_varname+:} false; then : 28389 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
14863 $as_echo_n "(cached) " >&6 28390 echo $ECHO_N "(cached) $ECHO_C" >&6
14864else 28391else
14865 28392
14866 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28393 cat >conftest.$ac_ext <<_ACEOF
28394/* confdefs.h. */
28395_ACEOF
28396cat confdefs.h >>conftest.$ac_ext
28397cat >>conftest.$ac_ext <<_ACEOF
14867/* end confdefs.h. */ 28398/* end confdefs.h. */
14868#include <utmp.h> 28399#include <utmp.h>
14869 28400
14870_ACEOF 28401_ACEOF
14871if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28402if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
14872 $EGREP "ut_host" >/dev/null 2>&1; then : 28403 $EGREP "ut_host" >/dev/null 2>&1; then
14873 eval "$ossh_varname=yes" 28404 eval "$ossh_varname=yes"
14874else 28405else
14875 eval "$ossh_varname=no" 28406 eval "$ossh_varname=no"
@@ -14880,35 +28411,41 @@ fi
14880 28411
14881 ossh_result=`eval 'echo $'"$ossh_varname"` 28412 ossh_result=`eval 'echo $'"$ossh_varname"`
14882 if test -n "`echo $ossh_varname`"; then 28413 if test -n "`echo $ossh_varname`"; then
14883 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28414 { echo "$as_me:$LINENO: result: $ossh_result" >&5
14884$as_echo "$ossh_result" >&6; } 28415echo "${ECHO_T}$ossh_result" >&6; }
14885 if test "x$ossh_result" = "xyes"; then 28416 if test "x$ossh_result" = "xyes"; then
14886 28417
14887$as_echo "#define HAVE_HOST_IN_UTMP 1" >>confdefs.h 28418cat >>confdefs.h <<\_ACEOF
28419#define HAVE_HOST_IN_UTMP 1
28420_ACEOF
14888 28421
14889 fi 28422 fi
14890 else 28423 else
14891 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28424 { echo "$as_me:$LINENO: result: no" >&5
14892$as_echo "no" >&6; } 28425echo "${ECHO_T}no" >&6; }
14893 fi 28426 fi
14894 28427
14895 28428
14896# look for field 'ut_host' in header 'utmpx.h' 28429# look for field 'ut_host' in header 'utmpx.h'
14897 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28430 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
14898 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_host 28431 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_host
14899 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_host field in utmpx.h" >&5 28432 { echo "$as_me:$LINENO: checking for ut_host field in utmpx.h" >&5
14900$as_echo_n "checking for ut_host field in utmpx.h... " >&6; } 28433echo $ECHO_N "checking for ut_host field in utmpx.h... $ECHO_C" >&6; }
14901 if eval \${$ossh_varname+:} false; then : 28434 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
14902 $as_echo_n "(cached) " >&6 28435 echo $ECHO_N "(cached) $ECHO_C" >&6
14903else 28436else
14904 28437
14905 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28438 cat >conftest.$ac_ext <<_ACEOF
28439/* confdefs.h. */
28440_ACEOF
28441cat confdefs.h >>conftest.$ac_ext
28442cat >>conftest.$ac_ext <<_ACEOF
14906/* end confdefs.h. */ 28443/* end confdefs.h. */
14907#include <utmpx.h> 28444#include <utmpx.h>
14908 28445
14909_ACEOF 28446_ACEOF
14910if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28447if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
14911 $EGREP "ut_host" >/dev/null 2>&1; then : 28448 $EGREP "ut_host" >/dev/null 2>&1; then
14912 eval "$ossh_varname=yes" 28449 eval "$ossh_varname=yes"
14913else 28450else
14914 eval "$ossh_varname=no" 28451 eval "$ossh_varname=no"
@@ -14919,35 +28456,41 @@ fi
14919 28456
14920 ossh_result=`eval 'echo $'"$ossh_varname"` 28457 ossh_result=`eval 'echo $'"$ossh_varname"`
14921 if test -n "`echo $ossh_varname`"; then 28458 if test -n "`echo $ossh_varname`"; then
14922 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28459 { echo "$as_me:$LINENO: result: $ossh_result" >&5
14923$as_echo "$ossh_result" >&6; } 28460echo "${ECHO_T}$ossh_result" >&6; }
14924 if test "x$ossh_result" = "xyes"; then 28461 if test "x$ossh_result" = "xyes"; then
14925 28462
14926$as_echo "#define HAVE_HOST_IN_UTMPX 1" >>confdefs.h 28463cat >>confdefs.h <<\_ACEOF
28464#define HAVE_HOST_IN_UTMPX 1
28465_ACEOF
14927 28466
14928 fi 28467 fi
14929 else 28468 else
14930 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28469 { echo "$as_me:$LINENO: result: no" >&5
14931$as_echo "no" >&6; } 28470echo "${ECHO_T}no" >&6; }
14932 fi 28471 fi
14933 28472
14934 28473
14935# look for field 'syslen' in header 'utmpx.h' 28474# look for field 'syslen' in header 'utmpx.h'
14936 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28475 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
14937 ossh_varname="ossh_cv_$ossh_safe""_has_"syslen 28476 ossh_varname="ossh_cv_$ossh_safe""_has_"syslen
14938 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for syslen field in utmpx.h" >&5 28477 { echo "$as_me:$LINENO: checking for syslen field in utmpx.h" >&5
14939$as_echo_n "checking for syslen field in utmpx.h... " >&6; } 28478echo $ECHO_N "checking for syslen field in utmpx.h... $ECHO_C" >&6; }
14940 if eval \${$ossh_varname+:} false; then : 28479 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
14941 $as_echo_n "(cached) " >&6 28480 echo $ECHO_N "(cached) $ECHO_C" >&6
14942else 28481else
14943 28482
14944 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28483 cat >conftest.$ac_ext <<_ACEOF
28484/* confdefs.h. */
28485_ACEOF
28486cat confdefs.h >>conftest.$ac_ext
28487cat >>conftest.$ac_ext <<_ACEOF
14945/* end confdefs.h. */ 28488/* end confdefs.h. */
14946#include <utmpx.h> 28489#include <utmpx.h>
14947 28490
14948_ACEOF 28491_ACEOF
14949if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28492if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
14950 $EGREP "syslen" >/dev/null 2>&1; then : 28493 $EGREP "syslen" >/dev/null 2>&1; then
14951 eval "$ossh_varname=yes" 28494 eval "$ossh_varname=yes"
14952else 28495else
14953 eval "$ossh_varname=no" 28496 eval "$ossh_varname=no"
@@ -14958,35 +28501,41 @@ fi
14958 28501
14959 ossh_result=`eval 'echo $'"$ossh_varname"` 28502 ossh_result=`eval 'echo $'"$ossh_varname"`
14960 if test -n "`echo $ossh_varname`"; then 28503 if test -n "`echo $ossh_varname`"; then
14961 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28504 { echo "$as_me:$LINENO: result: $ossh_result" >&5
14962$as_echo "$ossh_result" >&6; } 28505echo "${ECHO_T}$ossh_result" >&6; }
14963 if test "x$ossh_result" = "xyes"; then 28506 if test "x$ossh_result" = "xyes"; then
14964 28507
14965$as_echo "#define HAVE_SYSLEN_IN_UTMPX 1" >>confdefs.h 28508cat >>confdefs.h <<\_ACEOF
28509#define HAVE_SYSLEN_IN_UTMPX 1
28510_ACEOF
14966 28511
14967 fi 28512 fi
14968 else 28513 else
14969 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28514 { echo "$as_me:$LINENO: result: no" >&5
14970$as_echo "no" >&6; } 28515echo "${ECHO_T}no" >&6; }
14971 fi 28516 fi
14972 28517
14973 28518
14974# look for field 'ut_pid' in header 'utmp.h' 28519# look for field 'ut_pid' in header 'utmp.h'
14975 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28520 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
14976 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_pid 28521 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_pid
14977 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_pid field in utmp.h" >&5 28522 { echo "$as_me:$LINENO: checking for ut_pid field in utmp.h" >&5
14978$as_echo_n "checking for ut_pid field in utmp.h... " >&6; } 28523echo $ECHO_N "checking for ut_pid field in utmp.h... $ECHO_C" >&6; }
14979 if eval \${$ossh_varname+:} false; then : 28524 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
14980 $as_echo_n "(cached) " >&6 28525 echo $ECHO_N "(cached) $ECHO_C" >&6
14981else 28526else
14982 28527
14983 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28528 cat >conftest.$ac_ext <<_ACEOF
28529/* confdefs.h. */
28530_ACEOF
28531cat confdefs.h >>conftest.$ac_ext
28532cat >>conftest.$ac_ext <<_ACEOF
14984/* end confdefs.h. */ 28533/* end confdefs.h. */
14985#include <utmp.h> 28534#include <utmp.h>
14986 28535
14987_ACEOF 28536_ACEOF
14988if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28537if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
14989 $EGREP "ut_pid" >/dev/null 2>&1; then : 28538 $EGREP "ut_pid" >/dev/null 2>&1; then
14990 eval "$ossh_varname=yes" 28539 eval "$ossh_varname=yes"
14991else 28540else
14992 eval "$ossh_varname=no" 28541 eval "$ossh_varname=no"
@@ -14997,35 +28546,41 @@ fi
14997 28546
14998 ossh_result=`eval 'echo $'"$ossh_varname"` 28547 ossh_result=`eval 'echo $'"$ossh_varname"`
14999 if test -n "`echo $ossh_varname`"; then 28548 if test -n "`echo $ossh_varname`"; then
15000 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28549 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15001$as_echo "$ossh_result" >&6; } 28550echo "${ECHO_T}$ossh_result" >&6; }
15002 if test "x$ossh_result" = "xyes"; then 28551 if test "x$ossh_result" = "xyes"; then
15003 28552
15004$as_echo "#define HAVE_PID_IN_UTMP 1" >>confdefs.h 28553cat >>confdefs.h <<\_ACEOF
28554#define HAVE_PID_IN_UTMP 1
28555_ACEOF
15005 28556
15006 fi 28557 fi
15007 else 28558 else
15008 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28559 { echo "$as_me:$LINENO: result: no" >&5
15009$as_echo "no" >&6; } 28560echo "${ECHO_T}no" >&6; }
15010 fi 28561 fi
15011 28562
15012 28563
15013# look for field 'ut_type' in header 'utmp.h' 28564# look for field 'ut_type' in header 'utmp.h'
15014 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28565 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15015 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_type 28566 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_type
15016 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_type field in utmp.h" >&5 28567 { echo "$as_me:$LINENO: checking for ut_type field in utmp.h" >&5
15017$as_echo_n "checking for ut_type field in utmp.h... " >&6; } 28568echo $ECHO_N "checking for ut_type field in utmp.h... $ECHO_C" >&6; }
15018 if eval \${$ossh_varname+:} false; then : 28569 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15019 $as_echo_n "(cached) " >&6 28570 echo $ECHO_N "(cached) $ECHO_C" >&6
15020else 28571else
15021 28572
15022 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28573 cat >conftest.$ac_ext <<_ACEOF
28574/* confdefs.h. */
28575_ACEOF
28576cat confdefs.h >>conftest.$ac_ext
28577cat >>conftest.$ac_ext <<_ACEOF
15023/* end confdefs.h. */ 28578/* end confdefs.h. */
15024#include <utmp.h> 28579#include <utmp.h>
15025 28580
15026_ACEOF 28581_ACEOF
15027if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28582if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15028 $EGREP "ut_type" >/dev/null 2>&1; then : 28583 $EGREP "ut_type" >/dev/null 2>&1; then
15029 eval "$ossh_varname=yes" 28584 eval "$ossh_varname=yes"
15030else 28585else
15031 eval "$ossh_varname=no" 28586 eval "$ossh_varname=no"
@@ -15036,35 +28591,41 @@ fi
15036 28591
15037 ossh_result=`eval 'echo $'"$ossh_varname"` 28592 ossh_result=`eval 'echo $'"$ossh_varname"`
15038 if test -n "`echo $ossh_varname`"; then 28593 if test -n "`echo $ossh_varname`"; then
15039 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28594 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15040$as_echo "$ossh_result" >&6; } 28595echo "${ECHO_T}$ossh_result" >&6; }
15041 if test "x$ossh_result" = "xyes"; then 28596 if test "x$ossh_result" = "xyes"; then
15042 28597
15043$as_echo "#define HAVE_TYPE_IN_UTMP 1" >>confdefs.h 28598cat >>confdefs.h <<\_ACEOF
28599#define HAVE_TYPE_IN_UTMP 1
28600_ACEOF
15044 28601
15045 fi 28602 fi
15046 else 28603 else
15047 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28604 { echo "$as_me:$LINENO: result: no" >&5
15048$as_echo "no" >&6; } 28605echo "${ECHO_T}no" >&6; }
15049 fi 28606 fi
15050 28607
15051 28608
15052# look for field 'ut_type' in header 'utmpx.h' 28609# look for field 'ut_type' in header 'utmpx.h'
15053 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28610 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15054 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_type 28611 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_type
15055 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_type field in utmpx.h" >&5 28612 { echo "$as_me:$LINENO: checking for ut_type field in utmpx.h" >&5
15056$as_echo_n "checking for ut_type field in utmpx.h... " >&6; } 28613echo $ECHO_N "checking for ut_type field in utmpx.h... $ECHO_C" >&6; }
15057 if eval \${$ossh_varname+:} false; then : 28614 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15058 $as_echo_n "(cached) " >&6 28615 echo $ECHO_N "(cached) $ECHO_C" >&6
15059else 28616else
15060 28617
15061 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28618 cat >conftest.$ac_ext <<_ACEOF
28619/* confdefs.h. */
28620_ACEOF
28621cat confdefs.h >>conftest.$ac_ext
28622cat >>conftest.$ac_ext <<_ACEOF
15062/* end confdefs.h. */ 28623/* end confdefs.h. */
15063#include <utmpx.h> 28624#include <utmpx.h>
15064 28625
15065_ACEOF 28626_ACEOF
15066if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28627if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15067 $EGREP "ut_type" >/dev/null 2>&1; then : 28628 $EGREP "ut_type" >/dev/null 2>&1; then
15068 eval "$ossh_varname=yes" 28629 eval "$ossh_varname=yes"
15069else 28630else
15070 eval "$ossh_varname=no" 28631 eval "$ossh_varname=no"
@@ -15075,35 +28636,41 @@ fi
15075 28636
15076 ossh_result=`eval 'echo $'"$ossh_varname"` 28637 ossh_result=`eval 'echo $'"$ossh_varname"`
15077 if test -n "`echo $ossh_varname`"; then 28638 if test -n "`echo $ossh_varname`"; then
15078 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28639 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15079$as_echo "$ossh_result" >&6; } 28640echo "${ECHO_T}$ossh_result" >&6; }
15080 if test "x$ossh_result" = "xyes"; then 28641 if test "x$ossh_result" = "xyes"; then
15081 28642
15082$as_echo "#define HAVE_TYPE_IN_UTMPX 1" >>confdefs.h 28643cat >>confdefs.h <<\_ACEOF
28644#define HAVE_TYPE_IN_UTMPX 1
28645_ACEOF
15083 28646
15084 fi 28647 fi
15085 else 28648 else
15086 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28649 { echo "$as_me:$LINENO: result: no" >&5
15087$as_echo "no" >&6; } 28650echo "${ECHO_T}no" >&6; }
15088 fi 28651 fi
15089 28652
15090 28653
15091# look for field 'ut_tv' in header 'utmp.h' 28654# look for field 'ut_tv' in header 'utmp.h'
15092 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28655 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15093 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_tv 28656 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_tv
15094 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_tv field in utmp.h" >&5 28657 { echo "$as_me:$LINENO: checking for ut_tv field in utmp.h" >&5
15095$as_echo_n "checking for ut_tv field in utmp.h... " >&6; } 28658echo $ECHO_N "checking for ut_tv field in utmp.h... $ECHO_C" >&6; }
15096 if eval \${$ossh_varname+:} false; then : 28659 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15097 $as_echo_n "(cached) " >&6 28660 echo $ECHO_N "(cached) $ECHO_C" >&6
15098else 28661else
15099 28662
15100 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28663 cat >conftest.$ac_ext <<_ACEOF
28664/* confdefs.h. */
28665_ACEOF
28666cat confdefs.h >>conftest.$ac_ext
28667cat >>conftest.$ac_ext <<_ACEOF
15101/* end confdefs.h. */ 28668/* end confdefs.h. */
15102#include <utmp.h> 28669#include <utmp.h>
15103 28670
15104_ACEOF 28671_ACEOF
15105if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28672if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15106 $EGREP "ut_tv" >/dev/null 2>&1; then : 28673 $EGREP "ut_tv" >/dev/null 2>&1; then
15107 eval "$ossh_varname=yes" 28674 eval "$ossh_varname=yes"
15108else 28675else
15109 eval "$ossh_varname=no" 28676 eval "$ossh_varname=no"
@@ -15114,35 +28681,41 @@ fi
15114 28681
15115 ossh_result=`eval 'echo $'"$ossh_varname"` 28682 ossh_result=`eval 'echo $'"$ossh_varname"`
15116 if test -n "`echo $ossh_varname`"; then 28683 if test -n "`echo $ossh_varname`"; then
15117 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28684 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15118$as_echo "$ossh_result" >&6; } 28685echo "${ECHO_T}$ossh_result" >&6; }
15119 if test "x$ossh_result" = "xyes"; then 28686 if test "x$ossh_result" = "xyes"; then
15120 28687
15121$as_echo "#define HAVE_TV_IN_UTMP 1" >>confdefs.h 28688cat >>confdefs.h <<\_ACEOF
28689#define HAVE_TV_IN_UTMP 1
28690_ACEOF
15122 28691
15123 fi 28692 fi
15124 else 28693 else
15125 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28694 { echo "$as_me:$LINENO: result: no" >&5
15126$as_echo "no" >&6; } 28695echo "${ECHO_T}no" >&6; }
15127 fi 28696 fi
15128 28697
15129 28698
15130# look for field 'ut_id' in header 'utmp.h' 28699# look for field 'ut_id' in header 'utmp.h'
15131 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28700 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15132 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_id 28701 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_id
15133 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_id field in utmp.h" >&5 28702 { echo "$as_me:$LINENO: checking for ut_id field in utmp.h" >&5
15134$as_echo_n "checking for ut_id field in utmp.h... " >&6; } 28703echo $ECHO_N "checking for ut_id field in utmp.h... $ECHO_C" >&6; }
15135 if eval \${$ossh_varname+:} false; then : 28704 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15136 $as_echo_n "(cached) " >&6 28705 echo $ECHO_N "(cached) $ECHO_C" >&6
15137else 28706else
15138 28707
15139 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28708 cat >conftest.$ac_ext <<_ACEOF
28709/* confdefs.h. */
28710_ACEOF
28711cat confdefs.h >>conftest.$ac_ext
28712cat >>conftest.$ac_ext <<_ACEOF
15140/* end confdefs.h. */ 28713/* end confdefs.h. */
15141#include <utmp.h> 28714#include <utmp.h>
15142 28715
15143_ACEOF 28716_ACEOF
15144if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28717if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15145 $EGREP "ut_id" >/dev/null 2>&1; then : 28718 $EGREP "ut_id" >/dev/null 2>&1; then
15146 eval "$ossh_varname=yes" 28719 eval "$ossh_varname=yes"
15147else 28720else
15148 eval "$ossh_varname=no" 28721 eval "$ossh_varname=no"
@@ -15153,35 +28726,41 @@ fi
15153 28726
15154 ossh_result=`eval 'echo $'"$ossh_varname"` 28727 ossh_result=`eval 'echo $'"$ossh_varname"`
15155 if test -n "`echo $ossh_varname`"; then 28728 if test -n "`echo $ossh_varname`"; then
15156 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28729 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15157$as_echo "$ossh_result" >&6; } 28730echo "${ECHO_T}$ossh_result" >&6; }
15158 if test "x$ossh_result" = "xyes"; then 28731 if test "x$ossh_result" = "xyes"; then
15159 28732
15160$as_echo "#define HAVE_ID_IN_UTMP 1" >>confdefs.h 28733cat >>confdefs.h <<\_ACEOF
28734#define HAVE_ID_IN_UTMP 1
28735_ACEOF
15161 28736
15162 fi 28737 fi
15163 else 28738 else
15164 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28739 { echo "$as_me:$LINENO: result: no" >&5
15165$as_echo "no" >&6; } 28740echo "${ECHO_T}no" >&6; }
15166 fi 28741 fi
15167 28742
15168 28743
15169# look for field 'ut_id' in header 'utmpx.h' 28744# look for field 'ut_id' in header 'utmpx.h'
15170 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28745 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15171 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_id 28746 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_id
15172 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_id field in utmpx.h" >&5 28747 { echo "$as_me:$LINENO: checking for ut_id field in utmpx.h" >&5
15173$as_echo_n "checking for ut_id field in utmpx.h... " >&6; } 28748echo $ECHO_N "checking for ut_id field in utmpx.h... $ECHO_C" >&6; }
15174 if eval \${$ossh_varname+:} false; then : 28749 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15175 $as_echo_n "(cached) " >&6 28750 echo $ECHO_N "(cached) $ECHO_C" >&6
15176else 28751else
15177 28752
15178 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28753 cat >conftest.$ac_ext <<_ACEOF
28754/* confdefs.h. */
28755_ACEOF
28756cat confdefs.h >>conftest.$ac_ext
28757cat >>conftest.$ac_ext <<_ACEOF
15179/* end confdefs.h. */ 28758/* end confdefs.h. */
15180#include <utmpx.h> 28759#include <utmpx.h>
15181 28760
15182_ACEOF 28761_ACEOF
15183if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28762if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15184 $EGREP "ut_id" >/dev/null 2>&1; then : 28763 $EGREP "ut_id" >/dev/null 2>&1; then
15185 eval "$ossh_varname=yes" 28764 eval "$ossh_varname=yes"
15186else 28765else
15187 eval "$ossh_varname=no" 28766 eval "$ossh_varname=no"
@@ -15192,35 +28771,41 @@ fi
15192 28771
15193 ossh_result=`eval 'echo $'"$ossh_varname"` 28772 ossh_result=`eval 'echo $'"$ossh_varname"`
15194 if test -n "`echo $ossh_varname`"; then 28773 if test -n "`echo $ossh_varname`"; then
15195 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28774 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15196$as_echo "$ossh_result" >&6; } 28775echo "${ECHO_T}$ossh_result" >&6; }
15197 if test "x$ossh_result" = "xyes"; then 28776 if test "x$ossh_result" = "xyes"; then
15198 28777
15199$as_echo "#define HAVE_ID_IN_UTMPX 1" >>confdefs.h 28778cat >>confdefs.h <<\_ACEOF
28779#define HAVE_ID_IN_UTMPX 1
28780_ACEOF
15200 28781
15201 fi 28782 fi
15202 else 28783 else
15203 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28784 { echo "$as_me:$LINENO: result: no" >&5
15204$as_echo "no" >&6; } 28785echo "${ECHO_T}no" >&6; }
15205 fi 28786 fi
15206 28787
15207 28788
15208# look for field 'ut_addr' in header 'utmp.h' 28789# look for field 'ut_addr' in header 'utmp.h'
15209 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28790 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15210 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr 28791 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr
15211 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_addr field in utmp.h" >&5 28792 { echo "$as_me:$LINENO: checking for ut_addr field in utmp.h" >&5
15212$as_echo_n "checking for ut_addr field in utmp.h... " >&6; } 28793echo $ECHO_N "checking for ut_addr field in utmp.h... $ECHO_C" >&6; }
15213 if eval \${$ossh_varname+:} false; then : 28794 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15214 $as_echo_n "(cached) " >&6 28795 echo $ECHO_N "(cached) $ECHO_C" >&6
15215else 28796else
15216 28797
15217 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28798 cat >conftest.$ac_ext <<_ACEOF
28799/* confdefs.h. */
28800_ACEOF
28801cat confdefs.h >>conftest.$ac_ext
28802cat >>conftest.$ac_ext <<_ACEOF
15218/* end confdefs.h. */ 28803/* end confdefs.h. */
15219#include <utmp.h> 28804#include <utmp.h>
15220 28805
15221_ACEOF 28806_ACEOF
15222if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28807if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15223 $EGREP "ut_addr" >/dev/null 2>&1; then : 28808 $EGREP "ut_addr" >/dev/null 2>&1; then
15224 eval "$ossh_varname=yes" 28809 eval "$ossh_varname=yes"
15225else 28810else
15226 eval "$ossh_varname=no" 28811 eval "$ossh_varname=no"
@@ -15231,35 +28816,41 @@ fi
15231 28816
15232 ossh_result=`eval 'echo $'"$ossh_varname"` 28817 ossh_result=`eval 'echo $'"$ossh_varname"`
15233 if test -n "`echo $ossh_varname`"; then 28818 if test -n "`echo $ossh_varname`"; then
15234 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28819 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15235$as_echo "$ossh_result" >&6; } 28820echo "${ECHO_T}$ossh_result" >&6; }
15236 if test "x$ossh_result" = "xyes"; then 28821 if test "x$ossh_result" = "xyes"; then
15237 28822
15238$as_echo "#define HAVE_ADDR_IN_UTMP 1" >>confdefs.h 28823cat >>confdefs.h <<\_ACEOF
28824#define HAVE_ADDR_IN_UTMP 1
28825_ACEOF
15239 28826
15240 fi 28827 fi
15241 else 28828 else
15242 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28829 { echo "$as_me:$LINENO: result: no" >&5
15243$as_echo "no" >&6; } 28830echo "${ECHO_T}no" >&6; }
15244 fi 28831 fi
15245 28832
15246 28833
15247# look for field 'ut_addr' in header 'utmpx.h' 28834# look for field 'ut_addr' in header 'utmpx.h'
15248 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28835 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15249 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr 28836 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr
15250 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_addr field in utmpx.h" >&5 28837 { echo "$as_me:$LINENO: checking for ut_addr field in utmpx.h" >&5
15251$as_echo_n "checking for ut_addr field in utmpx.h... " >&6; } 28838echo $ECHO_N "checking for ut_addr field in utmpx.h... $ECHO_C" >&6; }
15252 if eval \${$ossh_varname+:} false; then : 28839 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15253 $as_echo_n "(cached) " >&6 28840 echo $ECHO_N "(cached) $ECHO_C" >&6
15254else 28841else
15255 28842
15256 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28843 cat >conftest.$ac_ext <<_ACEOF
28844/* confdefs.h. */
28845_ACEOF
28846cat confdefs.h >>conftest.$ac_ext
28847cat >>conftest.$ac_ext <<_ACEOF
15257/* end confdefs.h. */ 28848/* end confdefs.h. */
15258#include <utmpx.h> 28849#include <utmpx.h>
15259 28850
15260_ACEOF 28851_ACEOF
15261if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28852if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15262 $EGREP "ut_addr" >/dev/null 2>&1; then : 28853 $EGREP "ut_addr" >/dev/null 2>&1; then
15263 eval "$ossh_varname=yes" 28854 eval "$ossh_varname=yes"
15264else 28855else
15265 eval "$ossh_varname=no" 28856 eval "$ossh_varname=no"
@@ -15270,35 +28861,41 @@ fi
15270 28861
15271 ossh_result=`eval 'echo $'"$ossh_varname"` 28862 ossh_result=`eval 'echo $'"$ossh_varname"`
15272 if test -n "`echo $ossh_varname`"; then 28863 if test -n "`echo $ossh_varname`"; then
15273 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28864 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15274$as_echo "$ossh_result" >&6; } 28865echo "${ECHO_T}$ossh_result" >&6; }
15275 if test "x$ossh_result" = "xyes"; then 28866 if test "x$ossh_result" = "xyes"; then
15276 28867
15277$as_echo "#define HAVE_ADDR_IN_UTMPX 1" >>confdefs.h 28868cat >>confdefs.h <<\_ACEOF
28869#define HAVE_ADDR_IN_UTMPX 1
28870_ACEOF
15278 28871
15279 fi 28872 fi
15280 else 28873 else
15281 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28874 { echo "$as_me:$LINENO: result: no" >&5
15282$as_echo "no" >&6; } 28875echo "${ECHO_T}no" >&6; }
15283 fi 28876 fi
15284 28877
15285 28878
15286# look for field 'ut_addr_v6' in header 'utmp.h' 28879# look for field 'ut_addr_v6' in header 'utmp.h'
15287 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28880 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15288 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr_v6 28881 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr_v6
15289 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_addr_v6 field in utmp.h" >&5 28882 { echo "$as_me:$LINENO: checking for ut_addr_v6 field in utmp.h" >&5
15290$as_echo_n "checking for ut_addr_v6 field in utmp.h... " >&6; } 28883echo $ECHO_N "checking for ut_addr_v6 field in utmp.h... $ECHO_C" >&6; }
15291 if eval \${$ossh_varname+:} false; then : 28884 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15292 $as_echo_n "(cached) " >&6 28885 echo $ECHO_N "(cached) $ECHO_C" >&6
15293else 28886else
15294 28887
15295 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28888 cat >conftest.$ac_ext <<_ACEOF
28889/* confdefs.h. */
28890_ACEOF
28891cat confdefs.h >>conftest.$ac_ext
28892cat >>conftest.$ac_ext <<_ACEOF
15296/* end confdefs.h. */ 28893/* end confdefs.h. */
15297#include <utmp.h> 28894#include <utmp.h>
15298 28895
15299_ACEOF 28896_ACEOF
15300if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28897if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15301 $EGREP "ut_addr_v6" >/dev/null 2>&1; then : 28898 $EGREP "ut_addr_v6" >/dev/null 2>&1; then
15302 eval "$ossh_varname=yes" 28899 eval "$ossh_varname=yes"
15303else 28900else
15304 eval "$ossh_varname=no" 28901 eval "$ossh_varname=no"
@@ -15309,35 +28906,41 @@ fi
15309 28906
15310 ossh_result=`eval 'echo $'"$ossh_varname"` 28907 ossh_result=`eval 'echo $'"$ossh_varname"`
15311 if test -n "`echo $ossh_varname`"; then 28908 if test -n "`echo $ossh_varname`"; then
15312 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28909 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15313$as_echo "$ossh_result" >&6; } 28910echo "${ECHO_T}$ossh_result" >&6; }
15314 if test "x$ossh_result" = "xyes"; then 28911 if test "x$ossh_result" = "xyes"; then
15315 28912
15316$as_echo "#define HAVE_ADDR_V6_IN_UTMP 1" >>confdefs.h 28913cat >>confdefs.h <<\_ACEOF
28914#define HAVE_ADDR_V6_IN_UTMP 1
28915_ACEOF
15317 28916
15318 fi 28917 fi
15319 else 28918 else
15320 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28919 { echo "$as_me:$LINENO: result: no" >&5
15321$as_echo "no" >&6; } 28920echo "${ECHO_T}no" >&6; }
15322 fi 28921 fi
15323 28922
15324 28923
15325# look for field 'ut_addr_v6' in header 'utmpx.h' 28924# look for field 'ut_addr_v6' in header 'utmpx.h'
15326 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28925 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15327 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr_v6 28926 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr_v6
15328 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_addr_v6 field in utmpx.h" >&5 28927 { echo "$as_me:$LINENO: checking for ut_addr_v6 field in utmpx.h" >&5
15329$as_echo_n "checking for ut_addr_v6 field in utmpx.h... " >&6; } 28928echo $ECHO_N "checking for ut_addr_v6 field in utmpx.h... $ECHO_C" >&6; }
15330 if eval \${$ossh_varname+:} false; then : 28929 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15331 $as_echo_n "(cached) " >&6 28930 echo $ECHO_N "(cached) $ECHO_C" >&6
15332else 28931else
15333 28932
15334 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28933 cat >conftest.$ac_ext <<_ACEOF
28934/* confdefs.h. */
28935_ACEOF
28936cat confdefs.h >>conftest.$ac_ext
28937cat >>conftest.$ac_ext <<_ACEOF
15335/* end confdefs.h. */ 28938/* end confdefs.h. */
15336#include <utmpx.h> 28939#include <utmpx.h>
15337 28940
15338_ACEOF 28941_ACEOF
15339if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28942if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15340 $EGREP "ut_addr_v6" >/dev/null 2>&1; then : 28943 $EGREP "ut_addr_v6" >/dev/null 2>&1; then
15341 eval "$ossh_varname=yes" 28944 eval "$ossh_varname=yes"
15342else 28945else
15343 eval "$ossh_varname=no" 28946 eval "$ossh_varname=no"
@@ -15348,35 +28951,41 @@ fi
15348 28951
15349 ossh_result=`eval 'echo $'"$ossh_varname"` 28952 ossh_result=`eval 'echo $'"$ossh_varname"`
15350 if test -n "`echo $ossh_varname`"; then 28953 if test -n "`echo $ossh_varname`"; then
15351 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28954 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15352$as_echo "$ossh_result" >&6; } 28955echo "${ECHO_T}$ossh_result" >&6; }
15353 if test "x$ossh_result" = "xyes"; then 28956 if test "x$ossh_result" = "xyes"; then
15354 28957
15355$as_echo "#define HAVE_ADDR_V6_IN_UTMPX 1" >>confdefs.h 28958cat >>confdefs.h <<\_ACEOF
28959#define HAVE_ADDR_V6_IN_UTMPX 1
28960_ACEOF
15356 28961
15357 fi 28962 fi
15358 else 28963 else
15359 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28964 { echo "$as_me:$LINENO: result: no" >&5
15360$as_echo "no" >&6; } 28965echo "${ECHO_T}no" >&6; }
15361 fi 28966 fi
15362 28967
15363 28968
15364# look for field 'ut_exit' in header 'utmp.h' 28969# look for field 'ut_exit' in header 'utmp.h'
15365 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28970 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15366 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_exit 28971 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_exit
15367 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_exit field in utmp.h" >&5 28972 { echo "$as_me:$LINENO: checking for ut_exit field in utmp.h" >&5
15368$as_echo_n "checking for ut_exit field in utmp.h... " >&6; } 28973echo $ECHO_N "checking for ut_exit field in utmp.h... $ECHO_C" >&6; }
15369 if eval \${$ossh_varname+:} false; then : 28974 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15370 $as_echo_n "(cached) " >&6 28975 echo $ECHO_N "(cached) $ECHO_C" >&6
15371else 28976else
15372 28977
15373 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 28978 cat >conftest.$ac_ext <<_ACEOF
28979/* confdefs.h. */
28980_ACEOF
28981cat confdefs.h >>conftest.$ac_ext
28982cat >>conftest.$ac_ext <<_ACEOF
15374/* end confdefs.h. */ 28983/* end confdefs.h. */
15375#include <utmp.h> 28984#include <utmp.h>
15376 28985
15377_ACEOF 28986_ACEOF
15378if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28987if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15379 $EGREP "ut_exit" >/dev/null 2>&1; then : 28988 $EGREP "ut_exit" >/dev/null 2>&1; then
15380 eval "$ossh_varname=yes" 28989 eval "$ossh_varname=yes"
15381else 28990else
15382 eval "$ossh_varname=no" 28991 eval "$ossh_varname=no"
@@ -15387,35 +28996,41 @@ fi
15387 28996
15388 ossh_result=`eval 'echo $'"$ossh_varname"` 28997 ossh_result=`eval 'echo $'"$ossh_varname"`
15389 if test -n "`echo $ossh_varname`"; then 28998 if test -n "`echo $ossh_varname`"; then
15390 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28999 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15391$as_echo "$ossh_result" >&6; } 29000echo "${ECHO_T}$ossh_result" >&6; }
15392 if test "x$ossh_result" = "xyes"; then 29001 if test "x$ossh_result" = "xyes"; then
15393 29002
15394$as_echo "#define HAVE_EXIT_IN_UTMP 1" >>confdefs.h 29003cat >>confdefs.h <<\_ACEOF
29004#define HAVE_EXIT_IN_UTMP 1
29005_ACEOF
15395 29006
15396 fi 29007 fi
15397 else 29008 else
15398 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 29009 { echo "$as_me:$LINENO: result: no" >&5
15399$as_echo "no" >&6; } 29010echo "${ECHO_T}no" >&6; }
15400 fi 29011 fi
15401 29012
15402 29013
15403# look for field 'ut_time' in header 'utmp.h' 29014# look for field 'ut_time' in header 'utmp.h'
15404 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 29015 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15405 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_time 29016 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_time
15406 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_time field in utmp.h" >&5 29017 { echo "$as_me:$LINENO: checking for ut_time field in utmp.h" >&5
15407$as_echo_n "checking for ut_time field in utmp.h... " >&6; } 29018echo $ECHO_N "checking for ut_time field in utmp.h... $ECHO_C" >&6; }
15408 if eval \${$ossh_varname+:} false; then : 29019 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15409 $as_echo_n "(cached) " >&6 29020 echo $ECHO_N "(cached) $ECHO_C" >&6
15410else 29021else
15411 29022
15412 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 29023 cat >conftest.$ac_ext <<_ACEOF
29024/* confdefs.h. */
29025_ACEOF
29026cat confdefs.h >>conftest.$ac_ext
29027cat >>conftest.$ac_ext <<_ACEOF
15413/* end confdefs.h. */ 29028/* end confdefs.h. */
15414#include <utmp.h> 29029#include <utmp.h>
15415 29030
15416_ACEOF 29031_ACEOF
15417if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 29032if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15418 $EGREP "ut_time" >/dev/null 2>&1; then : 29033 $EGREP "ut_time" >/dev/null 2>&1; then
15419 eval "$ossh_varname=yes" 29034 eval "$ossh_varname=yes"
15420else 29035else
15421 eval "$ossh_varname=no" 29036 eval "$ossh_varname=no"
@@ -15426,35 +29041,41 @@ fi
15426 29041
15427 ossh_result=`eval 'echo $'"$ossh_varname"` 29042 ossh_result=`eval 'echo $'"$ossh_varname"`
15428 if test -n "`echo $ossh_varname`"; then 29043 if test -n "`echo $ossh_varname`"; then
15429 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 29044 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15430$as_echo "$ossh_result" >&6; } 29045echo "${ECHO_T}$ossh_result" >&6; }
15431 if test "x$ossh_result" = "xyes"; then 29046 if test "x$ossh_result" = "xyes"; then
15432 29047
15433$as_echo "#define HAVE_TIME_IN_UTMP 1" >>confdefs.h 29048cat >>confdefs.h <<\_ACEOF
29049#define HAVE_TIME_IN_UTMP 1
29050_ACEOF
15434 29051
15435 fi 29052 fi
15436 else 29053 else
15437 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 29054 { echo "$as_me:$LINENO: result: no" >&5
15438$as_echo "no" >&6; } 29055echo "${ECHO_T}no" >&6; }
15439 fi 29056 fi
15440 29057
15441 29058
15442# look for field 'ut_time' in header 'utmpx.h' 29059# look for field 'ut_time' in header 'utmpx.h'
15443 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 29060 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15444 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_time 29061 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_time
15445 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_time field in utmpx.h" >&5 29062 { echo "$as_me:$LINENO: checking for ut_time field in utmpx.h" >&5
15446$as_echo_n "checking for ut_time field in utmpx.h... " >&6; } 29063echo $ECHO_N "checking for ut_time field in utmpx.h... $ECHO_C" >&6; }
15447 if eval \${$ossh_varname+:} false; then : 29064 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15448 $as_echo_n "(cached) " >&6 29065 echo $ECHO_N "(cached) $ECHO_C" >&6
15449else 29066else
15450 29067
15451 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 29068 cat >conftest.$ac_ext <<_ACEOF
29069/* confdefs.h. */
29070_ACEOF
29071cat confdefs.h >>conftest.$ac_ext
29072cat >>conftest.$ac_ext <<_ACEOF
15452/* end confdefs.h. */ 29073/* end confdefs.h. */
15453#include <utmpx.h> 29074#include <utmpx.h>
15454 29075
15455_ACEOF 29076_ACEOF
15456if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 29077if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15457 $EGREP "ut_time" >/dev/null 2>&1; then : 29078 $EGREP "ut_time" >/dev/null 2>&1; then
15458 eval "$ossh_varname=yes" 29079 eval "$ossh_varname=yes"
15459else 29080else
15460 eval "$ossh_varname=no" 29081 eval "$ossh_varname=no"
@@ -15465,35 +29086,41 @@ fi
15465 29086
15466 ossh_result=`eval 'echo $'"$ossh_varname"` 29087 ossh_result=`eval 'echo $'"$ossh_varname"`
15467 if test -n "`echo $ossh_varname`"; then 29088 if test -n "`echo $ossh_varname`"; then
15468 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 29089 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15469$as_echo "$ossh_result" >&6; } 29090echo "${ECHO_T}$ossh_result" >&6; }
15470 if test "x$ossh_result" = "xyes"; then 29091 if test "x$ossh_result" = "xyes"; then
15471 29092
15472$as_echo "#define HAVE_TIME_IN_UTMPX 1" >>confdefs.h 29093cat >>confdefs.h <<\_ACEOF
29094#define HAVE_TIME_IN_UTMPX 1
29095_ACEOF
15473 29096
15474 fi 29097 fi
15475 else 29098 else
15476 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 29099 { echo "$as_me:$LINENO: result: no" >&5
15477$as_echo "no" >&6; } 29100echo "${ECHO_T}no" >&6; }
15478 fi 29101 fi
15479 29102
15480 29103
15481# look for field 'ut_tv' in header 'utmpx.h' 29104# look for field 'ut_tv' in header 'utmpx.h'
15482 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 29105 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15483 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_tv 29106 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_tv
15484 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ut_tv field in utmpx.h" >&5 29107 { echo "$as_me:$LINENO: checking for ut_tv field in utmpx.h" >&5
15485$as_echo_n "checking for ut_tv field in utmpx.h... " >&6; } 29108echo $ECHO_N "checking for ut_tv field in utmpx.h... $ECHO_C" >&6; }
15486 if eval \${$ossh_varname+:} false; then : 29109 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15487 $as_echo_n "(cached) " >&6 29110 echo $ECHO_N "(cached) $ECHO_C" >&6
15488else 29111else
15489 29112
15490 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 29113 cat >conftest.$ac_ext <<_ACEOF
29114/* confdefs.h. */
29115_ACEOF
29116cat confdefs.h >>conftest.$ac_ext
29117cat >>conftest.$ac_ext <<_ACEOF
15491/* end confdefs.h. */ 29118/* end confdefs.h. */
15492#include <utmpx.h> 29119#include <utmpx.h>
15493 29120
15494_ACEOF 29121_ACEOF
15495if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 29122if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15496 $EGREP "ut_tv" >/dev/null 2>&1; then : 29123 $EGREP "ut_tv" >/dev/null 2>&1; then
15497 eval "$ossh_varname=yes" 29124 eval "$ossh_varname=yes"
15498else 29125else
15499 eval "$ossh_varname=no" 29126 eval "$ossh_varname=no"
@@ -15504,21 +29131,115 @@ fi
15504 29131
15505 ossh_result=`eval 'echo $'"$ossh_varname"` 29132 ossh_result=`eval 'echo $'"$ossh_varname"`
15506 if test -n "`echo $ossh_varname`"; then 29133 if test -n "`echo $ossh_varname`"; then
15507 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 29134 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15508$as_echo "$ossh_result" >&6; } 29135echo "${ECHO_T}$ossh_result" >&6; }
15509 if test "x$ossh_result" = "xyes"; then 29136 if test "x$ossh_result" = "xyes"; then
15510 29137
15511$as_echo "#define HAVE_TV_IN_UTMPX 1" >>confdefs.h 29138cat >>confdefs.h <<\_ACEOF
29139#define HAVE_TV_IN_UTMPX 1
29140_ACEOF
15512 29141
15513 fi 29142 fi
15514 else 29143 else
15515 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 29144 { echo "$as_me:$LINENO: result: no" >&5
15516$as_echo "no" >&6; } 29145echo "${ECHO_T}no" >&6; }
15517 fi 29146 fi
15518 29147
15519 29148
15520ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" 29149{ echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5
15521if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : 29150echo $ECHO_N "checking for struct stat.st_blksize... $ECHO_C" >&6; }
29151if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then
29152 echo $ECHO_N "(cached) $ECHO_C" >&6
29153else
29154 cat >conftest.$ac_ext <<_ACEOF
29155/* confdefs.h. */
29156_ACEOF
29157cat confdefs.h >>conftest.$ac_ext
29158cat >>conftest.$ac_ext <<_ACEOF
29159/* end confdefs.h. */
29160$ac_includes_default
29161int
29162main ()
29163{
29164static struct stat ac_aggr;
29165if (ac_aggr.st_blksize)
29166return 0;
29167 ;
29168 return 0;
29169}
29170_ACEOF
29171rm -f conftest.$ac_objext
29172if { (ac_try="$ac_compile"
29173case "(($ac_try" in
29174 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29175 *) ac_try_echo=$ac_try;;
29176esac
29177eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29178 (eval "$ac_compile") 2>conftest.er1
29179 ac_status=$?
29180 grep -v '^ *+' conftest.er1 >conftest.err
29181 rm -f conftest.er1
29182 cat conftest.err >&5
29183 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29184 (exit $ac_status); } && {
29185 test -z "$ac_c_werror_flag" ||
29186 test ! -s conftest.err
29187 } && test -s conftest.$ac_objext; then
29188 ac_cv_member_struct_stat_st_blksize=yes
29189else
29190 echo "$as_me: failed program was:" >&5
29191sed 's/^/| /' conftest.$ac_ext >&5
29192
29193 cat >conftest.$ac_ext <<_ACEOF
29194/* confdefs.h. */
29195_ACEOF
29196cat confdefs.h >>conftest.$ac_ext
29197cat >>conftest.$ac_ext <<_ACEOF
29198/* end confdefs.h. */
29199$ac_includes_default
29200int
29201main ()
29202{
29203static struct stat ac_aggr;
29204if (sizeof ac_aggr.st_blksize)
29205return 0;
29206 ;
29207 return 0;
29208}
29209_ACEOF
29210rm -f conftest.$ac_objext
29211if { (ac_try="$ac_compile"
29212case "(($ac_try" in
29213 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29214 *) ac_try_echo=$ac_try;;
29215esac
29216eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29217 (eval "$ac_compile") 2>conftest.er1
29218 ac_status=$?
29219 grep -v '^ *+' conftest.er1 >conftest.err
29220 rm -f conftest.er1
29221 cat conftest.err >&5
29222 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29223 (exit $ac_status); } && {
29224 test -z "$ac_c_werror_flag" ||
29225 test ! -s conftest.err
29226 } && test -s conftest.$ac_objext; then
29227 ac_cv_member_struct_stat_st_blksize=yes
29228else
29229 echo "$as_me: failed program was:" >&5
29230sed 's/^/| /' conftest.$ac_ext >&5
29231
29232 ac_cv_member_struct_stat_st_blksize=no
29233fi
29234
29235rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29236fi
29237
29238rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29239fi
29240{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5
29241echo "${ECHO_T}$ac_cv_member_struct_stat_st_blksize" >&6; }
29242if test $ac_cv_member_struct_stat_st_blksize = yes; then
15522 29243
15523cat >>confdefs.h <<_ACEOF 29244cat >>confdefs.h <<_ACEOF
15524#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 29245#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
@@ -15527,12 +29248,108 @@ _ACEOF
15527 29248
15528fi 29249fi
15529 29250
15530ac_fn_c_check_member "$LINENO" "struct passwd" "pw_gecos" "ac_cv_member_struct_passwd_pw_gecos" " 29251{ echo "$as_me:$LINENO: checking for struct passwd.pw_gecos" >&5
29252echo $ECHO_N "checking for struct passwd.pw_gecos... $ECHO_C" >&6; }
29253if test "${ac_cv_member_struct_passwd_pw_gecos+set}" = set; then
29254 echo $ECHO_N "(cached) $ECHO_C" >&6
29255else
29256 cat >conftest.$ac_ext <<_ACEOF
29257/* confdefs.h. */
29258_ACEOF
29259cat confdefs.h >>conftest.$ac_ext
29260cat >>conftest.$ac_ext <<_ACEOF
29261/* end confdefs.h. */
29262
15531#include <sys/types.h> 29263#include <sys/types.h>
15532#include <pwd.h> 29264#include <pwd.h>
15533 29265
15534" 29266
15535if test "x$ac_cv_member_struct_passwd_pw_gecos" = xyes; then : 29267int
29268main ()
29269{
29270static struct passwd ac_aggr;
29271if (ac_aggr.pw_gecos)
29272return 0;
29273 ;
29274 return 0;
29275}
29276_ACEOF
29277rm -f conftest.$ac_objext
29278if { (ac_try="$ac_compile"
29279case "(($ac_try" in
29280 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29281 *) ac_try_echo=$ac_try;;
29282esac
29283eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29284 (eval "$ac_compile") 2>conftest.er1
29285 ac_status=$?
29286 grep -v '^ *+' conftest.er1 >conftest.err
29287 rm -f conftest.er1
29288 cat conftest.err >&5
29289 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29290 (exit $ac_status); } && {
29291 test -z "$ac_c_werror_flag" ||
29292 test ! -s conftest.err
29293 } && test -s conftest.$ac_objext; then
29294 ac_cv_member_struct_passwd_pw_gecos=yes
29295else
29296 echo "$as_me: failed program was:" >&5
29297sed 's/^/| /' conftest.$ac_ext >&5
29298
29299 cat >conftest.$ac_ext <<_ACEOF
29300/* confdefs.h. */
29301_ACEOF
29302cat confdefs.h >>conftest.$ac_ext
29303cat >>conftest.$ac_ext <<_ACEOF
29304/* end confdefs.h. */
29305
29306#include <sys/types.h>
29307#include <pwd.h>
29308
29309
29310int
29311main ()
29312{
29313static struct passwd ac_aggr;
29314if (sizeof ac_aggr.pw_gecos)
29315return 0;
29316 ;
29317 return 0;
29318}
29319_ACEOF
29320rm -f conftest.$ac_objext
29321if { (ac_try="$ac_compile"
29322case "(($ac_try" in
29323 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29324 *) ac_try_echo=$ac_try;;
29325esac
29326eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29327 (eval "$ac_compile") 2>conftest.er1
29328 ac_status=$?
29329 grep -v '^ *+' conftest.er1 >conftest.err
29330 rm -f conftest.er1
29331 cat conftest.err >&5
29332 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29333 (exit $ac_status); } && {
29334 test -z "$ac_c_werror_flag" ||
29335 test ! -s conftest.err
29336 } && test -s conftest.$ac_objext; then
29337 ac_cv_member_struct_passwd_pw_gecos=yes
29338else
29339 echo "$as_me: failed program was:" >&5
29340sed 's/^/| /' conftest.$ac_ext >&5
29341
29342 ac_cv_member_struct_passwd_pw_gecos=no
29343fi
29344
29345rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29346fi
29347
29348rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29349fi
29350{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_passwd_pw_gecos" >&5
29351echo "${ECHO_T}$ac_cv_member_struct_passwd_pw_gecos" >&6; }
29352if test $ac_cv_member_struct_passwd_pw_gecos = yes; then
15536 29353
15537cat >>confdefs.h <<_ACEOF 29354cat >>confdefs.h <<_ACEOF
15538#define HAVE_STRUCT_PASSWD_PW_GECOS 1 29355#define HAVE_STRUCT_PASSWD_PW_GECOS 1
@@ -15540,12 +29357,108 @@ _ACEOF
15540 29357
15541 29358
15542fi 29359fi
15543ac_fn_c_check_member "$LINENO" "struct passwd" "pw_class" "ac_cv_member_struct_passwd_pw_class" " 29360{ echo "$as_me:$LINENO: checking for struct passwd.pw_class" >&5
29361echo $ECHO_N "checking for struct passwd.pw_class... $ECHO_C" >&6; }
29362if test "${ac_cv_member_struct_passwd_pw_class+set}" = set; then
29363 echo $ECHO_N "(cached) $ECHO_C" >&6
29364else
29365 cat >conftest.$ac_ext <<_ACEOF
29366/* confdefs.h. */
29367_ACEOF
29368cat confdefs.h >>conftest.$ac_ext
29369cat >>conftest.$ac_ext <<_ACEOF
29370/* end confdefs.h. */
29371
29372#include <sys/types.h>
29373#include <pwd.h>
29374
29375
29376int
29377main ()
29378{
29379static struct passwd ac_aggr;
29380if (ac_aggr.pw_class)
29381return 0;
29382 ;
29383 return 0;
29384}
29385_ACEOF
29386rm -f conftest.$ac_objext
29387if { (ac_try="$ac_compile"
29388case "(($ac_try" in
29389 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29390 *) ac_try_echo=$ac_try;;
29391esac
29392eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29393 (eval "$ac_compile") 2>conftest.er1
29394 ac_status=$?
29395 grep -v '^ *+' conftest.er1 >conftest.err
29396 rm -f conftest.er1
29397 cat conftest.err >&5
29398 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29399 (exit $ac_status); } && {
29400 test -z "$ac_c_werror_flag" ||
29401 test ! -s conftest.err
29402 } && test -s conftest.$ac_objext; then
29403 ac_cv_member_struct_passwd_pw_class=yes
29404else
29405 echo "$as_me: failed program was:" >&5
29406sed 's/^/| /' conftest.$ac_ext >&5
29407
29408 cat >conftest.$ac_ext <<_ACEOF
29409/* confdefs.h. */
29410_ACEOF
29411cat confdefs.h >>conftest.$ac_ext
29412cat >>conftest.$ac_ext <<_ACEOF
29413/* end confdefs.h. */
29414
15544#include <sys/types.h> 29415#include <sys/types.h>
15545#include <pwd.h> 29416#include <pwd.h>
15546 29417
15547" 29418
15548if test "x$ac_cv_member_struct_passwd_pw_class" = xyes; then : 29419int
29420main ()
29421{
29422static struct passwd ac_aggr;
29423if (sizeof ac_aggr.pw_class)
29424return 0;
29425 ;
29426 return 0;
29427}
29428_ACEOF
29429rm -f conftest.$ac_objext
29430if { (ac_try="$ac_compile"
29431case "(($ac_try" in
29432 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29433 *) ac_try_echo=$ac_try;;
29434esac
29435eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29436 (eval "$ac_compile") 2>conftest.er1
29437 ac_status=$?
29438 grep -v '^ *+' conftest.er1 >conftest.err
29439 rm -f conftest.er1
29440 cat conftest.err >&5
29441 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29442 (exit $ac_status); } && {
29443 test -z "$ac_c_werror_flag" ||
29444 test ! -s conftest.err
29445 } && test -s conftest.$ac_objext; then
29446 ac_cv_member_struct_passwd_pw_class=yes
29447else
29448 echo "$as_me: failed program was:" >&5
29449sed 's/^/| /' conftest.$ac_ext >&5
29450
29451 ac_cv_member_struct_passwd_pw_class=no
29452fi
29453
29454rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29455fi
29456
29457rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29458fi
29459{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_passwd_pw_class" >&5
29460echo "${ECHO_T}$ac_cv_member_struct_passwd_pw_class" >&6; }
29461if test $ac_cv_member_struct_passwd_pw_class = yes; then
15549 29462
15550cat >>confdefs.h <<_ACEOF 29463cat >>confdefs.h <<_ACEOF
15551#define HAVE_STRUCT_PASSWD_PW_CLASS 1 29464#define HAVE_STRUCT_PASSWD_PW_CLASS 1
@@ -15553,12 +29466,108 @@ _ACEOF
15553 29466
15554 29467
15555fi 29468fi
15556ac_fn_c_check_member "$LINENO" "struct passwd" "pw_change" "ac_cv_member_struct_passwd_pw_change" " 29469{ echo "$as_me:$LINENO: checking for struct passwd.pw_change" >&5
29470echo $ECHO_N "checking for struct passwd.pw_change... $ECHO_C" >&6; }
29471if test "${ac_cv_member_struct_passwd_pw_change+set}" = set; then
29472 echo $ECHO_N "(cached) $ECHO_C" >&6
29473else
29474 cat >conftest.$ac_ext <<_ACEOF
29475/* confdefs.h. */
29476_ACEOF
29477cat confdefs.h >>conftest.$ac_ext
29478cat >>conftest.$ac_ext <<_ACEOF
29479/* end confdefs.h. */
29480
15557#include <sys/types.h> 29481#include <sys/types.h>
15558#include <pwd.h> 29482#include <pwd.h>
15559 29483
15560" 29484
15561if test "x$ac_cv_member_struct_passwd_pw_change" = xyes; then : 29485int
29486main ()
29487{
29488static struct passwd ac_aggr;
29489if (ac_aggr.pw_change)
29490return 0;
29491 ;
29492 return 0;
29493}
29494_ACEOF
29495rm -f conftest.$ac_objext
29496if { (ac_try="$ac_compile"
29497case "(($ac_try" in
29498 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29499 *) ac_try_echo=$ac_try;;
29500esac
29501eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29502 (eval "$ac_compile") 2>conftest.er1
29503 ac_status=$?
29504 grep -v '^ *+' conftest.er1 >conftest.err
29505 rm -f conftest.er1
29506 cat conftest.err >&5
29507 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29508 (exit $ac_status); } && {
29509 test -z "$ac_c_werror_flag" ||
29510 test ! -s conftest.err
29511 } && test -s conftest.$ac_objext; then
29512 ac_cv_member_struct_passwd_pw_change=yes
29513else
29514 echo "$as_me: failed program was:" >&5
29515sed 's/^/| /' conftest.$ac_ext >&5
29516
29517 cat >conftest.$ac_ext <<_ACEOF
29518/* confdefs.h. */
29519_ACEOF
29520cat confdefs.h >>conftest.$ac_ext
29521cat >>conftest.$ac_ext <<_ACEOF
29522/* end confdefs.h. */
29523
29524#include <sys/types.h>
29525#include <pwd.h>
29526
29527
29528int
29529main ()
29530{
29531static struct passwd ac_aggr;
29532if (sizeof ac_aggr.pw_change)
29533return 0;
29534 ;
29535 return 0;
29536}
29537_ACEOF
29538rm -f conftest.$ac_objext
29539if { (ac_try="$ac_compile"
29540case "(($ac_try" in
29541 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29542 *) ac_try_echo=$ac_try;;
29543esac
29544eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29545 (eval "$ac_compile") 2>conftest.er1
29546 ac_status=$?
29547 grep -v '^ *+' conftest.er1 >conftest.err
29548 rm -f conftest.er1
29549 cat conftest.err >&5
29550 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29551 (exit $ac_status); } && {
29552 test -z "$ac_c_werror_flag" ||
29553 test ! -s conftest.err
29554 } && test -s conftest.$ac_objext; then
29555 ac_cv_member_struct_passwd_pw_change=yes
29556else
29557 echo "$as_me: failed program was:" >&5
29558sed 's/^/| /' conftest.$ac_ext >&5
29559
29560 ac_cv_member_struct_passwd_pw_change=no
29561fi
29562
29563rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29564fi
29565
29566rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29567fi
29568{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_passwd_pw_change" >&5
29569echo "${ECHO_T}$ac_cv_member_struct_passwd_pw_change" >&6; }
29570if test $ac_cv_member_struct_passwd_pw_change = yes; then
15562 29571
15563cat >>confdefs.h <<_ACEOF 29572cat >>confdefs.h <<_ACEOF
15564#define HAVE_STRUCT_PASSWD_PW_CHANGE 1 29573#define HAVE_STRUCT_PASSWD_PW_CHANGE 1
@@ -15566,12 +29575,108 @@ _ACEOF
15566 29575
15567 29576
15568fi 29577fi
15569ac_fn_c_check_member "$LINENO" "struct passwd" "pw_expire" "ac_cv_member_struct_passwd_pw_expire" " 29578{ echo "$as_me:$LINENO: checking for struct passwd.pw_expire" >&5
29579echo $ECHO_N "checking for struct passwd.pw_expire... $ECHO_C" >&6; }
29580if test "${ac_cv_member_struct_passwd_pw_expire+set}" = set; then
29581 echo $ECHO_N "(cached) $ECHO_C" >&6
29582else
29583 cat >conftest.$ac_ext <<_ACEOF
29584/* confdefs.h. */
29585_ACEOF
29586cat confdefs.h >>conftest.$ac_ext
29587cat >>conftest.$ac_ext <<_ACEOF
29588/* end confdefs.h. */
29589
15570#include <sys/types.h> 29590#include <sys/types.h>
15571#include <pwd.h> 29591#include <pwd.h>
15572 29592
15573" 29593
15574if test "x$ac_cv_member_struct_passwd_pw_expire" = xyes; then : 29594int
29595main ()
29596{
29597static struct passwd ac_aggr;
29598if (ac_aggr.pw_expire)
29599return 0;
29600 ;
29601 return 0;
29602}
29603_ACEOF
29604rm -f conftest.$ac_objext
29605if { (ac_try="$ac_compile"
29606case "(($ac_try" in
29607 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29608 *) ac_try_echo=$ac_try;;
29609esac
29610eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29611 (eval "$ac_compile") 2>conftest.er1
29612 ac_status=$?
29613 grep -v '^ *+' conftest.er1 >conftest.err
29614 rm -f conftest.er1
29615 cat conftest.err >&5
29616 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29617 (exit $ac_status); } && {
29618 test -z "$ac_c_werror_flag" ||
29619 test ! -s conftest.err
29620 } && test -s conftest.$ac_objext; then
29621 ac_cv_member_struct_passwd_pw_expire=yes
29622else
29623 echo "$as_me: failed program was:" >&5
29624sed 's/^/| /' conftest.$ac_ext >&5
29625
29626 cat >conftest.$ac_ext <<_ACEOF
29627/* confdefs.h. */
29628_ACEOF
29629cat confdefs.h >>conftest.$ac_ext
29630cat >>conftest.$ac_ext <<_ACEOF
29631/* end confdefs.h. */
29632
29633#include <sys/types.h>
29634#include <pwd.h>
29635
29636
29637int
29638main ()
29639{
29640static struct passwd ac_aggr;
29641if (sizeof ac_aggr.pw_expire)
29642return 0;
29643 ;
29644 return 0;
29645}
29646_ACEOF
29647rm -f conftest.$ac_objext
29648if { (ac_try="$ac_compile"
29649case "(($ac_try" in
29650 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29651 *) ac_try_echo=$ac_try;;
29652esac
29653eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29654 (eval "$ac_compile") 2>conftest.er1
29655 ac_status=$?
29656 grep -v '^ *+' conftest.er1 >conftest.err
29657 rm -f conftest.er1
29658 cat conftest.err >&5
29659 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29660 (exit $ac_status); } && {
29661 test -z "$ac_c_werror_flag" ||
29662 test ! -s conftest.err
29663 } && test -s conftest.$ac_objext; then
29664 ac_cv_member_struct_passwd_pw_expire=yes
29665else
29666 echo "$as_me: failed program was:" >&5
29667sed 's/^/| /' conftest.$ac_ext >&5
29668
29669 ac_cv_member_struct_passwd_pw_expire=no
29670fi
29671
29672rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29673fi
29674
29675rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29676fi
29677{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_passwd_pw_expire" >&5
29678echo "${ECHO_T}$ac_cv_member_struct_passwd_pw_expire" >&6; }
29679if test $ac_cv_member_struct_passwd_pw_expire = yes; then
15575 29680
15576cat >>confdefs.h <<_ACEOF 29681cat >>confdefs.h <<_ACEOF
15577#define HAVE_STRUCT_PASSWD_PW_EXPIRE 1 29682#define HAVE_STRUCT_PASSWD_PW_EXPIRE 1
@@ -15581,7 +29686,18 @@ _ACEOF
15581fi 29686fi
15582 29687
15583 29688
15584ac_fn_c_check_member "$LINENO" "struct __res_state" "retrans" "ac_cv_member_struct___res_state_retrans" " 29689{ echo "$as_me:$LINENO: checking for struct __res_state.retrans" >&5
29690echo $ECHO_N "checking for struct __res_state.retrans... $ECHO_C" >&6; }
29691if test "${ac_cv_member_struct___res_state_retrans+set}" = set; then
29692 echo $ECHO_N "(cached) $ECHO_C" >&6
29693else
29694 cat >conftest.$ac_ext <<_ACEOF
29695/* confdefs.h. */
29696_ACEOF
29697cat confdefs.h >>conftest.$ac_ext
29698cat >>conftest.$ac_ext <<_ACEOF
29699/* end confdefs.h. */
29700
15585#include <stdio.h> 29701#include <stdio.h>
15586#if HAVE_SYS_TYPES_H 29702#if HAVE_SYS_TYPES_H
15587# include <sys/types.h> 29703# include <sys/types.h>
@@ -15590,23 +29706,119 @@ ac_fn_c_check_member "$LINENO" "struct __res_state" "retrans" "ac_cv_member_stru
15590#include <arpa/nameser.h> 29706#include <arpa/nameser.h>
15591#include <resolv.h> 29707#include <resolv.h>
15592 29708
15593"
15594if test "x$ac_cv_member_struct___res_state_retrans" = xyes; then :
15595 29709
29710int
29711main ()
29712{
29713static struct __res_state ac_aggr;
29714if (ac_aggr.retrans)
29715return 0;
29716 ;
29717 return 0;
29718}
29719_ACEOF
29720rm -f conftest.$ac_objext
29721if { (ac_try="$ac_compile"
29722case "(($ac_try" in
29723 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29724 *) ac_try_echo=$ac_try;;
29725esac
29726eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29727 (eval "$ac_compile") 2>conftest.er1
29728 ac_status=$?
29729 grep -v '^ *+' conftest.er1 >conftest.err
29730 rm -f conftest.er1
29731 cat conftest.err >&5
29732 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29733 (exit $ac_status); } && {
29734 test -z "$ac_c_werror_flag" ||
29735 test ! -s conftest.err
29736 } && test -s conftest.$ac_objext; then
29737 ac_cv_member_struct___res_state_retrans=yes
29738else
29739 echo "$as_me: failed program was:" >&5
29740sed 's/^/| /' conftest.$ac_ext >&5
29741
29742 cat >conftest.$ac_ext <<_ACEOF
29743/* confdefs.h. */
29744_ACEOF
29745cat confdefs.h >>conftest.$ac_ext
29746cat >>conftest.$ac_ext <<_ACEOF
29747/* end confdefs.h. */
29748
29749#include <stdio.h>
29750#if HAVE_SYS_TYPES_H
29751# include <sys/types.h>
29752#endif
29753#include <netinet/in.h>
29754#include <arpa/nameser.h>
29755#include <resolv.h>
29756
29757
29758int
29759main ()
29760{
29761static struct __res_state ac_aggr;
29762if (sizeof ac_aggr.retrans)
29763return 0;
29764 ;
29765 return 0;
29766}
29767_ACEOF
29768rm -f conftest.$ac_objext
29769if { (ac_try="$ac_compile"
29770case "(($ac_try" in
29771 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29772 *) ac_try_echo=$ac_try;;
29773esac
29774eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29775 (eval "$ac_compile") 2>conftest.er1
29776 ac_status=$?
29777 grep -v '^ *+' conftest.er1 >conftest.err
29778 rm -f conftest.er1
29779 cat conftest.err >&5
29780 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29781 (exit $ac_status); } && {
29782 test -z "$ac_c_werror_flag" ||
29783 test ! -s conftest.err
29784 } && test -s conftest.$ac_objext; then
29785 ac_cv_member_struct___res_state_retrans=yes
15596else 29786else
29787 echo "$as_me: failed program was:" >&5
29788sed 's/^/| /' conftest.$ac_ext >&5
15597 29789
15598$as_echo "#define __res_state state" >>confdefs.h 29790 ac_cv_member_struct___res_state_retrans=no
29791fi
15599 29792
29793rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15600fi 29794fi
15601 29795
29796rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29797fi
29798{ echo "$as_me:$LINENO: result: $ac_cv_member_struct___res_state_retrans" >&5
29799echo "${ECHO_T}$ac_cv_member_struct___res_state_retrans" >&6; }
29800if test $ac_cv_member_struct___res_state_retrans = yes; then
29801 :
29802else
29803
29804cat >>confdefs.h <<\_ACEOF
29805#define __res_state state
29806_ACEOF
29807
29808fi
15602 29809
15603{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ss_family field in struct sockaddr_storage" >&5 29810
15604$as_echo_n "checking for ss_family field in struct sockaddr_storage... " >&6; } 29811{ echo "$as_me:$LINENO: checking for ss_family field in struct sockaddr_storage" >&5
15605if ${ac_cv_have_ss_family_in_struct_ss+:} false; then : 29812echo $ECHO_N "checking for ss_family field in struct sockaddr_storage... $ECHO_C" >&6; }
15606 $as_echo_n "(cached) " >&6 29813if test "${ac_cv_have_ss_family_in_struct_ss+set}" = set; then
29814 echo $ECHO_N "(cached) $ECHO_C" >&6
15607else 29815else
15608 29816
15609 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 29817 cat >conftest.$ac_ext <<_ACEOF
29818/* confdefs.h. */
29819_ACEOF
29820cat confdefs.h >>conftest.$ac_ext
29821cat >>conftest.$ac_ext <<_ACEOF
15610/* end confdefs.h. */ 29822/* end confdefs.h. */
15611 29823
15612#include <sys/types.h> 29824#include <sys/types.h>
@@ -15620,29 +29832,55 @@ main ()
15620 return 0; 29832 return 0;
15621} 29833}
15622_ACEOF 29834_ACEOF
15623if ac_fn_c_try_compile "$LINENO"; then : 29835rm -f conftest.$ac_objext
29836if { (ac_try="$ac_compile"
29837case "(($ac_try" in
29838 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29839 *) ac_try_echo=$ac_try;;
29840esac
29841eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29842 (eval "$ac_compile") 2>conftest.er1
29843 ac_status=$?
29844 grep -v '^ *+' conftest.er1 >conftest.err
29845 rm -f conftest.er1
29846 cat conftest.err >&5
29847 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29848 (exit $ac_status); } && {
29849 test -z "$ac_c_werror_flag" ||
29850 test ! -s conftest.err
29851 } && test -s conftest.$ac_objext; then
15624 ac_cv_have_ss_family_in_struct_ss="yes" 29852 ac_cv_have_ss_family_in_struct_ss="yes"
15625else 29853else
15626 ac_cv_have_ss_family_in_struct_ss="no" 29854 echo "$as_me: failed program was:" >&5
29855sed 's/^/| /' conftest.$ac_ext >&5
29856
29857 ac_cv_have_ss_family_in_struct_ss="no"
15627fi 29858fi
29859
15628rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 29860rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15629 29861
15630fi 29862fi
15631{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_ss_family_in_struct_ss" >&5 29863{ echo "$as_me:$LINENO: result: $ac_cv_have_ss_family_in_struct_ss" >&5
15632$as_echo "$ac_cv_have_ss_family_in_struct_ss" >&6; } 29864echo "${ECHO_T}$ac_cv_have_ss_family_in_struct_ss" >&6; }
15633if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then 29865if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
15634 29866
15635$as_echo "#define HAVE_SS_FAMILY_IN_SS 1" >>confdefs.h 29867cat >>confdefs.h <<\_ACEOF
29868#define HAVE_SS_FAMILY_IN_SS 1
29869_ACEOF
15636 29870
15637fi 29871fi
15638 29872
15639{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __ss_family field in struct sockaddr_storage" >&5 29873{ echo "$as_me:$LINENO: checking for __ss_family field in struct sockaddr_storage" >&5
15640$as_echo_n "checking for __ss_family field in struct sockaddr_storage... " >&6; } 29874echo $ECHO_N "checking for __ss_family field in struct sockaddr_storage... $ECHO_C" >&6; }
15641if ${ac_cv_have___ss_family_in_struct_ss+:} false; then : 29875if test "${ac_cv_have___ss_family_in_struct_ss+set}" = set; then
15642 $as_echo_n "(cached) " >&6 29876 echo $ECHO_N "(cached) $ECHO_C" >&6
15643else 29877else
15644 29878
15645 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 29879 cat >conftest.$ac_ext <<_ACEOF
29880/* confdefs.h. */
29881_ACEOF
29882cat confdefs.h >>conftest.$ac_ext
29883cat >>conftest.$ac_ext <<_ACEOF
15646/* end confdefs.h. */ 29884/* end confdefs.h. */
15647 29885
15648#include <sys/types.h> 29886#include <sys/types.h>
@@ -15656,30 +29894,56 @@ main ()
15656 return 0; 29894 return 0;
15657} 29895}
15658_ACEOF 29896_ACEOF
15659if ac_fn_c_try_compile "$LINENO"; then : 29897rm -f conftest.$ac_objext
29898if { (ac_try="$ac_compile"
29899case "(($ac_try" in
29900 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29901 *) ac_try_echo=$ac_try;;
29902esac
29903eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29904 (eval "$ac_compile") 2>conftest.er1
29905 ac_status=$?
29906 grep -v '^ *+' conftest.er1 >conftest.err
29907 rm -f conftest.er1
29908 cat conftest.err >&5
29909 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29910 (exit $ac_status); } && {
29911 test -z "$ac_c_werror_flag" ||
29912 test ! -s conftest.err
29913 } && test -s conftest.$ac_objext; then
15660 ac_cv_have___ss_family_in_struct_ss="yes" 29914 ac_cv_have___ss_family_in_struct_ss="yes"
15661else 29915else
15662 ac_cv_have___ss_family_in_struct_ss="no" 29916 echo "$as_me: failed program was:" >&5
29917sed 's/^/| /' conftest.$ac_ext >&5
29918
29919 ac_cv_have___ss_family_in_struct_ss="no"
15663 29920
15664fi 29921fi
29922
15665rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 29923rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15666 29924
15667fi 29925fi
15668{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have___ss_family_in_struct_ss" >&5 29926{ echo "$as_me:$LINENO: result: $ac_cv_have___ss_family_in_struct_ss" >&5
15669$as_echo "$ac_cv_have___ss_family_in_struct_ss" >&6; } 29927echo "${ECHO_T}$ac_cv_have___ss_family_in_struct_ss" >&6; }
15670if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then 29928if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
15671 29929
15672$as_echo "#define HAVE___SS_FAMILY_IN_SS 1" >>confdefs.h 29930cat >>confdefs.h <<\_ACEOF
29931#define HAVE___SS_FAMILY_IN_SS 1
29932_ACEOF
15673 29933
15674fi 29934fi
15675 29935
15676{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for msg_accrights field in struct msghdr" >&5 29936{ echo "$as_me:$LINENO: checking for msg_accrights field in struct msghdr" >&5
15677$as_echo_n "checking for msg_accrights field in struct msghdr... " >&6; } 29937echo $ECHO_N "checking for msg_accrights field in struct msghdr... $ECHO_C" >&6; }
15678if ${ac_cv_have_accrights_in_msghdr+:} false; then : 29938if test "${ac_cv_have_accrights_in_msghdr+set}" = set; then
15679 $as_echo_n "(cached) " >&6 29939 echo $ECHO_N "(cached) $ECHO_C" >&6
15680else 29940else
15681 29941
15682 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 29942 cat >conftest.$ac_ext <<_ACEOF
29943/* confdefs.h. */
29944_ACEOF
29945cat confdefs.h >>conftest.$ac_ext
29946cat >>conftest.$ac_ext <<_ACEOF
15683/* end confdefs.h. */ 29947/* end confdefs.h. */
15684 29948
15685#include <sys/types.h> 29949#include <sys/types.h>
@@ -15702,26 +29966,52 @@ exit(0);
15702 return 0; 29966 return 0;
15703} 29967}
15704_ACEOF 29968_ACEOF
15705if ac_fn_c_try_compile "$LINENO"; then : 29969rm -f conftest.$ac_objext
29970if { (ac_try="$ac_compile"
29971case "(($ac_try" in
29972 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
29973 *) ac_try_echo=$ac_try;;
29974esac
29975eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
29976 (eval "$ac_compile") 2>conftest.er1
29977 ac_status=$?
29978 grep -v '^ *+' conftest.er1 >conftest.err
29979 rm -f conftest.er1
29980 cat conftest.err >&5
29981 echo "$as_me:$LINENO: \$? = $ac_status" >&5
29982 (exit $ac_status); } && {
29983 test -z "$ac_c_werror_flag" ||
29984 test ! -s conftest.err
29985 } && test -s conftest.$ac_objext; then
15706 ac_cv_have_accrights_in_msghdr="yes" 29986 ac_cv_have_accrights_in_msghdr="yes"
15707else 29987else
15708 ac_cv_have_accrights_in_msghdr="no" 29988 echo "$as_me: failed program was:" >&5
29989sed 's/^/| /' conftest.$ac_ext >&5
29990
29991 ac_cv_have_accrights_in_msghdr="no"
15709 29992
15710fi 29993fi
29994
15711rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 29995rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15712 29996
15713fi 29997fi
15714{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_accrights_in_msghdr" >&5 29998{ echo "$as_me:$LINENO: result: $ac_cv_have_accrights_in_msghdr" >&5
15715$as_echo "$ac_cv_have_accrights_in_msghdr" >&6; } 29999echo "${ECHO_T}$ac_cv_have_accrights_in_msghdr" >&6; }
15716if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then 30000if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
15717 30001
15718$as_echo "#define HAVE_ACCRIGHTS_IN_MSGHDR 1" >>confdefs.h 30002cat >>confdefs.h <<\_ACEOF
30003#define HAVE_ACCRIGHTS_IN_MSGHDR 1
30004_ACEOF
15719 30005
15720fi 30006fi
15721 30007
15722{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if struct statvfs.f_fsid is integral type" >&5 30008{ echo "$as_me:$LINENO: checking if struct statvfs.f_fsid is integral type" >&5
15723$as_echo_n "checking if struct statvfs.f_fsid is integral type... " >&6; } 30009echo $ECHO_N "checking if struct statvfs.f_fsid is integral type... $ECHO_C" >&6; }
15724cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30010cat >conftest.$ac_ext <<_ACEOF
30011/* confdefs.h. */
30012_ACEOF
30013cat confdefs.h >>conftest.$ac_ext
30014cat >>conftest.$ac_ext <<_ACEOF
15725/* end confdefs.h. */ 30015/* end confdefs.h. */
15726 30016
15727#include <sys/param.h> 30017#include <sys/param.h>
@@ -15744,16 +30034,39 @@ main ()
15744 return 0; 30034 return 0;
15745} 30035}
15746_ACEOF 30036_ACEOF
15747if ac_fn_c_try_compile "$LINENO"; then : 30037rm -f conftest.$ac_objext
15748 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 30038if { (ac_try="$ac_compile"
15749$as_echo "yes" >&6; } 30039case "(($ac_try" in
30040 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30041 *) ac_try_echo=$ac_try;;
30042esac
30043eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30044 (eval "$ac_compile") 2>conftest.er1
30045 ac_status=$?
30046 grep -v '^ *+' conftest.er1 >conftest.err
30047 rm -f conftest.er1
30048 cat conftest.err >&5
30049 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30050 (exit $ac_status); } && {
30051 test -z "$ac_c_werror_flag" ||
30052 test ! -s conftest.err
30053 } && test -s conftest.$ac_objext; then
30054 { echo "$as_me:$LINENO: result: yes" >&5
30055echo "${ECHO_T}yes" >&6; }
15750else 30056else
15751 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 30057 echo "$as_me: failed program was:" >&5
15752$as_echo "no" >&6; } 30058sed 's/^/| /' conftest.$ac_ext >&5
30059
30060 { echo "$as_me:$LINENO: result: no" >&5
30061echo "${ECHO_T}no" >&6; }
15753 30062
15754 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsid_t has member val" >&5 30063 { echo "$as_me:$LINENO: checking if fsid_t has member val" >&5
15755$as_echo_n "checking if fsid_t has member val... " >&6; } 30064echo $ECHO_N "checking if fsid_t has member val... $ECHO_C" >&6; }
15756 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30065 cat >conftest.$ac_ext <<_ACEOF
30066/* confdefs.h. */
30067_ACEOF
30068cat confdefs.h >>conftest.$ac_ext
30069cat >>conftest.$ac_ext <<_ACEOF
15757/* end confdefs.h. */ 30070/* end confdefs.h. */
15758 30071
15759#include <sys/types.h> 30072#include <sys/types.h>
@@ -15767,21 +30080,47 @@ main ()
15767 return 0; 30080 return 0;
15768} 30081}
15769_ACEOF 30082_ACEOF
15770if ac_fn_c_try_compile "$LINENO"; then : 30083rm -f conftest.$ac_objext
15771 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 30084if { (ac_try="$ac_compile"
15772$as_echo "yes" >&6; } 30085case "(($ac_try" in
30086 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30087 *) ac_try_echo=$ac_try;;
30088esac
30089eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30090 (eval "$ac_compile") 2>conftest.er1
30091 ac_status=$?
30092 grep -v '^ *+' conftest.er1 >conftest.err
30093 rm -f conftest.er1
30094 cat conftest.err >&5
30095 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30096 (exit $ac_status); } && {
30097 test -z "$ac_c_werror_flag" ||
30098 test ! -s conftest.err
30099 } && test -s conftest.$ac_objext; then
30100 { echo "$as_me:$LINENO: result: yes" >&5
30101echo "${ECHO_T}yes" >&6; }
15773 30102
15774$as_echo "#define FSID_HAS_VAL 1" >>confdefs.h 30103cat >>confdefs.h <<\_ACEOF
30104#define FSID_HAS_VAL 1
30105_ACEOF
15775 30106
15776else 30107else
15777 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 30108 echo "$as_me: failed program was:" >&5
15778$as_echo "no" >&6; } 30109sed 's/^/| /' conftest.$ac_ext >&5
30110
30111 { echo "$as_me:$LINENO: result: no" >&5
30112echo "${ECHO_T}no" >&6; }
15779fi 30113fi
30114
15780rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 30115rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15781 30116
15782 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if f_fsid has member __val" >&5 30117 { echo "$as_me:$LINENO: checking if f_fsid has member __val" >&5
15783$as_echo_n "checking if f_fsid has member __val... " >&6; } 30118echo $ECHO_N "checking if f_fsid has member __val... $ECHO_C" >&6; }
15784 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30119 cat >conftest.$ac_ext <<_ACEOF
30120/* confdefs.h. */
30121_ACEOF
30122cat confdefs.h >>conftest.$ac_ext
30123cat >>conftest.$ac_ext <<_ACEOF
15785/* end confdefs.h. */ 30124/* end confdefs.h. */
15786 30125
15787#include <sys/types.h> 30126#include <sys/types.h>
@@ -15795,28 +30134,55 @@ main ()
15795 return 0; 30134 return 0;
15796} 30135}
15797_ACEOF 30136_ACEOF
15798if ac_fn_c_try_compile "$LINENO"; then : 30137rm -f conftest.$ac_objext
15799 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 30138if { (ac_try="$ac_compile"
15800$as_echo "yes" >&6; } 30139case "(($ac_try" in
30140 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30141 *) ac_try_echo=$ac_try;;
30142esac
30143eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30144 (eval "$ac_compile") 2>conftest.er1
30145 ac_status=$?
30146 grep -v '^ *+' conftest.er1 >conftest.err
30147 rm -f conftest.er1
30148 cat conftest.err >&5
30149 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30150 (exit $ac_status); } && {
30151 test -z "$ac_c_werror_flag" ||
30152 test ! -s conftest.err
30153 } && test -s conftest.$ac_objext; then
30154 { echo "$as_me:$LINENO: result: yes" >&5
30155echo "${ECHO_T}yes" >&6; }
15801 30156
15802$as_echo "#define FSID_HAS___VAL 1" >>confdefs.h 30157cat >>confdefs.h <<\_ACEOF
30158#define FSID_HAS___VAL 1
30159_ACEOF
15803 30160
15804else 30161else
15805 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 30162 echo "$as_me: failed program was:" >&5
15806$as_echo "no" >&6; } 30163sed 's/^/| /' conftest.$ac_ext >&5
30164
30165 { echo "$as_me:$LINENO: result: no" >&5
30166echo "${ECHO_T}no" >&6; }
15807fi 30167fi
30168
15808rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 30169rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15809 30170
15810fi 30171fi
30172
15811rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 30173rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15812 30174
15813{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for msg_control field in struct msghdr" >&5 30175{ echo "$as_me:$LINENO: checking for msg_control field in struct msghdr" >&5
15814$as_echo_n "checking for msg_control field in struct msghdr... " >&6; } 30176echo $ECHO_N "checking for msg_control field in struct msghdr... $ECHO_C" >&6; }
15815if ${ac_cv_have_control_in_msghdr+:} false; then : 30177if test "${ac_cv_have_control_in_msghdr+set}" = set; then
15816 $as_echo_n "(cached) " >&6 30178 echo $ECHO_N "(cached) $ECHO_C" >&6
15817else 30179else
15818 30180
15819 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30181 cat >conftest.$ac_ext <<_ACEOF
30182/* confdefs.h. */
30183_ACEOF
30184cat confdefs.h >>conftest.$ac_ext
30185cat >>conftest.$ac_ext <<_ACEOF
15820/* end confdefs.h. */ 30186/* end confdefs.h. */
15821 30187
15822#include <sys/types.h> 30188#include <sys/types.h>
@@ -15839,30 +30205,56 @@ exit(0);
15839 return 0; 30205 return 0;
15840} 30206}
15841_ACEOF 30207_ACEOF
15842if ac_fn_c_try_compile "$LINENO"; then : 30208rm -f conftest.$ac_objext
30209if { (ac_try="$ac_compile"
30210case "(($ac_try" in
30211 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30212 *) ac_try_echo=$ac_try;;
30213esac
30214eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30215 (eval "$ac_compile") 2>conftest.er1
30216 ac_status=$?
30217 grep -v '^ *+' conftest.er1 >conftest.err
30218 rm -f conftest.er1
30219 cat conftest.err >&5
30220 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30221 (exit $ac_status); } && {
30222 test -z "$ac_c_werror_flag" ||
30223 test ! -s conftest.err
30224 } && test -s conftest.$ac_objext; then
15843 ac_cv_have_control_in_msghdr="yes" 30225 ac_cv_have_control_in_msghdr="yes"
15844else 30226else
15845 ac_cv_have_control_in_msghdr="no" 30227 echo "$as_me: failed program was:" >&5
30228sed 's/^/| /' conftest.$ac_ext >&5
30229
30230 ac_cv_have_control_in_msghdr="no"
15846 30231
15847fi 30232fi
30233
15848rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 30234rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15849 30235
15850fi 30236fi
15851{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_control_in_msghdr" >&5 30237{ echo "$as_me:$LINENO: result: $ac_cv_have_control_in_msghdr" >&5
15852$as_echo "$ac_cv_have_control_in_msghdr" >&6; } 30238echo "${ECHO_T}$ac_cv_have_control_in_msghdr" >&6; }
15853if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then 30239if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
15854 30240
15855$as_echo "#define HAVE_CONTROL_IN_MSGHDR 1" >>confdefs.h 30241cat >>confdefs.h <<\_ACEOF
30242#define HAVE_CONTROL_IN_MSGHDR 1
30243_ACEOF
15856 30244
15857fi 30245fi
15858 30246
15859{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libc defines __progname" >&5 30247{ echo "$as_me:$LINENO: checking if libc defines __progname" >&5
15860$as_echo_n "checking if libc defines __progname... " >&6; } 30248echo $ECHO_N "checking if libc defines __progname... $ECHO_C" >&6; }
15861if ${ac_cv_libc_defines___progname+:} false; then : 30249if test "${ac_cv_libc_defines___progname+set}" = set; then
15862 $as_echo_n "(cached) " >&6 30250 echo $ECHO_N "(cached) $ECHO_C" >&6
15863else 30251else
15864 30252
15865 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30253 cat >conftest.$ac_ext <<_ACEOF
30254/* confdefs.h. */
30255_ACEOF
30256cat confdefs.h >>conftest.$ac_ext
30257cat >>conftest.$ac_ext <<_ACEOF
15866/* end confdefs.h. */ 30258/* end confdefs.h. */
15867 30259
15868int 30260int
@@ -15873,31 +30265,58 @@ main ()
15873 return 0; 30265 return 0;
15874} 30266}
15875_ACEOF 30267_ACEOF
15876if ac_fn_c_try_link "$LINENO"; then : 30268rm -f conftest.$ac_objext conftest$ac_exeext
30269if { (ac_try="$ac_link"
30270case "(($ac_try" in
30271 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30272 *) ac_try_echo=$ac_try;;
30273esac
30274eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30275 (eval "$ac_link") 2>conftest.er1
30276 ac_status=$?
30277 grep -v '^ *+' conftest.er1 >conftest.err
30278 rm -f conftest.er1
30279 cat conftest.err >&5
30280 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30281 (exit $ac_status); } && {
30282 test -z "$ac_c_werror_flag" ||
30283 test ! -s conftest.err
30284 } && test -s conftest$ac_exeext &&
30285 $as_test_x conftest$ac_exeext; then
15877 ac_cv_libc_defines___progname="yes" 30286 ac_cv_libc_defines___progname="yes"
15878else 30287else
15879 ac_cv_libc_defines___progname="no" 30288 echo "$as_me: failed program was:" >&5
30289sed 's/^/| /' conftest.$ac_ext >&5
30290
30291 ac_cv_libc_defines___progname="no"
15880 30292
15881fi 30293fi
15882rm -f core conftest.err conftest.$ac_objext \ 30294
15883 conftest$ac_exeext conftest.$ac_ext 30295rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
30296 conftest$ac_exeext conftest.$ac_ext
15884 30297
15885fi 30298fi
15886{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libc_defines___progname" >&5 30299{ echo "$as_me:$LINENO: result: $ac_cv_libc_defines___progname" >&5
15887$as_echo "$ac_cv_libc_defines___progname" >&6; } 30300echo "${ECHO_T}$ac_cv_libc_defines___progname" >&6; }
15888if test "x$ac_cv_libc_defines___progname" = "xyes" ; then 30301if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
15889 30302
15890$as_echo "#define HAVE___PROGNAME 1" >>confdefs.h 30303cat >>confdefs.h <<\_ACEOF
30304#define HAVE___PROGNAME 1
30305_ACEOF
15891 30306
15892fi 30307fi
15893 30308
15894{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC implements __FUNCTION__" >&5 30309{ echo "$as_me:$LINENO: checking whether $CC implements __FUNCTION__" >&5
15895$as_echo_n "checking whether $CC implements __FUNCTION__... " >&6; } 30310echo $ECHO_N "checking whether $CC implements __FUNCTION__... $ECHO_C" >&6; }
15896if ${ac_cv_cc_implements___FUNCTION__+:} false; then : 30311if test "${ac_cv_cc_implements___FUNCTION__+set}" = set; then
15897 $as_echo_n "(cached) " >&6 30312 echo $ECHO_N "(cached) $ECHO_C" >&6
15898else 30313else
15899 30314
15900 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30315 cat >conftest.$ac_ext <<_ACEOF
30316/* confdefs.h. */
30317_ACEOF
30318cat confdefs.h >>conftest.$ac_ext
30319cat >>conftest.$ac_ext <<_ACEOF
15901/* end confdefs.h. */ 30320/* end confdefs.h. */
15902 #include <stdio.h> 30321 #include <stdio.h>
15903int 30322int
@@ -15908,31 +30327,58 @@ main ()
15908 return 0; 30327 return 0;
15909} 30328}
15910_ACEOF 30329_ACEOF
15911if ac_fn_c_try_link "$LINENO"; then : 30330rm -f conftest.$ac_objext conftest$ac_exeext
30331if { (ac_try="$ac_link"
30332case "(($ac_try" in
30333 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30334 *) ac_try_echo=$ac_try;;
30335esac
30336eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30337 (eval "$ac_link") 2>conftest.er1
30338 ac_status=$?
30339 grep -v '^ *+' conftest.er1 >conftest.err
30340 rm -f conftest.er1
30341 cat conftest.err >&5
30342 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30343 (exit $ac_status); } && {
30344 test -z "$ac_c_werror_flag" ||
30345 test ! -s conftest.err
30346 } && test -s conftest$ac_exeext &&
30347 $as_test_x conftest$ac_exeext; then
15912 ac_cv_cc_implements___FUNCTION__="yes" 30348 ac_cv_cc_implements___FUNCTION__="yes"
15913else 30349else
15914 ac_cv_cc_implements___FUNCTION__="no" 30350 echo "$as_me: failed program was:" >&5
30351sed 's/^/| /' conftest.$ac_ext >&5
30352
30353 ac_cv_cc_implements___FUNCTION__="no"
15915 30354
15916fi 30355fi
15917rm -f core conftest.err conftest.$ac_objext \ 30356
15918 conftest$ac_exeext conftest.$ac_ext 30357rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
30358 conftest$ac_exeext conftest.$ac_ext
15919 30359
15920fi 30360fi
15921{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_implements___FUNCTION__" >&5 30361{ echo "$as_me:$LINENO: result: $ac_cv_cc_implements___FUNCTION__" >&5
15922$as_echo "$ac_cv_cc_implements___FUNCTION__" >&6; } 30362echo "${ECHO_T}$ac_cv_cc_implements___FUNCTION__" >&6; }
15923if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then 30363if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
15924 30364
15925$as_echo "#define HAVE___FUNCTION__ 1" >>confdefs.h 30365cat >>confdefs.h <<\_ACEOF
30366#define HAVE___FUNCTION__ 1
30367_ACEOF
15926 30368
15927fi 30369fi
15928 30370
15929{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC implements __func__" >&5 30371{ echo "$as_me:$LINENO: checking whether $CC implements __func__" >&5
15930$as_echo_n "checking whether $CC implements __func__... " >&6; } 30372echo $ECHO_N "checking whether $CC implements __func__... $ECHO_C" >&6; }
15931if ${ac_cv_cc_implements___func__+:} false; then : 30373if test "${ac_cv_cc_implements___func__+set}" = set; then
15932 $as_echo_n "(cached) " >&6 30374 echo $ECHO_N "(cached) $ECHO_C" >&6
15933else 30375else
15934 30376
15935 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30377 cat >conftest.$ac_ext <<_ACEOF
30378/* confdefs.h. */
30379_ACEOF
30380cat confdefs.h >>conftest.$ac_ext
30381cat >>conftest.$ac_ext <<_ACEOF
15936/* end confdefs.h. */ 30382/* end confdefs.h. */
15937 #include <stdio.h> 30383 #include <stdio.h>
15938int 30384int
@@ -15943,31 +30389,58 @@ main ()
15943 return 0; 30389 return 0;
15944} 30390}
15945_ACEOF 30391_ACEOF
15946if ac_fn_c_try_link "$LINENO"; then : 30392rm -f conftest.$ac_objext conftest$ac_exeext
30393if { (ac_try="$ac_link"
30394case "(($ac_try" in
30395 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30396 *) ac_try_echo=$ac_try;;
30397esac
30398eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30399 (eval "$ac_link") 2>conftest.er1
30400 ac_status=$?
30401 grep -v '^ *+' conftest.er1 >conftest.err
30402 rm -f conftest.er1
30403 cat conftest.err >&5
30404 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30405 (exit $ac_status); } && {
30406 test -z "$ac_c_werror_flag" ||
30407 test ! -s conftest.err
30408 } && test -s conftest$ac_exeext &&
30409 $as_test_x conftest$ac_exeext; then
15947 ac_cv_cc_implements___func__="yes" 30410 ac_cv_cc_implements___func__="yes"
15948else 30411else
15949 ac_cv_cc_implements___func__="no" 30412 echo "$as_me: failed program was:" >&5
30413sed 's/^/| /' conftest.$ac_ext >&5
30414
30415 ac_cv_cc_implements___func__="no"
15950 30416
15951fi 30417fi
15952rm -f core conftest.err conftest.$ac_objext \ 30418
15953 conftest$ac_exeext conftest.$ac_ext 30419rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
30420 conftest$ac_exeext conftest.$ac_ext
15954 30421
15955fi 30422fi
15956{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_implements___func__" >&5 30423{ echo "$as_me:$LINENO: result: $ac_cv_cc_implements___func__" >&5
15957$as_echo "$ac_cv_cc_implements___func__" >&6; } 30424echo "${ECHO_T}$ac_cv_cc_implements___func__" >&6; }
15958if test "x$ac_cv_cc_implements___func__" = "xyes" ; then 30425if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
15959 30426
15960$as_echo "#define HAVE___func__ 1" >>confdefs.h 30427cat >>confdefs.h <<\_ACEOF
30428#define HAVE___func__ 1
30429_ACEOF
15961 30430
15962fi 30431fi
15963 30432
15964{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether va_copy exists" >&5 30433{ echo "$as_me:$LINENO: checking whether va_copy exists" >&5
15965$as_echo_n "checking whether va_copy exists... " >&6; } 30434echo $ECHO_N "checking whether va_copy exists... $ECHO_C" >&6; }
15966if ${ac_cv_have_va_copy+:} false; then : 30435if test "${ac_cv_have_va_copy+set}" = set; then
15967 $as_echo_n "(cached) " >&6 30436 echo $ECHO_N "(cached) $ECHO_C" >&6
15968else 30437else
15969 30438
15970 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30439 cat >conftest.$ac_ext <<_ACEOF
30440/* confdefs.h. */
30441_ACEOF
30442cat confdefs.h >>conftest.$ac_ext
30443cat >>conftest.$ac_ext <<_ACEOF
15971/* end confdefs.h. */ 30444/* end confdefs.h. */
15972 30445
15973#include <stdarg.h> 30446#include <stdarg.h>
@@ -15981,31 +30454,58 @@ main ()
15981 return 0; 30454 return 0;
15982} 30455}
15983_ACEOF 30456_ACEOF
15984if ac_fn_c_try_link "$LINENO"; then : 30457rm -f conftest.$ac_objext conftest$ac_exeext
30458if { (ac_try="$ac_link"
30459case "(($ac_try" in
30460 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30461 *) ac_try_echo=$ac_try;;
30462esac
30463eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30464 (eval "$ac_link") 2>conftest.er1
30465 ac_status=$?
30466 grep -v '^ *+' conftest.er1 >conftest.err
30467 rm -f conftest.er1
30468 cat conftest.err >&5
30469 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30470 (exit $ac_status); } && {
30471 test -z "$ac_c_werror_flag" ||
30472 test ! -s conftest.err
30473 } && test -s conftest$ac_exeext &&
30474 $as_test_x conftest$ac_exeext; then
15985 ac_cv_have_va_copy="yes" 30475 ac_cv_have_va_copy="yes"
15986else 30476else
15987 ac_cv_have_va_copy="no" 30477 echo "$as_me: failed program was:" >&5
30478sed 's/^/| /' conftest.$ac_ext >&5
30479
30480 ac_cv_have_va_copy="no"
15988 30481
15989fi 30482fi
15990rm -f core conftest.err conftest.$ac_objext \ 30483
15991 conftest$ac_exeext conftest.$ac_ext 30484rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
30485 conftest$ac_exeext conftest.$ac_ext
15992 30486
15993fi 30487fi
15994{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_va_copy" >&5 30488{ echo "$as_me:$LINENO: result: $ac_cv_have_va_copy" >&5
15995$as_echo "$ac_cv_have_va_copy" >&6; } 30489echo "${ECHO_T}$ac_cv_have_va_copy" >&6; }
15996if test "x$ac_cv_have_va_copy" = "xyes" ; then 30490if test "x$ac_cv_have_va_copy" = "xyes" ; then
15997 30491
15998$as_echo "#define HAVE_VA_COPY 1" >>confdefs.h 30492cat >>confdefs.h <<\_ACEOF
30493#define HAVE_VA_COPY 1
30494_ACEOF
15999 30495
16000fi 30496fi
16001 30497
16002{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __va_copy exists" >&5 30498{ echo "$as_me:$LINENO: checking whether __va_copy exists" >&5
16003$as_echo_n "checking whether __va_copy exists... " >&6; } 30499echo $ECHO_N "checking whether __va_copy exists... $ECHO_C" >&6; }
16004if ${ac_cv_have___va_copy+:} false; then : 30500if test "${ac_cv_have___va_copy+set}" = set; then
16005 $as_echo_n "(cached) " >&6 30501 echo $ECHO_N "(cached) $ECHO_C" >&6
16006else 30502else
16007 30503
16008 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30504 cat >conftest.$ac_ext <<_ACEOF
30505/* confdefs.h. */
30506_ACEOF
30507cat confdefs.h >>conftest.$ac_ext
30508cat >>conftest.$ac_ext <<_ACEOF
16009/* end confdefs.h. */ 30509/* end confdefs.h. */
16010 30510
16011#include <stdarg.h> 30511#include <stdarg.h>
@@ -16019,31 +30519,58 @@ main ()
16019 return 0; 30519 return 0;
16020} 30520}
16021_ACEOF 30521_ACEOF
16022if ac_fn_c_try_link "$LINENO"; then : 30522rm -f conftest.$ac_objext conftest$ac_exeext
30523if { (ac_try="$ac_link"
30524case "(($ac_try" in
30525 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30526 *) ac_try_echo=$ac_try;;
30527esac
30528eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30529 (eval "$ac_link") 2>conftest.er1
30530 ac_status=$?
30531 grep -v '^ *+' conftest.er1 >conftest.err
30532 rm -f conftest.er1
30533 cat conftest.err >&5
30534 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30535 (exit $ac_status); } && {
30536 test -z "$ac_c_werror_flag" ||
30537 test ! -s conftest.err
30538 } && test -s conftest$ac_exeext &&
30539 $as_test_x conftest$ac_exeext; then
16023 ac_cv_have___va_copy="yes" 30540 ac_cv_have___va_copy="yes"
16024else 30541else
16025 ac_cv_have___va_copy="no" 30542 echo "$as_me: failed program was:" >&5
30543sed 's/^/| /' conftest.$ac_ext >&5
30544
30545 ac_cv_have___va_copy="no"
16026 30546
16027fi 30547fi
16028rm -f core conftest.err conftest.$ac_objext \ 30548
16029 conftest$ac_exeext conftest.$ac_ext 30549rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
30550 conftest$ac_exeext conftest.$ac_ext
16030 30551
16031fi 30552fi
16032{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have___va_copy" >&5 30553{ echo "$as_me:$LINENO: result: $ac_cv_have___va_copy" >&5
16033$as_echo "$ac_cv_have___va_copy" >&6; } 30554echo "${ECHO_T}$ac_cv_have___va_copy" >&6; }
16034if test "x$ac_cv_have___va_copy" = "xyes" ; then 30555if test "x$ac_cv_have___va_copy" = "xyes" ; then
16035 30556
16036$as_echo "#define HAVE___VA_COPY 1" >>confdefs.h 30557cat >>confdefs.h <<\_ACEOF
30558#define HAVE___VA_COPY 1
30559_ACEOF
16037 30560
16038fi 30561fi
16039 30562
16040{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getopt has optreset support" >&5 30563{ echo "$as_me:$LINENO: checking whether getopt has optreset support" >&5
16041$as_echo_n "checking whether getopt has optreset support... " >&6; } 30564echo $ECHO_N "checking whether getopt has optreset support... $ECHO_C" >&6; }
16042if ${ac_cv_have_getopt_optreset+:} false; then : 30565if test "${ac_cv_have_getopt_optreset+set}" = set; then
16043 $as_echo_n "(cached) " >&6 30566 echo $ECHO_N "(cached) $ECHO_C" >&6
16044else 30567else
16045 30568
16046 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30569 cat >conftest.$ac_ext <<_ACEOF
30570/* confdefs.h. */
30571_ACEOF
30572cat confdefs.h >>conftest.$ac_ext
30573cat >>conftest.$ac_ext <<_ACEOF
16047/* end confdefs.h. */ 30574/* end confdefs.h. */
16048 #include <getopt.h> 30575 #include <getopt.h>
16049int 30576int
@@ -16054,31 +30581,58 @@ main ()
16054 return 0; 30581 return 0;
16055} 30582}
16056_ACEOF 30583_ACEOF
16057if ac_fn_c_try_link "$LINENO"; then : 30584rm -f conftest.$ac_objext conftest$ac_exeext
30585if { (ac_try="$ac_link"
30586case "(($ac_try" in
30587 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30588 *) ac_try_echo=$ac_try;;
30589esac
30590eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30591 (eval "$ac_link") 2>conftest.er1
30592 ac_status=$?
30593 grep -v '^ *+' conftest.er1 >conftest.err
30594 rm -f conftest.er1
30595 cat conftest.err >&5
30596 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30597 (exit $ac_status); } && {
30598 test -z "$ac_c_werror_flag" ||
30599 test ! -s conftest.err
30600 } && test -s conftest$ac_exeext &&
30601 $as_test_x conftest$ac_exeext; then
16058 ac_cv_have_getopt_optreset="yes" 30602 ac_cv_have_getopt_optreset="yes"
16059else 30603else
16060 ac_cv_have_getopt_optreset="no" 30604 echo "$as_me: failed program was:" >&5
30605sed 's/^/| /' conftest.$ac_ext >&5
30606
30607 ac_cv_have_getopt_optreset="no"
16061 30608
16062fi 30609fi
16063rm -f core conftest.err conftest.$ac_objext \ 30610
16064 conftest$ac_exeext conftest.$ac_ext 30611rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
30612 conftest$ac_exeext conftest.$ac_ext
16065 30613
16066fi 30614fi
16067{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_getopt_optreset" >&5 30615{ echo "$as_me:$LINENO: result: $ac_cv_have_getopt_optreset" >&5
16068$as_echo "$ac_cv_have_getopt_optreset" >&6; } 30616echo "${ECHO_T}$ac_cv_have_getopt_optreset" >&6; }
16069if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then 30617if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
16070 30618
16071$as_echo "#define HAVE_GETOPT_OPTRESET 1" >>confdefs.h 30619cat >>confdefs.h <<\_ACEOF
30620#define HAVE_GETOPT_OPTRESET 1
30621_ACEOF
16072 30622
16073fi 30623fi
16074 30624
16075{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libc defines sys_errlist" >&5 30625{ echo "$as_me:$LINENO: checking if libc defines sys_errlist" >&5
16076$as_echo_n "checking if libc defines sys_errlist... " >&6; } 30626echo $ECHO_N "checking if libc defines sys_errlist... $ECHO_C" >&6; }
16077if ${ac_cv_libc_defines_sys_errlist+:} false; then : 30627if test "${ac_cv_libc_defines_sys_errlist+set}" = set; then
16078 $as_echo_n "(cached) " >&6 30628 echo $ECHO_N "(cached) $ECHO_C" >&6
16079else 30629else
16080 30630
16081 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30631 cat >conftest.$ac_ext <<_ACEOF
30632/* confdefs.h. */
30633_ACEOF
30634cat confdefs.h >>conftest.$ac_ext
30635cat >>conftest.$ac_ext <<_ACEOF
16082/* end confdefs.h. */ 30636/* end confdefs.h. */
16083 30637
16084int 30638int
@@ -16089,32 +30643,59 @@ main ()
16089 return 0; 30643 return 0;
16090} 30644}
16091_ACEOF 30645_ACEOF
16092if ac_fn_c_try_link "$LINENO"; then : 30646rm -f conftest.$ac_objext conftest$ac_exeext
30647if { (ac_try="$ac_link"
30648case "(($ac_try" in
30649 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30650 *) ac_try_echo=$ac_try;;
30651esac
30652eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30653 (eval "$ac_link") 2>conftest.er1
30654 ac_status=$?
30655 grep -v '^ *+' conftest.er1 >conftest.err
30656 rm -f conftest.er1
30657 cat conftest.err >&5
30658 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30659 (exit $ac_status); } && {
30660 test -z "$ac_c_werror_flag" ||
30661 test ! -s conftest.err
30662 } && test -s conftest$ac_exeext &&
30663 $as_test_x conftest$ac_exeext; then
16093 ac_cv_libc_defines_sys_errlist="yes" 30664 ac_cv_libc_defines_sys_errlist="yes"
16094else 30665else
16095 ac_cv_libc_defines_sys_errlist="no" 30666 echo "$as_me: failed program was:" >&5
30667sed 's/^/| /' conftest.$ac_ext >&5
30668
30669 ac_cv_libc_defines_sys_errlist="no"
16096 30670
16097fi 30671fi
16098rm -f core conftest.err conftest.$ac_objext \ 30672
16099 conftest$ac_exeext conftest.$ac_ext 30673rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
30674 conftest$ac_exeext conftest.$ac_ext
16100 30675
16101fi 30676fi
16102{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libc_defines_sys_errlist" >&5 30677{ echo "$as_me:$LINENO: result: $ac_cv_libc_defines_sys_errlist" >&5
16103$as_echo "$ac_cv_libc_defines_sys_errlist" >&6; } 30678echo "${ECHO_T}$ac_cv_libc_defines_sys_errlist" >&6; }
16104if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then 30679if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
16105 30680
16106$as_echo "#define HAVE_SYS_ERRLIST 1" >>confdefs.h 30681cat >>confdefs.h <<\_ACEOF
30682#define HAVE_SYS_ERRLIST 1
30683_ACEOF
16107 30684
16108fi 30685fi
16109 30686
16110 30687
16111{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libc defines sys_nerr" >&5 30688{ echo "$as_me:$LINENO: checking if libc defines sys_nerr" >&5
16112$as_echo_n "checking if libc defines sys_nerr... " >&6; } 30689echo $ECHO_N "checking if libc defines sys_nerr... $ECHO_C" >&6; }
16113if ${ac_cv_libc_defines_sys_nerr+:} false; then : 30690if test "${ac_cv_libc_defines_sys_nerr+set}" = set; then
16114 $as_echo_n "(cached) " >&6 30691 echo $ECHO_N "(cached) $ECHO_C" >&6
16115else 30692else
16116 30693
16117 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30694 cat >conftest.$ac_ext <<_ACEOF
30695/* confdefs.h. */
30696_ACEOF
30697cat confdefs.h >>conftest.$ac_ext
30698cat >>conftest.$ac_ext <<_ACEOF
16118/* end confdefs.h. */ 30699/* end confdefs.h. */
16119 30700
16120int 30701int
@@ -16125,32 +30706,59 @@ main ()
16125 return 0; 30706 return 0;
16126} 30707}
16127_ACEOF 30708_ACEOF
16128if ac_fn_c_try_link "$LINENO"; then : 30709rm -f conftest.$ac_objext conftest$ac_exeext
30710if { (ac_try="$ac_link"
30711case "(($ac_try" in
30712 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30713 *) ac_try_echo=$ac_try;;
30714esac
30715eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30716 (eval "$ac_link") 2>conftest.er1
30717 ac_status=$?
30718 grep -v '^ *+' conftest.er1 >conftest.err
30719 rm -f conftest.er1
30720 cat conftest.err >&5
30721 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30722 (exit $ac_status); } && {
30723 test -z "$ac_c_werror_flag" ||
30724 test ! -s conftest.err
30725 } && test -s conftest$ac_exeext &&
30726 $as_test_x conftest$ac_exeext; then
16129 ac_cv_libc_defines_sys_nerr="yes" 30727 ac_cv_libc_defines_sys_nerr="yes"
16130else 30728else
16131 ac_cv_libc_defines_sys_nerr="no" 30729 echo "$as_me: failed program was:" >&5
30730sed 's/^/| /' conftest.$ac_ext >&5
30731
30732 ac_cv_libc_defines_sys_nerr="no"
16132 30733
16133fi 30734fi
16134rm -f core conftest.err conftest.$ac_objext \ 30735
16135 conftest$ac_exeext conftest.$ac_ext 30736rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
30737 conftest$ac_exeext conftest.$ac_ext
16136 30738
16137fi 30739fi
16138{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libc_defines_sys_nerr" >&5 30740{ echo "$as_me:$LINENO: result: $ac_cv_libc_defines_sys_nerr" >&5
16139$as_echo "$ac_cv_libc_defines_sys_nerr" >&6; } 30741echo "${ECHO_T}$ac_cv_libc_defines_sys_nerr" >&6; }
16140if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then 30742if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
16141 30743
16142$as_echo "#define HAVE_SYS_NERR 1" >>confdefs.h 30744cat >>confdefs.h <<\_ACEOF
30745#define HAVE_SYS_NERR 1
30746_ACEOF
16143 30747
16144fi 30748fi
16145 30749
16146# Check libraries needed by DNS fingerprint support 30750# Check libraries needed by DNS fingerprint support
16147{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getrrsetbyname" >&5 30751{ echo "$as_me:$LINENO: checking for library containing getrrsetbyname" >&5
16148$as_echo_n "checking for library containing getrrsetbyname... " >&6; } 30752echo $ECHO_N "checking for library containing getrrsetbyname... $ECHO_C" >&6; }
16149if ${ac_cv_search_getrrsetbyname+:} false; then : 30753if test "${ac_cv_search_getrrsetbyname+set}" = set; then
16150 $as_echo_n "(cached) " >&6 30754 echo $ECHO_N "(cached) $ECHO_C" >&6
16151else 30755else
16152 ac_func_search_save_LIBS=$LIBS 30756 ac_func_search_save_LIBS=$LIBS
16153cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30757cat >conftest.$ac_ext <<_ACEOF
30758/* confdefs.h. */
30759_ACEOF
30760cat confdefs.h >>conftest.$ac_ext
30761cat >>conftest.$ac_ext <<_ACEOF
16154/* end confdefs.h. */ 30762/* end confdefs.h. */
16155 30763
16156/* Override any GCC internal prototype to avoid an error. 30764/* Override any GCC internal prototype to avoid an error.
@@ -16175,41 +30783,70 @@ for ac_lib in '' resolv; do
16175 ac_res=-l$ac_lib 30783 ac_res=-l$ac_lib
16176 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 30784 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
16177 fi 30785 fi
16178 if ac_fn_c_try_link "$LINENO"; then : 30786 rm -f conftest.$ac_objext conftest$ac_exeext
30787if { (ac_try="$ac_link"
30788case "(($ac_try" in
30789 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30790 *) ac_try_echo=$ac_try;;
30791esac
30792eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30793 (eval "$ac_link") 2>conftest.er1
30794 ac_status=$?
30795 grep -v '^ *+' conftest.er1 >conftest.err
30796 rm -f conftest.er1
30797 cat conftest.err >&5
30798 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30799 (exit $ac_status); } && {
30800 test -z "$ac_c_werror_flag" ||
30801 test ! -s conftest.err
30802 } && test -s conftest$ac_exeext &&
30803 $as_test_x conftest$ac_exeext; then
16179 ac_cv_search_getrrsetbyname=$ac_res 30804 ac_cv_search_getrrsetbyname=$ac_res
30805else
30806 echo "$as_me: failed program was:" >&5
30807sed 's/^/| /' conftest.$ac_ext >&5
30808
30809
16180fi 30810fi
16181rm -f core conftest.err conftest.$ac_objext \ 30811
16182 conftest$ac_exeext 30812rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16183 if ${ac_cv_search_getrrsetbyname+:} false; then : 30813 conftest$ac_exeext
30814 if test "${ac_cv_search_getrrsetbyname+set}" = set; then
16184 break 30815 break
16185fi 30816fi
16186done 30817done
16187if ${ac_cv_search_getrrsetbyname+:} false; then : 30818if test "${ac_cv_search_getrrsetbyname+set}" = set; then
16188 30819 :
16189else 30820else
16190 ac_cv_search_getrrsetbyname=no 30821 ac_cv_search_getrrsetbyname=no
16191fi 30822fi
16192rm conftest.$ac_ext 30823rm conftest.$ac_ext
16193LIBS=$ac_func_search_save_LIBS 30824LIBS=$ac_func_search_save_LIBS
16194fi 30825fi
16195{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getrrsetbyname" >&5 30826{ echo "$as_me:$LINENO: result: $ac_cv_search_getrrsetbyname" >&5
16196$as_echo "$ac_cv_search_getrrsetbyname" >&6; } 30827echo "${ECHO_T}$ac_cv_search_getrrsetbyname" >&6; }
16197ac_res=$ac_cv_search_getrrsetbyname 30828ac_res=$ac_cv_search_getrrsetbyname
16198if test "$ac_res" != no; then : 30829if test "$ac_res" != no; then
16199 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 30830 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
16200 30831
16201$as_echo "#define HAVE_GETRRSETBYNAME 1" >>confdefs.h 30832cat >>confdefs.h <<\_ACEOF
30833#define HAVE_GETRRSETBYNAME 1
30834_ACEOF
16202 30835
16203else 30836else
16204 30837
16205 # Needed by our getrrsetbyname() 30838 # Needed by our getrrsetbyname()
16206 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing res_query" >&5 30839 { echo "$as_me:$LINENO: checking for library containing res_query" >&5
16207$as_echo_n "checking for library containing res_query... " >&6; } 30840echo $ECHO_N "checking for library containing res_query... $ECHO_C" >&6; }
16208if ${ac_cv_search_res_query+:} false; then : 30841if test "${ac_cv_search_res_query+set}" = set; then
16209 $as_echo_n "(cached) " >&6 30842 echo $ECHO_N "(cached) $ECHO_C" >&6
16210else 30843else
16211 ac_func_search_save_LIBS=$LIBS 30844 ac_func_search_save_LIBS=$LIBS
16212cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30845cat >conftest.$ac_ext <<_ACEOF
30846/* confdefs.h. */
30847_ACEOF
30848cat confdefs.h >>conftest.$ac_ext
30849cat >>conftest.$ac_ext <<_ACEOF
16213/* end confdefs.h. */ 30850/* end confdefs.h. */
16214 30851
16215/* Override any GCC internal prototype to avoid an error. 30852/* Override any GCC internal prototype to avoid an error.
@@ -16234,38 +30871,65 @@ for ac_lib in '' resolv; do
16234 ac_res=-l$ac_lib 30871 ac_res=-l$ac_lib
16235 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 30872 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
16236 fi 30873 fi
16237 if ac_fn_c_try_link "$LINENO"; then : 30874 rm -f conftest.$ac_objext conftest$ac_exeext
30875if { (ac_try="$ac_link"
30876case "(($ac_try" in
30877 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30878 *) ac_try_echo=$ac_try;;
30879esac
30880eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30881 (eval "$ac_link") 2>conftest.er1
30882 ac_status=$?
30883 grep -v '^ *+' conftest.er1 >conftest.err
30884 rm -f conftest.er1
30885 cat conftest.err >&5
30886 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30887 (exit $ac_status); } && {
30888 test -z "$ac_c_werror_flag" ||
30889 test ! -s conftest.err
30890 } && test -s conftest$ac_exeext &&
30891 $as_test_x conftest$ac_exeext; then
16238 ac_cv_search_res_query=$ac_res 30892 ac_cv_search_res_query=$ac_res
30893else
30894 echo "$as_me: failed program was:" >&5
30895sed 's/^/| /' conftest.$ac_ext >&5
30896
30897
16239fi 30898fi
16240rm -f core conftest.err conftest.$ac_objext \ 30899
16241 conftest$ac_exeext 30900rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16242 if ${ac_cv_search_res_query+:} false; then : 30901 conftest$ac_exeext
30902 if test "${ac_cv_search_res_query+set}" = set; then
16243 break 30903 break
16244fi 30904fi
16245done 30905done
16246if ${ac_cv_search_res_query+:} false; then : 30906if test "${ac_cv_search_res_query+set}" = set; then
16247 30907 :
16248else 30908else
16249 ac_cv_search_res_query=no 30909 ac_cv_search_res_query=no
16250fi 30910fi
16251rm conftest.$ac_ext 30911rm conftest.$ac_ext
16252LIBS=$ac_func_search_save_LIBS 30912LIBS=$ac_func_search_save_LIBS
16253fi 30913fi
16254{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_res_query" >&5 30914{ echo "$as_me:$LINENO: result: $ac_cv_search_res_query" >&5
16255$as_echo "$ac_cv_search_res_query" >&6; } 30915echo "${ECHO_T}$ac_cv_search_res_query" >&6; }
16256ac_res=$ac_cv_search_res_query 30916ac_res=$ac_cv_search_res_query
16257if test "$ac_res" != no; then : 30917if test "$ac_res" != no; then
16258 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 30918 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
16259 30919
16260fi 30920fi
16261 30921
16262 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dn_expand" >&5 30922 { echo "$as_me:$LINENO: checking for library containing dn_expand" >&5
16263$as_echo_n "checking for library containing dn_expand... " >&6; } 30923echo $ECHO_N "checking for library containing dn_expand... $ECHO_C" >&6; }
16264if ${ac_cv_search_dn_expand+:} false; then : 30924if test "${ac_cv_search_dn_expand+set}" = set; then
16265 $as_echo_n "(cached) " >&6 30925 echo $ECHO_N "(cached) $ECHO_C" >&6
16266else 30926else
16267 ac_func_search_save_LIBS=$LIBS 30927 ac_func_search_save_LIBS=$LIBS
16268cat confdefs.h - <<_ACEOF >conftest.$ac_ext 30928cat >conftest.$ac_ext <<_ACEOF
30929/* confdefs.h. */
30930_ACEOF
30931cat confdefs.h >>conftest.$ac_ext
30932cat >>conftest.$ac_ext <<_ACEOF
16269/* end confdefs.h. */ 30933/* end confdefs.h. */
16270 30934
16271/* Override any GCC internal prototype to avoid an error. 30935/* Override any GCC internal prototype to avoid an error.
@@ -16290,34 +30954,61 @@ for ac_lib in '' resolv; do
16290 ac_res=-l$ac_lib 30954 ac_res=-l$ac_lib
16291 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 30955 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
16292 fi 30956 fi
16293 if ac_fn_c_try_link "$LINENO"; then : 30957 rm -f conftest.$ac_objext conftest$ac_exeext
30958if { (ac_try="$ac_link"
30959case "(($ac_try" in
30960 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
30961 *) ac_try_echo=$ac_try;;
30962esac
30963eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
30964 (eval "$ac_link") 2>conftest.er1
30965 ac_status=$?
30966 grep -v '^ *+' conftest.er1 >conftest.err
30967 rm -f conftest.er1
30968 cat conftest.err >&5
30969 echo "$as_me:$LINENO: \$? = $ac_status" >&5
30970 (exit $ac_status); } && {
30971 test -z "$ac_c_werror_flag" ||
30972 test ! -s conftest.err
30973 } && test -s conftest$ac_exeext &&
30974 $as_test_x conftest$ac_exeext; then
16294 ac_cv_search_dn_expand=$ac_res 30975 ac_cv_search_dn_expand=$ac_res
30976else
30977 echo "$as_me: failed program was:" >&5
30978sed 's/^/| /' conftest.$ac_ext >&5
30979
30980
16295fi 30981fi
16296rm -f core conftest.err conftest.$ac_objext \ 30982
16297 conftest$ac_exeext 30983rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16298 if ${ac_cv_search_dn_expand+:} false; then : 30984 conftest$ac_exeext
30985 if test "${ac_cv_search_dn_expand+set}" = set; then
16299 break 30986 break
16300fi 30987fi
16301done 30988done
16302if ${ac_cv_search_dn_expand+:} false; then : 30989if test "${ac_cv_search_dn_expand+set}" = set; then
16303 30990 :
16304else 30991else
16305 ac_cv_search_dn_expand=no 30992 ac_cv_search_dn_expand=no
16306fi 30993fi
16307rm conftest.$ac_ext 30994rm conftest.$ac_ext
16308LIBS=$ac_func_search_save_LIBS 30995LIBS=$ac_func_search_save_LIBS
16309fi 30996fi
16310{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dn_expand" >&5 30997{ echo "$as_me:$LINENO: result: $ac_cv_search_dn_expand" >&5
16311$as_echo "$ac_cv_search_dn_expand" >&6; } 30998echo "${ECHO_T}$ac_cv_search_dn_expand" >&6; }
16312ac_res=$ac_cv_search_dn_expand 30999ac_res=$ac_cv_search_dn_expand
16313if test "$ac_res" != no; then : 31000if test "$ac_res" != no; then
16314 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 31001 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
16315 31002
16316fi 31003fi
16317 31004
16318 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if res_query will link" >&5 31005 { echo "$as_me:$LINENO: checking if res_query will link" >&5
16319$as_echo_n "checking if res_query will link... " >&6; } 31006echo $ECHO_N "checking if res_query will link... $ECHO_C" >&6; }
16320 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 31007 cat >conftest.$ac_ext <<_ACEOF
31008/* confdefs.h. */
31009_ACEOF
31010cat confdefs.h >>conftest.$ac_ext
31011cat >>conftest.$ac_ext <<_ACEOF
16321/* end confdefs.h. */ 31012/* end confdefs.h. */
16322 31013
16323#include <sys/types.h> 31014#include <sys/types.h>
@@ -16336,17 +31027,41 @@ main ()
16336 return 0; 31027 return 0;
16337} 31028}
16338_ACEOF 31029_ACEOF
16339if ac_fn_c_try_link "$LINENO"; then : 31030rm -f conftest.$ac_objext conftest$ac_exeext
16340 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 31031if { (ac_try="$ac_link"
16341$as_echo "yes" >&6; } 31032case "(($ac_try" in
31033 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31034 *) ac_try_echo=$ac_try;;
31035esac
31036eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31037 (eval "$ac_link") 2>conftest.er1
31038 ac_status=$?
31039 grep -v '^ *+' conftest.er1 >conftest.err
31040 rm -f conftest.er1
31041 cat conftest.err >&5
31042 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31043 (exit $ac_status); } && {
31044 test -z "$ac_c_werror_flag" ||
31045 test ! -s conftest.err
31046 } && test -s conftest$ac_exeext &&
31047 $as_test_x conftest$ac_exeext; then
31048 { echo "$as_me:$LINENO: result: yes" >&5
31049echo "${ECHO_T}yes" >&6; }
16342else 31050else
16343 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31051 echo "$as_me: failed program was:" >&5
16344$as_echo "no" >&6; } 31052sed 's/^/| /' conftest.$ac_ext >&5
31053
31054 { echo "$as_me:$LINENO: result: no" >&5
31055echo "${ECHO_T}no" >&6; }
16345 saved_LIBS="$LIBS" 31056 saved_LIBS="$LIBS"
16346 LIBS="$LIBS -lresolv" 31057 LIBS="$LIBS -lresolv"
16347 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_query in -lresolv" >&5 31058 { echo "$as_me:$LINENO: checking for res_query in -lresolv" >&5
16348$as_echo_n "checking for res_query in -lresolv... " >&6; } 31059echo $ECHO_N "checking for res_query in -lresolv... $ECHO_C" >&6; }
16349 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 31060 cat >conftest.$ac_ext <<_ACEOF
31061/* confdefs.h. */
31062_ACEOF
31063cat confdefs.h >>conftest.$ac_ext
31064cat >>conftest.$ac_ext <<_ACEOF
16350/* end confdefs.h. */ 31065/* end confdefs.h. */
16351 31066
16352#include <sys/types.h> 31067#include <sys/types.h>
@@ -16365,72 +31080,389 @@ main ()
16365 return 0; 31080 return 0;
16366} 31081}
16367_ACEOF 31082_ACEOF
16368if ac_fn_c_try_link "$LINENO"; then : 31083rm -f conftest.$ac_objext conftest$ac_exeext
16369 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 31084if { (ac_try="$ac_link"
16370$as_echo "yes" >&6; } 31085case "(($ac_try" in
31086 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31087 *) ac_try_echo=$ac_try;;
31088esac
31089eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31090 (eval "$ac_link") 2>conftest.er1
31091 ac_status=$?
31092 grep -v '^ *+' conftest.er1 >conftest.err
31093 rm -f conftest.er1
31094 cat conftest.err >&5
31095 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31096 (exit $ac_status); } && {
31097 test -z "$ac_c_werror_flag" ||
31098 test ! -s conftest.err
31099 } && test -s conftest$ac_exeext &&
31100 $as_test_x conftest$ac_exeext; then
31101 { echo "$as_me:$LINENO: result: yes" >&5
31102echo "${ECHO_T}yes" >&6; }
16371else 31103else
16372 LIBS="$saved_LIBS" 31104 echo "$as_me: failed program was:" >&5
16373 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31105sed 's/^/| /' conftest.$ac_ext >&5
16374$as_echo "no" >&6; } 31106
31107 LIBS="$saved_LIBS"
31108 { echo "$as_me:$LINENO: result: no" >&5
31109echo "${ECHO_T}no" >&6; }
16375fi 31110fi
16376rm -f core conftest.err conftest.$ac_objext \ 31111
16377 conftest$ac_exeext conftest.$ac_ext 31112rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
31113 conftest$ac_exeext conftest.$ac_ext
16378 31114
16379fi 31115fi
16380rm -f core conftest.err conftest.$ac_objext \ 31116
16381 conftest$ac_exeext conftest.$ac_ext 31117rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16382 for ac_func in _getshort _getlong 31118 conftest$ac_exeext conftest.$ac_ext
16383do : 31119
16384 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 31120
16385ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 31121for ac_func in _getshort _getlong
16386if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 31122do
31123as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
31124{ echo "$as_me:$LINENO: checking for $ac_func" >&5
31125echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
31126if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
31127 echo $ECHO_N "(cached) $ECHO_C" >&6
31128else
31129 cat >conftest.$ac_ext <<_ACEOF
31130/* confdefs.h. */
31131_ACEOF
31132cat confdefs.h >>conftest.$ac_ext
31133cat >>conftest.$ac_ext <<_ACEOF
31134/* end confdefs.h. */
31135/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
31136 For example, HP-UX 11i <limits.h> declares gettimeofday. */
31137#define $ac_func innocuous_$ac_func
31138
31139/* System header to define __stub macros and hopefully few prototypes,
31140 which can conflict with char $ac_func (); below.
31141 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
31142 <limits.h> exists even on freestanding compilers. */
31143
31144#ifdef __STDC__
31145# include <limits.h>
31146#else
31147# include <assert.h>
31148#endif
31149
31150#undef $ac_func
31151
31152/* Override any GCC internal prototype to avoid an error.
31153 Use char because int might match the return type of a GCC
31154 builtin and then its argument prototype would still apply. */
31155#ifdef __cplusplus
31156extern "C"
31157#endif
31158char $ac_func ();
31159/* The GNU C library defines this for functions which it implements
31160 to always fail with ENOSYS. Some functions are actually named
31161 something starting with __ and the normal name is an alias. */
31162#if defined __stub_$ac_func || defined __stub___$ac_func
31163choke me
31164#endif
31165
31166int
31167main ()
31168{
31169return $ac_func ();
31170 ;
31171 return 0;
31172}
31173_ACEOF
31174rm -f conftest.$ac_objext conftest$ac_exeext
31175if { (ac_try="$ac_link"
31176case "(($ac_try" in
31177 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31178 *) ac_try_echo=$ac_try;;
31179esac
31180eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31181 (eval "$ac_link") 2>conftest.er1
31182 ac_status=$?
31183 grep -v '^ *+' conftest.er1 >conftest.err
31184 rm -f conftest.er1
31185 cat conftest.err >&5
31186 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31187 (exit $ac_status); } && {
31188 test -z "$ac_c_werror_flag" ||
31189 test ! -s conftest.err
31190 } && test -s conftest$ac_exeext &&
31191 $as_test_x conftest$ac_exeext; then
31192 eval "$as_ac_var=yes"
31193else
31194 echo "$as_me: failed program was:" >&5
31195sed 's/^/| /' conftest.$ac_ext >&5
31196
31197 eval "$as_ac_var=no"
31198fi
31199
31200rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
31201 conftest$ac_exeext conftest.$ac_ext
31202fi
31203ac_res=`eval echo '${'$as_ac_var'}'`
31204 { echo "$as_me:$LINENO: result: $ac_res" >&5
31205echo "${ECHO_T}$ac_res" >&6; }
31206if test `eval echo '${'$as_ac_var'}'` = yes; then
16387 cat >>confdefs.h <<_ACEOF 31207 cat >>confdefs.h <<_ACEOF
16388#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 31208#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
16389_ACEOF 31209_ACEOF
16390 31210
16391fi 31211fi
16392done 31212done
16393 31213
16394 ac_fn_c_check_decl "$LINENO" "_getshort" "ac_cv_have_decl__getshort" "#include <sys/types.h> 31214 { echo "$as_me:$LINENO: checking whether _getshort is declared" >&5
31215echo $ECHO_N "checking whether _getshort is declared... $ECHO_C" >&6; }
31216if test "${ac_cv_have_decl__getshort+set}" = set; then
31217 echo $ECHO_N "(cached) $ECHO_C" >&6
31218else
31219 cat >conftest.$ac_ext <<_ACEOF
31220/* confdefs.h. */
31221_ACEOF
31222cat confdefs.h >>conftest.$ac_ext
31223cat >>conftest.$ac_ext <<_ACEOF
31224/* end confdefs.h. */
31225#include <sys/types.h>
16395 #include <arpa/nameser.h> 31226 #include <arpa/nameser.h>
16396" 31227
16397if test "x$ac_cv_have_decl__getshort" = xyes; then : 31228int
16398 ac_have_decl=1 31229main ()
31230{
31231#ifndef _getshort
31232 (void) _getshort;
31233#endif
31234
31235 ;
31236 return 0;
31237}
31238_ACEOF
31239rm -f conftest.$ac_objext
31240if { (ac_try="$ac_compile"
31241case "(($ac_try" in
31242 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31243 *) ac_try_echo=$ac_try;;
31244esac
31245eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31246 (eval "$ac_compile") 2>conftest.er1
31247 ac_status=$?
31248 grep -v '^ *+' conftest.er1 >conftest.err
31249 rm -f conftest.er1
31250 cat conftest.err >&5
31251 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31252 (exit $ac_status); } && {
31253 test -z "$ac_c_werror_flag" ||
31254 test ! -s conftest.err
31255 } && test -s conftest.$ac_objext; then
31256 ac_cv_have_decl__getshort=yes
16399else 31257else
16400 ac_have_decl=0 31258 echo "$as_me: failed program was:" >&5
31259sed 's/^/| /' conftest.$ac_ext >&5
31260
31261 ac_cv_have_decl__getshort=no
16401fi 31262fi
16402 31263
31264rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
31265fi
31266{ echo "$as_me:$LINENO: result: $ac_cv_have_decl__getshort" >&5
31267echo "${ECHO_T}$ac_cv_have_decl__getshort" >&6; }
31268if test $ac_cv_have_decl__getshort = yes; then
31269
16403cat >>confdefs.h <<_ACEOF 31270cat >>confdefs.h <<_ACEOF
16404#define HAVE_DECL__GETSHORT $ac_have_decl 31271#define HAVE_DECL__GETSHORT 1
16405_ACEOF 31272_ACEOF
16406ac_fn_c_check_decl "$LINENO" "_getlong" "ac_cv_have_decl__getlong" "#include <sys/types.h> 31273
31274
31275else
31276 cat >>confdefs.h <<_ACEOF
31277#define HAVE_DECL__GETSHORT 0
31278_ACEOF
31279
31280
31281fi
31282{ echo "$as_me:$LINENO: checking whether _getlong is declared" >&5
31283echo $ECHO_N "checking whether _getlong is declared... $ECHO_C" >&6; }
31284if test "${ac_cv_have_decl__getlong+set}" = set; then
31285 echo $ECHO_N "(cached) $ECHO_C" >&6
31286else
31287 cat >conftest.$ac_ext <<_ACEOF
31288/* confdefs.h. */
31289_ACEOF
31290cat confdefs.h >>conftest.$ac_ext
31291cat >>conftest.$ac_ext <<_ACEOF
31292/* end confdefs.h. */
31293#include <sys/types.h>
16407 #include <arpa/nameser.h> 31294 #include <arpa/nameser.h>
16408" 31295
16409if test "x$ac_cv_have_decl__getlong" = xyes; then : 31296int
16410 ac_have_decl=1 31297main ()
31298{
31299#ifndef _getlong
31300 (void) _getlong;
31301#endif
31302
31303 ;
31304 return 0;
31305}
31306_ACEOF
31307rm -f conftest.$ac_objext
31308if { (ac_try="$ac_compile"
31309case "(($ac_try" in
31310 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31311 *) ac_try_echo=$ac_try;;
31312esac
31313eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31314 (eval "$ac_compile") 2>conftest.er1
31315 ac_status=$?
31316 grep -v '^ *+' conftest.er1 >conftest.err
31317 rm -f conftest.er1
31318 cat conftest.err >&5
31319 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31320 (exit $ac_status); } && {
31321 test -z "$ac_c_werror_flag" ||
31322 test ! -s conftest.err
31323 } && test -s conftest.$ac_objext; then
31324 ac_cv_have_decl__getlong=yes
16411else 31325else
16412 ac_have_decl=0 31326 echo "$as_me: failed program was:" >&5
31327sed 's/^/| /' conftest.$ac_ext >&5
31328
31329 ac_cv_have_decl__getlong=no
31330fi
31331
31332rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16413fi 31333fi
31334{ echo "$as_me:$LINENO: result: $ac_cv_have_decl__getlong" >&5
31335echo "${ECHO_T}$ac_cv_have_decl__getlong" >&6; }
31336if test $ac_cv_have_decl__getlong = yes; then
16414 31337
16415cat >>confdefs.h <<_ACEOF 31338cat >>confdefs.h <<_ACEOF
16416#define HAVE_DECL__GETLONG $ac_have_decl 31339#define HAVE_DECL__GETLONG 1
16417_ACEOF 31340_ACEOF
16418 31341
16419 ac_fn_c_check_member "$LINENO" "HEADER" "ad" "ac_cv_member_HEADER_ad" "#include <arpa/nameser.h>
16420"
16421if test "x$ac_cv_member_HEADER_ad" = xyes; then :
16422 31342
16423$as_echo "#define HAVE_HEADER_AD 1" >>confdefs.h 31343else
31344 cat >>confdefs.h <<_ACEOF
31345#define HAVE_DECL__GETLONG 0
31346_ACEOF
31347
31348
31349fi
31350
31351
31352 { echo "$as_me:$LINENO: checking for HEADER.ad" >&5
31353echo $ECHO_N "checking for HEADER.ad... $ECHO_C" >&6; }
31354if test "${ac_cv_member_HEADER_ad+set}" = set; then
31355 echo $ECHO_N "(cached) $ECHO_C" >&6
31356else
31357 cat >conftest.$ac_ext <<_ACEOF
31358/* confdefs.h. */
31359_ACEOF
31360cat confdefs.h >>conftest.$ac_ext
31361cat >>conftest.$ac_ext <<_ACEOF
31362/* end confdefs.h. */
31363#include <arpa/nameser.h>
31364
31365int
31366main ()
31367{
31368static HEADER ac_aggr;
31369if (ac_aggr.ad)
31370return 0;
31371 ;
31372 return 0;
31373}
31374_ACEOF
31375rm -f conftest.$ac_objext
31376if { (ac_try="$ac_compile"
31377case "(($ac_try" in
31378 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31379 *) ac_try_echo=$ac_try;;
31380esac
31381eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31382 (eval "$ac_compile") 2>conftest.er1
31383 ac_status=$?
31384 grep -v '^ *+' conftest.er1 >conftest.err
31385 rm -f conftest.er1
31386 cat conftest.err >&5
31387 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31388 (exit $ac_status); } && {
31389 test -z "$ac_c_werror_flag" ||
31390 test ! -s conftest.err
31391 } && test -s conftest.$ac_objext; then
31392 ac_cv_member_HEADER_ad=yes
31393else
31394 echo "$as_me: failed program was:" >&5
31395sed 's/^/| /' conftest.$ac_ext >&5
31396
31397 cat >conftest.$ac_ext <<_ACEOF
31398/* confdefs.h. */
31399_ACEOF
31400cat confdefs.h >>conftest.$ac_ext
31401cat >>conftest.$ac_ext <<_ACEOF
31402/* end confdefs.h. */
31403#include <arpa/nameser.h>
16424 31404
31405int
31406main ()
31407{
31408static HEADER ac_aggr;
31409if (sizeof ac_aggr.ad)
31410return 0;
31411 ;
31412 return 0;
31413}
31414_ACEOF
31415rm -f conftest.$ac_objext
31416if { (ac_try="$ac_compile"
31417case "(($ac_try" in
31418 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31419 *) ac_try_echo=$ac_try;;
31420esac
31421eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31422 (eval "$ac_compile") 2>conftest.er1
31423 ac_status=$?
31424 grep -v '^ *+' conftest.er1 >conftest.err
31425 rm -f conftest.er1
31426 cat conftest.err >&5
31427 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31428 (exit $ac_status); } && {
31429 test -z "$ac_c_werror_flag" ||
31430 test ! -s conftest.err
31431 } && test -s conftest.$ac_objext; then
31432 ac_cv_member_HEADER_ad=yes
31433else
31434 echo "$as_me: failed program was:" >&5
31435sed 's/^/| /' conftest.$ac_ext >&5
31436
31437 ac_cv_member_HEADER_ad=no
16425fi 31438fi
16426 31439
31440rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
31441fi
16427 31442
31443rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16428fi 31444fi
31445{ echo "$as_me:$LINENO: result: $ac_cv_member_HEADER_ad" >&5
31446echo "${ECHO_T}$ac_cv_member_HEADER_ad" >&6; }
31447if test $ac_cv_member_HEADER_ad = yes; then
16429 31448
31449cat >>confdefs.h <<\_ACEOF
31450#define HAVE_HEADER_AD 1
31451_ACEOF
31452
31453fi
16430 31454
16431{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if struct __res_state _res is an extern" >&5 31455
16432$as_echo_n "checking if struct __res_state _res is an extern... " >&6; } 31456fi
16433cat confdefs.h - <<_ACEOF >conftest.$ac_ext 31457
31458
31459{ echo "$as_me:$LINENO: checking if struct __res_state _res is an extern" >&5
31460echo $ECHO_N "checking if struct __res_state _res is an extern... $ECHO_C" >&6; }
31461cat >conftest.$ac_ext <<_ACEOF
31462/* confdefs.h. */
31463_ACEOF
31464cat confdefs.h >>conftest.$ac_ext
31465cat >>conftest.$ac_ext <<_ACEOF
16434/* end confdefs.h. */ 31466/* end confdefs.h. */
16435 31467
16436#include <stdio.h> 31468#include <stdio.h>
@@ -16450,49 +31482,209 @@ main ()
16450 return 0; 31482 return 0;
16451} 31483}
16452_ACEOF 31484_ACEOF
16453if ac_fn_c_try_link "$LINENO"; then : 31485rm -f conftest.$ac_objext conftest$ac_exeext
16454 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 31486if { (ac_try="$ac_link"
16455$as_echo "yes" >&6; } 31487case "(($ac_try" in
31488 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31489 *) ac_try_echo=$ac_try;;
31490esac
31491eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31492 (eval "$ac_link") 2>conftest.er1
31493 ac_status=$?
31494 grep -v '^ *+' conftest.er1 >conftest.err
31495 rm -f conftest.er1
31496 cat conftest.err >&5
31497 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31498 (exit $ac_status); } && {
31499 test -z "$ac_c_werror_flag" ||
31500 test ! -s conftest.err
31501 } && test -s conftest$ac_exeext &&
31502 $as_test_x conftest$ac_exeext; then
31503 { echo "$as_me:$LINENO: result: yes" >&5
31504echo "${ECHO_T}yes" >&6; }
16456 31505
16457$as_echo "#define HAVE__RES_EXTERN 1" >>confdefs.h 31506cat >>confdefs.h <<\_ACEOF
31507#define HAVE__RES_EXTERN 1
31508_ACEOF
16458 31509
16459 31510
16460else 31511else
16461 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31512 echo "$as_me: failed program was:" >&5
16462$as_echo "no" >&6; } 31513sed 's/^/| /' conftest.$ac_ext >&5
31514
31515 { echo "$as_me:$LINENO: result: no" >&5
31516echo "${ECHO_T}no" >&6; }
16463 31517
16464fi 31518fi
16465rm -f core conftest.err conftest.$ac_objext \ 31519
16466 conftest$ac_exeext conftest.$ac_ext 31520rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
31521 conftest$ac_exeext conftest.$ac_ext
16467 31522
16468# Check whether user wants SELinux support 31523# Check whether user wants SELinux support
16469SELINUX_MSG="no" 31524SELINUX_MSG="no"
16470LIBSELINUX="" 31525LIBSELINUX=""
16471 31526
16472# Check whether --with-selinux was given. 31527# Check whether --with-selinux was given.
16473if test "${with_selinux+set}" = set; then : 31528if test "${with_selinux+set}" = set; then
16474 withval=$with_selinux; if test "x$withval" != "xno" ; then 31529 withval=$with_selinux; if test "x$withval" != "xno" ; then
16475 save_LIBS="$LIBS" 31530 save_LIBS="$LIBS"
16476 31531
16477$as_echo "#define WITH_SELINUX 1" >>confdefs.h 31532cat >>confdefs.h <<\_ACEOF
31533#define WITH_SELINUX 1
31534_ACEOF
16478 31535
16479 SELINUX_MSG="yes" 31536 SELINUX_MSG="yes"
16480 ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default" 31537 if test "${ac_cv_header_selinux_selinux_h+set}" = set; then
16481if test "x$ac_cv_header_selinux_selinux_h" = xyes; then : 31538 { echo "$as_me:$LINENO: checking for selinux/selinux.h" >&5
31539echo $ECHO_N "checking for selinux/selinux.h... $ECHO_C" >&6; }
31540if test "${ac_cv_header_selinux_selinux_h+set}" = set; then
31541 echo $ECHO_N "(cached) $ECHO_C" >&6
31542fi
31543{ echo "$as_me:$LINENO: result: $ac_cv_header_selinux_selinux_h" >&5
31544echo "${ECHO_T}$ac_cv_header_selinux_selinux_h" >&6; }
31545else
31546 # Is the header compilable?
31547{ echo "$as_me:$LINENO: checking selinux/selinux.h usability" >&5
31548echo $ECHO_N "checking selinux/selinux.h usability... $ECHO_C" >&6; }
31549cat >conftest.$ac_ext <<_ACEOF
31550/* confdefs.h. */
31551_ACEOF
31552cat confdefs.h >>conftest.$ac_ext
31553cat >>conftest.$ac_ext <<_ACEOF
31554/* end confdefs.h. */
31555$ac_includes_default
31556#include <selinux/selinux.h>
31557_ACEOF
31558rm -f conftest.$ac_objext
31559if { (ac_try="$ac_compile"
31560case "(($ac_try" in
31561 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31562 *) ac_try_echo=$ac_try;;
31563esac
31564eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31565 (eval "$ac_compile") 2>conftest.er1
31566 ac_status=$?
31567 grep -v '^ *+' conftest.er1 >conftest.err
31568 rm -f conftest.er1
31569 cat conftest.err >&5
31570 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31571 (exit $ac_status); } && {
31572 test -z "$ac_c_werror_flag" ||
31573 test ! -s conftest.err
31574 } && test -s conftest.$ac_objext; then
31575 ac_header_compiler=yes
31576else
31577 echo "$as_me: failed program was:" >&5
31578sed 's/^/| /' conftest.$ac_ext >&5
31579
31580 ac_header_compiler=no
31581fi
31582
31583rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
31584{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
31585echo "${ECHO_T}$ac_header_compiler" >&6; }
31586
31587# Is the header present?
31588{ echo "$as_me:$LINENO: checking selinux/selinux.h presence" >&5
31589echo $ECHO_N "checking selinux/selinux.h presence... $ECHO_C" >&6; }
31590cat >conftest.$ac_ext <<_ACEOF
31591/* confdefs.h. */
31592_ACEOF
31593cat confdefs.h >>conftest.$ac_ext
31594cat >>conftest.$ac_ext <<_ACEOF
31595/* end confdefs.h. */
31596#include <selinux/selinux.h>
31597_ACEOF
31598if { (ac_try="$ac_cpp conftest.$ac_ext"
31599case "(($ac_try" in
31600 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31601 *) ac_try_echo=$ac_try;;
31602esac
31603eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31604 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
31605 ac_status=$?
31606 grep -v '^ *+' conftest.er1 >conftest.err
31607 rm -f conftest.er1
31608 cat conftest.err >&5
31609 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31610 (exit $ac_status); } >/dev/null && {
31611 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
31612 test ! -s conftest.err
31613 }; then
31614 ac_header_preproc=yes
31615else
31616 echo "$as_me: failed program was:" >&5
31617sed 's/^/| /' conftest.$ac_ext >&5
16482 31618
31619 ac_header_preproc=no
31620fi
31621
31622rm -f conftest.err conftest.$ac_ext
31623{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
31624echo "${ECHO_T}$ac_header_preproc" >&6; }
31625
31626# So? What about this header?
31627case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
31628 yes:no: )
31629 { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: accepted by the compiler, rejected by the preprocessor!" >&5
31630echo "$as_me: WARNING: selinux/selinux.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
31631 { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: proceeding with the compiler's result" >&5
31632echo "$as_me: WARNING: selinux/selinux.h: proceeding with the compiler's result" >&2;}
31633 ac_header_preproc=yes
31634 ;;
31635 no:yes:* )
31636 { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: present but cannot be compiled" >&5
31637echo "$as_me: WARNING: selinux/selinux.h: present but cannot be compiled" >&2;}
31638 { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: check for missing prerequisite headers?" >&5
31639echo "$as_me: WARNING: selinux/selinux.h: check for missing prerequisite headers?" >&2;}
31640 { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: see the Autoconf documentation" >&5
31641echo "$as_me: WARNING: selinux/selinux.h: see the Autoconf documentation" >&2;}
31642 { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: section \"Present But Cannot Be Compiled\"" >&5
31643echo "$as_me: WARNING: selinux/selinux.h: section \"Present But Cannot Be Compiled\"" >&2;}
31644 { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: proceeding with the preprocessor's result" >&5
31645echo "$as_me: WARNING: selinux/selinux.h: proceeding with the preprocessor's result" >&2;}
31646 { echo "$as_me:$LINENO: WARNING: selinux/selinux.h: in the future, the compiler will take precedence" >&5
31647echo "$as_me: WARNING: selinux/selinux.h: in the future, the compiler will take precedence" >&2;}
31648 ( cat <<\_ASBOX
31649## ------------------------------------------- ##
31650## Report this to openssh-unix-dev@mindrot.org ##
31651## ------------------------------------------- ##
31652_ASBOX
31653 ) | sed "s/^/$as_me: WARNING: /" >&2
31654 ;;
31655esac
31656{ echo "$as_me:$LINENO: checking for selinux/selinux.h" >&5
31657echo $ECHO_N "checking for selinux/selinux.h... $ECHO_C" >&6; }
31658if test "${ac_cv_header_selinux_selinux_h+set}" = set; then
31659 echo $ECHO_N "(cached) $ECHO_C" >&6
16483else 31660else
16484 as_fn_error $? "SELinux support requires selinux.h header" "$LINENO" 5 31661 ac_cv_header_selinux_selinux_h=$ac_header_preproc
16485fi 31662fi
31663{ echo "$as_me:$LINENO: result: $ac_cv_header_selinux_selinux_h" >&5
31664echo "${ECHO_T}$ac_cv_header_selinux_selinux_h" >&6; }
16486 31665
31666fi
31667if test $ac_cv_header_selinux_selinux_h = yes; then
31668 :
31669else
31670 { { echo "$as_me:$LINENO: error: SELinux support requires selinux.h header" >&5
31671echo "$as_me: error: SELinux support requires selinux.h header" >&2;}
31672 { (exit 1); exit 1; }; }
31673fi
16487 31674
16488 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setexeccon in -lselinux" >&5 31675
16489$as_echo_n "checking for setexeccon in -lselinux... " >&6; } 31676 { echo "$as_me:$LINENO: checking for setexeccon in -lselinux" >&5
16490if ${ac_cv_lib_selinux_setexeccon+:} false; then : 31677echo $ECHO_N "checking for setexeccon in -lselinux... $ECHO_C" >&6; }
16491 $as_echo_n "(cached) " >&6 31678if test "${ac_cv_lib_selinux_setexeccon+set}" = set; then
31679 echo $ECHO_N "(cached) $ECHO_C" >&6
16492else 31680else
16493 ac_check_lib_save_LIBS=$LIBS 31681 ac_check_lib_save_LIBS=$LIBS
16494LIBS="-lselinux $LIBS" 31682LIBS="-lselinux $LIBS"
16495cat confdefs.h - <<_ACEOF >conftest.$ac_ext 31683cat >conftest.$ac_ext <<_ACEOF
31684/* confdefs.h. */
31685_ACEOF
31686cat confdefs.h >>conftest.$ac_ext
31687cat >>conftest.$ac_ext <<_ACEOF
16496/* end confdefs.h. */ 31688/* end confdefs.h. */
16497 31689
16498/* Override any GCC internal prototype to avoid an error. 31690/* Override any GCC internal prototype to avoid an error.
@@ -16510,34 +31702,140 @@ return setexeccon ();
16510 return 0; 31702 return 0;
16511} 31703}
16512_ACEOF 31704_ACEOF
16513if ac_fn_c_try_link "$LINENO"; then : 31705rm -f conftest.$ac_objext conftest$ac_exeext
31706if { (ac_try="$ac_link"
31707case "(($ac_try" in
31708 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31709 *) ac_try_echo=$ac_try;;
31710esac
31711eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31712 (eval "$ac_link") 2>conftest.er1
31713 ac_status=$?
31714 grep -v '^ *+' conftest.er1 >conftest.err
31715 rm -f conftest.er1
31716 cat conftest.err >&5
31717 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31718 (exit $ac_status); } && {
31719 test -z "$ac_c_werror_flag" ||
31720 test ! -s conftest.err
31721 } && test -s conftest$ac_exeext &&
31722 $as_test_x conftest$ac_exeext; then
16514 ac_cv_lib_selinux_setexeccon=yes 31723 ac_cv_lib_selinux_setexeccon=yes
16515else 31724else
16516 ac_cv_lib_selinux_setexeccon=no 31725 echo "$as_me: failed program was:" >&5
31726sed 's/^/| /' conftest.$ac_ext >&5
31727
31728 ac_cv_lib_selinux_setexeccon=no
16517fi 31729fi
16518rm -f core conftest.err conftest.$ac_objext \ 31730
16519 conftest$ac_exeext conftest.$ac_ext 31731rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
31732 conftest$ac_exeext conftest.$ac_ext
16520LIBS=$ac_check_lib_save_LIBS 31733LIBS=$ac_check_lib_save_LIBS
16521fi 31734fi
16522{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_setexeccon" >&5 31735{ echo "$as_me:$LINENO: result: $ac_cv_lib_selinux_setexeccon" >&5
16523$as_echo "$ac_cv_lib_selinux_setexeccon" >&6; } 31736echo "${ECHO_T}$ac_cv_lib_selinux_setexeccon" >&6; }
16524if test "x$ac_cv_lib_selinux_setexeccon" = xyes; then : 31737if test $ac_cv_lib_selinux_setexeccon = yes; then
16525 LIBSELINUX="-lselinux" 31738 LIBSELINUX="-lselinux"
16526 LIBS="$LIBS -lselinux" 31739 LIBS="$LIBS -lselinux"
16527 31740
16528else 31741else
16529 as_fn_error $? "SELinux support requires libselinux library" "$LINENO" 5 31742 { { echo "$as_me:$LINENO: error: SELinux support requires libselinux library" >&5
31743echo "$as_me: error: SELinux support requires libselinux library" >&2;}
31744 { (exit 1); exit 1; }; }
16530fi 31745fi
16531 31746
16532 SSHLIBS="$SSHLIBS $LIBSELINUX" 31747 SSHLIBS="$SSHLIBS $LIBSELINUX"
16533 SSHDLIBS="$SSHDLIBS $LIBSELINUX" 31748 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
16534 for ac_func in getseuserbyname get_default_context_with_level 31749
16535do : 31750
16536 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 31751for ac_func in getseuserbyname get_default_context_with_level
16537ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 31752do
16538if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 31753as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
31754{ echo "$as_me:$LINENO: checking for $ac_func" >&5
31755echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
31756if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
31757 echo $ECHO_N "(cached) $ECHO_C" >&6
31758else
31759 cat >conftest.$ac_ext <<_ACEOF
31760/* confdefs.h. */
31761_ACEOF
31762cat confdefs.h >>conftest.$ac_ext
31763cat >>conftest.$ac_ext <<_ACEOF
31764/* end confdefs.h. */
31765/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
31766 For example, HP-UX 11i <limits.h> declares gettimeofday. */
31767#define $ac_func innocuous_$ac_func
31768
31769/* System header to define __stub macros and hopefully few prototypes,
31770 which can conflict with char $ac_func (); below.
31771 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
31772 <limits.h> exists even on freestanding compilers. */
31773
31774#ifdef __STDC__
31775# include <limits.h>
31776#else
31777# include <assert.h>
31778#endif
31779
31780#undef $ac_func
31781
31782/* Override any GCC internal prototype to avoid an error.
31783 Use char because int might match the return type of a GCC
31784 builtin and then its argument prototype would still apply. */
31785#ifdef __cplusplus
31786extern "C"
31787#endif
31788char $ac_func ();
31789/* The GNU C library defines this for functions which it implements
31790 to always fail with ENOSYS. Some functions are actually named
31791 something starting with __ and the normal name is an alias. */
31792#if defined __stub_$ac_func || defined __stub___$ac_func
31793choke me
31794#endif
31795
31796int
31797main ()
31798{
31799return $ac_func ();
31800 ;
31801 return 0;
31802}
31803_ACEOF
31804rm -f conftest.$ac_objext conftest$ac_exeext
31805if { (ac_try="$ac_link"
31806case "(($ac_try" in
31807 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31808 *) ac_try_echo=$ac_try;;
31809esac
31810eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31811 (eval "$ac_link") 2>conftest.er1
31812 ac_status=$?
31813 grep -v '^ *+' conftest.er1 >conftest.err
31814 rm -f conftest.er1
31815 cat conftest.err >&5
31816 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31817 (exit $ac_status); } && {
31818 test -z "$ac_c_werror_flag" ||
31819 test ! -s conftest.err
31820 } && test -s conftest$ac_exeext &&
31821 $as_test_x conftest$ac_exeext; then
31822 eval "$as_ac_var=yes"
31823else
31824 echo "$as_me: failed program was:" >&5
31825sed 's/^/| /' conftest.$ac_ext >&5
31826
31827 eval "$as_ac_var=no"
31828fi
31829
31830rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
31831 conftest$ac_exeext conftest.$ac_ext
31832fi
31833ac_res=`eval echo '${'$as_ac_var'}'`
31834 { echo "$as_me:$LINENO: result: $ac_res" >&5
31835echo "${ECHO_T}$ac_res" >&6; }
31836if test `eval echo '${'$as_ac_var'}'` = yes; then
16539 cat >>confdefs.h <<_ACEOF 31837 cat >>confdefs.h <<_ACEOF
16540#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 31838#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
16541_ACEOF 31839_ACEOF
16542 31840
16543fi 31841fi
@@ -16555,7 +31853,7 @@ fi
16555KRB5_MSG="no" 31853KRB5_MSG="no"
16556 31854
16557# Check whether --with-kerberos5 was given. 31855# Check whether --with-kerberos5 was given.
16558if test "${with_kerberos5+set}" = set; then : 31856if test "${with_kerberos5+set}" = set; then
16559 withval=$with_kerberos5; if test "x$withval" != "xno" ; then 31857 withval=$with_kerberos5; if test "x$withval" != "xno" ; then
16560 if test "x$withval" = "xyes" ; then 31858 if test "x$withval" = "xyes" ; then
16561 KRB5ROOT="/usr/local" 31859 KRB5ROOT="/usr/local"
@@ -16564,16 +31862,18 @@ if test "${with_kerberos5+set}" = set; then :
16564 fi 31862 fi
16565 31863
16566 31864
16567$as_echo "#define KRB5 1" >>confdefs.h 31865cat >>confdefs.h <<\_ACEOF
31866#define KRB5 1
31867_ACEOF
16568 31868
16569 KRB5_MSG="yes" 31869 KRB5_MSG="yes"
16570 31870
16571 # Extract the first word of "krb5-config", so it can be a program name with args. 31871 # Extract the first word of "krb5-config", so it can be a program name with args.
16572set dummy krb5-config; ac_word=$2 31872set dummy krb5-config; ac_word=$2
16573{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 31873{ echo "$as_me:$LINENO: checking for $ac_word" >&5
16574$as_echo_n "checking for $ac_word... " >&6; } 31874echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
16575if ${ac_cv_path_KRB5CONF+:} false; then : 31875if test "${ac_cv_path_KRB5CONF+set}" = set; then
16576 $as_echo_n "(cached) " >&6 31876 echo $ECHO_N "(cached) $ECHO_C" >&6
16577else 31877else
16578 case $KRB5CONF in 31878 case $KRB5CONF in
16579 [\\/]* | ?:[\\/]*) 31879 [\\/]* | ?:[\\/]*)
@@ -16586,14 +31886,14 @@ for as_dir in $as_dummy
16586do 31886do
16587 IFS=$as_save_IFS 31887 IFS=$as_save_IFS
16588 test -z "$as_dir" && as_dir=. 31888 test -z "$as_dir" && as_dir=.
16589 for ac_exec_ext in '' $ac_executable_extensions; do 31889 for ac_exec_ext in '' $ac_executable_extensions; do
16590 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 31890 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
16591 ac_cv_path_KRB5CONF="$as_dir/$ac_word$ac_exec_ext" 31891 ac_cv_path_KRB5CONF="$as_dir/$ac_word$ac_exec_ext"
16592 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 31892 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
16593 break 2 31893 break 2
16594 fi 31894 fi
16595done 31895done
16596 done 31896done
16597IFS=$as_save_IFS 31897IFS=$as_save_IFS
16598 31898
16599 test -z "$ac_cv_path_KRB5CONF" && ac_cv_path_KRB5CONF="$KRB5ROOT/bin/krb5-config" 31899 test -z "$ac_cv_path_KRB5CONF" && ac_cv_path_KRB5CONF="$KRB5ROOT/bin/krb5-config"
@@ -16602,11 +31902,11 @@ esac
16602fi 31902fi
16603KRB5CONF=$ac_cv_path_KRB5CONF 31903KRB5CONF=$ac_cv_path_KRB5CONF
16604if test -n "$KRB5CONF"; then 31904if test -n "$KRB5CONF"; then
16605 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $KRB5CONF" >&5 31905 { echo "$as_me:$LINENO: result: $KRB5CONF" >&5
16606$as_echo "$KRB5CONF" >&6; } 31906echo "${ECHO_T}$KRB5CONF" >&6; }
16607else 31907else
16608 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31908 { echo "$as_me:$LINENO: result: no" >&5
16609$as_echo "no" >&6; } 31909echo "${ECHO_T}no" >&6; }
16610fi 31910fi
16611 31911
16612 31912
@@ -16615,24 +31915,30 @@ fi
16615 K5LIBS="`$KRB5CONF --libs`" 31915 K5LIBS="`$KRB5CONF --libs`"
16616 CPPFLAGS="$CPPFLAGS $K5CFLAGS" 31916 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
16617 31917
16618 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gssapi support" >&5 31918 { echo "$as_me:$LINENO: checking for gssapi support" >&5
16619$as_echo_n "checking for gssapi support... " >&6; } 31919echo $ECHO_N "checking for gssapi support... $ECHO_C" >&6; }
16620 if $KRB5CONF | grep gssapi >/dev/null ; then 31920 if $KRB5CONF | grep gssapi >/dev/null ; then
16621 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 31921 { echo "$as_me:$LINENO: result: yes" >&5
16622$as_echo "yes" >&6; } 31922echo "${ECHO_T}yes" >&6; }
16623 31923
16624$as_echo "#define GSSAPI 1" >>confdefs.h 31924cat >>confdefs.h <<\_ACEOF
31925#define GSSAPI 1
31926_ACEOF
16625 31927
16626 GSSCFLAGS="`$KRB5CONF --cflags gssapi`" 31928 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
16627 GSSLIBS="`$KRB5CONF --libs gssapi`" 31929 GSSLIBS="`$KRB5CONF --libs gssapi`"
16628 CPPFLAGS="$CPPFLAGS $GSSCFLAGS" 31930 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
16629 else 31931 else
16630 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31932 { echo "$as_me:$LINENO: result: no" >&5
16631$as_echo "no" >&6; } 31933echo "${ECHO_T}no" >&6; }
16632 fi 31934 fi
16633 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using Heimdal" >&5 31935 { echo "$as_me:$LINENO: checking whether we are using Heimdal" >&5
16634$as_echo_n "checking whether we are using Heimdal... " >&6; } 31936echo $ECHO_N "checking whether we are using Heimdal... $ECHO_C" >&6; }
16635 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 31937 cat >conftest.$ac_ext <<_ACEOF
31938/* confdefs.h. */
31939_ACEOF
31940cat confdefs.h >>conftest.$ac_ext
31941cat >>conftest.$ac_ext <<_ACEOF
16636/* end confdefs.h. */ 31942/* end confdefs.h. */
16637 #include <krb5.h> 31943 #include <krb5.h>
16638 31944
@@ -16644,24 +31950,50 @@ main ()
16644 return 0; 31950 return 0;
16645} 31951}
16646_ACEOF 31952_ACEOF
16647if ac_fn_c_try_compile "$LINENO"; then : 31953rm -f conftest.$ac_objext
16648 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 31954if { (ac_try="$ac_compile"
16649$as_echo "yes" >&6; } 31955case "(($ac_try" in
31956 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
31957 *) ac_try_echo=$ac_try;;
31958esac
31959eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
31960 (eval "$ac_compile") 2>conftest.er1
31961 ac_status=$?
31962 grep -v '^ *+' conftest.er1 >conftest.err
31963 rm -f conftest.er1
31964 cat conftest.err >&5
31965 echo "$as_me:$LINENO: \$? = $ac_status" >&5
31966 (exit $ac_status); } && {
31967 test -z "$ac_c_werror_flag" ||
31968 test ! -s conftest.err
31969 } && test -s conftest.$ac_objext; then
31970 { echo "$as_me:$LINENO: result: yes" >&5
31971echo "${ECHO_T}yes" >&6; }
16650 31972
16651$as_echo "#define HEIMDAL 1" >>confdefs.h 31973cat >>confdefs.h <<\_ACEOF
31974#define HEIMDAL 1
31975_ACEOF
16652 31976
16653else 31977else
16654 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31978 echo "$as_me: failed program was:" >&5
16655$as_echo "no" >&6; } 31979sed 's/^/| /' conftest.$ac_ext >&5
31980
31981 { echo "$as_me:$LINENO: result: no" >&5
31982echo "${ECHO_T}no" >&6; }
16656 31983
16657fi 31984fi
31985
16658rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 31986rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16659 else 31987 else
16660 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include" 31988 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
16661 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib" 31989 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
16662 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using Heimdal" >&5 31990 { echo "$as_me:$LINENO: checking whether we are using Heimdal" >&5
16663$as_echo_n "checking whether we are using Heimdal... " >&6; } 31991echo $ECHO_N "checking whether we are using Heimdal... $ECHO_C" >&6; }
16664 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 31992 cat >conftest.$ac_ext <<_ACEOF
31993/* confdefs.h. */
31994_ACEOF
31995cat confdefs.h >>conftest.$ac_ext
31996cat >>conftest.$ac_ext <<_ACEOF
16665/* end confdefs.h. */ 31997/* end confdefs.h. */
16666 #include <krb5.h> 31998 #include <krb5.h>
16667 31999
@@ -16673,21 +32005,43 @@ main ()
16673 return 0; 32005 return 0;
16674} 32006}
16675_ACEOF 32007_ACEOF
16676if ac_fn_c_try_compile "$LINENO"; then : 32008rm -f conftest.$ac_objext
16677 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 32009if { (ac_try="$ac_compile"
16678$as_echo "yes" >&6; } 32010case "(($ac_try" in
16679 $as_echo "#define HEIMDAL 1" >>confdefs.h 32011 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32012 *) ac_try_echo=$ac_try;;
32013esac
32014eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32015 (eval "$ac_compile") 2>conftest.er1
32016 ac_status=$?
32017 grep -v '^ *+' conftest.er1 >conftest.err
32018 rm -f conftest.er1
32019 cat conftest.err >&5
32020 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32021 (exit $ac_status); } && {
32022 test -z "$ac_c_werror_flag" ||
32023 test ! -s conftest.err
32024 } && test -s conftest.$ac_objext; then
32025 { echo "$as_me:$LINENO: result: yes" >&5
32026echo "${ECHO_T}yes" >&6; }
32027 cat >>confdefs.h <<\_ACEOF
32028#define HEIMDAL 1
32029_ACEOF
16680 32030
16681 K5LIBS="-lkrb5" 32031 K5LIBS="-lkrb5"
16682 K5LIBS="$K5LIBS -lcom_err -lasn1" 32032 K5LIBS="$K5LIBS -lcom_err -lasn1"
16683 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for net_write in -lroken" >&5 32033 { echo "$as_me:$LINENO: checking for net_write in -lroken" >&5
16684$as_echo_n "checking for net_write in -lroken... " >&6; } 32034echo $ECHO_N "checking for net_write in -lroken... $ECHO_C" >&6; }
16685if ${ac_cv_lib_roken_net_write+:} false; then : 32035if test "${ac_cv_lib_roken_net_write+set}" = set; then
16686 $as_echo_n "(cached) " >&6 32036 echo $ECHO_N "(cached) $ECHO_C" >&6
16687else 32037else
16688 ac_check_lib_save_LIBS=$LIBS 32038 ac_check_lib_save_LIBS=$LIBS
16689LIBS="-lroken $LIBS" 32039LIBS="-lroken $LIBS"
16690cat confdefs.h - <<_ACEOF >conftest.$ac_ext 32040cat >conftest.$ac_ext <<_ACEOF
32041/* confdefs.h. */
32042_ACEOF
32043cat confdefs.h >>conftest.$ac_ext
32044cat >>conftest.$ac_ext <<_ACEOF
16691/* end confdefs.h. */ 32045/* end confdefs.h. */
16692 32046
16693/* Override any GCC internal prototype to avoid an error. 32047/* Override any GCC internal prototype to avoid an error.
@@ -16705,29 +32059,54 @@ return net_write ();
16705 return 0; 32059 return 0;
16706} 32060}
16707_ACEOF 32061_ACEOF
16708if ac_fn_c_try_link "$LINENO"; then : 32062rm -f conftest.$ac_objext conftest$ac_exeext
32063if { (ac_try="$ac_link"
32064case "(($ac_try" in
32065 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32066 *) ac_try_echo=$ac_try;;
32067esac
32068eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32069 (eval "$ac_link") 2>conftest.er1
32070 ac_status=$?
32071 grep -v '^ *+' conftest.er1 >conftest.err
32072 rm -f conftest.er1
32073 cat conftest.err >&5
32074 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32075 (exit $ac_status); } && {
32076 test -z "$ac_c_werror_flag" ||
32077 test ! -s conftest.err
32078 } && test -s conftest$ac_exeext &&
32079 $as_test_x conftest$ac_exeext; then
16709 ac_cv_lib_roken_net_write=yes 32080 ac_cv_lib_roken_net_write=yes
16710else 32081else
16711 ac_cv_lib_roken_net_write=no 32082 echo "$as_me: failed program was:" >&5
32083sed 's/^/| /' conftest.$ac_ext >&5
32084
32085 ac_cv_lib_roken_net_write=no
16712fi 32086fi
16713rm -f core conftest.err conftest.$ac_objext \ 32087
16714 conftest$ac_exeext conftest.$ac_ext 32088rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
32089 conftest$ac_exeext conftest.$ac_ext
16715LIBS=$ac_check_lib_save_LIBS 32090LIBS=$ac_check_lib_save_LIBS
16716fi 32091fi
16717{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_roken_net_write" >&5 32092{ echo "$as_me:$LINENO: result: $ac_cv_lib_roken_net_write" >&5
16718$as_echo "$ac_cv_lib_roken_net_write" >&6; } 32093echo "${ECHO_T}$ac_cv_lib_roken_net_write" >&6; }
16719if test "x$ac_cv_lib_roken_net_write" = xyes; then : 32094if test $ac_cv_lib_roken_net_write = yes; then
16720 K5LIBS="$K5LIBS -lroken" 32095 K5LIBS="$K5LIBS -lroken"
16721fi 32096fi
16722 32097
16723 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for des_cbc_encrypt in -ldes" >&5 32098 { echo "$as_me:$LINENO: checking for des_cbc_encrypt in -ldes" >&5
16724$as_echo_n "checking for des_cbc_encrypt in -ldes... " >&6; } 32099echo $ECHO_N "checking for des_cbc_encrypt in -ldes... $ECHO_C" >&6; }
16725if ${ac_cv_lib_des_des_cbc_encrypt+:} false; then : 32100if test "${ac_cv_lib_des_des_cbc_encrypt+set}" = set; then
16726 $as_echo_n "(cached) " >&6 32101 echo $ECHO_N "(cached) $ECHO_C" >&6
16727else 32102else
16728 ac_check_lib_save_LIBS=$LIBS 32103 ac_check_lib_save_LIBS=$LIBS
16729LIBS="-ldes $LIBS" 32104LIBS="-ldes $LIBS"
16730cat confdefs.h - <<_ACEOF >conftest.$ac_ext 32105cat >conftest.$ac_ext <<_ACEOF
32106/* confdefs.h. */
32107_ACEOF
32108cat confdefs.h >>conftest.$ac_ext
32109cat >>conftest.$ac_ext <<_ACEOF
16731/* end confdefs.h. */ 32110/* end confdefs.h. */
16732 32111
16733/* Override any GCC internal prototype to avoid an error. 32112/* Override any GCC internal prototype to avoid an error.
@@ -16745,37 +32124,66 @@ return des_cbc_encrypt ();
16745 return 0; 32124 return 0;
16746} 32125}
16747_ACEOF 32126_ACEOF
16748if ac_fn_c_try_link "$LINENO"; then : 32127rm -f conftest.$ac_objext conftest$ac_exeext
32128if { (ac_try="$ac_link"
32129case "(($ac_try" in
32130 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32131 *) ac_try_echo=$ac_try;;
32132esac
32133eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32134 (eval "$ac_link") 2>conftest.er1
32135 ac_status=$?
32136 grep -v '^ *+' conftest.er1 >conftest.err
32137 rm -f conftest.er1
32138 cat conftest.err >&5
32139 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32140 (exit $ac_status); } && {
32141 test -z "$ac_c_werror_flag" ||
32142 test ! -s conftest.err
32143 } && test -s conftest$ac_exeext &&
32144 $as_test_x conftest$ac_exeext; then
16749 ac_cv_lib_des_des_cbc_encrypt=yes 32145 ac_cv_lib_des_des_cbc_encrypt=yes
16750else 32146else
16751 ac_cv_lib_des_des_cbc_encrypt=no 32147 echo "$as_me: failed program was:" >&5
32148sed 's/^/| /' conftest.$ac_ext >&5
32149
32150 ac_cv_lib_des_des_cbc_encrypt=no
16752fi 32151fi
16753rm -f core conftest.err conftest.$ac_objext \ 32152
16754 conftest$ac_exeext conftest.$ac_ext 32153rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
32154 conftest$ac_exeext conftest.$ac_ext
16755LIBS=$ac_check_lib_save_LIBS 32155LIBS=$ac_check_lib_save_LIBS
16756fi 32156fi
16757{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_des_des_cbc_encrypt" >&5 32157{ echo "$as_me:$LINENO: result: $ac_cv_lib_des_des_cbc_encrypt" >&5
16758$as_echo "$ac_cv_lib_des_des_cbc_encrypt" >&6; } 32158echo "${ECHO_T}$ac_cv_lib_des_des_cbc_encrypt" >&6; }
16759if test "x$ac_cv_lib_des_des_cbc_encrypt" = xyes; then : 32159if test $ac_cv_lib_des_des_cbc_encrypt = yes; then
16760 K5LIBS="$K5LIBS -ldes" 32160 K5LIBS="$K5LIBS -ldes"
16761fi 32161fi
16762 32162
16763 32163
16764else 32164else
16765 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 32165 echo "$as_me: failed program was:" >&5
16766$as_echo "no" >&6; } 32166sed 's/^/| /' conftest.$ac_ext >&5
32167
32168 { echo "$as_me:$LINENO: result: no" >&5
32169echo "${ECHO_T}no" >&6; }
16767 K5LIBS="-lkrb5 -lk5crypto -lcom_err" 32170 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
16768 32171
16769 32172
16770fi 32173fi
32174
16771rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 32175rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16772 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dn_expand" >&5 32176 { echo "$as_me:$LINENO: checking for library containing dn_expand" >&5
16773$as_echo_n "checking for library containing dn_expand... " >&6; } 32177echo $ECHO_N "checking for library containing dn_expand... $ECHO_C" >&6; }
16774if ${ac_cv_search_dn_expand+:} false; then : 32178if test "${ac_cv_search_dn_expand+set}" = set; then
16775 $as_echo_n "(cached) " >&6 32179 echo $ECHO_N "(cached) $ECHO_C" >&6
16776else 32180else
16777 ac_func_search_save_LIBS=$LIBS 32181 ac_func_search_save_LIBS=$LIBS
16778cat confdefs.h - <<_ACEOF >conftest.$ac_ext 32182cat >conftest.$ac_ext <<_ACEOF
32183/* confdefs.h. */
32184_ACEOF
32185cat confdefs.h >>conftest.$ac_ext
32186cat >>conftest.$ac_ext <<_ACEOF
16779/* end confdefs.h. */ 32187/* end confdefs.h. */
16780 32188
16781/* Override any GCC internal prototype to avoid an error. 32189/* Override any GCC internal prototype to avoid an error.
@@ -16800,40 +32208,67 @@ for ac_lib in '' resolv; do
16800 ac_res=-l$ac_lib 32208 ac_res=-l$ac_lib
16801 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 32209 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
16802 fi 32210 fi
16803 if ac_fn_c_try_link "$LINENO"; then : 32211 rm -f conftest.$ac_objext conftest$ac_exeext
32212if { (ac_try="$ac_link"
32213case "(($ac_try" in
32214 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32215 *) ac_try_echo=$ac_try;;
32216esac
32217eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32218 (eval "$ac_link") 2>conftest.er1
32219 ac_status=$?
32220 grep -v '^ *+' conftest.er1 >conftest.err
32221 rm -f conftest.er1
32222 cat conftest.err >&5
32223 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32224 (exit $ac_status); } && {
32225 test -z "$ac_c_werror_flag" ||
32226 test ! -s conftest.err
32227 } && test -s conftest$ac_exeext &&
32228 $as_test_x conftest$ac_exeext; then
16804 ac_cv_search_dn_expand=$ac_res 32229 ac_cv_search_dn_expand=$ac_res
32230else
32231 echo "$as_me: failed program was:" >&5
32232sed 's/^/| /' conftest.$ac_ext >&5
32233
32234
16805fi 32235fi
16806rm -f core conftest.err conftest.$ac_objext \ 32236
16807 conftest$ac_exeext 32237rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16808 if ${ac_cv_search_dn_expand+:} false; then : 32238 conftest$ac_exeext
32239 if test "${ac_cv_search_dn_expand+set}" = set; then
16809 break 32240 break
16810fi 32241fi
16811done 32242done
16812if ${ac_cv_search_dn_expand+:} false; then : 32243if test "${ac_cv_search_dn_expand+set}" = set; then
16813 32244 :
16814else 32245else
16815 ac_cv_search_dn_expand=no 32246 ac_cv_search_dn_expand=no
16816fi 32247fi
16817rm conftest.$ac_ext 32248rm conftest.$ac_ext
16818LIBS=$ac_func_search_save_LIBS 32249LIBS=$ac_func_search_save_LIBS
16819fi 32250fi
16820{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dn_expand" >&5 32251{ echo "$as_me:$LINENO: result: $ac_cv_search_dn_expand" >&5
16821$as_echo "$ac_cv_search_dn_expand" >&6; } 32252echo "${ECHO_T}$ac_cv_search_dn_expand" >&6; }
16822ac_res=$ac_cv_search_dn_expand 32253ac_res=$ac_cv_search_dn_expand
16823if test "$ac_res" != no; then : 32254if test "$ac_res" != no; then
16824 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 32255 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
16825 32256
16826fi 32257fi
16827 32258
16828 32259
16829 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gss_init_sec_context in -lgssapi_krb5" >&5 32260 { echo "$as_me:$LINENO: checking for gss_init_sec_context in -lgssapi_krb5" >&5
16830$as_echo_n "checking for gss_init_sec_context in -lgssapi_krb5... " >&6; } 32261echo $ECHO_N "checking for gss_init_sec_context in -lgssapi_krb5... $ECHO_C" >&6; }
16831if ${ac_cv_lib_gssapi_krb5_gss_init_sec_context+:} false; then : 32262if test "${ac_cv_lib_gssapi_krb5_gss_init_sec_context+set}" = set; then
16832 $as_echo_n "(cached) " >&6 32263 echo $ECHO_N "(cached) $ECHO_C" >&6
16833else 32264else
16834 ac_check_lib_save_LIBS=$LIBS 32265 ac_check_lib_save_LIBS=$LIBS
16835LIBS="-lgssapi_krb5 $LIBS" 32266LIBS="-lgssapi_krb5 $LIBS"
16836cat confdefs.h - <<_ACEOF >conftest.$ac_ext 32267cat >conftest.$ac_ext <<_ACEOF
32268/* confdefs.h. */
32269_ACEOF
32270cat confdefs.h >>conftest.$ac_ext
32271cat >>conftest.$ac_ext <<_ACEOF
16837/* end confdefs.h. */ 32272/* end confdefs.h. */
16838 32273
16839/* Override any GCC internal prototype to avoid an error. 32274/* Override any GCC internal prototype to avoid an error.
@@ -16851,30 +32286,57 @@ return gss_init_sec_context ();
16851 return 0; 32286 return 0;
16852} 32287}
16853_ACEOF 32288_ACEOF
16854if ac_fn_c_try_link "$LINENO"; then : 32289rm -f conftest.$ac_objext conftest$ac_exeext
32290if { (ac_try="$ac_link"
32291case "(($ac_try" in
32292 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32293 *) ac_try_echo=$ac_try;;
32294esac
32295eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32296 (eval "$ac_link") 2>conftest.er1
32297 ac_status=$?
32298 grep -v '^ *+' conftest.er1 >conftest.err
32299 rm -f conftest.er1
32300 cat conftest.err >&5
32301 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32302 (exit $ac_status); } && {
32303 test -z "$ac_c_werror_flag" ||
32304 test ! -s conftest.err
32305 } && test -s conftest$ac_exeext &&
32306 $as_test_x conftest$ac_exeext; then
16855 ac_cv_lib_gssapi_krb5_gss_init_sec_context=yes 32307 ac_cv_lib_gssapi_krb5_gss_init_sec_context=yes
16856else 32308else
16857 ac_cv_lib_gssapi_krb5_gss_init_sec_context=no 32309 echo "$as_me: failed program was:" >&5
32310sed 's/^/| /' conftest.$ac_ext >&5
32311
32312 ac_cv_lib_gssapi_krb5_gss_init_sec_context=no
16858fi 32313fi
16859rm -f core conftest.err conftest.$ac_objext \ 32314
16860 conftest$ac_exeext conftest.$ac_ext 32315rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
32316 conftest$ac_exeext conftest.$ac_ext
16861LIBS=$ac_check_lib_save_LIBS 32317LIBS=$ac_check_lib_save_LIBS
16862fi 32318fi
16863{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gssapi_krb5_gss_init_sec_context" >&5 32319{ echo "$as_me:$LINENO: result: $ac_cv_lib_gssapi_krb5_gss_init_sec_context" >&5
16864$as_echo "$ac_cv_lib_gssapi_krb5_gss_init_sec_context" >&6; } 32320echo "${ECHO_T}$ac_cv_lib_gssapi_krb5_gss_init_sec_context" >&6; }
16865if test "x$ac_cv_lib_gssapi_krb5_gss_init_sec_context" = xyes; then : 32321if test $ac_cv_lib_gssapi_krb5_gss_init_sec_context = yes; then
16866 $as_echo "#define GSSAPI 1" >>confdefs.h 32322 cat >>confdefs.h <<\_ACEOF
32323#define GSSAPI 1
32324_ACEOF
16867 32325
16868 GSSLIBS="-lgssapi_krb5" 32326 GSSLIBS="-lgssapi_krb5"
16869else 32327else
16870 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gss_init_sec_context in -lgssapi" >&5 32328 { echo "$as_me:$LINENO: checking for gss_init_sec_context in -lgssapi" >&5
16871$as_echo_n "checking for gss_init_sec_context in -lgssapi... " >&6; } 32329echo $ECHO_N "checking for gss_init_sec_context in -lgssapi... $ECHO_C" >&6; }
16872if ${ac_cv_lib_gssapi_gss_init_sec_context+:} false; then : 32330if test "${ac_cv_lib_gssapi_gss_init_sec_context+set}" = set; then
16873 $as_echo_n "(cached) " >&6 32331 echo $ECHO_N "(cached) $ECHO_C" >&6
16874else 32332else
16875 ac_check_lib_save_LIBS=$LIBS 32333 ac_check_lib_save_LIBS=$LIBS
16876LIBS="-lgssapi $LIBS" 32334LIBS="-lgssapi $LIBS"
16877cat confdefs.h - <<_ACEOF >conftest.$ac_ext 32335cat >conftest.$ac_ext <<_ACEOF
32336/* confdefs.h. */
32337_ACEOF
32338cat confdefs.h >>conftest.$ac_ext
32339cat >>conftest.$ac_ext <<_ACEOF
16878/* end confdefs.h. */ 32340/* end confdefs.h. */
16879 32341
16880/* Override any GCC internal prototype to avoid an error. 32342/* Override any GCC internal prototype to avoid an error.
@@ -16892,30 +32354,57 @@ return gss_init_sec_context ();
16892 return 0; 32354 return 0;
16893} 32355}
16894_ACEOF 32356_ACEOF
16895if ac_fn_c_try_link "$LINENO"; then : 32357rm -f conftest.$ac_objext conftest$ac_exeext
32358if { (ac_try="$ac_link"
32359case "(($ac_try" in
32360 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32361 *) ac_try_echo=$ac_try;;
32362esac
32363eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32364 (eval "$ac_link") 2>conftest.er1
32365 ac_status=$?
32366 grep -v '^ *+' conftest.er1 >conftest.err
32367 rm -f conftest.er1
32368 cat conftest.err >&5
32369 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32370 (exit $ac_status); } && {
32371 test -z "$ac_c_werror_flag" ||
32372 test ! -s conftest.err
32373 } && test -s conftest$ac_exeext &&
32374 $as_test_x conftest$ac_exeext; then
16896 ac_cv_lib_gssapi_gss_init_sec_context=yes 32375 ac_cv_lib_gssapi_gss_init_sec_context=yes
16897else 32376else
16898 ac_cv_lib_gssapi_gss_init_sec_context=no 32377 echo "$as_me: failed program was:" >&5
32378sed 's/^/| /' conftest.$ac_ext >&5
32379
32380 ac_cv_lib_gssapi_gss_init_sec_context=no
16899fi 32381fi
16900rm -f core conftest.err conftest.$ac_objext \ 32382
16901 conftest$ac_exeext conftest.$ac_ext 32383rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
32384 conftest$ac_exeext conftest.$ac_ext
16902LIBS=$ac_check_lib_save_LIBS 32385LIBS=$ac_check_lib_save_LIBS
16903fi 32386fi
16904{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gssapi_gss_init_sec_context" >&5 32387{ echo "$as_me:$LINENO: result: $ac_cv_lib_gssapi_gss_init_sec_context" >&5
16905$as_echo "$ac_cv_lib_gssapi_gss_init_sec_context" >&6; } 32388echo "${ECHO_T}$ac_cv_lib_gssapi_gss_init_sec_context" >&6; }
16906if test "x$ac_cv_lib_gssapi_gss_init_sec_context" = xyes; then : 32389if test $ac_cv_lib_gssapi_gss_init_sec_context = yes; then
16907 $as_echo "#define GSSAPI 1" >>confdefs.h 32390 cat >>confdefs.h <<\_ACEOF
32391#define GSSAPI 1
32392_ACEOF
16908 32393
16909 GSSLIBS="-lgssapi" 32394 GSSLIBS="-lgssapi"
16910else 32395else
16911 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gss_init_sec_context in -lgss" >&5 32396 { echo "$as_me:$LINENO: checking for gss_init_sec_context in -lgss" >&5
16912$as_echo_n "checking for gss_init_sec_context in -lgss... " >&6; } 32397echo $ECHO_N "checking for gss_init_sec_context in -lgss... $ECHO_C" >&6; }
16913if ${ac_cv_lib_gss_gss_init_sec_context+:} false; then : 32398if test "${ac_cv_lib_gss_gss_init_sec_context+set}" = set; then
16914 $as_echo_n "(cached) " >&6 32399 echo $ECHO_N "(cached) $ECHO_C" >&6
16915else 32400else
16916 ac_check_lib_save_LIBS=$LIBS 32401 ac_check_lib_save_LIBS=$LIBS
16917LIBS="-lgss $LIBS" 32402LIBS="-lgss $LIBS"
16918cat confdefs.h - <<_ACEOF >conftest.$ac_ext 32403cat >conftest.$ac_ext <<_ACEOF
32404/* confdefs.h. */
32405_ACEOF
32406cat confdefs.h >>conftest.$ac_ext
32407cat >>conftest.$ac_ext <<_ACEOF
16919/* end confdefs.h. */ 32408/* end confdefs.h. */
16920 32409
16921/* Override any GCC internal prototype to avoid an error. 32410/* Override any GCC internal prototype to avoid an error.
@@ -16933,50 +32422,335 @@ return gss_init_sec_context ();
16933 return 0; 32422 return 0;
16934} 32423}
16935_ACEOF 32424_ACEOF
16936if ac_fn_c_try_link "$LINENO"; then : 32425rm -f conftest.$ac_objext conftest$ac_exeext
32426if { (ac_try="$ac_link"
32427case "(($ac_try" in
32428 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32429 *) ac_try_echo=$ac_try;;
32430esac
32431eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32432 (eval "$ac_link") 2>conftest.er1
32433 ac_status=$?
32434 grep -v '^ *+' conftest.er1 >conftest.err
32435 rm -f conftest.er1
32436 cat conftest.err >&5
32437 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32438 (exit $ac_status); } && {
32439 test -z "$ac_c_werror_flag" ||
32440 test ! -s conftest.err
32441 } && test -s conftest$ac_exeext &&
32442 $as_test_x conftest$ac_exeext; then
16937 ac_cv_lib_gss_gss_init_sec_context=yes 32443 ac_cv_lib_gss_gss_init_sec_context=yes
16938else 32444else
16939 ac_cv_lib_gss_gss_init_sec_context=no 32445 echo "$as_me: failed program was:" >&5
32446sed 's/^/| /' conftest.$ac_ext >&5
32447
32448 ac_cv_lib_gss_gss_init_sec_context=no
16940fi 32449fi
16941rm -f core conftest.err conftest.$ac_objext \ 32450
16942 conftest$ac_exeext conftest.$ac_ext 32451rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
32452 conftest$ac_exeext conftest.$ac_ext
16943LIBS=$ac_check_lib_save_LIBS 32453LIBS=$ac_check_lib_save_LIBS
16944fi 32454fi
16945{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gss_gss_init_sec_context" >&5 32455{ echo "$as_me:$LINENO: result: $ac_cv_lib_gss_gss_init_sec_context" >&5
16946$as_echo "$ac_cv_lib_gss_gss_init_sec_context" >&6; } 32456echo "${ECHO_T}$ac_cv_lib_gss_gss_init_sec_context" >&6; }
16947if test "x$ac_cv_lib_gss_gss_init_sec_context" = xyes; then : 32457if test $ac_cv_lib_gss_gss_init_sec_context = yes; then
16948 $as_echo "#define GSSAPI 1" >>confdefs.h 32458 cat >>confdefs.h <<\_ACEOF
32459#define GSSAPI 1
32460_ACEOF
16949 32461
16950 GSSLIBS="-lgss" 32462 GSSLIBS="-lgss"
16951else 32463else
16952 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find any suitable gss-api library - build may fail" >&5 32464 { echo "$as_me:$LINENO: WARNING: Cannot find any suitable gss-api library - build may fail" >&5
16953$as_echo "$as_me: WARNING: Cannot find any suitable gss-api library - build may fail" >&2;} 32465echo "$as_me: WARNING: Cannot find any suitable gss-api library - build may fail" >&2;}
32466fi
32467
32468
16954fi 32469fi
16955 32470
16956 32471
16957fi 32472fi
16958 32473
16959 32474
32475 if test "${ac_cv_header_gssapi_h+set}" = set; then
32476 { echo "$as_me:$LINENO: checking for gssapi.h" >&5
32477echo $ECHO_N "checking for gssapi.h... $ECHO_C" >&6; }
32478if test "${ac_cv_header_gssapi_h+set}" = set; then
32479 echo $ECHO_N "(cached) $ECHO_C" >&6
32480fi
32481{ echo "$as_me:$LINENO: result: $ac_cv_header_gssapi_h" >&5
32482echo "${ECHO_T}$ac_cv_header_gssapi_h" >&6; }
32483else
32484 # Is the header compilable?
32485{ echo "$as_me:$LINENO: checking gssapi.h usability" >&5
32486echo $ECHO_N "checking gssapi.h usability... $ECHO_C" >&6; }
32487cat >conftest.$ac_ext <<_ACEOF
32488/* confdefs.h. */
32489_ACEOF
32490cat confdefs.h >>conftest.$ac_ext
32491cat >>conftest.$ac_ext <<_ACEOF
32492/* end confdefs.h. */
32493$ac_includes_default
32494#include <gssapi.h>
32495_ACEOF
32496rm -f conftest.$ac_objext
32497if { (ac_try="$ac_compile"
32498case "(($ac_try" in
32499 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32500 *) ac_try_echo=$ac_try;;
32501esac
32502eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32503 (eval "$ac_compile") 2>conftest.er1
32504 ac_status=$?
32505 grep -v '^ *+' conftest.er1 >conftest.err
32506 rm -f conftest.er1
32507 cat conftest.err >&5
32508 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32509 (exit $ac_status); } && {
32510 test -z "$ac_c_werror_flag" ||
32511 test ! -s conftest.err
32512 } && test -s conftest.$ac_objext; then
32513 ac_header_compiler=yes
32514else
32515 echo "$as_me: failed program was:" >&5
32516sed 's/^/| /' conftest.$ac_ext >&5
32517
32518 ac_header_compiler=no
32519fi
32520
32521rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
32522{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
32523echo "${ECHO_T}$ac_header_compiler" >&6; }
32524
32525# Is the header present?
32526{ echo "$as_me:$LINENO: checking gssapi.h presence" >&5
32527echo $ECHO_N "checking gssapi.h presence... $ECHO_C" >&6; }
32528cat >conftest.$ac_ext <<_ACEOF
32529/* confdefs.h. */
32530_ACEOF
32531cat confdefs.h >>conftest.$ac_ext
32532cat >>conftest.$ac_ext <<_ACEOF
32533/* end confdefs.h. */
32534#include <gssapi.h>
32535_ACEOF
32536if { (ac_try="$ac_cpp conftest.$ac_ext"
32537case "(($ac_try" in
32538 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32539 *) ac_try_echo=$ac_try;;
32540esac
32541eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32542 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
32543 ac_status=$?
32544 grep -v '^ *+' conftest.er1 >conftest.err
32545 rm -f conftest.er1
32546 cat conftest.err >&5
32547 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32548 (exit $ac_status); } >/dev/null && {
32549 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
32550 test ! -s conftest.err
32551 }; then
32552 ac_header_preproc=yes
32553else
32554 echo "$as_me: failed program was:" >&5
32555sed 's/^/| /' conftest.$ac_ext >&5
32556
32557 ac_header_preproc=no
16960fi 32558fi
16961 32559
32560rm -f conftest.err conftest.$ac_ext
32561{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
32562echo "${ECHO_T}$ac_header_preproc" >&6; }
16962 32563
16963 ac_fn_c_check_header_mongrel "$LINENO" "gssapi.h" "ac_cv_header_gssapi_h" "$ac_includes_default" 32564# So? What about this header?
16964if test "x$ac_cv_header_gssapi_h" = xyes; then : 32565case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
32566 yes:no: )
32567 { echo "$as_me:$LINENO: WARNING: gssapi.h: accepted by the compiler, rejected by the preprocessor!" >&5
32568echo "$as_me: WARNING: gssapi.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
32569 { echo "$as_me:$LINENO: WARNING: gssapi.h: proceeding with the compiler's result" >&5
32570echo "$as_me: WARNING: gssapi.h: proceeding with the compiler's result" >&2;}
32571 ac_header_preproc=yes
32572 ;;
32573 no:yes:* )
32574 { echo "$as_me:$LINENO: WARNING: gssapi.h: present but cannot be compiled" >&5
32575echo "$as_me: WARNING: gssapi.h: present but cannot be compiled" >&2;}
32576 { echo "$as_me:$LINENO: WARNING: gssapi.h: check for missing prerequisite headers?" >&5
32577echo "$as_me: WARNING: gssapi.h: check for missing prerequisite headers?" >&2;}
32578 { echo "$as_me:$LINENO: WARNING: gssapi.h: see the Autoconf documentation" >&5
32579echo "$as_me: WARNING: gssapi.h: see the Autoconf documentation" >&2;}
32580 { echo "$as_me:$LINENO: WARNING: gssapi.h: section \"Present But Cannot Be Compiled\"" >&5
32581echo "$as_me: WARNING: gssapi.h: section \"Present But Cannot Be Compiled\"" >&2;}
32582 { echo "$as_me:$LINENO: WARNING: gssapi.h: proceeding with the preprocessor's result" >&5
32583echo "$as_me: WARNING: gssapi.h: proceeding with the preprocessor's result" >&2;}
32584 { echo "$as_me:$LINENO: WARNING: gssapi.h: in the future, the compiler will take precedence" >&5
32585echo "$as_me: WARNING: gssapi.h: in the future, the compiler will take precedence" >&2;}
32586 ( cat <<\_ASBOX
32587## ------------------------------------------- ##
32588## Report this to openssh-unix-dev@mindrot.org ##
32589## ------------------------------------------- ##
32590_ASBOX
32591 ) | sed "s/^/$as_me: WARNING: /" >&2
32592 ;;
32593esac
32594{ echo "$as_me:$LINENO: checking for gssapi.h" >&5
32595echo $ECHO_N "checking for gssapi.h... $ECHO_C" >&6; }
32596if test "${ac_cv_header_gssapi_h+set}" = set; then
32597 echo $ECHO_N "(cached) $ECHO_C" >&6
32598else
32599 ac_cv_header_gssapi_h=$ac_header_preproc
32600fi
32601{ echo "$as_me:$LINENO: result: $ac_cv_header_gssapi_h" >&5
32602echo "${ECHO_T}$ac_cv_header_gssapi_h" >&6; }
16965 32603
32604fi
32605if test $ac_cv_header_gssapi_h = yes; then
32606 :
16966else 32607else
16967 unset ac_cv_header_gssapi_h 32608 unset ac_cv_header_gssapi_h
16968 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" 32609 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
16969 for ac_header in gssapi.h 32610
16970do : 32611for ac_header in gssapi.h
16971 ac_fn_c_check_header_mongrel "$LINENO" "gssapi.h" "ac_cv_header_gssapi_h" "$ac_includes_default" 32612do
16972if test "x$ac_cv_header_gssapi_h" = xyes; then : 32613as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
32614if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
32615 { echo "$as_me:$LINENO: checking for $ac_header" >&5
32616echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
32617if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
32618 echo $ECHO_N "(cached) $ECHO_C" >&6
32619fi
32620ac_res=`eval echo '${'$as_ac_Header'}'`
32621 { echo "$as_me:$LINENO: result: $ac_res" >&5
32622echo "${ECHO_T}$ac_res" >&6; }
32623else
32624 # Is the header compilable?
32625{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
32626echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
32627cat >conftest.$ac_ext <<_ACEOF
32628/* confdefs.h. */
32629_ACEOF
32630cat confdefs.h >>conftest.$ac_ext
32631cat >>conftest.$ac_ext <<_ACEOF
32632/* end confdefs.h. */
32633$ac_includes_default
32634#include <$ac_header>
32635_ACEOF
32636rm -f conftest.$ac_objext
32637if { (ac_try="$ac_compile"
32638case "(($ac_try" in
32639 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32640 *) ac_try_echo=$ac_try;;
32641esac
32642eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32643 (eval "$ac_compile") 2>conftest.er1
32644 ac_status=$?
32645 grep -v '^ *+' conftest.er1 >conftest.err
32646 rm -f conftest.er1
32647 cat conftest.err >&5
32648 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32649 (exit $ac_status); } && {
32650 test -z "$ac_c_werror_flag" ||
32651 test ! -s conftest.err
32652 } && test -s conftest.$ac_objext; then
32653 ac_header_compiler=yes
32654else
32655 echo "$as_me: failed program was:" >&5
32656sed 's/^/| /' conftest.$ac_ext >&5
32657
32658 ac_header_compiler=no
32659fi
32660
32661rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
32662{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
32663echo "${ECHO_T}$ac_header_compiler" >&6; }
32664
32665# Is the header present?
32666{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
32667echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
32668cat >conftest.$ac_ext <<_ACEOF
32669/* confdefs.h. */
32670_ACEOF
32671cat confdefs.h >>conftest.$ac_ext
32672cat >>conftest.$ac_ext <<_ACEOF
32673/* end confdefs.h. */
32674#include <$ac_header>
32675_ACEOF
32676if { (ac_try="$ac_cpp conftest.$ac_ext"
32677case "(($ac_try" in
32678 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32679 *) ac_try_echo=$ac_try;;
32680esac
32681eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32682 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
32683 ac_status=$?
32684 grep -v '^ *+' conftest.er1 >conftest.err
32685 rm -f conftest.er1
32686 cat conftest.err >&5
32687 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32688 (exit $ac_status); } >/dev/null && {
32689 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
32690 test ! -s conftest.err
32691 }; then
32692 ac_header_preproc=yes
32693else
32694 echo "$as_me: failed program was:" >&5
32695sed 's/^/| /' conftest.$ac_ext >&5
32696
32697 ac_header_preproc=no
32698fi
32699
32700rm -f conftest.err conftest.$ac_ext
32701{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
32702echo "${ECHO_T}$ac_header_preproc" >&6; }
32703
32704# So? What about this header?
32705case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
32706 yes:no: )
32707 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
32708echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
32709 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
32710echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
32711 ac_header_preproc=yes
32712 ;;
32713 no:yes:* )
32714 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
32715echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
32716 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
32717echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
32718 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
32719echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
32720 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
32721echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
32722 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
32723echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
32724 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
32725echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
32726 ( cat <<\_ASBOX
32727## ------------------------------------------- ##
32728## Report this to openssh-unix-dev@mindrot.org ##
32729## ------------------------------------------- ##
32730_ASBOX
32731 ) | sed "s/^/$as_me: WARNING: /" >&2
32732 ;;
32733esac
32734{ echo "$as_me:$LINENO: checking for $ac_header" >&5
32735echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
32736if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
32737 echo $ECHO_N "(cached) $ECHO_C" >&6
32738else
32739 eval "$as_ac_Header=\$ac_header_preproc"
32740fi
32741ac_res=`eval echo '${'$as_ac_Header'}'`
32742 { echo "$as_me:$LINENO: result: $ac_res" >&5
32743echo "${ECHO_T}$ac_res" >&6; }
32744
32745fi
32746if test `eval echo '${'$as_ac_Header'}'` = yes; then
16973 cat >>confdefs.h <<_ACEOF 32747 cat >>confdefs.h <<_ACEOF
16974#define HAVE_GSSAPI_H 1 32748#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
16975_ACEOF 32749_ACEOF
16976 32750
16977else 32751else
16978 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find any suitable gss-api header - build may fail" >&5 32752 { echo "$as_me:$LINENO: WARNING: Cannot find any suitable gss-api header - build may fail" >&5
16979$as_echo "$as_me: WARNING: Cannot find any suitable gss-api header - build may fail" >&2;} 32753echo "$as_me: WARNING: Cannot find any suitable gss-api header - build may fail" >&2;}
16980 32754
16981fi 32755fi
16982 32756
@@ -16990,9 +32764,138 @@ fi
16990 32764
16991 oldCPP="$CPPFLAGS" 32765 oldCPP="$CPPFLAGS"
16992 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" 32766 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
16993 ac_fn_c_check_header_mongrel "$LINENO" "gssapi_krb5.h" "ac_cv_header_gssapi_krb5_h" "$ac_includes_default" 32767 if test "${ac_cv_header_gssapi_krb5_h+set}" = set; then
16994if test "x$ac_cv_header_gssapi_krb5_h" = xyes; then : 32768 { echo "$as_me:$LINENO: checking for gssapi_krb5.h" >&5
32769echo $ECHO_N "checking for gssapi_krb5.h... $ECHO_C" >&6; }
32770if test "${ac_cv_header_gssapi_krb5_h+set}" = set; then
32771 echo $ECHO_N "(cached) $ECHO_C" >&6
32772fi
32773{ echo "$as_me:$LINENO: result: $ac_cv_header_gssapi_krb5_h" >&5
32774echo "${ECHO_T}$ac_cv_header_gssapi_krb5_h" >&6; }
32775else
32776 # Is the header compilable?
32777{ echo "$as_me:$LINENO: checking gssapi_krb5.h usability" >&5
32778echo $ECHO_N "checking gssapi_krb5.h usability... $ECHO_C" >&6; }
32779cat >conftest.$ac_ext <<_ACEOF
32780/* confdefs.h. */
32781_ACEOF
32782cat confdefs.h >>conftest.$ac_ext
32783cat >>conftest.$ac_ext <<_ACEOF
32784/* end confdefs.h. */
32785$ac_includes_default
32786#include <gssapi_krb5.h>
32787_ACEOF
32788rm -f conftest.$ac_objext
32789if { (ac_try="$ac_compile"
32790case "(($ac_try" in
32791 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32792 *) ac_try_echo=$ac_try;;
32793esac
32794eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32795 (eval "$ac_compile") 2>conftest.er1
32796 ac_status=$?
32797 grep -v '^ *+' conftest.er1 >conftest.err
32798 rm -f conftest.er1
32799 cat conftest.err >&5
32800 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32801 (exit $ac_status); } && {
32802 test -z "$ac_c_werror_flag" ||
32803 test ! -s conftest.err
32804 } && test -s conftest.$ac_objext; then
32805 ac_header_compiler=yes
32806else
32807 echo "$as_me: failed program was:" >&5
32808sed 's/^/| /' conftest.$ac_ext >&5
32809
32810 ac_header_compiler=no
32811fi
32812
32813rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
32814{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
32815echo "${ECHO_T}$ac_header_compiler" >&6; }
32816
32817# Is the header present?
32818{ echo "$as_me:$LINENO: checking gssapi_krb5.h presence" >&5
32819echo $ECHO_N "checking gssapi_krb5.h presence... $ECHO_C" >&6; }
32820cat >conftest.$ac_ext <<_ACEOF
32821/* confdefs.h. */
32822_ACEOF
32823cat confdefs.h >>conftest.$ac_ext
32824cat >>conftest.$ac_ext <<_ACEOF
32825/* end confdefs.h. */
32826#include <gssapi_krb5.h>
32827_ACEOF
32828if { (ac_try="$ac_cpp conftest.$ac_ext"
32829case "(($ac_try" in
32830 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32831 *) ac_try_echo=$ac_try;;
32832esac
32833eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32834 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
32835 ac_status=$?
32836 grep -v '^ *+' conftest.er1 >conftest.err
32837 rm -f conftest.er1
32838 cat conftest.err >&5
32839 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32840 (exit $ac_status); } >/dev/null && {
32841 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
32842 test ! -s conftest.err
32843 }; then
32844 ac_header_preproc=yes
32845else
32846 echo "$as_me: failed program was:" >&5
32847sed 's/^/| /' conftest.$ac_ext >&5
32848
32849 ac_header_preproc=no
32850fi
32851
32852rm -f conftest.err conftest.$ac_ext
32853{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
32854echo "${ECHO_T}$ac_header_preproc" >&6; }
32855
32856# So? What about this header?
32857case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
32858 yes:no: )
32859 { echo "$as_me:$LINENO: WARNING: gssapi_krb5.h: accepted by the compiler, rejected by the preprocessor!" >&5
32860echo "$as_me: WARNING: gssapi_krb5.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
32861 { echo "$as_me:$LINENO: WARNING: gssapi_krb5.h: proceeding with the compiler's result" >&5
32862echo "$as_me: WARNING: gssapi_krb5.h: proceeding with the compiler's result" >&2;}
32863 ac_header_preproc=yes
32864 ;;
32865 no:yes:* )
32866 { echo "$as_me:$LINENO: WARNING: gssapi_krb5.h: present but cannot be compiled" >&5
32867echo "$as_me: WARNING: gssapi_krb5.h: present but cannot be compiled" >&2;}
32868 { echo "$as_me:$LINENO: WARNING: gssapi_krb5.h: check for missing prerequisite headers?" >&5
32869echo "$as_me: WARNING: gssapi_krb5.h: check for missing prerequisite headers?" >&2;}
32870 { echo "$as_me:$LINENO: WARNING: gssapi_krb5.h: see the Autoconf documentation" >&5
32871echo "$as_me: WARNING: gssapi_krb5.h: see the Autoconf documentation" >&2;}
32872 { echo "$as_me:$LINENO: WARNING: gssapi_krb5.h: section \"Present But Cannot Be Compiled\"" >&5
32873echo "$as_me: WARNING: gssapi_krb5.h: section \"Present But Cannot Be Compiled\"" >&2;}
32874 { echo "$as_me:$LINENO: WARNING: gssapi_krb5.h: proceeding with the preprocessor's result" >&5
32875echo "$as_me: WARNING: gssapi_krb5.h: proceeding with the preprocessor's result" >&2;}
32876 { echo "$as_me:$LINENO: WARNING: gssapi_krb5.h: in the future, the compiler will take precedence" >&5
32877echo "$as_me: WARNING: gssapi_krb5.h: in the future, the compiler will take precedence" >&2;}
32878 ( cat <<\_ASBOX
32879## ------------------------------------------- ##
32880## Report this to openssh-unix-dev@mindrot.org ##
32881## ------------------------------------------- ##
32882_ASBOX
32883 ) | sed "s/^/$as_me: WARNING: /" >&2
32884 ;;
32885esac
32886{ echo "$as_me:$LINENO: checking for gssapi_krb5.h" >&5
32887echo $ECHO_N "checking for gssapi_krb5.h... $ECHO_C" >&6; }
32888if test "${ac_cv_header_gssapi_krb5_h+set}" = set; then
32889 echo $ECHO_N "(cached) $ECHO_C" >&6
32890else
32891 ac_cv_header_gssapi_krb5_h=$ac_header_preproc
32892fi
32893{ echo "$as_me:$LINENO: result: $ac_cv_header_gssapi_krb5_h" >&5
32894echo "${ECHO_T}$ac_cv_header_gssapi_krb5_h" >&6; }
16995 32895
32896fi
32897if test $ac_cv_header_gssapi_krb5_h = yes; then
32898 :
16996else 32899else
16997 CPPFLAGS="$oldCPP" 32900 CPPFLAGS="$oldCPP"
16998fi 32901fi
@@ -17007,39 +32910,438 @@ fi
17007 blibpath="$blibpath:${KRB5ROOT}/lib" 32910 blibpath="$blibpath:${KRB5ROOT}/lib"
17008 fi 32911 fi
17009 32912
17010 for ac_header in gssapi.h gssapi/gssapi.h 32913
17011do : 32914
17012 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 32915for ac_header in gssapi.h gssapi/gssapi.h
17013ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" 32916do
17014if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : 32917as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
32918if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
32919 { echo "$as_me:$LINENO: checking for $ac_header" >&5
32920echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
32921if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
32922 echo $ECHO_N "(cached) $ECHO_C" >&6
32923fi
32924ac_res=`eval echo '${'$as_ac_Header'}'`
32925 { echo "$as_me:$LINENO: result: $ac_res" >&5
32926echo "${ECHO_T}$ac_res" >&6; }
32927else
32928 # Is the header compilable?
32929{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
32930echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
32931cat >conftest.$ac_ext <<_ACEOF
32932/* confdefs.h. */
32933_ACEOF
32934cat confdefs.h >>conftest.$ac_ext
32935cat >>conftest.$ac_ext <<_ACEOF
32936/* end confdefs.h. */
32937$ac_includes_default
32938#include <$ac_header>
32939_ACEOF
32940rm -f conftest.$ac_objext
32941if { (ac_try="$ac_compile"
32942case "(($ac_try" in
32943 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32944 *) ac_try_echo=$ac_try;;
32945esac
32946eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32947 (eval "$ac_compile") 2>conftest.er1
32948 ac_status=$?
32949 grep -v '^ *+' conftest.er1 >conftest.err
32950 rm -f conftest.er1
32951 cat conftest.err >&5
32952 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32953 (exit $ac_status); } && {
32954 test -z "$ac_c_werror_flag" ||
32955 test ! -s conftest.err
32956 } && test -s conftest.$ac_objext; then
32957 ac_header_compiler=yes
32958else
32959 echo "$as_me: failed program was:" >&5
32960sed 's/^/| /' conftest.$ac_ext >&5
32961
32962 ac_header_compiler=no
32963fi
32964
32965rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
32966{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
32967echo "${ECHO_T}$ac_header_compiler" >&6; }
32968
32969# Is the header present?
32970{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
32971echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
32972cat >conftest.$ac_ext <<_ACEOF
32973/* confdefs.h. */
32974_ACEOF
32975cat confdefs.h >>conftest.$ac_ext
32976cat >>conftest.$ac_ext <<_ACEOF
32977/* end confdefs.h. */
32978#include <$ac_header>
32979_ACEOF
32980if { (ac_try="$ac_cpp conftest.$ac_ext"
32981case "(($ac_try" in
32982 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
32983 *) ac_try_echo=$ac_try;;
32984esac
32985eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
32986 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
32987 ac_status=$?
32988 grep -v '^ *+' conftest.er1 >conftest.err
32989 rm -f conftest.er1
32990 cat conftest.err >&5
32991 echo "$as_me:$LINENO: \$? = $ac_status" >&5
32992 (exit $ac_status); } >/dev/null && {
32993 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
32994 test ! -s conftest.err
32995 }; then
32996 ac_header_preproc=yes
32997else
32998 echo "$as_me: failed program was:" >&5
32999sed 's/^/| /' conftest.$ac_ext >&5
33000
33001 ac_header_preproc=no
33002fi
33003
33004rm -f conftest.err conftest.$ac_ext
33005{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
33006echo "${ECHO_T}$ac_header_preproc" >&6; }
33007
33008# So? What about this header?
33009case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
33010 yes:no: )
33011 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
33012echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
33013 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
33014echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
33015 ac_header_preproc=yes
33016 ;;
33017 no:yes:* )
33018 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
33019echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
33020 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
33021echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
33022 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
33023echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
33024 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
33025echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
33026 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
33027echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
33028 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
33029echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
33030 ( cat <<\_ASBOX
33031## ------------------------------------------- ##
33032## Report this to openssh-unix-dev@mindrot.org ##
33033## ------------------------------------------- ##
33034_ASBOX
33035 ) | sed "s/^/$as_me: WARNING: /" >&2
33036 ;;
33037esac
33038{ echo "$as_me:$LINENO: checking for $ac_header" >&5
33039echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
33040if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
33041 echo $ECHO_N "(cached) $ECHO_C" >&6
33042else
33043 eval "$as_ac_Header=\$ac_header_preproc"
33044fi
33045ac_res=`eval echo '${'$as_ac_Header'}'`
33046 { echo "$as_me:$LINENO: result: $ac_res" >&5
33047echo "${ECHO_T}$ac_res" >&6; }
33048
33049fi
33050if test `eval echo '${'$as_ac_Header'}'` = yes; then
17015 cat >>confdefs.h <<_ACEOF 33051 cat >>confdefs.h <<_ACEOF
17016#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 33052#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
17017_ACEOF 33053_ACEOF
17018 33054
17019fi 33055fi
17020 33056
17021done 33057done
17022 33058
17023 for ac_header in gssapi_krb5.h gssapi/gssapi_krb5.h 33059
17024do : 33060
17025 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 33061for ac_header in gssapi_krb5.h gssapi/gssapi_krb5.h
17026ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" 33062do
17027if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : 33063as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
33064if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
33065 { echo "$as_me:$LINENO: checking for $ac_header" >&5
33066echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
33067if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
33068 echo $ECHO_N "(cached) $ECHO_C" >&6
33069fi
33070ac_res=`eval echo '${'$as_ac_Header'}'`
33071 { echo "$as_me:$LINENO: result: $ac_res" >&5
33072echo "${ECHO_T}$ac_res" >&6; }
33073else
33074 # Is the header compilable?
33075{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
33076echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
33077cat >conftest.$ac_ext <<_ACEOF
33078/* confdefs.h. */
33079_ACEOF
33080cat confdefs.h >>conftest.$ac_ext
33081cat >>conftest.$ac_ext <<_ACEOF
33082/* end confdefs.h. */
33083$ac_includes_default
33084#include <$ac_header>
33085_ACEOF
33086rm -f conftest.$ac_objext
33087if { (ac_try="$ac_compile"
33088case "(($ac_try" in
33089 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33090 *) ac_try_echo=$ac_try;;
33091esac
33092eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33093 (eval "$ac_compile") 2>conftest.er1
33094 ac_status=$?
33095 grep -v '^ *+' conftest.er1 >conftest.err
33096 rm -f conftest.er1
33097 cat conftest.err >&5
33098 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33099 (exit $ac_status); } && {
33100 test -z "$ac_c_werror_flag" ||
33101 test ! -s conftest.err
33102 } && test -s conftest.$ac_objext; then
33103 ac_header_compiler=yes
33104else
33105 echo "$as_me: failed program was:" >&5
33106sed 's/^/| /' conftest.$ac_ext >&5
33107
33108 ac_header_compiler=no
33109fi
33110
33111rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
33112{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
33113echo "${ECHO_T}$ac_header_compiler" >&6; }
33114
33115# Is the header present?
33116{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
33117echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
33118cat >conftest.$ac_ext <<_ACEOF
33119/* confdefs.h. */
33120_ACEOF
33121cat confdefs.h >>conftest.$ac_ext
33122cat >>conftest.$ac_ext <<_ACEOF
33123/* end confdefs.h. */
33124#include <$ac_header>
33125_ACEOF
33126if { (ac_try="$ac_cpp conftest.$ac_ext"
33127case "(($ac_try" in
33128 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33129 *) ac_try_echo=$ac_try;;
33130esac
33131eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33132 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
33133 ac_status=$?
33134 grep -v '^ *+' conftest.er1 >conftest.err
33135 rm -f conftest.er1
33136 cat conftest.err >&5
33137 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33138 (exit $ac_status); } >/dev/null && {
33139 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
33140 test ! -s conftest.err
33141 }; then
33142 ac_header_preproc=yes
33143else
33144 echo "$as_me: failed program was:" >&5
33145sed 's/^/| /' conftest.$ac_ext >&5
33146
33147 ac_header_preproc=no
33148fi
33149
33150rm -f conftest.err conftest.$ac_ext
33151{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
33152echo "${ECHO_T}$ac_header_preproc" >&6; }
33153
33154# So? What about this header?
33155case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
33156 yes:no: )
33157 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
33158echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
33159 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
33160echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
33161 ac_header_preproc=yes
33162 ;;
33163 no:yes:* )
33164 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
33165echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
33166 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
33167echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
33168 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
33169echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
33170 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
33171echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
33172 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
33173echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
33174 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
33175echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
33176 ( cat <<\_ASBOX
33177## ------------------------------------------- ##
33178## Report this to openssh-unix-dev@mindrot.org ##
33179## ------------------------------------------- ##
33180_ASBOX
33181 ) | sed "s/^/$as_me: WARNING: /" >&2
33182 ;;
33183esac
33184{ echo "$as_me:$LINENO: checking for $ac_header" >&5
33185echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
33186if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
33187 echo $ECHO_N "(cached) $ECHO_C" >&6
33188else
33189 eval "$as_ac_Header=\$ac_header_preproc"
33190fi
33191ac_res=`eval echo '${'$as_ac_Header'}'`
33192 { echo "$as_me:$LINENO: result: $ac_res" >&5
33193echo "${ECHO_T}$ac_res" >&6; }
33194
33195fi
33196if test `eval echo '${'$as_ac_Header'}'` = yes; then
17028 cat >>confdefs.h <<_ACEOF 33197 cat >>confdefs.h <<_ACEOF
17029#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 33198#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
17030_ACEOF 33199_ACEOF
17031 33200
17032fi 33201fi
17033 33202
17034done 33203done
17035 33204
17036 for ac_header in gssapi_generic.h gssapi/gssapi_generic.h 33205
17037do : 33206
17038 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 33207for ac_header in gssapi_generic.h gssapi/gssapi_generic.h
17039ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" 33208do
17040if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : 33209as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
33210if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
33211 { echo "$as_me:$LINENO: checking for $ac_header" >&5
33212echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
33213if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
33214 echo $ECHO_N "(cached) $ECHO_C" >&6
33215fi
33216ac_res=`eval echo '${'$as_ac_Header'}'`
33217 { echo "$as_me:$LINENO: result: $ac_res" >&5
33218echo "${ECHO_T}$ac_res" >&6; }
33219else
33220 # Is the header compilable?
33221{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
33222echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
33223cat >conftest.$ac_ext <<_ACEOF
33224/* confdefs.h. */
33225_ACEOF
33226cat confdefs.h >>conftest.$ac_ext
33227cat >>conftest.$ac_ext <<_ACEOF
33228/* end confdefs.h. */
33229$ac_includes_default
33230#include <$ac_header>
33231_ACEOF
33232rm -f conftest.$ac_objext
33233if { (ac_try="$ac_compile"
33234case "(($ac_try" in
33235 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33236 *) ac_try_echo=$ac_try;;
33237esac
33238eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33239 (eval "$ac_compile") 2>conftest.er1
33240 ac_status=$?
33241 grep -v '^ *+' conftest.er1 >conftest.err
33242 rm -f conftest.er1
33243 cat conftest.err >&5
33244 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33245 (exit $ac_status); } && {
33246 test -z "$ac_c_werror_flag" ||
33247 test ! -s conftest.err
33248 } && test -s conftest.$ac_objext; then
33249 ac_header_compiler=yes
33250else
33251 echo "$as_me: failed program was:" >&5
33252sed 's/^/| /' conftest.$ac_ext >&5
33253
33254 ac_header_compiler=no
33255fi
33256
33257rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
33258{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
33259echo "${ECHO_T}$ac_header_compiler" >&6; }
33260
33261# Is the header present?
33262{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
33263echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
33264cat >conftest.$ac_ext <<_ACEOF
33265/* confdefs.h. */
33266_ACEOF
33267cat confdefs.h >>conftest.$ac_ext
33268cat >>conftest.$ac_ext <<_ACEOF
33269/* end confdefs.h. */
33270#include <$ac_header>
33271_ACEOF
33272if { (ac_try="$ac_cpp conftest.$ac_ext"
33273case "(($ac_try" in
33274 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33275 *) ac_try_echo=$ac_try;;
33276esac
33277eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33278 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
33279 ac_status=$?
33280 grep -v '^ *+' conftest.er1 >conftest.err
33281 rm -f conftest.er1
33282 cat conftest.err >&5
33283 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33284 (exit $ac_status); } >/dev/null && {
33285 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
33286 test ! -s conftest.err
33287 }; then
33288 ac_header_preproc=yes
33289else
33290 echo "$as_me: failed program was:" >&5
33291sed 's/^/| /' conftest.$ac_ext >&5
33292
33293 ac_header_preproc=no
33294fi
33295
33296rm -f conftest.err conftest.$ac_ext
33297{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
33298echo "${ECHO_T}$ac_header_preproc" >&6; }
33299
33300# So? What about this header?
33301case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
33302 yes:no: )
33303 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
33304echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
33305 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
33306echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
33307 ac_header_preproc=yes
33308 ;;
33309 no:yes:* )
33310 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
33311echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
33312 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
33313echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
33314 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
33315echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
33316 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
33317echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
33318 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
33319echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
33320 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
33321echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
33322 ( cat <<\_ASBOX
33323## ------------------------------------------- ##
33324## Report this to openssh-unix-dev@mindrot.org ##
33325## ------------------------------------------- ##
33326_ASBOX
33327 ) | sed "s/^/$as_me: WARNING: /" >&2
33328 ;;
33329esac
33330{ echo "$as_me:$LINENO: checking for $ac_header" >&5
33331echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
33332if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
33333 echo $ECHO_N "(cached) $ECHO_C" >&6
33334else
33335 eval "$as_ac_Header=\$ac_header_preproc"
33336fi
33337ac_res=`eval echo '${'$as_ac_Header'}'`
33338 { echo "$as_me:$LINENO: result: $ac_res" >&5
33339echo "${ECHO_T}$ac_res" >&6; }
33340
33341fi
33342if test `eval echo '${'$as_ac_Header'}'` = yes; then
17041 cat >>confdefs.h <<_ACEOF 33343 cat >>confdefs.h <<_ACEOF
17042#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 33344#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
17043_ACEOF 33345_ACEOF
17044 33346
17045fi 33347fi
@@ -17047,13 +33349,17 @@ fi
17047done 33349done
17048 33350
17049 33351
17050 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing k_hasafs" >&5 33352 { echo "$as_me:$LINENO: checking for library containing k_hasafs" >&5
17051$as_echo_n "checking for library containing k_hasafs... " >&6; } 33353echo $ECHO_N "checking for library containing k_hasafs... $ECHO_C" >&6; }
17052if ${ac_cv_search_k_hasafs+:} false; then : 33354if test "${ac_cv_search_k_hasafs+set}" = set; then
17053 $as_echo_n "(cached) " >&6 33355 echo $ECHO_N "(cached) $ECHO_C" >&6
17054else 33356else
17055 ac_func_search_save_LIBS=$LIBS 33357 ac_func_search_save_LIBS=$LIBS
17056cat confdefs.h - <<_ACEOF >conftest.$ac_ext 33358cat >conftest.$ac_ext <<_ACEOF
33359/* confdefs.h. */
33360_ACEOF
33361cat confdefs.h >>conftest.$ac_ext
33362cat >>conftest.$ac_ext <<_ACEOF
17057/* end confdefs.h. */ 33363/* end confdefs.h. */
17058 33364
17059/* Override any GCC internal prototype to avoid an error. 33365/* Override any GCC internal prototype to avoid an error.
@@ -17078,35 +33384,71 @@ for ac_lib in '' kafs; do
17078 ac_res=-l$ac_lib 33384 ac_res=-l$ac_lib
17079 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 33385 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
17080 fi 33386 fi
17081 if ac_fn_c_try_link "$LINENO"; then : 33387 rm -f conftest.$ac_objext conftest$ac_exeext
33388if { (ac_try="$ac_link"
33389case "(($ac_try" in
33390 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33391 *) ac_try_echo=$ac_try;;
33392esac
33393eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33394 (eval "$ac_link") 2>conftest.er1
33395 ac_status=$?
33396 grep -v '^ *+' conftest.er1 >conftest.err
33397 rm -f conftest.er1
33398 cat conftest.err >&5
33399 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33400 (exit $ac_status); } && {
33401 test -z "$ac_c_werror_flag" ||
33402 test ! -s conftest.err
33403 } && test -s conftest$ac_exeext &&
33404 $as_test_x conftest$ac_exeext; then
17082 ac_cv_search_k_hasafs=$ac_res 33405 ac_cv_search_k_hasafs=$ac_res
33406else
33407 echo "$as_me: failed program was:" >&5
33408sed 's/^/| /' conftest.$ac_ext >&5
33409
33410
17083fi 33411fi
17084rm -f core conftest.err conftest.$ac_objext \ 33412
17085 conftest$ac_exeext 33413rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
17086 if ${ac_cv_search_k_hasafs+:} false; then : 33414 conftest$ac_exeext
33415 if test "${ac_cv_search_k_hasafs+set}" = set; then
17087 break 33416 break
17088fi 33417fi
17089done 33418done
17090if ${ac_cv_search_k_hasafs+:} false; then : 33419if test "${ac_cv_search_k_hasafs+set}" = set; then
17091 33420 :
17092else 33421else
17093 ac_cv_search_k_hasafs=no 33422 ac_cv_search_k_hasafs=no
17094fi 33423fi
17095rm conftest.$ac_ext 33424rm conftest.$ac_ext
17096LIBS=$ac_func_search_save_LIBS 33425LIBS=$ac_func_search_save_LIBS
17097fi 33426fi
17098{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_k_hasafs" >&5 33427{ echo "$as_me:$LINENO: result: $ac_cv_search_k_hasafs" >&5
17099$as_echo "$ac_cv_search_k_hasafs" >&6; } 33428echo "${ECHO_T}$ac_cv_search_k_hasafs" >&6; }
17100ac_res=$ac_cv_search_k_hasafs 33429ac_res=$ac_cv_search_k_hasafs
17101if test "$ac_res" != no; then : 33430if test "$ac_res" != no; then
17102 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 33431 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
17103 33432
17104$as_echo "#define USE_AFS 1" >>confdefs.h 33433cat >>confdefs.h <<\_ACEOF
33434#define USE_AFS 1
33435_ACEOF
17105 33436
17106fi 33437fi
17107 33438
17108 33439
17109 ac_fn_c_check_decl "$LINENO" "GSS_C_NT_HOSTBASED_SERVICE" "ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE" " 33440 { echo "$as_me:$LINENO: checking whether GSS_C_NT_HOSTBASED_SERVICE is declared" >&5
33441echo $ECHO_N "checking whether GSS_C_NT_HOSTBASED_SERVICE is declared... $ECHO_C" >&6; }
33442if test "${ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE+set}" = set; then
33443 echo $ECHO_N "(cached) $ECHO_C" >&6
33444else
33445 cat >conftest.$ac_ext <<_ACEOF
33446/* confdefs.h. */
33447_ACEOF
33448cat confdefs.h >>conftest.$ac_ext
33449cat >>conftest.$ac_ext <<_ACEOF
33450/* end confdefs.h. */
33451
17110#ifdef HAVE_GSSAPI_H 33452#ifdef HAVE_GSSAPI_H
17111# include <gssapi.h> 33453# include <gssapi.h>
17112#elif defined(HAVE_GSSAPI_GSSAPI_H) 33454#elif defined(HAVE_GSSAPI_GSSAPI_H)
@@ -17119,26 +33461,156 @@ fi
17119# include <gssapi/gssapi_generic.h> 33461# include <gssapi/gssapi_generic.h>
17120#endif 33462#endif
17121 33463
17122" 33464
17123if test "x$ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE" = xyes; then : 33465int
17124 ac_have_decl=1 33466main ()
33467{
33468#ifndef GSS_C_NT_HOSTBASED_SERVICE
33469 (void) GSS_C_NT_HOSTBASED_SERVICE;
33470#endif
33471
33472 ;
33473 return 0;
33474}
33475_ACEOF
33476rm -f conftest.$ac_objext
33477if { (ac_try="$ac_compile"
33478case "(($ac_try" in
33479 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33480 *) ac_try_echo=$ac_try;;
33481esac
33482eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33483 (eval "$ac_compile") 2>conftest.er1
33484 ac_status=$?
33485 grep -v '^ *+' conftest.er1 >conftest.err
33486 rm -f conftest.er1
33487 cat conftest.err >&5
33488 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33489 (exit $ac_status); } && {
33490 test -z "$ac_c_werror_flag" ||
33491 test ! -s conftest.err
33492 } && test -s conftest.$ac_objext; then
33493 ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE=yes
17125else 33494else
17126 ac_have_decl=0 33495 echo "$as_me: failed program was:" >&5
33496sed 's/^/| /' conftest.$ac_ext >&5
33497
33498 ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE=no
33499fi
33500
33501rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17127fi 33502fi
33503{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE" >&5
33504echo "${ECHO_T}$ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE" >&6; }
33505if test $ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE = yes; then
17128 33506
17129cat >>confdefs.h <<_ACEOF 33507cat >>confdefs.h <<_ACEOF
17130#define HAVE_DECL_GSS_C_NT_HOSTBASED_SERVICE $ac_have_decl 33508#define HAVE_DECL_GSS_C_NT_HOSTBASED_SERVICE 1
17131_ACEOF 33509_ACEOF
17132 33510
33511
33512else
33513 cat >>confdefs.h <<_ACEOF
33514#define HAVE_DECL_GSS_C_NT_HOSTBASED_SERVICE 0
33515_ACEOF
33516
33517
33518fi
33519
33520
17133 saved_LIBS="$LIBS" 33521 saved_LIBS="$LIBS"
17134 LIBS="$LIBS $K5LIBS" 33522 LIBS="$LIBS $K5LIBS"
17135 for ac_func in krb5_cc_new_unique krb5_get_error_message krb5_free_error_message 33523
17136do : 33524
17137 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 33525
17138ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 33526for ac_func in krb5_cc_new_unique krb5_get_error_message krb5_free_error_message
17139if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 33527do
33528as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
33529{ echo "$as_me:$LINENO: checking for $ac_func" >&5
33530echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
33531if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
33532 echo $ECHO_N "(cached) $ECHO_C" >&6
33533else
33534 cat >conftest.$ac_ext <<_ACEOF
33535/* confdefs.h. */
33536_ACEOF
33537cat confdefs.h >>conftest.$ac_ext
33538cat >>conftest.$ac_ext <<_ACEOF
33539/* end confdefs.h. */
33540/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
33541 For example, HP-UX 11i <limits.h> declares gettimeofday. */
33542#define $ac_func innocuous_$ac_func
33543
33544/* System header to define __stub macros and hopefully few prototypes,
33545 which can conflict with char $ac_func (); below.
33546 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
33547 <limits.h> exists even on freestanding compilers. */
33548
33549#ifdef __STDC__
33550# include <limits.h>
33551#else
33552# include <assert.h>
33553#endif
33554
33555#undef $ac_func
33556
33557/* Override any GCC internal prototype to avoid an error.
33558 Use char because int might match the return type of a GCC
33559 builtin and then its argument prototype would still apply. */
33560#ifdef __cplusplus
33561extern "C"
33562#endif
33563char $ac_func ();
33564/* The GNU C library defines this for functions which it implements
33565 to always fail with ENOSYS. Some functions are actually named
33566 something starting with __ and the normal name is an alias. */
33567#if defined __stub_$ac_func || defined __stub___$ac_func
33568choke me
33569#endif
33570
33571int
33572main ()
33573{
33574return $ac_func ();
33575 ;
33576 return 0;
33577}
33578_ACEOF
33579rm -f conftest.$ac_objext conftest$ac_exeext
33580if { (ac_try="$ac_link"
33581case "(($ac_try" in
33582 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33583 *) ac_try_echo=$ac_try;;
33584esac
33585eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33586 (eval "$ac_link") 2>conftest.er1
33587 ac_status=$?
33588 grep -v '^ *+' conftest.er1 >conftest.err
33589 rm -f conftest.er1
33590 cat conftest.err >&5
33591 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33592 (exit $ac_status); } && {
33593 test -z "$ac_c_werror_flag" ||
33594 test ! -s conftest.err
33595 } && test -s conftest$ac_exeext &&
33596 $as_test_x conftest$ac_exeext; then
33597 eval "$as_ac_var=yes"
33598else
33599 echo "$as_me: failed program was:" >&5
33600sed 's/^/| /' conftest.$ac_ext >&5
33601
33602 eval "$as_ac_var=no"
33603fi
33604
33605rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
33606 conftest$ac_exeext conftest.$ac_ext
33607fi
33608ac_res=`eval echo '${'$as_ac_var'}'`
33609 { echo "$as_me:$LINENO: result: $ac_res" >&5
33610echo "${ECHO_T}$ac_res" >&6; }
33611if test `eval echo '${'$as_ac_var'}'` = yes; then
17140 cat >>confdefs.h <<_ACEOF 33612 cat >>confdefs.h <<_ACEOF
17141#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 33613#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
17142_ACEOF 33614_ACEOF
17143 33615
17144fi 33616fi
@@ -17159,7 +33631,7 @@ fi
17159PRIVSEP_PATH=/var/empty 33631PRIVSEP_PATH=/var/empty
17160 33632
17161# Check whether --with-privsep-path was given. 33633# Check whether --with-privsep-path was given.
17162if test "${with_privsep_path+set}" = set; then : 33634if test "${with_privsep_path+set}" = set; then
17163 withval=$with_privsep_path; 33635 withval=$with_privsep_path;
17164 if test -n "$withval" && test "x$withval" != "xno" && \ 33636 if test -n "$withval" && test "x$withval" != "xno" && \
17165 test "x${withval}" != "xyes"; then 33637 test "x${withval}" != "xyes"; then
@@ -17173,7 +33645,7 @@ fi
17173 33645
17174 33646
17175# Check whether --with-xauth was given. 33647# Check whether --with-xauth was given.
17176if test "${with_xauth+set}" = set; then : 33648if test "${with_xauth+set}" = set; then
17177 withval=$with_xauth; 33649 withval=$with_xauth;
17178 if test -n "$withval" && test "x$withval" != "xno" && \ 33650 if test -n "$withval" && test "x$withval" != "xno" && \
17179 test "x${withval}" != "xyes"; then 33651 test "x${withval}" != "xyes"; then
@@ -17189,10 +33661,10 @@ else
17189 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin" 33661 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
17190 # Extract the first word of "xauth", so it can be a program name with args. 33662 # Extract the first word of "xauth", so it can be a program name with args.
17191set dummy xauth; ac_word=$2 33663set dummy xauth; ac_word=$2
17192{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 33664{ echo "$as_me:$LINENO: checking for $ac_word" >&5
17193$as_echo_n "checking for $ac_word... " >&6; } 33665echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
17194if ${ac_cv_path_xauth_path+:} false; then : 33666if test "${ac_cv_path_xauth_path+set}" = set; then
17195 $as_echo_n "(cached) " >&6 33667 echo $ECHO_N "(cached) $ECHO_C" >&6
17196else 33668else
17197 case $xauth_path in 33669 case $xauth_path in
17198 [\\/]* | ?:[\\/]*) 33670 [\\/]* | ?:[\\/]*)
@@ -17204,14 +33676,14 @@ for as_dir in $TestPath
17204do 33676do
17205 IFS=$as_save_IFS 33677 IFS=$as_save_IFS
17206 test -z "$as_dir" && as_dir=. 33678 test -z "$as_dir" && as_dir=.
17207 for ac_exec_ext in '' $ac_executable_extensions; do 33679 for ac_exec_ext in '' $ac_executable_extensions; do
17208 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 33680 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
17209 ac_cv_path_xauth_path="$as_dir/$ac_word$ac_exec_ext" 33681 ac_cv_path_xauth_path="$as_dir/$ac_word$ac_exec_ext"
17210 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 33682 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
17211 break 2 33683 break 2
17212 fi 33684 fi
17213done 33685done
17214 done 33686done
17215IFS=$as_save_IFS 33687IFS=$as_save_IFS
17216 33688
17217 ;; 33689 ;;
@@ -17219,11 +33691,11 @@ esac
17219fi 33691fi
17220xauth_path=$ac_cv_path_xauth_path 33692xauth_path=$ac_cv_path_xauth_path
17221if test -n "$xauth_path"; then 33693if test -n "$xauth_path"; then
17222 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xauth_path" >&5 33694 { echo "$as_me:$LINENO: result: $xauth_path" >&5
17223$as_echo "$xauth_path" >&6; } 33695echo "${ECHO_T}$xauth_path" >&6; }
17224else 33696else
17225 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 33697 { echo "$as_me:$LINENO: result: no" >&5
17226$as_echo "no" >&6; } 33698echo "${ECHO_T}no" >&6; }
17227fi 33699fi
17228 33700
17229 33701
@@ -17237,7 +33709,7 @@ fi
17237 33709
17238STRIP_OPT=-s 33710STRIP_OPT=-s
17239# Check whether --enable-strip was given. 33711# Check whether --enable-strip was given.
17240if test "${enable_strip+set}" = set; then : 33712if test "${enable_strip+set}" = set; then
17241 enableval=$enable_strip; 33713 enableval=$enable_strip;
17242 if test "x$enableval" = "xno" ; then 33714 if test "x$enableval" = "xno" ; then
17243 STRIP_OPT= 33715 STRIP_OPT=
@@ -17264,7 +33736,7 @@ fi
17264# Check for mail directory 33736# Check for mail directory
17265 33737
17266# Check whether --with-maildir was given. 33738# Check whether --with-maildir was given.
17267if test "${with_maildir+set}" = set; then : 33739if test "${with_maildir+set}" = set; then
17268 withval=$with_maildir; 33740 withval=$with_maildir;
17269 if test "X$withval" != X && test "x$withval" != xno && \ 33741 if test "X$withval" != X && test "x$withval" != xno && \
17270 test "x${withval}" != xyes; then 33742 test "x${withval}" != xyes; then
@@ -17283,16 +33755,20 @@ else
17283_ACEOF 33755_ACEOF
17284 33756
17285 else 33757 else
17286 { $as_echo "$as_me:${as_lineno-$LINENO}: checking Discovering system mail directory" >&5 33758 { echo "$as_me:$LINENO: checking Discovering system mail directory" >&5
17287$as_echo_n "checking Discovering system mail directory... " >&6; } 33759echo $ECHO_N "checking Discovering system mail directory... $ECHO_C" >&6; }
17288 if test "$cross_compiling" = yes; then : 33760 if test "$cross_compiling" = yes; then
17289 33761
17290 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: use --with-maildir=/path/to/mail" >&5 33762 { echo "$as_me:$LINENO: WARNING: cross compiling: use --with-maildir=/path/to/mail" >&5
17291$as_echo "$as_me: WARNING: cross compiling: use --with-maildir=/path/to/mail" >&2;} 33763echo "$as_me: WARNING: cross compiling: use --with-maildir=/path/to/mail" >&2;}
17292 33764
17293 33765
17294else 33766else
17295 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 33767 cat >conftest.$ac_ext <<_ACEOF
33768/* confdefs.h. */
33769_ACEOF
33770cat confdefs.h >>conftest.$ac_ext
33771cat >>conftest.$ac_ext <<_ACEOF
17296/* end confdefs.h. */ 33772/* end confdefs.h. */
17297 33773
17298#include <stdio.h> 33774#include <stdio.h>
@@ -17335,13 +33811,32 @@ main ()
17335 return 0; 33811 return 0;
17336} 33812}
17337_ACEOF 33813_ACEOF
17338if ac_fn_c_try_run "$LINENO"; then : 33814rm -f conftest$ac_exeext
33815if { (ac_try="$ac_link"
33816case "(($ac_try" in
33817 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33818 *) ac_try_echo=$ac_try;;
33819esac
33820eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33821 (eval "$ac_link") 2>&5
33822 ac_status=$?
33823 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33824 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
33825 { (case "(($ac_try" in
33826 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
33827 *) ac_try_echo=$ac_try;;
33828esac
33829eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
33830 (eval "$ac_try") 2>&5
33831 ac_status=$?
33832 echo "$as_me:$LINENO: \$? = $ac_status" >&5
33833 (exit $ac_status); }; }; then
17339 33834
17340 maildir_what=`awk -F: '{print $1}' conftest.maildir` 33835 maildir_what=`awk -F: '{print $1}' conftest.maildir`
17341 maildir=`awk -F: '{print $2}' conftest.maildir \ 33836 maildir=`awk -F: '{print $2}' conftest.maildir \
17342 | sed 's|/$||'` 33837 | sed 's|/$||'`
17343 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using: $maildir from $maildir_what" >&5 33838 { echo "$as_me:$LINENO: result: Using: $maildir from $maildir_what" >&5
17344$as_echo "Using: $maildir from $maildir_what" >&6; } 33839echo "${ECHO_T}Using: $maildir from $maildir_what" >&6; }
17345 if test "x$maildir_what" != "x_PATH_MAILDIR"; then 33840 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
17346 cat >>confdefs.h <<_ACEOF 33841 cat >>confdefs.h <<_ACEOF
17347#define MAIL_DIRECTORY "$maildir" 33842#define MAIL_DIRECTORY "$maildir"
@@ -17350,25 +33845,30 @@ _ACEOF
17350 fi 33845 fi
17351 33846
17352else 33847else
33848 echo "$as_me: program exited with status $ac_status" >&5
33849echo "$as_me: failed program was:" >&5
33850sed 's/^/| /' conftest.$ac_ext >&5
33851
33852( exit $ac_status )
17353 33853
17354 if test "X$ac_status" = "X2";then 33854 if test "X$ac_status" = "X2";then
17355# our test program didn't find it. Default to /var/spool/mail 33855# our test program didn't find it. Default to /var/spool/mail
17356 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using: default value of /var/spool/mail" >&5 33856 { echo "$as_me:$LINENO: result: Using: default value of /var/spool/mail" >&5
17357$as_echo "Using: default value of /var/spool/mail" >&6; } 33857echo "${ECHO_T}Using: default value of /var/spool/mail" >&6; }
17358 cat >>confdefs.h <<_ACEOF 33858 cat >>confdefs.h <<_ACEOF
17359#define MAIL_DIRECTORY "/var/spool/mail" 33859#define MAIL_DIRECTORY "/var/spool/mail"
17360_ACEOF 33860_ACEOF
17361 33861
17362 else 33862 else
17363 { $as_echo "$as_me:${as_lineno-$LINENO}: result: *** not found ***" >&5 33863 { echo "$as_me:$LINENO: result: *** not found ***" >&5
17364$as_echo "*** not found ***" >&6; } 33864echo "${ECHO_T}*** not found ***" >&6; }
17365 fi 33865 fi
17366 33866
17367fi 33867fi
17368rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 33868rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
17369 conftest.$ac_objext conftest.beam conftest.$ac_ext
17370fi 33869fi
17371 33870
33871
17372 fi 33872 fi
17373 33873
17374 33874
@@ -17376,30 +33876,30 @@ fi
17376 # maildir 33876 # maildir
17377 33877
17378if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then 33878if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
17379 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: Disabling /dev/ptmx test" >&5 33879 { echo "$as_me:$LINENO: WARNING: cross compiling: Disabling /dev/ptmx test" >&5
17380$as_echo "$as_me: WARNING: cross compiling: Disabling /dev/ptmx test" >&2;} 33880echo "$as_me: WARNING: cross compiling: Disabling /dev/ptmx test" >&2;}
17381 disable_ptmx_check=yes 33881 disable_ptmx_check=yes
17382fi 33882fi
17383if test -z "$no_dev_ptmx" ; then 33883if test -z "$no_dev_ptmx" ; then
17384 if test "x$disable_ptmx_check" != "xyes" ; then 33884 if test "x$disable_ptmx_check" != "xyes" ; then
17385 as_ac_File=`$as_echo "ac_cv_file_"/dev/ptmx"" | $as_tr_sh` 33885 { echo "$as_me:$LINENO: checking for \"/dev/ptmx\"" >&5
17386{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/dev/ptmx\"" >&5 33886echo $ECHO_N "checking for \"/dev/ptmx\"... $ECHO_C" >&6; }
17387$as_echo_n "checking for \"/dev/ptmx\"... " >&6; } 33887if test "${ac_cv_file___dev_ptmx_+set}" = set; then
17388if eval \${$as_ac_File+:} false; then : 33888 echo $ECHO_N "(cached) $ECHO_C" >&6
17389 $as_echo_n "(cached) " >&6
17390else 33889else
17391 test "$cross_compiling" = yes && 33890 test "$cross_compiling" = yes &&
17392 as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 33891 { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
33892echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
33893 { (exit 1); exit 1; }; }
17393if test -r ""/dev/ptmx""; then 33894if test -r ""/dev/ptmx""; then
17394 eval "$as_ac_File=yes" 33895 ac_cv_file___dev_ptmx_=yes
17395else 33896else
17396 eval "$as_ac_File=no" 33897 ac_cv_file___dev_ptmx_=no
17397fi 33898fi
17398fi 33899fi
17399eval ac_res=\$$as_ac_File 33900{ echo "$as_me:$LINENO: result: $ac_cv_file___dev_ptmx_" >&5
17400 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 33901echo "${ECHO_T}$ac_cv_file___dev_ptmx_" >&6; }
17401$as_echo "$ac_res" >&6; } 33902if test $ac_cv_file___dev_ptmx_ = yes; then
17402if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
17403 33903
17404 33904
17405cat >>confdefs.h <<_ACEOF 33905cat >>confdefs.h <<_ACEOF
@@ -17415,24 +33915,24 @@ fi
17415fi 33915fi
17416 33916
17417if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then 33917if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
17418 as_ac_File=`$as_echo "ac_cv_file_"/dev/ptc"" | $as_tr_sh` 33918 { echo "$as_me:$LINENO: checking for \"/dev/ptc\"" >&5
17419{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/dev/ptc\"" >&5 33919echo $ECHO_N "checking for \"/dev/ptc\"... $ECHO_C" >&6; }
17420$as_echo_n "checking for \"/dev/ptc\"... " >&6; } 33920if test "${ac_cv_file___dev_ptc_+set}" = set; then
17421if eval \${$as_ac_File+:} false; then : 33921 echo $ECHO_N "(cached) $ECHO_C" >&6
17422 $as_echo_n "(cached) " >&6
17423else 33922else
17424 test "$cross_compiling" = yes && 33923 test "$cross_compiling" = yes &&
17425 as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 33924 { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
33925echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
33926 { (exit 1); exit 1; }; }
17426if test -r ""/dev/ptc""; then 33927if test -r ""/dev/ptc""; then
17427 eval "$as_ac_File=yes" 33928 ac_cv_file___dev_ptc_=yes
17428else 33929else
17429 eval "$as_ac_File=no" 33930 ac_cv_file___dev_ptc_=no
17430fi 33931fi
17431fi 33932fi
17432eval ac_res=\$$as_ac_File 33933{ echo "$as_me:$LINENO: result: $ac_cv_file___dev_ptc_" >&5
17433 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 33934echo "${ECHO_T}$ac_cv_file___dev_ptc_" >&6; }
17434$as_echo "$ac_res" >&6; } 33935if test $ac_cv_file___dev_ptc_ = yes; then
17435if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
17436 33936
17437 33937
17438cat >>confdefs.h <<_ACEOF 33938cat >>confdefs.h <<_ACEOF
@@ -17445,21 +33945,23 @@ _ACEOF
17445fi 33945fi
17446 33946
17447else 33947else
17448 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: Disabling /dev/ptc test" >&5 33948 { echo "$as_me:$LINENO: WARNING: cross compiling: Disabling /dev/ptc test" >&5
17449$as_echo "$as_me: WARNING: cross compiling: Disabling /dev/ptc test" >&2;} 33949echo "$as_me: WARNING: cross compiling: Disabling /dev/ptc test" >&2;}
17450fi 33950fi
17451 33951
17452# Options from here on. Some of these are preset by platform above 33952# Options from here on. Some of these are preset by platform above
17453 33953
17454# Check whether --with-mantype was given. 33954# Check whether --with-mantype was given.
17455if test "${with_mantype+set}" = set; then : 33955if test "${with_mantype+set}" = set; then
17456 withval=$with_mantype; 33956 withval=$with_mantype;
17457 case "$withval" in 33957 case "$withval" in
17458 man|cat|doc) 33958 man|cat|doc)
17459 MANTYPE=$withval 33959 MANTYPE=$withval
17460 ;; 33960 ;;
17461 *) 33961 *)
17462 as_fn_error $? "invalid man type: $withval" "$LINENO" 5 33962 { { echo "$as_me:$LINENO: error: invalid man type: $withval" >&5
33963echo "$as_me: error: invalid man type: $withval" >&2;}
33964 { (exit 1); exit 1; }; }
17463 ;; 33965 ;;
17464 esac 33966 esac
17465 33967
@@ -17472,10 +33974,10 @@ if test -z "$MANTYPE"; then
17472do 33974do
17473 # Extract the first word of "$ac_prog", so it can be a program name with args. 33975 # Extract the first word of "$ac_prog", so it can be a program name with args.
17474set dummy $ac_prog; ac_word=$2 33976set dummy $ac_prog; ac_word=$2
17475{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 33977{ echo "$as_me:$LINENO: checking for $ac_word" >&5
17476$as_echo_n "checking for $ac_word... " >&6; } 33978echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
17477if ${ac_cv_path_NROFF+:} false; then : 33979if test "${ac_cv_path_NROFF+set}" = set; then
17478 $as_echo_n "(cached) " >&6 33980 echo $ECHO_N "(cached) $ECHO_C" >&6
17479else 33981else
17480 case $NROFF in 33982 case $NROFF in
17481 [\\/]* | ?:[\\/]*) 33983 [\\/]* | ?:[\\/]*)
@@ -17487,14 +33989,14 @@ for as_dir in $TestPath
17487do 33989do
17488 IFS=$as_save_IFS 33990 IFS=$as_save_IFS
17489 test -z "$as_dir" && as_dir=. 33991 test -z "$as_dir" && as_dir=.
17490 for ac_exec_ext in '' $ac_executable_extensions; do 33992 for ac_exec_ext in '' $ac_executable_extensions; do
17491 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then 33993 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
17492 ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext" 33994 ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext"
17493 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 33995 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
17494 break 2 33996 break 2
17495 fi 33997 fi
17496done 33998done
17497 done 33999done
17498IFS=$as_save_IFS 34000IFS=$as_save_IFS
17499 34001
17500 ;; 34002 ;;
@@ -17502,11 +34004,11 @@ esac
17502fi 34004fi
17503NROFF=$ac_cv_path_NROFF 34005NROFF=$ac_cv_path_NROFF
17504if test -n "$NROFF"; then 34006if test -n "$NROFF"; then
17505 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NROFF" >&5 34007 { echo "$as_me:$LINENO: result: $NROFF" >&5
17506$as_echo "$NROFF" >&6; } 34008echo "${ECHO_T}$NROFF" >&6; }
17507else 34009else
17508 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34010 { echo "$as_me:$LINENO: result: no" >&5
17509$as_echo "no" >&6; } 34011echo "${ECHO_T}no" >&6; }
17510fi 34012fi
17511 34013
17512 34014
@@ -17534,11 +34036,13 @@ fi
17534MD5_MSG="no" 34036MD5_MSG="no"
17535 34037
17536# Check whether --with-md5-passwords was given. 34038# Check whether --with-md5-passwords was given.
17537if test "${with_md5_passwords+set}" = set; then : 34039if test "${with_md5_passwords+set}" = set; then
17538 withval=$with_md5_passwords; 34040 withval=$with_md5_passwords;
17539 if test "x$withval" != "xno" ; then 34041 if test "x$withval" != "xno" ; then
17540 34042
17541$as_echo "#define HAVE_MD5_PASSWORDS 1" >>confdefs.h 34043cat >>confdefs.h <<\_ACEOF
34044#define HAVE_MD5_PASSWORDS 1
34045_ACEOF
17542 34046
17543 MD5_MSG="yes" 34047 MD5_MSG="yes"
17544 fi 34048 fi
@@ -17550,10 +34054,12 @@ fi
17550# Whether to disable shadow password support 34054# Whether to disable shadow password support
17551 34055
17552# Check whether --with-shadow was given. 34056# Check whether --with-shadow was given.
17553if test "${with_shadow+set}" = set; then : 34057if test "${with_shadow+set}" = set; then
17554 withval=$with_shadow; 34058 withval=$with_shadow;
17555 if test "x$withval" = "xno" ; then 34059 if test "x$withval" = "xno" ; then
17556 $as_echo "#define DISABLE_SHADOW 1" >>confdefs.h 34060 cat >>confdefs.h <<\_ACEOF
34061#define DISABLE_SHADOW 1
34062_ACEOF
17557 34063
17558 disable_shadow=yes 34064 disable_shadow=yes
17559 fi 34065 fi
@@ -17563,9 +34069,13 @@ fi
17563 34069
17564 34070
17565if test -z "$disable_shadow" ; then 34071if test -z "$disable_shadow" ; then
17566 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the systems has expire shadow information" >&5 34072 { echo "$as_me:$LINENO: checking if the systems has expire shadow information" >&5
17567$as_echo_n "checking if the systems has expire shadow information... " >&6; } 34073echo $ECHO_N "checking if the systems has expire shadow information... $ECHO_C" >&6; }
17568 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 34074 cat >conftest.$ac_ext <<_ACEOF
34075/* confdefs.h. */
34076_ACEOF
34077cat confdefs.h >>conftest.$ac_ext
34078cat >>conftest.$ac_ext <<_ACEOF
17569/* end confdefs.h. */ 34079/* end confdefs.h. */
17570 34080
17571#include <sys/types.h> 34081#include <sys/types.h>
@@ -17580,20 +34090,45 @@ main ()
17580 return 0; 34090 return 0;
17581} 34091}
17582_ACEOF 34092_ACEOF
17583if ac_fn_c_try_compile "$LINENO"; then : 34093rm -f conftest.$ac_objext
34094if { (ac_try="$ac_compile"
34095case "(($ac_try" in
34096 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
34097 *) ac_try_echo=$ac_try;;
34098esac
34099eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
34100 (eval "$ac_compile") 2>conftest.er1
34101 ac_status=$?
34102 grep -v '^ *+' conftest.er1 >conftest.err
34103 rm -f conftest.er1
34104 cat conftest.err >&5
34105 echo "$as_me:$LINENO: \$? = $ac_status" >&5
34106 (exit $ac_status); } && {
34107 test -z "$ac_c_werror_flag" ||
34108 test ! -s conftest.err
34109 } && test -s conftest.$ac_objext; then
17584 sp_expire_available=yes 34110 sp_expire_available=yes
34111else
34112 echo "$as_me: failed program was:" >&5
34113sed 's/^/| /' conftest.$ac_ext >&5
34114
34115
34116
17585fi 34117fi
34118
17586rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34119rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17587 34120
17588 if test "x$sp_expire_available" = "xyes" ; then 34121 if test "x$sp_expire_available" = "xyes" ; then
17589 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34122 { echo "$as_me:$LINENO: result: yes" >&5
17590$as_echo "yes" >&6; } 34123echo "${ECHO_T}yes" >&6; }
17591 34124
17592$as_echo "#define HAS_SHADOW_EXPIRE 1" >>confdefs.h 34125cat >>confdefs.h <<\_ACEOF
34126#define HAS_SHADOW_EXPIRE 1
34127_ACEOF
17593 34128
17594 else 34129 else
17595 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34130 { echo "$as_me:$LINENO: result: no" >&5
17596$as_echo "no" >&6; } 34131echo "${ECHO_T}no" >&6; }
17597 fi 34132 fi
17598fi 34133fi
17599 34134
@@ -17601,16 +34136,20 @@ fi
17601if test ! -z "$IPADDR_IN_DISPLAY" ; then 34136if test ! -z "$IPADDR_IN_DISPLAY" ; then
17602 DISPLAY_HACK_MSG="yes" 34137 DISPLAY_HACK_MSG="yes"
17603 34138
17604$as_echo "#define IPADDR_IN_DISPLAY 1" >>confdefs.h 34139cat >>confdefs.h <<\_ACEOF
34140#define IPADDR_IN_DISPLAY 1
34141_ACEOF
17605 34142
17606else 34143else
17607 DISPLAY_HACK_MSG="no" 34144 DISPLAY_HACK_MSG="no"
17608 34145
17609# Check whether --with-ipaddr-display was given. 34146# Check whether --with-ipaddr-display was given.
17610if test "${with_ipaddr_display+set}" = set; then : 34147if test "${with_ipaddr_display+set}" = set; then
17611 withval=$with_ipaddr_display; 34148 withval=$with_ipaddr_display;
17612 if test "x$withval" != "xno" ; then 34149 if test "x$withval" != "xno" ; then
17613 $as_echo "#define IPADDR_IN_DISPLAY 1" >>confdefs.h 34150 cat >>confdefs.h <<\_ACEOF
34151#define IPADDR_IN_DISPLAY 1
34152_ACEOF
17614 34153
17615 DISPLAY_HACK_MSG="yes" 34154 DISPLAY_HACK_MSG="yes"
17616 fi 34155 fi
@@ -17622,10 +34161,10 @@ fi
17622 34161
17623# check for /etc/default/login and use it if present. 34162# check for /etc/default/login and use it if present.
17624# Check whether --enable-etc-default-login was given. 34163# Check whether --enable-etc-default-login was given.
17625if test "${enable_etc_default_login+set}" = set; then : 34164if test "${enable_etc_default_login+set}" = set; then
17626 enableval=$enable_etc_default_login; if test "x$enableval" = "xno"; then 34165 enableval=$enable_etc_default_login; if test "x$enableval" = "xno"; then
17627 { $as_echo "$as_me:${as_lineno-$LINENO}: /etc/default/login handling disabled" >&5 34166 { echo "$as_me:$LINENO: /etc/default/login handling disabled" >&5
17628$as_echo "$as_me: /etc/default/login handling disabled" >&6;} 34167echo "$as_me: /etc/default/login handling disabled" >&6;}
17629 etc_default_login=no 34168 etc_default_login=no
17630 else 34169 else
17631 etc_default_login=yes 34170 etc_default_login=yes
@@ -17633,8 +34172,8 @@ $as_echo "$as_me: /etc/default/login handling disabled" >&6;}
17633else 34172else
17634 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; 34173 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
17635 then 34174 then
17636 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking /etc/default/login" >&5 34175 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking /etc/default/login" >&5
17637$as_echo "$as_me: WARNING: cross compiling: not checking /etc/default/login" >&2;} 34176echo "$as_me: WARNING: cross compiling: not checking /etc/default/login" >&2;}
17638 etc_default_login=no 34177 etc_default_login=no
17639 else 34178 else
17640 etc_default_login=yes 34179 etc_default_login=yes
@@ -17644,30 +34183,32 @@ fi
17644 34183
17645 34184
17646if test "x$etc_default_login" != "xno"; then 34185if test "x$etc_default_login" != "xno"; then
17647 as_ac_File=`$as_echo "ac_cv_file_"/etc/default/login"" | $as_tr_sh` 34186 { echo "$as_me:$LINENO: checking for \"/etc/default/login\"" >&5
17648{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/etc/default/login\"" >&5 34187echo $ECHO_N "checking for \"/etc/default/login\"... $ECHO_C" >&6; }
17649$as_echo_n "checking for \"/etc/default/login\"... " >&6; } 34188if test "${ac_cv_file___etc_default_login_+set}" = set; then
17650if eval \${$as_ac_File+:} false; then : 34189 echo $ECHO_N "(cached) $ECHO_C" >&6
17651 $as_echo_n "(cached) " >&6
17652else 34190else
17653 test "$cross_compiling" = yes && 34191 test "$cross_compiling" = yes &&
17654 as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 34192 { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
34193echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
34194 { (exit 1); exit 1; }; }
17655if test -r ""/etc/default/login""; then 34195if test -r ""/etc/default/login""; then
17656 eval "$as_ac_File=yes" 34196 ac_cv_file___etc_default_login_=yes
17657else 34197else
17658 eval "$as_ac_File=no" 34198 ac_cv_file___etc_default_login_=no
17659fi 34199fi
17660fi 34200fi
17661eval ac_res=\$$as_ac_File 34201{ echo "$as_me:$LINENO: result: $ac_cv_file___etc_default_login_" >&5
17662 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 34202echo "${ECHO_T}$ac_cv_file___etc_default_login_" >&6; }
17663$as_echo "$ac_res" >&6; } 34203if test $ac_cv_file___etc_default_login_ = yes; then
17664if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
17665 external_path_file=/etc/default/login 34204 external_path_file=/etc/default/login
17666fi 34205fi
17667 34206
17668 if test "x$external_path_file" = "x/etc/default/login"; then 34207 if test "x$external_path_file" = "x/etc/default/login"; then
17669 34208
17670$as_echo "#define HAVE_ETC_DEFAULT_LOGIN 1" >>confdefs.h 34209cat >>confdefs.h <<\_ACEOF
34210#define HAVE_ETC_DEFAULT_LOGIN 1
34211_ACEOF
17671 34212
17672 fi 34213 fi
17673fi 34214fi
@@ -17681,21 +34222,21 @@ fi
17681SERVER_PATH_MSG="(default)" 34222SERVER_PATH_MSG="(default)"
17682 34223
17683# Check whether --with-default-path was given. 34224# Check whether --with-default-path was given.
17684if test "${with_default_path+set}" = set; then : 34225if test "${with_default_path+set}" = set; then
17685 withval=$with_default_path; 34226 withval=$with_default_path;
17686 if test "x$external_path_file" = "x/etc/login.conf" ; then 34227 if test "x$external_path_file" = "x/etc/login.conf" ; then
17687 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 34228 { echo "$as_me:$LINENO: WARNING:
17688--with-default-path=PATH has no effect on this system. 34229--with-default-path=PATH has no effect on this system.
17689Edit /etc/login.conf instead." >&5 34230Edit /etc/login.conf instead." >&5
17690$as_echo "$as_me: WARNING: 34231echo "$as_me: WARNING:
17691--with-default-path=PATH has no effect on this system. 34232--with-default-path=PATH has no effect on this system.
17692Edit /etc/login.conf instead." >&2;} 34233Edit /etc/login.conf instead." >&2;}
17693 elif test "x$withval" != "xno" ; then 34234 elif test "x$withval" != "xno" ; then
17694 if test ! -z "$external_path_file" ; then 34235 if test ! -z "$external_path_file" ; then
17695 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 34236 { echo "$as_me:$LINENO: WARNING:
17696--with-default-path=PATH will only be used if PATH is not defined in 34237--with-default-path=PATH will only be used if PATH is not defined in
17697$external_path_file ." >&5 34238$external_path_file ." >&5
17698$as_echo "$as_me: WARNING: 34239echo "$as_me: WARNING:
17699--with-default-path=PATH will only be used if PATH is not defined in 34240--with-default-path=PATH will only be used if PATH is not defined in
17700$external_path_file ." >&2;} 34241$external_path_file ." >&2;}
17701 fi 34242 fi
@@ -17705,22 +34246,26 @@ $external_path_file ." >&2;}
17705 34246
17706else 34247else
17707 if test "x$external_path_file" = "x/etc/login.conf" ; then 34248 if test "x$external_path_file" = "x/etc/login.conf" ; then
17708 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Make sure the path to scp is in /etc/login.conf" >&5 34249 { echo "$as_me:$LINENO: WARNING: Make sure the path to scp is in /etc/login.conf" >&5
17709$as_echo "$as_me: WARNING: Make sure the path to scp is in /etc/login.conf" >&2;} 34250echo "$as_me: WARNING: Make sure the path to scp is in /etc/login.conf" >&2;}
17710 else 34251 else
17711 if test ! -z "$external_path_file" ; then 34252 if test ! -z "$external_path_file" ; then
17712 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 34253 { echo "$as_me:$LINENO: WARNING:
17713If PATH is defined in $external_path_file, ensure the path to scp is included, 34254If PATH is defined in $external_path_file, ensure the path to scp is included,
17714otherwise scp will not work." >&5 34255otherwise scp will not work." >&5
17715$as_echo "$as_me: WARNING: 34256echo "$as_me: WARNING:
17716If PATH is defined in $external_path_file, ensure the path to scp is included, 34257If PATH is defined in $external_path_file, ensure the path to scp is included,
17717otherwise scp will not work." >&2;} 34258otherwise scp will not work." >&2;}
17718 fi 34259 fi
17719 if test "$cross_compiling" = yes; then : 34260 if test "$cross_compiling" = yes; then
17720 user_path="/usr/bin:/bin:/usr/sbin:/sbin" 34261 user_path="/usr/bin:/bin:/usr/sbin:/sbin"
17721 34262
17722else 34263else
17723 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 34264 cat >conftest.$ac_ext <<_ACEOF
34265/* confdefs.h. */
34266_ACEOF
34267cat confdefs.h >>conftest.$ac_ext
34268cat >>conftest.$ac_ext <<_ACEOF
17724/* end confdefs.h. */ 34269/* end confdefs.h. */
17725 34270
17726/* find out what STDPATH is */ 34271/* find out what STDPATH is */
@@ -17760,15 +34305,39 @@ main ()
17760 return 0; 34305 return 0;
17761} 34306}
17762_ACEOF 34307_ACEOF
17763if ac_fn_c_try_run "$LINENO"; then : 34308rm -f conftest$ac_exeext
34309if { (ac_try="$ac_link"
34310case "(($ac_try" in
34311 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
34312 *) ac_try_echo=$ac_try;;
34313esac
34314eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
34315 (eval "$ac_link") 2>&5
34316 ac_status=$?
34317 echo "$as_me:$LINENO: \$? = $ac_status" >&5
34318 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
34319 { (case "(($ac_try" in
34320 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
34321 *) ac_try_echo=$ac_try;;
34322esac
34323eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
34324 (eval "$ac_try") 2>&5
34325 ac_status=$?
34326 echo "$as_me:$LINENO: \$? = $ac_status" >&5
34327 (exit $ac_status); }; }; then
17764 user_path=`cat conftest.stdpath` 34328 user_path=`cat conftest.stdpath`
17765else 34329else
17766 user_path="/usr/bin:/bin:/usr/sbin:/sbin" 34330 echo "$as_me: program exited with status $ac_status" >&5
34331echo "$as_me: failed program was:" >&5
34332sed 's/^/| /' conftest.$ac_ext >&5
34333
34334( exit $ac_status )
34335 user_path="/usr/bin:/bin:/usr/sbin:/sbin"
17767fi 34336fi
17768rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 34337rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
17769 conftest.$ac_objext conftest.beam conftest.$ac_ext
17770fi 34338fi
17771 34339
34340
17772# make sure $bindir is in USER_PATH so scp will work 34341# make sure $bindir is in USER_PATH so scp will work
17773 t_bindir="${bindir}" 34342 t_bindir="${bindir}"
17774 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do 34343 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
@@ -17785,8 +34354,8 @@ fi
17785 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1 34354 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
17786 if test $? -ne 0 ; then 34355 if test $? -ne 0 ; then
17787 user_path=$user_path:$t_bindir 34356 user_path=$user_path:$t_bindir
17788 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Adding $t_bindir to USER_PATH so scp will work" >&5 34357 { echo "$as_me:$LINENO: result: Adding $t_bindir to USER_PATH so scp will work" >&5
17789$as_echo "Adding $t_bindir to USER_PATH so scp will work" >&6; } 34358echo "${ECHO_T}Adding $t_bindir to USER_PATH so scp will work" >&6; }
17790 fi 34359 fi
17791 fi 34360 fi
17792 fi 34361 fi
@@ -17805,7 +34374,7 @@ fi
17805# Set superuser path separately to user path 34374# Set superuser path separately to user path
17806 34375
17807# Check whether --with-superuser-path was given. 34376# Check whether --with-superuser-path was given.
17808if test "${with_superuser_path+set}" = set; then : 34377if test "${with_superuser_path+set}" = set; then
17809 withval=$with_superuser_path; 34378 withval=$with_superuser_path;
17810 if test -n "$withval" && test "x$withval" != "xno" && \ 34379 if test -n "$withval" && test "x$withval" != "xno" && \
17811 test "x${withval}" != "xyes"; then 34380 test "x${withval}" != "xyes"; then
@@ -17822,36 +34391,40 @@ fi
17822 34391
17823 34392
17824 34393
17825{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need to convert IPv4 in IPv6-mapped addresses" >&5 34394{ echo "$as_me:$LINENO: checking if we need to convert IPv4 in IPv6-mapped addresses" >&5
17826$as_echo_n "checking if we need to convert IPv4 in IPv6-mapped addresses... " >&6; } 34395echo $ECHO_N "checking if we need to convert IPv4 in IPv6-mapped addresses... $ECHO_C" >&6; }
17827IPV4_IN6_HACK_MSG="no" 34396IPV4_IN6_HACK_MSG="no"
17828 34397
17829# Check whether --with-4in6 was given. 34398# Check whether --with-4in6 was given.
17830if test "${with_4in6+set}" = set; then : 34399if test "${with_4in6+set}" = set; then
17831 withval=$with_4in6; 34400 withval=$with_4in6;
17832 if test "x$withval" != "xno" ; then 34401 if test "x$withval" != "xno" ; then
17833 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34402 { echo "$as_me:$LINENO: result: yes" >&5
17834$as_echo "yes" >&6; } 34403echo "${ECHO_T}yes" >&6; }
17835 34404
17836$as_echo "#define IPV4_IN_IPV6 1" >>confdefs.h 34405cat >>confdefs.h <<\_ACEOF
34406#define IPV4_IN_IPV6 1
34407_ACEOF
17837 34408
17838 IPV4_IN6_HACK_MSG="yes" 34409 IPV4_IN6_HACK_MSG="yes"
17839 else 34410 else
17840 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34411 { echo "$as_me:$LINENO: result: no" >&5
17841$as_echo "no" >&6; } 34412echo "${ECHO_T}no" >&6; }
17842 fi 34413 fi
17843 34414
17844else 34415else
17845 34416
17846 if test "x$inet6_default_4in6" = "xyes"; then 34417 if test "x$inet6_default_4in6" = "xyes"; then
17847 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 34418 { echo "$as_me:$LINENO: result: yes (default)" >&5
17848$as_echo "yes (default)" >&6; } 34419echo "${ECHO_T}yes (default)" >&6; }
17849 $as_echo "#define IPV4_IN_IPV6 1" >>confdefs.h 34420 cat >>confdefs.h <<\_ACEOF
34421#define IPV4_IN_IPV6 1
34422_ACEOF
17850 34423
17851 IPV4_IN6_HACK_MSG="yes" 34424 IPV4_IN6_HACK_MSG="yes"
17852 else 34425 else
17853 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (default)" >&5 34426 { echo "$as_me:$LINENO: result: no (default)" >&5
17854$as_echo "no (default)" >&6; } 34427echo "${ECHO_T}no (default)" >&6; }
17855 fi 34428 fi
17856 34429
17857 34430
@@ -17862,11 +34435,13 @@ fi
17862BSD_AUTH_MSG=no 34435BSD_AUTH_MSG=no
17863 34436
17864# Check whether --with-bsd-auth was given. 34437# Check whether --with-bsd-auth was given.
17865if test "${with_bsd_auth+set}" = set; then : 34438if test "${with_bsd_auth+set}" = set; then
17866 withval=$with_bsd_auth; 34439 withval=$with_bsd_auth;
17867 if test "x$withval" != "xno" ; then 34440 if test "x$withval" != "xno" ; then
17868 34441
17869$as_echo "#define BSD_AUTH 1" >>confdefs.h 34442cat >>confdefs.h <<\_ACEOF
34443#define BSD_AUTH 1
34444_ACEOF
17870 34445
17871 BSD_AUTH_MSG=yes 34446 BSD_AUTH_MSG=yes
17872 fi 34447 fi
@@ -17887,14 +34462,14 @@ fi
17887 34462
17888 34463
17889# Check whether --with-pid-dir was given. 34464# Check whether --with-pid-dir was given.
17890if test "${with_pid_dir+set}" = set; then : 34465if test "${with_pid_dir+set}" = set; then
17891 withval=$with_pid_dir; 34466 withval=$with_pid_dir;
17892 if test -n "$withval" && test "x$withval" != "xno" && \ 34467 if test -n "$withval" && test "x$withval" != "xno" && \
17893 test "x${withval}" != "xyes"; then 34468 test "x${withval}" != "xyes"; then
17894 piddir=$withval 34469 piddir=$withval
17895 if test ! -d $piddir ; then 34470 if test ! -d $piddir ; then
17896 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ** no $piddir directory on this system **" >&5 34471 { echo "$as_me:$LINENO: WARNING: ** no $piddir directory on this system **" >&5
17897$as_echo "$as_me: WARNING: ** no $piddir directory on this system **" >&2;} 34472echo "$as_me: WARNING: ** no $piddir directory on this system **" >&2;}
17898 fi 34473 fi
17899 fi 34474 fi
17900 34475
@@ -17910,10 +34485,12 @@ _ACEOF
17910 34485
17911 34486
17912# Check whether --enable-lastlog was given. 34487# Check whether --enable-lastlog was given.
17913if test "${enable_lastlog+set}" = set; then : 34488if test "${enable_lastlog+set}" = set; then
17914 enableval=$enable_lastlog; 34489 enableval=$enable_lastlog;
17915 if test "x$enableval" = "xno" ; then 34490 if test "x$enableval" = "xno" ; then
17916 $as_echo "#define DISABLE_LASTLOG 1" >>confdefs.h 34491 cat >>confdefs.h <<\_ACEOF
34492#define DISABLE_LASTLOG 1
34493_ACEOF
17917 34494
17918 fi 34495 fi
17919 34496
@@ -17921,10 +34498,12 @@ if test "${enable_lastlog+set}" = set; then :
17921fi 34498fi
17922 34499
17923# Check whether --enable-utmp was given. 34500# Check whether --enable-utmp was given.
17924if test "${enable_utmp+set}" = set; then : 34501if test "${enable_utmp+set}" = set; then
17925 enableval=$enable_utmp; 34502 enableval=$enable_utmp;
17926 if test "x$enableval" = "xno" ; then 34503 if test "x$enableval" = "xno" ; then
17927 $as_echo "#define DISABLE_UTMP 1" >>confdefs.h 34504 cat >>confdefs.h <<\_ACEOF
34505#define DISABLE_UTMP 1
34506_ACEOF
17928 34507
17929 fi 34508 fi
17930 34509
@@ -17932,11 +34511,13 @@ if test "${enable_utmp+set}" = set; then :
17932fi 34511fi
17933 34512
17934# Check whether --enable-utmpx was given. 34513# Check whether --enable-utmpx was given.
17935if test "${enable_utmpx+set}" = set; then : 34514if test "${enable_utmpx+set}" = set; then
17936 enableval=$enable_utmpx; 34515 enableval=$enable_utmpx;
17937 if test "x$enableval" = "xno" ; then 34516 if test "x$enableval" = "xno" ; then
17938 34517
17939$as_echo "#define DISABLE_UTMPX 1" >>confdefs.h 34518cat >>confdefs.h <<\_ACEOF
34519#define DISABLE_UTMPX 1
34520_ACEOF
17940 34521
17941 fi 34522 fi
17942 34523
@@ -17944,10 +34525,12 @@ $as_echo "#define DISABLE_UTMPX 1" >>confdefs.h
17944fi 34525fi
17945 34526
17946# Check whether --enable-wtmp was given. 34527# Check whether --enable-wtmp was given.
17947if test "${enable_wtmp+set}" = set; then : 34528if test "${enable_wtmp+set}" = set; then
17948 enableval=$enable_wtmp; 34529 enableval=$enable_wtmp;
17949 if test "x$enableval" = "xno" ; then 34530 if test "x$enableval" = "xno" ; then
17950 $as_echo "#define DISABLE_WTMP 1" >>confdefs.h 34531 cat >>confdefs.h <<\_ACEOF
34532#define DISABLE_WTMP 1
34533_ACEOF
17951 34534
17952 fi 34535 fi
17953 34536
@@ -17955,11 +34538,13 @@ if test "${enable_wtmp+set}" = set; then :
17955fi 34538fi
17956 34539
17957# Check whether --enable-wtmpx was given. 34540# Check whether --enable-wtmpx was given.
17958if test "${enable_wtmpx+set}" = set; then : 34541if test "${enable_wtmpx+set}" = set; then
17959 enableval=$enable_wtmpx; 34542 enableval=$enable_wtmpx;
17960 if test "x$enableval" = "xno" ; then 34543 if test "x$enableval" = "xno" ; then
17961 34544
17962$as_echo "#define DISABLE_WTMPX 1" >>confdefs.h 34545cat >>confdefs.h <<\_ACEOF
34546#define DISABLE_WTMPX 1
34547_ACEOF
17963 34548
17964 fi 34549 fi
17965 34550
@@ -17967,10 +34552,12 @@ $as_echo "#define DISABLE_WTMPX 1" >>confdefs.h
17967fi 34552fi
17968 34553
17969# Check whether --enable-libutil was given. 34554# Check whether --enable-libutil was given.
17970if test "${enable_libutil+set}" = set; then : 34555if test "${enable_libutil+set}" = set; then
17971 enableval=$enable_libutil; 34556 enableval=$enable_libutil;
17972 if test "x$enableval" = "xno" ; then 34557 if test "x$enableval" = "xno" ; then
17973 $as_echo "#define DISABLE_LOGIN 1" >>confdefs.h 34558 cat >>confdefs.h <<\_ACEOF
34559#define DISABLE_LOGIN 1
34560_ACEOF
17974 34561
17975 fi 34562 fi
17976 34563
@@ -17978,11 +34565,13 @@ if test "${enable_libutil+set}" = set; then :
17978fi 34565fi
17979 34566
17980# Check whether --enable-pututline was given. 34567# Check whether --enable-pututline was given.
17981if test "${enable_pututline+set}" = set; then : 34568if test "${enable_pututline+set}" = set; then
17982 enableval=$enable_pututline; 34569 enableval=$enable_pututline;
17983 if test "x$enableval" = "xno" ; then 34570 if test "x$enableval" = "xno" ; then
17984 34571
17985$as_echo "#define DISABLE_PUTUTLINE 1" >>confdefs.h 34572cat >>confdefs.h <<\_ACEOF
34573#define DISABLE_PUTUTLINE 1
34574_ACEOF
17986 34575
17987 fi 34576 fi
17988 34577
@@ -17990,11 +34579,13 @@ $as_echo "#define DISABLE_PUTUTLINE 1" >>confdefs.h
17990fi 34579fi
17991 34580
17992# Check whether --enable-pututxline was given. 34581# Check whether --enable-pututxline was given.
17993if test "${enable_pututxline+set}" = set; then : 34582if test "${enable_pututxline+set}" = set; then
17994 enableval=$enable_pututxline; 34583 enableval=$enable_pututxline;
17995 if test "x$enableval" = "xno" ; then 34584 if test "x$enableval" = "xno" ; then
17996 34585
17997$as_echo "#define DISABLE_PUTUTXLINE 1" >>confdefs.h 34586cat >>confdefs.h <<\_ACEOF
34587#define DISABLE_PUTUTXLINE 1
34588_ACEOF
17998 34589
17999 fi 34590 fi
18000 34591
@@ -18003,10 +34594,12 @@ fi
18003 34594
18004 34595
18005# Check whether --with-lastlog was given. 34596# Check whether --with-lastlog was given.
18006if test "${with_lastlog+set}" = set; then : 34597if test "${with_lastlog+set}" = set; then
18007 withval=$with_lastlog; 34598 withval=$with_lastlog;
18008 if test "x$withval" = "xno" ; then 34599 if test "x$withval" = "xno" ; then
18009 $as_echo "#define DISABLE_LASTLOG 1" >>confdefs.h 34600 cat >>confdefs.h <<\_ACEOF
34601#define DISABLE_LASTLOG 1
34602_ACEOF
18010 34603
18011 elif test -n "$withval" && test "x${withval}" != "xyes"; then 34604 elif test -n "$withval" && test "x${withval}" != "xyes"; then
18012 conf_lastlog_location=$withval 34605 conf_lastlog_location=$withval
@@ -18017,9 +34610,13 @@ fi
18017 34610
18018 34611
18019 34612
18020{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if your system defines LASTLOG_FILE" >&5 34613{ echo "$as_me:$LINENO: checking if your system defines LASTLOG_FILE" >&5
18021$as_echo_n "checking if your system defines LASTLOG_FILE... " >&6; } 34614echo $ECHO_N "checking if your system defines LASTLOG_FILE... $ECHO_C" >&6; }
18022cat confdefs.h - <<_ACEOF >conftest.$ac_ext 34615cat >conftest.$ac_ext <<_ACEOF
34616/* confdefs.h. */
34617_ACEOF
34618cat confdefs.h >>conftest.$ac_ext
34619cat >>conftest.$ac_ext <<_ACEOF
18023/* end confdefs.h. */ 34620/* end confdefs.h. */
18024 34621
18025#include <sys/types.h> 34622#include <sys/types.h>
@@ -18042,16 +34639,39 @@ main ()
18042 return 0; 34639 return 0;
18043} 34640}
18044_ACEOF 34641_ACEOF
18045if ac_fn_c_try_compile "$LINENO"; then : 34642rm -f conftest.$ac_objext
18046 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34643if { (ac_try="$ac_compile"
18047$as_echo "yes" >&6; } 34644case "(($ac_try" in
34645 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
34646 *) ac_try_echo=$ac_try;;
34647esac
34648eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
34649 (eval "$ac_compile") 2>conftest.er1
34650 ac_status=$?
34651 grep -v '^ *+' conftest.er1 >conftest.err
34652 rm -f conftest.er1
34653 cat conftest.err >&5
34654 echo "$as_me:$LINENO: \$? = $ac_status" >&5
34655 (exit $ac_status); } && {
34656 test -z "$ac_c_werror_flag" ||
34657 test ! -s conftest.err
34658 } && test -s conftest.$ac_objext; then
34659 { echo "$as_me:$LINENO: result: yes" >&5
34660echo "${ECHO_T}yes" >&6; }
18048else 34661else
34662 echo "$as_me: failed program was:" >&5
34663sed 's/^/| /' conftest.$ac_ext >&5
34664
18049 34665
18050 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34666 { echo "$as_me:$LINENO: result: no" >&5
18051$as_echo "no" >&6; } 34667echo "${ECHO_T}no" >&6; }
18052 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if your system defines _PATH_LASTLOG" >&5 34668 { echo "$as_me:$LINENO: checking if your system defines _PATH_LASTLOG" >&5
18053$as_echo_n "checking if your system defines _PATH_LASTLOG... " >&6; } 34669echo $ECHO_N "checking if your system defines _PATH_LASTLOG... $ECHO_C" >&6; }
18054 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 34670 cat >conftest.$ac_ext <<_ACEOF
34671/* confdefs.h. */
34672_ACEOF
34673cat confdefs.h >>conftest.$ac_ext
34674cat >>conftest.$ac_ext <<_ACEOF
18055/* end confdefs.h. */ 34675/* end confdefs.h. */
18056 34676
18057#include <sys/types.h> 34677#include <sys/types.h>
@@ -18071,19 +34691,40 @@ main ()
18071 return 0; 34691 return 0;
18072} 34692}
18073_ACEOF 34693_ACEOF
18074if ac_fn_c_try_compile "$LINENO"; then : 34694rm -f conftest.$ac_objext
18075 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34695if { (ac_try="$ac_compile"
18076$as_echo "yes" >&6; } 34696case "(($ac_try" in
34697 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
34698 *) ac_try_echo=$ac_try;;
34699esac
34700eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
34701 (eval "$ac_compile") 2>conftest.er1
34702 ac_status=$?
34703 grep -v '^ *+' conftest.er1 >conftest.err
34704 rm -f conftest.er1
34705 cat conftest.err >&5
34706 echo "$as_me:$LINENO: \$? = $ac_status" >&5
34707 (exit $ac_status); } && {
34708 test -z "$ac_c_werror_flag" ||
34709 test ! -s conftest.err
34710 } && test -s conftest.$ac_objext; then
34711 { echo "$as_me:$LINENO: result: yes" >&5
34712echo "${ECHO_T}yes" >&6; }
18077else 34713else
34714 echo "$as_me: failed program was:" >&5
34715sed 's/^/| /' conftest.$ac_ext >&5
18078 34716
18079 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34717
18080$as_echo "no" >&6; } 34718 { echo "$as_me:$LINENO: result: no" >&5
34719echo "${ECHO_T}no" >&6; }
18081 system_lastlog_path=no 34720 system_lastlog_path=no
18082 34721
18083fi 34722fi
34723
18084rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34724rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18085 34725
18086fi 34726fi
34727
18087rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34728rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18088 34729
18089if test -z "$conf_lastlog_location"; then 34730if test -z "$conf_lastlog_location"; then
@@ -18094,8 +34735,8 @@ if test -z "$conf_lastlog_location"; then
18094 fi 34735 fi
18095 done 34736 done
18096 if test -z "$conf_lastlog_location"; then 34737 if test -z "$conf_lastlog_location"; then
18097 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ** Cannot find lastlog **" >&5 34738 { echo "$as_me:$LINENO: WARNING: ** Cannot find lastlog **" >&5
18098$as_echo "$as_me: WARNING: ** Cannot find lastlog **" >&2;} 34739echo "$as_me: WARNING: ** Cannot find lastlog **" >&2;}
18099 fi 34740 fi
18100 fi 34741 fi
18101fi 34742fi
@@ -18108,9 +34749,13 @@ _ACEOF
18108 34749
18109fi 34750fi
18110 34751
18111{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if your system defines UTMP_FILE" >&5 34752{ echo "$as_me:$LINENO: checking if your system defines UTMP_FILE" >&5
18112$as_echo_n "checking if your system defines UTMP_FILE... " >&6; } 34753echo $ECHO_N "checking if your system defines UTMP_FILE... $ECHO_C" >&6; }
18113cat confdefs.h - <<_ACEOF >conftest.$ac_ext 34754cat >conftest.$ac_ext <<_ACEOF
34755/* confdefs.h. */
34756_ACEOF
34757cat confdefs.h >>conftest.$ac_ext
34758cat >>conftest.$ac_ext <<_ACEOF
18114/* end confdefs.h. */ 34759/* end confdefs.h. */
18115 34760
18116#include <sys/types.h> 34761#include <sys/types.h>
@@ -18127,15 +34772,35 @@ main ()
18127 return 0; 34772 return 0;
18128} 34773}
18129_ACEOF 34774_ACEOF
18130if ac_fn_c_try_compile "$LINENO"; then : 34775rm -f conftest.$ac_objext
18131 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34776if { (ac_try="$ac_compile"
18132$as_echo "yes" >&6; } 34777case "(($ac_try" in
34778 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
34779 *) ac_try_echo=$ac_try;;
34780esac
34781eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
34782 (eval "$ac_compile") 2>conftest.er1
34783 ac_status=$?
34784 grep -v '^ *+' conftest.er1 >conftest.err
34785 rm -f conftest.er1
34786 cat conftest.err >&5
34787 echo "$as_me:$LINENO: \$? = $ac_status" >&5
34788 (exit $ac_status); } && {
34789 test -z "$ac_c_werror_flag" ||
34790 test ! -s conftest.err
34791 } && test -s conftest.$ac_objext; then
34792 { echo "$as_me:$LINENO: result: yes" >&5
34793echo "${ECHO_T}yes" >&6; }
18133else 34794else
18134 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34795 echo "$as_me: failed program was:" >&5
18135$as_echo "no" >&6; } 34796sed 's/^/| /' conftest.$ac_ext >&5
34797
34798 { echo "$as_me:$LINENO: result: no" >&5
34799echo "${ECHO_T}no" >&6; }
18136 system_utmp_path=no 34800 system_utmp_path=no
18137 34801
18138fi 34802fi
34803
18139rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34804rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18140if test -z "$conf_utmp_location"; then 34805if test -z "$conf_utmp_location"; then
18141 if test x"$system_utmp_path" = x"no" ; then 34806 if test x"$system_utmp_path" = x"no" ; then
@@ -18145,7 +34810,9 @@ if test -z "$conf_utmp_location"; then
18145 fi 34810 fi
18146 done 34811 done
18147 if test -z "$conf_utmp_location"; then 34812 if test -z "$conf_utmp_location"; then
18148 $as_echo "#define DISABLE_UTMP 1" >>confdefs.h 34813 cat >>confdefs.h <<\_ACEOF
34814#define DISABLE_UTMP 1
34815_ACEOF
18149 34816
18150 fi 34817 fi
18151 fi 34818 fi
@@ -18158,9 +34825,13 @@ _ACEOF
18158 34825
18159fi 34826fi
18160 34827
18161{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if your system defines WTMP_FILE" >&5 34828{ echo "$as_me:$LINENO: checking if your system defines WTMP_FILE" >&5
18162$as_echo_n "checking if your system defines WTMP_FILE... " >&6; } 34829echo $ECHO_N "checking if your system defines WTMP_FILE... $ECHO_C" >&6; }
18163cat confdefs.h - <<_ACEOF >conftest.$ac_ext 34830cat >conftest.$ac_ext <<_ACEOF
34831/* confdefs.h. */
34832_ACEOF
34833cat confdefs.h >>conftest.$ac_ext
34834cat >>conftest.$ac_ext <<_ACEOF
18164/* end confdefs.h. */ 34835/* end confdefs.h. */
18165 34836
18166#include <sys/types.h> 34837#include <sys/types.h>
@@ -18177,15 +34848,35 @@ main ()
18177 return 0; 34848 return 0;
18178} 34849}
18179_ACEOF 34850_ACEOF
18180if ac_fn_c_try_compile "$LINENO"; then : 34851rm -f conftest.$ac_objext
18181 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34852if { (ac_try="$ac_compile"
18182$as_echo "yes" >&6; } 34853case "(($ac_try" in
34854 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
34855 *) ac_try_echo=$ac_try;;
34856esac
34857eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
34858 (eval "$ac_compile") 2>conftest.er1
34859 ac_status=$?
34860 grep -v '^ *+' conftest.er1 >conftest.err
34861 rm -f conftest.er1
34862 cat conftest.err >&5
34863 echo "$as_me:$LINENO: \$? = $ac_status" >&5
34864 (exit $ac_status); } && {
34865 test -z "$ac_c_werror_flag" ||
34866 test ! -s conftest.err
34867 } && test -s conftest.$ac_objext; then
34868 { echo "$as_me:$LINENO: result: yes" >&5
34869echo "${ECHO_T}yes" >&6; }
18183else 34870else
18184 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34871 echo "$as_me: failed program was:" >&5
18185$as_echo "no" >&6; } 34872sed 's/^/| /' conftest.$ac_ext >&5
34873
34874 { echo "$as_me:$LINENO: result: no" >&5
34875echo "${ECHO_T}no" >&6; }
18186 system_wtmp_path=no 34876 system_wtmp_path=no
18187 34877
18188fi 34878fi
34879
18189rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34880rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18190if test -z "$conf_wtmp_location"; then 34881if test -z "$conf_wtmp_location"; then
18191 if test x"$system_wtmp_path" = x"no" ; then 34882 if test x"$system_wtmp_path" = x"no" ; then
@@ -18195,7 +34886,9 @@ if test -z "$conf_wtmp_location"; then
18195 fi 34886 fi
18196 done 34887 done
18197 if test -z "$conf_wtmp_location"; then 34888 if test -z "$conf_wtmp_location"; then
18198 $as_echo "#define DISABLE_WTMP 1" >>confdefs.h 34889 cat >>confdefs.h <<\_ACEOF
34890#define DISABLE_WTMP 1
34891_ACEOF
18199 34892
18200 fi 34893 fi
18201 fi 34894 fi
@@ -18208,9 +34901,13 @@ _ACEOF
18208 34901
18209fi 34902fi
18210 34903
18211{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if your system defines WTMPX_FILE" >&5 34904{ echo "$as_me:$LINENO: checking if your system defines WTMPX_FILE" >&5
18212$as_echo_n "checking if your system defines WTMPX_FILE... " >&6; } 34905echo $ECHO_N "checking if your system defines WTMPX_FILE... $ECHO_C" >&6; }
18213cat confdefs.h - <<_ACEOF >conftest.$ac_ext 34906cat >conftest.$ac_ext <<_ACEOF
34907/* confdefs.h. */
34908_ACEOF
34909cat confdefs.h >>conftest.$ac_ext
34910cat >>conftest.$ac_ext <<_ACEOF
18214/* end confdefs.h. */ 34911/* end confdefs.h. */
18215 34912
18216#include <sys/types.h> 34913#include <sys/types.h>
@@ -18230,19 +34927,41 @@ main ()
18230 return 0; 34927 return 0;
18231} 34928}
18232_ACEOF 34929_ACEOF
18233if ac_fn_c_try_compile "$LINENO"; then : 34930rm -f conftest.$ac_objext
18234 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34931if { (ac_try="$ac_compile"
18235$as_echo "yes" >&6; } 34932case "(($ac_try" in
34933 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
34934 *) ac_try_echo=$ac_try;;
34935esac
34936eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
34937 (eval "$ac_compile") 2>conftest.er1
34938 ac_status=$?
34939 grep -v '^ *+' conftest.er1 >conftest.err
34940 rm -f conftest.er1
34941 cat conftest.err >&5
34942 echo "$as_me:$LINENO: \$? = $ac_status" >&5
34943 (exit $ac_status); } && {
34944 test -z "$ac_c_werror_flag" ||
34945 test ! -s conftest.err
34946 } && test -s conftest.$ac_objext; then
34947 { echo "$as_me:$LINENO: result: yes" >&5
34948echo "${ECHO_T}yes" >&6; }
18236else 34949else
18237 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34950 echo "$as_me: failed program was:" >&5
18238$as_echo "no" >&6; } 34951sed 's/^/| /' conftest.$ac_ext >&5
34952
34953 { echo "$as_me:$LINENO: result: no" >&5
34954echo "${ECHO_T}no" >&6; }
18239 system_wtmpx_path=no 34955 system_wtmpx_path=no
18240 34956
18241fi 34957fi
34958
18242rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34959rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18243if test -z "$conf_wtmpx_location"; then 34960if test -z "$conf_wtmpx_location"; then
18244 if test x"$system_wtmpx_path" = x"no" ; then 34961 if test x"$system_wtmpx_path" = x"no" ; then
18245 $as_echo "#define DISABLE_WTMPX 1" >>confdefs.h 34962 cat >>confdefs.h <<\_ACEOF
34963#define DISABLE_WTMPX 1
34964_ACEOF
18246 34965
18247 fi 34966 fi
18248else 34967else
@@ -18256,11 +34975,75 @@ fi
18256 34975
18257if test ! -z "$blibpath" ; then 34976if test ! -z "$blibpath" ; then
18258 LDFLAGS="$LDFLAGS $blibflags$blibpath" 34977 LDFLAGS="$LDFLAGS $blibflags$blibpath"
18259 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please check and edit blibpath in LDFLAGS in Makefile" >&5 34978 { echo "$as_me:$LINENO: WARNING: Please check and edit blibpath in LDFLAGS in Makefile" >&5
18260$as_echo "$as_me: WARNING: Please check and edit blibpath in LDFLAGS in Makefile" >&2;} 34979echo "$as_me: WARNING: Please check and edit blibpath in LDFLAGS in Makefile" >&2;}
18261fi 34980fi
18262 34981
18263ac_fn_c_check_member "$LINENO" "struct lastlog" "ll_line" "ac_cv_member_struct_lastlog_ll_line" " 34982{ echo "$as_me:$LINENO: checking for struct lastlog.ll_line" >&5
34983echo $ECHO_N "checking for struct lastlog.ll_line... $ECHO_C" >&6; }
34984if test "${ac_cv_member_struct_lastlog_ll_line+set}" = set; then
34985 echo $ECHO_N "(cached) $ECHO_C" >&6
34986else
34987 cat >conftest.$ac_ext <<_ACEOF
34988/* confdefs.h. */
34989_ACEOF
34990cat confdefs.h >>conftest.$ac_ext
34991cat >>conftest.$ac_ext <<_ACEOF
34992/* end confdefs.h. */
34993
34994#ifdef HAVE_SYS_TYPES_H
34995#include <sys/types.h>
34996#endif
34997#ifdef HAVE_UTMP_H
34998#include <utmp.h>
34999#endif
35000#ifdef HAVE_UTMPX_H
35001#include <utmpx.h>
35002#endif
35003#ifdef HAVE_LASTLOG_H
35004#include <lastlog.h>
35005#endif
35006
35007
35008int
35009main ()
35010{
35011static struct lastlog ac_aggr;
35012if (ac_aggr.ll_line)
35013return 0;
35014 ;
35015 return 0;
35016}
35017_ACEOF
35018rm -f conftest.$ac_objext
35019if { (ac_try="$ac_compile"
35020case "(($ac_try" in
35021 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
35022 *) ac_try_echo=$ac_try;;
35023esac
35024eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
35025 (eval "$ac_compile") 2>conftest.er1
35026 ac_status=$?
35027 grep -v '^ *+' conftest.er1 >conftest.err
35028 rm -f conftest.er1
35029 cat conftest.err >&5
35030 echo "$as_me:$LINENO: \$? = $ac_status" >&5
35031 (exit $ac_status); } && {
35032 test -z "$ac_c_werror_flag" ||
35033 test ! -s conftest.err
35034 } && test -s conftest.$ac_objext; then
35035 ac_cv_member_struct_lastlog_ll_line=yes
35036else
35037 echo "$as_me: failed program was:" >&5
35038sed 's/^/| /' conftest.$ac_ext >&5
35039
35040 cat >conftest.$ac_ext <<_ACEOF
35041/* confdefs.h. */
35042_ACEOF
35043cat confdefs.h >>conftest.$ac_ext
35044cat >>conftest.$ac_ext <<_ACEOF
35045/* end confdefs.h. */
35046
18264#ifdef HAVE_SYS_TYPES_H 35047#ifdef HAVE_SYS_TYPES_H
18265#include <sys/types.h> 35048#include <sys/types.h>
18266#endif 35049#endif
@@ -18274,20 +35057,128 @@ ac_fn_c_check_member "$LINENO" "struct lastlog" "ll_line" "ac_cv_member_struct_l
18274#include <lastlog.h> 35057#include <lastlog.h>
18275#endif 35058#endif
18276 35059
18277"
18278if test "x$ac_cv_member_struct_lastlog_ll_line" = xyes; then :
18279 35060
35061int
35062main ()
35063{
35064static struct lastlog ac_aggr;
35065if (sizeof ac_aggr.ll_line)
35066return 0;
35067 ;
35068 return 0;
35069}
35070_ACEOF
35071rm -f conftest.$ac_objext
35072if { (ac_try="$ac_compile"
35073case "(($ac_try" in
35074 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
35075 *) ac_try_echo=$ac_try;;
35076esac
35077eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
35078 (eval "$ac_compile") 2>conftest.er1
35079 ac_status=$?
35080 grep -v '^ *+' conftest.er1 >conftest.err
35081 rm -f conftest.er1
35082 cat conftest.err >&5
35083 echo "$as_me:$LINENO: \$? = $ac_status" >&5
35084 (exit $ac_status); } && {
35085 test -z "$ac_c_werror_flag" ||
35086 test ! -s conftest.err
35087 } && test -s conftest.$ac_objext; then
35088 ac_cv_member_struct_lastlog_ll_line=yes
35089else
35090 echo "$as_me: failed program was:" >&5
35091sed 's/^/| /' conftest.$ac_ext >&5
35092
35093 ac_cv_member_struct_lastlog_ll_line=no
35094fi
35095
35096rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
35097fi
35098
35099rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
35100fi
35101{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_lastlog_ll_line" >&5
35102echo "${ECHO_T}$ac_cv_member_struct_lastlog_ll_line" >&6; }
35103if test $ac_cv_member_struct_lastlog_ll_line = yes; then
35104 :
18280else 35105else
18281 35106
18282 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then 35107 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
18283 $as_echo "#define DISABLE_LASTLOG 1" >>confdefs.h 35108 cat >>confdefs.h <<\_ACEOF
35109#define DISABLE_LASTLOG 1
35110_ACEOF
18284 35111
18285 fi 35112 fi
18286 35113
18287fi 35114fi
18288 35115
18289 35116
18290ac_fn_c_check_member "$LINENO" "struct utmp" "ut_line" "ac_cv_member_struct_utmp_ut_line" " 35117{ echo "$as_me:$LINENO: checking for struct utmp.ut_line" >&5
35118echo $ECHO_N "checking for struct utmp.ut_line... $ECHO_C" >&6; }
35119if test "${ac_cv_member_struct_utmp_ut_line+set}" = set; then
35120 echo $ECHO_N "(cached) $ECHO_C" >&6
35121else
35122 cat >conftest.$ac_ext <<_ACEOF
35123/* confdefs.h. */
35124_ACEOF
35125cat confdefs.h >>conftest.$ac_ext
35126cat >>conftest.$ac_ext <<_ACEOF
35127/* end confdefs.h. */
35128
35129#ifdef HAVE_SYS_TYPES_H
35130#include <sys/types.h>
35131#endif
35132#ifdef HAVE_UTMP_H
35133#include <utmp.h>
35134#endif
35135#ifdef HAVE_UTMPX_H
35136#include <utmpx.h>
35137#endif
35138#ifdef HAVE_LASTLOG_H
35139#include <lastlog.h>
35140#endif
35141
35142
35143int
35144main ()
35145{
35146static struct utmp ac_aggr;
35147if (ac_aggr.ut_line)
35148return 0;
35149 ;
35150 return 0;
35151}
35152_ACEOF
35153rm -f conftest.$ac_objext
35154if { (ac_try="$ac_compile"
35155case "(($ac_try" in
35156 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
35157 *) ac_try_echo=$ac_try;;
35158esac
35159eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
35160 (eval "$ac_compile") 2>conftest.er1
35161 ac_status=$?
35162 grep -v '^ *+' conftest.er1 >conftest.err
35163 rm -f conftest.er1
35164 cat conftest.err >&5
35165 echo "$as_me:$LINENO: \$? = $ac_status" >&5
35166 (exit $ac_status); } && {
35167 test -z "$ac_c_werror_flag" ||
35168 test ! -s conftest.err
35169 } && test -s conftest.$ac_objext; then
35170 ac_cv_member_struct_utmp_ut_line=yes
35171else
35172 echo "$as_me: failed program was:" >&5
35173sed 's/^/| /' conftest.$ac_ext >&5
35174
35175 cat >conftest.$ac_ext <<_ACEOF
35176/* confdefs.h. */
35177_ACEOF
35178cat confdefs.h >>conftest.$ac_ext
35179cat >>conftest.$ac_ext <<_ACEOF
35180/* end confdefs.h. */
35181
18291#ifdef HAVE_SYS_TYPES_H 35182#ifdef HAVE_SYS_TYPES_H
18292#include <sys/types.h> 35183#include <sys/types.h>
18293#endif 35184#endif
@@ -18301,14 +35192,60 @@ ac_fn_c_check_member "$LINENO" "struct utmp" "ut_line" "ac_cv_member_struct_utmp
18301#include <lastlog.h> 35192#include <lastlog.h>
18302#endif 35193#endif
18303 35194
18304"
18305if test "x$ac_cv_member_struct_utmp_ut_line" = xyes; then :
18306 35195
35196int
35197main ()
35198{
35199static struct utmp ac_aggr;
35200if (sizeof ac_aggr.ut_line)
35201return 0;
35202 ;
35203 return 0;
35204}
35205_ACEOF
35206rm -f conftest.$ac_objext
35207if { (ac_try="$ac_compile"
35208case "(($ac_try" in
35209 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
35210 *) ac_try_echo=$ac_try;;
35211esac
35212eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
35213 (eval "$ac_compile") 2>conftest.er1
35214 ac_status=$?
35215 grep -v '^ *+' conftest.er1 >conftest.err
35216 rm -f conftest.er1
35217 cat conftest.err >&5
35218 echo "$as_me:$LINENO: \$? = $ac_status" >&5
35219 (exit $ac_status); } && {
35220 test -z "$ac_c_werror_flag" ||
35221 test ! -s conftest.err
35222 } && test -s conftest.$ac_objext; then
35223 ac_cv_member_struct_utmp_ut_line=yes
35224else
35225 echo "$as_me: failed program was:" >&5
35226sed 's/^/| /' conftest.$ac_ext >&5
35227
35228 ac_cv_member_struct_utmp_ut_line=no
35229fi
35230
35231rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
35232fi
35233
35234rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
35235fi
35236{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_utmp_ut_line" >&5
35237echo "${ECHO_T}$ac_cv_member_struct_utmp_ut_line" >&6; }
35238if test $ac_cv_member_struct_utmp_ut_line = yes; then
35239 :
18307else 35240else
18308 35241
18309 $as_echo "#define DISABLE_UTMP 1" >>confdefs.h 35242 cat >>confdefs.h <<\_ACEOF
35243#define DISABLE_UTMP 1
35244_ACEOF
18310 35245
18311 $as_echo "#define DISABLE_WTMP 1" >>confdefs.h 35246 cat >>confdefs.h <<\_ACEOF
35247#define DISABLE_WTMP 1
35248_ACEOF
18312 35249
18313 35250
18314fi 35251fi
@@ -18321,8 +35258,59 @@ if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
18321else 35258else
18322 TEST_SSH_IPV6=yes 35259 TEST_SSH_IPV6=yes
18323fi 35260fi
18324ac_fn_c_check_decl "$LINENO" "BROKEN_GETADDRINFO" "ac_cv_have_decl_BROKEN_GETADDRINFO" "$ac_includes_default" 35261{ echo "$as_me:$LINENO: checking whether BROKEN_GETADDRINFO is declared" >&5
18325if test "x$ac_cv_have_decl_BROKEN_GETADDRINFO" = xyes; then : 35262echo $ECHO_N "checking whether BROKEN_GETADDRINFO is declared... $ECHO_C" >&6; }
35263if test "${ac_cv_have_decl_BROKEN_GETADDRINFO+set}" = set; then
35264 echo $ECHO_N "(cached) $ECHO_C" >&6
35265else
35266 cat >conftest.$ac_ext <<_ACEOF
35267/* confdefs.h. */
35268_ACEOF
35269cat confdefs.h >>conftest.$ac_ext
35270cat >>conftest.$ac_ext <<_ACEOF
35271/* end confdefs.h. */
35272$ac_includes_default
35273int
35274main ()
35275{
35276#ifndef BROKEN_GETADDRINFO
35277 (void) BROKEN_GETADDRINFO;
35278#endif
35279
35280 ;
35281 return 0;
35282}
35283_ACEOF
35284rm -f conftest.$ac_objext
35285if { (ac_try="$ac_compile"
35286case "(($ac_try" in
35287 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
35288 *) ac_try_echo=$ac_try;;
35289esac
35290eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
35291 (eval "$ac_compile") 2>conftest.er1
35292 ac_status=$?
35293 grep -v '^ *+' conftest.er1 >conftest.err
35294 rm -f conftest.er1
35295 cat conftest.err >&5
35296 echo "$as_me:$LINENO: \$? = $ac_status" >&5
35297 (exit $ac_status); } && {
35298 test -z "$ac_c_werror_flag" ||
35299 test ! -s conftest.err
35300 } && test -s conftest.$ac_objext; then
35301 ac_cv_have_decl_BROKEN_GETADDRINFO=yes
35302else
35303 echo "$as_me: failed program was:" >&5
35304sed 's/^/| /' conftest.$ac_ext >&5
35305
35306 ac_cv_have_decl_BROKEN_GETADDRINFO=no
35307fi
35308
35309rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
35310fi
35311{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_BROKEN_GETADDRINFO" >&5
35312echo "${ECHO_T}$ac_cv_have_decl_BROKEN_GETADDRINFO" >&6; }
35313if test $ac_cv_have_decl_BROKEN_GETADDRINFO = yes; then
18326 TEST_SSH_IPV6=no 35314 TEST_SSH_IPV6=no
18327fi 35315fi
18328 35316
@@ -18363,13 +35351,12 @@ _ACEOF
18363 case $ac_val in #( 35351 case $ac_val in #(
18364 *${as_nl}*) 35352 *${as_nl}*)
18365 case $ac_var in #( 35353 case $ac_var in #(
18366 *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 35354 *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
18367$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; 35355echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
18368 esac 35356 esac
18369 case $ac_var in #( 35357 case $ac_var in #(
18370 _ | IFS | as_nl) ;; #( 35358 _ | IFS | as_nl) ;; #(
18371 BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( 35359 *) $as_unset $ac_var ;;
18372 *) { eval $ac_var=; unset $ac_var;} ;;
18373 esac ;; 35360 esac ;;
18374 esac 35361 esac
18375 done 35362 done
@@ -18377,8 +35364,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
18377 (set) 2>&1 | 35364 (set) 2>&1 |
18378 case $as_nl`(ac_space=' '; set) 2>&1` in #( 35365 case $as_nl`(ac_space=' '; set) 2>&1` in #(
18379 *${as_nl}ac_space=\ *) 35366 *${as_nl}ac_space=\ *)
18380 # `set' does not quote correctly, so add quotes: double-quote 35367 # `set' does not quote correctly, so add quotes (double-quote
18381 # substitution turns \\\\ into \\, and sed turns \\ into \. 35368 # substitution turns \\\\ into \\, and sed turns \\ into \).
18382 sed -n \ 35369 sed -n \
18383 "s/'/'\\\\''/g; 35370 "s/'/'\\\\''/g;
18384 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" 35371 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -18400,24 +35387,13 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
18400 :end' >>confcache 35387 :end' >>confcache
18401if diff "$cache_file" confcache >/dev/null 2>&1; then :; else 35388if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
18402 if test -w "$cache_file"; then 35389 if test -w "$cache_file"; then
18403 if test "x$cache_file" != "x/dev/null"; then 35390 test "x$cache_file" != "x/dev/null" &&
18404 { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 35391 { echo "$as_me:$LINENO: updating cache $cache_file" >&5
18405$as_echo "$as_me: updating cache $cache_file" >&6;} 35392echo "$as_me: updating cache $cache_file" >&6;}
18406 if test ! -f "$cache_file" || test -h "$cache_file"; then 35393 cat confcache >$cache_file
18407 cat confcache >"$cache_file"
18408 else
18409 case $cache_file in #(
18410 */* | ?:*)
18411 mv -f confcache "$cache_file"$$ &&
18412 mv -f "$cache_file"$$ "$cache_file" ;; #(
18413 *)
18414 mv -f confcache "$cache_file" ;;
18415 esac
18416 fi
18417 fi
18418 else 35394 else
18419 { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 35395 { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
18420$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} 35396echo "$as_me: not updating unwritable cache $cache_file" >&6;}
18421 fi 35397 fi
18422fi 35398fi
18423rm -f confcache 35399rm -f confcache
@@ -18430,15 +35406,14 @@ DEFS=-DHAVE_CONFIG_H
18430 35406
18431ac_libobjs= 35407ac_libobjs=
18432ac_ltlibobjs= 35408ac_ltlibobjs=
18433U=
18434for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue 35409for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
18435 # 1. Remove the extension, and $U if already installed. 35410 # 1. Remove the extension, and $U if already installed.
18436 ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' 35411 ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
18437 ac_i=`$as_echo "$ac_i" | sed "$ac_script"` 35412 ac_i=`echo "$ac_i" | sed "$ac_script"`
18438 # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR 35413 # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
18439 # will be set to the directory where LIBOBJS objects are built. 35414 # will be set to the directory where LIBOBJS objects are built.
18440 as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" 35415 ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
18441 as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' 35416 ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
18442done 35417done
18443LIBOBJS=$ac_libobjs 35418LIBOBJS=$ac_libobjs
18444 35419
@@ -18446,15 +35421,12 @@ LTLIBOBJS=$ac_ltlibobjs
18446 35421
18447 35422
18448 35423
18449 35424: ${CONFIG_STATUS=./config.status}
18450: "${CONFIG_STATUS=./config.status}"
18451ac_write_fail=0
18452ac_clean_files_save=$ac_clean_files 35425ac_clean_files_save=$ac_clean_files
18453ac_clean_files="$ac_clean_files $CONFIG_STATUS" 35426ac_clean_files="$ac_clean_files $CONFIG_STATUS"
18454{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 35427{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
18455$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} 35428echo "$as_me: creating $CONFIG_STATUS" >&6;}
18456as_write_fail=0 35429cat >$CONFIG_STATUS <<_ACEOF
18457cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
18458#! $SHELL 35430#! $SHELL
18459# Generated by $as_me. 35431# Generated by $as_me.
18460# Run this file to recreate the current configuration. 35432# Run this file to recreate the current configuration.
@@ -18464,79 +35436,59 @@ cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
18464debug=false 35436debug=false
18465ac_cs_recheck=false 35437ac_cs_recheck=false
18466ac_cs_silent=false 35438ac_cs_silent=false
18467
18468SHELL=\${CONFIG_SHELL-$SHELL} 35439SHELL=\${CONFIG_SHELL-$SHELL}
18469export SHELL 35440_ACEOF
18470_ASEOF 35441
18471cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 35442cat >>$CONFIG_STATUS <<\_ACEOF
18472## -------------------- ## 35443## --------------------- ##
18473## M4sh Initialization. ## 35444## M4sh Initialization. ##
18474## -------------------- ## 35445## --------------------- ##
18475 35446
18476# Be more Bourne compatible 35447# Be more Bourne compatible
18477DUALCASE=1; export DUALCASE # for MKS sh 35448DUALCASE=1; export DUALCASE # for MKS sh
18478if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : 35449if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
18479 emulate sh 35450 emulate sh
18480 NULLCMD=: 35451 NULLCMD=:
18481 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which 35452 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
18482 # is contrary to our usage. Disable this feature. 35453 # is contrary to our usage. Disable this feature.
18483 alias -g '${1+"$@"}'='"$@"' 35454 alias -g '${1+"$@"}'='"$@"'
18484 setopt NO_GLOB_SUBST 35455 setopt NO_GLOB_SUBST
18485else 35456else
18486 case `(set -o) 2>/dev/null` in #( 35457 case `(set -o) 2>/dev/null` in
18487 *posix*) : 35458 *posix*) set -o posix ;;
18488 set -o posix ;; #(
18489 *) :
18490 ;;
18491esac 35459esac
35460
18492fi 35461fi
18493 35462
18494 35463
18495as_nl=' 35464
18496' 35465
18497export as_nl 35466# PATH needs CR
18498# Printing a long string crashes Solaris 7 /usr/bin/printf. 35467# Avoid depending upon Character Ranges.
18499as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' 35468as_cr_letters='abcdefghijklmnopqrstuvwxyz'
18500as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo 35469as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
18501as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo 35470as_cr_Letters=$as_cr_letters$as_cr_LETTERS
18502# Prefer a ksh shell builtin over an external printf program on Solaris, 35471as_cr_digits='0123456789'
18503# but without wasting forks for bash or zsh. 35472as_cr_alnum=$as_cr_Letters$as_cr_digits
18504if test -z "$BASH_VERSION$ZSH_VERSION" \ 35473
18505 && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then 35474# The user is always right.
18506 as_echo='print -r --' 35475if test "${PATH_SEPARATOR+set}" != set; then
18507 as_echo_n='print -rn --' 35476 echo "#! /bin/sh" >conf$$.sh
18508elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then 35477 echo "exit 0" >>conf$$.sh
18509 as_echo='printf %s\n' 35478 chmod +x conf$$.sh
18510 as_echo_n='printf %s' 35479 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
18511else 35480 PATH_SEPARATOR=';'
18512 if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
18513 as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
18514 as_echo_n='/usr/ucb/echo -n'
18515 else 35481 else
18516 as_echo_body='eval expr "X$1" : "X\\(.*\\)"' 35482 PATH_SEPARATOR=:
18517 as_echo_n_body='eval
18518 arg=$1;
18519 case $arg in #(
18520 *"$as_nl"*)
18521 expr "X$arg" : "X\\(.*\\)$as_nl";
18522 arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
18523 esac;
18524 expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
18525 '
18526 export as_echo_n_body
18527 as_echo_n='sh -c $as_echo_n_body as_echo'
18528 fi 35483 fi
18529 export as_echo_body 35484 rm -f conf$$.sh
18530 as_echo='sh -c $as_echo_body as_echo'
18531fi 35485fi
18532 35486
18533# The user is always right. 35487# Support unset when possible.
18534if test "${PATH_SEPARATOR+set}" != set; then 35488if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
18535 PATH_SEPARATOR=: 35489 as_unset=unset
18536 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { 35490else
18537 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || 35491 as_unset=false
18538 PATH_SEPARATOR=';'
18539 }
18540fi 35492fi
18541 35493
18542 35494
@@ -18545,19 +35497,20 @@ fi
18545# there to prevent editors from complaining about space-tab. 35497# there to prevent editors from complaining about space-tab.
18546# (If _AS_PATH_WALK were called with IFS unset, it would disable word 35498# (If _AS_PATH_WALK were called with IFS unset, it would disable word
18547# splitting by setting IFS to empty value.) 35499# splitting by setting IFS to empty value.)
35500as_nl='
35501'
18548IFS=" "" $as_nl" 35502IFS=" "" $as_nl"
18549 35503
18550# Find who we are. Look in the path if we contain no directory separator. 35504# Find who we are. Look in the path if we contain no directory separator.
18551as_myself= 35505case $0 in
18552case $0 in #((
18553 *[\\/]* ) as_myself=$0 ;; 35506 *[\\/]* ) as_myself=$0 ;;
18554 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 35507 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
18555for as_dir in $PATH 35508for as_dir in $PATH
18556do 35509do
18557 IFS=$as_save_IFS 35510 IFS=$as_save_IFS
18558 test -z "$as_dir" && as_dir=. 35511 test -z "$as_dir" && as_dir=.
18559 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break 35512 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
18560 done 35513done
18561IFS=$as_save_IFS 35514IFS=$as_save_IFS
18562 35515
18563 ;; 35516 ;;
@@ -18568,111 +35521,32 @@ if test "x$as_myself" = x; then
18568 as_myself=$0 35521 as_myself=$0
18569fi 35522fi
18570if test ! -f "$as_myself"; then 35523if test ! -f "$as_myself"; then
18571 $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 35524 echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
18572 exit 1 35525 { (exit 1); exit 1; }
18573fi 35526fi
18574 35527
18575# Unset variables that we do not need and which cause bugs (e.g. in 35528# Work around bugs in pre-3.0 UWIN ksh.
18576# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" 35529for as_var in ENV MAIL MAILPATH
18577# suppresses any "Segmentation fault" message there. '((' could 35530do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
18578# trigger a bug in pdksh 5.2.14.
18579for as_var in BASH_ENV ENV MAIL MAILPATH
18580do eval test x\${$as_var+set} = xset \
18581 && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
18582done 35531done
18583PS1='$ ' 35532PS1='$ '
18584PS2='> ' 35533PS2='> '
18585PS4='+ ' 35534PS4='+ '
18586 35535
18587# NLS nuisances. 35536# NLS nuisances.
18588LC_ALL=C 35537for as_var in \
18589export LC_ALL 35538 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
18590LANGUAGE=C 35539 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
18591export LANGUAGE 35540 LC_TELEPHONE LC_TIME
18592 35541do
18593# CDPATH. 35542 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
18594(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 35543 eval $as_var=C; export $as_var
18595 35544 else
18596 35545 ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
18597# as_fn_error STATUS ERROR [LINENO LOG_FD]
18598# ----------------------------------------
18599# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
18600# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
18601# script with STATUS, using 1 if that was 0.
18602as_fn_error ()
18603{
18604 as_status=$1; test $as_status -eq 0 && as_status=1
18605 if test "$4"; then
18606 as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
18607 $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
18608 fi 35546 fi
18609 $as_echo "$as_me: error: $2" >&2 35547done
18610 as_fn_exit $as_status
18611} # as_fn_error
18612
18613
18614# as_fn_set_status STATUS
18615# -----------------------
18616# Set $? to STATUS, without forking.
18617as_fn_set_status ()
18618{
18619 return $1
18620} # as_fn_set_status
18621
18622# as_fn_exit STATUS
18623# -----------------
18624# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
18625as_fn_exit ()
18626{
18627 set +e
18628 as_fn_set_status $1
18629 exit $1
18630} # as_fn_exit
18631
18632# as_fn_unset VAR
18633# ---------------
18634# Portably unset VAR.
18635as_fn_unset ()
18636{
18637 { eval $1=; unset $1;}
18638}
18639as_unset=as_fn_unset
18640# as_fn_append VAR VALUE
18641# ----------------------
18642# Append the text in VALUE to the end of the definition contained in VAR. Take
18643# advantage of any shell optimizations that allow amortized linear growth over
18644# repeated appends, instead of the typical quadratic growth present in naive
18645# implementations.
18646if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
18647 eval 'as_fn_append ()
18648 {
18649 eval $1+=\$2
18650 }'
18651else
18652 as_fn_append ()
18653 {
18654 eval $1=\$$1\$2
18655 }
18656fi # as_fn_append
18657
18658# as_fn_arith ARG...
18659# ------------------
18660# Perform arithmetic evaluation on the ARGs, and store the result in the
18661# global $as_val. Take advantage of shells that can avoid forks. The arguments
18662# must be portable across $(()) and expr.
18663if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
18664 eval 'as_fn_arith ()
18665 {
18666 as_val=$(( $* ))
18667 }'
18668else
18669 as_fn_arith ()
18670 {
18671 as_val=`expr "$@" || test $? -eq 1`
18672 }
18673fi # as_fn_arith
18674
18675 35548
35549# Required to use basename.
18676if expr a : '\(a\)' >/dev/null 2>&1 && 35550if expr a : '\(a\)' >/dev/null 2>&1 &&
18677 test "X`expr 00001 : '.*\(...\)'`" = X001; then 35551 test "X`expr 00001 : '.*\(...\)'`" = X001; then
18678 as_expr=expr 35552 as_expr=expr
@@ -18686,17 +35560,13 @@ else
18686 as_basename=false 35560 as_basename=false
18687fi 35561fi
18688 35562
18689if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
18690 as_dirname=dirname
18691else
18692 as_dirname=false
18693fi
18694 35563
35564# Name of the executable.
18695as_me=`$as_basename -- "$0" || 35565as_me=`$as_basename -- "$0" ||
18696$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ 35566$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
18697 X"$0" : 'X\(//\)$' \| \ 35567 X"$0" : 'X\(//\)$' \| \
18698 X"$0" : 'X\(/\)' \| . 2>/dev/null || 35568 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
18699$as_echo X/"$0" | 35569echo X/"$0" |
18700 sed '/^.*\/\([^/][^/]*\)\/*$/{ 35570 sed '/^.*\/\([^/][^/]*\)\/*$/{
18701 s//\1/ 35571 s//\1/
18702 q 35572 q
@@ -18711,103 +35581,104 @@ $as_echo X/"$0" |
18711 } 35581 }
18712 s/.*/./; q'` 35582 s/.*/./; q'`
18713 35583
18714# Avoid depending upon Character Ranges. 35584# CDPATH.
18715as_cr_letters='abcdefghijklmnopqrstuvwxyz' 35585$as_unset CDPATH
18716as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' 35586
18717as_cr_Letters=$as_cr_letters$as_cr_LETTERS 35587
18718as_cr_digits='0123456789' 35588
18719as_cr_alnum=$as_cr_Letters$as_cr_digits 35589 as_lineno_1=$LINENO
35590 as_lineno_2=$LINENO
35591 test "x$as_lineno_1" != "x$as_lineno_2" &&
35592 test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
35593
35594 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
35595 # uniformly replaced by the line number. The first 'sed' inserts a
35596 # line-number line after each line using $LINENO; the second 'sed'
35597 # does the real work. The second script uses 'N' to pair each
35598 # line-number line with the line containing $LINENO, and appends
35599 # trailing '-' during substitution so that $LINENO is not a special
35600 # case at line end.
35601 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
35602 # scripts with optimization help from Paolo Bonzini. Blame Lee
35603 # E. McMahon (1931-1989) for sed's syntax. :-)
35604 sed -n '
35605 p
35606 /[$]LINENO/=
35607 ' <$as_myself |
35608 sed '
35609 s/[$]LINENO.*/&-/
35610 t lineno
35611 b
35612 :lineno
35613 N
35614 :loop
35615 s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
35616 t loop
35617 s/-\n.*//
35618 ' >$as_me.lineno &&
35619 chmod +x "$as_me.lineno" ||
35620 { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
35621 { (exit 1); exit 1; }; }
35622
35623 # Don't try to exec as it changes $[0], causing all sort of problems
35624 # (the dirname of $[0] is not the place where we might find the
35625 # original and so on. Autoconf is especially sensitive to this).
35626 . "./$as_me.lineno"
35627 # Exit status is that of the last command.
35628 exit
35629}
35630
35631
35632if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
35633 as_dirname=dirname
35634else
35635 as_dirname=false
35636fi
18720 35637
18721ECHO_C= ECHO_N= ECHO_T= 35638ECHO_C= ECHO_N= ECHO_T=
18722case `echo -n x` in #((((( 35639case `echo -n x` in
18723-n*) 35640-n*)
18724 case `echo 'xy\c'` in 35641 case `echo 'x\c'` in
18725 *c*) ECHO_T=' ';; # ECHO_T is single tab character. 35642 *c*) ECHO_T=' ';; # ECHO_T is single tab character.
18726 xy) ECHO_C='\c';; 35643 *) ECHO_C='\c';;
18727 *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
18728 ECHO_T=' ';;
18729 esac;; 35644 esac;;
18730*) 35645*)
18731 ECHO_N='-n';; 35646 ECHO_N='-n';;
18732esac 35647esac
18733 35648
35649if expr a : '\(a\)' >/dev/null 2>&1 &&
35650 test "X`expr 00001 : '.*\(...\)'`" = X001; then
35651 as_expr=expr
35652else
35653 as_expr=false
35654fi
35655
18734rm -f conf$$ conf$$.exe conf$$.file 35656rm -f conf$$ conf$$.exe conf$$.file
18735if test -d conf$$.dir; then 35657if test -d conf$$.dir; then
18736 rm -f conf$$.dir/conf$$.file 35658 rm -f conf$$.dir/conf$$.file
18737else 35659else
18738 rm -f conf$$.dir 35660 rm -f conf$$.dir
18739 mkdir conf$$.dir 2>/dev/null 35661 mkdir conf$$.dir
18740fi 35662fi
18741if (echo >conf$$.file) 2>/dev/null; then 35663echo >conf$$.file
18742 if ln -s conf$$.file conf$$ 2>/dev/null; then 35664if ln -s conf$$.file conf$$ 2>/dev/null; then
18743 as_ln_s='ln -s' 35665 as_ln_s='ln -s'
18744 # ... but there are two gotchas: 35666 # ... but there are two gotchas:
18745 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. 35667 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
18746 # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. 35668 # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
18747 # In both cases, we have to default to `cp -p'. 35669 # In both cases, we have to default to `cp -p'.
18748 ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || 35670 ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
18749 as_ln_s='cp -p'
18750 elif ln conf$$.file conf$$ 2>/dev/null; then
18751 as_ln_s=ln
18752 else
18753 as_ln_s='cp -p' 35671 as_ln_s='cp -p'
18754 fi 35672elif ln conf$$.file conf$$ 2>/dev/null; then
35673 as_ln_s=ln
18755else 35674else
18756 as_ln_s='cp -p' 35675 as_ln_s='cp -p'
18757fi 35676fi
18758rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file 35677rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
18759rmdir conf$$.dir 2>/dev/null 35678rmdir conf$$.dir 2>/dev/null
18760 35679
18761
18762# as_fn_mkdir_p
18763# -------------
18764# Create "$as_dir" as a directory, including parents if necessary.
18765as_fn_mkdir_p ()
18766{
18767
18768 case $as_dir in #(
18769 -*) as_dir=./$as_dir;;
18770 esac
18771 test -d "$as_dir" || eval $as_mkdir_p || {
18772 as_dirs=
18773 while :; do
18774 case $as_dir in #(
18775 *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
18776 *) as_qdir=$as_dir;;
18777 esac
18778 as_dirs="'$as_qdir' $as_dirs"
18779 as_dir=`$as_dirname -- "$as_dir" ||
18780$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
18781 X"$as_dir" : 'X\(//\)[^/]' \| \
18782 X"$as_dir" : 'X\(//\)$' \| \
18783 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
18784$as_echo X"$as_dir" |
18785 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
18786 s//\1/
18787 q
18788 }
18789 /^X\(\/\/\)[^/].*/{
18790 s//\1/
18791 q
18792 }
18793 /^X\(\/\/\)$/{
18794 s//\1/
18795 q
18796 }
18797 /^X\(\/\).*/{
18798 s//\1/
18799 q
18800 }
18801 s/.*/./; q'`
18802 test -d "$as_dir" && break
18803 done
18804 test -z "$as_dirs" || eval "mkdir $as_dirs"
18805 } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
18806
18807
18808} # as_fn_mkdir_p
18809if mkdir -p . 2>/dev/null; then 35680if mkdir -p . 2>/dev/null; then
18810 as_mkdir_p='mkdir -p "$as_dir"' 35681 as_mkdir_p=:
18811else 35682else
18812 test -d ./-p && rmdir ./-p 35683 test -d ./-p && rmdir ./-p
18813 as_mkdir_p=false 35684 as_mkdir_p=false
@@ -18824,12 +35695,12 @@ else
18824 as_test_x=' 35695 as_test_x='
18825 eval sh -c '\'' 35696 eval sh -c '\''
18826 if test -d "$1"; then 35697 if test -d "$1"; then
18827 test -d "$1/."; 35698 test -d "$1/.";
18828 else 35699 else
18829 case $1 in #( 35700 case $1 in
18830 -*)set "./$1";; 35701 -*)set "./$1";;
18831 esac; 35702 esac;
18832 case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( 35703 case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
18833 ???[sx]*):;;*)false;;esac;fi 35704 ???[sx]*):;;*)false;;esac;fi
18834 '\'' sh 35705 '\'' sh
18835 ' 35706 '
@@ -18844,19 +35715,13 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
18844 35715
18845 35716
18846exec 6>&1 35717exec 6>&1
18847## ----------------------------------- ##
18848## Main body of $CONFIG_STATUS script. ##
18849## ----------------------------------- ##
18850_ASEOF
18851test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
18852 35718
18853cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 35719# Save the log message, to keep $[0] and so on meaningful, and to
18854# Save the log message, to keep $0 and so on meaningful, and to
18855# report actual input values of CONFIG_FILES etc. instead of their 35720# report actual input values of CONFIG_FILES etc. instead of their
18856# values after options handling. 35721# values after options handling.
18857ac_log=" 35722ac_log="
18858This file was extended by OpenSSH $as_me Portable, which was 35723This file was extended by OpenSSH $as_me Portable, which was
18859generated by GNU Autoconf 2.68. Invocation command line was 35724generated by GNU Autoconf 2.61. Invocation command line was
18860 35725
18861 CONFIG_FILES = $CONFIG_FILES 35726 CONFIG_FILES = $CONFIG_FILES
18862 CONFIG_HEADERS = $CONFIG_HEADERS 35727 CONFIG_HEADERS = $CONFIG_HEADERS
@@ -18869,41 +35734,29 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q`
18869 35734
18870_ACEOF 35735_ACEOF
18871 35736
18872case $ac_config_files in *" 35737cat >>$CONFIG_STATUS <<_ACEOF
18873"*) set x $ac_config_files; shift; ac_config_files=$*;;
18874esac
18875
18876case $ac_config_headers in *"
18877"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
18878esac
18879
18880
18881cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
18882# Files that config.status was made for. 35738# Files that config.status was made for.
18883config_files="$ac_config_files" 35739config_files="$ac_config_files"
18884config_headers="$ac_config_headers" 35740config_headers="$ac_config_headers"
18885 35741
18886_ACEOF 35742_ACEOF
18887 35743
18888cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 35744cat >>$CONFIG_STATUS <<\_ACEOF
18889ac_cs_usage="\ 35745ac_cs_usage="\
18890\`$as_me' instantiates files and other configuration actions 35746\`$as_me' instantiates files from templates according to the
18891from templates according to the current configuration. Unless the files 35747current configuration.
18892and actions are specified as TAGs, all are instantiated by default.
18893 35748
18894Usage: $0 [OPTION]... [TAG]... 35749Usage: $0 [OPTIONS] [FILE]...
18895 35750
18896 -h, --help print this help, then exit 35751 -h, --help print this help, then exit
18897 -V, --version print version number and configuration settings, then exit 35752 -V, --version print version number and configuration settings, then exit
18898 --config print configuration, then exit 35753 -q, --quiet do not print progress messages
18899 -q, --quiet, --silent
18900 do not print progress messages
18901 -d, --debug don't remove temporary files 35754 -d, --debug don't remove temporary files
18902 --recheck update $as_me by reconfiguring in the same conditions 35755 --recheck update $as_me by reconfiguring in the same conditions
18903 --file=FILE[:TEMPLATE] 35756 --file=FILE[:TEMPLATE]
18904 instantiate the configuration file FILE 35757 instantiate the configuration file FILE
18905 --header=FILE[:TEMPLATE] 35758 --header=FILE[:TEMPLATE]
18906 instantiate the configuration header FILE 35759 instantiate the configuration header FILE
18907 35760
18908Configuration files: 35761Configuration files:
18909$config_files 35762$config_files
@@ -18911,43 +35764,36 @@ $config_files
18911Configuration headers: 35764Configuration headers:
18912$config_headers 35765$config_headers
18913 35766
18914Report bugs to <openssh-unix-dev@mindrot.org>." 35767Report bugs to <bug-autoconf@gnu.org>."
18915 35768
18916_ACEOF 35769_ACEOF
18917cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 35770cat >>$CONFIG_STATUS <<_ACEOF
18918ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
18919ac_cs_version="\\ 35771ac_cs_version="\\
18920OpenSSH config.status Portable 35772OpenSSH config.status Portable
18921configured by $0, generated by GNU Autoconf 2.68, 35773configured by $0, generated by GNU Autoconf 2.61,
18922 with options \\"\$ac_cs_config\\" 35774 with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
18923 35775
18924Copyright (C) 2010 Free Software Foundation, Inc. 35776Copyright (C) 2006 Free Software Foundation, Inc.
18925This config.status script is free software; the Free Software Foundation 35777This config.status script is free software; the Free Software Foundation
18926gives unlimited permission to copy, distribute and modify it." 35778gives unlimited permission to copy, distribute and modify it."
18927 35779
18928ac_pwd='$ac_pwd' 35780ac_pwd='$ac_pwd'
18929srcdir='$srcdir' 35781srcdir='$srcdir'
18930INSTALL='$INSTALL' 35782INSTALL='$INSTALL'
18931AWK='$AWK'
18932test -n "\$AWK" || AWK=awk
18933_ACEOF 35783_ACEOF
18934 35784
18935cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 35785cat >>$CONFIG_STATUS <<\_ACEOF
18936# The default lists apply if the user does not specify any file. 35786# If no file are specified by the user, then we need to provide default
35787# value. By we need to know if files were specified by the user.
18937ac_need_defaults=: 35788ac_need_defaults=:
18938while test $# != 0 35789while test $# != 0
18939do 35790do
18940 case $1 in 35791 case $1 in
18941 --*=?*) 35792 --*=*)
18942 ac_option=`expr "X$1" : 'X\([^=]*\)='` 35793 ac_option=`expr "X$1" : 'X\([^=]*\)='`
18943 ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` 35794 ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
18944 ac_shift=: 35795 ac_shift=:
18945 ;; 35796 ;;
18946 --*=)
18947 ac_option=`expr "X$1" : 'X\([^=]*\)='`
18948 ac_optarg=
18949 ac_shift=:
18950 ;;
18951 *) 35797 *)
18952 ac_option=$1 35798 ac_option=$1
18953 ac_optarg=$2 35799 ac_optarg=$2
@@ -18960,41 +35806,34 @@ do
18960 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) 35806 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
18961 ac_cs_recheck=: ;; 35807 ac_cs_recheck=: ;;
18962 --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) 35808 --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
18963 $as_echo "$ac_cs_version"; exit ;; 35809 echo "$ac_cs_version"; exit ;;
18964 --config | --confi | --conf | --con | --co | --c )
18965 $as_echo "$ac_cs_config"; exit ;;
18966 --debug | --debu | --deb | --de | --d | -d ) 35810 --debug | --debu | --deb | --de | --d | -d )
18967 debug=: ;; 35811 debug=: ;;
18968 --file | --fil | --fi | --f ) 35812 --file | --fil | --fi | --f )
18969 $ac_shift 35813 $ac_shift
18970 case $ac_optarg in 35814 CONFIG_FILES="$CONFIG_FILES $ac_optarg"
18971 *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
18972 '') as_fn_error $? "missing file argument" ;;
18973 esac
18974 as_fn_append CONFIG_FILES " '$ac_optarg'"
18975 ac_need_defaults=false;; 35815 ac_need_defaults=false;;
18976 --header | --heade | --head | --hea ) 35816 --header | --heade | --head | --hea )
18977 $ac_shift 35817 $ac_shift
18978 case $ac_optarg in 35818 CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
18979 *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
18980 esac
18981 as_fn_append CONFIG_HEADERS " '$ac_optarg'"
18982 ac_need_defaults=false;; 35819 ac_need_defaults=false;;
18983 --he | --h) 35820 --he | --h)
18984 # Conflict between --help and --header 35821 # Conflict between --help and --header
18985 as_fn_error $? "ambiguous option: \`$1' 35822 { echo "$as_me: error: ambiguous option: $1
18986Try \`$0 --help' for more information.";; 35823Try \`$0 --help' for more information." >&2
35824 { (exit 1); exit 1; }; };;
18987 --help | --hel | -h ) 35825 --help | --hel | -h )
18988 $as_echo "$ac_cs_usage"; exit ;; 35826 echo "$ac_cs_usage"; exit ;;
18989 -q | -quiet | --quiet | --quie | --qui | --qu | --q \ 35827 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
18990 | -silent | --silent | --silen | --sile | --sil | --si | --s) 35828 | -silent | --silent | --silen | --sile | --sil | --si | --s)
18991 ac_cs_silent=: ;; 35829 ac_cs_silent=: ;;
18992 35830
18993 # This is an error. 35831 # This is an error.
18994 -*) as_fn_error $? "unrecognized option: \`$1' 35832 -*) { echo "$as_me: error: unrecognized option: $1
18995Try \`$0 --help' for more information." ;; 35833Try \`$0 --help' for more information." >&2
35834 { (exit 1); exit 1; }; } ;;
18996 35835
18997 *) as_fn_append ac_config_targets " $1" 35836 *) ac_config_targets="$ac_config_targets $1"
18998 ac_need_defaults=false ;; 35837 ac_need_defaults=false ;;
18999 35838
19000 esac 35839 esac
@@ -19009,32 +35848,30 @@ if $ac_cs_silent; then
19009fi 35848fi
19010 35849
19011_ACEOF 35850_ACEOF
19012cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 35851cat >>$CONFIG_STATUS <<_ACEOF
19013if \$ac_cs_recheck; then 35852if \$ac_cs_recheck; then
19014 set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion 35853 echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
19015 shift 35854 CONFIG_SHELL=$SHELL
19016 \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
19017 CONFIG_SHELL='$SHELL'
19018 export CONFIG_SHELL 35855 export CONFIG_SHELL
19019 exec "\$@" 35856 exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
19020fi 35857fi
19021 35858
19022_ACEOF 35859_ACEOF
19023cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 35860cat >>$CONFIG_STATUS <<\_ACEOF
19024exec 5>>config.log 35861exec 5>>config.log
19025{ 35862{
19026 echo 35863 echo
19027 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX 35864 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
19028## Running $as_me. ## 35865## Running $as_me. ##
19029_ASBOX 35866_ASBOX
19030 $as_echo "$ac_log" 35867 echo "$ac_log"
19031} >&5 35868} >&5
19032 35869
19033_ACEOF 35870_ACEOF
19034cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 35871cat >>$CONFIG_STATUS <<_ACEOF
19035_ACEOF 35872_ACEOF
19036 35873
19037cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 35874cat >>$CONFIG_STATUS <<\_ACEOF
19038 35875
19039# Handling of arguments. 35876# Handling of arguments.
19040for ac_config_target in $ac_config_targets 35877for ac_config_target in $ac_config_targets
@@ -19049,7 +35886,9 @@ do
19049 "openbsd-compat/regress/Makefile") CONFIG_FILES="$CONFIG_FILES openbsd-compat/regress/Makefile" ;; 35886 "openbsd-compat/regress/Makefile") CONFIG_FILES="$CONFIG_FILES openbsd-compat/regress/Makefile" ;;
19050 "survey.sh") CONFIG_FILES="$CONFIG_FILES survey.sh" ;; 35887 "survey.sh") CONFIG_FILES="$CONFIG_FILES survey.sh" ;;
19051 35888
19052 *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; 35889 *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
35890echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
35891 { (exit 1); exit 1; }; };;
19053 esac 35892 esac
19054done 35893done
19055 35894
@@ -19071,302 +35910,255 @@ fi
19071# after its creation but before its name has been assigned to `$tmp'. 35910# after its creation but before its name has been assigned to `$tmp'.
19072$debug || 35911$debug ||
19073{ 35912{
19074 tmp= ac_tmp= 35913 tmp=
19075 trap 'exit_status=$? 35914 trap 'exit_status=$?
19076 : "${ac_tmp:=$tmp}" 35915 { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
19077 { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
19078' 0 35916' 0
19079 trap 'as_fn_exit 1' 1 2 13 15 35917 trap '{ (exit 1); exit 1; }' 1 2 13 15
19080} 35918}
19081# Create a (secure) tmp directory for tmp files. 35919# Create a (secure) tmp directory for tmp files.
19082 35920
19083{ 35921{
19084 tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && 35922 tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
19085 test -d "$tmp" 35923 test -n "$tmp" && test -d "$tmp"
19086} || 35924} ||
19087{ 35925{
19088 tmp=./conf$$-$RANDOM 35926 tmp=./conf$$-$RANDOM
19089 (umask 077 && mkdir "$tmp") 35927 (umask 077 && mkdir "$tmp")
19090} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 35928} ||
19091ac_tmp=$tmp 35929{
19092 35930 echo "$me: cannot create a temporary directory in ." >&2
19093# Set up the scripts for CONFIG_FILES section. 35931 { (exit 1); exit 1; }
19094# No need to generate them if there are no CONFIG_FILES. 35932}
19095# This happens for instance with `./config.status config.h'.
19096if test -n "$CONFIG_FILES"; then
19097 35933
35934#
35935# Set up the sed scripts for CONFIG_FILES section.
35936#
19098 35937
19099ac_cr=`echo X | tr X '\015'` 35938# No need to generate the scripts if there are no CONFIG_FILES.
19100# On cygwin, bash can eat \r inside `` if the user requested igncr. 35939# This happens for instance when ./config.status config.h
19101# But we know of no other shell where ac_cr would be empty at this 35940if test -n "$CONFIG_FILES"; then
19102# point, so we can use a bashism as a fallback.
19103if test "x$ac_cr" = x; then
19104 eval ac_cr=\$\'\\r\'
19105fi
19106ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
19107if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
19108 ac_cs_awk_cr='\\r'
19109else
19110 ac_cs_awk_cr=$ac_cr
19111fi
19112 35941
19113echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
19114_ACEOF 35942_ACEOF
19115 35943
19116 35944
19117{ 35945
19118 echo "cat >conf$$subs.awk <<_ACEOF" &&
19119 echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
19120 echo "_ACEOF"
19121} >conf$$subs.sh ||
19122 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
19123ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
19124ac_delim='%!_!# ' 35946ac_delim='%!_!# '
19125for ac_last_try in false false false false false :; do 35947for ac_last_try in false false false false false :; do
19126 . ./conf$$subs.sh || 35948 cat >conf$$subs.sed <<_ACEOF
19127 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 35949SHELL!$SHELL$ac_delim
19128 35950PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
19129 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` 35951PACKAGE_NAME!$PACKAGE_NAME$ac_delim
19130 if test $ac_delim_n = $ac_delim_num; then 35952PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
35953PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
35954PACKAGE_STRING!$PACKAGE_STRING$ac_delim
35955PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
35956exec_prefix!$exec_prefix$ac_delim
35957prefix!$prefix$ac_delim
35958program_transform_name!$program_transform_name$ac_delim
35959bindir!$bindir$ac_delim
35960sbindir!$sbindir$ac_delim
35961libexecdir!$libexecdir$ac_delim
35962datarootdir!$datarootdir$ac_delim
35963datadir!$datadir$ac_delim
35964sysconfdir!$sysconfdir$ac_delim
35965sharedstatedir!$sharedstatedir$ac_delim
35966localstatedir!$localstatedir$ac_delim
35967includedir!$includedir$ac_delim
35968oldincludedir!$oldincludedir$ac_delim
35969docdir!$docdir$ac_delim
35970infodir!$infodir$ac_delim
35971htmldir!$htmldir$ac_delim
35972dvidir!$dvidir$ac_delim
35973pdfdir!$pdfdir$ac_delim
35974psdir!$psdir$ac_delim
35975libdir!$libdir$ac_delim
35976localedir!$localedir$ac_delim
35977mandir!$mandir$ac_delim
35978DEFS!$DEFS$ac_delim
35979ECHO_C!$ECHO_C$ac_delim
35980ECHO_N!$ECHO_N$ac_delim
35981ECHO_T!$ECHO_T$ac_delim
35982LIBS!$LIBS$ac_delim
35983build_alias!$build_alias$ac_delim
35984host_alias!$host_alias$ac_delim
35985target_alias!$target_alias$ac_delim
35986CC!$CC$ac_delim
35987CFLAGS!$CFLAGS$ac_delim
35988LDFLAGS!$LDFLAGS$ac_delim
35989CPPFLAGS!$CPPFLAGS$ac_delim
35990ac_ct_CC!$ac_ct_CC$ac_delim
35991EXEEXT!$EXEEXT$ac_delim
35992OBJEXT!$OBJEXT$ac_delim
35993build!$build$ac_delim
35994build_cpu!$build_cpu$ac_delim
35995build_vendor!$build_vendor$ac_delim
35996build_os!$build_os$ac_delim
35997host!$host$ac_delim
35998host_cpu!$host_cpu$ac_delim
35999host_vendor!$host_vendor$ac_delim
36000host_os!$host_os$ac_delim
36001CPP!$CPP$ac_delim
36002GREP!$GREP$ac_delim
36003EGREP!$EGREP$ac_delim
36004AWK!$AWK$ac_delim
36005RANLIB!$RANLIB$ac_delim
36006INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
36007INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
36008INSTALL_DATA!$INSTALL_DATA$ac_delim
36009AR!$AR$ac_delim
36010CAT!$CAT$ac_delim
36011KILL!$KILL$ac_delim
36012PERL!$PERL$ac_delim
36013SED!$SED$ac_delim
36014ENT!$ENT$ac_delim
36015TEST_MINUS_S_SH!$TEST_MINUS_S_SH$ac_delim
36016SH!$SH$ac_delim
36017GROFF!$GROFF$ac_delim
36018NROFF!$NROFF$ac_delim
36019MANDOC!$MANDOC$ac_delim
36020TEST_SHELL!$TEST_SHELL$ac_delim
36021MANFMT!$MANFMT$ac_delim
36022PATH_GROUPADD_PROG!$PATH_GROUPADD_PROG$ac_delim
36023PATH_USERADD_PROG!$PATH_USERADD_PROG$ac_delim
36024MAKE_PACKAGE_SUPPORTED!$MAKE_PACKAGE_SUPPORTED$ac_delim
36025STARTUP_SCRIPT_SHELL!$STARTUP_SCRIPT_SHELL$ac_delim
36026LOGIN_PROGRAM_FALLBACK!$LOGIN_PROGRAM_FALLBACK$ac_delim
36027PATH_PASSWD_PROG!$PATH_PASSWD_PROG$ac_delim
36028LD!$LD$ac_delim
36029PKGCONFIG!$PKGCONFIG$ac_delim
36030LIBEDIT!$LIBEDIT$ac_delim
36031TEST_SSH_ECC!$TEST_SSH_ECC$ac_delim
36032COMMENT_OUT_ECC!$COMMENT_OUT_ECC$ac_delim
36033SSH_PRIVSEP_USER!$SSH_PRIVSEP_USER$ac_delim
36034SSHLIBS!$SSHLIBS$ac_delim
36035SSHDLIBS!$SSHDLIBS$ac_delim
36036KRB5CONF!$KRB5CONF$ac_delim
36037GSSLIBS!$GSSLIBS$ac_delim
36038K5LIBS!$K5LIBS$ac_delim
36039PRIVSEP_PATH!$PRIVSEP_PATH$ac_delim
36040xauth_path!$xauth_path$ac_delim
36041STRIP_OPT!$STRIP_OPT$ac_delim
36042XAUTH_PATH!$XAUTH_PATH$ac_delim
36043MANTYPE!$MANTYPE$ac_delim
36044mansubdir!$mansubdir$ac_delim
36045user_path!$user_path$ac_delim
36046_ACEOF
36047
36048 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
19131 break 36049 break
19132 elif $ac_last_try; then 36050 elif $ac_last_try; then
19133 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 36051 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
36052echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
36053 { (exit 1); exit 1; }; }
19134 else 36054 else
19135 ac_delim="$ac_delim!$ac_delim _$ac_delim!! " 36055 ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
19136 fi 36056 fi
19137done 36057done
19138rm -f conf$$subs.sh
19139
19140cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
19141cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
19142_ACEOF
19143sed -n '
19144h
19145s/^/S["/; s/!.*/"]=/
19146p
19147g
19148s/^[^!]*!//
19149:repl
19150t repl
19151s/'"$ac_delim"'$//
19152t delim
19153:nl
19154h
19155s/\(.\{148\}\)..*/\1/
19156t more1
19157s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
19158p
19159n
19160b repl
19161:more1
19162s/["\\]/\\&/g; s/^/"/; s/$/"\\/
19163p
19164g
19165s/.\{148\}//
19166t nl
19167:delim
19168h
19169s/\(.\{148\}\)..*/\1/
19170t more2
19171s/["\\]/\\&/g; s/^/"/; s/$/"/
19172p
19173b
19174:more2
19175s/["\\]/\\&/g; s/^/"/; s/$/"\\/
19176p
19177g
19178s/.\{148\}//
19179t delim
19180' <conf$$subs.awk | sed '
19181/^[^""]/{
19182 N
19183 s/\n//
19184}
19185' >>$CONFIG_STATUS || ac_write_fail=1
19186rm -f conf$$subs.awk
19187cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
19188_ACAWK
19189cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
19190 for (key in S) S_is_set[key] = 1
19191 FS = ""
19192
19193}
19194{
19195 line = $ 0
19196 nfields = split(line, field, "@")
19197 substed = 0
19198 len = length(field[1])
19199 for (i = 2; i < nfields; i++) {
19200 key = field[i]
19201 keylen = length(key)
19202 if (S_is_set[key]) {
19203 value = S[key]
19204 line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
19205 len += length(value) + length(field[++i])
19206 substed = 1
19207 } else
19208 len += 1 + keylen
19209 }
19210
19211 print line
19212}
19213
19214_ACAWK
19215_ACEOF
19216cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
19217if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
19218 sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
19219else
19220 cat
19221fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
19222 || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
19223_ACEOF
19224
19225# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
19226# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
19227# trailing colons and then remove the whole line if VPATH becomes empty
19228# (actually we leave an empty line to preserve line numbers).
19229if test "x$srcdir" = x.; then
19230 ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
19231h
19232s///
19233s/^/:/
19234s/[ ]*$/:/
19235s/:\$(srcdir):/:/g
19236s/:\${srcdir}:/:/g
19237s/:@srcdir@:/:/g
19238s/^:*//
19239s/:*$//
19240x
19241s/\(=[ ]*\).*/\1/
19242G
19243s/\n//
19244s/^[^=]*=[ ]*$//
19245}'
19246fi
19247 36058
19248cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 36059ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
19249fi # test -n "$CONFIG_FILES" 36060if test -n "$ac_eof"; then
36061 ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
36062 ac_eof=`expr $ac_eof + 1`
36063fi
19250 36064
19251# Set up the scripts for CONFIG_HEADERS section. 36065cat >>$CONFIG_STATUS <<_ACEOF
19252# No need to generate them if there are no CONFIG_HEADERS. 36066cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
19253# This happens for instance with `./config.status Makefile'. 36067/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
19254if test -n "$CONFIG_HEADERS"; then 36068_ACEOF
19255cat >"$ac_tmp/defines.awk" <<\_ACAWK || 36069sed '
19256BEGIN { 36070s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
36071s/^/s,@/; s/!/@,|#_!!_#|/
36072:n
36073t n
36074s/'"$ac_delim"'$/,g/; t
36075s/$/\\/; p
36076N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
36077' >>$CONFIG_STATUS <conf$$subs.sed
36078rm -f conf$$subs.sed
36079cat >>$CONFIG_STATUS <<_ACEOF
36080CEOF$ac_eof
19257_ACEOF 36081_ACEOF
19258 36082
19259# Transform confdefs.h into an awk script `defines.awk', embedded as
19260# here-document in config.status, that substitutes the proper values into
19261# config.h.in to produce config.h.
19262 36083
19263# Create a delimiter string that does not exist in confdefs.h, to ease
19264# handling of long lines.
19265ac_delim='%!_!# ' 36084ac_delim='%!_!# '
19266for ac_last_try in false false :; do 36085for ac_last_try in false false false false false :; do
19267 ac_tt=`sed -n "/$ac_delim/p" confdefs.h` 36086 cat >conf$$subs.sed <<_ACEOF
19268 if test -z "$ac_tt"; then 36087piddir!$piddir$ac_delim
36088TEST_SSH_IPV6!$TEST_SSH_IPV6$ac_delim
36089TEST_MALLOC_OPTIONS!$TEST_MALLOC_OPTIONS$ac_delim
36090UNSUPPORTED_ALGORITHMS!$UNSUPPORTED_ALGORITHMS$ac_delim
36091LIBOBJS!$LIBOBJS$ac_delim
36092LTLIBOBJS!$LTLIBOBJS$ac_delim
36093_ACEOF
36094
36095 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 6; then
19269 break 36096 break
19270 elif $ac_last_try; then 36097 elif $ac_last_try; then
19271 as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 36098 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
36099echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
36100 { (exit 1); exit 1; }; }
19272 else 36101 else
19273 ac_delim="$ac_delim!$ac_delim _$ac_delim!! " 36102 ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
19274 fi 36103 fi
19275done 36104done
19276 36105
19277# For the awk script, D is an array of macro values keyed by name, 36106ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
19278# likewise P contains macro parameters if any. Preserve backslash 36107if test -n "$ac_eof"; then
19279# newline sequences. 36108 ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
36109 ac_eof=`expr $ac_eof + 1`
36110fi
19280 36111
19281ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* 36112cat >>$CONFIG_STATUS <<_ACEOF
19282sed -n ' 36113cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
19283s/.\{148\}/&'"$ac_delim"'/g 36114/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
19284t rset 36115_ACEOF
19285:rset 36116sed '
19286s/^[ ]*#[ ]*define[ ][ ]*/ / 36117s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
19287t def 36118s/^/s,@/; s/!/@,|#_!!_#|/
19288d 36119:n
19289:def 36120t n
19290s/\\$// 36121s/'"$ac_delim"'$/,g/; t
19291t bsnl 36122s/$/\\/; p
19292s/["\\]/\\&/g 36123N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
19293s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ 36124' >>$CONFIG_STATUS <conf$$subs.sed
19294D["\1"]=" \3"/p 36125rm -f conf$$subs.sed
19295s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p 36126cat >>$CONFIG_STATUS <<_ACEOF
19296d 36127:end
19297:bsnl 36128s/|#_!!_#|//g
19298s/["\\]/\\&/g 36129CEOF$ac_eof
19299s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
19300D["\1"]=" \3\\\\\\n"\\/p
19301t cont
19302s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
19303t cont
19304d
19305:cont
19306n
19307s/.\{148\}/&'"$ac_delim"'/g
19308t clear
19309:clear
19310s/\\$//
19311t bsnlc
19312s/["\\]/\\&/g; s/^/"/; s/$/"/p
19313d
19314:bsnlc
19315s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
19316b cont
19317' <confdefs.h | sed '
19318s/'"$ac_delim"'/"\\\
19319"/g' >>$CONFIG_STATUS || ac_write_fail=1
19320
19321cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
19322 for (key in D) D_is_set[key] = 1
19323 FS = ""
19324}
19325/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
19326 line = \$ 0
19327 split(line, arg, " ")
19328 if (arg[1] == "#") {
19329 defundef = arg[2]
19330 mac1 = arg[3]
19331 } else {
19332 defundef = substr(arg[1], 2)
19333 mac1 = arg[2]
19334 }
19335 split(mac1, mac2, "(") #)
19336 macro = mac2[1]
19337 prefix = substr(line, 1, index(line, defundef) - 1)
19338 if (D_is_set[macro]) {
19339 # Preserve the white space surrounding the "#".
19340 print prefix "define", macro P[macro] D[macro]
19341 next
19342 } else {
19343 # Replace #undef with comments. This is necessary, for example,
19344 # in the case of _POSIX_SOURCE, which is predefined and required
19345 # on some systems where configure will not decide to define it.
19346 if (defundef == "undef") {
19347 print "/*", prefix defundef, macro, "*/"
19348 next
19349 }
19350 }
19351}
19352{ print }
19353_ACAWK
19354_ACEOF 36130_ACEOF
19355cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
19356 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
19357fi # test -n "$CONFIG_HEADERS"
19358 36131
19359 36132
19360eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " 36133# VPATH may cause trouble with some makes, so we remove $(srcdir),
19361shift 36134# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
19362for ac_tag 36135# trailing colons and then remove the whole line if VPATH becomes empty
36136# (actually we leave an empty line to preserve line numbers).
36137if test "x$srcdir" = x.; then
36138 ac_vpsub='/^[ ]*VPATH[ ]*=/{
36139s/:*\$(srcdir):*/:/
36140s/:*\${srcdir}:*/:/
36141s/:*@srcdir@:*/:/
36142s/^\([^=]*=[ ]*\):*/\1/
36143s/:*$//
36144s/^[^=]*=[ ]*$//
36145}'
36146fi
36147
36148cat >>$CONFIG_STATUS <<\_ACEOF
36149fi # test -n "$CONFIG_FILES"
36150
36151
36152for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS
19363do 36153do
19364 case $ac_tag in 36154 case $ac_tag in
19365 :[FHLC]) ac_mode=$ac_tag; continue;; 36155 :[FHLC]) ac_mode=$ac_tag; continue;;
19366 esac 36156 esac
19367 case $ac_mode$ac_tag in 36157 case $ac_mode$ac_tag in
19368 :[FHL]*:*);; 36158 :[FHL]*:*);;
19369 :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; 36159 :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
36160echo "$as_me: error: Invalid tag $ac_tag." >&2;}
36161 { (exit 1); exit 1; }; };;
19370 :[FH]-) ac_tag=-:-;; 36162 :[FH]-) ac_tag=-:-;;
19371 :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; 36163 :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
19372 esac 36164 esac
@@ -19385,7 +36177,7 @@ do
19385 for ac_f 36177 for ac_f
19386 do 36178 do
19387 case $ac_f in 36179 case $ac_f in
19388 -) ac_f="$ac_tmp/stdin";; 36180 -) ac_f="$tmp/stdin";;
19389 *) # Look for the file first in the build tree, then in the source tree 36181 *) # Look for the file first in the build tree, then in the source tree
19390 # (if the path is not absolute). The absolute path cannot be DOS-style, 36182 # (if the path is not absolute). The absolute path cannot be DOS-style,
19391 # because $ac_f cannot contain `:'. 36183 # because $ac_f cannot contain `:'.
@@ -19394,34 +36186,26 @@ do
19394 [\\/$]*) false;; 36186 [\\/$]*) false;;
19395 *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; 36187 *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
19396 esac || 36188 esac ||
19397 as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; 36189 { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
36190echo "$as_me: error: cannot find input file: $ac_f" >&2;}
36191 { (exit 1); exit 1; }; };;
19398 esac 36192 esac
19399 case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac 36193 ac_file_inputs="$ac_file_inputs $ac_f"
19400 as_fn_append ac_file_inputs " '$ac_f'"
19401 done 36194 done
19402 36195
19403 # Let's still pretend it is `configure' which instantiates (i.e., don't 36196 # Let's still pretend it is `configure' which instantiates (i.e., don't
19404 # use $as_me), people would be surprised to read: 36197 # use $as_me), people would be surprised to read:
19405 # /* config.h. Generated by config.status. */ 36198 # /* config.h. Generated by config.status. */
19406 configure_input='Generated from '` 36199 configure_input="Generated from "`IFS=:
19407 $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' 36200 echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
19408 `' by configure.'
19409 if test x"$ac_file" != x-; then 36201 if test x"$ac_file" != x-; then
19410 configure_input="$ac_file. $configure_input" 36202 configure_input="$ac_file. $configure_input"
19411 { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 36203 { echo "$as_me:$LINENO: creating $ac_file" >&5
19412$as_echo "$as_me: creating $ac_file" >&6;} 36204echo "$as_me: creating $ac_file" >&6;}
19413 fi 36205 fi
19414 # Neutralize special characters interpreted by sed in replacement strings.
19415 case $configure_input in #(
19416 *\&* | *\|* | *\\* )
19417 ac_sed_conf_input=`$as_echo "$configure_input" |
19418 sed 's/[\\\\&|]/\\\\&/g'`;; #(
19419 *) ac_sed_conf_input=$configure_input;;
19420 esac
19421 36206
19422 case $ac_tag in 36207 case $ac_tag in
19423 *:-:* | *:-) cat >"$ac_tmp/stdin" \ 36208 *:-:* | *:-) cat >"$tmp/stdin";;
19424 || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
19425 esac 36209 esac
19426 ;; 36210 ;;
19427 esac 36211 esac
@@ -19431,7 +36215,42 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
19431 X"$ac_file" : 'X\(//\)[^/]' \| \ 36215 X"$ac_file" : 'X\(//\)[^/]' \| \
19432 X"$ac_file" : 'X\(//\)$' \| \ 36216 X"$ac_file" : 'X\(//\)$' \| \
19433 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || 36217 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
19434$as_echo X"$ac_file" | 36218echo X"$ac_file" |
36219 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
36220 s//\1/
36221 q
36222 }
36223 /^X\(\/\/\)[^/].*/{
36224 s//\1/
36225 q
36226 }
36227 /^X\(\/\/\)$/{
36228 s//\1/
36229 q
36230 }
36231 /^X\(\/\).*/{
36232 s//\1/
36233 q
36234 }
36235 s/.*/./; q'`
36236 { as_dir="$ac_dir"
36237 case $as_dir in #(
36238 -*) as_dir=./$as_dir;;
36239 esac
36240 test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
36241 as_dirs=
36242 while :; do
36243 case $as_dir in #(
36244 *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
36245 *) as_qdir=$as_dir;;
36246 esac
36247 as_dirs="'$as_qdir' $as_dirs"
36248 as_dir=`$as_dirname -- "$as_dir" ||
36249$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
36250 X"$as_dir" : 'X\(//\)[^/]' \| \
36251 X"$as_dir" : 'X\(//\)$' \| \
36252 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
36253echo X"$as_dir" |
19435 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ 36254 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
19436 s//\1/ 36255 s//\1/
19437 q 36256 q
@@ -19449,15 +36268,20 @@ $as_echo X"$ac_file" |
19449 q 36268 q
19450 } 36269 }
19451 s/.*/./; q'` 36270 s/.*/./; q'`
19452 as_dir="$ac_dir"; as_fn_mkdir_p 36271 test -d "$as_dir" && break
36272 done
36273 test -z "$as_dirs" || eval "mkdir $as_dirs"
36274 } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
36275echo "$as_me: error: cannot create directory $as_dir" >&2;}
36276 { (exit 1); exit 1; }; }; }
19453 ac_builddir=. 36277 ac_builddir=.
19454 36278
19455case "$ac_dir" in 36279case "$ac_dir" in
19456.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; 36280.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
19457*) 36281*)
19458 ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` 36282 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
19459 # A ".." for each directory in $ac_dir_suffix. 36283 # A ".." for each directory in $ac_dir_suffix.
19460 ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` 36284 ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
19461 case $ac_top_builddir_sub in 36285 case $ac_top_builddir_sub in
19462 "") ac_top_builddir_sub=. ac_top_build_prefix= ;; 36286 "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
19463 *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; 36287 *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -19497,12 +36321,12 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
19497 esac 36321 esac
19498_ACEOF 36322_ACEOF
19499 36323
19500cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 36324cat >>$CONFIG_STATUS <<\_ACEOF
19501# If the template does not know about datarootdir, expand it. 36325# If the template does not know about datarootdir, expand it.
19502# FIXME: This hack should be removed a few years after 2.60. 36326# FIXME: This hack should be removed a few years after 2.60.
19503ac_datarootdir_hack=; ac_datarootdir_seen= 36327ac_datarootdir_hack=; ac_datarootdir_seen=
19504ac_sed_dataroot=' 36328
19505/datarootdir/ { 36329case `sed -n '/datarootdir/ {
19506 p 36330 p
19507 q 36331 q
19508} 36332}
@@ -19510,37 +36334,36 @@ ac_sed_dataroot='
19510/@docdir@/p 36334/@docdir@/p
19511/@infodir@/p 36335/@infodir@/p
19512/@localedir@/p 36336/@localedir@/p
19513/@mandir@/p' 36337/@mandir@/p
19514case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in 36338' $ac_file_inputs` in
19515*datarootdir*) ac_datarootdir_seen=yes;; 36339*datarootdir*) ac_datarootdir_seen=yes;;
19516*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) 36340*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
19517 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 36341 { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
19518$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} 36342echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
19519_ACEOF 36343_ACEOF
19520cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 36344cat >>$CONFIG_STATUS <<_ACEOF
19521 ac_datarootdir_hack=' 36345 ac_datarootdir_hack='
19522 s&@datadir@&$datadir&g 36346 s&@datadir@&$datadir&g
19523 s&@docdir@&$docdir&g 36347 s&@docdir@&$docdir&g
19524 s&@infodir@&$infodir&g 36348 s&@infodir@&$infodir&g
19525 s&@localedir@&$localedir&g 36349 s&@localedir@&$localedir&g
19526 s&@mandir@&$mandir&g 36350 s&@mandir@&$mandir&g
19527 s&\\\${datarootdir}&$datarootdir&g' ;; 36351 s&\\\${datarootdir}&$datarootdir&g' ;;
19528esac 36352esac
19529_ACEOF 36353_ACEOF
19530 36354
19531# Neutralize VPATH when `$srcdir' = `.'. 36355# Neutralize VPATH when `$srcdir' = `.'.
19532# Shell code in configure.ac might set extrasub. 36356# Shell code in configure.ac might set extrasub.
19533# FIXME: do we really want to maintain this feature? 36357# FIXME: do we really want to maintain this feature?
19534cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 36358cat >>$CONFIG_STATUS <<_ACEOF
19535ac_sed_extra="$ac_vpsub 36359 sed "$ac_vpsub
19536$extrasub 36360$extrasub
19537_ACEOF 36361_ACEOF
19538cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 36362cat >>$CONFIG_STATUS <<\_ACEOF
19539:t 36363:t
19540/@[a-zA-Z_][a-zA-Z_0-9]*@/!b 36364/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
19541s|@configure_input@|$ac_sed_conf_input|;t t 36365s&@configure_input@&$configure_input&;t t
19542s&@top_builddir@&$ac_top_builddir_sub&;t t 36366s&@top_builddir@&$ac_top_builddir_sub&;t t
19543s&@top_build_prefix@&$ac_top_build_prefix&;t t
19544s&@srcdir@&$ac_srcdir&;t t 36367s&@srcdir@&$ac_srcdir&;t t
19545s&@abs_srcdir@&$ac_abs_srcdir&;t t 36368s&@abs_srcdir@&$ac_abs_srcdir&;t t
19546s&@top_srcdir@&$ac_top_srcdir&;t t 36369s&@top_srcdir@&$ac_top_srcdir&;t t
@@ -19550,49 +36373,119 @@ s&@abs_builddir@&$ac_abs_builddir&;t t
19550s&@abs_top_builddir@&$ac_abs_top_builddir&;t t 36373s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
19551s&@INSTALL@&$ac_INSTALL&;t t 36374s&@INSTALL@&$ac_INSTALL&;t t
19552$ac_datarootdir_hack 36375$ac_datarootdir_hack
19553" 36376" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
19554eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
19555 >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
19556 36377
19557test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && 36378test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
19558 { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && 36379 { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
19559 { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ 36380 { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
19560 "$ac_tmp/out"`; test -z "$ac_out"; } && 36381 { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
19561 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' 36382which seems to be undefined. Please make sure it is defined." >&5
19562which seems to be undefined. Please make sure it is defined" >&5 36383echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
19563$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' 36384which seems to be undefined. Please make sure it is defined." >&2;}
19564which seems to be undefined. Please make sure it is defined" >&2;} 36385
19565 36386 rm -f "$tmp/stdin"
19566 rm -f "$ac_tmp/stdin"
19567 case $ac_file in 36387 case $ac_file in
19568 -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; 36388 -) cat "$tmp/out"; rm -f "$tmp/out";;
19569 *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; 36389 *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
19570 esac \ 36390 esac
19571 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
19572 ;; 36391 ;;
19573 :H) 36392 :H)
19574 # 36393 #
19575 # CONFIG_HEADER 36394 # CONFIG_HEADER
19576 # 36395 #
36396_ACEOF
36397
36398# Transform confdefs.h into a sed script `conftest.defines', that
36399# substitutes the proper values into config.h.in to produce config.h.
36400rm -f conftest.defines conftest.tail
36401# First, append a space to every undef/define line, to ease matching.
36402echo 's/$/ /' >conftest.defines
36403# Then, protect against being on the right side of a sed subst, or in
36404# an unquoted here document, in config.status. If some macros were
36405# called several times there might be several #defines for the same
36406# symbol, which is useless. But do not sort them, since the last
36407# AC_DEFINE must be honored.
36408ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
36409# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
36410# NAME is the cpp macro being defined, VALUE is the value it is being given.
36411# PARAMS is the parameter list in the macro definition--in most cases, it's
36412# just an empty string.
36413ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
36414ac_dB='\\)[ (].*,\\1define\\2'
36415ac_dC=' '
36416ac_dD=' ,'
36417
36418uniq confdefs.h |
36419 sed -n '
36420 t rset
36421 :rset
36422 s/^[ ]*#[ ]*define[ ][ ]*//
36423 t ok
36424 d
36425 :ok
36426 s/[\\&,]/\\&/g
36427 s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
36428 s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
36429 ' >>conftest.defines
36430
36431# Remove the space that was appended to ease matching.
36432# Then replace #undef with comments. This is necessary, for
36433# example, in the case of _POSIX_SOURCE, which is predefined and required
36434# on some systems where configure will not decide to define it.
36435# (The regexp can be short, since the line contains either #define or #undef.)
36436echo 's/ $//
36437s,^[ #]*u.*,/* & */,' >>conftest.defines
36438
36439# Break up conftest.defines:
36440ac_max_sed_lines=50
36441
36442# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
36443# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
36444# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
36445# et cetera.
36446ac_in='$ac_file_inputs'
36447ac_out='"$tmp/out1"'
36448ac_nxt='"$tmp/out2"'
36449
36450while :
36451do
36452 # Write a here document:
36453 cat >>$CONFIG_STATUS <<_ACEOF
36454 # First, check the format of the line:
36455 cat >"\$tmp/defines.sed" <<\\CEOF
36456/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
36457/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
36458b
36459:def
36460_ACEOF
36461 sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
36462 echo 'CEOF
36463 sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
36464 ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
36465 sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
36466 grep . conftest.tail >/dev/null || break
36467 rm -f conftest.defines
36468 mv conftest.tail conftest.defines
36469done
36470rm -f conftest.defines conftest.tail
36471
36472echo "ac_result=$ac_in" >>$CONFIG_STATUS
36473cat >>$CONFIG_STATUS <<\_ACEOF
19577 if test x"$ac_file" != x-; then 36474 if test x"$ac_file" != x-; then
19578 { 36475 echo "/* $configure_input */" >"$tmp/config.h"
19579 $as_echo "/* $configure_input */" \ 36476 cat "$ac_result" >>"$tmp/config.h"
19580 && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" 36477 if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
19581 } >"$ac_tmp/config.h" \ 36478 { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
19582 || as_fn_error $? "could not create $ac_file" "$LINENO" 5 36479echo "$as_me: $ac_file is unchanged" >&6;}
19583 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
19584 { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
19585$as_echo "$as_me: $ac_file is unchanged" >&6;}
19586 else 36480 else
19587 rm -f "$ac_file" 36481 rm -f $ac_file
19588 mv "$ac_tmp/config.h" "$ac_file" \ 36482 mv "$tmp/config.h" $ac_file
19589 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
19590 fi 36483 fi
19591 else 36484 else
19592 $as_echo "/* $configure_input */" \ 36485 echo "/* $configure_input */"
19593 && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ 36486 cat "$ac_result"
19594 || as_fn_error $? "could not create -" "$LINENO" 5
19595 fi 36487 fi
36488 rm -f "$tmp/out12"
19596 ;; 36489 ;;
19597 36490
19598 36491
@@ -19601,13 +36494,11 @@ $as_echo "$as_me: $ac_file is unchanged" >&6;}
19601done # for ac_tag 36494done # for ac_tag
19602 36495
19603 36496
19604as_fn_exit 0 36497{ (exit 0); exit 0; }
19605_ACEOF 36498_ACEOF
36499chmod +x $CONFIG_STATUS
19606ac_clean_files=$ac_clean_files_save 36500ac_clean_files=$ac_clean_files_save
19607 36501
19608test $ac_write_fail = 0 ||
19609 as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
19610
19611 36502
19612# configure is writing to config.log, and then calls config.status. 36503# configure is writing to config.log, and then calls config.status.
19613# config.status does its own redirection, appending to config.log. 36504# config.status does its own redirection, appending to config.log.
@@ -19627,11 +36518,7 @@ if test "$no_create" != yes; then
19627 exec 5>>config.log 36518 exec 5>>config.log
19628 # Use ||, not &&, to avoid exiting from the if with $? = 1, which 36519 # Use ||, not &&, to avoid exiting from the if with $? = 1, which
19629 # would make configure fail if this is the last instruction. 36520 # would make configure fail if this is the last instruction.
19630 $ac_cs_success || as_fn_exit 1 36521 $ac_cs_success || { (exit 1); exit 1; }
19631fi
19632if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
19633 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
19634$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
19635fi 36522fi
19636 36523
19637 36524
diff --git a/configure.ac b/configure.ac
index 67c4486e7..b4d6598d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,6 +121,42 @@ AC_CHECK_DECL([PR_SET_NO_NEW_PRIVS], [have_linux_no_new_privs=1], , [
121 #include <linux/prctl.h> 121 #include <linux/prctl.h>
122]) 122])
123 123
124openssl=yes
125ssh1=yes
126AC_ARG_WITH([openssl],
127 [ --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL** ],
128 [ if test "x$withval" = "xno" ; then
129 openssl=no
130 ssh1=no
131 fi
132 ]
133)
134AC_MSG_CHECKING([whether OpenSSL will be used for cryptography])
135if test "x$openssl" = "xyes" ; then
136 AC_MSG_RESULT([yes])
137 AC_DEFINE_UNQUOTED([WITH_OPENSSL], [1], [use libcrypto for cryptography])
138else
139 AC_MSG_RESULT([no])
140fi
141
142AC_ARG_WITH([ssh1],
143 [ --without-ssh1 Disable support for SSH protocol 1],
144 [
145 if test "x$withval" = "xno" ; then
146 ssh1=no
147 elif test "x$openssl" = "xno" ; then
148 AC_MSG_ERROR([Cannot enable SSH protocol 1 with OpenSSL disabled])
149 fi
150 ]
151)
152AC_MSG_CHECKING([whether SSH protocol 1 support is enabled])
153if test "x$ssh1" = "xyes" ; then
154 AC_MSG_RESULT([yes])
155 AC_DEFINE_UNQUOTED([WITH_SSH1], [1], [include SSH protocol version 1 support])
156else
157 AC_MSG_RESULT([no])
158fi
159
124use_stack_protector=1 160use_stack_protector=1
125use_toolchain_hardening=1 161use_toolchain_hardening=1
126AC_ARG_WITH([stackprotect], 162AC_ARG_WITH([stackprotect],
@@ -1296,7 +1332,7 @@ g.gl_statv = NULL;
1296 AC_MSG_RESULT([yes]) 1332 AC_MSG_RESULT([yes])
1297 ], [ 1333 ], [
1298 AC_MSG_RESULT([no]) 1334 AC_MSG_RESULT([no])
1299 1335
1300]) 1336])
1301 1337
1302AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>]) 1338AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
@@ -1523,7 +1559,7 @@ AC_ARG_WITH([audit],
1523) 1559)
1524 1560
1525AC_ARG_WITH([pie], 1561AC_ARG_WITH([pie],
1526 [ --with-pie Build Position Independent Executables if possible], [ 1562 [ --with-pie Build Position Independent Executables if possible], [
1527 if test "x$withval" = "xno"; then 1563 if test "x$withval" = "xno"; then
1528 use_pie=no 1564 use_pie=no
1529 fi 1565 fi
@@ -1629,6 +1665,7 @@ AC_CHECK_FUNCS([ \
1629 prctl \ 1665 prctl \
1630 pstat \ 1666 pstat \
1631 readpassphrase \ 1667 readpassphrase \
1668 reallocarray \
1632 realpath \ 1669 realpath \
1633 recvmsg \ 1670 recvmsg \
1634 rresvport_af \ 1671 rresvport_af \
@@ -1688,10 +1725,13 @@ AC_LINK_IFELSE(
1688 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).]) 1725 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
1689]) 1726])
1690 1727
1691# PKCS#11 support requires dlopen() and co 1728# PKCS11 depends on OpenSSL.
1692AC_SEARCH_LIBS([dlopen], [dl], 1729if test "x$openssl" = "xyes" ; then
1693 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])] 1730 # PKCS#11 support requires dlopen() and co
1694) 1731 AC_SEARCH_LIBS([dlopen], [dl],
1732 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
1733 )
1734fi
1695 1735
1696# IRIX has a const char return value for gai_strerror() 1736# IRIX has a const char return value for gai_strerror()
1697AC_CHECK_FUNCS([gai_strerror], [ 1737AC_CHECK_FUNCS([gai_strerror], [
@@ -2157,6 +2197,13 @@ if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2157 ) 2197 )
2158fi 2198fi
2159 2199
2200if test "x$ac_cv_func_getaddrinfo" = "xyes"; then
2201 AC_CHECK_DECLS(AI_NUMERICSERV, , ,
2202 [#include <sys/types.h>
2203 #include <sys/socket.h>
2204 #include <netdb.h>])
2205fi
2206
2160if test "x$check_for_conflicting_getspnam" = "x1"; then 2207if test "x$check_for_conflicting_getspnam" = "x1"; then
2161 AC_MSG_CHECKING([for conflicting getspnam in shadow.h]) 2208 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2162 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]], 2209 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
@@ -2180,6 +2227,9 @@ saved_LDFLAGS="$LDFLAGS"
2180AC_ARG_WITH([ssl-dir], 2227AC_ARG_WITH([ssl-dir],
2181 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ], 2228 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2182 [ 2229 [
2230 if test "x$openssl" = "xno" ; then
2231 AC_MSG_ERROR([cannot use --with-ssl-dir when OpenSSL disabled])
2232 fi
2183 if test "x$withval" != "xno" ; then 2233 if test "x$withval" != "xno" ; then
2184 case "$withval" in 2234 case "$withval" in
2185 # Relative paths 2235 # Relative paths
@@ -2212,445 +2262,458 @@ AC_ARG_WITH([ssl-dir],
2212 fi 2262 fi
2213 ] 2263 ]
2214) 2264)
2215LIBS="-lcrypto $LIBS" 2265
2216AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1], 2266AC_ARG_WITH([openssl-header-check],
2217 [Define if your ssl headers are included 2267 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2218 with #include <openssl/header.h>])],
2219 [ 2268 [
2220 dnl Check default openssl install dir 2269 if test "x$withval" = "xno" ; then
2221 if test -n "${need_dash_r}"; then 2270 openssl_check_nonfatal=1
2222 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
2223 else
2224 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
2225 fi 2271 fi
2226 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2227 AC_CHECK_HEADER([openssl/opensslv.h], ,
2228 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2229 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
2230 [
2231 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2232 ]
2233 )
2234 ] 2272 ]
2235) 2273)
2236 2274
2237# Determine OpenSSL header version 2275openssl_engine=no
2238AC_MSG_CHECKING([OpenSSL header version]) 2276AC_ARG_WITH([ssl-engine],
2239AC_RUN_IFELSE( 2277 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2240 [AC_LANG_PROGRAM([[
2241#include <stdio.h>
2242#include <string.h>
2243#include <openssl/opensslv.h>
2244#define DATA "conftest.sslincver"
2245 ]], [[
2246 FILE *fd;
2247 int rc;
2248
2249 fd = fopen(DATA,"w");
2250 if(fd == NULL)
2251 exit(1);
2252
2253 if ((rc = fprintf(fd ,"%08x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2254 exit(1);
2255
2256 exit(0);
2257 ]])],
2258 [
2259 ssl_header_ver=`cat conftest.sslincver`
2260 AC_MSG_RESULT([$ssl_header_ver])
2261 ],
2262 [
2263 AC_MSG_RESULT([not found])
2264 AC_MSG_ERROR([OpenSSL version header not found.])
2265 ],
2266 [ 2278 [
2267 AC_MSG_WARN([cross compiling: not checking]) 2279 if test "x$openssl" = "xno" ; then
2280 AC_MSG_ERROR([cannot use --with-ssl-engine when OpenSSL disabled])
2281 fi
2282 if test "x$withval" != "xno" ; then
2283 openssl_engine=yes
2284 fi
2268 ] 2285 ]
2269) 2286)
2270 2287
2271# Determine OpenSSL library version 2288if test "x$openssl" = "xyes" ; then
2272AC_MSG_CHECKING([OpenSSL library version]) 2289 LIBS="-lcrypto $LIBS"
2273AC_RUN_IFELSE( 2290 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
2274 [AC_LANG_PROGRAM([[ 2291 [Define if your ssl headers are included
2275#include <stdio.h> 2292 with #include <openssl/header.h>])],
2276#include <string.h> 2293 [
2277#include <openssl/opensslv.h> 2294 dnl Check default openssl install dir
2278#include <openssl/crypto.h> 2295 if test -n "${need_dash_r}"; then
2279#define DATA "conftest.ssllibver" 2296 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
2280 ]], [[ 2297 else
2281 FILE *fd; 2298 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
2282 int rc; 2299 fi
2300 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2301 AC_CHECK_HEADER([openssl/opensslv.h], ,
2302 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2303 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
2304 [
2305 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2306 ]
2307 )
2308 ]
2309 )
2283 2310
2284 fd = fopen(DATA,"w"); 2311 # Determine OpenSSL header version
2285 if(fd == NULL) 2312 AC_MSG_CHECKING([OpenSSL header version])
2286 exit(1); 2313 AC_RUN_IFELSE(
2314 [AC_LANG_PROGRAM([[
2315 #include <stdio.h>
2316 #include <string.h>
2317 #include <openssl/opensslv.h>
2318 #define DATA "conftest.sslincver"
2319 ]], [[
2320 FILE *fd;
2321 int rc;
2287 2322
2288 if ((rc = fprintf(fd ,"%08x (%s)\n", SSLeay(), 2323 fd = fopen(DATA,"w");
2289 SSLeay_version(SSLEAY_VERSION))) <0) 2324 if(fd == NULL)
2290 exit(1); 2325 exit(1);
2291 2326
2292 exit(0); 2327 if ((rc = fprintf(fd ,"%08x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2293 ]])], 2328 exit(1);
2294 [ 2329
2295 ssl_library_ver=`cat conftest.ssllibver` 2330 exit(0);
2296 # Check version is supported. 2331 ]])],
2297 case "$ssl_library_ver" in 2332 [
2298 0090[[0-7]]*|009080[[0-5]]*) 2333 ssl_header_ver=`cat conftest.sslincver`
2299 AC_MSG_ERROR([OpenSSL >= 0.9.8f required]) 2334 AC_MSG_RESULT([$ssl_header_ver])
2300 ;; 2335 ],
2301 *) ;; 2336 [
2302 esac 2337 AC_MSG_RESULT([not found])
2303 AC_MSG_RESULT([$ssl_library_ver]) 2338 AC_MSG_ERROR([OpenSSL version header not found.])
2304 ], 2339 ],
2305 [ 2340 [
2306 AC_MSG_RESULT([not found]) 2341 AC_MSG_WARN([cross compiling: not checking])
2307 AC_MSG_ERROR([OpenSSL library not found.]) 2342 ]
2308 ], 2343 )
2309 [
2310 AC_MSG_WARN([cross compiling: not checking])
2311 ]
2312)
2313 2344
2314# XXX make --without-openssl work 2345 # Determine OpenSSL library version
2315AC_DEFINE_UNQUOTED([WITH_OPENSSL], [1], [use libcrypto for cryptography]) 2346 AC_MSG_CHECKING([OpenSSL library version])
2316AC_DEFINE_UNQUOTED([WITH_SSH1], [1], [include SSH protocol version 1 support]) 2347 AC_RUN_IFELSE(
2348 [AC_LANG_PROGRAM([[
2349 #include <stdio.h>
2350 #include <string.h>
2351 #include <openssl/opensslv.h>
2352 #include <openssl/crypto.h>
2353 #define DATA "conftest.ssllibver"
2354 ]], [[
2355 FILE *fd;
2356 int rc;
2317 2357
2318AC_ARG_WITH([openssl-header-check], 2358 fd = fopen(DATA,"w");
2319 [ --without-openssl-header-check Disable OpenSSL version consistency check], 2359 if(fd == NULL)
2320 [ if test "x$withval" = "xno" ; then 2360 exit(1);
2321 openssl_check_nonfatal=1
2322 fi
2323 ]
2324)
2325 2361
2326# Sanity check OpenSSL headers 2362 if ((rc = fprintf(fd ,"%08x (%s)\n", SSLeay(),
2327AC_MSG_CHECKING([whether OpenSSL's headers match the library]) 2363 SSLeay_version(SSLEAY_VERSION))) <0)
2328AC_RUN_IFELSE( 2364 exit(1);
2329 [AC_LANG_PROGRAM([[
2330#include <string.h>
2331#include <openssl/opensslv.h>
2332 ]], [[
2333 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
2334 ]])],
2335 [
2336 AC_MSG_RESULT([yes])
2337 ],
2338 [
2339 AC_MSG_RESULT([no])
2340 if test "x$openssl_check_nonfatal" = "x"; then
2341 AC_MSG_ERROR([Your OpenSSL headers do not match your
2342library. Check config.log for details.
2343If you are sure your installation is consistent, you can disable the check
2344by running "./configure --without-openssl-header-check".
2345Also see contrib/findssl.sh for help identifying header/library mismatches.
2346])
2347 else
2348 AC_MSG_WARN([Your OpenSSL headers do not match your
2349library. Check config.log for details.
2350Also see contrib/findssl.sh for help identifying header/library mismatches.])
2351 fi
2352 ],
2353 [
2354 AC_MSG_WARN([cross compiling: not checking])
2355 ]
2356)
2357 2365
2358AC_MSG_CHECKING([if programs using OpenSSL functions will link]) 2366 exit(0);
2359AC_LINK_IFELSE( 2367 ]])],
2360 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]], 2368 [
2361 [[ SSLeay_add_all_algorithms(); ]])], 2369 ssl_library_ver=`cat conftest.ssllibver`
2362 [ 2370 # Check version is supported.
2363 AC_MSG_RESULT([yes]) 2371 case "$ssl_library_ver" in
2364 ], 2372 0090[[0-7]]*|009080[[0-5]]*)
2365 [ 2373 AC_MSG_ERROR([OpenSSL >= 0.9.8f required (have "$ssl_library_ver")])
2366 AC_MSG_RESULT([no]) 2374 ;;
2367 saved_LIBS="$LIBS" 2375 *) ;;
2368 LIBS="$LIBS -ldl" 2376 esac
2369 AC_MSG_CHECKING([if programs using OpenSSL need -ldl]) 2377 AC_MSG_RESULT([$ssl_library_ver])
2370 AC_LINK_IFELSE( 2378 ],
2371 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]], 2379 [
2372 [[ SSLeay_add_all_algorithms(); ]])], 2380 AC_MSG_RESULT([not found])
2373 [ 2381 AC_MSG_ERROR([OpenSSL library not found.])
2374 AC_MSG_RESULT([yes]) 2382 ],
2375 ], 2383 [
2376 [ 2384 AC_MSG_WARN([cross compiling: not checking])
2377 AC_MSG_RESULT([no]) 2385 ]
2378 LIBS="$saved_LIBS" 2386 )
2379 ]
2380 )
2381 ]
2382)
2383 2387
2384AC_CHECK_FUNCS([ \ 2388 # Sanity check OpenSSL headers
2385 BN_is_prime_ex \ 2389 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2386 DSA_generate_parameters_ex \ 2390 AC_RUN_IFELSE(
2387 EVP_DigestInit_ex \ 2391 [AC_LANG_PROGRAM([[
2388 EVP_DigestFinal_ex \ 2392 #include <string.h>
2389 EVP_MD_CTX_init \ 2393 #include <openssl/opensslv.h>
2390 EVP_MD_CTX_cleanup \ 2394 ]], [[
2391 EVP_MD_CTX_copy_ex \ 2395 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
2392 HMAC_CTX_init \ 2396 ]])],
2393 RSA_generate_key_ex \ 2397 [
2394 RSA_get_default_method \ 2398 AC_MSG_RESULT([yes])
2395]) 2399 ],
2400 [
2401 AC_MSG_RESULT([no])
2402 if test "x$openssl_check_nonfatal" = "x"; then
2403 AC_MSG_ERROR([Your OpenSSL headers do not match your
2404 library. Check config.log for details.
2405 If you are sure your installation is consistent, you can disable the check
2406 by running "./configure --without-openssl-header-check".
2407 Also see contrib/findssl.sh for help identifying header/library mismatches.
2408 ])
2409 else
2410 AC_MSG_WARN([Your OpenSSL headers do not match your
2411 library. Check config.log for details.
2412 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2413 fi
2414 ],
2415 [
2416 AC_MSG_WARN([cross compiling: not checking])
2417 ]
2418 )
2396 2419
2397AC_ARG_WITH([ssl-engine], 2420 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2398 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ], 2421 AC_LINK_IFELSE(
2399 [ if test "x$withval" != "xno" ; then 2422 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2423 [[ SSLeay_add_all_algorithms(); ]])],
2424 [
2425 AC_MSG_RESULT([yes])
2426 ],
2427 [
2428 AC_MSG_RESULT([no])
2429 saved_LIBS="$LIBS"
2430 LIBS="$LIBS -ldl"
2431 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2432 AC_LINK_IFELSE(
2433 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2434 [[ SSLeay_add_all_algorithms(); ]])],
2435 [
2436 AC_MSG_RESULT([yes])
2437 ],
2438 [
2439 AC_MSG_RESULT([no])
2440 LIBS="$saved_LIBS"
2441 ]
2442 )
2443 ]
2444 )
2445
2446 AC_CHECK_FUNCS([ \
2447 BN_is_prime_ex \
2448 DSA_generate_parameters_ex \
2449 EVP_DigestInit_ex \
2450 EVP_DigestFinal_ex \
2451 EVP_MD_CTX_init \
2452 EVP_MD_CTX_cleanup \
2453 EVP_MD_CTX_copy_ex \
2454 HMAC_CTX_init \
2455 RSA_generate_key_ex \
2456 RSA_get_default_method \
2457 ])
2458
2459 if test "x$openssl_engine" = "xyes" ; then
2400 AC_MSG_CHECKING([for OpenSSL ENGINE support]) 2460 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2401 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 2461 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2402#include <openssl/engine.h> 2462 #include <openssl/engine.h>
2403 ]], [[ 2463 ]], [[
2404 ENGINE_load_builtin_engines(); 2464 ENGINE_load_builtin_engines();
2405 ENGINE_register_all_complete(); 2465 ENGINE_register_all_complete();
2406 ]])], 2466 ]])],
2407 [ AC_MSG_RESULT([yes]) 2467 [ AC_MSG_RESULT([yes])
2408 AC_DEFINE([USE_OPENSSL_ENGINE], [1], 2468 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
2409 [Enable OpenSSL engine support]) 2469 [Enable OpenSSL engine support])
2410 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found]) 2470 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2411 ]) 2471 ])
2412 fi ] 2472 fi
2413)
2414 2473
2415# Check for OpenSSL without EVP_aes_{192,256}_cbc 2474 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2416AC_MSG_CHECKING([whether OpenSSL has crippled AES support]) 2475 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2417AC_LINK_IFELSE( 2476 AC_LINK_IFELSE(
2418 [AC_LANG_PROGRAM([[ 2477 [AC_LANG_PROGRAM([[
2419#include <string.h> 2478 #include <string.h>
2420#include <openssl/evp.h> 2479 #include <openssl/evp.h>
2421 ]], [[ 2480 ]], [[
2422 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL); 2481 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
2423 ]])], 2482 ]])],
2424 [ 2483 [
2425 AC_MSG_RESULT([no]) 2484 AC_MSG_RESULT([no])
2426 ], 2485 ],
2427 [ 2486 [
2428 AC_MSG_RESULT([yes]) 2487 AC_MSG_RESULT([yes])
2429 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1], 2488 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
2430 [libcrypto is missing AES 192 and 256 bit functions]) 2489 [libcrypto is missing AES 192 and 256 bit functions])
2431 ] 2490 ]
2432) 2491 )
2433 2492
2434# Check for OpenSSL with EVP_aes_*ctr 2493 # Check for OpenSSL with EVP_aes_*ctr
2435AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP]) 2494 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2436AC_LINK_IFELSE( 2495 AC_LINK_IFELSE(
2437 [AC_LANG_PROGRAM([[ 2496 [AC_LANG_PROGRAM([[
2438#include <string.h> 2497 #include <string.h>
2439#include <openssl/evp.h> 2498 #include <openssl/evp.h>
2440 ]], [[ 2499 ]], [[
2441 exit(EVP_aes_128_ctr() == NULL || 2500 exit(EVP_aes_128_ctr() == NULL ||
2442 EVP_aes_192_cbc() == NULL || 2501 EVP_aes_192_cbc() == NULL ||
2443 EVP_aes_256_cbc() == NULL); 2502 EVP_aes_256_cbc() == NULL);
2444 ]])], 2503 ]])],
2445 [ 2504 [
2446 AC_MSG_RESULT([yes]) 2505 AC_MSG_RESULT([yes])
2447 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1], 2506 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2448 [libcrypto has EVP AES CTR]) 2507 [libcrypto has EVP AES CTR])
2449 ], 2508 ],
2450 [ 2509 [
2451 AC_MSG_RESULT([no]) 2510 AC_MSG_RESULT([no])
2452 ] 2511 ]
2453) 2512 )
2454 2513
2455# Check for OpenSSL with EVP_aes_*gcm 2514 # Check for OpenSSL with EVP_aes_*gcm
2456AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP]) 2515 AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2457AC_LINK_IFELSE( 2516 AC_LINK_IFELSE(
2458 [AC_LANG_PROGRAM([[ 2517 [AC_LANG_PROGRAM([[
2459#include <string.h> 2518 #include <string.h>
2460#include <openssl/evp.h> 2519 #include <openssl/evp.h>
2461 ]], [[ 2520 ]], [[
2462 exit(EVP_aes_128_gcm() == NULL || 2521 exit(EVP_aes_128_gcm() == NULL ||
2463 EVP_aes_256_gcm() == NULL || 2522 EVP_aes_256_gcm() == NULL ||
2464 EVP_CTRL_GCM_SET_IV_FIXED == 0 || 2523 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2465 EVP_CTRL_GCM_IV_GEN == 0 || 2524 EVP_CTRL_GCM_IV_GEN == 0 ||
2466 EVP_CTRL_GCM_SET_TAG == 0 || 2525 EVP_CTRL_GCM_SET_TAG == 0 ||
2467 EVP_CTRL_GCM_GET_TAG == 0 || 2526 EVP_CTRL_GCM_GET_TAG == 0 ||
2468 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0); 2527 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
2469 ]])], 2528 ]])],
2470 [ 2529 [
2471 AC_MSG_RESULT([yes]) 2530 AC_MSG_RESULT([yes])
2472 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1], 2531 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2473 [libcrypto has EVP AES GCM]) 2532 [libcrypto has EVP AES GCM])
2474 ], 2533 ],
2475 [ 2534 [
2476 AC_MSG_RESULT([no]) 2535 AC_MSG_RESULT([no])
2477 unsupported_algorithms="$unsupported_cipers \ 2536 unsupported_algorithms="$unsupported_cipers \
2478 aes128-gcm@openssh.com aes256-gcm@openssh.com" 2537 aes128-gcm@openssh.com aes256-gcm@openssh.com"
2479 ] 2538 ]
2480) 2539 )
2481 2540
2482AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto], 2541 AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2483 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1], 2542 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2484 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])]) 2543 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2485 2544
2486AC_MSG_CHECKING([if EVP_DigestUpdate returns an int]) 2545 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2487AC_LINK_IFELSE( 2546 AC_LINK_IFELSE(
2488 [AC_LANG_PROGRAM([[ 2547 [AC_LANG_PROGRAM([[
2489#include <string.h> 2548 #include <string.h>
2490#include <openssl/evp.h> 2549 #include <openssl/evp.h>
2491 ]], [[ 2550 ]], [[
2492 if(EVP_DigestUpdate(NULL, NULL,0)) 2551 if(EVP_DigestUpdate(NULL, NULL,0))
2493 exit(0); 2552 exit(0);
2494 ]])], 2553 ]])],
2495 [ 2554 [
2496 AC_MSG_RESULT([yes]) 2555 AC_MSG_RESULT([yes])
2497 ], 2556 ],
2498 [ 2557 [
2499 AC_MSG_RESULT([no]) 2558 AC_MSG_RESULT([no])
2500 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1], 2559 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
2501 [Define if EVP_DigestUpdate returns void]) 2560 [Define if EVP_DigestUpdate returns void])
2502 ] 2561 ]
2503) 2562 )
2504 2563
2505# Some systems want crypt() from libcrypt, *not* the version in OpenSSL, 2564 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2506# because the system crypt() is more featureful. 2565 # because the system crypt() is more featureful.
2507if test "x$check_for_libcrypt_before" = "x1"; then 2566 if test "x$check_for_libcrypt_before" = "x1"; then
2508 AC_CHECK_LIB([crypt], [crypt]) 2567 AC_CHECK_LIB([crypt], [crypt])
2509fi 2568 fi
2510 2569
2511# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the 2570 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2512# version in OpenSSL. 2571 # version in OpenSSL.
2513if test "x$check_for_libcrypt_later" = "x1"; then 2572 if test "x$check_for_libcrypt_later" = "x1"; then
2514 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"]) 2573 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
2515fi 2574 fi
2516AC_CHECK_FUNCS([crypt DES_crypt]) 2575 AC_CHECK_FUNCS([crypt DES_crypt])
2517 2576
2518# Search for SHA256 support in libc and/or OpenSSL 2577 # Search for SHA256 support in libc and/or OpenSSL
2519AC_CHECK_FUNCS([SHA256_Update EVP_sha256], , 2578 AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2520 [unsupported_algorithms="$unsupported_algorithms \ 2579 [unsupported_algorithms="$unsupported_algorithms \
2521 hmac-sha2-256 hmac-sha2-512 \ 2580 hmac-sha2-256 hmac-sha2-512 \
2522 diffie-hellman-group-exchange-sha256 \ 2581 diffie-hellman-group-exchange-sha256 \
2523 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com" 2582 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com"
2524 ] 2583 ]
2525) 2584 )
2526# Search for RIPE-MD support in OpenSSL 2585 # Search for RIPE-MD support in OpenSSL
2527AC_CHECK_FUNCS([EVP_ripemd160], , 2586 AC_CHECK_FUNCS([EVP_ripemd160], ,
2528 [unsupported_algorithms="$unsupported_algorithms \ 2587 [unsupported_algorithms="$unsupported_algorithms \
2529 hmac-ripemd160 2588 hmac-ripemd160
2530 hmac-ripemd160@openssh.com 2589 hmac-ripemd160@openssh.com
2531 hmac-ripemd160-etm@openssh.com" 2590 hmac-ripemd160-etm@openssh.com"
2532 ] 2591 ]
2533) 2592 )
2534 2593
2535# Check complete ECC support in OpenSSL 2594 # Check complete ECC support in OpenSSL
2536AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1]) 2595 AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2537AC_LINK_IFELSE( 2596 AC_LINK_IFELSE(
2538 [AC_LANG_PROGRAM([[ 2597 [AC_LANG_PROGRAM([[
2539#include <openssl/ec.h> 2598 #include <openssl/ec.h>
2540#include <openssl/ecdh.h> 2599 #include <openssl/ecdh.h>
2541#include <openssl/ecdsa.h> 2600 #include <openssl/ecdsa.h>
2542#include <openssl/evp.h> 2601 #include <openssl/evp.h>
2543#include <openssl/objects.h> 2602 #include <openssl/objects.h>
2544#include <openssl/opensslv.h> 2603 #include <openssl/opensslv.h>
2545#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */ 2604 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2546# error "OpenSSL < 0.9.8g has unreliable ECC code" 2605 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2547#endif 2606 #endif
2548 ]], [[ 2607 ]], [[
2549 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); 2608 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2550 const EVP_MD *m = EVP_sha256(); /* We need this too */ 2609 const EVP_MD *m = EVP_sha256(); /* We need this too */
2551 ]])], 2610 ]])],
2552 [ AC_MSG_RESULT([yes]) 2611 [ AC_MSG_RESULT([yes])
2553 enable_nistp256=1 ], 2612 enable_nistp256=1 ],
2554 [ AC_MSG_RESULT([no]) ] 2613 [ AC_MSG_RESULT([no]) ]
2555) 2614 )
2556 2615
2557AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1]) 2616 AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2558AC_LINK_IFELSE( 2617 AC_LINK_IFELSE(
2559 [AC_LANG_PROGRAM([[ 2618 [AC_LANG_PROGRAM([[
2560#include <openssl/ec.h> 2619 #include <openssl/ec.h>
2561#include <openssl/ecdh.h> 2620 #include <openssl/ecdh.h>
2562#include <openssl/ecdsa.h> 2621 #include <openssl/ecdsa.h>
2563#include <openssl/evp.h> 2622 #include <openssl/evp.h>
2564#include <openssl/objects.h> 2623 #include <openssl/objects.h>
2565#include <openssl/opensslv.h> 2624 #include <openssl/opensslv.h>
2566#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */ 2625 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2567# error "OpenSSL < 0.9.8g has unreliable ECC code" 2626 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2568#endif 2627 #endif
2569 ]], [[ 2628 ]], [[
2570 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1); 2629 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2571 const EVP_MD *m = EVP_sha384(); /* We need this too */ 2630 const EVP_MD *m = EVP_sha384(); /* We need this too */
2572 ]])], 2631 ]])],
2573 [ AC_MSG_RESULT([yes]) 2632 [ AC_MSG_RESULT([yes])
2574 enable_nistp384=1 ], 2633 enable_nistp384=1 ],
2575 [ AC_MSG_RESULT([no]) ] 2634 [ AC_MSG_RESULT([no]) ]
2576) 2635 )
2577 2636
2578AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1]) 2637 AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
2579AC_LINK_IFELSE( 2638 AC_LINK_IFELSE(
2580 [AC_LANG_PROGRAM([[
2581#include <openssl/ec.h>
2582#include <openssl/ecdh.h>
2583#include <openssl/ecdsa.h>
2584#include <openssl/evp.h>
2585#include <openssl/objects.h>
2586#include <openssl/opensslv.h>
2587#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2588# error "OpenSSL < 0.9.8g has unreliable ECC code"
2589#endif
2590 ]], [[
2591 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2592 const EVP_MD *m = EVP_sha512(); /* We need this too */
2593 ]])],
2594 [ AC_MSG_RESULT([yes])
2595 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2596 AC_RUN_IFELSE(
2597 [AC_LANG_PROGRAM([[ 2639 [AC_LANG_PROGRAM([[
2598#include <openssl/ec.h> 2640 #include <openssl/ec.h>
2599#include <openssl/ecdh.h> 2641 #include <openssl/ecdh.h>
2600#include <openssl/ecdsa.h> 2642 #include <openssl/ecdsa.h>
2601#include <openssl/evp.h> 2643 #include <openssl/evp.h>
2602#include <openssl/objects.h> 2644 #include <openssl/objects.h>
2603#include <openssl/opensslv.h> 2645 #include <openssl/opensslv.h>
2604 ]],[[ 2646 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2647 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2648 #endif
2649 ]], [[
2605 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); 2650 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2606 const EVP_MD *m = EVP_sha512(); /* We need this too */ 2651 const EVP_MD *m = EVP_sha512(); /* We need this too */
2607 exit(e == NULL || m == NULL);
2608 ]])], 2652 ]])],
2609 [ AC_MSG_RESULT([yes]) 2653 [ AC_MSG_RESULT([yes])
2610 enable_nistp521=1 ], 2654 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2611 [ AC_MSG_RESULT([no]) ], 2655 AC_RUN_IFELSE(
2612 [ AC_MSG_WARN([cross-compiling: assuming yes]) 2656 [AC_LANG_PROGRAM([[
2613 enable_nistp521=1 ] 2657 #include <openssl/ec.h>
2614 )], 2658 #include <openssl/ecdh.h>
2615 AC_MSG_RESULT([no]) 2659 #include <openssl/ecdsa.h>
2616) 2660 #include <openssl/evp.h>
2661 #include <openssl/objects.h>
2662 #include <openssl/opensslv.h>
2663 ]],[[
2664 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2665 const EVP_MD *m = EVP_sha512(); /* We need this too */
2666 exit(e == NULL || m == NULL);
2667 ]])],
2668 [ AC_MSG_RESULT([yes])
2669 enable_nistp521=1 ],
2670 [ AC_MSG_RESULT([no]) ],
2671 [ AC_MSG_WARN([cross-compiling: assuming yes])
2672 enable_nistp521=1 ]
2673 )],
2674 AC_MSG_RESULT([no])
2675 )
2617 2676
2618COMMENT_OUT_ECC="#no ecc#" 2677 COMMENT_OUT_ECC="#no ecc#"
2619TEST_SSH_ECC=no 2678 TEST_SSH_ECC=no
2620 2679
2621if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \ 2680 if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
2622 test x$enable_nistp521 = x1; then 2681 test x$enable_nistp521 = x1; then
2623 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC]) 2682 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
2624fi 2683 fi
2625if test x$enable_nistp256 = x1; then 2684 if test x$enable_nistp256 = x1; then
2626 AC_DEFINE([OPENSSL_HAS_NISTP256], [1], 2685 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
2627 [libcrypto has NID_X9_62_prime256v1]) 2686 [libcrypto has NID_X9_62_prime256v1])
2628 TEST_SSH_ECC=yes 2687 TEST_SSH_ECC=yes
2629 COMMENT_OUT_ECC="" 2688 COMMENT_OUT_ECC=""
2630else 2689 else
2631 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \ 2690 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \
2632 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com" 2691 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com"
2633fi 2692 fi
2634if test x$enable_nistp384 = x1; then 2693 if test x$enable_nistp384 = x1; then
2635 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1]) 2694 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
2636 TEST_SSH_ECC=yes 2695 TEST_SSH_ECC=yes
2637 COMMENT_OUT_ECC="" 2696 COMMENT_OUT_ECC=""
2638else 2697 else
2639 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \ 2698 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \
2640 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com" 2699 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com"
2641fi 2700 fi
2642if test x$enable_nistp521 = x1; then 2701 if test x$enable_nistp521 = x1; then
2643 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1]) 2702 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
2644 TEST_SSH_ECC=yes 2703 TEST_SSH_ECC=yes
2645 COMMENT_OUT_ECC="" 2704 COMMENT_OUT_ECC=""
2705 else
2706 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \
2707 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com"
2708 fi
2709
2710 AC_SUBST([TEST_SSH_ECC])
2711 AC_SUBST([COMMENT_OUT_ECC])
2646else 2712else
2647 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \ 2713 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
2648 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com" 2714 AC_CHECK_FUNCS([crypt])
2649fi 2715fi
2650 2716
2651AC_SUBST([TEST_SSH_ECC])
2652AC_SUBST([COMMENT_OUT_ECC])
2653
2654AC_CHECK_FUNCS([ \ 2717AC_CHECK_FUNCS([ \
2655 arc4random \ 2718 arc4random \
2656 arc4random_buf \ 2719 arc4random_buf \
@@ -2671,28 +2734,30 @@ LIBS="$saved_LIBS"
2671### Configure cryptographic random number support 2734### Configure cryptographic random number support
2672 2735
2673# Check wheter OpenSSL seeds itself 2736# Check wheter OpenSSL seeds itself
2674AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded]) 2737if test "x$openssl" = "xyes" ; then
2675AC_RUN_IFELSE( 2738 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2676 [AC_LANG_PROGRAM([[ 2739 AC_RUN_IFELSE(
2677#include <string.h> 2740 [AC_LANG_PROGRAM([[
2678#include <openssl/rand.h> 2741 #include <string.h>
2679 ]], [[ 2742 #include <openssl/rand.h>
2680 exit(RAND_status() == 1 ? 0 : 1); 2743 ]], [[
2681 ]])], 2744 exit(RAND_status() == 1 ? 0 : 1);
2682 [ 2745 ]])],
2683 OPENSSL_SEEDS_ITSELF=yes 2746 [
2684 AC_MSG_RESULT([yes]) 2747 OPENSSL_SEEDS_ITSELF=yes
2685 ], 2748 AC_MSG_RESULT([yes])
2686 [ 2749 ],
2687 AC_MSG_RESULT([no]) 2750 [
2688 ], 2751 AC_MSG_RESULT([no])
2689 [ 2752 ],
2690 AC_MSG_WARN([cross compiling: assuming yes]) 2753 [
2691 # This is safe, since we will fatal() at runtime if 2754 AC_MSG_WARN([cross compiling: assuming yes])
2692 # OpenSSL is not seeded correctly. 2755 # This is safe, since we will fatal() at runtime if
2693 OPENSSL_SEEDS_ITSELF=yes 2756 # OpenSSL is not seeded correctly.
2694 ] 2757 OPENSSL_SEEDS_ITSELF=yes
2695) 2758 ]
2759 )
2760fi
2696 2761
2697# PRNGD TCP socket 2762# PRNGD TCP socket
2698AC_ARG_WITH([prngd-port], 2763AC_ARG_WITH([prngd-port],
@@ -2774,8 +2839,10 @@ elif test ! -z "$PRNGD_SOCKET" ; then
2774 RAND_MSG="PRNGd socket $PRNGD_SOCKET" 2839 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2775elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then 2840elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2776 AC_DEFINE([OPENSSL_PRNG_ONLY], [1], 2841 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2777 [Define if you want OpenSSL's internally seeded PRNG only]) 2842 [Define if you want the OpenSSL internally seeded PRNG only])
2778 RAND_MSG="OpenSSL internal ONLY" 2843 RAND_MSG="OpenSSL internal ONLY"
2844elif test "x$openssl" = "xno" ; then
2845 AC_MSG_WARN([OpenSSH will use /dev/urandom as a source of random numbers. It will fail if this device is not supported or accessible])
2779else 2846else
2780 AC_MSG_ERROR([OpenSSH has no source of random numbers. Please configure OpenSSL with an entropy source or re-run configure using one of the --with-prngd-port or --with-prngd-socket options]) 2847 AC_MSG_ERROR([OpenSSH has no source of random numbers. Please configure OpenSSL with an entropy source or re-run configure using one of the --with-prngd-port or --with-prngd-socket options])
2781fi 2848fi
@@ -2837,7 +2904,7 @@ if test "x$PAM_MSG" = "xyes" ; then
2837 which takes only one argument to pam_strerror]) 2904 which takes only one argument to pam_strerror])
2838 AC_MSG_RESULT([yes]) 2905 AC_MSG_RESULT([yes])
2839 PAM_MSG="yes (old library)" 2906 PAM_MSG="yes (old library)"
2840 2907
2841 ]) 2908 ])
2842fi 2909fi
2843 2910
diff --git a/contrib/Makefile b/contrib/Makefile
index c6c48e78a..eaf7fe2fd 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -4,12 +4,12 @@ all:
4 @echo "Valid targets: gnome-ssh-askpass1 gnome-ssh-askpass2" 4 @echo "Valid targets: gnome-ssh-askpass1 gnome-ssh-askpass2"
5 5
6gnome-ssh-askpass1: gnome-ssh-askpass1.c 6gnome-ssh-askpass1: gnome-ssh-askpass1.c
7 $(CC) `gnome-config --cflags gnome gnomeui` \ 7 $(CC) $(CFLAGS) `gnome-config --cflags gnome gnomeui` \
8 gnome-ssh-askpass1.c -o gnome-ssh-askpass1 \ 8 gnome-ssh-askpass1.c -o gnome-ssh-askpass1 \
9 `gnome-config --libs gnome gnomeui` 9 `gnome-config --libs gnome gnomeui`
10 10
11gnome-ssh-askpass2: gnome-ssh-askpass2.c 11gnome-ssh-askpass2: gnome-ssh-askpass2.c
12 $(CC) `$(PKG_CONFIG) --cflags gtk+-2.0` \ 12 $(CC) $(CFLAGS) `$(PKG_CONFIG) --cflags gtk+-2.0` \
13 gnome-ssh-askpass2.c -o gnome-ssh-askpass2 \ 13 gnome-ssh-askpass2.c -o gnome-ssh-askpass2 \
14 `$(PKG_CONFIG) --libs gtk+-2.0 x11` 14 `$(PKG_CONFIG) --libs gtk+-2.0 x11`
15 15
diff --git a/contrib/caldera/openssh.spec b/contrib/caldera/openssh.spec
deleted file mode 100644
index 0011b4dea..000000000
--- a/contrib/caldera/openssh.spec
+++ /dev/null
@@ -1,365 +0,0 @@
1
2# Some of this will need re-evaluation post-LSB. The SVIdir is there
3# because the link appeared broken. The rest is for easy compilation,
4# the tradeoff open to discussion. (LC957)
5
6%define SVIdir /etc/rc.d/init.d
7%{!?_defaultdocdir:%define _defaultdocdir %{_prefix}/share/doc/packages}
8%{!?SVIcdir:%define SVIcdir /etc/sysconfig/daemons}
9
10%define _mandir %{_prefix}/share/man/en
11%define _sysconfdir /etc/ssh
12%define _libexecdir %{_libdir}/ssh
13
14# Do we want to disable root_login? (1=yes 0=no)
15%define no_root_login 0
16
17#old cvs stuff. please update before use. may be deprecated.
18%define use_stable 1
19%define version 6.7p1
20%if %{use_stable}
21 %define cvs %{nil}
22 %define release 1
23%else
24 %define cvs cvs20050315
25 %define release 0r1
26%endif
27%define xsa x11-ssh-askpass
28%define askpass %{xsa}-1.2.4.1
29
30# OpenSSH privilege separation requires a user & group ID
31%define sshd_uid 67
32%define sshd_gid 67
33
34Name : openssh
35Version : %{version}%{cvs}
36Release : %{release}
37Group : System/Network
38
39Summary : OpenSSH free Secure Shell (SSH) implementation.
40Summary(de) : OpenSSH - freie Implementation der Secure Shell (SSH).
41Summary(es) : OpenSSH implementación libre de Secure Shell (SSH).
42Summary(fr) : Implémentation libre du shell sécurisé OpenSSH (SSH).
43Summary(it) : Implementazione gratuita OpenSSH della Secure Shell.
44Summary(pt) : Implementação livre OpenSSH do protocolo 'Secure Shell' (SSH).
45Summary(pt_BR) : Implementação livre OpenSSH do protocolo Secure Shell (SSH).
46
47Copyright : BSD
48Packager : Raymund Will <ray@caldera.de>
49URL : http://www.openssh.com/
50
51Obsoletes : ssh, ssh-clients, openssh-clients
52
53BuildRoot : /tmp/%{name}-%{version}
54BuildRequires : XFree86-imake
55
56# %{use_stable}==1: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable
57# %{use_stable}==0: :pserver:cvs@bass.directhit.com:/cvs/openssh_cvs
58Source0: see-above:/.../openssh-%{version}.tar.gz
59%if %{use_stable}
60Source1: see-above:/.../openssh-%{version}.tar.gz.asc
61%endif
62Source2: http://www.jmknoble.net/software/%{xsa}/%{askpass}.tar.gz
63Source3: http://www.openssh.com/faq.html
64
65%Package server
66Group : System/Network
67Requires : openssh = %{version}
68Obsoletes : ssh-server
69
70Summary : OpenSSH Secure Shell protocol server (sshd).
71Summary(de) : OpenSSH Secure Shell Protocol-Server (sshd).
72Summary(es) : Servidor del protocolo OpenSSH Secure Shell (sshd).
73Summary(fr) : Serveur de protocole du shell sécurisé OpenSSH (sshd).
74Summary(it) : Server OpenSSH per il protocollo Secure Shell (sshd).
75Summary(pt) : Servidor do protocolo 'Secure Shell' OpenSSH (sshd).
76Summary(pt_BR) : Servidor do protocolo Secure Shell OpenSSH (sshd).
77
78
79%Package askpass
80Group : System/Network
81Requires : openssh = %{version}
82URL : http://www.jmknoble.net/software/x11-ssh-askpass/
83Obsoletes : ssh-extras
84
85Summary : OpenSSH X11 pass-phrase dialog.
86Summary(de) : OpenSSH X11 Passwort-Dialog.
87Summary(es) : Aplicación de petición de frase clave OpenSSH X11.
88Summary(fr) : Dialogue pass-phrase X11 d'OpenSSH.
89Summary(it) : Finestra di dialogo X11 per la frase segreta di OpenSSH.
90Summary(pt) : Diálogo de pedido de senha para X11 do OpenSSH.
91Summary(pt_BR) : Diálogo de pedido de senha para X11 do OpenSSH.
92
93
94%Description
95OpenSSH (Secure Shell) provides access to a remote system. It replaces
96telnet, rlogin, rexec, and rsh, and provides secure encrypted
97communications between two untrusted hosts over an insecure network.
98X11 connections and arbitrary TCP/IP ports can also be forwarded over
99the secure channel.
100
101%Description -l de
102OpenSSH (Secure Shell) stellt den Zugang zu anderen Rechnern her. Es ersetzt
103telnet, rlogin, rexec und rsh und stellt eine sichere, verschlüsselte
104Verbindung zwischen zwei nicht vertrauenswürdigen Hosts über eine unsicheres
105Netzwerk her. X11 Verbindungen und beliebige andere TCP/IP Ports können ebenso
106über den sicheren Channel weitergeleitet werden.
107
108%Description -l es
109OpenSSH (Secure Shell) proporciona acceso a sistemas remotos. Reemplaza a
110telnet, rlogin, rexec, y rsh, y proporciona comunicaciones seguras encriptadas
111entre dos equipos entre los que no se ha establecido confianza a través de una
112red insegura. Las conexiones X11 y puertos TCP/IP arbitrarios también pueden
113ser canalizadas sobre el canal seguro.
114
115%Description -l fr
116OpenSSH (Secure Shell) fournit un accès à un système distant. Il remplace
117telnet, rlogin, rexec et rsh, tout en assurant des communications cryptées
118securisées entre deux hôtes non fiabilisés sur un réseau non sécurisé. Des
119connexions X11 et des ports TCP/IP arbitraires peuvent également être
120transmis sur le canal sécurisé.
121
122%Description -l it
123OpenSSH (Secure Shell) fornisce l'accesso ad un sistema remoto.
124Sostituisce telnet, rlogin, rexec, e rsh, e fornisce comunicazioni sicure
125e crittate tra due host non fidati su una rete non sicura. Le connessioni
126X11 ad una porta TCP/IP arbitraria possono essere inoltrate attraverso
127un canale sicuro.
128
129%Description -l pt
130OpenSSH (Secure Shell) fornece acesso a um sistema remoto. Substitui o
131telnet, rlogin, rexec, e o rsh e fornece comunicações seguras e cifradas
132entre duas máquinas sem confiança mútua sobre uma rede insegura.
133Ligações X11 e portos TCP/IP arbitrários também poder ser reenviados
134pelo canal seguro.
135
136%Description -l pt_BR
137O OpenSSH (Secure Shell) fornece acesso a um sistema remoto. Substitui o
138telnet, rlogin, rexec, e o rsh e fornece comunicações seguras e criptografadas
139entre duas máquinas sem confiança mútua sobre uma rede insegura.
140Ligações X11 e portas TCP/IP arbitrárias também podem ser reenviadas
141pelo canal seguro.
142
143%Description server
144This package installs the sshd, the server portion of OpenSSH.
145
146%Description -l de server
147Dieses Paket installiert den sshd, den Server-Teil der OpenSSH.
148
149%Description -l es server
150Este paquete instala sshd, la parte servidor de OpenSSH.
151
152%Description -l fr server
153Ce paquetage installe le 'sshd', partie serveur de OpenSSH.
154
155%Description -l it server
156Questo pacchetto installa sshd, il server di OpenSSH.
157
158%Description -l pt server
159Este pacote intala o sshd, o servidor do OpenSSH.
160
161%Description -l pt_BR server
162Este pacote intala o sshd, o servidor do OpenSSH.
163
164%Description askpass
165This package contains an X11-based pass-phrase dialog used per
166default by ssh-add(1). It is based on %{askpass}
167by Jim Knoble <jmknoble@pobox.com>.
168
169
170%Prep
171%setup %([ -z "%{cvs}" ] || echo "-n %{name}_cvs") -a2
172%if ! %{use_stable}
173 autoreconf
174%endif
175
176
177%Build
178CFLAGS="$RPM_OPT_FLAGS" \
179%configure \
180 --with-pam \
181 --with-privsep-path=%{_var}/empty/sshd \
182 #leave this line for easy edits.
183
184%__make
185
186cd %{askpass}
187%configure \
188 #leave this line for easy edits.
189
190xmkmf
191%__make includes
192%__make
193
194
195%Install
196[ %{buildroot} != "/" ] && rm -rf %{buildroot}
197
198make install DESTDIR=%{buildroot}
199%makeinstall -C %{askpass} \
200 BINDIR=%{_libexecdir} \
201 MANPATH=%{_mandir} \
202 DESTDIR=%{buildroot}
203
204# OpenLinux specific configuration
205mkdir -p %{buildroot}{/etc/pam.d,%{SVIcdir},%{SVIdir}}
206mkdir -p %{buildroot}%{_var}/empty/sshd
207
208# enabling X11 forwarding on the server is convenient and okay,
209# on the client side it's a potential security risk!
210%__perl -pi -e 's:#X11Forwarding no:X11Forwarding yes:g' \
211 %{buildroot}%{_sysconfdir}/sshd_config
212
213%if %{no_root_login}
214%__perl -pi -e 's:#PermitRootLogin yes:PermitRootLogin no:g' \
215 %{buildroot}%{_sysconfdir}/sshd_config
216%endif
217
218install -m644 contrib/caldera/sshd.pam %{buildroot}/etc/pam.d/sshd
219# FIXME: disabled, find out why this doesn't work with nis
220%__perl -pi -e 's:(.*pam_limits.*):#$1:' \
221 %{buildroot}/etc/pam.d/sshd
222
223install -m 0755 contrib/caldera/sshd.init %{buildroot}%{SVIdir}/sshd
224
225# the last one is needless, but more future-proof
226find %{buildroot}%{SVIdir} -type f -exec \
227 %__perl -pi -e 's:\@SVIdir\@:%{SVIdir}:g;\
228 s:\@sysconfdir\@:%{_sysconfdir}:g; \
229 s:/usr/sbin:%{_sbindir}:g'\
230 \{\} \;
231
232cat <<-EoD > %{buildroot}%{SVIcdir}/sshd
233 IDENT=sshd
234 DESCRIPTIVE="OpenSSH secure shell daemon"
235 # This service will be marked as 'skipped' on boot if there
236 # is no host key. Use ssh-host-keygen to generate one
237 ONBOOT="yes"
238 OPTIONS=""
239EoD
240
241SKG=%{buildroot}%{_sbindir}/ssh-host-keygen
242install -m 0755 contrib/caldera/ssh-host-keygen $SKG
243# Fix up some path names in the keygen toy^Hol
244 %__perl -pi -e 's:\@sysconfdir\@:%{_sysconfdir}:g; \
245 s:\@sshkeygen\@:%{_bindir}/ssh-keygen:g' \
246 %{buildroot}%{_sbindir}/ssh-host-keygen
247
248# This looks terrible. Expect it to change.
249# install remaining docs
250DocD="%{buildroot}%{_defaultdocdir}/%{name}-%{version}"
251mkdir -p $DocD/%{askpass}
252cp -a CREDITS ChangeLog LICENCE OVERVIEW README* TODO PROTOCOL* $DocD
253install -p -m 0444 %{SOURCE3} $DocD/faq.html
254cp -a %{askpass}/{README,ChangeLog,TODO,SshAskpass*.ad} $DocD/%{askpass}
255%if %{use_stable}
256 cp -p %{askpass}/%{xsa}.man $DocD/%{askpass}/%{xsa}.1
257%else
258 cp -p %{askpass}/%{xsa}.man %{buildroot}%{_mandir}man1/%{xsa}.1
259 ln -s %{xsa}.1 %{buildroot}%{_mandir}man1/ssh-askpass.1
260%endif
261
262find %{buildroot}%{_mandir} -type f -not -name '*.gz' -print0 | xargs -0r %__gzip -9nf
263rm %{buildroot}%{_mandir}/man1/slogin.1 && \
264 ln -s %{_mandir}/man1/ssh.1.gz \
265 %{buildroot}%{_mandir}/man1/slogin.1.gz
266
267
268%Clean
269#%{rmDESTDIR}
270[ %{buildroot} != "/" ] && rm -rf %{buildroot}
271
272%Post
273# Generate host key when none is present to get up and running,
274# both client and server require this for host-based auth!
275# ssh-host-keygen checks for existing keys.
276/usr/sbin/ssh-host-keygen
277: # to protect the rpm database
278
279%pre server
280%{_sbindir}/groupadd -g %{sshd_gid} sshd 2>/dev/null || :
281%{_sbindir}/useradd -d /var/empty/sshd -s /bin/false -u %{sshd_uid} \
282 -c "SSH Daemon virtual user" -g sshd sshd 2>/dev/null || :
283: # to protect the rpm database
284
285%Post server
286if [ -x %{LSBinit}-install ]; then
287 %{LSBinit}-install sshd
288else
289 lisa --SysV-init install sshd S55 2:3:4:5 K45 0:1:6
290fi
291
292! %{SVIdir}/sshd status || %{SVIdir}/sshd restart
293: # to protect the rpm database
294
295
296%PreUn server
297[ "$1" = 0 ] || exit 0
298! %{SVIdir}/sshd status || %{SVIdir}/sshd stop
299if [ -x %{LSBinit}-remove ]; then
300 %{LSBinit}-remove sshd
301else
302 lisa --SysV-init remove sshd $1
303fi
304: # to protect the rpm database
305
306%Files
307%defattr(-,root,root)
308%dir %{_sysconfdir}
309%config %{_sysconfdir}/ssh_config
310%{_bindir}/scp
311%{_bindir}/sftp
312%{_bindir}/ssh
313%{_bindir}/slogin
314%{_bindir}/ssh-add
315%attr(2755,root,nobody) %{_bindir}/ssh-agent
316%{_bindir}/ssh-keygen
317%{_bindir}/ssh-keyscan
318%dir %{_libexecdir}
319%attr(4711,root,root) %{_libexecdir}/ssh-keysign
320%{_libexecdir}/ssh-pkcs11-helper
321%{_sbindir}/ssh-host-keygen
322%dir %{_defaultdocdir}/%{name}-%{version}
323%{_defaultdocdir}/%{name}-%{version}/CREDITS
324%{_defaultdocdir}/%{name}-%{version}/ChangeLog
325%{_defaultdocdir}/%{name}-%{version}/LICENCE
326%{_defaultdocdir}/%{name}-%{version}/OVERVIEW
327%{_defaultdocdir}/%{name}-%{version}/README*
328%{_defaultdocdir}/%{name}-%{version}/TODO
329%{_defaultdocdir}/%{name}-%{version}/faq.html
330%{_mandir}/man1/*
331%{_mandir}/man8/ssh-keysign.8.gz
332%{_mandir}/man8/ssh-pkcs11-helper.8.gz
333%{_mandir}/man5/ssh_config.5.gz
334
335%Files server
336%defattr(-,root,root)
337%dir %{_var}/empty/sshd
338%config %{SVIdir}/sshd
339%config /etc/pam.d/sshd
340%config %{_sysconfdir}/moduli
341%config %{_sysconfdir}/sshd_config
342%config %{SVIcdir}/sshd
343%{_libexecdir}/sftp-server
344%{_sbindir}/sshd
345%{_mandir}/man5/moduli.5.gz
346%{_mandir}/man5/sshd_config.5.gz
347%{_mandir}/man8/sftp-server.8.gz
348%{_mandir}/man8/sshd.8.gz
349
350%Files askpass
351%defattr(-,root,root)
352%{_libexecdir}/ssh-askpass
353%{_libexecdir}/x11-ssh-askpass
354%{_defaultdocdir}/%{name}-%{version}/%{askpass}
355
356
357%ChangeLog
358* Tue Jan 18 2011 Tim Rice <tim@multitalents.net>
359- Use CFLAGS from Makefile instead of RPM so build completes.
360- Signatures were changed to .asc since 4.1p1.
361
362* Mon Jan 01 1998 ...
363Template Version: 1.31
364
365$Id: openssh.spec,v 1.85 2014/08/19 01:36:08 djm Exp $
diff --git a/contrib/caldera/ssh-host-keygen b/contrib/caldera/ssh-host-keygen
deleted file mode 100755
index 86382ddfb..000000000
--- a/contrib/caldera/ssh-host-keygen
+++ /dev/null
@@ -1,36 +0,0 @@
1#! /bin/sh
2#
3# $Id: ssh-host-keygen,v 1.3 2008/11/03 09:16:01 djm Exp $
4#
5# This script is normally run only *once* for a given host
6# (in a given period of time) -- on updates/upgrades/recovery
7# the ssh_host_key* files _should_ be retained! Otherwise false
8# "man-in-the-middle-attack" alerts will frighten unsuspecting
9# clients...
10
11keydir=@sysconfdir@
12keygen=@sshkeygen@
13
14if [ -f $keydir/ssh_host_key -o \
15 -f $keydir/ssh_host_key.pub ]; then
16 echo "You already have an SSH1 RSA host key in $keydir/ssh_host_key."
17else
18 echo "Generating SSH1 RSA host key."
19 $keygen -t rsa1 -f $keydir/ssh_host_key -C '' -N ''
20fi
21
22if [ -f $keydir/ssh_host_rsa_key -o \
23 -f $keydir/ssh_host_rsa_key.pub ]; then
24 echo "You already have an SSH2 RSA host key in $keydir/ssh_host_rsa_key."
25else
26 echo "Generating SSH2 RSA host key."
27 $keygen -t rsa -f $keydir/ssh_host_rsa_key -C '' -N ''
28fi
29
30if [ -f $keydir/ssh_host_dsa_key -o \
31 -f $keydir/ssh_host_dsa_key.pub ]; then
32 echo "You already have an SSH2 DSA host key in $keydir/ssh_host_dsa_key."
33else
34 echo "Generating SSH2 DSA host key."
35 $keygen -t dsa -f $keydir/ssh_host_dsa_key -C '' -N ''
36fi
diff --git a/contrib/caldera/sshd.init b/contrib/caldera/sshd.init
deleted file mode 100755
index 983146f4f..000000000
--- a/contrib/caldera/sshd.init
+++ /dev/null
@@ -1,125 +0,0 @@
1#! /bin/bash
2#
3# $Id: sshd.init,v 1.4 2003/11/21 12:48:57 djm Exp $
4#
5### BEGIN INIT INFO
6# Provides:
7# Required-Start: $network
8# Required-Stop:
9# Default-Start: 3 4 5
10# Default-Stop: 0 1 2 6
11# Description: sshd
12# Bring up/down the OpenSSH secure shell daemon.
13### END INIT INFO
14#
15# Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
16# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
17# Modified for OpenLinux by Raymund Will <ray@caldera.de>
18
19NAME=sshd
20DAEMON=/usr/sbin/$NAME
21# Hack-Alert(TM)! This is necessary to get around the 'reload'-problem
22# created by recent OpenSSH daemon/ssd combinations. See Caldera internal
23# PR [linux/8278] for details...
24PIDF=/var/run/$NAME.pid
25NAME=$DAEMON
26
27_status() {
28 [ -z "$1" ] || local pidf="$1"
29 local ret=-1
30 local pid
31 if [ -n "$pidf" ] && [ -r "$pidf" ]; then
32 pid=$(head -1 $pidf)
33 else
34 pid=$(pidof $NAME)
35 fi
36
37 if [ ! -e $SVIlock ]; then
38 # no lock-file => not started == stopped?
39 ret=3
40 elif [ -n "$pidf" -a ! -f "$pidf" ] || [ -z "$pid" ]; then
41 # pid-file given but not present or no pid => died, but was not stopped
42 ret=2
43 elif [ -r /proc/$pid/cmdline ] &&
44 echo -ne $NAME'\000' | cmp -s - /proc/$pid/cmdline; then
45 # pid-file given and present or pid found => check process...
46 # but don't compare exe, as this will fail after an update!
47 # compares OK => all's well, that ends well...
48 ret=0
49 else
50 # no such process or exe does not match => stale pid-file or process died
51 # just recently...
52 ret=1
53 fi
54 return $ret
55}
56
57# Source function library (and set vital variables).
58. @SVIdir@/functions
59
60case "$1" in
61 start)
62 [ ! -e $SVIlock ] || exit 0
63 [ -x $DAEMON ] || exit 5
64 SVIemptyConfig @sysconfdir@/sshd_config && exit 6
65
66 if [ ! \( -f @sysconfdir@/ssh_host_key -a \
67 -f @sysconfdir@/ssh_host_key.pub \) -a \
68 ! \( -f @sysconfdir@/ssh_host_rsa_key -a \
69 -f @sysconfdir@/ssh_host_rsa_key.pub \) -a \
70 ! \( -f @sysconfdir@/ssh_host_dsa_key -a \
71 -f @sysconfdir@/ssh_host_dsa_key.pub \) ]; then
72
73 echo "$SVIsubsys: host key not initialized: skipped!"
74 echo "$SVIsubsys: use ssh-host-keygen to generate one!"
75 exit 6
76 fi
77
78 echo -n "Starting $SVIsubsys services: "
79 ssd -S -x $DAEMON -n $NAME -- $OPTIONS
80 ret=$?
81
82 echo "."
83 touch $SVIlock
84 ;;
85
86 stop)
87 [ -e $SVIlock ] || exit 0
88
89 echo -n "Stopping $SVIsubsys services: "
90 ssd -K -p $PIDF -n $NAME
91 ret=$?
92
93 echo "."
94 rm -f $SVIlock
95 ;;
96
97 force-reload|reload)
98 [ -e $SVIlock ] || exit 0
99
100 echo "Reloading $SVIsubsys configuration files: "
101 ssd -K --signal 1 -q -p $PIDF -n $NAME
102 ret=$?
103 echo "done."
104 ;;
105
106 restart)
107 $0 stop
108 $0 start
109 ret=$?
110 ;;
111
112 status)
113 _status $PIDF
114 ret=$?
115 ;;
116
117 *)
118 echo "Usage: $SVIscript {[re]start|stop|[force-]reload|status}"
119 ret=2
120 ;;
121
122esac
123
124exit $ret
125
diff --git a/contrib/caldera/sshd.pam b/contrib/caldera/sshd.pam
deleted file mode 100644
index f050a9aee..000000000
--- a/contrib/caldera/sshd.pam
+++ /dev/null
@@ -1,8 +0,0 @@
1#%PAM-1.0
2auth required /lib/security/pam_pwdb.so shadow nodelay
3account required /lib/security/pam_nologin.so
4account required /lib/security/pam_pwdb.so
5password required /lib/security/pam_cracklib.so
6password required /lib/security/pam_pwdb.so shadow nullok use_authtok
7session required /lib/security/pam_pwdb.so
8session required /lib/security/pam_limits.so
diff --git a/contrib/cygwin/ssh-host-config b/contrib/cygwin/ssh-host-config
index a7ea3e0d2..d934d09b5 100644
--- a/contrib/cygwin/ssh-host-config
+++ b/contrib/cygwin/ssh-host-config
@@ -1,6 +1,6 @@
1#!/bin/bash 1#!/bin/bash
2# 2#
3# ssh-host-config, Copyright 2000-2011 Red Hat Inc. 3# ssh-host-config, Copyright 2000-2014 Red Hat Inc.
4# 4#
5# This file is part of the Cygwin port of OpenSSH. 5# This file is part of the Cygwin port of OpenSSH.
6# 6#
@@ -61,6 +61,7 @@ LOCALSTATEDIR=/var
61 61
62sshd_config_configured=no 62sshd_config_configured=no
63port_number=22 63port_number=22
64service_name=sshd
64strictmodes=yes 65strictmodes=yes
65privsep_used=yes 66privsep_used=yes
66cygwin_value="" 67cygwin_value=""
@@ -353,11 +354,9 @@ check_service_files_ownership() {
353 fi 354 fi
354 if [ -z "${run_service_as}" ] 355 if [ -z "${run_service_as}" ]
355 then 356 then
356 csih_warning "Couldn't determine name of user running sshd service from /etc/passwd!" 357 csih_warning "Couldn't determine name of user running sshd service from account database!"
357 csih_warning "As a result, this script cannot make sure that the files used" 358 csih_warning "As a result, this script cannot make sure that the files used"
358 csih_warning "by the sshd service belong to the user running the service." 359 csih_warning "by the sshd service belong to the user running the service."
359 csih_warning "Please re-run the mkpasswd tool to make sure the /etc/passwd"
360 csih_warning "file is in a good shape."
361 return 1 360 return 1
362 fi 361 fi
363 fi 362 fi
@@ -410,7 +409,7 @@ install_service() {
410 local ret=0 409 local ret=0
411 410
412 echo 411 echo
413 if /usr/bin/cygrunsrv -Q sshd >/dev/null 2>&1 412 if /usr/bin/cygrunsrv -Q ${service_name} >/dev/null 2>&1
414 then 413 then
415 csih_inform "Sshd service is already installed." 414 csih_inform "Sshd service is already installed."
416 check_service_files_ownership "" || let ret+=$? 415 check_service_files_ownership "" || let ret+=$?
@@ -466,7 +465,7 @@ install_service() {
466 fi 465 fi
467 if [ -z "${password}" ] 466 if [ -z "${password}" ]
468 then 467 then
469 if /usr/bin/cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd \ 468 if /usr/bin/cygrunsrv -I ${service_name} -d "CYGWIN ${service_name}" -p /usr/sbin/sshd \
470 -a "-D" -y tcpip "${cygwin_env[@]}" 469 -a "-D" -y tcpip "${cygwin_env[@]}"
471 then 470 then
472 echo 471 echo
@@ -476,20 +475,20 @@ install_service() {
476 csih_inform "will start automatically after the next reboot." 475 csih_inform "will start automatically after the next reboot."
477 fi 476 fi
478 else 477 else
479 if /usr/bin/cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd \ 478 if /usr/bin/cygrunsrv -I ${service_name} -d "CYGWIN ${service_name}" -p /usr/sbin/sshd \
480 -a "-D" -y tcpip "${cygwin_env[@]}" \ 479 -a "-D" -y tcpip "${cygwin_env[@]}" \
481 -u "${run_service_as}" -w "${password}" 480 -u "${run_service_as}" -w "${password}"
482 then 481 then
483 /usr/bin/editrights -u "${run_service_as}" -a SeServiceLogonRight 482 /usr/bin/editrights -u "${run_service_as}" -a SeServiceLogonRight
484 echo 483 echo
485 csih_inform "The sshd service has been installed under the '${run_service_as}'" 484 csih_inform "The sshd service has been installed under the '${run_service_as}'"
486 csih_inform "account. To start the service now, call \`net start sshd' or" 485 csih_inform "account. To start the service now, call \`net start ${service_name}' or"
487 csih_inform "\`cygrunsrv -S sshd'. Otherwise, it will start automatically" 486 csih_inform "\`cygrunsrv -S ${service_name}'. Otherwise, it will start automatically"
488 csih_inform "after the next reboot." 487 csih_inform "after the next reboot."
489 fi 488 fi
490 fi 489 fi
491 490
492 if /usr/bin/cygrunsrv -Q sshd >/dev/null 2>&1 491 if /usr/bin/cygrunsrv -Q ${service_name} >/dev/null 2>&1
493 then 492 then
494 check_service_files_ownership "${run_service_as}" || let ret+=$? 493 check_service_files_ownership "${run_service_as}" || let ret+=$?
495 else 494 else
@@ -563,6 +562,11 @@ do
563 shift 562 shift
564 ;; 563 ;;
565 564
565 -N | --name )
566 service_name=$1
567 shift
568 ;;
569
566 -p | --port ) 570 -p | --port )
567 port_number=$1 571 port_number=$1
568 shift 572 shift
@@ -592,6 +596,7 @@ do
592 echo " --yes -y Answer all questions with \"yes\" automatically." 596 echo " --yes -y Answer all questions with \"yes\" automatically."
593 echo " --no -n Answer all questions with \"no\" automatically." 597 echo " --no -n Answer all questions with \"no\" automatically."
594 echo " --cygwin -c <options> Use \"options\" as value for CYGWIN environment var." 598 echo " --cygwin -c <options> Use \"options\" as value for CYGWIN environment var."
599 echo " --name -N <name> sshd windows service name."
595 echo " --port -p <n> sshd listens on port n." 600 echo " --port -p <n> sshd listens on port n."
596 echo " --user -u <account> privileged user for service, default 'cyg_server'." 601 echo " --user -u <account> privileged user for service, default 'cyg_server'."
597 echo " --pwd -w <passwd> Use \"pwd\" as password for privileged user." 602 echo " --pwd -w <passwd> Use \"pwd\" as password for privileged user."
@@ -625,10 +630,7 @@ then
625 csih_warning "However, it seems your account does not have these privileges." 630 csih_warning "However, it seems your account does not have these privileges."
626 csih_warning "Here's the list of groups in your user token:" 631 csih_warning "Here's the list of groups in your user token:"
627 echo 632 echo
628 for i in $(/usr/bin/id -G) 633 /usr/bin/id -Gnz | xargs -0n1 echo " "
629 do
630 /usr/bin/awk -F: "/[^:]*:[^:]*:$i:/{ print \" \" \$1; }" /etc/group
631 done
632 echo 634 echo
633 csih_warning "This usually means you're running this script from a non-admin" 635 csih_warning "This usually means you're running this script from a non-admin"
634 csih_warning "desktop session, or in a non-elevated shell under UAC control." 636 csih_warning "desktop session, or in a non-elevated shell under UAC control."
diff --git a/contrib/cygwin/ssh-user-config b/contrib/cygwin/ssh-user-config
index 8708b7a58..33dc0cbea 100644
--- a/contrib/cygwin/ssh-user-config
+++ b/contrib/cygwin/ssh-user-config
@@ -1,6 +1,6 @@
1#!/bin/bash 1#!/bin/bash
2# 2#
3# ssh-user-config, Copyright 2000-2008 Red Hat Inc. 3# ssh-user-config, Copyright 2000-2014 Red Hat Inc.
4# 4#
5# This file is part of the Cygwin port of OpenSSH. 5# This file is part of the Cygwin port of OpenSSH.
6# 6#
@@ -75,19 +75,18 @@ readonly -f create_identity
75# pwdhome 75# pwdhome
76# ====================================================================== 76# ======================================================================
77check_user_homedir() { 77check_user_homedir() {
78 local uid=$(id -u) 78 pwdhome=$(getent passwd $UID | awk -F: '{ print $6; }')
79 pwdhome=$(awk -F: '{ if ( $3 == '${uid}' ) print $6; }' < ${SYSCONFDIR}/passwd)
80 if [ "X${pwdhome}" = "X" ] 79 if [ "X${pwdhome}" = "X" ]
81 then 80 then
82 csih_error_multi \ 81 csih_error_multi \
83 "There is no home directory set for you in ${SYSCONFDIR}/passwd." \ 82 "There is no home directory set for you in the account database." \
84 'Setting $HOME is not sufficient!' 83 'Setting $HOME is not sufficient!'
85 fi 84 fi
86 85
87 if [ ! -d "${pwdhome}" ] 86 if [ ! -d "${pwdhome}" ]
88 then 87 then
89 csih_error_multi \ 88 csih_error_multi \
90 "${pwdhome} is set in ${SYSCONFDIR}/passwd as your home directory" \ 89 "${pwdhome} is set in the account database as your home directory" \
91 'but it is not a valid directory. Cannot create user identity files.' 90 'but it is not a valid directory. Cannot create user identity files.'
92 fi 91 fi
93 92
@@ -96,7 +95,7 @@ check_user_homedir() {
96 if [ "X${pwdhome}" = "X/" ] 95 if [ "X${pwdhome}" = "X/" ]
97 then 96 then
98 # But first raise a warning! 97 # But first raise a warning!
99 csih_warning "Your home directory in ${SYSCONFDIR}/passwd is set to root (/). This is not recommended!" 98 csih_warning "Your home directory in the account database is set to root (/). This is not recommended!"
100 if csih_request "Would you like to proceed anyway?" 99 if csih_request "Would you like to proceed anyway?"
101 then 100 then
102 pwdhome='' 101 pwdhome=''
@@ -106,7 +105,7 @@ check_user_homedir() {
106 fi 105 fi
107 fi 106 fi
108 107
109 if [ -d "${pwdhome}" -a csih_is_nt -a -n "`chmod -c g-w,o-w "${pwdhome}"`" ] 108 if [ -d "${pwdhome}" -a -n "`chmod -c g-w,o-w "${pwdhome}"`" ]
110 then 109 then
111 echo 110 echo
112 csih_warning 'group and other have been revoked write permission to your home' 111 csih_warning 'group and other have been revoked write permission to your home'
@@ -149,9 +148,10 @@ readonly -f check_user_dot_ssh_dir
149# pwdhome -- check_user_homedir() 148# pwdhome -- check_user_homedir()
150# ====================================================================== 149# ======================================================================
151fix_authorized_keys_perms() { 150fix_authorized_keys_perms() {
152 if [ csih_is_nt -a -e "${pwdhome}/.ssh/authorized_keys" ] 151 if [ -e "${pwdhome}/.ssh/authorized_keys" ]
153 then 152 then
154 if ! setfacl -m "u::rw-,g::---,o::---" "${pwdhome}/.ssh/authorized_keys" 153 setfacl -b "${pwdhome}/.ssh/authorized_keys" 2>/dev/null || echo -n
154 if ! chmod u-x,g-wx,o-wx "${pwdhome}/.ssh/authorized_keys"
155 then 155 then
156 csih_warning "Setting correct permissions to ${pwdhome}/.ssh/authorized_keys" 156 csih_warning "Setting correct permissions to ${pwdhome}/.ssh/authorized_keys"
157 csih_warning "failed. Please care for the correct permissions. The minimum requirement" 157 csih_warning "failed. Please care for the correct permissions. The minimum requirement"
@@ -243,15 +243,6 @@ done
243# Action! 243# Action!
244# ====================================================================== 244# ======================================================================
245 245
246# Check passwd file
247if [ ! -f ${SYSCONFDIR}/passwd ]
248then
249 csih_error_multi \
250 "${SYSCONFDIR}/passwd is nonexistant. Please generate an ${SYSCONFDIR}/passwd file" \
251 'first using mkpasswd. Check if it contains an entry for you and' \
252 'please care for the home directory in your entry as well.'
253fi
254
255check_user_homedir 246check_user_homedir
256check_user_dot_ssh_dir 247check_user_dot_ssh_dir
257create_identity id_rsa rsa "SSH2 RSA" 248create_identity id_rsa rsa "SSH2 RSA"
diff --git a/contrib/redhat/openssh.spec b/contrib/redhat/openssh.spec
index 9bdce1e3c..7ac4ed0a5 100644
--- a/contrib/redhat/openssh.spec
+++ b/contrib/redhat/openssh.spec
@@ -1,4 +1,4 @@
1%define ver 6.7p1 1%define ver 6.8p1
2%define rel 1 2%define rel 1
3 3
4# OpenSSH privilege separation requires a user & group ID 4# OpenSSH privilege separation requires a user & group ID
diff --git a/contrib/suse/openssh.spec b/contrib/suse/openssh.spec
index f87674317..0eb779c9b 100644
--- a/contrib/suse/openssh.spec
+++ b/contrib/suse/openssh.spec
@@ -13,7 +13,7 @@
13 13
14Summary: OpenSSH, a free Secure Shell (SSH) protocol implementation 14Summary: OpenSSH, a free Secure Shell (SSH) protocol implementation
15Name: openssh 15Name: openssh
16Version: 6.7p1 16Version: 6.8p1
17URL: http://www.openssh.com/ 17URL: http://www.openssh.com/
18Release: 1 18Release: 1
19Source0: openssh-%{version}.tar.gz 19Source0: openssh-%{version}.tar.gz
diff --git a/deattack.c b/deattack.c
index 1b37e4dab..e76481a6d 100644
--- a/deattack.c
+++ b/deattack.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: deattack.c,v 1.30 2006/09/16 19:53:37 djm Exp $ */ 1/* $OpenBSD: deattack.c,v 1.32 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Cryptographic attack detector for ssh - source code 3 * Cryptographic attack detector for ssh - source code
4 * 4 *
@@ -20,16 +20,13 @@
20 20
21#include "includes.h" 21#include "includes.h"
22 22
23#include <sys/types.h>
24
25#include <string.h> 23#include <string.h>
26#include <stdio.h> 24#include <stdio.h>
27#include <stdarg.h> 25#include <stdlib.h>
28 26
29#include "xmalloc.h"
30#include "deattack.h" 27#include "deattack.h"
31#include "log.h"
32#include "crc32.h" 28#include "crc32.h"
29#include "sshbuf.h"
33#include "misc.h" 30#include "misc.h"
34 31
35/* 32/*
@@ -66,7 +63,7 @@
66 63
67 64
68/* Hash function (Input keys are cipher results) */ 65/* Hash function (Input keys are cipher results) */
69#define HASH(x) get_u32(x) 66#define HASH(x) PEEK_U32(x)
70 67
71#define CMP(a, b) (memcmp(a, b, SSH_BLOCKSIZE)) 68#define CMP(a, b) (memcmp(a, b, SSH_BLOCKSIZE))
72 69
@@ -79,10 +76,10 @@ crc_update(u_int32_t *a, u_int32_t b)
79 76
80/* detect if a block is used in a particular pattern */ 77/* detect if a block is used in a particular pattern */
81static int 78static int
82check_crc(u_char *S, u_char *buf, u_int32_t len) 79check_crc(const u_char *S, const u_char *buf, u_int32_t len)
83{ 80{
84 u_int32_t crc; 81 u_int32_t crc;
85 u_char *c; 82 const u_char *c;
86 83
87 crc = 0; 84 crc = 0;
88 for (c = buf; c < buf + len; c += SSH_BLOCKSIZE) { 85 for (c = buf; c < buf + len; c += SSH_BLOCKSIZE) {
@@ -94,36 +91,44 @@ check_crc(u_char *S, u_char *buf, u_int32_t len)
94 crc_update(&crc, 0); 91 crc_update(&crc, 0);
95 } 92 }
96 } 93 }
97 return (crc == 0); 94 return crc == 0;
98} 95}
99 96
97void
98deattack_init(struct deattack_ctx *dctx)
99{
100 bzero(dctx, sizeof(*dctx));
101 dctx->n = HASH_MINSIZE / HASH_ENTRYSIZE;
102}
100 103
101/* Detect a crc32 compensation attack on a packet */ 104/* Detect a crc32 compensation attack on a packet */
102int 105int
103detect_attack(u_char *buf, u_int32_t len) 106detect_attack(struct deattack_ctx *dctx, const u_char *buf, u_int32_t len)
104{ 107{
105 static u_int16_t *h = (u_int16_t *) NULL; 108 u_int32_t i, j, l, same;
106 static u_int32_t n = HASH_MINSIZE / HASH_ENTRYSIZE; 109 u_int16_t *tmp;
107 u_int32_t i, j; 110 const u_char *c, *d;
108 u_int32_t l, same;
109 u_char *c;
110 u_char *d;
111 111
112 if (len > (SSH_MAXBLOCKS * SSH_BLOCKSIZE) || 112 if (len > (SSH_MAXBLOCKS * SSH_BLOCKSIZE) ||
113 len % SSH_BLOCKSIZE != 0) { 113 len % SSH_BLOCKSIZE != 0)
114 fatal("detect_attack: bad length %d", len); 114 return DEATTACK_ERROR;
115 } 115 for (l = dctx->n; l < HASH_FACTOR(len / SSH_BLOCKSIZE); l = l << 2)
116 for (l = n; l < HASH_FACTOR(len / SSH_BLOCKSIZE); l = l << 2)
117 ; 116 ;
118 117
119 if (h == NULL) { 118 if (dctx->h == NULL) {
120 debug("Installing crc compensation attack detector."); 119 if ((dctx->h = calloc(l, HASH_ENTRYSIZE)) == NULL)
121 h = (u_int16_t *) xcalloc(l, HASH_ENTRYSIZE); 120 return DEATTACK_ERROR;
122 n = l; 121 dctx->n = l;
123 } else { 122 } else {
124 if (l > n) { 123 if (l > dctx->n) {
125 h = (u_int16_t *)xrealloc(h, l, HASH_ENTRYSIZE); 124 if ((tmp = reallocarray(dctx->h, l, HASH_ENTRYSIZE))
126 n = l; 125 == NULL) {
126 free(dctx->h);
127 dctx->h = NULL;
128 return DEATTACK_ERROR;
129 }
130 dctx->h = tmp;
131 dctx->n = l;
127 } 132 }
128 } 133 }
129 134
@@ -132,29 +137,29 @@ detect_attack(u_char *buf, u_int32_t len)
132 for (d = buf; d < c; d += SSH_BLOCKSIZE) { 137 for (d = buf; d < c; d += SSH_BLOCKSIZE) {
133 if (!CMP(c, d)) { 138 if (!CMP(c, d)) {
134 if ((check_crc(c, buf, len))) 139 if ((check_crc(c, buf, len)))
135 return (DEATTACK_DETECTED); 140 return DEATTACK_DETECTED;
136 else 141 else
137 break; 142 break;
138 } 143 }
139 } 144 }
140 } 145 }
141 return (DEATTACK_OK); 146 return DEATTACK_OK;
142 } 147 }
143 memset(h, HASH_UNUSEDCHAR, n * HASH_ENTRYSIZE); 148 memset(dctx->h, HASH_UNUSEDCHAR, dctx->n * HASH_ENTRYSIZE);
144 149
145 for (c = buf, same = j = 0; c < (buf + len); c += SSH_BLOCKSIZE, j++) { 150 for (c = buf, same = j = 0; c < (buf + len); c += SSH_BLOCKSIZE, j++) {
146 for (i = HASH(c) & (n - 1); h[i] != HASH_UNUSED; 151 for (i = HASH(c) & (dctx->n - 1); dctx->h[i] != HASH_UNUSED;
147 i = (i + 1) & (n - 1)) { 152 i = (i + 1) & (dctx->n - 1)) {
148 if (!CMP(c, buf + h[i] * SSH_BLOCKSIZE)) { 153 if (!CMP(c, buf + dctx->h[i] * SSH_BLOCKSIZE)) {
149 if (++same > MAX_IDENTICAL) 154 if (++same > MAX_IDENTICAL)
150 return (DEATTACK_DOS_DETECTED); 155 return DEATTACK_DOS_DETECTED;
151 if (check_crc(c, buf, len)) 156 if (check_crc(c, buf, len))
152 return (DEATTACK_DETECTED); 157 return DEATTACK_DETECTED;
153 else 158 else
154 break; 159 break;
155 } 160 }
156 } 161 }
157 h[i] = j; 162 dctx->h[i] = j;
158 } 163 }
159 return (DEATTACK_OK); 164 return DEATTACK_OK;
160} 165}
diff --git a/deattack.h b/deattack.h
index 0316fb285..ce67a30ff 100644
--- a/deattack.h
+++ b/deattack.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: deattack.h,v 1.10 2006/09/16 19:53:37 djm Exp $ */ 1/* $OpenBSD: deattack.h,v 1.11 2015/01/19 19:52:16 markus Exp $ */
2 2
3/* 3/*
4 * Cryptographic attack detector for ssh - Header file 4 * Cryptographic attack detector for ssh - Header file
@@ -26,6 +26,13 @@
26#define DEATTACK_OK 0 26#define DEATTACK_OK 0
27#define DEATTACK_DETECTED 1 27#define DEATTACK_DETECTED 1
28#define DEATTACK_DOS_DETECTED 2 28#define DEATTACK_DOS_DETECTED 2
29#define DEATTACK_ERROR 3
29 30
30int detect_attack(u_char *, u_int32_t); 31struct deattack_ctx {
32 u_int16_t *h;
33 u_int32_t n;
34};
35
36void deattack_init(struct deattack_ctx *);
37int detect_attack(struct deattack_ctx *, const u_char *, u_int32_t);
31#endif 38#endif
diff --git a/defines.h b/defines.h
index 3ac8be987..fa0ccba7c 100644
--- a/defines.h
+++ b/defines.h
@@ -105,6 +105,17 @@ enum
105# endif /* PATH_MAX */ 105# endif /* PATH_MAX */
106#endif /* MAXPATHLEN */ 106#endif /* MAXPATHLEN */
107 107
108#ifndef HOST_NAME_MAX
109# include "netdb.h" /* for MAXHOSTNAMELEN */
110# if defined(_POSIX_HOST_NAME_MAX)
111# define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
112# elif defined(MAXHOSTNAMELEN)
113# define HOST_NAME_MAX MAXHOSTNAMELEN
114# else
115# define HOST_NAME_MAX 255
116# endif
117#endif /* HOST_NAME_MAX */
118
108#if defined(HAVE_DECL_MAXSYMLINKS) && HAVE_DECL_MAXSYMLINKS == 0 119#if defined(HAVE_DECL_MAXSYMLINKS) && HAVE_DECL_MAXSYMLINKS == 0
109# define MAXSYMLINKS 5 120# define MAXSYMLINKS 5
110#endif 121#endif
@@ -586,6 +597,12 @@ struct winsize {
586# undef HAVE_GAI_STRERROR 597# undef HAVE_GAI_STRERROR
587#endif 598#endif
588 599
600#if defined(HAVE_GETADDRINFO)
601# if defined(HAVE_DECL_AI_NUMERICSERV) && HAVE_DECL_AI_NUMERICSERV == 0
602# define AI_NUMERICSERV 0
603# endif
604#endif
605
589#if defined(BROKEN_UPDWTMPX) && defined(HAVE_UPDWTMPX) 606#if defined(BROKEN_UPDWTMPX) && defined(HAVE_UPDWTMPX)
590# undef HAVE_UPDWTMPX 607# undef HAVE_UPDWTMPX
591#endif 608#endif
@@ -805,14 +822,6 @@ struct winsize {
805# define SSH_IOBUFSZ 8192 822# define SSH_IOBUFSZ 8192
806#endif 823#endif
807 824
808#ifndef _NSIG
809# ifdef NSIG
810# define _NSIG NSIG
811# else
812# define _NSIG 128
813# endif
814#endif
815
816/* 825/*
817 * Platforms that have arc4random_uniform() and not arc4random_stir() 826 * Platforms that have arc4random_uniform() and not arc4random_stir()
818 * shouldn't need the latter. 827 * shouldn't need the latter.
diff --git a/dh.c b/dh.c
index 3331cda6c..a260240fd 100644
--- a/dh.c
+++ b/dh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.c,v 1.53 2013/11/21 00:45:44 djm Exp $ */ 1/* $OpenBSD: dh.c,v 1.55 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Niels Provos. All rights reserved. 3 * Copyright (c) 2000 Niels Provos. All rights reserved.
4 * 4 *
@@ -25,7 +25,7 @@
25 25
26#include "includes.h" 26#include "includes.h"
27 27
28#include <sys/param.h> 28#include <sys/param.h> /* MIN */
29 29
30#include <openssl/bn.h> 30#include <openssl/bn.h>
31#include <openssl/dh.h> 31#include <openssl/dh.h>
@@ -34,11 +34,13 @@
34#include <stdio.h> 34#include <stdio.h>
35#include <stdlib.h> 35#include <stdlib.h>
36#include <string.h> 36#include <string.h>
37#include <limits.h>
37 38
38#include "dh.h" 39#include "dh.h"
39#include "pathnames.h" 40#include "pathnames.h"
40#include "log.h" 41#include "log.h"
41#include "misc.h" 42#include "misc.h"
43#include "ssherr.h"
42 44
43static int 45static int
44parse_prime(int linenum, char *line, struct dhgroup *dhg) 46parse_prime(int linenum, char *line, struct dhgroup *dhg)
@@ -107,10 +109,11 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg)
107 goto fail; 109 goto fail;
108 } 110 }
109 111
110 if ((dhg->g = BN_new()) == NULL) 112 if ((dhg->g = BN_new()) == NULL ||
111 fatal("parse_prime: BN_new failed"); 113 (dhg->p = BN_new()) == NULL) {
112 if ((dhg->p = BN_new()) == NULL) 114 error("parse_prime: BN_new failed");
113 fatal("parse_prime: BN_new failed"); 115 goto fail;
116 }
114 if (BN_hex2bn(&dhg->g, gen) == 0) { 117 if (BN_hex2bn(&dhg->g, gen) == 0) {
115 error("moduli:%d: could not parse generator value", linenum); 118 error("moduli:%d: could not parse generator value", linenum);
116 goto fail; 119 goto fail;
@@ -128,7 +131,6 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg)
128 error("moduli:%d: generator is invalid", linenum); 131 error("moduli:%d: generator is invalid", linenum);
129 goto fail; 132 goto fail;
130 } 133 }
131
132 return 1; 134 return 1;
133 135
134 fail: 136 fail:
@@ -137,7 +139,6 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg)
137 if (dhg->p != NULL) 139 if (dhg->p != NULL)
138 BN_clear_free(dhg->p); 140 BN_clear_free(dhg->p);
139 dhg->g = dhg->p = NULL; 141 dhg->g = dhg->p = NULL;
140 error("Bad prime description in line %d", linenum);
141 return 0; 142 return 0;
142} 143}
143 144
@@ -200,9 +201,11 @@ choose_dh(int min, int wantbits, int max)
200 break; 201 break;
201 } 202 }
202 fclose(f); 203 fclose(f);
203 if (linenum != which+1) 204 if (linenum != which+1) {
204 fatal("WARNING: line %d disappeared in %s, giving up", 205 logit("WARNING: line %d disappeared in %s, giving up",
205 which, _PATH_DH_PRIMES); 206 which, _PATH_DH_PRIMES);
207 return (dh_new_group14());
208 }
206 209
207 return (dh_new_group(dhg.g, dhg.p)); 210 return (dh_new_group(dhg.g, dhg.p));
208} 211}
@@ -251,22 +254,22 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub)
251 return 0; 254 return 0;
252} 255}
253 256
254void 257int
255dh_gen_key(DH *dh, int need) 258dh_gen_key(DH *dh, int need)
256{ 259{
257 int pbits; 260 int pbits;
258 261
259 if (need <= 0) 262 if (need < 0 || dh->p == NULL ||
260 fatal("%s: need <= 0", __func__); 263 (pbits = BN_num_bits(dh->p)) <= 0 ||
261 if (dh->p == NULL) 264 need > INT_MAX / 2 || 2 * need >= pbits)
262 fatal("%s: dh->p == NULL", __func__); 265 return SSH_ERR_INVALID_ARGUMENT;
263 if ((pbits = BN_num_bits(dh->p)) <= 0)
264 fatal("%s: bits(p) <= 0", __func__);
265 dh->length = MIN(need * 2, pbits - 1); 266 dh->length = MIN(need * 2, pbits - 1);
266 if (DH_generate_key(dh) == 0) 267 if (DH_generate_key(dh) == 0 ||
267 fatal("%s: key generation failed", __func__); 268 !dh_pub_is_valid(dh, dh->pub_key)) {
268 if (!dh_pub_is_valid(dh, dh->pub_key)) 269 BN_clear_free(dh->priv_key);
269 fatal("%s: generated invalid key", __func__); 270 return SSH_ERR_LIBCRYPTO_ERROR;
271 }
272 return 0;
270} 273}
271 274
272DH * 275DH *
@@ -275,13 +278,12 @@ dh_new_group_asc(const char *gen, const char *modulus)
275 DH *dh; 278 DH *dh;
276 279
277 if ((dh = DH_new()) == NULL) 280 if ((dh = DH_new()) == NULL)
278 fatal("dh_new_group_asc: DH_new"); 281 return NULL;
279 282 if (BN_hex2bn(&dh->p, modulus) == 0 ||
280 if (BN_hex2bn(&dh->p, modulus) == 0) 283 BN_hex2bn(&dh->g, gen) == 0) {
281 fatal("BN_hex2bn p"); 284 DH_free(dh);
282 if (BN_hex2bn(&dh->g, gen) == 0) 285 return NULL;
283 fatal("BN_hex2bn g"); 286 }
284
285 return (dh); 287 return (dh);
286} 288}
287 289
@@ -296,7 +298,7 @@ dh_new_group(BIGNUM *gen, BIGNUM *modulus)
296 DH *dh; 298 DH *dh;
297 299
298 if ((dh = DH_new()) == NULL) 300 if ((dh = DH_new()) == NULL)
299 fatal("dh_new_group: DH_new"); 301 return NULL;
300 dh->p = modulus; 302 dh->p = modulus;
301 dh->g = gen; 303 dh->g = gen;
302 304
@@ -344,7 +346,7 @@ dh_new_group14(void)
344 * from RFC4419 section 3. 346 * from RFC4419 section 3.
345 */ 347 */
346 348
347int 349u_int
348dh_estimate(int bits) 350dh_estimate(int bits)
349{ 351{
350 if (bits <= 112) 352 if (bits <= 112)
diff --git a/dh.h b/dh.h
index 48f7b68ea..63a1b1477 100644
--- a/dh.h
+++ b/dh.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.h,v 1.11 2013/10/08 11:42:13 dtucker Exp $ */ 1/* $OpenBSD: dh.h,v 1.12 2015/01/19 20:16:15 markus Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Niels Provos. All rights reserved. 4 * Copyright (c) 2000 Niels Provos. All rights reserved.
@@ -38,10 +38,10 @@ DH *dh_new_group(BIGNUM *, BIGNUM *);
38DH *dh_new_group1(void); 38DH *dh_new_group1(void);
39DH *dh_new_group14(void); 39DH *dh_new_group14(void);
40 40
41void dh_gen_key(DH *, int); 41int dh_gen_key(DH *, int);
42int dh_pub_is_valid(DH *, BIGNUM *); 42int dh_pub_is_valid(DH *, BIGNUM *);
43 43
44int dh_estimate(int); 44u_int dh_estimate(int);
45 45
46/* Min and max values from RFC4419. */ 46/* Min and max values from RFC4419. */
47#define DH_GRP_MIN 1024 47#define DH_GRP_MIN 1024
diff --git a/digest-libc.c b/digest-libc.c
index 1b4423a05..a216e784e 100644
--- a/digest-libc.c
+++ b/digest-libc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: digest-libc.c,v 1.3 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: digest-libc.c,v 1.4 2014/12/21 22:27:56 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2013 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2013 Damien Miller <djm@mindrot.org>
4 * Copyright (c) 2014 Markus Friedl. All rights reserved. 4 * Copyright (c) 2014 Markus Friedl. All rights reserved.
@@ -18,15 +18,19 @@
18 18
19#include "includes.h" 19#include "includes.h"
20 20
21#ifndef WITH_OPENSSL
22
21#include <sys/types.h> 23#include <sys/types.h>
22#include <limits.h> 24#include <limits.h>
23#include <stdlib.h> 25#include <stdlib.h>
24#include <string.h> 26#include <string.h>
25 27
28#if 0
26#include <md5.h> 29#include <md5.h>
27#include <rmd160.h> 30#include <rmd160.h>
28#include <sha1.h> 31#include <sha1.h>
29#include <sha2.h> 32#include <sha2.h>
33#endif
30 34
31#include "ssherr.h" 35#include "ssherr.h"
32#include "sshbuf.h" 36#include "sshbuf.h"
@@ -89,30 +93,30 @@ const struct ssh_digest digests[SSH_DIGEST_MAX] = {
89 "SHA256", 93 "SHA256",
90 SHA256_BLOCK_LENGTH, 94 SHA256_BLOCK_LENGTH,
91 SHA256_DIGEST_LENGTH, 95 SHA256_DIGEST_LENGTH,
92 sizeof(SHA2_CTX), 96 sizeof(SHA256_CTX),
93 (md_init_fn *) SHA256Init, 97 (md_init_fn *) SHA256_Init,
94 (md_update_fn *) SHA256Update, 98 (md_update_fn *) SHA256_Update,
95 (md_final_fn *) SHA256Final 99 (md_final_fn *) SHA256_Final
96 }, 100 },
97 { 101 {
98 SSH_DIGEST_SHA384, 102 SSH_DIGEST_SHA384,
99 "SHA384", 103 "SHA384",
100 SHA384_BLOCK_LENGTH, 104 SHA384_BLOCK_LENGTH,
101 SHA384_DIGEST_LENGTH, 105 SHA384_DIGEST_LENGTH,
102 sizeof(SHA2_CTX), 106 sizeof(SHA384_CTX),
103 (md_init_fn *) SHA384Init, 107 (md_init_fn *) SHA384_Init,
104 (md_update_fn *) SHA384Update, 108 (md_update_fn *) SHA384_Update,
105 (md_final_fn *) SHA384Final 109 (md_final_fn *) SHA384_Final
106 }, 110 },
107 { 111 {
108 SSH_DIGEST_SHA512, 112 SSH_DIGEST_SHA512,
109 "SHA512", 113 "SHA512",
110 SHA512_BLOCK_LENGTH, 114 SHA512_BLOCK_LENGTH,
111 SHA512_DIGEST_LENGTH, 115 SHA512_DIGEST_LENGTH,
112 sizeof(SHA2_CTX), 116 sizeof(SHA512_CTX),
113 (md_init_fn *) SHA512Init, 117 (md_init_fn *) SHA512_Init,
114 (md_update_fn *) SHA512Update, 118 (md_update_fn *) SHA512_Update,
115 (md_final_fn *) SHA512Final 119 (md_final_fn *) SHA512_Final
116 } 120 }
117}; 121};
118 122
@@ -126,6 +130,26 @@ ssh_digest_by_alg(int alg)
126 return &(digests[alg]); 130 return &(digests[alg]);
127} 131}
128 132
133int
134ssh_digest_alg_by_name(const char *name)
135{
136 int alg;
137
138 for (alg = 0; alg < SSH_DIGEST_MAX; alg++) {
139 if (strcasecmp(name, digests[alg].name) == 0)
140 return digests[alg].id;
141 }
142 return -1;
143}
144
145const char *
146ssh_digest_alg_name(int alg)
147{
148 const struct ssh_digest *digest = ssh_digest_by_alg(alg);
149
150 return digest == NULL ? NULL : digest->name;
151}
152
129size_t 153size_t
130ssh_digest_bytes(int alg) 154ssh_digest_bytes(int alg)
131{ 155{
@@ -237,3 +261,4 @@ ssh_digest_buffer(int alg, const struct sshbuf *b, u_char *d, size_t dlen)
237{ 261{
238 return ssh_digest_memory(alg, sshbuf_ptr(b), sshbuf_len(b), d, dlen); 262 return ssh_digest_memory(alg, sshbuf_ptr(b), sshbuf_len(b), d, dlen);
239} 263}
264#endif /* !WITH_OPENSSL */
diff --git a/digest-openssl.c b/digest-openssl.c
index 02b170341..13b63c2f0 100644
--- a/digest-openssl.c
+++ b/digest-openssl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: digest-openssl.c,v 1.4 2014/07/03 03:26:43 djm Exp $ */ 1/* $OpenBSD: digest-openssl.c,v 1.5 2014/12/21 22:27:56 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2013 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2013 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -17,6 +17,8 @@
17 17
18#include "includes.h" 18#include "includes.h"
19 19
20#ifdef WITH_OPENSSL
21
20#include <sys/types.h> 22#include <sys/types.h>
21#include <limits.h> 23#include <limits.h>
22#include <stdlib.h> 24#include <stdlib.h>
@@ -74,6 +76,26 @@ ssh_digest_by_alg(int alg)
74 return &(digests[alg]); 76 return &(digests[alg]);
75} 77}
76 78
79int
80ssh_digest_alg_by_name(const char *name)
81{
82 int alg;
83
84 for (alg = 0; digests[alg].id != -1; alg++) {
85 if (strcasecmp(name, digests[alg].name) == 0)
86 return digests[alg].id;
87 }
88 return -1;
89}
90
91const char *
92ssh_digest_alg_name(int alg)
93{
94 const struct ssh_digest *digest = ssh_digest_by_alg(alg);
95
96 return digest == NULL ? NULL : digest->name;
97}
98
77size_t 99size_t
78ssh_digest_bytes(int alg) 100ssh_digest_bytes(int alg)
79{ 101{
@@ -180,3 +202,4 @@ ssh_digest_buffer(int alg, const struct sshbuf *b, u_char *d, size_t dlen)
180{ 202{
181 return ssh_digest_memory(alg, sshbuf_ptr(b), sshbuf_len(b), d, dlen); 203 return ssh_digest_memory(alg, sshbuf_ptr(b), sshbuf_len(b), d, dlen);
182} 204}
205#endif /* WITH_OPENSSL */
diff --git a/digest.h b/digest.h
index 6afb197f0..3fe073468 100644
--- a/digest.h
+++ b/digest.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: digest.h,v 1.6 2014/07/03 04:36:45 djm Exp $ */ 1/* $OpenBSD: digest.h,v 1.7 2014/12/21 22:27:56 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2013 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2013 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -33,6 +33,12 @@
33struct sshbuf; 33struct sshbuf;
34struct ssh_digest_ctx; 34struct ssh_digest_ctx;
35 35
36/* Looks up a digest algorithm by name */
37int ssh_digest_alg_by_name(const char *name);
38
39/* Returns the algorithm name for a digest identifier */
40const char *ssh_digest_alg_name(int alg);
41
36/* Returns the algorithm's digest length in bytes or 0 for invalid algorithm */ 42/* Returns the algorithm's digest length in bytes or 0 for invalid algorithm */
37size_t ssh_digest_bytes(int alg); 43size_t ssh_digest_bytes(int alg);
38 44
diff --git a/dispatch.c b/dispatch.c
index 64bb80947..afe618221 100644
--- a/dispatch.c
+++ b/dispatch.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dispatch.c,v 1.22 2008/10/31 15:05:34 stevesk Exp $ */ 1/* $OpenBSD: dispatch.c,v 1.26 2015/02/12 20:34:19 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -36,69 +36,123 @@
36#include "dispatch.h" 36#include "dispatch.h"
37#include "packet.h" 37#include "packet.h"
38#include "compat.h" 38#include "compat.h"
39#include "ssherr.h"
39 40
40#define DISPATCH_MAX 255 41int
41 42dispatch_protocol_error(int type, u_int32_t seq, void *ctx)
42dispatch_fn *dispatch[DISPATCH_MAX];
43
44void
45dispatch_protocol_error(int type, u_int32_t seq, void *ctxt)
46{ 43{
44 struct ssh *ssh = active_state; /* XXX */
45 int r;
46
47 logit("dispatch_protocol_error: type %d seq %u", type, seq); 47 logit("dispatch_protocol_error: type %d seq %u", type, seq);
48 if (!compat20) 48 if (!compat20)
49 fatal("protocol error"); 49 fatal("protocol error");
50 packet_start(SSH2_MSG_UNIMPLEMENTED); 50 if ((r = sshpkt_start(ssh, SSH2_MSG_UNIMPLEMENTED)) != 0 ||
51 packet_put_int(seq); 51 (r = sshpkt_put_u32(ssh, seq)) != 0 ||
52 packet_send(); 52 (r = sshpkt_send(ssh)) != 0 ||
53 packet_write_wait(); 53 (r = ssh_packet_write_wait(ssh)) != 0)
54 sshpkt_fatal(ssh, __func__, r);
55 return 0;
54} 56}
55void 57
56dispatch_protocol_ignore(int type, u_int32_t seq, void *ctxt) 58int
59dispatch_protocol_ignore(int type, u_int32_t seq, void *ssh)
57{ 60{
58 logit("dispatch_protocol_ignore: type %d seq %u", type, seq); 61 logit("dispatch_protocol_ignore: type %d seq %u", type, seq);
62 return 0;
59} 63}
64
60void 65void
61dispatch_init(dispatch_fn *dflt) 66ssh_dispatch_init(struct ssh *ssh, dispatch_fn *dflt)
62{ 67{
63 u_int i; 68 u_int i;
64 for (i = 0; i < DISPATCH_MAX; i++) 69 for (i = 0; i < DISPATCH_MAX; i++)
65 dispatch[i] = dflt; 70 ssh->dispatch[i] = dflt;
66} 71}
72
67void 73void
68dispatch_range(u_int from, u_int to, dispatch_fn *fn) 74ssh_dispatch_range(struct ssh *ssh, u_int from, u_int to, dispatch_fn *fn)
69{ 75{
70 u_int i; 76 u_int i;
71 77
72 for (i = from; i <= to; i++) { 78 for (i = from; i <= to; i++) {
73 if (i >= DISPATCH_MAX) 79 if (i >= DISPATCH_MAX)
74 break; 80 break;
75 dispatch[i] = fn; 81 ssh->dispatch[i] = fn;
76 } 82 }
77} 83}
84
78void 85void
79dispatch_set(int type, dispatch_fn *fn) 86ssh_dispatch_set(struct ssh *ssh, int type, dispatch_fn *fn)
80{ 87{
81 dispatch[type] = fn; 88 ssh->dispatch[type] = fn;
82} 89}
83void 90
84dispatch_run(int mode, volatile sig_atomic_t *done, void *ctxt) 91int
92ssh_dispatch_run(struct ssh *ssh, int mode, volatile sig_atomic_t *done,
93 void *ctxt)
85{ 94{
86 for (;;) { 95 int r;
87 int type; 96 u_char type;
88 u_int32_t seqnr; 97 u_int32_t seqnr;
89 98
99 for (;;) {
90 if (mode == DISPATCH_BLOCK) { 100 if (mode == DISPATCH_BLOCK) {
91 type = packet_read_seqnr(&seqnr); 101 r = ssh_packet_read_seqnr(ssh, &type, &seqnr);
102 if (r != 0)
103 return r;
92 } else { 104 } else {
93 type = packet_read_poll_seqnr(&seqnr); 105 r = ssh_packet_read_poll_seqnr(ssh, &type, &seqnr);
106 if (r != 0)
107 return r;
94 if (type == SSH_MSG_NONE) 108 if (type == SSH_MSG_NONE)
95 return; 109 return 0;
110 }
111 if (type > 0 && type < DISPATCH_MAX &&
112 ssh->dispatch[type] != NULL) {
113 if (ssh->dispatch_skip_packets) {
114 debug2("skipped packet (type %u)", type);
115 ssh->dispatch_skip_packets--;
116 continue;
117 }
118 /* XXX 'ssh' will replace 'ctxt' later */
119 r = (*ssh->dispatch[type])(type, seqnr, ctxt);
120 if (r != 0)
121 return r;
122 } else {
123 r = sshpkt_disconnect(ssh,
124 "protocol error: rcvd type %d", type);
125 if (r != 0)
126 return r;
127 return SSH_ERR_DISCONNECTED;
96 } 128 }
97 if (type > 0 && type < DISPATCH_MAX && dispatch[type] != NULL)
98 (*dispatch[type])(type, seqnr, ctxt);
99 else
100 packet_disconnect("protocol error: rcvd type %d", type);
101 if (done != NULL && *done) 129 if (done != NULL && *done)
102 return; 130 return 0;
131 }
132}
133
134void
135ssh_dispatch_run_fatal(struct ssh *ssh, int mode, volatile sig_atomic_t *done,
136 void *ctxt)
137{
138 int r;
139
140 if ((r = ssh_dispatch_run(ssh, mode, done, ctxt)) != 0) {
141 switch (r) {
142 case SSH_ERR_CONN_CLOSED:
143 logit("Connection closed by %.200s",
144 ssh_remote_ipaddr(ssh));
145 cleanup_exit(255);
146 case SSH_ERR_CONN_TIMEOUT:
147 logit("Connection to %.200s timed out while "
148 "waiting to read", ssh_remote_ipaddr(ssh));
149 cleanup_exit(255);
150 case SSH_ERR_DISCONNECTED:
151 logit("Disconnected from %.200s",
152 ssh_remote_ipaddr(ssh));
153 cleanup_exit(255);
154 default:
155 fatal("%s: %s", __func__, ssh_err(r));
156 }
103 } 157 }
104} 158}
diff --git a/dispatch.h b/dispatch.h
index 3e3d1a1ad..cd51dbc0b 100644
--- a/dispatch.h
+++ b/dispatch.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dispatch.h,v 1.11 2006/04/20 09:27:09 djm Exp $ */ 1/* $OpenBSD: dispatch.h,v 1.12 2015/01/19 20:07:45 markus Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -24,18 +24,35 @@
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27#include <signal.h> 27#ifndef DISPATCH_H
28#define DISPATCH_H
29
30#define DISPATCH_MAX 255
28 31
29enum { 32enum {
30 DISPATCH_BLOCK, 33 DISPATCH_BLOCK,
31 DISPATCH_NONBLOCK 34 DISPATCH_NONBLOCK
32}; 35};
33 36
34typedef void dispatch_fn(int, u_int32_t, void *); 37struct ssh;
38
39typedef int dispatch_fn(int, u_int32_t, void *);
40
41int dispatch_protocol_error(int, u_int32_t, void *);
42int dispatch_protocol_ignore(int, u_int32_t, void *);
43void ssh_dispatch_init(struct ssh *, dispatch_fn *);
44void ssh_dispatch_set(struct ssh *, int, dispatch_fn *);
45void ssh_dispatch_range(struct ssh *, u_int, u_int, dispatch_fn *);
46int ssh_dispatch_run(struct ssh *, int, volatile sig_atomic_t *, void *);
47void ssh_dispatch_run_fatal(struct ssh *, int, volatile sig_atomic_t *, void *);
48
49#define dispatch_init(dflt) \
50 ssh_dispatch_init(active_state, (dflt))
51#define dispatch_range(from, to, fn) \
52 ssh_dispatch_range(active_state, (from), (to), (fn))
53#define dispatch_set(type, fn) \
54 ssh_dispatch_set(active_state, (type), (fn))
55#define dispatch_run(mode, done, ctxt) \
56 ssh_dispatch_run_fatal(active_state, (mode), (done), (ctxt))
35 57
36void dispatch_init(dispatch_fn *); 58#endif
37void dispatch_set(int, dispatch_fn *);
38void dispatch_range(u_int, u_int, dispatch_fn *);
39void dispatch_run(int, volatile sig_atomic_t *, void *);
40void dispatch_protocol_error(int, u_int32_t, void *);
41void dispatch_protocol_ignore(int, u_int32_t, void *);
diff --git a/dns.c b/dns.c
index c4d073cf5..f201b602e 100644
--- a/dns.c
+++ b/dns.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dns.c,v 1.31 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: dns.c,v 1.34 2015/01/28 22:36:00 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wesley Griffin. All rights reserved. 4 * Copyright (c) 2003 Wesley Griffin. All rights reserved.
@@ -38,9 +38,11 @@
38#include <stdlib.h> 38#include <stdlib.h>
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "key.h" 41#include "sshkey.h"
42#include "ssherr.h"
42#include "dns.h" 43#include "dns.h"
43#include "log.h" 44#include "log.h"
45#include "digest.h"
44 46
45static const char *errset_text[] = { 47static const char *errset_text[] = {
46 "success", /* 0 ERRSET_SUCCESS */ 48 "success", /* 0 ERRSET_SUCCESS */
@@ -77,10 +79,10 @@ dns_result_totext(unsigned int res)
77 */ 79 */
78static int 80static int
79dns_read_key(u_int8_t *algorithm, u_int8_t *digest_type, 81dns_read_key(u_int8_t *algorithm, u_int8_t *digest_type,
80 u_char **digest, u_int *digest_len, Key *key) 82 u_char **digest, size_t *digest_len, struct sshkey *key)
81{ 83{
82 int success = 0; 84 int r, success = 0;
83 enum fp_type fp_type = 0; 85 int fp_alg = -1;
84 86
85 switch (key->type) { 87 switch (key->type) {
86 case KEY_RSA: 88 case KEY_RSA:
@@ -110,19 +112,20 @@ dns_read_key(u_int8_t *algorithm, u_int8_t *digest_type,
110 112
111 switch (*digest_type) { 113 switch (*digest_type) {
112 case SSHFP_HASH_SHA1: 114 case SSHFP_HASH_SHA1:
113 fp_type = SSH_FP_SHA1; 115 fp_alg = SSH_DIGEST_SHA1;
114 break; 116 break;
115 case SSHFP_HASH_SHA256: 117 case SSHFP_HASH_SHA256:
116 fp_type = SSH_FP_SHA256; 118 fp_alg = SSH_DIGEST_SHA256;
117 break; 119 break;
118 default: 120 default:
119 *digest_type = SSHFP_HASH_RESERVED; /* 0 */ 121 *digest_type = SSHFP_HASH_RESERVED; /* 0 */
120 } 122 }
121 123
122 if (*algorithm && *digest_type) { 124 if (*algorithm && *digest_type) {
123 *digest = key_fingerprint_raw(key, fp_type, digest_len); 125 if ((r = sshkey_fingerprint_raw(key, fp_alg, digest,
124 if (*digest == NULL) 126 digest_len)) != 0)
125 fatal("dns_read_key: null from key_fingerprint_raw()"); 127 fatal("%s: sshkey_fingerprint_raw: %s", __func__,
128 ssh_err(r));
126 success = 1; 129 success = 1;
127 } else { 130 } else {
128 *digest = NULL; 131 *digest = NULL;
@@ -138,7 +141,7 @@ dns_read_key(u_int8_t *algorithm, u_int8_t *digest_type,
138 */ 141 */
139static int 142static int
140dns_read_rdata(u_int8_t *algorithm, u_int8_t *digest_type, 143dns_read_rdata(u_int8_t *algorithm, u_int8_t *digest_type,
141 u_char **digest, u_int *digest_len, u_char *rdata, int rdata_len) 144 u_char **digest, size_t *digest_len, u_char *rdata, int rdata_len)
142{ 145{
143 int success = 0; 146 int success = 0;
144 147
@@ -199,7 +202,7 @@ is_numeric_hostname(const char *hostname)
199 */ 202 */
200int 203int
201verify_host_key_dns(const char *hostname, struct sockaddr *address, 204verify_host_key_dns(const char *hostname, struct sockaddr *address,
202 Key *hostkey, int *flags) 205 struct sshkey *hostkey, int *flags)
203{ 206{
204 u_int counter; 207 u_int counter;
205 int result; 208 int result;
@@ -208,12 +211,12 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address,
208 u_int8_t hostkey_algorithm; 211 u_int8_t hostkey_algorithm;
209 u_int8_t hostkey_digest_type = SSHFP_HASH_RESERVED; 212 u_int8_t hostkey_digest_type = SSHFP_HASH_RESERVED;
210 u_char *hostkey_digest; 213 u_char *hostkey_digest;
211 u_int hostkey_digest_len; 214 size_t hostkey_digest_len;
212 215
213 u_int8_t dnskey_algorithm; 216 u_int8_t dnskey_algorithm;
214 u_int8_t dnskey_digest_type; 217 u_int8_t dnskey_digest_type;
215 u_char *dnskey_digest; 218 u_char *dnskey_digest;
216 u_int dnskey_digest_len; 219 size_t dnskey_digest_len;
217 220
218 *flags = 0; 221 *flags = 0;
219 222
@@ -291,7 +294,7 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address,
291 free(dnskey_digest); 294 free(dnskey_digest);
292 } 295 }
293 296
294 free(hostkey_digest); /* from key_fingerprint_raw() */ 297 free(hostkey_digest); /* from sshkey_fingerprint_raw() */
295 freerrset(fingerprints); 298 freerrset(fingerprints);
296 299
297 if (*flags & DNS_VERIFY_FOUND) 300 if (*flags & DNS_VERIFY_FOUND)
@@ -309,13 +312,13 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address,
309 * Export the fingerprint of a key as a DNS resource record 312 * Export the fingerprint of a key as a DNS resource record
310 */ 313 */
311int 314int
312export_dns_rr(const char *hostname, Key *key, FILE *f, int generic) 315export_dns_rr(const char *hostname, struct sshkey *key, FILE *f, int generic)
313{ 316{
314 u_int8_t rdata_pubkey_algorithm = 0; 317 u_int8_t rdata_pubkey_algorithm = 0;
315 u_int8_t rdata_digest_type = SSHFP_HASH_RESERVED; 318 u_int8_t rdata_digest_type = SSHFP_HASH_RESERVED;
316 u_int8_t dtype; 319 u_int8_t dtype;
317 u_char *rdata_digest; 320 u_char *rdata_digest;
318 u_int i, rdata_digest_len; 321 size_t i, rdata_digest_len;
319 int success = 0; 322 int success = 0;
320 323
321 for (dtype = SSHFP_HASH_SHA1; dtype < SSHFP_HASH_MAX; dtype++) { 324 for (dtype = SSHFP_HASH_SHA1; dtype < SSHFP_HASH_MAX; dtype++) {
@@ -323,7 +326,7 @@ export_dns_rr(const char *hostname, Key *key, FILE *f, int generic)
323 if (dns_read_key(&rdata_pubkey_algorithm, &rdata_digest_type, 326 if (dns_read_key(&rdata_pubkey_algorithm, &rdata_digest_type,
324 &rdata_digest, &rdata_digest_len, key)) { 327 &rdata_digest, &rdata_digest_len, key)) {
325 if (generic) { 328 if (generic) {
326 fprintf(f, "%s IN TYPE%d \\# %d %02x %02x ", 329 fprintf(f, "%s IN TYPE%d \\# %zu %02x %02x ",
327 hostname, DNS_RDATATYPE_SSHFP, 330 hostname, DNS_RDATATYPE_SSHFP,
328 2 + rdata_digest_len, 331 2 + rdata_digest_len,
329 rdata_pubkey_algorithm, rdata_digest_type); 332 rdata_pubkey_algorithm, rdata_digest_type);
@@ -334,7 +337,7 @@ export_dns_rr(const char *hostname, Key *key, FILE *f, int generic)
334 for (i = 0; i < rdata_digest_len; i++) 337 for (i = 0; i < rdata_digest_len; i++)
335 fprintf(f, "%02x", rdata_digest[i]); 338 fprintf(f, "%02x", rdata_digest[i]);
336 fprintf(f, "\n"); 339 fprintf(f, "\n");
337 free(rdata_digest); /* from key_fingerprint_raw() */ 340 free(rdata_digest); /* from sshkey_fingerprint_raw() */
338 success = 1; 341 success = 1;
339 } 342 }
340 } 343 }
diff --git a/dns.h b/dns.h
index b9feae6be..815f073a1 100644
--- a/dns.h
+++ b/dns.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dns.h,v 1.13 2014/04/20 09:24:26 logan Exp $ */ 1/* $OpenBSD: dns.h,v 1.14 2015/01/15 09:40:00 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wesley Griffin. All rights reserved. 4 * Copyright (c) 2003 Wesley Griffin. All rights reserved.
@@ -50,7 +50,8 @@ enum sshfp_hashes {
50#define DNS_VERIFY_MATCH 0x00000002 50#define DNS_VERIFY_MATCH 0x00000002
51#define DNS_VERIFY_SECURE 0x00000004 51#define DNS_VERIFY_SECURE 0x00000004
52 52
53int verify_host_key_dns(const char *, struct sockaddr *, Key *, int *); 53int verify_host_key_dns(const char *, struct sockaddr *,
54int export_dns_rr(const char *, Key *, FILE *, int); 54 struct sshkey *, int *);
55int export_dns_rr(const char *, struct sshkey *, FILE *, int);
55 56
56#endif /* DNS_H */ 57#endif /* DNS_H */
diff --git a/entropy.c b/entropy.c
index 1e9d52ac4..9305f89ae 100644
--- a/entropy.c
+++ b/entropy.c
@@ -24,6 +24,8 @@
24 24
25#include "includes.h" 25#include "includes.h"
26 26
27#ifdef WITH_OPENSSL
28
27#include <sys/types.h> 29#include <sys/types.h>
28#include <sys/socket.h> 30#include <sys/socket.h>
29#ifdef HAVE_SYS_UN_H 31#ifdef HAVE_SYS_UN_H
@@ -230,3 +232,13 @@ seed_rng(void)
230 if (RAND_status() != 1) 232 if (RAND_status() != 1)
231 fatal("PRNG is not seeded"); 233 fatal("PRNG is not seeded");
232} 234}
235
236#else /* WITH_OPENSSL */
237
238/* Handled in arc4random() */
239void
240seed_rng(void)
241{
242}
243
244#endif /* WITH_OPENSSL */
diff --git a/ge25519.h b/ge25519.h
index 64f63c6f8..a09763760 100644
--- a/ge25519.h
+++ b/ge25519.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ge25519.h,v 1.3 2013/12/09 11:03:45 markus Exp $ */ 1/* $OpenBSD: ge25519.h,v 1.4 2015/02/16 18:26:26 miod Exp $ */
2 2
3/* 3/*
4 * Public Domain, Authors: Daniel J. Bernstein, Niels Duif, Tanja Lange, 4 * Public Domain, Authors: Daniel J. Bernstein, Niels Duif, Tanja Lange,
@@ -28,7 +28,7 @@ typedef struct
28 fe25519 t; 28 fe25519 t;
29} ge25519; 29} ge25519;
30 30
31const ge25519 ge25519_base; 31extern const ge25519 ge25519_base;
32 32
33int ge25519_unpackneg_vartime(ge25519 *r, const unsigned char p[32]); 33int ge25519_unpackneg_vartime(ge25519 *r, const unsigned char p[32]);
34 34
diff --git a/groupaccess.c b/groupaccess.c
index 1eab10b19..4fca04471 100644
--- a/groupaccess.c
+++ b/groupaccess.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: groupaccess.c,v 1.14 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: groupaccess.c,v 1.15 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Kevin Steves. All rights reserved. 3 * Copyright (c) 2001 Kevin Steves. All rights reserved.
4 * 4 *
@@ -26,13 +26,13 @@
26#include "includes.h" 26#include "includes.h"
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/param.h>
30 29
31#include <grp.h> 30#include <grp.h>
32#include <unistd.h> 31#include <unistd.h>
33#include <stdarg.h> 32#include <stdarg.h>
34#include <stdlib.h> 33#include <stdlib.h>
35#include <string.h> 34#include <string.h>
35#include <limits.h>
36 36
37#include "xmalloc.h" 37#include "xmalloc.h"
38#include "groupaccess.h" 38#include "groupaccess.h"
diff --git a/gss-genr.c b/gss-genr.c
index b39281bc1..60ac65f8d 100644
--- a/gss-genr.c
+++ b/gss-genr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gss-genr.c,v 1.22 2013/11/08 00:39:15 djm Exp $ */ 1/* $OpenBSD: gss-genr.c,v 1.23 2015/01/20 23:14:00 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved.
@@ -31,6 +31,7 @@
31#include <sys/types.h> 31#include <sys/types.h>
32#include <sys/param.h> 32#include <sys/param.h>
33 33
34#include <limits.h>
34#include <stdarg.h> 35#include <stdarg.h>
35#include <string.h> 36#include <string.h>
36#include <unistd.h> 37#include <unistd.h>
diff --git a/gss-serv.c b/gss-serv.c
index 5c599247b..e7b8c5223 100644
--- a/gss-serv.c
+++ b/gss-serv.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gss-serv.c,v 1.27 2014/07/03 03:34:09 djm Exp $ */ 1/* $OpenBSD: gss-serv.c,v 1.28 2015/01/20 23:14:00 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -29,7 +29,6 @@
29#ifdef GSSAPI 29#ifdef GSSAPI
30 30
31#include <sys/types.h> 31#include <sys/types.h>
32#include <sys/param.h>
33 32
34#include <stdarg.h> 33#include <stdarg.h>
35#include <string.h> 34#include <string.h>
diff --git a/hmac.c b/hmac.c
index 99317b0f9..d1c12417e 100644
--- a/hmac.c
+++ b/hmac.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hmac.c,v 1.10 2014/01/31 16:39:19 tedu Exp $ */ 1/* $OpenBSD: hmac.c,v 1.11 2015/01/15 21:37:14 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Markus Friedl. All rights reserved. 3 * Copyright (c) 2014 Markus Friedl. All rights reserved.
4 * 4 *
@@ -20,7 +20,7 @@
20#include <sys/types.h> 20#include <sys/types.h>
21#include <string.h> 21#include <string.h>
22 22
23#include "buffer.h" 23#include "sshbuf.h"
24#include "digest.h" 24#include "digest.h"
25#include "hmac.h" 25#include "hmac.h"
26 26
@@ -96,7 +96,7 @@ ssh_hmac_update(struct ssh_hmac_ctx *ctx, const void *m, size_t mlen)
96} 96}
97 97
98int 98int
99ssh_hmac_update_buffer(struct ssh_hmac_ctx *ctx, const Buffer *b) 99ssh_hmac_update_buffer(struct ssh_hmac_ctx *ctx, const struct sshbuf *b)
100{ 100{
101 return ssh_digest_update_buffer(ctx->digest, b); 101 return ssh_digest_update_buffer(ctx->digest, b);
102} 102}
diff --git a/hostfile.c b/hostfile.c
index ee2daf45f..b235795e6 100644
--- a/hostfile.c
+++ b/hostfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hostfile.c,v 1.57 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: hostfile.c,v 1.64 2015/02/16 22:08:57 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -39,22 +39,26 @@
39#include "includes.h" 39#include "includes.h"
40 40
41#include <sys/types.h> 41#include <sys/types.h>
42#include <sys/stat.h>
42 43
43#include <netinet/in.h> 44#include <netinet/in.h>
44 45
46#include <errno.h>
45#include <resolv.h> 47#include <resolv.h>
46#include <stdarg.h> 48#include <stdarg.h>
47#include <stdio.h> 49#include <stdio.h>
48#include <stdlib.h> 50#include <stdlib.h>
49#include <string.h> 51#include <string.h>
50#include <stdarg.h> 52#include <stdarg.h>
53#include <unistd.h>
51 54
52#include "xmalloc.h" 55#include "xmalloc.h"
53#include "match.h" 56#include "match.h"
54#include "key.h" 57#include "sshkey.h"
55#include "hostfile.h" 58#include "hostfile.h"
56#include "log.h" 59#include "log.h"
57#include "misc.h" 60#include "misc.h"
61#include "ssherr.h"
58#include "digest.h" 62#include "digest.h"
59#include "hmac.h" 63#include "hmac.h"
60 64
@@ -63,6 +67,8 @@ struct hostkeys {
63 u_int num_entries; 67 u_int num_entries;
64}; 68};
65 69
70/* XXX hmac is too easy to dictionary attack; use bcrypt? */
71
66static int 72static int
67extract_salt(const char *s, u_int l, u_char *salt, size_t salt_len) 73extract_salt(const char *s, u_int l, u_char *salt, size_t salt_len)
68{ 74{
@@ -155,15 +161,16 @@ host_hash(const char *host, const char *name_from_hostfile, u_int src_len)
155 */ 161 */
156 162
157int 163int
158hostfile_read_key(char **cpp, int *bitsp, Key *ret) 164hostfile_read_key(char **cpp, u_int *bitsp, struct sshkey *ret)
159{ 165{
160 char *cp; 166 char *cp;
167 int r;
161 168
162 /* Skip leading whitespace. */ 169 /* Skip leading whitespace. */
163 for (cp = *cpp; *cp == ' ' || *cp == '\t'; cp++) 170 for (cp = *cpp; *cp == ' ' || *cp == '\t'; cp++)
164 ; 171 ;
165 172
166 if (key_read(ret, &cp) != 1) 173 if ((r = sshkey_read(ret, &cp)) != 0)
167 return 0; 174 return 0;
168 175
169 /* Skip trailing whitespace. */ 176 /* Skip trailing whitespace. */
@@ -172,28 +179,8 @@ hostfile_read_key(char **cpp, int *bitsp, Key *ret)
172 179
173 /* Return results. */ 180 /* Return results. */
174 *cpp = cp; 181 *cpp = cp;
175 if (bitsp != NULL) { 182 if (bitsp != NULL)
176 if ((*bitsp = key_size(ret)) <= 0) 183 *bitsp = sshkey_size(ret);
177 return 0;
178 }
179 return 1;
180}
181
182static int
183hostfile_check_key(int bits, const Key *key, const char *host,
184 const char *filename, u_long linenum)
185{
186#ifdef WITH_SSH1
187 if (key == NULL || key->type != KEY_RSA1 || key->rsa == NULL)
188 return 1;
189 if (bits != BN_num_bits(key->rsa->n)) {
190 logit("Warning: %s, line %lu: keysize mismatch for host %s: "
191 "actual %d vs. announced %d.",
192 filename, linenum, host, BN_num_bits(key->rsa->n), bits);
193 logit("Warning: replace %d with %d in %s, line %lu.",
194 bits, BN_num_bits(key->rsa->n), filename, linenum);
195 }
196#endif
197 return 1; 184 return 1;
198} 185}
199 186
@@ -241,95 +228,65 @@ init_hostkeys(void)
241 return ret; 228 return ret;
242} 229}
243 230
244void 231struct load_callback_ctx {
245load_hostkeys(struct hostkeys *hostkeys, const char *host, const char *path) 232 const char *host;
246{ 233 u_long num_loaded;
247 FILE *f; 234 struct hostkeys *hostkeys;
248 char line[8192]; 235};
249 u_long linenum = 0, num_loaded = 0;
250 char *cp, *cp2, *hashed_host;
251 HostkeyMarker marker;
252 Key *key;
253 int kbits;
254
255 if ((f = fopen(path, "r")) == NULL)
256 return;
257 debug3("%s: loading entries for host \"%.100s\" from file \"%s\"",
258 __func__, host, path);
259 while (read_keyfile_line(f, path, line, sizeof(line), &linenum) == 0) {
260 cp = line;
261
262 /* Skip any leading whitespace, comments and empty lines. */
263 for (; *cp == ' ' || *cp == '\t'; cp++)
264 ;
265 if (!*cp || *cp == '#' || *cp == '\n')
266 continue;
267
268 if ((marker = check_markers(&cp)) == MRK_ERROR) {
269 verbose("%s: invalid marker at %s:%lu",
270 __func__, path, linenum);
271 continue;
272 }
273 236
274 /* Find the end of the host name portion. */ 237static int
275 for (cp2 = cp; *cp2 && *cp2 != ' ' && *cp2 != '\t'; cp2++) 238record_hostkey(struct hostkey_foreach_line *l, void *_ctx)
276 ; 239{
240 struct load_callback_ctx *ctx = (struct load_callback_ctx *)_ctx;
241 struct hostkeys *hostkeys = ctx->hostkeys;
242 struct hostkey_entry *tmp;
277 243
278 /* Check if the host name matches. */ 244 if (l->status == HKF_STATUS_INVALID) {
279 if (match_hostname(host, cp, (u_int) (cp2 - cp)) != 1) { 245 error("%s:%ld: parse error in hostkeys file",
280 if (*cp != HASH_DELIM) 246 l->path, l->linenum);
281 continue; 247 return 0;
282 hashed_host = host_hash(host, cp, (u_int) (cp2 - cp)); 248 }
283 if (hashed_host == NULL) {
284 debug("Invalid hashed host line %lu of %s",
285 linenum, path);
286 continue;
287 }
288 if (strncmp(hashed_host, cp, (u_int) (cp2 - cp)) != 0)
289 continue;
290 }
291 249
292 /* Got a match. Skip host name. */ 250 debug3("%s: found %skey type %s in file %s:%lu", __func__,
293 cp = cp2; 251 l->marker == MRK_NONE ? "" :
252 (l->marker == MRK_CA ? "ca " : "revoked "),
253 sshkey_type(l->key), l->path, l->linenum);
254 if ((tmp = reallocarray(hostkeys->entries,
255 hostkeys->num_entries + 1, sizeof(*hostkeys->entries))) == NULL)
256 return SSH_ERR_ALLOC_FAIL;
257 hostkeys->entries = tmp;
258 hostkeys->entries[hostkeys->num_entries].host = xstrdup(ctx->host);
259 hostkeys->entries[hostkeys->num_entries].file = xstrdup(l->path);
260 hostkeys->entries[hostkeys->num_entries].line = l->linenum;
261 hostkeys->entries[hostkeys->num_entries].key = l->key;
262 l->key = NULL; /* steal it */
263 hostkeys->entries[hostkeys->num_entries].marker = l->marker;
264 hostkeys->num_entries++;
265 ctx->num_loaded++;
294 266
295 /* 267 return 0;
296 * Extract the key from the line. This will skip any leading 268}
297 * whitespace. Ignore badly formatted lines.
298 */
299 key = key_new(KEY_UNSPEC);
300 if (!hostfile_read_key(&cp, &kbits, key)) {
301 key_free(key);
302#ifdef WITH_SSH1
303 key = key_new(KEY_RSA1);
304 if (!hostfile_read_key(&cp, &kbits, key)) {
305 key_free(key);
306 continue;
307 }
308#else
309 continue;
310#endif
311 }
312 if (!hostfile_check_key(kbits, key, host, path, linenum))
313 continue;
314 269
315 debug3("%s: found %skey type %s in file %s:%lu", __func__, 270void
316 marker == MRK_NONE ? "" : 271load_hostkeys(struct hostkeys *hostkeys, const char *host, const char *path)
317 (marker == MRK_CA ? "ca " : "revoked "), 272{
318 key_type(key), path, linenum); 273 int r;
319 hostkeys->entries = xrealloc(hostkeys->entries, 274 struct load_callback_ctx ctx;
320 hostkeys->num_entries + 1, sizeof(*hostkeys->entries)); 275
321 hostkeys->entries[hostkeys->num_entries].host = xstrdup(host); 276 ctx.host = host;
322 hostkeys->entries[hostkeys->num_entries].file = xstrdup(path); 277 ctx.num_loaded = 0;
323 hostkeys->entries[hostkeys->num_entries].line = linenum; 278 ctx.hostkeys = hostkeys;
324 hostkeys->entries[hostkeys->num_entries].key = key; 279
325 hostkeys->entries[hostkeys->num_entries].marker = marker; 280 if ((r = hostkeys_foreach(path, record_hostkey, &ctx, host, NULL,
326 hostkeys->num_entries++; 281 HKF_WANT_MATCH|HKF_WANT_PARSE_KEY)) != 0) {
327 num_loaded++; 282 if (r != SSH_ERR_SYSTEM_ERROR && errno != ENOENT)
283 debug("%s: hostkeys_foreach failed for %s: %s",
284 __func__, path, ssh_err(r));
328 } 285 }
329 debug3("%s: loaded %lu keys", __func__, num_loaded); 286 if (ctx.num_loaded != 0)
330 fclose(f); 287 debug3("%s: loaded %lu keys from %s", __func__,
331 return; 288 ctx.num_loaded, host);
332} 289}
333 290
334void 291void
335free_hostkeys(struct hostkeys *hostkeys) 292free_hostkeys(struct hostkeys *hostkeys)
@@ -339,7 +296,7 @@ free_hostkeys(struct hostkeys *hostkeys)
339 for (i = 0; i < hostkeys->num_entries; i++) { 296 for (i = 0; i < hostkeys->num_entries; i++) {
340 free(hostkeys->entries[i].host); 297 free(hostkeys->entries[i].host);
341 free(hostkeys->entries[i].file); 298 free(hostkeys->entries[i].file);
342 key_free(hostkeys->entries[i].key); 299 sshkey_free(hostkeys->entries[i].key);
343 explicit_bzero(hostkeys->entries + i, sizeof(*hostkeys->entries)); 300 explicit_bzero(hostkeys->entries + i, sizeof(*hostkeys->entries));
344 } 301 }
345 free(hostkeys->entries); 302 free(hostkeys->entries);
@@ -348,18 +305,18 @@ free_hostkeys(struct hostkeys *hostkeys)
348} 305}
349 306
350static int 307static int
351check_key_not_revoked(struct hostkeys *hostkeys, Key *k) 308check_key_not_revoked(struct hostkeys *hostkeys, struct sshkey *k)
352{ 309{
353 int is_cert = key_is_cert(k); 310 int is_cert = sshkey_is_cert(k);
354 u_int i; 311 u_int i;
355 312
356 for (i = 0; i < hostkeys->num_entries; i++) { 313 for (i = 0; i < hostkeys->num_entries; i++) {
357 if (hostkeys->entries[i].marker != MRK_REVOKE) 314 if (hostkeys->entries[i].marker != MRK_REVOKE)
358 continue; 315 continue;
359 if (key_equal_public(k, hostkeys->entries[i].key)) 316 if (sshkey_equal_public(k, hostkeys->entries[i].key))
360 return -1; 317 return -1;
361 if (is_cert && 318 if (is_cert &&
362 key_equal_public(k->cert->signature_key, 319 sshkey_equal_public(k->cert->signature_key,
363 hostkeys->entries[i].key)) 320 hostkeys->entries[i].key))
364 return -1; 321 return -1;
365 } 322 }
@@ -383,11 +340,11 @@ check_key_not_revoked(struct hostkeys *hostkeys, Key *k)
383 */ 340 */
384static HostStatus 341static HostStatus
385check_hostkeys_by_key_or_type(struct hostkeys *hostkeys, 342check_hostkeys_by_key_or_type(struct hostkeys *hostkeys,
386 Key *k, int keytype, const struct hostkey_entry **found) 343 struct sshkey *k, int keytype, const struct hostkey_entry **found)
387{ 344{
388 u_int i; 345 u_int i;
389 HostStatus end_return = HOST_NEW; 346 HostStatus end_return = HOST_NEW;
390 int want_cert = key_is_cert(k); 347 int want_cert = sshkey_is_cert(k);
391 HostkeyMarker want_marker = want_cert ? MRK_CA : MRK_NONE; 348 HostkeyMarker want_marker = want_cert ? MRK_CA : MRK_NONE;
392 int proto = (k ? k->type : keytype) == KEY_RSA1 ? 1 : 2; 349 int proto = (k ? k->type : keytype) == KEY_RSA1 ? 1 : 2;
393 350
@@ -411,7 +368,7 @@ check_hostkeys_by_key_or_type(struct hostkeys *hostkeys,
411 break; 368 break;
412 } 369 }
413 if (want_cert) { 370 if (want_cert) {
414 if (key_equal_public(k->cert->signature_key, 371 if (sshkey_equal_public(k->cert->signature_key,
415 hostkeys->entries[i].key)) { 372 hostkeys->entries[i].key)) {
416 /* A matching CA exists */ 373 /* A matching CA exists */
417 end_return = HOST_OK; 374 end_return = HOST_OK;
@@ -420,7 +377,7 @@ check_hostkeys_by_key_or_type(struct hostkeys *hostkeys,
420 break; 377 break;
421 } 378 }
422 } else { 379 } else {
423 if (key_equal(k, hostkeys->entries[i].key)) { 380 if (sshkey_equal(k, hostkeys->entries[i].key)) {
424 end_return = HOST_OK; 381 end_return = HOST_OK;
425 if (found != NULL) 382 if (found != NULL)
426 *found = hostkeys->entries + i; 383 *found = hostkeys->entries + i;
@@ -439,9 +396,9 @@ check_hostkeys_by_key_or_type(struct hostkeys *hostkeys,
439 } 396 }
440 return end_return; 397 return end_return;
441} 398}
442 399
443HostStatus 400HostStatus
444check_key_in_hostkeys(struct hostkeys *hostkeys, Key *key, 401check_key_in_hostkeys(struct hostkeys *hostkeys, struct sshkey *key,
445 const struct hostkey_entry **found) 402 const struct hostkey_entry **found)
446{ 403{
447 if (key == NULL) 404 if (key == NULL)
@@ -457,40 +414,438 @@ lookup_key_in_hostkeys_by_type(struct hostkeys *hostkeys, int keytype,
457 found) == HOST_FOUND); 414 found) == HOST_FOUND);
458} 415}
459 416
417static int
418write_host_entry(FILE *f, const char *host, const char *ip,
419 const struct sshkey *key, int store_hash)
420{
421 int r, success = 0;
422 char *hashed_host = NULL;
423
424 if (store_hash) {
425 if ((hashed_host = host_hash(host, NULL, 0)) == NULL) {
426 error("%s: host_hash failed", __func__);
427 return 0;
428 }
429 fprintf(f, "%s ", hashed_host);
430 } else if (ip != NULL)
431 fprintf(f, "%s,%s ", host, ip);
432 else
433 fprintf(f, "%s ", host);
434
435 if ((r = sshkey_write(key, f)) == 0)
436 success = 1;
437 else
438 error("%s: sshkey_write failed: %s", __func__, ssh_err(r));
439 fputc('\n', f);
440 return success;
441}
442
460/* 443/*
461 * Appends an entry to the host file. Returns false if the entry could not 444 * Appends an entry to the host file. Returns false if the entry could not
462 * be appended. 445 * be appended.
463 */ 446 */
464
465int 447int
466add_host_to_hostfile(const char *filename, const char *host, const Key *key, 448add_host_to_hostfile(const char *filename, const char *host,
467 int store_hash) 449 const struct sshkey *key, int store_hash)
468{ 450{
469 FILE *f; 451 FILE *f;
470 int success = 0; 452 int success;
471 char *hashed_host = NULL;
472 453
473 if (key == NULL) 454 if (key == NULL)
474 return 1; /* XXX ? */ 455 return 1; /* XXX ? */
475 f = fopen(filename, "a"); 456 f = fopen(filename, "a");
476 if (!f) 457 if (!f)
477 return 0; 458 return 0;
459 success = write_host_entry(f, host, NULL, key, store_hash);
460 fclose(f);
461 return success;
462}
478 463
479 if (store_hash) { 464struct host_delete_ctx {
480 if ((hashed_host = host_hash(host, NULL, 0)) == NULL) { 465 FILE *out;
481 error("add_host_to_hostfile: host_hash failed"); 466 int quiet;
482 fclose(f); 467 const char *host;
468 int *skip_keys; /* XXX split for host/ip? might want to ensure both */
469 struct sshkey * const *keys;
470 size_t nkeys;
471 int modified;
472};
473
474static int
475host_delete(struct hostkey_foreach_line *l, void *_ctx)
476{
477 struct host_delete_ctx *ctx = (struct host_delete_ctx *)_ctx;
478 int loglevel = ctx->quiet ? SYSLOG_LEVEL_DEBUG1 : SYSLOG_LEVEL_VERBOSE;
479 size_t i;
480
481 if (l->status == HKF_STATUS_MATCHED) {
482 if (l->marker != MRK_NONE) {
483 /* Don't remove CA and revocation lines */
484 fprintf(ctx->out, "%s\n", l->line);
485 return 0;
486 }
487
488 /* XXX might need a knob for this later */
489 /* Don't remove RSA1 keys */
490 if (l->key->type == KEY_RSA1) {
491 fprintf(ctx->out, "%s\n", l->line);
483 return 0; 492 return 0;
484 } 493 }
494
495 /*
496 * If this line contains one of the keys that we will be
497 * adding later, then don't change it and mark the key for
498 * skipping.
499 */
500 for (i = 0; i < ctx->nkeys; i++) {
501 if (sshkey_equal(ctx->keys[i], l->key)) {
502 ctx->skip_keys[i] = 1;
503 fprintf(ctx->out, "%s\n", l->line);
504 debug3("%s: %s key already at %s:%ld", __func__,
505 sshkey_type(l->key), l->path, l->linenum);
506 return 0;
507 }
508 }
509
510 /*
511 * Hostname matches and has no CA/revoke marker, delete it
512 * by *not* writing the line to ctx->out.
513 */
514 do_log2(loglevel, "%s%s%s:%ld: Removed %s key for host %s",
515 ctx->quiet ? __func__ : "", ctx->quiet ? ": " : "",
516 l->path, l->linenum, sshkey_type(l->key), ctx->host);
517 ctx->modified = 1;
518 return 0;
519 }
520 /* Retain non-matching hosts and invalid lines when deleting */
521 if (l->status == HKF_STATUS_INVALID) {
522 do_log2(loglevel, "%s%s%s:%ld: invalid known_hosts entry",
523 ctx->quiet ? __func__ : "", ctx->quiet ? ": " : "",
524 l->path, l->linenum);
485 } 525 }
486 fprintf(f, "%s ", store_hash ? hashed_host : host); 526 fprintf(ctx->out, "%s\n", l->line);
527 return 0;
528}
487 529
488 if (key_write(key, f)) { 530int
489 success = 1; 531hostfile_replace_entries(const char *filename, const char *host, const char *ip,
532 struct sshkey **keys, size_t nkeys, int store_hash, int quiet, int hash_alg)
533{
534 int r, fd, oerrno = 0;
535 int loglevel = quiet ? SYSLOG_LEVEL_DEBUG1 : SYSLOG_LEVEL_VERBOSE;
536 struct host_delete_ctx ctx;
537 char *fp, *temp = NULL, *back = NULL;
538 mode_t omask;
539 size_t i;
540
541 omask = umask(077);
542
543 memset(&ctx, 0, sizeof(ctx));
544 ctx.host = host;
545 ctx.quiet = quiet;
546 if ((ctx.skip_keys = calloc(nkeys, sizeof(*ctx.skip_keys))) == NULL)
547 return SSH_ERR_ALLOC_FAIL;
548 ctx.keys = keys;
549 ctx.nkeys = nkeys;
550 ctx.modified = 0;
551
552 /*
553 * Prepare temporary file for in-place deletion.
554 */
555 if ((r = asprintf(&temp, "%s.XXXXXXXXXXX", filename)) < 0 ||
556 (r = asprintf(&back, "%s.old", filename)) < 0) {
557 r = SSH_ERR_ALLOC_FAIL;
558 goto fail;
559 }
560
561 if ((fd = mkstemp(temp)) == -1) {
562 oerrno = errno;
563 error("%s: mkstemp: %s", __func__, strerror(oerrno));
564 r = SSH_ERR_SYSTEM_ERROR;
565 goto fail;
566 }
567 if ((ctx.out = fdopen(fd, "w")) == NULL) {
568 oerrno = errno;
569 close(fd);
570 error("%s: fdopen: %s", __func__, strerror(oerrno));
571 r = SSH_ERR_SYSTEM_ERROR;
572 goto fail;
573 }
574
575 /* Remove all entries for the specified host from the file */
576 if ((r = hostkeys_foreach(filename, host_delete, &ctx, host, ip,
577 HKF_WANT_PARSE_KEY)) != 0) {
578 error("%s: hostkeys_foreach failed: %s", __func__, ssh_err(r));
579 goto fail;
580 }
581
582 /* Add the requested keys */
583 for (i = 0; i < nkeys; i++) {
584 if (ctx.skip_keys[i])
585 continue;
586 if ((fp = sshkey_fingerprint(keys[i], hash_alg,
587 SSH_FP_DEFAULT)) == NULL) {
588 r = SSH_ERR_ALLOC_FAIL;
589 goto fail;
590 }
591 do_log2(loglevel, "%s%sAdding new key for %s to %s: %s %s",
592 quiet ? __func__ : "", quiet ? ": " : "", host, filename,
593 sshkey_ssh_name(keys[i]), fp);
594 free(fp);
595 if (!write_host_entry(ctx.out, host, ip, keys[i], store_hash)) {
596 r = SSH_ERR_INTERNAL_ERROR;
597 goto fail;
598 }
599 ctx.modified = 1;
600 }
601 fclose(ctx.out);
602 ctx.out = NULL;
603
604 if (ctx.modified) {
605 /* Backup the original file and replace it with the temporary */
606 if (unlink(back) == -1 && errno != ENOENT) {
607 oerrno = errno;
608 error("%s: unlink %.100s: %s", __func__,
609 back, strerror(errno));
610 r = SSH_ERR_SYSTEM_ERROR;
611 goto fail;
612 }
613 if (link(filename, back) == -1) {
614 oerrno = errno;
615 error("%s: link %.100s to %.100s: %s", __func__,
616 filename, back, strerror(errno));
617 r = SSH_ERR_SYSTEM_ERROR;
618 goto fail;
619 }
620 if (rename(temp, filename) == -1) {
621 oerrno = errno;
622 error("%s: rename \"%s\" to \"%s\": %s", __func__,
623 temp, filename, strerror(errno));
624 r = SSH_ERR_SYSTEM_ERROR;
625 goto fail;
626 }
490 } else { 627 } else {
491 error("add_host_to_hostfile: saving key in %s failed", filename); 628 /* No changes made; just delete the temporary file */
629 if (unlink(temp) != 0)
630 error("%s: unlink \"%s\": %s", __func__,
631 temp, strerror(errno));
632 }
633
634 /* success */
635 r = 0;
636 fail:
637 if (temp != NULL && r != 0)
638 unlink(temp);
639 free(temp);
640 free(back);
641 if (ctx.out != NULL)
642 fclose(ctx.out);
643 free(ctx.skip_keys);
644 umask(omask);
645 if (r == SSH_ERR_SYSTEM_ERROR)
646 errno = oerrno;
647 return r;
648}
649
650static int
651match_maybe_hashed(const char *host, const char *names, int *was_hashed)
652{
653 int hashed = *names == HASH_DELIM;
654 const char *hashed_host;
655 size_t nlen = strlen(names);
656
657 if (was_hashed != NULL)
658 *was_hashed = hashed;
659 if (hashed) {
660 if ((hashed_host = host_hash(host, names, nlen)) == NULL)
661 return -1;
662 return nlen == strlen(hashed_host) &&
663 strncmp(hashed_host, names, nlen) == 0;
664 }
665 return match_hostname(host, names, nlen) == 1;
666}
667
668int
669hostkeys_foreach(const char *path, hostkeys_foreach_fn *callback, void *ctx,
670 const char *host, const char *ip, u_int options)
671{
672 FILE *f;
673 char line[8192], oline[8192], ktype[128];
674 u_long linenum = 0;
675 char *cp, *cp2;
676 u_int kbits;
677 int hashed;
678 int s, r = 0;
679 struct hostkey_foreach_line lineinfo;
680 size_t l;
681
682 memset(&lineinfo, 0, sizeof(lineinfo));
683 if (host == NULL && (options & HKF_WANT_MATCH) != 0)
684 return SSH_ERR_INVALID_ARGUMENT;
685 if ((f = fopen(path, "r")) == NULL)
686 return SSH_ERR_SYSTEM_ERROR;
687
688 debug3("%s: reading file \"%s\"", __func__, path);
689 while (read_keyfile_line(f, path, line, sizeof(line), &linenum) == 0) {
690 line[strcspn(line, "\n")] = '\0';
691 strlcpy(oline, line, sizeof(oline));
692
693 sshkey_free(lineinfo.key);
694 memset(&lineinfo, 0, sizeof(lineinfo));
695 lineinfo.path = path;
696 lineinfo.linenum = linenum;
697 lineinfo.line = oline;
698 lineinfo.marker = MRK_NONE;
699 lineinfo.status = HKF_STATUS_OK;
700 lineinfo.keytype = KEY_UNSPEC;
701
702 /* Skip any leading whitespace, comments and empty lines. */
703 for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
704 ;
705 if (!*cp || *cp == '#' || *cp == '\n') {
706 if ((options & HKF_WANT_MATCH) == 0) {
707 lineinfo.status = HKF_STATUS_COMMENT;
708 if ((r = callback(&lineinfo, ctx)) != 0)
709 break;
710 }
711 continue;
712 }
713
714 if ((lineinfo.marker = check_markers(&cp)) == MRK_ERROR) {
715 verbose("%s: invalid marker at %s:%lu",
716 __func__, path, linenum);
717 if ((options & HKF_WANT_MATCH) == 0)
718 goto bad;
719 continue;
720 }
721
722 /* Find the end of the host name portion. */
723 for (cp2 = cp; *cp2 && *cp2 != ' ' && *cp2 != '\t'; cp2++)
724 ;
725 lineinfo.hosts = cp;
726 *cp2++ = '\0';
727
728 /* Check if the host name matches. */
729 if (host != NULL) {
730 if ((s = match_maybe_hashed(host, lineinfo.hosts,
731 &hashed)) == -1) {
732 debug2("%s: %s:%ld: bad host hash \"%.32s\"",
733 __func__, path, linenum, lineinfo.hosts);
734 goto bad;
735 }
736 if (s == 1) {
737 lineinfo.status = HKF_STATUS_MATCHED;
738 lineinfo.match |= HKF_MATCH_HOST |
739 (hashed ? HKF_MATCH_HOST_HASHED : 0);
740 }
741 /* Try matching IP address if supplied */
742 if (ip != NULL) {
743 if ((s = match_maybe_hashed(ip, lineinfo.hosts,
744 &hashed)) == -1) {
745 debug2("%s: %s:%ld: bad ip hash "
746 "\"%.32s\"", __func__, path,
747 linenum, lineinfo.hosts);
748 goto bad;
749 }
750 if (s == 1) {
751 lineinfo.status = HKF_STATUS_MATCHED;
752 lineinfo.match |= HKF_MATCH_IP |
753 (hashed ? HKF_MATCH_IP_HASHED : 0);
754 }
755 }
756 /*
757 * Skip this line if host matching requested and
758 * neither host nor address matched.
759 */
760 if ((options & HKF_WANT_MATCH) != 0 &&
761 lineinfo.status != HKF_STATUS_MATCHED)
762 continue;
763 }
764
765 /* Got a match. Skip host name and any following whitespace */
766 for (; *cp2 == ' ' || *cp2 == '\t'; cp2++)
767 ;
768 if (*cp2 == '\0' || *cp2 == '#') {
769 debug2("%s:%ld: truncated before key type",
770 path, linenum);
771 goto bad;
772 }
773 lineinfo.rawkey = cp = cp2;
774
775 if ((options & HKF_WANT_PARSE_KEY) != 0) {
776 /*
777 * Extract the key from the line. This will skip
778 * any leading whitespace. Ignore badly formatted
779 * lines.
780 */
781 if ((lineinfo.key = sshkey_new(KEY_UNSPEC)) == NULL) {
782 error("%s: sshkey_new failed", __func__);
783 r = SSH_ERR_ALLOC_FAIL;
784 break;
785 }
786 if (!hostfile_read_key(&cp, &kbits, lineinfo.key)) {
787#ifdef WITH_SSH1
788 sshkey_free(lineinfo.key);
789 lineinfo.key = sshkey_new(KEY_RSA1);
790 if (lineinfo.key == NULL) {
791 error("%s: sshkey_new fail", __func__);
792 r = SSH_ERR_ALLOC_FAIL;
793 break;
794 }
795 if (!hostfile_read_key(&cp, &kbits,
796 lineinfo.key))
797 goto bad;
798#else
799 goto bad;
800#endif
801 }
802 lineinfo.keytype = lineinfo.key->type;
803 lineinfo.comment = cp;
804 } else {
805 /* Extract and parse key type */
806 l = strcspn(lineinfo.rawkey, " \t");
807 if (l <= 1 || l >= sizeof(ktype) ||
808 lineinfo.rawkey[l] == '\0')
809 goto bad;
810 memcpy(ktype, lineinfo.rawkey, l);
811 ktype[l] = '\0';
812 lineinfo.keytype = sshkey_type_from_name(ktype);
813#ifdef WITH_SSH1
814 /*
815 * Assume RSA1 if the first component is a short
816 * decimal number.
817 */
818 if (lineinfo.keytype == KEY_UNSPEC && l < 8 &&
819 strspn(ktype, "0123456789") == l)
820 lineinfo.keytype = KEY_RSA1;
821#endif
822 /*
823 * Check that something other than whitespace follows
824 * the key type. This won't catch all corruption, but
825 * it does catch trivial truncation.
826 */
827 cp2 += l; /* Skip past key type */
828 for (; *cp2 == ' ' || *cp2 == '\t'; cp2++)
829 ;
830 if (*cp2 == '\0' || *cp2 == '#') {
831 debug2("%s:%ld: truncated after key type",
832 path, linenum);
833 lineinfo.keytype = KEY_UNSPEC;
834 }
835 if (lineinfo.keytype == KEY_UNSPEC) {
836 bad:
837 sshkey_free(lineinfo.key);
838 lineinfo.key = NULL;
839 lineinfo.status = HKF_STATUS_INVALID;
840 if ((r = callback(&lineinfo, ctx)) != 0)
841 break;
842 continue;
843 }
844 }
845 if ((r = callback(&lineinfo, ctx)) != 0)
846 break;
492 } 847 }
493 fprintf(f, "\n"); 848 sshkey_free(lineinfo.key);
494 fclose(f); 849 fclose(f);
495 return success; 850 return r;
496} 851}
diff --git a/hostfile.h b/hostfile.h
index 679c034f3..bd2104373 100644
--- a/hostfile.h
+++ b/hostfile.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: hostfile.h,v 1.20 2013/07/12 00:19:58 djm Exp $ */ 1/* $OpenBSD: hostfile.h,v 1.24 2015/02/16 22:08:57 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -26,7 +26,7 @@ struct hostkey_entry {
26 char *host; 26 char *host;
27 char *file; 27 char *file;
28 u_long line; 28 u_long line;
29 Key *key; 29 struct sshkey *key;
30 HostkeyMarker marker; 30 HostkeyMarker marker;
31}; 31};
32struct hostkeys; 32struct hostkeys;
@@ -35,13 +35,18 @@ struct hostkeys *init_hostkeys(void);
35void load_hostkeys(struct hostkeys *, const char *, const char *); 35void load_hostkeys(struct hostkeys *, const char *, const char *);
36void free_hostkeys(struct hostkeys *); 36void free_hostkeys(struct hostkeys *);
37 37
38HostStatus check_key_in_hostkeys(struct hostkeys *, Key *, 38HostStatus check_key_in_hostkeys(struct hostkeys *, struct sshkey *,
39 const struct hostkey_entry **); 39 const struct hostkey_entry **);
40int lookup_key_in_hostkeys_by_type(struct hostkeys *, int, 40int lookup_key_in_hostkeys_by_type(struct hostkeys *, int,
41 const struct hostkey_entry **); 41 const struct hostkey_entry **);
42 42
43int hostfile_read_key(char **, int *, Key *); 43int hostfile_read_key(char **, u_int *, struct sshkey *);
44int add_host_to_hostfile(const char *, const char *, const Key *, int); 44int add_host_to_hostfile(const char *, const char *,
45 const struct sshkey *, int);
46
47int hostfile_replace_entries(const char *filename,
48 const char *host, const char *ip, struct sshkey **keys, size_t nkeys,
49 int store_hash, int quiet, int hash_alg);
45 50
46#define HASH_MAGIC "|1|" 51#define HASH_MAGIC "|1|"
47#define HASH_DELIM '|' 52#define HASH_DELIM '|'
@@ -51,4 +56,53 @@ int add_host_to_hostfile(const char *, const char *, const Key *, int);
51 56
52char *host_hash(const char *, const char *, u_int); 57char *host_hash(const char *, const char *, u_int);
53 58
59/*
60 * Iterate through a hostkeys file, optionally parsing keys and matching
61 * hostnames. Allows access to the raw keyfile lines to allow
62 * streaming edits to the file to take place.
63 */
64#define HKF_WANT_MATCH (1) /* return only matching hosts/addrs */
65#define HKF_WANT_PARSE_KEY (1<<1) /* need key parsed */
66
67#define HKF_STATUS_OK 0 /* Line parsed, didn't match host */
68#define HKF_STATUS_INVALID 1 /* line had parse error */
69#define HKF_STATUS_COMMENT 2 /* valid line contained no key */
70#define HKF_STATUS_MATCHED 3 /* hostname or IP matched */
71
72#define HKF_MATCH_HOST (1) /* hostname matched */
73#define HKF_MATCH_IP (1<<1) /* address matched */
74#define HKF_MATCH_HOST_HASHED (1<<2) /* hostname was hashed */
75#define HKF_MATCH_IP_HASHED (1<<3) /* address was hashed */
76/* XXX HKF_MATCH_KEY_TYPE? */
77
78/*
79 * The callback function receives this as an argument for each matching
80 * hostkey line. The callback may "steal" the 'key' field by setting it to NULL.
81 * If a parse error occurred, then "hosts" and subsequent options may be NULL.
82 */
83struct hostkey_foreach_line {
84 const char *path; /* Path of file */
85 u_long linenum; /* Line number */
86 u_int status; /* One of HKF_STATUS_* */
87 u_int match; /* Zero or more of HKF_MATCH_* OR'd together */
88 char *line; /* Entire key line; mutable by callback */
89 int marker; /* CA/revocation markers; indicated by MRK_* value */
90 const char *hosts; /* Raw hosts text, may be hashed or list multiple */
91 const char *rawkey; /* Text of key and any comment following it */
92 int keytype; /* Type of key; KEY_UNSPEC for invalid/comment lines */
93 struct sshkey *key; /* Key, if parsed ok and HKF_WANT_MATCH_HOST set */
94 const char *comment; /* Any comment following the key */
95};
96
97/*
98 * Callback fires for each line (or matching line if a HKF_WANT_* option
99 * is set). The foreach loop will terminate if the callback returns a non-
100 * zero exit status.
101 */
102typedef int hostkeys_foreach_fn(struct hostkey_foreach_line *l, void *ctx);
103
104/* Iterate over a hostkeys file */
105int hostkeys_foreach(const char *path, hostkeys_foreach_fn *callback, void *ctx,
106 const char *host, const char *ip, u_int options);
107
54#endif 108#endif
diff --git a/includes.h b/includes.h
index 07bcd89f2..2893a54cd 100644
--- a/includes.h
+++ b/includes.h
@@ -23,10 +23,11 @@
23#endif 23#endif
24 24
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/param.h>
26#include <sys/socket.h> /* For CMSG_* */ 27#include <sys/socket.h> /* For CMSG_* */
27 28
28#ifdef HAVE_LIMITS_H 29#ifdef HAVE_LIMITS_H
29# include <limits.h> /* For PATH_MAX */ 30# include <limits.h> /* For PATH_MAX, _POSIX_HOST_NAME_MAX */
30#endif 31#endif
31#ifdef HAVE_BSTRING_H 32#ifdef HAVE_BSTRING_H
32# include <bstring.h> 33# include <bstring.h>
@@ -166,7 +167,9 @@
166# endif 167# endif
167#endif 168#endif
168 169
170#ifdef WITH_OPENSSL
169#include <openssl/opensslv.h> /* For OPENSSL_VERSION_NUMBER */ 171#include <openssl/opensslv.h> /* For OPENSSL_VERSION_NUMBER */
172#endif
170 173
171#include "defines.h" 174#include "defines.h"
172 175
diff --git a/kex.c b/kex.c
index a173e70e3..8c2b00179 100644
--- a/kex.c
+++ b/kex.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kex.c,v 1.99 2014/04/29 18:01:49 markus Exp $ */ 1/* $OpenBSD: kex.c,v 1.105 2015/01/30 00:22:25 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * 4 *
@@ -25,7 +25,7 @@
25 25
26#include "includes.h" 26#include "includes.h"
27 27
28#include <sys/param.h> 28#include <sys/param.h> /* MAX roundup */
29 29
30#include <signal.h> 30#include <signal.h>
31#include <stdarg.h> 31#include <stdarg.h>
@@ -37,20 +37,22 @@
37#include <openssl/crypto.h> 37#include <openssl/crypto.h>
38#endif 38#endif
39 39
40#include "xmalloc.h"
41#include "ssh2.h" 40#include "ssh2.h"
42#include "buffer.h"
43#include "packet.h" 41#include "packet.h"
44#include "compat.h" 42#include "compat.h"
45#include "cipher.h" 43#include "cipher.h"
46#include "key.h" 44#include "sshkey.h"
47#include "kex.h" 45#include "kex.h"
48#include "log.h" 46#include "log.h"
49#include "mac.h" 47#include "mac.h"
50#include "match.h" 48#include "match.h"
49#include "misc.h"
51#include "dispatch.h" 50#include "dispatch.h"
52#include "monitor.h" 51#include "monitor.h"
53#include "roaming.h" 52#include "roaming.h"
53
54#include "ssherr.h"
55#include "sshbuf.h"
54#include "digest.h" 56#include "digest.h"
55 57
56#if OPENSSL_VERSION_NUMBER >= 0x00907000L 58#if OPENSSL_VERSION_NUMBER >= 0x00907000L
@@ -62,12 +64,12 @@ extern const EVP_MD *evp_ssh_sha256(void);
62#endif 64#endif
63 65
64/* prototype */ 66/* prototype */
65static void kex_kexinit_finish(Kex *); 67static int kex_choose_conf(struct ssh *);
66static void kex_choose_conf(Kex *); 68static int kex_input_newkeys(int, u_int32_t, void *);
67 69
68struct kexalg { 70struct kexalg {
69 char *name; 71 char *name;
70 int type; 72 u_int type;
71 int ec_nid; 73 int ec_nid;
72 int hash_alg; 74 int hash_alg;
73}; 75};
@@ -89,18 +91,17 @@ static const struct kexalg kexalgs[] = {
89 SSH_DIGEST_SHA512 }, 91 SSH_DIGEST_SHA512 },
90# endif /* OPENSSL_HAS_NISTP521 */ 92# endif /* OPENSSL_HAS_NISTP521 */
91#endif /* OPENSSL_HAS_ECC */ 93#endif /* OPENSSL_HAS_ECC */
92 { KEX_DH1, KEX_DH_GRP1_SHA1, 0, SSH_DIGEST_SHA1 },
93#endif /* WITH_OPENSSL */ 94#endif /* WITH_OPENSSL */
94#ifdef HAVE_EVP_SHA256 95#if defined(HAVE_EVP_SHA256) || !defined(WITH_OPENSSL)
95 { KEX_CURVE25519_SHA256, KEX_C25519_SHA256, 0, SSH_DIGEST_SHA256 }, 96 { KEX_CURVE25519_SHA256, KEX_C25519_SHA256, 0, SSH_DIGEST_SHA256 },
96#endif /* HAVE_EVP_SHA256 */ 97#endif /* HAVE_EVP_SHA256 || !WITH_OPENSSL */
97 { NULL, -1, -1, -1}, 98 { NULL, -1, -1, -1},
98}; 99};
99 100
100char * 101char *
101kex_alg_list(char sep) 102kex_alg_list(char sep)
102{ 103{
103 char *ret = NULL; 104 char *ret = NULL, *tmp;
104 size_t nlen, rlen = 0; 105 size_t nlen, rlen = 0;
105 const struct kexalg *k; 106 const struct kexalg *k;
106 107
@@ -108,7 +109,11 @@ kex_alg_list(char sep)
108 if (ret != NULL) 109 if (ret != NULL)
109 ret[rlen++] = sep; 110 ret[rlen++] = sep;
110 nlen = strlen(k->name); 111 nlen = strlen(k->name);
111 ret = xrealloc(ret, 1, rlen + nlen + 2); 112 if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
113 free(ret);
114 return NULL;
115 }
116 ret = tmp;
112 memcpy(ret + rlen, k->name, nlen + 1); 117 memcpy(ret + rlen, k->name, nlen + 1);
113 rlen += nlen; 118 rlen += nlen;
114 } 119 }
@@ -135,7 +140,8 @@ kex_names_valid(const char *names)
135 140
136 if (names == NULL || strcmp(names, "") == 0) 141 if (names == NULL || strcmp(names, "") == 0)
137 return 0; 142 return 0;
138 s = cp = xstrdup(names); 143 if ((s = cp = strdup(names)) == NULL)
144 return 0;
139 for ((p = strsep(&cp, ",")); p && *p != '\0'; 145 for ((p = strsep(&cp, ",")); p && *p != '\0';
140 (p = strsep(&cp, ","))) { 146 (p = strsep(&cp, ","))) {
141 if (kex_alg_by_name(p) == NULL) { 147 if (kex_alg_by_name(p) == NULL) {
@@ -150,56 +156,75 @@ kex_names_valid(const char *names)
150} 156}
151 157
152/* put algorithm proposal into buffer */ 158/* put algorithm proposal into buffer */
153static void 159int
154kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) 160kex_prop2buf(struct sshbuf *b, char *proposal[PROPOSAL_MAX])
155{ 161{
156 u_int i; 162 u_int i;
163 int r;
164
165 sshbuf_reset(b);
157 166
158 buffer_clear(b);
159 /* 167 /*
160 * add a dummy cookie, the cookie will be overwritten by 168 * add a dummy cookie, the cookie will be overwritten by
161 * kex_send_kexinit(), each time a kexinit is set 169 * kex_send_kexinit(), each time a kexinit is set
162 */ 170 */
163 for (i = 0; i < KEX_COOKIE_LEN; i++) 171 for (i = 0; i < KEX_COOKIE_LEN; i++) {
164 buffer_put_char(b, 0); 172 if ((r = sshbuf_put_u8(b, 0)) != 0)
165 for (i = 0; i < PROPOSAL_MAX; i++) 173 return r;
166 buffer_put_cstring(b, proposal[i]); 174 }
167 buffer_put_char(b, 0); /* first_kex_packet_follows */ 175 for (i = 0; i < PROPOSAL_MAX; i++) {
168 buffer_put_int(b, 0); /* uint32 reserved */ 176 if ((r = sshbuf_put_cstring(b, proposal[i])) != 0)
177 return r;
178 }
179 if ((r = sshbuf_put_u8(b, 0)) != 0 || /* first_kex_packet_follows */
180 (r = sshbuf_put_u32(b, 0)) != 0) /* uint32 reserved */
181 return r;
182 return 0;
169} 183}
170 184
171/* parse buffer and return algorithm proposal */ 185/* parse buffer and return algorithm proposal */
172static char ** 186int
173kex_buf2prop(Buffer *raw, int *first_kex_follows) 187kex_buf2prop(struct sshbuf *raw, int *first_kex_follows, char ***propp)
174{ 188{
175 Buffer b; 189 struct sshbuf *b = NULL;
190 u_char v;
176 u_int i; 191 u_int i;
177 char **proposal; 192 char **proposal = NULL;
178 193 int r;
179 proposal = xcalloc(PROPOSAL_MAX, sizeof(char *)); 194
180 195 *propp = NULL;
181 buffer_init(&b); 196 if ((proposal = calloc(PROPOSAL_MAX, sizeof(char *))) == NULL)
182 buffer_append(&b, buffer_ptr(raw), buffer_len(raw)); 197 return SSH_ERR_ALLOC_FAIL;
183 /* skip cookie */ 198 if ((b = sshbuf_fromb(raw)) == NULL) {
184 for (i = 0; i < KEX_COOKIE_LEN; i++) 199 r = SSH_ERR_ALLOC_FAIL;
185 buffer_get_char(&b); 200 goto out;
201 }
202 if ((r = sshbuf_consume(b, KEX_COOKIE_LEN)) != 0) /* skip cookie */
203 goto out;
186 /* extract kex init proposal strings */ 204 /* extract kex init proposal strings */
187 for (i = 0; i < PROPOSAL_MAX; i++) { 205 for (i = 0; i < PROPOSAL_MAX; i++) {
188 proposal[i] = buffer_get_cstring(&b,NULL); 206 if ((r = sshbuf_get_cstring(b, &(proposal[i]), NULL)) != 0)
207 goto out;
189 debug2("kex_parse_kexinit: %s", proposal[i]); 208 debug2("kex_parse_kexinit: %s", proposal[i]);
190 } 209 }
191 /* first kex follows / reserved */ 210 /* first kex follows / reserved */
192 i = buffer_get_char(&b); 211 if ((r = sshbuf_get_u8(b, &v)) != 0 ||
212 (r = sshbuf_get_u32(b, &i)) != 0)
213 goto out;
193 if (first_kex_follows != NULL) 214 if (first_kex_follows != NULL)
194 *first_kex_follows = i; 215 *first_kex_follows = i;
195 debug2("kex_parse_kexinit: first_kex_follows %d ", i); 216 debug2("kex_parse_kexinit: first_kex_follows %d ", v);
196 i = buffer_get_int(&b);
197 debug2("kex_parse_kexinit: reserved %u ", i); 217 debug2("kex_parse_kexinit: reserved %u ", i);
198 buffer_free(&b); 218 r = 0;
199 return proposal; 219 *propp = proposal;
220 out:
221 if (r != 0 && proposal != NULL)
222 kex_prop_free(proposal);
223 sshbuf_free(b);
224 return r;
200} 225}
201 226
202static void 227void
203kex_prop_free(char **proposal) 228kex_prop_free(char **proposal)
204{ 229{
205 u_int i; 230 u_int i;
@@ -210,97 +235,111 @@ kex_prop_free(char **proposal)
210} 235}
211 236
212/* ARGSUSED */ 237/* ARGSUSED */
213static void 238static int
214kex_protocol_error(int type, u_int32_t seq, void *ctxt) 239kex_protocol_error(int type, u_int32_t seq, void *ctxt)
215{ 240{
216 error("Hm, kex protocol error: type %d seq %u", type, seq); 241 error("Hm, kex protocol error: type %d seq %u", type, seq);
242 return 0;
217} 243}
218 244
219static void 245static void
220kex_reset_dispatch(void) 246kex_reset_dispatch(struct ssh *ssh)
221{ 247{
222 dispatch_range(SSH2_MSG_TRANSPORT_MIN, 248 ssh_dispatch_range(ssh, SSH2_MSG_TRANSPORT_MIN,
223 SSH2_MSG_TRANSPORT_MAX, &kex_protocol_error); 249 SSH2_MSG_TRANSPORT_MAX, &kex_protocol_error);
224 dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit); 250 ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, &kex_input_kexinit);
225} 251}
226 252
227void 253int
228kex_finish(Kex *kex) 254kex_send_newkeys(struct ssh *ssh)
229{ 255{
230 kex_reset_dispatch(); 256 int r;
231 257
232 packet_start(SSH2_MSG_NEWKEYS); 258 kex_reset_dispatch(ssh);
233 packet_send(); 259 if ((r = sshpkt_start(ssh, SSH2_MSG_NEWKEYS)) != 0 ||
234 /* packet_write_wait(); */ 260 (r = sshpkt_send(ssh)) != 0)
261 return r;
235 debug("SSH2_MSG_NEWKEYS sent"); 262 debug("SSH2_MSG_NEWKEYS sent");
236
237 debug("expecting SSH2_MSG_NEWKEYS"); 263 debug("expecting SSH2_MSG_NEWKEYS");
238 packet_read_expect(SSH2_MSG_NEWKEYS); 264 ssh_dispatch_set(ssh, SSH2_MSG_NEWKEYS, &kex_input_newkeys);
239 packet_check_eom(); 265 return 0;
240 debug("SSH2_MSG_NEWKEYS received"); 266}
267
268static int
269kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
270{
271 struct ssh *ssh = ctxt;
272 struct kex *kex = ssh->kex;
273 int r;
241 274
275 debug("SSH2_MSG_NEWKEYS received");
276 ssh_dispatch_set(ssh, SSH2_MSG_NEWKEYS, &kex_protocol_error);
277 if ((r = sshpkt_get_end(ssh)) != 0)
278 return r;
242 kex->done = 1; 279 kex->done = 1;
243 buffer_clear(&kex->peer); 280 sshbuf_reset(kex->peer);
244 /* buffer_clear(&kex->my); */ 281 /* sshbuf_reset(kex->my); */
245 kex->flags &= ~KEX_INIT_SENT; 282 kex->flags &= ~KEX_INIT_SENT;
246 free(kex->name); 283 free(kex->name);
247 kex->name = NULL; 284 kex->name = NULL;
285 return 0;
248} 286}
249 287
250void 288int
251kex_send_kexinit(Kex *kex) 289kex_send_kexinit(struct ssh *ssh)
252{ 290{
253 u_int32_t rnd = 0;
254 u_char *cookie; 291 u_char *cookie;
255 u_int i; 292 struct kex *kex = ssh->kex;
293 int r;
256 294
257 if (kex == NULL) { 295 if (kex == NULL)
258 error("kex_send_kexinit: no kex, cannot rekey"); 296 return SSH_ERR_INTERNAL_ERROR;
259 return; 297 if (kex->flags & KEX_INIT_SENT)
260 } 298 return 0;
261 if (kex->flags & KEX_INIT_SENT) {
262 debug("KEX_INIT_SENT");
263 return;
264 }
265 kex->done = 0; 299 kex->done = 0;
266 300
267 /* generate a random cookie */ 301 /* generate a random cookie */
268 if (buffer_len(&kex->my) < KEX_COOKIE_LEN) 302 if (sshbuf_len(kex->my) < KEX_COOKIE_LEN)
269 fatal("kex_send_kexinit: kex proposal too short"); 303 return SSH_ERR_INVALID_FORMAT;
270 cookie = buffer_ptr(&kex->my); 304 if ((cookie = sshbuf_mutable_ptr(kex->my)) == NULL)
271 for (i = 0; i < KEX_COOKIE_LEN; i++) { 305 return SSH_ERR_INTERNAL_ERROR;
272 if (i % 4 == 0) 306 arc4random_buf(cookie, KEX_COOKIE_LEN);
273 rnd = arc4random(); 307
274 cookie[i] = rnd; 308 if ((r = sshpkt_start(ssh, SSH2_MSG_KEXINIT)) != 0 ||
275 rnd >>= 8; 309 (r = sshpkt_putb(ssh, kex->my)) != 0 ||
276 } 310 (r = sshpkt_send(ssh)) != 0)
277 packet_start(SSH2_MSG_KEXINIT); 311 return r;
278 packet_put_raw(buffer_ptr(&kex->my), buffer_len(&kex->my));
279 packet_send();
280 debug("SSH2_MSG_KEXINIT sent"); 312 debug("SSH2_MSG_KEXINIT sent");
281 kex->flags |= KEX_INIT_SENT; 313 kex->flags |= KEX_INIT_SENT;
314 return 0;
282} 315}
283 316
284/* ARGSUSED */ 317/* ARGSUSED */
285void 318int
286kex_input_kexinit(int type, u_int32_t seq, void *ctxt) 319kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
287{ 320{
288 char *ptr; 321 struct ssh *ssh = ctxt;
289 u_int i, dlen; 322 struct kex *kex = ssh->kex;
290 Kex *kex = (Kex *)ctxt; 323 const u_char *ptr;
324 u_int i;
325 size_t dlen;
326 int r;
291 327
292 debug("SSH2_MSG_KEXINIT received"); 328 debug("SSH2_MSG_KEXINIT received");
293 if (kex == NULL) 329 if (kex == NULL)
294 fatal("kex_input_kexinit: no kex, cannot rekey"); 330 return SSH_ERR_INVALID_ARGUMENT;
295 331
296 ptr = packet_get_raw(&dlen); 332 ptr = sshpkt_ptr(ssh, &dlen);
297 buffer_append(&kex->peer, ptr, dlen); 333 if ((r = sshbuf_put(kex->peer, ptr, dlen)) != 0)
334 return r;
298 335
299 /* discard packet */ 336 /* discard packet */
300 for (i = 0; i < KEX_COOKIE_LEN; i++) 337 for (i = 0; i < KEX_COOKIE_LEN; i++)
301 packet_get_char(); 338 if ((r = sshpkt_get_u8(ssh, NULL)) != 0)
339 return r;
302 for (i = 0; i < PROPOSAL_MAX; i++) 340 for (i = 0; i < PROPOSAL_MAX; i++)
303 free(packet_get_string(NULL)); 341 if ((r = sshpkt_get_string(ssh, NULL, NULL)) != 0)
342 return r;
304 /* 343 /*
305 * XXX RFC4253 sec 7: "each side MAY guess" - currently no supported 344 * XXX RFC4253 sec 7: "each side MAY guess" - currently no supported
306 * KEX method has the server move first, but a server might be using 345 * KEX method has the server move first, but a server might be using
@@ -311,55 +350,129 @@ kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
311 * for cases where the server *doesn't* go first. I guess we should 350 * for cases where the server *doesn't* go first. I guess we should
312 * ignore it when it is set for these cases, which is what we do now. 351 * ignore it when it is set for these cases, which is what we do now.
313 */ 352 */
314 (void) packet_get_char(); /* first_kex_follows */ 353 if ((r = sshpkt_get_u8(ssh, NULL)) != 0 || /* first_kex_follows */
315 (void) packet_get_int(); /* reserved */ 354 (r = sshpkt_get_u32(ssh, NULL)) != 0 || /* reserved */
316 packet_check_eom(); 355 (r = sshpkt_get_end(ssh)) != 0)
356 return r;
357
358 if (!(kex->flags & KEX_INIT_SENT))
359 if ((r = kex_send_kexinit(ssh)) != 0)
360 return r;
361 if ((r = kex_choose_conf(ssh)) != 0)
362 return r;
363
364 if (kex->kex_type < KEX_MAX && kex->kex[kex->kex_type] != NULL)
365 return (kex->kex[kex->kex_type])(ssh);
317 366
318 kex_kexinit_finish(kex); 367 return SSH_ERR_INTERNAL_ERROR;
319} 368}
320 369
321Kex * 370int
322kex_setup(char *proposal[PROPOSAL_MAX]) 371kex_new(struct ssh *ssh, char *proposal[PROPOSAL_MAX], struct kex **kexp)
323{ 372{
324 Kex *kex; 373 struct kex *kex;
325 374 int r;
326 kex = xcalloc(1, sizeof(*kex)); 375
327 buffer_init(&kex->peer); 376 *kexp = NULL;
328 buffer_init(&kex->my); 377 if ((kex = calloc(1, sizeof(*kex))) == NULL)
329 kex_prop2buf(&kex->my, proposal); 378 return SSH_ERR_ALLOC_FAIL;
379 if ((kex->peer = sshbuf_new()) == NULL ||
380 (kex->my = sshbuf_new()) == NULL) {
381 r = SSH_ERR_ALLOC_FAIL;
382 goto out;
383 }
384 if ((r = kex_prop2buf(kex->my, proposal)) != 0)
385 goto out;
330 kex->done = 0; 386 kex->done = 0;
387 kex_reset_dispatch(ssh);
388 r = 0;
389 *kexp = kex;
390 out:
391 if (r != 0)
392 kex_free(kex);
393 return r;
394}
331 395
332 kex_send_kexinit(kex); /* we start */ 396void
333 kex_reset_dispatch(); 397kex_free_newkeys(struct newkeys *newkeys)
334 398{
335 return kex; 399 if (newkeys == NULL)
400 return;
401 if (newkeys->enc.key) {
402 explicit_bzero(newkeys->enc.key, newkeys->enc.key_len);
403 free(newkeys->enc.key);
404 newkeys->enc.key = NULL;
405 }
406 if (newkeys->enc.iv) {
407 explicit_bzero(newkeys->enc.iv, newkeys->enc.block_size);
408 free(newkeys->enc.iv);
409 newkeys->enc.iv = NULL;
410 }
411 free(newkeys->enc.name);
412 explicit_bzero(&newkeys->enc, sizeof(newkeys->enc));
413 free(newkeys->comp.name);
414 explicit_bzero(&newkeys->comp, sizeof(newkeys->comp));
415 mac_clear(&newkeys->mac);
416 if (newkeys->mac.key) {
417 explicit_bzero(newkeys->mac.key, newkeys->mac.key_len);
418 free(newkeys->mac.key);
419 newkeys->mac.key = NULL;
420 }
421 free(newkeys->mac.name);
422 explicit_bzero(&newkeys->mac, sizeof(newkeys->mac));
423 explicit_bzero(newkeys, sizeof(*newkeys));
424 free(newkeys);
336} 425}
337 426
338static void 427void
339kex_kexinit_finish(Kex *kex) 428kex_free(struct kex *kex)
340{ 429{
341 if (!(kex->flags & KEX_INIT_SENT)) 430 u_int mode;
342 kex_send_kexinit(kex);
343 431
344 kex_choose_conf(kex); 432#ifdef WITH_OPENSSL
433 if (kex->dh)
434 DH_free(kex->dh);
435#ifdef OPENSSL_HAS_ECC
436 if (kex->ec_client_key)
437 EC_KEY_free(kex->ec_client_key);
438#endif /* OPENSSL_HAS_ECC */
439#endif /* WITH_OPENSSL */
440 for (mode = 0; mode < MODE_MAX; mode++) {
441 kex_free_newkeys(kex->newkeys[mode]);
442 kex->newkeys[mode] = NULL;
443 }
444 sshbuf_free(kex->peer);
445 sshbuf_free(kex->my);
446 free(kex->session_id);
447 free(kex->client_version_string);
448 free(kex->server_version_string);
449 free(kex);
450}
345 451
346 if (kex->kex_type >= 0 && kex->kex_type < KEX_MAX && 452int
347 kex->kex[kex->kex_type] != NULL) { 453kex_setup(struct ssh *ssh, char *proposal[PROPOSAL_MAX])
348 (kex->kex[kex->kex_type])(kex); 454{
349 } else { 455 int r;
350 fatal("Unsupported key exchange %d", kex->kex_type); 456
457 if ((r = kex_new(ssh, proposal, &ssh->kex)) != 0)
458 return r;
459 if ((r = kex_send_kexinit(ssh)) != 0) { /* we start */
460 kex_free(ssh->kex);
461 ssh->kex = NULL;
462 return r;
351 } 463 }
464 return 0;
352} 465}
353 466
354static void 467static int
355choose_enc(Enc *enc, char *client, char *server) 468choose_enc(struct sshenc *enc, char *client, char *server)
356{ 469{
357 char *name = match_list(client, server, NULL); 470 char *name = match_list(client, server, NULL);
471
358 if (name == NULL) 472 if (name == NULL)
359 fatal("no matching cipher found: client %s server %s", 473 return SSH_ERR_NO_CIPHER_ALG_MATCH;
360 client, server);
361 if ((enc->cipher = cipher_by_name(name)) == NULL) 474 if ((enc->cipher = cipher_by_name(name)) == NULL)
362 fatal("matching cipher is not supported: %s", name); 475 return SSH_ERR_INTERNAL_ERROR;
363 enc->name = name; 476 enc->name = name;
364 enc->enabled = 0; 477 enc->enabled = 0;
365 enc->iv = NULL; 478 enc->iv = NULL;
@@ -367,31 +480,34 @@ choose_enc(Enc *enc, char *client, char *server)
367 enc->key = NULL; 480 enc->key = NULL;
368 enc->key_len = cipher_keylen(enc->cipher); 481 enc->key_len = cipher_keylen(enc->cipher);
369 enc->block_size = cipher_blocksize(enc->cipher); 482 enc->block_size = cipher_blocksize(enc->cipher);
483 return 0;
370} 484}
371 485
372static void 486static int
373choose_mac(Mac *mac, char *client, char *server) 487choose_mac(struct ssh *ssh, struct sshmac *mac, char *client, char *server)
374{ 488{
375 char *name = match_list(client, server, NULL); 489 char *name = match_list(client, server, NULL);
490
376 if (name == NULL) 491 if (name == NULL)
377 fatal("no matching mac found: client %s server %s", 492 return SSH_ERR_NO_MAC_ALG_MATCH;
378 client, server);
379 if (mac_setup(mac, name) < 0) 493 if (mac_setup(mac, name) < 0)
380 fatal("unsupported mac %s", name); 494 return SSH_ERR_INTERNAL_ERROR;
381 /* truncate the key */ 495 /* truncate the key */
382 if (datafellows & SSH_BUG_HMAC) 496 if (ssh->compat & SSH_BUG_HMAC)
383 mac->key_len = 16; 497 mac->key_len = 16;
384 mac->name = name; 498 mac->name = name;
385 mac->key = NULL; 499 mac->key = NULL;
386 mac->enabled = 0; 500 mac->enabled = 0;
501 return 0;
387} 502}
388 503
389static void 504static int
390choose_comp(Comp *comp, char *client, char *server) 505choose_comp(struct sshcomp *comp, char *client, char *server)
391{ 506{
392 char *name = match_list(client, server, NULL); 507 char *name = match_list(client, server, NULL);
508
393 if (name == NULL) 509 if (name == NULL)
394 fatal("no matching comp found: client %s server %s", client, server); 510 return SSH_ERR_NO_COMPRESS_ALG_MATCH;
395 if (strcmp(name, "zlib@openssh.com") == 0) { 511 if (strcmp(name, "zlib@openssh.com") == 0) {
396 comp->type = COMP_DELAYED; 512 comp->type = COMP_DELAYED;
397 } else if (strcmp(name, "zlib") == 0) { 513 } else if (strcmp(name, "zlib") == 0) {
@@ -399,36 +515,42 @@ choose_comp(Comp *comp, char *client, char *server)
399 } else if (strcmp(name, "none") == 0) { 515 } else if (strcmp(name, "none") == 0) {
400 comp->type = COMP_NONE; 516 comp->type = COMP_NONE;
401 } else { 517 } else {
402 fatal("unsupported comp %s", name); 518 return SSH_ERR_INTERNAL_ERROR;
403 } 519 }
404 comp->name = name; 520 comp->name = name;
521 return 0;
405} 522}
406 523
407static void 524static int
408choose_kex(Kex *k, char *client, char *server) 525choose_kex(struct kex *k, char *client, char *server)
409{ 526{
410 const struct kexalg *kexalg; 527 const struct kexalg *kexalg;
411 528
412 k->name = match_list(client, server, NULL); 529 k->name = match_list(client, server, NULL);
530
413 if (k->name == NULL) 531 if (k->name == NULL)
414 fatal("Unable to negotiate a key exchange method"); 532 return SSH_ERR_NO_KEX_ALG_MATCH;
415 if ((kexalg = kex_alg_by_name(k->name)) == NULL) 533 if ((kexalg = kex_alg_by_name(k->name)) == NULL)
416 fatal("unsupported kex alg %s", k->name); 534 return SSH_ERR_INTERNAL_ERROR;
417 k->kex_type = kexalg->type; 535 k->kex_type = kexalg->type;
418 k->hash_alg = kexalg->hash_alg; 536 k->hash_alg = kexalg->hash_alg;
419 k->ec_nid = kexalg->ec_nid; 537 k->ec_nid = kexalg->ec_nid;
538 return 0;
420} 539}
421 540
422static void 541static int
423choose_hostkeyalg(Kex *k, char *client, char *server) 542choose_hostkeyalg(struct kex *k, char *client, char *server)
424{ 543{
425 char *hostkeyalg = match_list(client, server, NULL); 544 char *hostkeyalg = match_list(client, server, NULL);
545
426 if (hostkeyalg == NULL) 546 if (hostkeyalg == NULL)
427 fatal("no hostkey alg"); 547 return SSH_ERR_NO_HOSTKEY_ALG_MATCH;
428 k->hostkey_type = key_type_from_name(hostkeyalg); 548 k->hostkey_type = sshkey_type_from_name(hostkeyalg);
429 if (k->hostkey_type == KEY_UNSPEC) 549 if (k->hostkey_type == KEY_UNSPEC)
430 fatal("bad hostkey alg '%s'", hostkeyalg); 550 return SSH_ERR_INTERNAL_ERROR;
551 k->hostkey_nid = sshkey_ecdsa_nid_from_name(hostkeyalg);
431 free(hostkeyalg); 552 free(hostkeyalg);
553 return 0;
432} 554}
433 555
434static int 556static int
@@ -455,18 +577,20 @@ proposals_match(char *my[PROPOSAL_MAX], char *peer[PROPOSAL_MAX])
455 return (1); 577 return (1);
456} 578}
457 579
458static void 580static int
459kex_choose_conf(Kex *kex) 581kex_choose_conf(struct ssh *ssh)
460{ 582{
461 Newkeys *newkeys; 583 struct kex *kex = ssh->kex;
462 char **my, **peer; 584 struct newkeys *newkeys;
585 char **my = NULL, **peer = NULL;
463 char **cprop, **sprop; 586 char **cprop, **sprop;
464 int nenc, nmac, ncomp; 587 int nenc, nmac, ncomp;
465 u_int mode, ctos, need, dh_need, authlen; 588 u_int mode, ctos, need, dh_need, authlen;
466 int first_kex_follows, type; 589 int r, first_kex_follows;
467 590
468 my = kex_buf2prop(&kex->my, NULL); 591 if ((r = kex_buf2prop(kex->my, NULL, &my)) != 0 ||
469 peer = kex_buf2prop(&kex->peer, &first_kex_follows); 592 (r = kex_buf2prop(kex->peer, &first_kex_follows, &peer)) != 0)
593 goto out;
470 594
471 if (kex->server) { 595 if (kex->server) {
472 cprop=peer; 596 cprop=peer;
@@ -478,8 +602,9 @@ kex_choose_conf(Kex *kex)
478 602
479 /* Check whether server offers roaming */ 603 /* Check whether server offers roaming */
480 if (!kex->server) { 604 if (!kex->server) {
481 char *roaming; 605 char *roaming = match_list(KEX_RESUME,
482 roaming = match_list(KEX_RESUME, peer[PROPOSAL_KEX_ALGS], NULL); 606 peer[PROPOSAL_KEX_ALGS], NULL);
607
483 if (roaming) { 608 if (roaming) {
484 kex->roaming = 1; 609 kex->roaming = 1;
485 free(roaming); 610 free(roaming);
@@ -488,28 +613,39 @@ kex_choose_conf(Kex *kex)
488 613
489 /* Algorithm Negotiation */ 614 /* Algorithm Negotiation */
490 for (mode = 0; mode < MODE_MAX; mode++) { 615 for (mode = 0; mode < MODE_MAX; mode++) {
491 newkeys = xcalloc(1, sizeof(*newkeys)); 616 if ((newkeys = calloc(1, sizeof(*newkeys))) == NULL) {
617 r = SSH_ERR_ALLOC_FAIL;
618 goto out;
619 }
492 kex->newkeys[mode] = newkeys; 620 kex->newkeys[mode] = newkeys;
493 ctos = (!kex->server && mode == MODE_OUT) || 621 ctos = (!kex->server && mode == MODE_OUT) ||
494 (kex->server && mode == MODE_IN); 622 (kex->server && mode == MODE_IN);
495 nenc = ctos ? PROPOSAL_ENC_ALGS_CTOS : PROPOSAL_ENC_ALGS_STOC; 623 nenc = ctos ? PROPOSAL_ENC_ALGS_CTOS : PROPOSAL_ENC_ALGS_STOC;
496 nmac = ctos ? PROPOSAL_MAC_ALGS_CTOS : PROPOSAL_MAC_ALGS_STOC; 624 nmac = ctos ? PROPOSAL_MAC_ALGS_CTOS : PROPOSAL_MAC_ALGS_STOC;
497 ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC; 625 ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC;
498 choose_enc(&newkeys->enc, cprop[nenc], sprop[nenc]); 626 if ((r = choose_enc(&newkeys->enc, cprop[nenc],
499 /* ignore mac for authenticated encryption */ 627 sprop[nenc])) != 0)
628 goto out;
500 authlen = cipher_authlen(newkeys->enc.cipher); 629 authlen = cipher_authlen(newkeys->enc.cipher);
501 if (authlen == 0) 630 /* ignore mac for authenticated encryption */
502 choose_mac(&newkeys->mac, cprop[nmac], sprop[nmac]); 631 if (authlen == 0 &&
503 choose_comp(&newkeys->comp, cprop[ncomp], sprop[ncomp]); 632 (r = choose_mac(ssh, &newkeys->mac, cprop[nmac],
633 sprop[nmac])) != 0)
634 goto out;
635 if ((r = choose_comp(&newkeys->comp, cprop[ncomp],
636 sprop[ncomp])) != 0)
637 goto out;
504 debug("kex: %s %s %s %s", 638 debug("kex: %s %s %s %s",
505 ctos ? "client->server" : "server->client", 639 ctos ? "client->server" : "server->client",
506 newkeys->enc.name, 640 newkeys->enc.name,
507 authlen == 0 ? newkeys->mac.name : "<implicit>", 641 authlen == 0 ? newkeys->mac.name : "<implicit>",
508 newkeys->comp.name); 642 newkeys->comp.name);
509 } 643 }
510 choose_kex(kex, cprop[PROPOSAL_KEX_ALGS], sprop[PROPOSAL_KEX_ALGS]); 644 if ((r = choose_kex(kex, cprop[PROPOSAL_KEX_ALGS],
511 choose_hostkeyalg(kex, cprop[PROPOSAL_SERVER_HOST_KEY_ALGS], 645 sprop[PROPOSAL_KEX_ALGS])) != 0 ||
512 sprop[PROPOSAL_SERVER_HOST_KEY_ALGS]); 646 (r = choose_hostkeyalg(kex, cprop[PROPOSAL_SERVER_HOST_KEY_ALGS],
647 sprop[PROPOSAL_SERVER_HOST_KEY_ALGS])) != 0)
648 goto out;
513 need = dh_need = 0; 649 need = dh_need = 0;
514 for (mode = 0; mode < MODE_MAX; mode++) { 650 for (mode = 0; mode < MODE_MAX; mode++) {
515 newkeys = kex->newkeys[mode]; 651 newkeys = kex->newkeys[mode];
@@ -528,45 +664,47 @@ kex_choose_conf(Kex *kex)
528 664
529 /* ignore the next message if the proposals do not match */ 665 /* ignore the next message if the proposals do not match */
530 if (first_kex_follows && !proposals_match(my, peer) && 666 if (first_kex_follows && !proposals_match(my, peer) &&
531 !(datafellows & SSH_BUG_FIRSTKEX)) { 667 !(ssh->compat & SSH_BUG_FIRSTKEX))
532 type = packet_read(); 668 ssh->dispatch_skip_packets = 1;
533 debug2("skipping next packet (type %u)", type); 669 r = 0;
534 } 670 out:
535
536 kex_prop_free(my); 671 kex_prop_free(my);
537 kex_prop_free(peer); 672 kex_prop_free(peer);
673 return r;
538} 674}
539 675
540static u_char * 676static int
541derive_key(Kex *kex, int id, u_int need, u_char *hash, u_int hashlen, 677derive_key(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen,
542 const u_char *shared_secret, u_int slen) 678 const struct sshbuf *shared_secret, u_char **keyp)
543{ 679{
544 Buffer b; 680 struct kex *kex = ssh->kex;
545 struct ssh_digest_ctx *hashctx; 681 struct ssh_digest_ctx *hashctx = NULL;
546 char c = id; 682 char c = id;
547 u_int have; 683 u_int have;
548 size_t mdsz; 684 size_t mdsz;
549 u_char *digest; 685 u_char *digest;
686 int r;
550 687
551 if ((mdsz = ssh_digest_bytes(kex->hash_alg)) == 0) 688 if ((mdsz = ssh_digest_bytes(kex->hash_alg)) == 0)
552 fatal("bad kex md size %zu", mdsz); 689 return SSH_ERR_INVALID_ARGUMENT;
553 digest = xmalloc(roundup(need, mdsz)); 690 if ((digest = calloc(1, roundup(need, mdsz))) == NULL) {
554 691 r = SSH_ERR_ALLOC_FAIL;
555 buffer_init(&b); 692 goto out;
556 buffer_append(&b, shared_secret, slen); 693 }
557 694
558 /* K1 = HASH(K || H || "A" || session_id) */ 695 /* K1 = HASH(K || H || "A" || session_id) */
559 if ((hashctx = ssh_digest_start(kex->hash_alg)) == NULL) 696 if ((hashctx = ssh_digest_start(kex->hash_alg)) == NULL ||
560 fatal("%s: ssh_digest_start failed", __func__); 697 ssh_digest_update_buffer(hashctx, shared_secret) != 0 ||
561 if (ssh_digest_update_buffer(hashctx, &b) != 0 ||
562 ssh_digest_update(hashctx, hash, hashlen) != 0 || 698 ssh_digest_update(hashctx, hash, hashlen) != 0 ||
563 ssh_digest_update(hashctx, &c, 1) != 0 || 699 ssh_digest_update(hashctx, &c, 1) != 0 ||
564 ssh_digest_update(hashctx, kex->session_id, 700 ssh_digest_update(hashctx, kex->session_id,
565 kex->session_id_len) != 0) 701 kex->session_id_len) != 0 ||
566 fatal("%s: ssh_digest_update failed", __func__); 702 ssh_digest_final(hashctx, digest, mdsz) != 0) {
567 if (ssh_digest_final(hashctx, digest, mdsz) != 0) 703 r = SSH_ERR_LIBCRYPTO_ERROR;
568 fatal("%s: ssh_digest_final failed", __func__); 704 goto out;
705 }
569 ssh_digest_free(hashctx); 706 ssh_digest_free(hashctx);
707 hashctx = NULL;
570 708
571 /* 709 /*
572 * expand key: 710 * expand key:
@@ -574,107 +712,115 @@ derive_key(Kex *kex, int id, u_int need, u_char *hash, u_int hashlen,
574 * Key = K1 || K2 || ... || Kn 712 * Key = K1 || K2 || ... || Kn
575 */ 713 */
576 for (have = mdsz; need > have; have += mdsz) { 714 for (have = mdsz; need > have; have += mdsz) {
577 if ((hashctx = ssh_digest_start(kex->hash_alg)) == NULL) 715 if ((hashctx = ssh_digest_start(kex->hash_alg)) == NULL ||
578 fatal("%s: ssh_digest_start failed", __func__); 716 ssh_digest_update_buffer(hashctx, shared_secret) != 0 ||
579 if (ssh_digest_update_buffer(hashctx, &b) != 0 ||
580 ssh_digest_update(hashctx, hash, hashlen) != 0 || 717 ssh_digest_update(hashctx, hash, hashlen) != 0 ||
581 ssh_digest_update(hashctx, digest, have) != 0) 718 ssh_digest_update(hashctx, digest, have) != 0 ||
582 fatal("%s: ssh_digest_update failed", __func__); 719 ssh_digest_final(hashctx, digest + have, mdsz) != 0) {
583 if (ssh_digest_final(hashctx, digest + have, mdsz) != 0) 720 r = SSH_ERR_LIBCRYPTO_ERROR;
584 fatal("%s: ssh_digest_final failed", __func__); 721 goto out;
722 }
585 ssh_digest_free(hashctx); 723 ssh_digest_free(hashctx);
724 hashctx = NULL;
586 } 725 }
587 buffer_free(&b);
588#ifdef DEBUG_KEX 726#ifdef DEBUG_KEX
589 fprintf(stderr, "key '%c'== ", c); 727 fprintf(stderr, "key '%c'== ", c);
590 dump_digest("key", digest, need); 728 dump_digest("key", digest, need);
591#endif 729#endif
592 return digest; 730 *keyp = digest;
731 digest = NULL;
732 r = 0;
733 out:
734 if (digest)
735 free(digest);
736 ssh_digest_free(hashctx);
737 return r;
593} 738}
594 739
595Newkeys *current_keys[MODE_MAX];
596
597#define NKEYS 6 740#define NKEYS 6
598void 741int
599kex_derive_keys(Kex *kex, u_char *hash, u_int hashlen, 742kex_derive_keys(struct ssh *ssh, u_char *hash, u_int hashlen,
600 const u_char *shared_secret, u_int slen) 743 const struct sshbuf *shared_secret)
601{ 744{
745 struct kex *kex = ssh->kex;
602 u_char *keys[NKEYS]; 746 u_char *keys[NKEYS];
603 u_int i, mode, ctos; 747 u_int i, j, mode, ctos;
748 int r;
604 749
605 for (i = 0; i < NKEYS; i++) { 750 for (i = 0; i < NKEYS; i++) {
606 keys[i] = derive_key(kex, 'A'+i, kex->we_need, hash, hashlen, 751 if ((r = derive_key(ssh, 'A'+i, kex->we_need, hash, hashlen,
607 shared_secret, slen); 752 shared_secret, &keys[i])) != 0) {
753 for (j = 0; j < i; j++)
754 free(keys[j]);
755 return r;
756 }
608 } 757 }
609
610 debug2("kex_derive_keys");
611 for (mode = 0; mode < MODE_MAX; mode++) { 758 for (mode = 0; mode < MODE_MAX; mode++) {
612 current_keys[mode] = kex->newkeys[mode];
613 kex->newkeys[mode] = NULL;
614 ctos = (!kex->server && mode == MODE_OUT) || 759 ctos = (!kex->server && mode == MODE_OUT) ||
615 (kex->server && mode == MODE_IN); 760 (kex->server && mode == MODE_IN);
616 current_keys[mode]->enc.iv = keys[ctos ? 0 : 1]; 761 kex->newkeys[mode]->enc.iv = keys[ctos ? 0 : 1];
617 current_keys[mode]->enc.key = keys[ctos ? 2 : 3]; 762 kex->newkeys[mode]->enc.key = keys[ctos ? 2 : 3];
618 current_keys[mode]->mac.key = keys[ctos ? 4 : 5]; 763 kex->newkeys[mode]->mac.key = keys[ctos ? 4 : 5];
619 } 764 }
765 return 0;
620} 766}
621 767
622#ifdef WITH_OPENSSL 768#ifdef WITH_OPENSSL
623void 769int
624kex_derive_keys_bn(Kex *kex, u_char *hash, u_int hashlen, const BIGNUM *secret) 770kex_derive_keys_bn(struct ssh *ssh, u_char *hash, u_int hashlen,
771 const BIGNUM *secret)
625{ 772{
626 Buffer shared_secret; 773 struct sshbuf *shared_secret;
627 774 int r;
628 buffer_init(&shared_secret); 775
629 buffer_put_bignum2(&shared_secret, secret); 776 if ((shared_secret = sshbuf_new()) == NULL)
630 kex_derive_keys(kex, hash, hashlen, 777 return SSH_ERR_ALLOC_FAIL;
631 buffer_ptr(&shared_secret), buffer_len(&shared_secret)); 778 if ((r = sshbuf_put_bignum2(shared_secret, secret)) == 0)
632 buffer_free(&shared_secret); 779 r = kex_derive_keys(ssh, hash, hashlen, shared_secret);
780 sshbuf_free(shared_secret);
781 return r;
633} 782}
634#endif 783#endif
635 784
636Newkeys *
637kex_get_newkeys(int mode)
638{
639 Newkeys *ret;
640
641 ret = current_keys[mode];
642 current_keys[mode] = NULL;
643 return ret;
644}
645
646#ifdef WITH_SSH1 785#ifdef WITH_SSH1
647void 786int
648derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus, 787derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus,
649 u_int8_t cookie[8], u_int8_t id[16]) 788 u_int8_t cookie[8], u_int8_t id[16])
650{ 789{
651 u_int8_t nbuf[2048], obuf[SSH_DIGEST_MAX_LENGTH]; 790 u_int8_t hbuf[2048], sbuf[2048], obuf[SSH_DIGEST_MAX_LENGTH];
652 int len; 791 struct ssh_digest_ctx *hashctx = NULL;
653 struct ssh_digest_ctx *hashctx; 792 size_t hlen, slen;
654 793 int r;
655 if ((hashctx = ssh_digest_start(SSH_DIGEST_MD5)) == NULL) 794
656 fatal("%s: ssh_digest_start", __func__); 795 hlen = BN_num_bytes(host_modulus);
657 796 slen = BN_num_bytes(server_modulus);
658 len = BN_num_bytes(host_modulus); 797 if (hlen < (512 / 8) || (u_int)hlen > sizeof(hbuf) ||
659 if (len < (512 / 8) || (u_int)len > sizeof(nbuf)) 798 slen < (512 / 8) || (u_int)slen > sizeof(sbuf))
660 fatal("%s: bad host modulus (len %d)", __func__, len); 799 return SSH_ERR_KEY_BITS_MISMATCH;
661 BN_bn2bin(host_modulus, nbuf); 800 if (BN_bn2bin(host_modulus, hbuf) <= 0 ||
662 if (ssh_digest_update(hashctx, nbuf, len) != 0) 801 BN_bn2bin(server_modulus, sbuf) <= 0) {
663 fatal("%s: ssh_digest_update failed", __func__); 802 r = SSH_ERR_LIBCRYPTO_ERROR;
664 803 goto out;
665 len = BN_num_bytes(server_modulus); 804 }
666 if (len < (512 / 8) || (u_int)len > sizeof(nbuf)) 805 if ((hashctx = ssh_digest_start(SSH_DIGEST_MD5)) == NULL) {
667 fatal("%s: bad server modulus (len %d)", __func__, len); 806 r = SSH_ERR_ALLOC_FAIL;
668 BN_bn2bin(server_modulus, nbuf); 807 goto out;
669 if (ssh_digest_update(hashctx, nbuf, len) != 0 || 808 }
670 ssh_digest_update(hashctx, cookie, 8) != 0) 809 if (ssh_digest_update(hashctx, hbuf, hlen) != 0 ||
671 fatal("%s: ssh_digest_update failed", __func__); 810 ssh_digest_update(hashctx, sbuf, slen) != 0 ||
672 if (ssh_digest_final(hashctx, obuf, sizeof(obuf)) != 0) 811 ssh_digest_update(hashctx, cookie, 8) != 0 ||
673 fatal("%s: ssh_digest_final failed", __func__); 812 ssh_digest_final(hashctx, obuf, sizeof(obuf)) != 0) {
813 r = SSH_ERR_LIBCRYPTO_ERROR;
814 goto out;
815 }
674 memcpy(id, obuf, ssh_digest_bytes(SSH_DIGEST_MD5)); 816 memcpy(id, obuf, ssh_digest_bytes(SSH_DIGEST_MD5));
675 817 r = 0;
676 explicit_bzero(nbuf, sizeof(nbuf)); 818 out:
819 ssh_digest_free(hashctx);
820 explicit_bzero(hbuf, sizeof(hbuf));
821 explicit_bzero(sbuf, sizeof(sbuf));
677 explicit_bzero(obuf, sizeof(obuf)); 822 explicit_bzero(obuf, sizeof(obuf));
823 return r;
678} 824}
679#endif 825#endif
680 826
@@ -682,16 +828,7 @@ derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus,
682void 828void
683dump_digest(char *msg, u_char *digest, int len) 829dump_digest(char *msg, u_char *digest, int len)
684{ 830{
685 int i;
686
687 fprintf(stderr, "%s\n", msg); 831 fprintf(stderr, "%s\n", msg);
688 for (i = 0; i < len; i++) { 832 sshbuf_dump_data(digest, len, stderr);
689 fprintf(stderr, "%02x", digest[i]);
690 if (i%32 == 31)
691 fprintf(stderr, "\n");
692 else if (i%8 == 7)
693 fprintf(stderr, " ");
694 }
695 fprintf(stderr, "\n");
696} 833}
697#endif 834#endif
diff --git a/kex.h b/kex.h
index 4c40ec851..f70b81fc1 100644
--- a/kex.h
+++ b/kex.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: kex.h,v 1.64 2014/05/02 03:27:54 djm Exp $ */ 1/* $OpenBSD: kex.h,v 1.71 2015/02/16 22:13:32 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -26,13 +26,28 @@
26#ifndef KEX_H 26#ifndef KEX_H
27#define KEX_H 27#define KEX_H
28 28
29#include <signal.h> 29#include "mac.h"
30#include <openssl/evp.h> 30#include "buffer.h" /* XXX for typedef */
31#include <openssl/hmac.h> 31#include "key.h" /* XXX for typedef */
32#ifdef OPENSSL_HAS_ECC 32
33#include <openssl/ec.h> 33#ifdef WITH_LEAKMALLOC
34#include "leakmalloc.h"
34#endif 35#endif
35 36
37#ifdef WITH_OPENSSL
38# ifdef OPENSSL_HAS_ECC
39# include <openssl/ec.h>
40# else /* OPENSSL_HAS_ECC */
41# define EC_KEY void
42# define EC_GROUP void
43# define EC_POINT void
44# endif /* OPENSSL_HAS_ECC */
45#else /* WITH_OPENSSL */
46# define EC_KEY void
47# define EC_GROUP void
48# define EC_POINT void
49#endif /* WITH_OPENSSL */
50
36#define KEX_COOKIE_LEN 16 51#define KEX_COOKIE_LEN 16
37 52
38#define KEX_DH1 "diffie-hellman-group1-sha1" 53#define KEX_DH1 "diffie-hellman-group1-sha1"
@@ -49,6 +64,8 @@
49#define COMP_ZLIB 1 64#define COMP_ZLIB 1
50#define COMP_DELAYED 2 65#define COMP_DELAYED 2
51 66
67#define CURVE25519_SIZE 32
68
52enum kex_init_proposals { 69enum kex_init_proposals {
53 PROPOSAL_KEX_ALGS, 70 PROPOSAL_KEX_ALGS,
54 PROPOSAL_SERVER_HOST_KEY_ALGS, 71 PROPOSAL_SERVER_HOST_KEY_ALGS,
@@ -81,15 +98,9 @@ enum kex_exchange {
81 98
82#define KEX_INIT_SENT 0x0001 99#define KEX_INIT_SENT 0x0001
83 100
84typedef struct Kex Kex; 101struct sshenc {
85typedef struct Mac Mac;
86typedef struct Comp Comp;
87typedef struct Enc Enc;
88typedef struct Newkeys Newkeys;
89
90struct Enc {
91 char *name; 102 char *name;
92 const Cipher *cipher; 103 const struct sshcipher *cipher;
93 int enabled; 104 int enabled;
94 u_int key_len; 105 u_int key_len;
95 u_int iv_len; 106 u_int iv_len;
@@ -97,108 +108,120 @@ struct Enc {
97 u_char *key; 108 u_char *key;
98 u_char *iv; 109 u_char *iv;
99}; 110};
100struct Mac { 111struct sshcomp {
101 char *name; 112 u_int type;
102 int enabled;
103 u_int mac_len;
104 u_char *key;
105 u_int key_len;
106 int type;
107 int etm; /* Encrypt-then-MAC */
108 struct ssh_hmac_ctx *hmac_ctx;
109 struct umac_ctx *umac_ctx;
110};
111struct Comp {
112 int type;
113 int enabled; 113 int enabled;
114 char *name; 114 char *name;
115}; 115};
116struct Newkeys { 116struct newkeys {
117 Enc enc; 117 struct sshenc enc;
118 Mac mac; 118 struct sshmac mac;
119 Comp comp; 119 struct sshcomp comp;
120}; 120};
121struct Kex { 121
122struct ssh;
123
124struct kex {
122 u_char *session_id; 125 u_char *session_id;
123 u_int session_id_len; 126 size_t session_id_len;
124 Newkeys *newkeys[MODE_MAX]; 127 struct newkeys *newkeys[MODE_MAX];
125 u_int we_need; 128 u_int we_need;
126 u_int dh_need; 129 u_int dh_need;
127 int server; 130 int server;
128 char *name; 131 char *name;
129 int hostkey_type; 132 int hostkey_type;
130 int kex_type; 133 int hostkey_nid;
134 u_int kex_type;
131 int roaming; 135 int roaming;
132 Buffer my; 136 struct sshbuf *my;
133 Buffer peer; 137 struct sshbuf *peer;
134 sig_atomic_t done; 138 sig_atomic_t done;
135 int flags; 139 u_int flags;
136 int hash_alg; 140 int hash_alg;
137 int ec_nid; 141 int ec_nid;
138 char *client_version_string; 142 char *client_version_string;
139 char *server_version_string; 143 char *server_version_string;
140 int (*verify_host_key)(Key *); 144 int (*verify_host_key)(struct sshkey *, struct ssh *);
141 Key *(*load_host_public_key)(int); 145 struct sshkey *(*load_host_public_key)(int, int, struct ssh *);
142 Key *(*load_host_private_key)(int); 146 struct sshkey *(*load_host_private_key)(int, int, struct ssh *);
143 int (*host_key_index)(Key *); 147 int (*host_key_index)(struct sshkey *, int, struct ssh *);
144 void (*sign)(Key *, Key *, u_char **, u_int *, u_char *, u_int); 148 int (*sign)(struct sshkey *, struct sshkey *,
145 void (*kex[KEX_MAX])(Kex *); 149 u_char **, size_t *, const u_char *, size_t, u_int);
150 int (*kex[KEX_MAX])(struct ssh *);
151 /* kex specific state */
152 DH *dh; /* DH */
153 u_int min, max, nbits; /* GEX */
154 EC_KEY *ec_client_key; /* ECDH */
155 const EC_GROUP *ec_group; /* ECDH */
156 u_char c25519_client_key[CURVE25519_SIZE]; /* 25519 */
157 u_char c25519_client_pubkey[CURVE25519_SIZE]; /* 25519 */
146}; 158};
147 159
148int kex_names_valid(const char *); 160int kex_names_valid(const char *);
149char *kex_alg_list(char); 161char *kex_alg_list(char);
150 162
151Kex *kex_setup(char *[PROPOSAL_MAX]); 163int kex_new(struct ssh *, char *[PROPOSAL_MAX], struct kex **);
152void kex_finish(Kex *); 164int kex_setup(struct ssh *, char *[PROPOSAL_MAX]);
153 165void kex_free_newkeys(struct newkeys *);
154void kex_send_kexinit(Kex *); 166void kex_free(struct kex *);
155void kex_input_kexinit(int, u_int32_t, void *); 167
156void kex_derive_keys(Kex *, u_char *, u_int, const u_char *, u_int); 168int kex_buf2prop(struct sshbuf *, int *, char ***);
157void kex_derive_keys_bn(Kex *, u_char *, u_int, const BIGNUM *); 169int kex_prop2buf(struct sshbuf *, char *proposal[PROPOSAL_MAX]);
158 170void kex_prop_free(char **);
159Newkeys *kex_get_newkeys(int); 171
160 172int kex_send_kexinit(struct ssh *);
161void kexdh_client(Kex *); 173int kex_input_kexinit(int, u_int32_t, void *);
162void kexdh_server(Kex *); 174int kex_derive_keys(struct ssh *, u_char *, u_int, const struct sshbuf *);
163void kexgex_client(Kex *); 175int kex_derive_keys_bn(struct ssh *, u_char *, u_int, const BIGNUM *);
164void kexgex_server(Kex *); 176int kex_send_newkeys(struct ssh *);
165void kexecdh_client(Kex *); 177
166void kexecdh_server(Kex *); 178int kexdh_client(struct ssh *);
167void kexc25519_client(Kex *); 179int kexdh_server(struct ssh *);
168void kexc25519_server(Kex *); 180int kexgex_client(struct ssh *);
169 181int kexgex_server(struct ssh *);
170void 182int kexecdh_client(struct ssh *);
171kex_dh_hash(char *, char *, char *, int, char *, int, u_char *, int, 183int kexecdh_server(struct ssh *);
172 BIGNUM *, BIGNUM *, BIGNUM *, u_char **, u_int *); 184int kexc25519_client(struct ssh *);
173void 185int kexc25519_server(struct ssh *);
174kexgex_hash(int, char *, char *, char *, int, char *, 186
175 int, u_char *, int, int, int, int, BIGNUM *, BIGNUM *, BIGNUM *, 187int kex_dh_hash(const char *, const char *,
176 BIGNUM *, BIGNUM *, u_char **, u_int *); 188 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
177#ifdef OPENSSL_HAS_ECC 189 const BIGNUM *, const BIGNUM *, const BIGNUM *, u_char *, size_t *);
178void 190
179kex_ecdh_hash(int, const EC_GROUP *, char *, char *, char *, int, 191int kexgex_hash(int, const char *, const char *,
180 char *, int, u_char *, int, const EC_POINT *, const EC_POINT *, 192 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
181 const BIGNUM *, u_char **, u_int *); 193 int, int, int,
182#endif 194 const BIGNUM *, const BIGNUM *, const BIGNUM *,
183void 195 const BIGNUM *, const BIGNUM *,
184kex_c25519_hash(int, char *, char *, char *, int, 196 u_char *, size_t *);
185 char *, int, u_char *, int, const u_char *, const u_char *, 197
186 const u_char *, u_int, u_char **, u_int *); 198int kex_ecdh_hash(int, const EC_GROUP *, const char *, const char *,
187 199 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
188#define CURVE25519_SIZE 32 200 const EC_POINT *, const EC_POINT *, const BIGNUM *, u_char *, size_t *);
189void kexc25519_keygen(u_char[CURVE25519_SIZE], u_char[CURVE25519_SIZE]) 201
202int kex_c25519_hash(int, const char *, const char *, const char *, size_t,
203 const char *, size_t, const u_char *, size_t, const u_char *, const u_char *,
204 const u_char *, size_t, u_char *, size_t *);
205
206void kexc25519_keygen(u_char key[CURVE25519_SIZE], u_char pub[CURVE25519_SIZE])
190 __attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE))) 207 __attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE)))
191 __attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE))); 208 __attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE)));
192void kexc25519_shared_key(const u_char key[CURVE25519_SIZE], 209int kexc25519_shared_key(const u_char key[CURVE25519_SIZE],
193 const u_char pub[CURVE25519_SIZE], Buffer *out) 210 const u_char pub[CURVE25519_SIZE], struct sshbuf *out)
194 __attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE))) 211 __attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE)))
195 __attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE))); 212 __attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE)));
196 213
197void 214int
198derive_ssh1_session_id(BIGNUM *, BIGNUM *, u_int8_t[8], u_int8_t[16]); 215derive_ssh1_session_id(BIGNUM *, BIGNUM *, u_int8_t[8], u_int8_t[16]);
199 216
200#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) || defined(DEBUG_KEXECDH) 217#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) || defined(DEBUG_KEXECDH)
201void dump_digest(char *, u_char *, int); 218void dump_digest(char *, u_char *, int);
202#endif 219#endif
203 220
221#if !defined(WITH_OPENSSL) || !defined(OPENSSL_HAS_ECC)
222# undef EC_KEY
223# undef EC_GROUP
224# undef EC_POINT
225#endif
226
204#endif 227#endif
diff --git a/kexc25519.c b/kexc25519.c
index e3afa0055..b6e6c4010 100644
--- a/kexc25519.c
+++ b/kexc25519.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexc25519.c,v 1.7 2014/05/02 03:27:54 djm Exp $ */ 1/* $OpenBSD: kexc25519.c,v 1.8 2015/01/19 20:16:15 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2001, 2013 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001, 2013 Markus Friedl. All rights reserved.
4 * Copyright (c) 2010 Damien Miller. All rights reserved. 4 * Copyright (c) 2010 Damien Miller. All rights reserved.
@@ -35,13 +35,14 @@
35#include <openssl/bn.h> 35#include <openssl/bn.h>
36#include <openssl/evp.h> 36#include <openssl/evp.h>
37 37
38#include "buffer.h" 38#include "sshbuf.h"
39#include "ssh2.h" 39#include "ssh2.h"
40#include "key.h" 40#include "sshkey.h"
41#include "cipher.h" 41#include "cipher.h"
42#include "kex.h" 42#include "kex.h"
43#include "log.h" 43#include "log.h"
44#include "digest.h" 44#include "digest.h"
45#include "ssherr.h"
45 46
46extern int crypto_scalarmult_curve25519(u_char a[CURVE25519_SIZE], 47extern int crypto_scalarmult_curve25519(u_char a[CURVE25519_SIZE],
47 const u_char b[CURVE25519_SIZE], const u_char c[CURVE25519_SIZE]) 48 const u_char b[CURVE25519_SIZE], const u_char c[CURVE25519_SIZE])
@@ -58,65 +59,70 @@ kexc25519_keygen(u_char key[CURVE25519_SIZE], u_char pub[CURVE25519_SIZE])
58 crypto_scalarmult_curve25519(pub, key, basepoint); 59 crypto_scalarmult_curve25519(pub, key, basepoint);
59} 60}
60 61
61void 62int
62kexc25519_shared_key(const u_char key[CURVE25519_SIZE], 63kexc25519_shared_key(const u_char key[CURVE25519_SIZE],
63 const u_char pub[CURVE25519_SIZE], Buffer *out) 64 const u_char pub[CURVE25519_SIZE], struct sshbuf *out)
64{ 65{
65 u_char shared_key[CURVE25519_SIZE]; 66 u_char shared_key[CURVE25519_SIZE];
67 int r;
66 68
67 crypto_scalarmult_curve25519(shared_key, key, pub); 69 crypto_scalarmult_curve25519(shared_key, key, pub);
68#ifdef DEBUG_KEXECDH 70#ifdef DEBUG_KEXECDH
69 dump_digest("shared secret", shared_key, CURVE25519_SIZE); 71 dump_digest("shared secret", shared_key, CURVE25519_SIZE);
70#endif 72#endif
71 buffer_clear(out); 73 sshbuf_reset(out);
72 buffer_put_bignum2_from_string(out, shared_key, CURVE25519_SIZE); 74 r = sshbuf_put_bignum2_bytes(out, shared_key, CURVE25519_SIZE);
73 explicit_bzero(shared_key, CURVE25519_SIZE); 75 explicit_bzero(shared_key, CURVE25519_SIZE);
76 return r;
74} 77}
75 78
76void 79int
77kex_c25519_hash( 80kex_c25519_hash(
78 int hash_alg, 81 int hash_alg,
79 char *client_version_string, 82 const char *client_version_string,
80 char *server_version_string, 83 const char *server_version_string,
81 char *ckexinit, int ckexinitlen, 84 const char *ckexinit, size_t ckexinitlen,
82 char *skexinit, int skexinitlen, 85 const char *skexinit, size_t skexinitlen,
83 u_char *serverhostkeyblob, int sbloblen, 86 const u_char *serverhostkeyblob, size_t sbloblen,
84 const u_char client_dh_pub[CURVE25519_SIZE], 87 const u_char client_dh_pub[CURVE25519_SIZE],
85 const u_char server_dh_pub[CURVE25519_SIZE], 88 const u_char server_dh_pub[CURVE25519_SIZE],
86 const u_char *shared_secret, u_int secretlen, 89 const u_char *shared_secret, size_t secretlen,
87 u_char **hash, u_int *hashlen) 90 u_char *hash, size_t *hashlen)
88{ 91{
89 Buffer b; 92 struct sshbuf *b;
90 static u_char digest[SSH_DIGEST_MAX_LENGTH]; 93 int r;
91 94
92 buffer_init(&b); 95 if (*hashlen < ssh_digest_bytes(hash_alg))
93 buffer_put_cstring(&b, client_version_string); 96 return SSH_ERR_INVALID_ARGUMENT;
94 buffer_put_cstring(&b, server_version_string); 97 if ((b = sshbuf_new()) == NULL)
95 98 return SSH_ERR_ALLOC_FAIL;
96 /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */ 99 if ((r = sshbuf_put_cstring(b, client_version_string)) < 0 ||
97 buffer_put_int(&b, ckexinitlen+1); 100 (r = sshbuf_put_cstring(b, server_version_string)) < 0 ||
98 buffer_put_char(&b, SSH2_MSG_KEXINIT); 101 /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */
99 buffer_append(&b, ckexinit, ckexinitlen); 102 (r = sshbuf_put_u32(b, ckexinitlen+1)) < 0 ||
100 buffer_put_int(&b, skexinitlen+1); 103 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) < 0 ||
101 buffer_put_char(&b, SSH2_MSG_KEXINIT); 104 (r = sshbuf_put(b, ckexinit, ckexinitlen)) < 0 ||
102 buffer_append(&b, skexinit, skexinitlen); 105 (r = sshbuf_put_u32(b, skexinitlen+1)) < 0 ||
103 106 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) < 0 ||
104 buffer_put_string(&b, serverhostkeyblob, sbloblen); 107 (r = sshbuf_put(b, skexinit, skexinitlen)) < 0 ||
105 buffer_put_string(&b, client_dh_pub, CURVE25519_SIZE); 108 (r = sshbuf_put_string(b, serverhostkeyblob, sbloblen)) < 0 ||
106 buffer_put_string(&b, server_dh_pub, CURVE25519_SIZE); 109 (r = sshbuf_put_string(b, client_dh_pub, CURVE25519_SIZE)) < 0 ||
107 buffer_append(&b, shared_secret, secretlen); 110 (r = sshbuf_put_string(b, server_dh_pub, CURVE25519_SIZE)) < 0 ||
108 111 (r = sshbuf_put(b, shared_secret, secretlen)) < 0) {
112 sshbuf_free(b);
113 return r;
114 }
109#ifdef DEBUG_KEX 115#ifdef DEBUG_KEX
110 buffer_dump(&b); 116 sshbuf_dump(b, stderr);
111#endif 117#endif
112 if (ssh_digest_buffer(hash_alg, &b, digest, sizeof(digest)) != 0) 118 if (ssh_digest_buffer(hash_alg, b, hash, *hashlen) != 0) {
113 fatal("%s: digest_buffer failed", __func__); 119 sshbuf_free(b);
114 120 return SSH_ERR_LIBCRYPTO_ERROR;
115 buffer_free(&b); 121 }
116 122 sshbuf_free(b);
123 *hashlen = ssh_digest_bytes(hash_alg);
117#ifdef DEBUG_KEX 124#ifdef DEBUG_KEX
118 dump_digest("hash", digest, ssh_digest_bytes(hash_alg)); 125 dump_digest("hash", hash, *hashlen);
119#endif 126#endif
120 *hash = digest; 127 return 0;
121 *hashlen = ssh_digest_bytes(hash_alg);
122} 128}
diff --git a/kexc25519c.c b/kexc25519c.c
index a80678af6..b7ef65dc3 100644
--- a/kexc25519c.c
+++ b/kexc25519c.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexc25519c.c,v 1.4 2014/01/12 08:13:13 djm Exp $ */ 1/* $OpenBSD: kexc25519c.c,v 1.7 2015/01/26 06:10:03 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2010 Damien Miller. All rights reserved. 4 * Copyright (c) 2010 Damien Miller. All rights reserved.
@@ -33,97 +33,138 @@
33#include <string.h> 33#include <string.h>
34#include <signal.h> 34#include <signal.h>
35 35
36#include "xmalloc.h" 36#include "sshkey.h"
37#include "buffer.h"
38#include "key.h"
39#include "cipher.h" 37#include "cipher.h"
40#include "kex.h" 38#include "kex.h"
41#include "log.h" 39#include "log.h"
42#include "packet.h" 40#include "packet.h"
43#include "ssh2.h" 41#include "ssh2.h"
42#include "sshbuf.h"
43#include "digest.h"
44#include "ssherr.h"
44 45
45void 46static int
46kexc25519_client(Kex *kex) 47input_kex_c25519_reply(int type, u_int32_t seq, void *ctxt);
47{
48 Key *server_host_key;
49 u_char client_key[CURVE25519_SIZE];
50 u_char client_pubkey[CURVE25519_SIZE];
51 u_char *server_pubkey = NULL;
52 u_char *server_host_key_blob = NULL, *signature = NULL;
53 u_char *hash;
54 u_int slen, sbloblen, hashlen;
55 Buffer shared_secret;
56
57 kexc25519_keygen(client_key, client_pubkey);
58 48
59 packet_start(SSH2_MSG_KEX_ECDH_INIT); 49int
60 packet_put_string(client_pubkey, sizeof(client_pubkey)); 50kexc25519_client(struct ssh *ssh)
61 packet_send(); 51{
62 debug("sending SSH2_MSG_KEX_ECDH_INIT"); 52 struct kex *kex = ssh->kex;
53 int r;
63 54
55 kexc25519_keygen(kex->c25519_client_key, kex->c25519_client_pubkey);
64#ifdef DEBUG_KEXECDH 56#ifdef DEBUG_KEXECDH
65 dump_digest("client private key:", client_key, sizeof(client_key)); 57 dump_digest("client private key:", kex->c25519_client_key,
58 sizeof(kex->c25519_client_key));
66#endif 59#endif
60 if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_ECDH_INIT)) != 0 ||
61 (r = sshpkt_put_string(ssh, kex->c25519_client_pubkey,
62 sizeof(kex->c25519_client_pubkey))) != 0 ||
63 (r = sshpkt_send(ssh)) != 0)
64 return r;
67 65
68 debug("expecting SSH2_MSG_KEX_ECDH_REPLY"); 66 debug("expecting SSH2_MSG_KEX_ECDH_REPLY");
69 packet_read_expect(SSH2_MSG_KEX_ECDH_REPLY); 67 ssh_dispatch_set(ssh, SSH2_MSG_KEX_ECDH_REPLY, &input_kex_c25519_reply);
68 return 0;
69}
70
71static int
72input_kex_c25519_reply(int type, u_int32_t seq, void *ctxt)
73{
74 struct ssh *ssh = ctxt;
75 struct kex *kex = ssh->kex;
76 struct sshkey *server_host_key = NULL;
77 struct sshbuf *shared_secret = NULL;
78 u_char *server_pubkey = NULL;
79 u_char *server_host_key_blob = NULL, *signature = NULL;
80 u_char hash[SSH_DIGEST_MAX_LENGTH];
81 size_t slen, pklen, sbloblen, hashlen;
82 int r;
83
84 if (kex->verify_host_key == NULL) {
85 r = SSH_ERR_INVALID_ARGUMENT;
86 goto out;
87 }
70 88
71 /* hostkey */ 89 /* hostkey */
72 server_host_key_blob = packet_get_string(&sbloblen); 90 if ((r = sshpkt_get_string(ssh, &server_host_key_blob,
73 server_host_key = key_from_blob(server_host_key_blob, sbloblen); 91 &sbloblen)) != 0 ||
74 if (server_host_key == NULL) 92 (r = sshkey_from_blob(server_host_key_blob, sbloblen,
75 fatal("cannot decode server_host_key_blob"); 93 &server_host_key)) != 0)
76 if (server_host_key->type != kex->hostkey_type) 94 goto out;
77 fatal("type mismatch for decoded server_host_key_blob"); 95 if (server_host_key->type != kex->hostkey_type ||
78 if (kex->verify_host_key == NULL) 96 (kex->hostkey_type == KEY_ECDSA &&
79 fatal("cannot verify server_host_key"); 97 server_host_key->ecdsa_nid != kex->hostkey_nid)) {
80 if (kex->verify_host_key(server_host_key) == -1) 98 r = SSH_ERR_KEY_TYPE_MISMATCH;
81 fatal("server_host_key verification failed"); 99 goto out;
100 }
101 if (kex->verify_host_key(server_host_key, ssh) == -1) {
102 r = SSH_ERR_SIGNATURE_INVALID;
103 goto out;
104 }
82 105
83 /* Q_S, server public key */ 106 /* Q_S, server public key */
84 server_pubkey = packet_get_string(&slen); 107 /* signed H */
85 if (slen != CURVE25519_SIZE) 108 if ((r = sshpkt_get_string(ssh, &server_pubkey, &pklen)) != 0 ||
86 fatal("Incorrect size for server Curve25519 pubkey: %d", slen); 109 (r = sshpkt_get_string(ssh, &signature, &slen)) != 0 ||
110 (r = sshpkt_get_end(ssh)) != 0)
111 goto out;
112 if (pklen != CURVE25519_SIZE) {
113 r = SSH_ERR_SIGNATURE_INVALID;
114 goto out;
115 }
87 116
88#ifdef DEBUG_KEXECDH 117#ifdef DEBUG_KEXECDH
89 dump_digest("server public key:", server_pubkey, CURVE25519_SIZE); 118 dump_digest("server public key:", server_pubkey, CURVE25519_SIZE);
90#endif 119#endif
91 120
92 /* signed H */ 121 if ((shared_secret = sshbuf_new()) == NULL) {
93 signature = packet_get_string(&slen); 122 r = SSH_ERR_ALLOC_FAIL;
94 packet_check_eom(); 123 goto out;
95 124 }
96 buffer_init(&shared_secret); 125 if ((r = kexc25519_shared_key(kex->c25519_client_key, server_pubkey,
97 kexc25519_shared_key(client_key, server_pubkey, &shared_secret); 126 shared_secret)) < 0)
127 goto out;
98 128
99 /* calc and verify H */ 129 /* calc and verify H */
100 kex_c25519_hash( 130 hashlen = sizeof(hash);
131 if ((r = kex_c25519_hash(
101 kex->hash_alg, 132 kex->hash_alg,
102 kex->client_version_string, 133 kex->client_version_string,
103 kex->server_version_string, 134 kex->server_version_string,
104 buffer_ptr(&kex->my), buffer_len(&kex->my), 135 sshbuf_ptr(kex->my), sshbuf_len(kex->my),
105 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 136 sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
106 server_host_key_blob, sbloblen, 137 server_host_key_blob, sbloblen,
107 client_pubkey, 138 kex->c25519_client_pubkey,
108 server_pubkey, 139 server_pubkey,
109 buffer_ptr(&shared_secret), buffer_len(&shared_secret), 140 sshbuf_ptr(shared_secret), sshbuf_len(shared_secret),
110 &hash, &hashlen 141 hash, &hashlen)) < 0)
111 ); 142 goto out;
112 free(server_host_key_blob); 143
113 free(server_pubkey); 144 if ((r = sshkey_verify(server_host_key, signature, slen, hash, hashlen,
114 if (key_verify(server_host_key, signature, slen, hash, hashlen) != 1) 145 ssh->compat)) != 0)
115 fatal("key_verify failed for server_host_key"); 146 goto out;
116 key_free(server_host_key);
117 free(signature);
118 147
119 /* save session id */ 148 /* save session id */
120 if (kex->session_id == NULL) { 149 if (kex->session_id == NULL) {
121 kex->session_id_len = hashlen; 150 kex->session_id_len = hashlen;
122 kex->session_id = xmalloc(kex->session_id_len); 151 kex->session_id = malloc(kex->session_id_len);
152 if (kex->session_id == NULL) {
153 r = SSH_ERR_ALLOC_FAIL;
154 goto out;
155 }
123 memcpy(kex->session_id, hash, kex->session_id_len); 156 memcpy(kex->session_id, hash, kex->session_id_len);
124 } 157 }
125 kex_derive_keys(kex, hash, hashlen, 158
126 buffer_ptr(&shared_secret), buffer_len(&shared_secret)); 159 if ((r = kex_derive_keys(ssh, hash, hashlen, shared_secret)) == 0)
127 buffer_free(&shared_secret); 160 r = kex_send_newkeys(ssh);
128 kex_finish(kex); 161out:
162 explicit_bzero(hash, sizeof(hash));
163 explicit_bzero(kex->c25519_client_key, sizeof(kex->c25519_client_key));
164 free(server_host_key_blob);
165 free(server_pubkey);
166 free(signature);
167 sshkey_free(server_host_key);
168 sshbuf_free(shared_secret);
169 return r;
129} 170}
diff --git a/kexc25519s.c b/kexc25519s.c
index 2b8e8efa1..b2d2c858f 100644
--- a/kexc25519s.c
+++ b/kexc25519s.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexc25519s.c,v 1.4 2014/01/12 08:13:13 djm Exp $ */ 1/* $OpenBSD: kexc25519s.c,v 1.8 2015/01/26 06:10:03 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2010 Damien Miller. All rights reserved. 4 * Copyright (c) 2010 Damien Miller. All rights reserved.
@@ -30,97 +30,129 @@
30#include <string.h> 30#include <string.h>
31#include <signal.h> 31#include <signal.h>
32 32
33#include "xmalloc.h" 33#include "sshkey.h"
34#include "buffer.h"
35#include "key.h"
36#include "cipher.h" 34#include "cipher.h"
35#include "digest.h"
37#include "kex.h" 36#include "kex.h"
38#include "log.h" 37#include "log.h"
39#include "packet.h" 38#include "packet.h"
40#include "ssh2.h" 39#include "ssh2.h"
40#include "sshbuf.h"
41#include "ssherr.h"
41 42
42void 43static int input_kex_c25519_init(int, u_int32_t, void *);
43kexc25519_server(Kex *kex) 44
45int
46kexc25519_server(struct ssh *ssh)
47{
48 debug("expecting SSH2_MSG_KEX_ECDH_INIT");
49 ssh_dispatch_set(ssh, SSH2_MSG_KEX_ECDH_INIT, &input_kex_c25519_init);
50 return 0;
51}
52
53static int
54input_kex_c25519_init(int type, u_int32_t seq, void *ctxt)
44{ 55{
45 Key *server_host_private, *server_host_public; 56 struct ssh *ssh = ctxt;
57 struct kex *kex = ssh->kex;
58 struct sshkey *server_host_private, *server_host_public;
59 struct sshbuf *shared_secret = NULL;
46 u_char *server_host_key_blob = NULL, *signature = NULL; 60 u_char *server_host_key_blob = NULL, *signature = NULL;
47 u_char server_key[CURVE25519_SIZE]; 61 u_char server_key[CURVE25519_SIZE];
48 u_char *client_pubkey = NULL; 62 u_char *client_pubkey = NULL;
49 u_char server_pubkey[CURVE25519_SIZE]; 63 u_char server_pubkey[CURVE25519_SIZE];
50 u_char *hash; 64 u_char hash[SSH_DIGEST_MAX_LENGTH];
51 u_int slen, sbloblen, hashlen; 65 size_t slen, pklen, sbloblen, hashlen;
52 Buffer shared_secret; 66 int r;
53 67
54 /* generate private key */ 68 /* generate private key */
55 kexc25519_keygen(server_key, server_pubkey); 69 kexc25519_keygen(server_key, server_pubkey);
56#ifdef DEBUG_KEXECDH 70#ifdef DEBUG_KEXECDH
57 dump_digest("server private key:", server_key, sizeof(server_key)); 71 dump_digest("server private key:", server_key, sizeof(server_key));
58#endif 72#endif
59
60 if (kex->load_host_public_key == NULL || 73 if (kex->load_host_public_key == NULL ||
61 kex->load_host_private_key == NULL) 74 kex->load_host_private_key == NULL) {
62 fatal("Cannot load hostkey"); 75 r = SSH_ERR_INVALID_ARGUMENT;
63 server_host_public = kex->load_host_public_key(kex->hostkey_type); 76 goto out;
64 if (server_host_public == NULL) 77 }
65 fatal("Unsupported hostkey type %d", kex->hostkey_type); 78 server_host_public = kex->load_host_public_key(kex->hostkey_type,
66 server_host_private = kex->load_host_private_key(kex->hostkey_type); 79 kex->hostkey_nid, ssh);
67 80 server_host_private = kex->load_host_private_key(kex->hostkey_type,
68 debug("expecting SSH2_MSG_KEX_ECDH_INIT"); 81 kex->hostkey_nid, ssh);
69 packet_read_expect(SSH2_MSG_KEX_ECDH_INIT); 82 if (server_host_public == NULL) {
70 client_pubkey = packet_get_string(&slen); 83 r = SSH_ERR_NO_HOSTKEY_LOADED;
71 if (slen != CURVE25519_SIZE) 84 goto out;
72 fatal("Incorrect size for server Curve25519 pubkey: %d", slen); 85 }
73 packet_check_eom();
74 86
87 if ((r = sshpkt_get_string(ssh, &client_pubkey, &pklen)) != 0 ||
88 (r = sshpkt_get_end(ssh)) != 0)
89 goto out;
90 if (pklen != CURVE25519_SIZE) {
91 r = SSH_ERR_SIGNATURE_INVALID;
92 goto out;
93 }
75#ifdef DEBUG_KEXECDH 94#ifdef DEBUG_KEXECDH
76 dump_digest("client public key:", client_pubkey, CURVE25519_SIZE); 95 dump_digest("client public key:", client_pubkey, CURVE25519_SIZE);
77#endif 96#endif
78 97
79 buffer_init(&shared_secret); 98 if ((shared_secret = sshbuf_new()) == NULL) {
80 kexc25519_shared_key(server_key, client_pubkey, &shared_secret); 99 r = SSH_ERR_ALLOC_FAIL;
100 goto out;
101 }
102 if ((r = kexc25519_shared_key(server_key, client_pubkey,
103 shared_secret)) < 0)
104 goto out;
81 105
82 /* calc H */ 106 /* calc H */
83 key_to_blob(server_host_public, &server_host_key_blob, &sbloblen); 107 if ((r = sshkey_to_blob(server_host_public, &server_host_key_blob,
84 kex_c25519_hash( 108 &sbloblen)) != 0)
109 goto out;
110 hashlen = sizeof(hash);
111 if ((r = kex_c25519_hash(
85 kex->hash_alg, 112 kex->hash_alg,
86 kex->client_version_string, 113 kex->client_version_string,
87 kex->server_version_string, 114 kex->server_version_string,
88 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 115 sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
89 buffer_ptr(&kex->my), buffer_len(&kex->my), 116 sshbuf_ptr(kex->my), sshbuf_len(kex->my),
90 server_host_key_blob, sbloblen, 117 server_host_key_blob, sbloblen,
91 client_pubkey, 118 client_pubkey,
92 server_pubkey, 119 server_pubkey,
93 buffer_ptr(&shared_secret), buffer_len(&shared_secret), 120 sshbuf_ptr(shared_secret), sshbuf_len(shared_secret),
94 &hash, &hashlen 121 hash, &hashlen)) < 0)
95 ); 122 goto out;
96 123
97 /* save session id := H */ 124 /* save session id := H */
98 if (kex->session_id == NULL) { 125 if (kex->session_id == NULL) {
99 kex->session_id_len = hashlen; 126 kex->session_id_len = hashlen;
100 kex->session_id = xmalloc(kex->session_id_len); 127 kex->session_id = malloc(kex->session_id_len);
128 if (kex->session_id == NULL) {
129 r = SSH_ERR_ALLOC_FAIL;
130 goto out;
131 }
101 memcpy(kex->session_id, hash, kex->session_id_len); 132 memcpy(kex->session_id, hash, kex->session_id_len);
102 } 133 }
103 134
104 /* sign H */ 135 /* sign H */
105 kex->sign(server_host_private, server_host_public, &signature, &slen, 136 if ((r = kex->sign(server_host_private, server_host_public,
106 hash, hashlen); 137 &signature, &slen, hash, hashlen, ssh->compat)) < 0)
107 138 goto out;
108 /* destroy_sensitive_data(); */
109 139
110 /* send server hostkey, ECDH pubkey 'Q_S' and signed H */ 140 /* send server hostkey, ECDH pubkey 'Q_S' and signed H */
111 packet_start(SSH2_MSG_KEX_ECDH_REPLY); 141 if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_ECDH_REPLY)) != 0 ||
112 packet_put_string(server_host_key_blob, sbloblen); 142 (r = sshpkt_put_string(ssh, server_host_key_blob, sbloblen)) != 0 ||
113 packet_put_string(server_pubkey, sizeof(server_pubkey)); 143 (r = sshpkt_put_string(ssh, server_pubkey, sizeof(server_pubkey))) != 0 ||
114 packet_put_string(signature, slen); 144 (r = sshpkt_put_string(ssh, signature, slen)) != 0 ||
115 packet_send(); 145 (r = sshpkt_send(ssh)) != 0)
116 146 goto out;
117 free(signature); 147
148 if ((r = kex_derive_keys(ssh, hash, hashlen, shared_secret)) == 0)
149 r = kex_send_newkeys(ssh);
150out:
151 explicit_bzero(hash, sizeof(hash));
152 explicit_bzero(server_key, sizeof(server_key));
118 free(server_host_key_blob); 153 free(server_host_key_blob);
119 /* have keys, free server key */ 154 free(signature);
120 free(client_pubkey); 155 free(client_pubkey);
121 156 sshbuf_free(shared_secret);
122 kex_derive_keys(kex, hash, hashlen, 157 return r;
123 buffer_ptr(&shared_secret), buffer_len(&shared_secret));
124 buffer_free(&shared_secret);
125 kex_finish(kex);
126} 158}
diff --git a/kexdh.c b/kexdh.c
index e7cdadc90..feea6697d 100644
--- a/kexdh.c
+++ b/kexdh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexdh.c,v 1.24 2014/01/09 23:20:00 djm Exp $ */ 1/* $OpenBSD: kexdh.c,v 1.25 2015/01/19 20:16:15 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * 4 *
@@ -25,63 +25,69 @@
25 25
26#include "includes.h" 26#include "includes.h"
27 27
28#ifdef WITH_OPENSSL
29
28#include <sys/types.h> 30#include <sys/types.h>
29 31
30#include <signal.h> 32#include <signal.h>
31 33
32#include <openssl/evp.h> 34#include <openssl/evp.h>
33 35
34#include "buffer.h"
35#include "ssh2.h" 36#include "ssh2.h"
36#include "key.h" 37#include "sshkey.h"
37#include "cipher.h" 38#include "cipher.h"
38#include "kex.h" 39#include "kex.h"
40#include "ssherr.h"
41#include "sshbuf.h"
39#include "digest.h" 42#include "digest.h"
40#include "log.h"
41 43
42void 44int
43kex_dh_hash( 45kex_dh_hash(
44 char *client_version_string, 46 const char *client_version_string,
45 char *server_version_string, 47 const char *server_version_string,
46 char *ckexinit, int ckexinitlen, 48 const u_char *ckexinit, size_t ckexinitlen,
47 char *skexinit, int skexinitlen, 49 const u_char *skexinit, size_t skexinitlen,
48 u_char *serverhostkeyblob, int sbloblen, 50 const u_char *serverhostkeyblob, size_t sbloblen,
49 BIGNUM *client_dh_pub, 51 const BIGNUM *client_dh_pub,
50 BIGNUM *server_dh_pub, 52 const BIGNUM *server_dh_pub,
51 BIGNUM *shared_secret, 53 const BIGNUM *shared_secret,
52 u_char **hash, u_int *hashlen) 54 u_char *hash, size_t *hashlen)
53{ 55{
54 Buffer b; 56 struct sshbuf *b;
55 static u_char digest[SSH_DIGEST_MAX_LENGTH]; 57 int r;
56
57 buffer_init(&b);
58 buffer_put_cstring(&b, client_version_string);
59 buffer_put_cstring(&b, server_version_string);
60
61 /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */
62 buffer_put_int(&b, ckexinitlen+1);
63 buffer_put_char(&b, SSH2_MSG_KEXINIT);
64 buffer_append(&b, ckexinit, ckexinitlen);
65 buffer_put_int(&b, skexinitlen+1);
66 buffer_put_char(&b, SSH2_MSG_KEXINIT);
67 buffer_append(&b, skexinit, skexinitlen);
68
69 buffer_put_string(&b, serverhostkeyblob, sbloblen);
70 buffer_put_bignum2(&b, client_dh_pub);
71 buffer_put_bignum2(&b, server_dh_pub);
72 buffer_put_bignum2(&b, shared_secret);
73 58
59 if (*hashlen < ssh_digest_bytes(SSH_DIGEST_SHA1))
60 return SSH_ERR_INVALID_ARGUMENT;
61 if ((b = sshbuf_new()) == NULL)
62 return SSH_ERR_ALLOC_FAIL;
63 if ((r = sshbuf_put_cstring(b, client_version_string)) != 0 ||
64 (r = sshbuf_put_cstring(b, server_version_string)) != 0 ||
65 /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */
66 (r = sshbuf_put_u32(b, ckexinitlen+1)) != 0 ||
67 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 ||
68 (r = sshbuf_put(b, ckexinit, ckexinitlen)) != 0 ||
69 (r = sshbuf_put_u32(b, skexinitlen+1)) != 0 ||
70 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 ||
71 (r = sshbuf_put(b, skexinit, skexinitlen)) != 0 ||
72 (r = sshbuf_put_string(b, serverhostkeyblob, sbloblen)) != 0 ||
73 (r = sshbuf_put_bignum2(b, client_dh_pub)) != 0 ||
74 (r = sshbuf_put_bignum2(b, server_dh_pub)) != 0 ||
75 (r = sshbuf_put_bignum2(b, shared_secret)) != 0) {
76 sshbuf_free(b);
77 return r;
78 }
74#ifdef DEBUG_KEX 79#ifdef DEBUG_KEX
75 buffer_dump(&b); 80 sshbuf_dump(b, stderr);
76#endif 81#endif
77 if (ssh_digest_buffer(SSH_DIGEST_SHA1, &b, digest, sizeof(digest)) != 0) 82 if (ssh_digest_buffer(SSH_DIGEST_SHA1, b, hash, *hashlen) != 0) {
78 fatal("%s: ssh_digest_buffer failed", __func__); 83 sshbuf_free(b);
79 84 return SSH_ERR_LIBCRYPTO_ERROR;
80 buffer_free(&b); 85 }
81 86 sshbuf_free(b);
87 *hashlen = ssh_digest_bytes(SSH_DIGEST_SHA1);
82#ifdef DEBUG_KEX 88#ifdef DEBUG_KEX
83 dump_digest("hash", digest, ssh_digest_bytes(SSH_DIGEST_SHA1)); 89 dump_digest("hash", hash, *hashlen);
84#endif 90#endif
85 *hash = digest; 91 return 0;
86 *hashlen = ssh_digest_bytes(SSH_DIGEST_SHA1);
87} 92}
93#endif /* WITH_OPENSSL */
diff --git a/kexdhc.c b/kexdhc.c
index f7a19fc13..af259f16a 100644
--- a/kexdhc.c
+++ b/kexdhc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexdhc.c,v 1.15 2014/02/02 03:44:31 djm Exp $ */ 1/* $OpenBSD: kexdhc.c,v 1.18 2015/01/26 06:10:03 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * 4 *
@@ -25,6 +25,8 @@
25 25
26#include "includes.h" 26#include "includes.h"
27 27
28#ifdef WITH_OPENSSL
29
28#include <sys/types.h> 30#include <sys/types.h>
29 31
30#include <openssl/dh.h> 32#include <openssl/dh.h>
@@ -34,128 +36,177 @@
34#include <string.h> 36#include <string.h>
35#include <signal.h> 37#include <signal.h>
36 38
37#include "xmalloc.h" 39#include "sshkey.h"
38#include "buffer.h"
39#include "key.h"
40#include "cipher.h" 40#include "cipher.h"
41#include "digest.h"
41#include "kex.h" 42#include "kex.h"
42#include "log.h" 43#include "log.h"
43#include "packet.h" 44#include "packet.h"
44#include "dh.h" 45#include "dh.h"
45#include "ssh2.h" 46#include "ssh2.h"
47#include "dispatch.h"
48#include "compat.h"
49#include "ssherr.h"
50#include "sshbuf.h"
51
52static int input_kex_dh(int, u_int32_t, void *);
46 53
47void 54int
48kexdh_client(Kex *kex) 55kexdh_client(struct ssh *ssh)
49{ 56{
50 BIGNUM *dh_server_pub = NULL, *shared_secret = NULL; 57 struct kex *kex = ssh->kex;
51 DH *dh; 58 int r;
52 Key *server_host_key;
53 u_char *server_host_key_blob = NULL, *signature = NULL;
54 u_char *kbuf, *hash;
55 u_int klen, slen, sbloblen, hashlen;
56 int kout;
57 59
58 /* generate and send 'e', client DH public key */ 60 /* generate and send 'e', client DH public key */
59 switch (kex->kex_type) { 61 switch (kex->kex_type) {
60 case KEX_DH_GRP1_SHA1: 62 case KEX_DH_GRP1_SHA1:
61 dh = dh_new_group1(); 63 kex->dh = dh_new_group1();
62 break; 64 break;
63 case KEX_DH_GRP14_SHA1: 65 case KEX_DH_GRP14_SHA1:
64 dh = dh_new_group14(); 66 kex->dh = dh_new_group14();
65 break; 67 break;
66 default: 68 default:
67 fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); 69 r = SSH_ERR_INVALID_ARGUMENT;
70 goto out;
71 }
72 if (kex->dh == NULL) {
73 r = SSH_ERR_ALLOC_FAIL;
74 goto out;
68 } 75 }
69 dh_gen_key(dh, kex->we_need * 8);
70 packet_start(SSH2_MSG_KEXDH_INIT);
71 packet_put_bignum2(dh->pub_key);
72 packet_send();
73
74 debug("sending SSH2_MSG_KEXDH_INIT"); 76 debug("sending SSH2_MSG_KEXDH_INIT");
77 if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0 ||
78 (r = sshpkt_start(ssh, SSH2_MSG_KEXDH_INIT)) != 0 ||
79 (r = sshpkt_put_bignum2(ssh, kex->dh->pub_key)) != 0 ||
80 (r = sshpkt_send(ssh)) != 0)
81 goto out;
75#ifdef DEBUG_KEXDH 82#ifdef DEBUG_KEXDH
76 DHparams_print_fp(stderr, dh); 83 DHparams_print_fp(stderr, kex->dh);
77 fprintf(stderr, "pub= "); 84 fprintf(stderr, "pub= ");
78 BN_print_fp(stderr, dh->pub_key); 85 BN_print_fp(stderr, kex->dh->pub_key);
79 fprintf(stderr, "\n"); 86 fprintf(stderr, "\n");
80#endif 87#endif
81
82 debug("expecting SSH2_MSG_KEXDH_REPLY"); 88 debug("expecting SSH2_MSG_KEXDH_REPLY");
83 packet_read_expect(SSH2_MSG_KEXDH_REPLY); 89 ssh_dispatch_set(ssh, SSH2_MSG_KEXDH_REPLY, &input_kex_dh);
90 r = 0;
91 out:
92 return r;
93}
84 94
95static int
96input_kex_dh(int type, u_int32_t seq, void *ctxt)
97{
98 struct ssh *ssh = ctxt;
99 struct kex *kex = ssh->kex;
100 BIGNUM *dh_server_pub = NULL, *shared_secret = NULL;
101 struct sshkey *server_host_key = NULL;
102 u_char *kbuf = NULL, *server_host_key_blob = NULL, *signature = NULL;
103 u_char hash[SSH_DIGEST_MAX_LENGTH];
104 size_t klen = 0, slen, sbloblen, hashlen;
105 int kout, r;
106
107 if (kex->verify_host_key == NULL) {
108 r = SSH_ERR_INVALID_ARGUMENT;
109 goto out;
110 }
85 /* key, cert */ 111 /* key, cert */
86 server_host_key_blob = packet_get_string(&sbloblen); 112 if ((r = sshpkt_get_string(ssh, &server_host_key_blob,
87 server_host_key = key_from_blob(server_host_key_blob, sbloblen); 113 &sbloblen)) != 0 ||
88 if (server_host_key == NULL) 114 (r = sshkey_from_blob(server_host_key_blob, sbloblen,
89 fatal("cannot decode server_host_key_blob"); 115 &server_host_key)) != 0)
90 if (server_host_key->type != kex->hostkey_type) 116 goto out;
91 fatal("type mismatch for decoded server_host_key_blob"); 117 if (server_host_key->type != kex->hostkey_type ||
92 if (kex->verify_host_key == NULL) 118 (kex->hostkey_type == KEY_ECDSA &&
93 fatal("cannot verify server_host_key"); 119 server_host_key->ecdsa_nid != kex->hostkey_nid)) {
94 if (kex->verify_host_key(server_host_key) == -1) 120 r = SSH_ERR_KEY_TYPE_MISMATCH;
95 fatal("server_host_key verification failed"); 121 goto out;
96 122 }
123 if (kex->verify_host_key(server_host_key, ssh) == -1) {
124 r = SSH_ERR_SIGNATURE_INVALID;
125 goto out;
126 }
97 /* DH parameter f, server public DH key */ 127 /* DH parameter f, server public DH key */
98 if ((dh_server_pub = BN_new()) == NULL) 128 if ((dh_server_pub = BN_new()) == NULL) {
99 fatal("dh_server_pub == NULL"); 129 r = SSH_ERR_ALLOC_FAIL;
100 packet_get_bignum2(dh_server_pub); 130 goto out;
101 131 }
132 /* signed H */
133 if ((r = sshpkt_get_bignum2(ssh, dh_server_pub)) != 0 ||
134 (r = sshpkt_get_string(ssh, &signature, &slen)) != 0 ||
135 (r = sshpkt_get_end(ssh)) != 0)
136 goto out;
102#ifdef DEBUG_KEXDH 137#ifdef DEBUG_KEXDH
103 fprintf(stderr, "dh_server_pub= "); 138 fprintf(stderr, "dh_server_pub= ");
104 BN_print_fp(stderr, dh_server_pub); 139 BN_print_fp(stderr, dh_server_pub);
105 fprintf(stderr, "\n"); 140 fprintf(stderr, "\n");
106 debug("bits %d", BN_num_bits(dh_server_pub)); 141 debug("bits %d", BN_num_bits(dh_server_pub));
107#endif 142#endif
143 if (!dh_pub_is_valid(kex->dh, dh_server_pub)) {
144 sshpkt_disconnect(ssh, "bad server public DH value");
145 r = SSH_ERR_MESSAGE_INCOMPLETE;
146 goto out;
147 }
108 148
109 /* signed H */ 149 klen = DH_size(kex->dh);
110 signature = packet_get_string(&slen); 150 if ((kbuf = malloc(klen)) == NULL ||
111 packet_check_eom(); 151 (shared_secret = BN_new()) == NULL) {
112 152 r = SSH_ERR_ALLOC_FAIL;
113 if (!dh_pub_is_valid(dh, dh_server_pub)) 153 goto out;
114 packet_disconnect("bad server public DH value"); 154 }
115 155 if ((kout = DH_compute_key(kbuf, dh_server_pub, kex->dh)) < 0 ||
116 klen = DH_size(dh); 156 BN_bin2bn(kbuf, kout, shared_secret) == NULL) {
117 kbuf = xmalloc(klen); 157 r = SSH_ERR_LIBCRYPTO_ERROR;
118 if ((kout = DH_compute_key(kbuf, dh_server_pub, dh)) < 0) 158 goto out;
119 fatal("DH_compute_key: failed"); 159 }
120#ifdef DEBUG_KEXDH 160#ifdef DEBUG_KEXDH
121 dump_digest("shared secret", kbuf, kout); 161 dump_digest("shared secret", kbuf, kout);
122#endif 162#endif
123 if ((shared_secret = BN_new()) == NULL)
124 fatal("kexdh_client: BN_new failed");
125 if (BN_bin2bn(kbuf, kout, shared_secret) == NULL)
126 fatal("kexdh_client: BN_bin2bn failed");
127 explicit_bzero(kbuf, klen);
128 free(kbuf);
129 163
130 /* calc and verify H */ 164 /* calc and verify H */
131 kex_dh_hash( 165 hashlen = sizeof(hash);
166 if ((r = kex_dh_hash(
132 kex->client_version_string, 167 kex->client_version_string,
133 kex->server_version_string, 168 kex->server_version_string,
134 buffer_ptr(&kex->my), buffer_len(&kex->my), 169 sshbuf_ptr(kex->my), sshbuf_len(kex->my),
135 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 170 sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
136 server_host_key_blob, sbloblen, 171 server_host_key_blob, sbloblen,
137 dh->pub_key, 172 kex->dh->pub_key,
138 dh_server_pub, 173 dh_server_pub,
139 shared_secret, 174 shared_secret,
140 &hash, &hashlen 175 hash, &hashlen)) != 0)
141 ); 176 goto out;
142 free(server_host_key_blob);
143 BN_clear_free(dh_server_pub);
144 DH_free(dh);
145 177
146 if (key_verify(server_host_key, signature, slen, hash, hashlen) != 1) 178 if ((r = sshkey_verify(server_host_key, signature, slen, hash, hashlen,
147 fatal("key_verify failed for server_host_key"); 179 ssh->compat)) != 0)
148 key_free(server_host_key); 180 goto out;
149 free(signature);
150 181
151 /* save session id */ 182 /* save session id */
152 if (kex->session_id == NULL) { 183 if (kex->session_id == NULL) {
153 kex->session_id_len = hashlen; 184 kex->session_id_len = hashlen;
154 kex->session_id = xmalloc(kex->session_id_len); 185 kex->session_id = malloc(kex->session_id_len);
186 if (kex->session_id == NULL) {
187 r = SSH_ERR_ALLOC_FAIL;
188 goto out;
189 }
155 memcpy(kex->session_id, hash, kex->session_id_len); 190 memcpy(kex->session_id, hash, kex->session_id_len);
156 } 191 }
157 192
158 kex_derive_keys_bn(kex, hash, hashlen, shared_secret); 193 if ((r = kex_derive_keys_bn(ssh, hash, hashlen, shared_secret)) == 0)
159 BN_clear_free(shared_secret); 194 r = kex_send_newkeys(ssh);
160 kex_finish(kex); 195 out:
196 explicit_bzero(hash, sizeof(hash));
197 DH_free(kex->dh);
198 kex->dh = NULL;
199 if (dh_server_pub)
200 BN_clear_free(dh_server_pub);
201 if (kbuf) {
202 explicit_bzero(kbuf, klen);
203 free(kbuf);
204 }
205 if (shared_secret)
206 BN_clear_free(shared_secret);
207 sshkey_free(server_host_key);
208 free(server_host_key_blob);
209 free(signature);
210 return r;
161} 211}
212#endif /* WITH_OPENSSL */
diff --git a/kexdhs.c b/kexdhs.c
index c3011f741..de7c05b17 100644
--- a/kexdhs.c
+++ b/kexdhs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexdhs.c,v 1.18 2014/02/02 03:44:31 djm Exp $ */ 1/* $OpenBSD: kexdhs.c,v 1.22 2015/01/26 06:10:03 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * 4 *
@@ -25,6 +25,8 @@
25 25
26#include "includes.h" 26#include "includes.h"
27 27
28#ifdef WITH_OPENSSL
29
28#include <sys/types.h> 30#include <sys/types.h>
29 31
30#include <stdarg.h> 32#include <stdarg.h>
@@ -33,55 +35,89 @@
33 35
34#include <openssl/dh.h> 36#include <openssl/dh.h>
35 37
36#include "xmalloc.h" 38#include "sshkey.h"
37#include "buffer.h"
38#include "key.h"
39#include "cipher.h" 39#include "cipher.h"
40#include "digest.h"
40#include "kex.h" 41#include "kex.h"
41#include "log.h" 42#include "log.h"
42#include "packet.h" 43#include "packet.h"
43#include "dh.h" 44#include "dh.h"
44#include "ssh2.h" 45#include "ssh2.h"
45 46
46void 47#include "dispatch.h"
47kexdh_server(Kex *kex) 48#include "compat.h"
49#include "ssherr.h"
50#include "sshbuf.h"
51
52static int input_kex_dh_init(int, u_int32_t, void *);
53
54int
55kexdh_server(struct ssh *ssh)
48{ 56{
49 BIGNUM *shared_secret = NULL, *dh_client_pub = NULL; 57 struct kex *kex = ssh->kex;
50 DH *dh; 58 int r;
51 Key *server_host_public, *server_host_private;
52 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
53 u_int sbloblen, klen, hashlen, slen;
54 int kout;
55 59
56 /* generate server DH public key */ 60 /* generate server DH public key */
57 switch (kex->kex_type) { 61 switch (kex->kex_type) {
58 case KEX_DH_GRP1_SHA1: 62 case KEX_DH_GRP1_SHA1:
59 dh = dh_new_group1(); 63 kex->dh = dh_new_group1();
60 break; 64 break;
61 case KEX_DH_GRP14_SHA1: 65 case KEX_DH_GRP14_SHA1:
62 dh = dh_new_group14(); 66 kex->dh = dh_new_group14();
63 break; 67 break;
64 default: 68 default:
65 fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); 69 r = SSH_ERR_INVALID_ARGUMENT;
70 goto out;
71 }
72 if (kex->dh == NULL) {
73 r = SSH_ERR_ALLOC_FAIL;
74 goto out;
66 } 75 }
67 dh_gen_key(dh, kex->we_need * 8); 76 if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0)
77 goto out;
68 78
69 debug("expecting SSH2_MSG_KEXDH_INIT"); 79 debug("expecting SSH2_MSG_KEXDH_INIT");
70 packet_read_expect(SSH2_MSG_KEXDH_INIT); 80 ssh_dispatch_set(ssh, SSH2_MSG_KEXDH_INIT, &input_kex_dh_init);
81 r = 0;
82 out:
83 return r;
84}
85
86int
87input_kex_dh_init(int type, u_int32_t seq, void *ctxt)
88{
89 struct ssh *ssh = ctxt;
90 struct kex *kex = ssh->kex;
91 BIGNUM *shared_secret = NULL, *dh_client_pub = NULL;
92 struct sshkey *server_host_public, *server_host_private;
93 u_char *kbuf = NULL, *signature = NULL, *server_host_key_blob = NULL;
94 u_char hash[SSH_DIGEST_MAX_LENGTH];
95 size_t sbloblen, slen;
96 size_t klen = 0, hashlen;
97 int kout, r;
71 98
72 if (kex->load_host_public_key == NULL || 99 if (kex->load_host_public_key == NULL ||
73 kex->load_host_private_key == NULL) 100 kex->load_host_private_key == NULL) {
74 fatal("Cannot load hostkey"); 101 r = SSH_ERR_INVALID_ARGUMENT;
75 server_host_public = kex->load_host_public_key(kex->hostkey_type); 102 goto out;
76 if (server_host_public == NULL) 103 }
77 fatal("Unsupported hostkey type %d", kex->hostkey_type); 104 server_host_public = kex->load_host_public_key(kex->hostkey_type,
78 server_host_private = kex->load_host_private_key(kex->hostkey_type); 105 kex->hostkey_nid, ssh);
106 server_host_private = kex->load_host_private_key(kex->hostkey_type,
107 kex->hostkey_nid, ssh);
108 if (server_host_public == NULL) {
109 r = SSH_ERR_NO_HOSTKEY_LOADED;
110 goto out;
111 }
79 112
80 /* key, cert */ 113 /* key, cert */
81 if ((dh_client_pub = BN_new()) == NULL) 114 if ((dh_client_pub = BN_new()) == NULL) {
82 fatal("dh_client_pub == NULL"); 115 r = SSH_ERR_ALLOC_FAIL;
83 packet_get_bignum2(dh_client_pub); 116 goto out;
84 packet_check_eom(); 117 }
118 if ((r = sshpkt_get_bignum2(ssh, dh_client_pub)) != 0 ||
119 (r = sshpkt_get_end(ssh)) != 0)
120 goto out;
85 121
86#ifdef DEBUG_KEXDH 122#ifdef DEBUG_KEXDH
87 fprintf(stderr, "dh_client_pub= "); 123 fprintf(stderr, "dh_client_pub= ");
@@ -91,70 +127,90 @@ kexdh_server(Kex *kex)
91#endif 127#endif
92 128
93#ifdef DEBUG_KEXDH 129#ifdef DEBUG_KEXDH
94 DHparams_print_fp(stderr, dh); 130 DHparams_print_fp(stderr, kex->dh);
95 fprintf(stderr, "pub= "); 131 fprintf(stderr, "pub= ");
96 BN_print_fp(stderr, dh->pub_key); 132 BN_print_fp(stderr, kex->dh->pub_key);
97 fprintf(stderr, "\n"); 133 fprintf(stderr, "\n");
98#endif 134#endif
99 if (!dh_pub_is_valid(dh, dh_client_pub)) 135 if (!dh_pub_is_valid(kex->dh, dh_client_pub)) {
100 packet_disconnect("bad client public DH value"); 136 sshpkt_disconnect(ssh, "bad client public DH value");
137 r = SSH_ERR_MESSAGE_INCOMPLETE;
138 goto out;
139 }
101 140
102 klen = DH_size(dh); 141 klen = DH_size(kex->dh);
103 kbuf = xmalloc(klen); 142 if ((kbuf = malloc(klen)) == NULL ||
104 if ((kout = DH_compute_key(kbuf, dh_client_pub, dh)) < 0) 143 (shared_secret = BN_new()) == NULL) {
105 fatal("DH_compute_key: failed"); 144 r = SSH_ERR_ALLOC_FAIL;
145 goto out;
146 }
147 if ((kout = DH_compute_key(kbuf, dh_client_pub, kex->dh)) < 0 ||
148 BN_bin2bn(kbuf, kout, shared_secret) == NULL) {
149 r = SSH_ERR_LIBCRYPTO_ERROR;
150 goto out;
151 }
106#ifdef DEBUG_KEXDH 152#ifdef DEBUG_KEXDH
107 dump_digest("shared secret", kbuf, kout); 153 dump_digest("shared secret", kbuf, kout);
108#endif 154#endif
109 if ((shared_secret = BN_new()) == NULL) 155 if ((r = sshkey_to_blob(server_host_public, &server_host_key_blob,
110 fatal("kexdh_server: BN_new failed"); 156 &sbloblen)) != 0)
111 if (BN_bin2bn(kbuf, kout, shared_secret) == NULL) 157 goto out;
112 fatal("kexdh_server: BN_bin2bn failed");
113 explicit_bzero(kbuf, klen);
114 free(kbuf);
115
116 key_to_blob(server_host_public, &server_host_key_blob, &sbloblen);
117
118 /* calc H */ 158 /* calc H */
119 kex_dh_hash( 159 hashlen = sizeof(hash);
160 if ((r = kex_dh_hash(
120 kex->client_version_string, 161 kex->client_version_string,
121 kex->server_version_string, 162 kex->server_version_string,
122 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 163 sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
123 buffer_ptr(&kex->my), buffer_len(&kex->my), 164 sshbuf_ptr(kex->my), sshbuf_len(kex->my),
124 server_host_key_blob, sbloblen, 165 server_host_key_blob, sbloblen,
125 dh_client_pub, 166 dh_client_pub,
126 dh->pub_key, 167 kex->dh->pub_key,
127 shared_secret, 168 shared_secret,
128 &hash, &hashlen 169 hash, &hashlen)) != 0)
129 ); 170 goto out;
130 BN_clear_free(dh_client_pub);
131 171
132 /* save session id := H */ 172 /* save session id := H */
133 if (kex->session_id == NULL) { 173 if (kex->session_id == NULL) {
134 kex->session_id_len = hashlen; 174 kex->session_id_len = hashlen;
135 kex->session_id = xmalloc(kex->session_id_len); 175 kex->session_id = malloc(kex->session_id_len);
176 if (kex->session_id == NULL) {
177 r = SSH_ERR_ALLOC_FAIL;
178 goto out;
179 }
136 memcpy(kex->session_id, hash, kex->session_id_len); 180 memcpy(kex->session_id, hash, kex->session_id_len);
137 } 181 }
138 182
139 /* sign H */ 183 /* sign H */
140 kex->sign(server_host_private, server_host_public, &signature, &slen, 184 if ((r = kex->sign(server_host_private, server_host_public,
141 hash, hashlen); 185 &signature, &slen, hash, hashlen, ssh->compat)) < 0)
186 goto out;
142 187
143 /* destroy_sensitive_data(); */ 188 /* destroy_sensitive_data(); */
144 189
145 /* send server hostkey, DH pubkey 'f' and singed H */ 190 /* send server hostkey, DH pubkey 'f' and singed H */
146 packet_start(SSH2_MSG_KEXDH_REPLY); 191 if ((r = sshpkt_start(ssh, SSH2_MSG_KEXDH_REPLY)) != 0 ||
147 packet_put_string(server_host_key_blob, sbloblen); 192 (r = sshpkt_put_string(ssh, server_host_key_blob, sbloblen)) != 0 ||
148 packet_put_bignum2(dh->pub_key); /* f */ 193 (r = sshpkt_put_bignum2(ssh, kex->dh->pub_key)) != 0 || /* f */
149 packet_put_string(signature, slen); 194 (r = sshpkt_put_string(ssh, signature, slen)) != 0 ||
150 packet_send(); 195 (r = sshpkt_send(ssh)) != 0)
151 196 goto out;
152 free(signature); 197
198 if ((r = kex_derive_keys_bn(ssh, hash, hashlen, shared_secret)) == 0)
199 r = kex_send_newkeys(ssh);
200 out:
201 explicit_bzero(hash, sizeof(hash));
202 DH_free(kex->dh);
203 kex->dh = NULL;
204 if (dh_client_pub)
205 BN_clear_free(dh_client_pub);
206 if (kbuf) {
207 explicit_bzero(kbuf, klen);
208 free(kbuf);
209 }
210 if (shared_secret)
211 BN_clear_free(shared_secret);
153 free(server_host_key_blob); 212 free(server_host_key_blob);
154 /* have keys, free DH */ 213 free(signature);
155 DH_free(dh); 214 return r;
156
157 kex_derive_keys_bn(kex, hash, hashlen, shared_secret);
158 BN_clear_free(shared_secret);
159 kex_finish(kex);
160} 215}
216#endif /* WITH_OPENSSL */
diff --git a/kexecdh.c b/kexecdh.c
index c52c5e234..2a4fec6b1 100644
--- a/kexecdh.c
+++ b/kexecdh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexecdh.c,v 1.5 2014/01/09 23:20:00 djm Exp $ */ 1/* $OpenBSD: kexecdh.c,v 1.6 2015/01/19 20:16:15 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2010 Damien Miller. All rights reserved. 4 * Copyright (c) 2010 Damien Miller. All rights reserved.
@@ -26,7 +26,7 @@
26 26
27#include "includes.h" 27#include "includes.h"
28 28
29#ifdef OPENSSL_HAS_ECC 29#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC)
30 30
31#include <sys/types.h> 31#include <sys/types.h>
32 32
@@ -38,60 +38,63 @@
38#include <openssl/ec.h> 38#include <openssl/ec.h>
39#include <openssl/ecdh.h> 39#include <openssl/ecdh.h>
40 40
41#include "buffer.h"
42#include "ssh2.h" 41#include "ssh2.h"
43#include "key.h" 42#include "sshkey.h"
44#include "cipher.h" 43#include "cipher.h"
45#include "kex.h" 44#include "kex.h"
46#include "log.h" 45#include "sshbuf.h"
47#include "digest.h" 46#include "digest.h"
47#include "ssherr.h"
48 48
49void 49int
50kex_ecdh_hash( 50kex_ecdh_hash(
51 int hash_alg, 51 int hash_alg,
52 const EC_GROUP *ec_group, 52 const EC_GROUP *ec_group,
53 char *client_version_string, 53 const char *client_version_string,
54 char *server_version_string, 54 const char *server_version_string,
55 char *ckexinit, int ckexinitlen, 55 const u_char *ckexinit, size_t ckexinitlen,
56 char *skexinit, int skexinitlen, 56 const u_char *skexinit, size_t skexinitlen,
57 u_char *serverhostkeyblob, int sbloblen, 57 const u_char *serverhostkeyblob, size_t sbloblen,
58 const EC_POINT *client_dh_pub, 58 const EC_POINT *client_dh_pub,
59 const EC_POINT *server_dh_pub, 59 const EC_POINT *server_dh_pub,
60 const BIGNUM *shared_secret, 60 const BIGNUM *shared_secret,
61 u_char **hash, u_int *hashlen) 61 u_char *hash, size_t *hashlen)
62{ 62{
63 Buffer b; 63 struct sshbuf *b;
64 static u_char digest[SSH_DIGEST_MAX_LENGTH]; 64 int r;
65
66 buffer_init(&b);
67 buffer_put_cstring(&b, client_version_string);
68 buffer_put_cstring(&b, server_version_string);
69
70 /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */
71 buffer_put_int(&b, ckexinitlen+1);
72 buffer_put_char(&b, SSH2_MSG_KEXINIT);
73 buffer_append(&b, ckexinit, ckexinitlen);
74 buffer_put_int(&b, skexinitlen+1);
75 buffer_put_char(&b, SSH2_MSG_KEXINIT);
76 buffer_append(&b, skexinit, skexinitlen);
77
78 buffer_put_string(&b, serverhostkeyblob, sbloblen);
79 buffer_put_ecpoint(&b, ec_group, client_dh_pub);
80 buffer_put_ecpoint(&b, ec_group, server_dh_pub);
81 buffer_put_bignum2(&b, shared_secret);
82 65
66 if (*hashlen < ssh_digest_bytes(hash_alg))
67 return SSH_ERR_INVALID_ARGUMENT;
68 if ((b = sshbuf_new()) == NULL)
69 return SSH_ERR_ALLOC_FAIL;
70 if ((r = sshbuf_put_cstring(b, client_version_string)) != 0 ||
71 (r = sshbuf_put_cstring(b, server_version_string)) != 0 ||
72 /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */
73 (r = sshbuf_put_u32(b, ckexinitlen+1)) != 0 ||
74 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 ||
75 (r = sshbuf_put(b, ckexinit, ckexinitlen)) != 0 ||
76 (r = sshbuf_put_u32(b, skexinitlen+1)) != 0 ||
77 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 ||
78 (r = sshbuf_put(b, skexinit, skexinitlen)) != 0 ||
79 (r = sshbuf_put_string(b, serverhostkeyblob, sbloblen)) != 0 ||
80 (r = sshbuf_put_ec(b, client_dh_pub, ec_group)) != 0 ||
81 (r = sshbuf_put_ec(b, server_dh_pub, ec_group)) != 0 ||
82 (r = sshbuf_put_bignum2(b, shared_secret)) != 0) {
83 sshbuf_free(b);
84 return r;
85 }
83#ifdef DEBUG_KEX 86#ifdef DEBUG_KEX
84 buffer_dump(&b); 87 sshbuf_dump(b, stderr);
85#endif 88#endif
86 if (ssh_digest_buffer(hash_alg, &b, digest, sizeof(digest)) != 0) 89 if (ssh_digest_buffer(hash_alg, b, hash, *hashlen) != 0) {
87 fatal("%s: ssh_digest_buffer failed", __func__); 90 sshbuf_free(b);
88 91 return SSH_ERR_LIBCRYPTO_ERROR;
89 buffer_free(&b); 92 }
90 93 sshbuf_free(b);
94 *hashlen = ssh_digest_bytes(hash_alg);
91#ifdef DEBUG_KEX 95#ifdef DEBUG_KEX
92 dump_digest("hash", digest, ssh_digest_bytes(hash_alg)); 96 dump_digest("hash", hash, *hashlen);
93#endif 97#endif
94 *hash = digest; 98 return 0;
95 *hashlen = ssh_digest_bytes(hash_alg);
96} 99}
97#endif /* OPENSSL_HAS_ECC */ 100#endif /* defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC) */
diff --git a/kexecdhc.c b/kexecdhc.c
index 2f7629cca..90220ce82 100644
--- a/kexecdhc.c
+++ b/kexecdhc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexecdhc.c,v 1.7 2014/02/02 03:44:31 djm Exp $ */ 1/* $OpenBSD: kexecdhc.c,v 1.10 2015/01/26 06:10:03 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2010 Damien Miller. All rights reserved. 4 * Copyright (c) 2010 Damien Miller. All rights reserved.
@@ -26,140 +26,203 @@
26 26
27#include "includes.h" 27#include "includes.h"
28 28
29#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC)
30
29#include <sys/types.h> 31#include <sys/types.h>
30 32
31#include <stdio.h> 33#include <stdio.h>
32#include <string.h> 34#include <string.h>
33#include <signal.h> 35#include <signal.h>
34 36
35#include "xmalloc.h" 37#include <openssl/ecdh.h>
36#include "buffer.h" 38
37#include "key.h" 39#include "sshkey.h"
38#include "cipher.h" 40#include "cipher.h"
41#include "digest.h"
39#include "kex.h" 42#include "kex.h"
40#include "log.h" 43#include "log.h"
41#include "packet.h" 44#include "packet.h"
42#include "dh.h" 45#include "dh.h"
43#include "ssh2.h" 46#include "ssh2.h"
47#include "dispatch.h"
48#include "compat.h"
49#include "ssherr.h"
50#include "sshbuf.h"
44 51
45#ifdef OPENSSL_HAS_ECC 52static int input_kex_ecdh_reply(int, u_int32_t, void *);
46
47#include <openssl/ecdh.h>
48 53
49void 54int
50kexecdh_client(Kex *kex) 55kexecdh_client(struct ssh *ssh)
51{ 56{
52 EC_KEY *client_key; 57 struct kex *kex = ssh->kex;
53 EC_POINT *server_public; 58 EC_KEY *client_key = NULL;
54 const EC_GROUP *group; 59 const EC_GROUP *group;
55 BIGNUM *shared_secret; 60 const EC_POINT *public_key;
56 Key *server_host_key; 61 int r;
57 u_char *server_host_key_blob = NULL, *signature = NULL;
58 u_char *kbuf, *hash;
59 u_int klen, slen, sbloblen, hashlen;
60 62
61 if ((client_key = EC_KEY_new_by_curve_name(kex->ec_nid)) == NULL) 63 if ((client_key = EC_KEY_new_by_curve_name(kex->ec_nid)) == NULL) {
62 fatal("%s: EC_KEY_new_by_curve_name failed", __func__); 64 r = SSH_ERR_ALLOC_FAIL;
63 if (EC_KEY_generate_key(client_key) != 1) 65 goto out;
64 fatal("%s: EC_KEY_generate_key failed", __func__); 66 }
67 if (EC_KEY_generate_key(client_key) != 1) {
68 r = SSH_ERR_LIBCRYPTO_ERROR;
69 goto out;
70 }
65 group = EC_KEY_get0_group(client_key); 71 group = EC_KEY_get0_group(client_key);
72 public_key = EC_KEY_get0_public_key(client_key);
66 73
67 packet_start(SSH2_MSG_KEX_ECDH_INIT); 74 if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_ECDH_INIT)) != 0 ||
68 packet_put_ecpoint(group, EC_KEY_get0_public_key(client_key)); 75 (r = sshpkt_put_ec(ssh, public_key, group)) != 0 ||
69 packet_send(); 76 (r = sshpkt_send(ssh)) != 0)
77 goto out;
70 debug("sending SSH2_MSG_KEX_ECDH_INIT"); 78 debug("sending SSH2_MSG_KEX_ECDH_INIT");
71 79
72#ifdef DEBUG_KEXECDH 80#ifdef DEBUG_KEXECDH
73 fputs("client private key:\n", stderr); 81 fputs("client private key:\n", stderr);
74 key_dump_ec_key(client_key); 82 sshkey_dump_ec_key(client_key);
75#endif 83#endif
84 kex->ec_client_key = client_key;
85 kex->ec_group = group;
86 client_key = NULL; /* owned by the kex */
76 87
77 debug("expecting SSH2_MSG_KEX_ECDH_REPLY"); 88 debug("expecting SSH2_MSG_KEX_ECDH_REPLY");
78 packet_read_expect(SSH2_MSG_KEX_ECDH_REPLY); 89 ssh_dispatch_set(ssh, SSH2_MSG_KEX_ECDH_REPLY, &input_kex_ecdh_reply);
90 r = 0;
91 out:
92 if (client_key)
93 EC_KEY_free(client_key);
94 return r;
95}
96
97static int
98input_kex_ecdh_reply(int type, u_int32_t seq, void *ctxt)
99{
100 struct ssh *ssh = ctxt;
101 struct kex *kex = ssh->kex;
102 const EC_GROUP *group;
103 EC_POINT *server_public = NULL;
104 EC_KEY *client_key;
105 BIGNUM *shared_secret = NULL;
106 struct sshkey *server_host_key = NULL;
107 u_char *server_host_key_blob = NULL, *signature = NULL;
108 u_char *kbuf = NULL;
109 u_char hash[SSH_DIGEST_MAX_LENGTH];
110 size_t slen, sbloblen;
111 size_t klen = 0, hashlen;
112 int r;
113
114 if (kex->verify_host_key == NULL) {
115 r = SSH_ERR_INVALID_ARGUMENT;
116 goto out;
117 }
118 group = kex->ec_group;
119 client_key = kex->ec_client_key;
79 120
80 /* hostkey */ 121 /* hostkey */
81 server_host_key_blob = packet_get_string(&sbloblen); 122 if ((r = sshpkt_get_string(ssh, &server_host_key_blob,
82 server_host_key = key_from_blob(server_host_key_blob, sbloblen); 123 &sbloblen)) != 0 ||
83 if (server_host_key == NULL) 124 (r = sshkey_from_blob(server_host_key_blob, sbloblen,
84 fatal("cannot decode server_host_key_blob"); 125 &server_host_key)) != 0)
85 if (server_host_key->type != kex->hostkey_type) 126 goto out;
86 fatal("type mismatch for decoded server_host_key_blob"); 127 if (server_host_key->type != kex->hostkey_type ||
87 if (kex->verify_host_key == NULL) 128 (kex->hostkey_type == KEY_ECDSA &&
88 fatal("cannot verify server_host_key"); 129 server_host_key->ecdsa_nid != kex->hostkey_nid)) {
89 if (kex->verify_host_key(server_host_key) == -1) 130 r = SSH_ERR_KEY_TYPE_MISMATCH;
90 fatal("server_host_key verification failed"); 131 goto out;
132 }
133 if (kex->verify_host_key(server_host_key, ssh) == -1) {
134 r = SSH_ERR_SIGNATURE_INVALID;
135 goto out;
136 }
91 137
92 /* Q_S, server public key */ 138 /* Q_S, server public key */
93 if ((server_public = EC_POINT_new(group)) == NULL) 139 /* signed H */
94 fatal("%s: EC_POINT_new failed", __func__); 140 if ((server_public = EC_POINT_new(group)) == NULL) {
95 packet_get_ecpoint(group, server_public); 141 r = SSH_ERR_ALLOC_FAIL;
96 142 goto out;
97 if (key_ec_validate_public(group, server_public) != 0) 143 }
98 fatal("%s: invalid server public key", __func__); 144 if ((r = sshpkt_get_ec(ssh, server_public, group)) != 0 ||
145 (r = sshpkt_get_string(ssh, &signature, &slen)) != 0 ||
146 (r = sshpkt_get_end(ssh)) != 0)
147 goto out;
99 148
100#ifdef DEBUG_KEXECDH 149#ifdef DEBUG_KEXECDH
101 fputs("server public key:\n", stderr); 150 fputs("server public key:\n", stderr);
102 key_dump_ec_point(group, server_public); 151 sshkey_dump_ec_point(group, server_public);
103#endif 152#endif
104 153 if (sshkey_ec_validate_public(group, server_public) != 0) {
105 /* signed H */ 154 sshpkt_disconnect(ssh, "invalid server public key");
106 signature = packet_get_string(&slen); 155 r = SSH_ERR_MESSAGE_INCOMPLETE;
107 packet_check_eom(); 156 goto out;
157 }
108 158
109 klen = (EC_GROUP_get_degree(group) + 7) / 8; 159 klen = (EC_GROUP_get_degree(group) + 7) / 8;
110 kbuf = xmalloc(klen); 160 if ((kbuf = malloc(klen)) == NULL ||
161 (shared_secret = BN_new()) == NULL) {
162 r = SSH_ERR_ALLOC_FAIL;
163 goto out;
164 }
111 if (ECDH_compute_key(kbuf, klen, server_public, 165 if (ECDH_compute_key(kbuf, klen, server_public,
112 client_key, NULL) != (int)klen) 166 client_key, NULL) != (int)klen ||
113 fatal("%s: ECDH_compute_key failed", __func__); 167 BN_bin2bn(kbuf, klen, shared_secret) == NULL) {
168 r = SSH_ERR_LIBCRYPTO_ERROR;
169 goto out;
170 }
114 171
115#ifdef DEBUG_KEXECDH 172#ifdef DEBUG_KEXECDH
116 dump_digest("shared secret", kbuf, klen); 173 dump_digest("shared secret", kbuf, klen);
117#endif 174#endif
118 if ((shared_secret = BN_new()) == NULL)
119 fatal("%s: BN_new failed", __func__);
120 if (BN_bin2bn(kbuf, klen, shared_secret) == NULL)
121 fatal("%s: BN_bin2bn failed", __func__);
122 explicit_bzero(kbuf, klen);
123 free(kbuf);
124
125 /* calc and verify H */ 175 /* calc and verify H */
126 kex_ecdh_hash( 176 hashlen = sizeof(hash);
177 if ((r = kex_ecdh_hash(
127 kex->hash_alg, 178 kex->hash_alg,
128 group, 179 group,
129 kex->client_version_string, 180 kex->client_version_string,
130 kex->server_version_string, 181 kex->server_version_string,
131 buffer_ptr(&kex->my), buffer_len(&kex->my), 182 sshbuf_ptr(kex->my), sshbuf_len(kex->my),
132 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 183 sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
133 server_host_key_blob, sbloblen, 184 server_host_key_blob, sbloblen,
134 EC_KEY_get0_public_key(client_key), 185 EC_KEY_get0_public_key(client_key),
135 server_public, 186 server_public,
136 shared_secret, 187 shared_secret,
137 &hash, &hashlen 188 hash, &hashlen)) != 0)
138 ); 189 goto out;
139 free(server_host_key_blob);
140 EC_POINT_clear_free(server_public);
141 EC_KEY_free(client_key);
142 190
143 if (key_verify(server_host_key, signature, slen, hash, hashlen) != 1) 191 if ((r = sshkey_verify(server_host_key, signature, slen, hash,
144 fatal("key_verify failed for server_host_key"); 192 hashlen, ssh->compat)) != 0)
145 key_free(server_host_key); 193 goto out;
146 free(signature);
147 194
148 /* save session id */ 195 /* save session id */
149 if (kex->session_id == NULL) { 196 if (kex->session_id == NULL) {
150 kex->session_id_len = hashlen; 197 kex->session_id_len = hashlen;
151 kex->session_id = xmalloc(kex->session_id_len); 198 kex->session_id = malloc(kex->session_id_len);
199 if (kex->session_id == NULL) {
200 r = SSH_ERR_ALLOC_FAIL;
201 goto out;
202 }
152 memcpy(kex->session_id, hash, kex->session_id_len); 203 memcpy(kex->session_id, hash, kex->session_id_len);
153 } 204 }
154 205
155 kex_derive_keys_bn(kex, hash, hashlen, shared_secret); 206 if ((r = kex_derive_keys_bn(ssh, hash, hashlen, shared_secret)) == 0)
156 BN_clear_free(shared_secret); 207 r = kex_send_newkeys(ssh);
157 kex_finish(kex); 208 out:
158} 209 explicit_bzero(hash, sizeof(hash));
159#else /* OPENSSL_HAS_ECC */ 210 if (kex->ec_client_key) {
160void 211 EC_KEY_free(kex->ec_client_key);
161kexecdh_client(Kex *kex) 212 kex->ec_client_key = NULL;
162{ 213 }
163 fatal("ECC support is not enabled"); 214 if (server_public)
215 EC_POINT_clear_free(server_public);
216 if (kbuf) {
217 explicit_bzero(kbuf, klen);
218 free(kbuf);
219 }
220 if (shared_secret)
221 BN_clear_free(shared_secret);
222 sshkey_free(server_host_key);
223 free(server_host_key_blob);
224 free(signature);
225 return r;
164} 226}
165#endif /* OPENSSL_HAS_ECC */ 227#endif /* defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC) */
228
diff --git a/kexecdhs.c b/kexecdhs.c
index 2700b7219..0adb80e6a 100644
--- a/kexecdhs.c
+++ b/kexecdhs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexecdhs.c,v 1.10 2014/02/02 03:44:31 djm Exp $ */ 1/* $OpenBSD: kexecdhs.c,v 1.14 2015/01/26 06:10:03 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2010 Damien Miller. All rights reserved. 4 * Copyright (c) 2010 Damien Miller. All rights reserved.
@@ -26,136 +26,183 @@
26 26
27#include "includes.h" 27#include "includes.h"
28 28
29#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC)
30
29#include <sys/types.h> 31#include <sys/types.h>
30#include <string.h> 32#include <string.h>
31#include <signal.h> 33#include <signal.h>
32 34
33#include "xmalloc.h" 35#include <openssl/ecdh.h>
34#include "buffer.h" 36
35#include "key.h" 37#include "sshkey.h"
36#include "cipher.h" 38#include "cipher.h"
39#include "digest.h"
37#include "kex.h" 40#include "kex.h"
38#include "log.h" 41#include "log.h"
39#include "packet.h" 42#include "packet.h"
40#include "ssh2.h" 43#include "ssh2.h"
41 44
42#ifdef OPENSSL_HAS_ECC 45#include "dispatch.h"
46#include "compat.h"
47#include "ssherr.h"
48#include "sshbuf.h"
43 49
44#include <openssl/ecdh.h> 50static int input_kex_ecdh_init(int, u_int32_t, void *);
51
52int
53kexecdh_server(struct ssh *ssh)
54{
55 debug("expecting SSH2_MSG_KEX_ECDH_INIT");
56 ssh_dispatch_set(ssh, SSH2_MSG_KEX_ECDH_INIT, &input_kex_ecdh_init);
57 return 0;
58}
45 59
46void 60static int
47kexecdh_server(Kex *kex) 61input_kex_ecdh_init(int type, u_int32_t seq, void *ctxt)
48{ 62{
63 struct ssh *ssh = ctxt;
64 struct kex *kex = ssh->kex;
49 EC_POINT *client_public; 65 EC_POINT *client_public;
50 EC_KEY *server_key; 66 EC_KEY *server_key = NULL;
51 const EC_GROUP *group; 67 const EC_GROUP *group;
52 BIGNUM *shared_secret; 68 const EC_POINT *public_key;
53 Key *server_host_private, *server_host_public; 69 BIGNUM *shared_secret = NULL;
70 struct sshkey *server_host_private, *server_host_public;
54 u_char *server_host_key_blob = NULL, *signature = NULL; 71 u_char *server_host_key_blob = NULL, *signature = NULL;
55 u_char *kbuf, *hash; 72 u_char *kbuf = NULL;
56 u_int klen, slen, sbloblen, hashlen; 73 u_char hash[SSH_DIGEST_MAX_LENGTH];
57 74 size_t slen, sbloblen;
58 if ((server_key = EC_KEY_new_by_curve_name(kex->ec_nid)) == NULL) 75 size_t klen = 0, hashlen;
59 fatal("%s: EC_KEY_new_by_curve_name failed", __func__); 76 int r;
60 if (EC_KEY_generate_key(server_key) != 1) 77
61 fatal("%s: EC_KEY_generate_key failed", __func__); 78 if ((server_key = EC_KEY_new_by_curve_name(kex->ec_nid)) == NULL) {
79 r = SSH_ERR_ALLOC_FAIL;
80 goto out;
81 }
82 if (EC_KEY_generate_key(server_key) != 1) {
83 r = SSH_ERR_LIBCRYPTO_ERROR;
84 goto out;
85 }
62 group = EC_KEY_get0_group(server_key); 86 group = EC_KEY_get0_group(server_key);
63 87
64#ifdef DEBUG_KEXECDH 88#ifdef DEBUG_KEXECDH
65 fputs("server private key:\n", stderr); 89 fputs("server private key:\n", stderr);
66 key_dump_ec_key(server_key); 90 sshkey_dump_ec_key(server_key);
67#endif 91#endif
68 92
69 if (kex->load_host_public_key == NULL || 93 if (kex->load_host_public_key == NULL ||
70 kex->load_host_private_key == NULL) 94 kex->load_host_private_key == NULL) {
71 fatal("Cannot load hostkey"); 95 r = SSH_ERR_INVALID_ARGUMENT;
72 server_host_public = kex->load_host_public_key(kex->hostkey_type); 96 goto out;
73 if (server_host_public == NULL) 97 }
74 fatal("Unsupported hostkey type %d", kex->hostkey_type); 98 server_host_public = kex->load_host_public_key(kex->hostkey_type,
75 server_host_private = kex->load_host_private_key(kex->hostkey_type); 99 kex->hostkey_nid, ssh);
76 100 server_host_private = kex->load_host_private_key(kex->hostkey_type,
77 debug("expecting SSH2_MSG_KEX_ECDH_INIT"); 101 kex->hostkey_nid, ssh);
78 packet_read_expect(SSH2_MSG_KEX_ECDH_INIT); 102 if (server_host_public == NULL) {
79 if ((client_public = EC_POINT_new(group)) == NULL) 103 r = SSH_ERR_NO_HOSTKEY_LOADED;
80 fatal("%s: EC_POINT_new failed", __func__); 104 goto out;
81 packet_get_ecpoint(group, client_public); 105 }
82 packet_check_eom(); 106 if ((client_public = EC_POINT_new(group)) == NULL) {
83 107 r = SSH_ERR_ALLOC_FAIL;
84 if (key_ec_validate_public(group, client_public) != 0) 108 goto out;
85 fatal("%s: invalid client public key", __func__); 109 }
110 if ((r = sshpkt_get_ec(ssh, client_public, group)) != 0 ||
111 (r = sshpkt_get_end(ssh)) != 0)
112 goto out;
86 113
87#ifdef DEBUG_KEXECDH 114#ifdef DEBUG_KEXECDH
88 fputs("client public key:\n", stderr); 115 fputs("client public key:\n", stderr);
89 key_dump_ec_point(group, client_public); 116 sshkey_dump_ec_point(group, client_public);
90#endif 117#endif
118 if (sshkey_ec_validate_public(group, client_public) != 0) {
119 sshpkt_disconnect(ssh, "invalid client public key");
120 r = SSH_ERR_MESSAGE_INCOMPLETE;
121 goto out;
122 }
91 123
92 /* Calculate shared_secret */ 124 /* Calculate shared_secret */
93 klen = (EC_GROUP_get_degree(group) + 7) / 8; 125 klen = (EC_GROUP_get_degree(group) + 7) / 8;
94 kbuf = xmalloc(klen); 126 if ((kbuf = malloc(klen)) == NULL ||
127 (shared_secret = BN_new()) == NULL) {
128 r = SSH_ERR_ALLOC_FAIL;
129 goto out;
130 }
95 if (ECDH_compute_key(kbuf, klen, client_public, 131 if (ECDH_compute_key(kbuf, klen, client_public,
96 server_key, NULL) != (int)klen) 132 server_key, NULL) != (int)klen ||
97 fatal("%s: ECDH_compute_key failed", __func__); 133 BN_bin2bn(kbuf, klen, shared_secret) == NULL) {
134 r = SSH_ERR_LIBCRYPTO_ERROR;
135 goto out;
136 }
98 137
99#ifdef DEBUG_KEXDH 138#ifdef DEBUG_KEXECDH
100 dump_digest("shared secret", kbuf, klen); 139 dump_digest("shared secret", kbuf, klen);
101#endif 140#endif
102 if ((shared_secret = BN_new()) == NULL)
103 fatal("%s: BN_new failed", __func__);
104 if (BN_bin2bn(kbuf, klen, shared_secret) == NULL)
105 fatal("%s: BN_bin2bn failed", __func__);
106 explicit_bzero(kbuf, klen);
107 free(kbuf);
108
109 /* calc H */ 141 /* calc H */
110 key_to_blob(server_host_public, &server_host_key_blob, &sbloblen); 142 if ((r = sshkey_to_blob(server_host_public, &server_host_key_blob,
111 kex_ecdh_hash( 143 &sbloblen)) != 0)
144 goto out;
145 hashlen = sizeof(hash);
146 if ((r = kex_ecdh_hash(
112 kex->hash_alg, 147 kex->hash_alg,
113 group, 148 group,
114 kex->client_version_string, 149 kex->client_version_string,
115 kex->server_version_string, 150 kex->server_version_string,
116 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 151 sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
117 buffer_ptr(&kex->my), buffer_len(&kex->my), 152 sshbuf_ptr(kex->my), sshbuf_len(kex->my),
118 server_host_key_blob, sbloblen, 153 server_host_key_blob, sbloblen,
119 client_public, 154 client_public,
120 EC_KEY_get0_public_key(server_key), 155 EC_KEY_get0_public_key(server_key),
121 shared_secret, 156 shared_secret,
122 &hash, &hashlen 157 hash, &hashlen)) != 0)
123 ); 158 goto out;
124 EC_POINT_clear_free(client_public);
125 159
126 /* save session id := H */ 160 /* save session id := H */
127 if (kex->session_id == NULL) { 161 if (kex->session_id == NULL) {
128 kex->session_id_len = hashlen; 162 kex->session_id_len = hashlen;
129 kex->session_id = xmalloc(kex->session_id_len); 163 kex->session_id = malloc(kex->session_id_len);
164 if (kex->session_id == NULL) {
165 r = SSH_ERR_ALLOC_FAIL;
166 goto out;
167 }
130 memcpy(kex->session_id, hash, kex->session_id_len); 168 memcpy(kex->session_id, hash, kex->session_id_len);
131 } 169 }
132 170
133 /* sign H */ 171 /* sign H */
134 kex->sign(server_host_private, server_host_public, &signature, &slen, 172 if ((r = kex->sign(server_host_private, server_host_public,
135 hash, hashlen); 173 &signature, &slen, hash, hashlen, ssh->compat)) < 0)
174 goto out;
136 175
137 /* destroy_sensitive_data(); */ 176 /* destroy_sensitive_data(); */
138 177
178 public_key = EC_KEY_get0_public_key(server_key);
139 /* send server hostkey, ECDH pubkey 'Q_S' and signed H */ 179 /* send server hostkey, ECDH pubkey 'Q_S' and signed H */
140 packet_start(SSH2_MSG_KEX_ECDH_REPLY); 180 if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_ECDH_REPLY)) != 0 ||
141 packet_put_string(server_host_key_blob, sbloblen); 181 (r = sshpkt_put_string(ssh, server_host_key_blob, sbloblen)) != 0 ||
142 packet_put_ecpoint(group, EC_KEY_get0_public_key(server_key)); 182 (r = sshpkt_put_ec(ssh, public_key, group)) != 0 ||
143 packet_put_string(signature, slen); 183 (r = sshpkt_put_string(ssh, signature, slen)) != 0 ||
144 packet_send(); 184 (r = sshpkt_send(ssh)) != 0)
145 185 goto out;
146 free(signature); 186
187 if ((r = kex_derive_keys_bn(ssh, hash, hashlen, shared_secret)) == 0)
188 r = kex_send_newkeys(ssh);
189 out:
190 explicit_bzero(hash, sizeof(hash));
191 if (kex->ec_client_key) {
192 EC_KEY_free(kex->ec_client_key);
193 kex->ec_client_key = NULL;
194 }
195 if (server_key)
196 EC_KEY_free(server_key);
197 if (kbuf) {
198 explicit_bzero(kbuf, klen);
199 free(kbuf);
200 }
201 if (shared_secret)
202 BN_clear_free(shared_secret);
147 free(server_host_key_blob); 203 free(server_host_key_blob);
148 /* have keys, free server key */ 204 free(signature);
149 EC_KEY_free(server_key); 205 return r;
150
151 kex_derive_keys_bn(kex, hash, hashlen, shared_secret);
152 BN_clear_free(shared_secret);
153 kex_finish(kex);
154}
155#else /* OPENSSL_HAS_ECC */
156void
157kexecdh_server(Kex *kex)
158{
159 fatal("ECC support is not enabled");
160} 206}
161#endif /* OPENSSL_HAS_ECC */ 207#endif /* defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC) */
208
diff --git a/kexgex.c b/kexgex.c
index c2e6bc16d..8b0d83332 100644
--- a/kexgex.c
+++ b/kexgex.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexgex.c,v 1.28 2014/01/09 23:20:00 djm Exp $ */ 1/* $OpenBSD: kexgex.c,v 1.29 2015/01/19 20:16:15 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Niels Provos. All rights reserved. 3 * Copyright (c) 2000 Niels Provos. All rights reserved.
4 * Copyright (c) 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -26,73 +26,77 @@
26 26
27#include "includes.h" 27#include "includes.h"
28 28
29#ifdef WITH_OPENSSL
30
29#include <sys/types.h> 31#include <sys/types.h>
30 32
31#include <openssl/evp.h> 33#include <openssl/evp.h>
32#include <signal.h> 34#include <signal.h>
33 35
34#include "buffer.h" 36#include "sshkey.h"
35#include "key.h"
36#include "cipher.h" 37#include "cipher.h"
37#include "kex.h" 38#include "kex.h"
38#include "ssh2.h" 39#include "ssh2.h"
40#include "ssherr.h"
41#include "sshbuf.h"
39#include "digest.h" 42#include "digest.h"
40#include "log.h"
41 43
42void 44int
43kexgex_hash( 45kexgex_hash(
44 int hash_alg, 46 int hash_alg,
45 char *client_version_string, 47 const char *client_version_string,
46 char *server_version_string, 48 const char *server_version_string,
47 char *ckexinit, int ckexinitlen, 49 const u_char *ckexinit, size_t ckexinitlen,
48 char *skexinit, int skexinitlen, 50 const u_char *skexinit, size_t skexinitlen,
49 u_char *serverhostkeyblob, int sbloblen, 51 const u_char *serverhostkeyblob, size_t sbloblen,
50 int min, int wantbits, int max, BIGNUM *prime, BIGNUM *gen, 52 int min, int wantbits, int max,
51 BIGNUM *client_dh_pub, 53 const BIGNUM *prime,
52 BIGNUM *server_dh_pub, 54 const BIGNUM *gen,
53 BIGNUM *shared_secret, 55 const BIGNUM *client_dh_pub,
54 u_char **hash, u_int *hashlen) 56 const BIGNUM *server_dh_pub,
57 const BIGNUM *shared_secret,
58 u_char *hash, size_t *hashlen)
55{ 59{
56 Buffer b; 60 struct sshbuf *b;
57 static u_char digest[SSH_DIGEST_MAX_LENGTH]; 61 int r;
58
59 buffer_init(&b);
60 buffer_put_cstring(&b, client_version_string);
61 buffer_put_cstring(&b, server_version_string);
62
63 /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */
64 buffer_put_int(&b, ckexinitlen+1);
65 buffer_put_char(&b, SSH2_MSG_KEXINIT);
66 buffer_append(&b, ckexinit, ckexinitlen);
67 buffer_put_int(&b, skexinitlen+1);
68 buffer_put_char(&b, SSH2_MSG_KEXINIT);
69 buffer_append(&b, skexinit, skexinitlen);
70 62
71 buffer_put_string(&b, serverhostkeyblob, sbloblen); 63 if (*hashlen < ssh_digest_bytes(SSH_DIGEST_SHA1))
72 if (min == -1 || max == -1) 64 return SSH_ERR_INVALID_ARGUMENT;
73 buffer_put_int(&b, wantbits); 65 if ((b = sshbuf_new()) == NULL)
74 else { 66 return SSH_ERR_ALLOC_FAIL;
75 buffer_put_int(&b, min); 67 if ((r = sshbuf_put_cstring(b, client_version_string)) != 0 ||
76 buffer_put_int(&b, wantbits); 68 (r = sshbuf_put_cstring(b, server_version_string)) != 0 ||
77 buffer_put_int(&b, max); 69 /* kexinit messages: fake header: len+SSH2_MSG_KEXINIT */
70 (r = sshbuf_put_u32(b, ckexinitlen+1)) != 0 ||
71 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 ||
72 (r = sshbuf_put(b, ckexinit, ckexinitlen)) != 0 ||
73 (r = sshbuf_put_u32(b, skexinitlen+1)) != 0 ||
74 (r = sshbuf_put_u8(b, SSH2_MSG_KEXINIT)) != 0 ||
75 (r = sshbuf_put(b, skexinit, skexinitlen)) != 0 ||
76 (r = sshbuf_put_string(b, serverhostkeyblob, sbloblen)) != 0 ||
77 (min != -1 && (r = sshbuf_put_u32(b, min)) != 0) ||
78 (r = sshbuf_put_u32(b, wantbits)) != 0 ||
79 (max != -1 && (r = sshbuf_put_u32(b, max)) != 0) ||
80 (r = sshbuf_put_bignum2(b, prime)) != 0 ||
81 (r = sshbuf_put_bignum2(b, gen)) != 0 ||
82 (r = sshbuf_put_bignum2(b, client_dh_pub)) != 0 ||
83 (r = sshbuf_put_bignum2(b, server_dh_pub)) != 0 ||
84 (r = sshbuf_put_bignum2(b, shared_secret)) != 0) {
85 sshbuf_free(b);
86 return r;
78 } 87 }
79 buffer_put_bignum2(&b, prime);
80 buffer_put_bignum2(&b, gen);
81 buffer_put_bignum2(&b, client_dh_pub);
82 buffer_put_bignum2(&b, server_dh_pub);
83 buffer_put_bignum2(&b, shared_secret);
84
85#ifdef DEBUG_KEXDH 88#ifdef DEBUG_KEXDH
86 buffer_dump(&b); 89 sshbuf_dump(b, stderr);
87#endif
88 if (ssh_digest_buffer(hash_alg, &b, digest, sizeof(digest)) != 0)
89 fatal("%s: ssh_digest_buffer failed", __func__);
90
91 buffer_free(&b);
92
93#ifdef DEBUG_KEX
94 dump_digest("hash", digest, ssh_digest_bytes(hash_alg));
95#endif 90#endif
96 *hash = digest; 91 if (ssh_digest_buffer(hash_alg, b, hash, *hashlen) != 0) {
92 sshbuf_free(b);
93 return SSH_ERR_LIBCRYPTO_ERROR;
94 }
95 sshbuf_free(b);
97 *hashlen = ssh_digest_bytes(hash_alg); 96 *hashlen = ssh_digest_bytes(hash_alg);
97#ifdef DEBUG_KEXDH
98 dump_digest("hash", hash, *hashlen);
99#endif
100 return 0;
98} 101}
102#endif /* WITH_OPENSSL */
diff --git a/kexgexc.c b/kexgexc.c
index 355b7ba31..e8e059a88 100644
--- a/kexgexc.c
+++ b/kexgexc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexgexc.c,v 1.17 2014/02/02 03:44:31 djm Exp $ */ 1/* $OpenBSD: kexgexc.c,v 1.20 2015/01/26 06:10:03 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Niels Provos. All rights reserved. 3 * Copyright (c) 2000 Niels Provos. All rights reserved.
4 * Copyright (c) 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -26,6 +26,8 @@
26 26
27#include "includes.h" 27#include "includes.h"
28 28
29#ifdef WITH_OPENSSL
30
29#include <sys/types.h> 31#include <sys/types.h>
30 32
31#include <openssl/dh.h> 33#include <openssl/dh.h>
@@ -35,173 +37,243 @@
35#include <string.h> 37#include <string.h>
36#include <signal.h> 38#include <signal.h>
37 39
38#include "xmalloc.h" 40#include "sshkey.h"
39#include "buffer.h"
40#include "key.h"
41#include "cipher.h" 41#include "cipher.h"
42#include "digest.h"
42#include "kex.h" 43#include "kex.h"
43#include "log.h" 44#include "log.h"
44#include "packet.h" 45#include "packet.h"
45#include "dh.h" 46#include "dh.h"
46#include "ssh2.h" 47#include "ssh2.h"
47#include "compat.h" 48#include "compat.h"
49#include "dispatch.h"
50#include "ssherr.h"
51#include "sshbuf.h"
52
53static int input_kex_dh_gex_group(int, u_int32_t, void *);
54static int input_kex_dh_gex_reply(int, u_int32_t, void *);
48 55
49void 56int
50kexgex_client(Kex *kex) 57kexgex_client(struct ssh *ssh)
51{ 58{
52 BIGNUM *dh_server_pub = NULL, *shared_secret = NULL; 59 struct kex *kex = ssh->kex;
53 BIGNUM *p = NULL, *g = NULL; 60 int r;
54 Key *server_host_key; 61 u_int nbits;
55 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL;
56 u_int klen, slen, sbloblen, hashlen;
57 int kout;
58 int min, max, nbits;
59 DH *dh;
60 62
61 nbits = dh_estimate(kex->dh_need * 8); 63 nbits = dh_estimate(kex->dh_need * 8);
62 64
63 if (datafellows & SSH_OLD_DHGEX) { 65 kex->min = DH_GRP_MIN;
66 kex->max = DH_GRP_MAX;
67 kex->nbits = nbits;
68 if (ssh->compat & SSH_OLD_DHGEX) {
64 /* Old GEX request */ 69 /* Old GEX request */
65 packet_start(SSH2_MSG_KEX_DH_GEX_REQUEST_OLD); 70 if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_REQUEST_OLD))
66 packet_put_int(nbits); 71 != 0 ||
67 min = DH_GRP_MIN; 72 (r = sshpkt_put_u32(ssh, kex->nbits)) != 0 ||
68 max = DH_GRP_MAX; 73 (r = sshpkt_send(ssh)) != 0)
69 74 goto out;
70 debug("SSH2_MSG_KEX_DH_GEX_REQUEST_OLD(%u) sent", nbits); 75 debug("SSH2_MSG_KEX_DH_GEX_REQUEST_OLD(%u) sent", kex->nbits);
71 } else { 76 } else {
72 /* New GEX request */ 77 /* New GEX request */
73 min = DH_GRP_MIN; 78 if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_REQUEST)) != 0 ||
74 max = DH_GRP_MAX; 79 (r = sshpkt_put_u32(ssh, kex->min)) != 0 ||
75 packet_start(SSH2_MSG_KEX_DH_GEX_REQUEST); 80 (r = sshpkt_put_u32(ssh, kex->nbits)) != 0 ||
76 packet_put_int(min); 81 (r = sshpkt_put_u32(ssh, kex->max)) != 0 ||
77 packet_put_int(nbits); 82 (r = sshpkt_send(ssh)) != 0)
78 packet_put_int(max); 83 goto out;
79
80 debug("SSH2_MSG_KEX_DH_GEX_REQUEST(%u<%u<%u) sent", 84 debug("SSH2_MSG_KEX_DH_GEX_REQUEST(%u<%u<%u) sent",
81 min, nbits, max); 85 kex->min, kex->nbits, kex->max);
82 } 86 }
83#ifdef DEBUG_KEXDH 87#ifdef DEBUG_KEXDH
84 fprintf(stderr, "\nmin = %d, nbits = %d, max = %d\n", 88 fprintf(stderr, "\nmin = %d, nbits = %d, max = %d\n",
85 min, nbits, max); 89 kex->min, kex->nbits, kex->max);
86#endif 90#endif
87 packet_send(); 91 ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_GROUP,
88 92 &input_kex_dh_gex_group);
89 debug("expecting SSH2_MSG_KEX_DH_GEX_GROUP"); 93 r = 0;
90 packet_read_expect(SSH2_MSG_KEX_DH_GEX_GROUP); 94 out:
95 return r;
96}
91 97
92 if ((p = BN_new()) == NULL) 98static int
93 fatal("BN_new"); 99input_kex_dh_gex_group(int type, u_int32_t seq, void *ctxt)
94 packet_get_bignum2(p); 100{
95 if ((g = BN_new()) == NULL) 101 struct ssh *ssh = ctxt;
96 fatal("BN_new"); 102 struct kex *kex = ssh->kex;
97 packet_get_bignum2(g); 103 BIGNUM *p = NULL, *g = NULL;
98 packet_check_eom(); 104 int r, bits;
99 105
100 if (BN_num_bits(p) < min || BN_num_bits(p) > max) 106 debug("got SSH2_MSG_KEX_DH_GEX_GROUP");
101 fatal("DH_GEX group out of range: %d !< %d !< %d",
102 min, BN_num_bits(p), max);
103 107
104 dh = dh_new_group(g, p); 108 if ((p = BN_new()) == NULL ||
105 dh_gen_key(dh, kex->we_need * 8); 109 (g = BN_new()) == NULL) {
110 r = SSH_ERR_ALLOC_FAIL;
111 goto out;
112 }
113 if ((r = sshpkt_get_bignum2(ssh, p)) != 0 ||
114 (r = sshpkt_get_bignum2(ssh, g)) != 0 ||
115 (r = sshpkt_get_end(ssh)) != 0)
116 goto out;
117 if ((bits = BN_num_bits(p)) < 0 ||
118 (u_int)bits < kex->min || (u_int)bits > kex->max) {
119 r = SSH_ERR_DH_GEX_OUT_OF_RANGE;
120 goto out;
121 }
122 if ((kex->dh = dh_new_group(g, p)) == NULL) {
123 r = SSH_ERR_ALLOC_FAIL;
124 goto out;
125 }
126 p = g = NULL; /* belong to kex->dh now */
106 127
128 /* generate and send 'e', client DH public key */
129 if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0 ||
130 (r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_INIT)) != 0 ||
131 (r = sshpkt_put_bignum2(ssh, kex->dh->pub_key)) != 0 ||
132 (r = sshpkt_send(ssh)) != 0)
133 goto out;
134 debug("SSH2_MSG_KEX_DH_GEX_INIT sent");
107#ifdef DEBUG_KEXDH 135#ifdef DEBUG_KEXDH
108 DHparams_print_fp(stderr, dh); 136 DHparams_print_fp(stderr, kex->dh);
109 fprintf(stderr, "pub= "); 137 fprintf(stderr, "pub= ");
110 BN_print_fp(stderr, dh->pub_key); 138 BN_print_fp(stderr, kex->dh->pub_key);
111 fprintf(stderr, "\n"); 139 fprintf(stderr, "\n");
112#endif 140#endif
141 ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_GROUP, NULL);
142 ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_REPLY, &input_kex_dh_gex_reply);
143 r = 0;
144out:
145 if (p)
146 BN_clear_free(p);
147 if (g)
148 BN_clear_free(g);
149 return r;
150}
113 151
114 debug("SSH2_MSG_KEX_DH_GEX_INIT sent"); 152static int
115 /* generate and send 'e', client DH public key */ 153input_kex_dh_gex_reply(int type, u_int32_t seq, void *ctxt)
116 packet_start(SSH2_MSG_KEX_DH_GEX_INIT); 154{
117 packet_put_bignum2(dh->pub_key); 155 struct ssh *ssh = ctxt;
118 packet_send(); 156 struct kex *kex = ssh->kex;
119 157 BIGNUM *dh_server_pub = NULL, *shared_secret = NULL;
120 debug("expecting SSH2_MSG_KEX_DH_GEX_REPLY"); 158 struct sshkey *server_host_key = NULL;
121 packet_read_expect(SSH2_MSG_KEX_DH_GEX_REPLY); 159 u_char *kbuf = NULL, *signature = NULL, *server_host_key_blob = NULL;
160 u_char hash[SSH_DIGEST_MAX_LENGTH];
161 size_t klen = 0, slen, sbloblen, hashlen;
162 int kout, r;
122 163
164 debug("got SSH2_MSG_KEX_DH_GEX_REPLY");
165 if (kex->verify_host_key == NULL) {
166 r = SSH_ERR_INVALID_ARGUMENT;
167 goto out;
168 }
123 /* key, cert */ 169 /* key, cert */
124 server_host_key_blob = packet_get_string(&sbloblen); 170 if ((r = sshpkt_get_string(ssh, &server_host_key_blob,
125 server_host_key = key_from_blob(server_host_key_blob, sbloblen); 171 &sbloblen)) != 0 ||
126 if (server_host_key == NULL) 172 (r = sshkey_from_blob(server_host_key_blob, sbloblen,
127 fatal("cannot decode server_host_key_blob"); 173 &server_host_key)) != 0)
128 if (server_host_key->type != kex->hostkey_type) 174 goto out;
129 fatal("type mismatch for decoded server_host_key_blob"); 175 if (server_host_key->type != kex->hostkey_type) {
130 if (kex->verify_host_key == NULL) 176 r = SSH_ERR_KEY_TYPE_MISMATCH;
131 fatal("cannot verify server_host_key"); 177 goto out;
132 if (kex->verify_host_key(server_host_key) == -1) 178 }
133 fatal("server_host_key verification failed"); 179 if (server_host_key->type != kex->hostkey_type ||
134 180 (kex->hostkey_type == KEY_ECDSA &&
181 server_host_key->ecdsa_nid != kex->hostkey_nid)) {
182 r = SSH_ERR_KEY_TYPE_MISMATCH;
183 goto out;
184 }
185 if (kex->verify_host_key(server_host_key, ssh) == -1) {
186 r = SSH_ERR_SIGNATURE_INVALID;
187 goto out;
188 }
135 /* DH parameter f, server public DH key */ 189 /* DH parameter f, server public DH key */
136 if ((dh_server_pub = BN_new()) == NULL) 190 if ((dh_server_pub = BN_new()) == NULL) {
137 fatal("dh_server_pub == NULL"); 191 r = SSH_ERR_ALLOC_FAIL;
138 packet_get_bignum2(dh_server_pub); 192 goto out;
139 193 }
194 /* signed H */
195 if ((r = sshpkt_get_bignum2(ssh, dh_server_pub)) != 0 ||
196 (r = sshpkt_get_string(ssh, &signature, &slen)) != 0 ||
197 (r = sshpkt_get_end(ssh)) != 0)
198 goto out;
140#ifdef DEBUG_KEXDH 199#ifdef DEBUG_KEXDH
141 fprintf(stderr, "dh_server_pub= "); 200 fprintf(stderr, "dh_server_pub= ");
142 BN_print_fp(stderr, dh_server_pub); 201 BN_print_fp(stderr, dh_server_pub);
143 fprintf(stderr, "\n"); 202 fprintf(stderr, "\n");
144 debug("bits %d", BN_num_bits(dh_server_pub)); 203 debug("bits %d", BN_num_bits(dh_server_pub));
145#endif 204#endif
205 if (!dh_pub_is_valid(kex->dh, dh_server_pub)) {
206 sshpkt_disconnect(ssh, "bad server public DH value");
207 r = SSH_ERR_MESSAGE_INCOMPLETE;
208 goto out;
209 }
146 210
147 /* signed H */ 211 klen = DH_size(kex->dh);
148 signature = packet_get_string(&slen); 212 if ((kbuf = malloc(klen)) == NULL ||
149 packet_check_eom(); 213 (shared_secret = BN_new()) == NULL) {
150 214 r = SSH_ERR_ALLOC_FAIL;
151 if (!dh_pub_is_valid(dh, dh_server_pub)) 215 goto out;
152 packet_disconnect("bad server public DH value"); 216 }
153 217 if ((kout = DH_compute_key(kbuf, dh_server_pub, kex->dh)) < 0 ||
154 klen = DH_size(dh); 218 BN_bin2bn(kbuf, kout, shared_secret) == NULL) {
155 kbuf = xmalloc(klen); 219 r = SSH_ERR_LIBCRYPTO_ERROR;
156 if ((kout = DH_compute_key(kbuf, dh_server_pub, dh)) < 0) 220 goto out;
157 fatal("DH_compute_key: failed"); 221 }
158#ifdef DEBUG_KEXDH 222#ifdef DEBUG_KEXDH
159 dump_digest("shared secret", kbuf, kout); 223 dump_digest("shared secret", kbuf, kout);
160#endif 224#endif
161 if ((shared_secret = BN_new()) == NULL) 225 if (ssh->compat & SSH_OLD_DHGEX)
162 fatal("kexgex_client: BN_new failed"); 226 kex->min = kex->max = -1;
163 if (BN_bin2bn(kbuf, kout, shared_secret) == NULL)
164 fatal("kexgex_client: BN_bin2bn failed");
165 explicit_bzero(kbuf, klen);
166 free(kbuf);
167
168 if (datafellows & SSH_OLD_DHGEX)
169 min = max = -1;
170 227
171 /* calc and verify H */ 228 /* calc and verify H */
172 kexgex_hash( 229 hashlen = sizeof(hash);
230 if ((r = kexgex_hash(
173 kex->hash_alg, 231 kex->hash_alg,
174 kex->client_version_string, 232 kex->client_version_string,
175 kex->server_version_string, 233 kex->server_version_string,
176 buffer_ptr(&kex->my), buffer_len(&kex->my), 234 sshbuf_ptr(kex->my), sshbuf_len(kex->my),
177 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 235 sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
178 server_host_key_blob, sbloblen, 236 server_host_key_blob, sbloblen,
179 min, nbits, max, 237 kex->min, kex->nbits, kex->max,
180 dh->p, dh->g, 238 kex->dh->p, kex->dh->g,
181 dh->pub_key, 239 kex->dh->pub_key,
182 dh_server_pub, 240 dh_server_pub,
183 shared_secret, 241 shared_secret,
184 &hash, &hashlen 242 hash, &hashlen)) != 0)
185 ); 243 goto out;
186
187 /* have keys, free DH */
188 DH_free(dh);
189 free(server_host_key_blob);
190 BN_clear_free(dh_server_pub);
191 244
192 if (key_verify(server_host_key, signature, slen, hash, hashlen) != 1) 245 if ((r = sshkey_verify(server_host_key, signature, slen, hash,
193 fatal("key_verify failed for server_host_key"); 246 hashlen, ssh->compat)) != 0)
194 key_free(server_host_key); 247 goto out;
195 free(signature);
196 248
197 /* save session id */ 249 /* save session id */
198 if (kex->session_id == NULL) { 250 if (kex->session_id == NULL) {
199 kex->session_id_len = hashlen; 251 kex->session_id_len = hashlen;
200 kex->session_id = xmalloc(kex->session_id_len); 252 kex->session_id = malloc(kex->session_id_len);
253 if (kex->session_id == NULL) {
254 r = SSH_ERR_ALLOC_FAIL;
255 goto out;
256 }
201 memcpy(kex->session_id, hash, kex->session_id_len); 257 memcpy(kex->session_id, hash, kex->session_id_len);
202 } 258 }
203 kex_derive_keys_bn(kex, hash, hashlen, shared_secret);
204 BN_clear_free(shared_secret);
205 259
206 kex_finish(kex); 260 if ((r = kex_derive_keys_bn(ssh, hash, hashlen, shared_secret)) == 0)
261 r = kex_send_newkeys(ssh);
262 out:
263 explicit_bzero(hash, sizeof(hash));
264 DH_free(kex->dh);
265 kex->dh = NULL;
266 if (dh_server_pub)
267 BN_clear_free(dh_server_pub);
268 if (kbuf) {
269 explicit_bzero(kbuf, klen);
270 free(kbuf);
271 }
272 if (shared_secret)
273 BN_clear_free(shared_secret);
274 sshkey_free(server_host_key);
275 free(server_host_key_blob);
276 free(signature);
277 return r;
207} 278}
279#endif /* WITH_OPENSSL */
diff --git a/kexgexs.c b/kexgexs.c
index 770ad28a8..9c281d288 100644
--- a/kexgexs.c
+++ b/kexgexs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexgexs.c,v 1.19 2014/02/02 03:44:31 djm Exp $ */ 1/* $OpenBSD: kexgexs.c,v 1.24 2015/01/26 06:10:03 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Niels Provos. All rights reserved. 3 * Copyright (c) 2000 Niels Provos. All rights reserved.
4 * Copyright (c) 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -26,7 +26,9 @@
26 26
27#include "includes.h" 27#include "includes.h"
28 28
29#include <sys/param.h> 29#ifdef WITH_OPENSSL
30
31#include <sys/param.h> /* MIN MAX */
30 32
31#include <stdarg.h> 33#include <stdarg.h>
32#include <stdio.h> 34#include <stdio.h>
@@ -35,10 +37,9 @@
35 37
36#include <openssl/dh.h> 38#include <openssl/dh.h>
37 39
38#include "xmalloc.h" 40#include "sshkey.h"
39#include "buffer.h"
40#include "key.h"
41#include "cipher.h" 41#include "cipher.h"
42#include "digest.h"
42#include "kex.h" 43#include "kex.h"
43#include "log.h" 44#include "log.h"
44#include "packet.h" 45#include "packet.h"
@@ -49,33 +50,43 @@
49#include "ssh-gss.h" 50#include "ssh-gss.h"
50#endif 51#endif
51#include "monitor_wrap.h" 52#include "monitor_wrap.h"
53#include "dispatch.h"
54#include "ssherr.h"
55#include "sshbuf.h"
56
57static int input_kex_dh_gex_request(int, u_int32_t, void *);
58static int input_kex_dh_gex_init(int, u_int32_t, void *);
52 59
53void 60int
54kexgex_server(Kex *kex) 61kexgex_server(struct ssh *ssh)
55{ 62{
56 BIGNUM *shared_secret = NULL, *dh_client_pub = NULL; 63 ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_REQUEST_OLD,
57 Key *server_host_public, *server_host_private; 64 &input_kex_dh_gex_request);
58 DH *dh; 65 ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_REQUEST,
59 u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; 66 &input_kex_dh_gex_request);
60 u_int sbloblen, klen, slen, hashlen; 67 debug("expecting SSH2_MSG_KEX_DH_GEX_REQUEST");
61 int omin = -1, min = -1, omax = -1, max = -1, onbits = -1, nbits = -1; 68 return 0;
62 int type, kout; 69}
70
71static int
72input_kex_dh_gex_request(int type, u_int32_t seq, void *ctxt)
73{
74 struct ssh *ssh = ctxt;
75 struct kex *kex = ssh->kex;
76 int r;
77 u_int min = 0, max = 0, nbits = 0;
63 78
64 if (kex->load_host_public_key == NULL ||
65 kex->load_host_private_key == NULL)
66 fatal("Cannot load hostkey");
67 server_host_public = kex->load_host_public_key(kex->hostkey_type);
68 if (server_host_public == NULL)
69 fatal("Unsupported hostkey type %d", kex->hostkey_type);
70 server_host_private = kex->load_host_private_key(kex->hostkey_type);
71
72 type = packet_read();
73 switch (type) { 79 switch (type) {
74 case SSH2_MSG_KEX_DH_GEX_REQUEST: 80 case SSH2_MSG_KEX_DH_GEX_REQUEST:
75 debug("SSH2_MSG_KEX_DH_GEX_REQUEST received"); 81 debug("SSH2_MSG_KEX_DH_GEX_REQUEST received");
76 omin = min = packet_get_int(); 82 if ((r = sshpkt_get_u32(ssh, &min)) != 0 ||
77 onbits = nbits = packet_get_int(); 83 (r = sshpkt_get_u32(ssh, &nbits)) != 0 ||
78 omax = max = packet_get_int(); 84 (r = sshpkt_get_u32(ssh, &max)) != 0 ||
85 (r = sshpkt_get_end(ssh)) != 0)
86 goto out;
87 kex->nbits = nbits;
88 kex->min = min;
89 kex->max = max;
79 min = MAX(DH_GRP_MIN, min); 90 min = MAX(DH_GRP_MIN, min);
80 max = MIN(DH_GRP_MAX, max); 91 max = MIN(DH_GRP_MAX, max);
81 nbits = MAX(DH_GRP_MIN, nbits); 92 nbits = MAX(DH_GRP_MIN, nbits);
@@ -83,45 +94,89 @@ kexgex_server(Kex *kex)
83 break; 94 break;
84 case SSH2_MSG_KEX_DH_GEX_REQUEST_OLD: 95 case SSH2_MSG_KEX_DH_GEX_REQUEST_OLD:
85 debug("SSH2_MSG_KEX_DH_GEX_REQUEST_OLD received"); 96 debug("SSH2_MSG_KEX_DH_GEX_REQUEST_OLD received");
86 onbits = nbits = packet_get_int(); 97 if ((r = sshpkt_get_u32(ssh, &nbits)) != 0 ||
98 (r = sshpkt_get_end(ssh)) != 0)
99 goto out;
100 kex->nbits = nbits;
87 /* unused for old GEX */ 101 /* unused for old GEX */
88 omin = min = DH_GRP_MIN; 102 kex->min = min = DH_GRP_MIN;
89 omax = max = DH_GRP_MAX; 103 kex->max = max = DH_GRP_MAX;
90 break; 104 break;
91 default: 105 default:
92 fatal("protocol error during kex, no DH_GEX_REQUEST: %d", type); 106 r = SSH_ERR_INVALID_ARGUMENT;
107 goto out;
93 } 108 }
94 packet_check_eom();
95 109
96 if (omax < omin || onbits < omin || omax < onbits) 110 if (kex->max < kex->min || kex->nbits < kex->min ||
97 fatal("DH_GEX_REQUEST, bad parameters: %d !< %d !< %d", 111 kex->max < kex->nbits) {
98 omin, onbits, omax); 112 r = SSH_ERR_DH_GEX_OUT_OF_RANGE;
113 goto out;
114 }
99 115
100 /* Contact privileged parent */ 116 /* Contact privileged parent */
101 dh = PRIVSEP(choose_dh(min, nbits, max)); 117 kex->dh = PRIVSEP(choose_dh(min, nbits, max));
102 if (dh == NULL) 118 if (kex->dh == NULL) {
103 packet_disconnect("Protocol error: no matching DH grp found"); 119 sshpkt_disconnect(ssh, "no matching DH grp found");
104 120 r = SSH_ERR_ALLOC_FAIL;
121 goto out;
122 }
105 debug("SSH2_MSG_KEX_DH_GEX_GROUP sent"); 123 debug("SSH2_MSG_KEX_DH_GEX_GROUP sent");
106 packet_start(SSH2_MSG_KEX_DH_GEX_GROUP); 124 if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_GROUP)) != 0 ||
107 packet_put_bignum2(dh->p); 125 (r = sshpkt_put_bignum2(ssh, kex->dh->p)) != 0 ||
108 packet_put_bignum2(dh->g); 126 (r = sshpkt_put_bignum2(ssh, kex->dh->g)) != 0 ||
109 packet_send(); 127 (r = sshpkt_send(ssh)) != 0)
110 128 goto out;
111 /* flush */
112 packet_write_wait();
113 129
114 /* Compute our exchange value in parallel with the client */ 130 /* Compute our exchange value in parallel with the client */
115 dh_gen_key(dh, kex->we_need * 8); 131 if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0)
132 goto out;
133
134 /* old KEX does not use min/max in kexgex_hash() */
135 if (type == SSH2_MSG_KEX_DH_GEX_REQUEST_OLD)
136 kex->min = kex->max = -1;
116 137
117 debug("expecting SSH2_MSG_KEX_DH_GEX_INIT"); 138 debug("expecting SSH2_MSG_KEX_DH_GEX_INIT");
118 packet_read_expect(SSH2_MSG_KEX_DH_GEX_INIT); 139 ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_INIT, &input_kex_dh_gex_init);
140 r = 0;
141 out:
142 return r;
143}
144
145static int
146input_kex_dh_gex_init(int type, u_int32_t seq, void *ctxt)
147{
148 struct ssh *ssh = ctxt;
149 struct kex *kex = ssh->kex;
150 BIGNUM *shared_secret = NULL, *dh_client_pub = NULL;
151 struct sshkey *server_host_public, *server_host_private;
152 u_char *kbuf = NULL, *signature = NULL, *server_host_key_blob = NULL;
153 u_char hash[SSH_DIGEST_MAX_LENGTH];
154 size_t sbloblen, slen;
155 size_t klen = 0, hashlen;
156 int kout, r;
157
158 if (kex->load_host_public_key == NULL ||
159 kex->load_host_private_key == NULL) {
160 r = SSH_ERR_INVALID_ARGUMENT;
161 goto out;
162 }
163 server_host_public = kex->load_host_public_key(kex->hostkey_type,
164 kex->hostkey_nid, ssh);
165 server_host_private = kex->load_host_private_key(kex->hostkey_type,
166 kex->hostkey_nid, ssh);
167 if (server_host_public == NULL) {
168 r = SSH_ERR_NO_HOSTKEY_LOADED;
169 goto out;
170 }
119 171
120 /* key, cert */ 172 /* key, cert */
121 if ((dh_client_pub = BN_new()) == NULL) 173 if ((dh_client_pub = BN_new()) == NULL) {
122 fatal("dh_client_pub == NULL"); 174 r = SSH_ERR_ALLOC_FAIL;
123 packet_get_bignum2(dh_client_pub); 175 goto out;
124 packet_check_eom(); 176 }
177 if ((r = sshpkt_get_bignum2(ssh, dh_client_pub)) != 0 ||
178 (r = sshpkt_get_end(ssh)) != 0)
179 goto out;
125 180
126#ifdef DEBUG_KEXDH 181#ifdef DEBUG_KEXDH
127 fprintf(stderr, "dh_client_pub= "); 182 fprintf(stderr, "dh_client_pub= ");
@@ -131,78 +186,92 @@ kexgex_server(Kex *kex)
131#endif 186#endif
132 187
133#ifdef DEBUG_KEXDH 188#ifdef DEBUG_KEXDH
134 DHparams_print_fp(stderr, dh); 189 DHparams_print_fp(stderr, kex->dh);
135 fprintf(stderr, "pub= "); 190 fprintf(stderr, "pub= ");
136 BN_print_fp(stderr, dh->pub_key); 191 BN_print_fp(stderr, kex->dh->pub_key);
137 fprintf(stderr, "\n"); 192 fprintf(stderr, "\n");
138#endif 193#endif
139 if (!dh_pub_is_valid(dh, dh_client_pub)) 194 if (!dh_pub_is_valid(kex->dh, dh_client_pub)) {
140 packet_disconnect("bad client public DH value"); 195 sshpkt_disconnect(ssh, "bad client public DH value");
196 r = SSH_ERR_MESSAGE_INCOMPLETE;
197 goto out;
198 }
141 199
142 klen = DH_size(dh); 200 klen = DH_size(kex->dh);
143 kbuf = xmalloc(klen); 201 if ((kbuf = malloc(klen)) == NULL ||
144 if ((kout = DH_compute_key(kbuf, dh_client_pub, dh)) < 0) 202 (shared_secret = BN_new()) == NULL) {
145 fatal("DH_compute_key: failed"); 203 r = SSH_ERR_ALLOC_FAIL;
204 goto out;
205 }
206 if ((kout = DH_compute_key(kbuf, dh_client_pub, kex->dh)) < 0 ||
207 BN_bin2bn(kbuf, kout, shared_secret) == NULL) {
208 r = SSH_ERR_LIBCRYPTO_ERROR;
209 goto out;
210 }
146#ifdef DEBUG_KEXDH 211#ifdef DEBUG_KEXDH
147 dump_digest("shared secret", kbuf, kout); 212 dump_digest("shared secret", kbuf, kout);
148#endif 213#endif
149 if ((shared_secret = BN_new()) == NULL) 214 if ((r = sshkey_to_blob(server_host_public, &server_host_key_blob,
150 fatal("kexgex_server: BN_new failed"); 215 &sbloblen)) != 0)
151 if (BN_bin2bn(kbuf, kout, shared_secret) == NULL) 216 goto out;
152 fatal("kexgex_server: BN_bin2bn failed");
153 explicit_bzero(kbuf, klen);
154 free(kbuf);
155
156 key_to_blob(server_host_public, &server_host_key_blob, &sbloblen);
157
158 if (type == SSH2_MSG_KEX_DH_GEX_REQUEST_OLD)
159 omin = min = omax = max = -1;
160
161 /* calc H */ 217 /* calc H */
162 kexgex_hash( 218 hashlen = sizeof(hash);
219 if ((r = kexgex_hash(
163 kex->hash_alg, 220 kex->hash_alg,
164 kex->client_version_string, 221 kex->client_version_string,
165 kex->server_version_string, 222 kex->server_version_string,
166 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 223 sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
167 buffer_ptr(&kex->my), buffer_len(&kex->my), 224 sshbuf_ptr(kex->my), sshbuf_len(kex->my),
168 server_host_key_blob, sbloblen, 225 server_host_key_blob, sbloblen,
169 omin, onbits, omax, 226 kex->min, kex->nbits, kex->max,
170 dh->p, dh->g, 227 kex->dh->p, kex->dh->g,
171 dh_client_pub, 228 dh_client_pub,
172 dh->pub_key, 229 kex->dh->pub_key,
173 shared_secret, 230 shared_secret,
174 &hash, &hashlen 231 hash, &hashlen)) != 0)
175 ); 232 goto out;
176 BN_clear_free(dh_client_pub);
177 233
178 /* save session id := H */ 234 /* save session id := H */
179 if (kex->session_id == NULL) { 235 if (kex->session_id == NULL) {
180 kex->session_id_len = hashlen; 236 kex->session_id_len = hashlen;
181 kex->session_id = xmalloc(kex->session_id_len); 237 kex->session_id = malloc(kex->session_id_len);
238 if (kex->session_id == NULL) {
239 r = SSH_ERR_ALLOC_FAIL;
240 goto out;
241 }
182 memcpy(kex->session_id, hash, kex->session_id_len); 242 memcpy(kex->session_id, hash, kex->session_id_len);
183 } 243 }
184 244
185 /* sign H */ 245 /* sign H */
186 kex->sign(server_host_private, server_host_public, &signature, &slen, 246 if ((r = kex->sign(server_host_private, server_host_public,
187 hash, hashlen); 247 &signature, &slen, hash, hashlen, ssh->compat)) < 0)
248 goto out;
188 249
189 /* destroy_sensitive_data(); */ 250 /* destroy_sensitive_data(); */
190 251
191 /* send server hostkey, DH pubkey 'f' and singed H */ 252 /* send server hostkey, DH pubkey 'f' and singed H */
192 debug("SSH2_MSG_KEX_DH_GEX_REPLY sent"); 253 if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_REPLY)) != 0 ||
193 packet_start(SSH2_MSG_KEX_DH_GEX_REPLY); 254 (r = sshpkt_put_string(ssh, server_host_key_blob, sbloblen)) != 0 ||
194 packet_put_string(server_host_key_blob, sbloblen); 255 (r = sshpkt_put_bignum2(ssh, kex->dh->pub_key)) != 0 || /* f */
195 packet_put_bignum2(dh->pub_key); /* f */ 256 (r = sshpkt_put_string(ssh, signature, slen)) != 0 ||
196 packet_put_string(signature, slen); 257 (r = sshpkt_send(ssh)) != 0)
197 packet_send(); 258 goto out;
198 259
199 free(signature); 260 if ((r = kex_derive_keys_bn(ssh, hash, hashlen, shared_secret)) == 0)
261 r = kex_send_newkeys(ssh);
262 out:
263 DH_free(kex->dh);
264 kex->dh = NULL;
265 if (dh_client_pub)
266 BN_clear_free(dh_client_pub);
267 if (kbuf) {
268 explicit_bzero(kbuf, klen);
269 free(kbuf);
270 }
271 if (shared_secret)
272 BN_clear_free(shared_secret);
200 free(server_host_key_blob); 273 free(server_host_key_blob);
201 /* have keys, free DH */ 274 free(signature);
202 DH_free(dh); 275 return r;
203
204 kex_derive_keys_bn(kex, hash, hashlen, shared_secret);
205 BN_clear_free(shared_secret);
206
207 kex_finish(kex);
208} 276}
277#endif /* WITH_OPENSSL */
diff --git a/key.c b/key.c
index 206076159..bbe027b66 100644
--- a/key.c
+++ b/key.c
@@ -1,15 +1,15 @@
1/* $OpenBSD: key.c,v 1.122 2014/07/22 01:18:50 dtucker Exp $ */ 1/* $OpenBSD: key.c,v 1.127 2015/01/28 22:36:00 djm Exp $ */
2/* 2/*
3 * placed in the public domain 3 * placed in the public domain
4 */ 4 */
5 5
6#include "includes.h" 6#include "includes.h"
7 7
8#include <sys/param.h>
9#include <sys/types.h> 8#include <sys/types.h>
10#include <errno.h> 9#include <errno.h>
11#include <stdarg.h> 10#include <stdarg.h>
12#include <stdio.h> 11#include <stdio.h>
12#include <limits.h>
13 13
14#define SSH_KEY_NO_DEFINE 14#define SSH_KEY_NO_DEFINE
15#include "key.h" 15#include "key.h"
@@ -39,24 +39,6 @@ key_new_private(int type)
39 return ret; 39 return ret;
40} 40}
41 41
42u_char*
43key_fingerprint_raw(const Key *k, enum fp_type dgst_type,
44 u_int *dgst_raw_length)
45{
46 u_char *ret = NULL;
47 size_t dlen;
48 int r;
49
50 if (dgst_raw_length != NULL)
51 *dgst_raw_length = 0;
52 if ((r = sshkey_fingerprint_raw(k, dgst_type, &ret, &dlen)) != 0)
53 fatal("%s: %s", __func__, ssh_err(r));
54 if (dlen > INT_MAX)
55 fatal("%s: giant len %zu", __func__, dlen);
56 *dgst_raw_length = dlen;
57 return ret;
58}
59
60int 42int
61key_read(Key *ret, char **cpp) 43key_read(Key *ret, char **cpp)
62{ 44{
@@ -329,7 +311,7 @@ key_load_file(int fd, const char *filename, struct sshbuf *blob)
329{ 311{
330 int r; 312 int r;
331 313
332 if ((r = sshkey_load_file(fd, filename, blob)) != 0) { 314 if ((r = sshkey_load_file(fd, blob)) != 0) {
333 fatal_on_fatal_errors(r, __func__, SSH_ERR_LIBCRYPTO_ERROR); 315 fatal_on_fatal_errors(r, __func__, SSH_ERR_LIBCRYPTO_ERROR);
334 error("%s: %s", __func__, ssh_err(r)); 316 error("%s: %s", __func__, ssh_err(r));
335 return 0; 317 return 0;
@@ -436,44 +418,9 @@ key_load_private_type(int type, const char *filename, const char *passphrase,
436 return ret; 418 return ret;
437} 419}
438 420
439#ifdef WITH_OPENSSL
440Key *
441key_load_private_pem(int fd, int type, const char *passphrase,
442 char **commentp)
443{
444 int r;
445 Key *ret = NULL;
446
447 if ((r = sshkey_load_private_pem(fd, type, passphrase,
448 &ret, commentp)) != 0) {
449 fatal_on_fatal_errors(r, __func__, SSH_ERR_LIBCRYPTO_ERROR);
450 if (r == SSH_ERR_KEY_WRONG_PASSPHRASE)
451 debug("%s: %s", __func__, ssh_err(r));
452 else
453 error("%s: %s", __func__, ssh_err(r));
454 return NULL;
455 }
456 return ret;
457}
458#endif /* WITH_OPENSSL */
459
460int 421int
461key_perm_ok(int fd, const char *filename) 422key_perm_ok(int fd, const char *filename)
462{ 423{
463 return sshkey_perm_ok(fd, filename) == 0 ? 1 : 0; 424 return sshkey_perm_ok(fd, filename) == 0 ? 1 : 0;
464} 425}
465 426
466int
467key_in_file(Key *key, const char *filename, int strict_type)
468{
469 int r;
470
471 if ((r = sshkey_in_file(key, filename, strict_type)) != 0) {
472 fatal_on_fatal_errors(r, __func__, SSH_ERR_LIBCRYPTO_ERROR);
473 if (r == SSH_ERR_SYSTEM_ERROR && errno == ENOENT)
474 return 0;
475 error("%s: %s", __func__, ssh_err(r));
476 return r == SSH_ERR_KEY_NOT_FOUND ? 0 : -1;
477 }
478 return 1;
479}
diff --git a/key.h b/key.h
index c6401a576..89fd5cfdf 100644
--- a/key.h
+++ b/key.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: key.h,v 1.42 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: key.h,v 1.47 2015/01/28 22:36:00 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -39,7 +39,6 @@ typedef struct sshkey Key;
39#define key_free sshkey_free 39#define key_free sshkey_free
40#define key_equal_public sshkey_equal_public 40#define key_equal_public sshkey_equal_public
41#define key_equal sshkey_equal 41#define key_equal sshkey_equal
42#define key_fingerprint sshkey_fingerprint
43#define key_type sshkey_type 42#define key_type sshkey_type
44#define key_cert_type sshkey_cert_type 43#define key_cert_type sshkey_cert_type
45#define key_ssh_name sshkey_ssh_name 44#define key_ssh_name sshkey_ssh_name
@@ -50,7 +49,6 @@ typedef struct sshkey Key;
50#define key_size sshkey_size 49#define key_size sshkey_size
51#define key_ecdsa_bits_to_nid sshkey_ecdsa_bits_to_nid 50#define key_ecdsa_bits_to_nid sshkey_ecdsa_bits_to_nid
52#define key_ecdsa_key_to_nid sshkey_ecdsa_key_to_nid 51#define key_ecdsa_key_to_nid sshkey_ecdsa_key_to_nid
53#define key_names_valid2 sshkey_names_valid2
54#define key_is_cert sshkey_is_cert 52#define key_is_cert sshkey_is_cert
55#define key_type_plain sshkey_type_plain 53#define key_type_plain sshkey_type_plain
56#define key_cert_is_legacy sshkey_cert_is_legacy 54#define key_cert_is_legacy sshkey_cert_is_legacy
@@ -60,14 +58,12 @@ typedef struct sshkey Key;
60#define key_ec_nid_to_hash_alg sshkey_ec_nid_to_hash_alg 58#define key_ec_nid_to_hash_alg sshkey_ec_nid_to_hash_alg
61#define key_dump_ec_point sshkey_dump_ec_point 59#define key_dump_ec_point sshkey_dump_ec_point
62#define key_dump_ec_key sshkey_dump_ec_key 60#define key_dump_ec_key sshkey_dump_ec_key
63#define key_fingerprint sshkey_fingerprint
64#endif 61#endif
65 62
66void key_add_private(Key *); 63void key_add_private(Key *);
67Key *key_new_private(int); 64Key *key_new_private(int);
68void key_free(Key *); 65void key_free(Key *);
69Key *key_demote(const Key *); 66Key *key_demote(const Key *);
70u_char *key_fingerprint_raw(const Key *, enum fp_type, u_int *);
71int key_write(const Key *, FILE *); 67int key_write(const Key *, FILE *);
72int key_read(Key *, char **); 68int key_read(Key *, char **);
73 69
@@ -104,8 +100,6 @@ Key *key_load_public(const char *, char **);
104Key *key_load_private(const char *, const char *, char **); 100Key *key_load_private(const char *, const char *, char **);
105Key *key_load_private_cert(int, const char *, const char *, int *); 101Key *key_load_private_cert(int, const char *, const char *, int *);
106Key *key_load_private_type(int, const char *, const char *, char **, int *); 102Key *key_load_private_type(int, const char *, const char *, char **, int *);
107Key *key_load_private_pem(int, int, const char *, char **);
108int key_perm_ok(int, const char *); 103int key_perm_ok(int, const char *);
109int key_in_file(Key *, const char *, int);
110 104
111#endif 105#endif
diff --git a/krl.c b/krl.c
index eb31df90f..4bbaa2080 100644
--- a/krl.c
+++ b/krl.c
@@ -14,12 +14,12 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17/* $OpenBSD: krl.c,v 1.17 2014/06/24 01:13:21 djm Exp $ */ 17/* $OpenBSD: krl.c,v 1.31 2015/01/30 01:10:33 djm Exp $ */
18 18
19#include "includes.h" 19#include "includes.h"
20 20
21#include <sys/param.h> /* MIN */
21#include <sys/types.h> 22#include <sys/types.h>
22#include <sys/param.h>
23#include <openbsd-compat/sys-tree.h> 23#include <openbsd-compat/sys-tree.h>
24#include <openbsd-compat/sys-queue.h> 24#include <openbsd-compat/sys-queue.h>
25 25
@@ -30,12 +30,14 @@
30#include <time.h> 30#include <time.h>
31#include <unistd.h> 31#include <unistd.h>
32 32
33#include "buffer.h" 33#include "sshbuf.h"
34#include "key.h" 34#include "ssherr.h"
35#include "sshkey.h"
35#include "authfile.h" 36#include "authfile.h"
36#include "misc.h" 37#include "misc.h"
37#include "log.h" 38#include "log.h"
38#include "xmalloc.h" 39#include "digest.h"
40#include "bitmap.h"
39 41
40#include "krl.h" 42#include "krl.h"
41 43
@@ -72,7 +74,7 @@ RB_GENERATE_STATIC(revoked_key_id_tree, revoked_key_id, tree_entry, key_id_cmp);
72/* Tree of blobs (used for keys and fingerprints) */ 74/* Tree of blobs (used for keys and fingerprints) */
73struct revoked_blob { 75struct revoked_blob {
74 u_char *blob; 76 u_char *blob;
75 u_int len; 77 size_t len;
76 RB_ENTRY(revoked_blob) tree_entry; 78 RB_ENTRY(revoked_blob) tree_entry;
77}; 79};
78static int blob_cmp(struct revoked_blob *a, struct revoked_blob *b); 80static int blob_cmp(struct revoked_blob *a, struct revoked_blob *b);
@@ -81,7 +83,7 @@ RB_GENERATE_STATIC(revoked_blob_tree, revoked_blob, tree_entry, blob_cmp);
81 83
82/* Tracks revoked certs for a single CA */ 84/* Tracks revoked certs for a single CA */
83struct revoked_certs { 85struct revoked_certs {
84 Key *ca_key; 86 struct sshkey *ca_key;
85 struct revoked_serial_tree revoked_serials; 87 struct revoked_serial_tree revoked_serials;
86 struct revoked_key_id_tree revoked_key_ids; 88 struct revoked_key_id_tree revoked_key_ids;
87 TAILQ_ENTRY(revoked_certs) entry; 89 TAILQ_ENTRY(revoked_certs) entry;
@@ -154,8 +156,7 @@ revoked_certs_free(struct revoked_certs *rc)
154 free(rki->key_id); 156 free(rki->key_id);
155 free(rki); 157 free(rki);
156 } 158 }
157 if (rc->ca_key != NULL) 159 sshkey_free(rc->ca_key);
158 key_free(rc->ca_key);
159} 160}
160 161
161void 162void
@@ -190,12 +191,13 @@ ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version)
190 krl->krl_version = version; 191 krl->krl_version = version;
191} 192}
192 193
193void 194int
194ssh_krl_set_comment(struct ssh_krl *krl, const char *comment) 195ssh_krl_set_comment(struct ssh_krl *krl, const char *comment)
195{ 196{
196 free(krl->comment); 197 free(krl->comment);
197 if ((krl->comment = strdup(comment)) == NULL) 198 if ((krl->comment = strdup(comment)) == NULL)
198 fatal("%s: strdup", __func__); 199 return SSH_ERR_ALLOC_FAIL;
200 return 0;
199} 201}
200 202
201/* 203/*
@@ -203,14 +205,16 @@ ssh_krl_set_comment(struct ssh_krl *krl, const char *comment)
203 * create a new one in the tree if one did not exist already. 205 * create a new one in the tree if one did not exist already.
204 */ 206 */
205static int 207static int
206revoked_certs_for_ca_key(struct ssh_krl *krl, const Key *ca_key, 208revoked_certs_for_ca_key(struct ssh_krl *krl, const struct sshkey *ca_key,
207 struct revoked_certs **rcp, int allow_create) 209 struct revoked_certs **rcp, int allow_create)
208{ 210{
209 struct revoked_certs *rc; 211 struct revoked_certs *rc;
212 int r;
210 213
211 *rcp = NULL; 214 *rcp = NULL;
212 TAILQ_FOREACH(rc, &krl->revoked_certs, entry) { 215 TAILQ_FOREACH(rc, &krl->revoked_certs, entry) {
213 if (key_equal(rc->ca_key, ca_key)) { 216 if ((ca_key == NULL && rc->ca_key == NULL) ||
217 sshkey_equal(rc->ca_key, ca_key)) {
214 *rcp = rc; 218 *rcp = rc;
215 return 0; 219 return 0;
216 } 220 }
@@ -219,15 +223,18 @@ revoked_certs_for_ca_key(struct ssh_krl *krl, const Key *ca_key,
219 return 0; 223 return 0;
220 /* If this CA doesn't exist in the list then add it now */ 224 /* If this CA doesn't exist in the list then add it now */
221 if ((rc = calloc(1, sizeof(*rc))) == NULL) 225 if ((rc = calloc(1, sizeof(*rc))) == NULL)
222 return -1; 226 return SSH_ERR_ALLOC_FAIL;
223 if ((rc->ca_key = key_from_private(ca_key)) == NULL) { 227 if (ca_key == NULL)
228 rc->ca_key = NULL;
229 else if ((r = sshkey_from_private(ca_key, &rc->ca_key)) != 0) {
224 free(rc); 230 free(rc);
225 return -1; 231 return r;
226 } 232 }
227 RB_INIT(&rc->revoked_serials); 233 RB_INIT(&rc->revoked_serials);
228 RB_INIT(&rc->revoked_key_ids); 234 RB_INIT(&rc->revoked_key_ids);
229 TAILQ_INSERT_TAIL(&krl->revoked_certs, rc, entry); 235 TAILQ_INSERT_TAIL(&krl->revoked_certs, rc, entry);
230 debug3("%s: new CA %s", __func__, key_type(ca_key)); 236 KRL_DBG(("%s: new CA %s", __func__,
237 ca_key == NULL ? "*" : sshkey_type(ca_key)));
231 *rcp = rc; 238 *rcp = rc;
232 return 0; 239 return 0;
233} 240}
@@ -245,14 +252,14 @@ insert_serial_range(struct revoked_serial_tree *rt, u_int64_t lo, u_int64_t hi)
245 if (ers == NULL || serial_cmp(ers, &rs) != 0) { 252 if (ers == NULL || serial_cmp(ers, &rs) != 0) {
246 /* No entry matches. Just insert */ 253 /* No entry matches. Just insert */
247 if ((irs = malloc(sizeof(rs))) == NULL) 254 if ((irs = malloc(sizeof(rs))) == NULL)
248 return -1; 255 return SSH_ERR_ALLOC_FAIL;
249 memcpy(irs, &rs, sizeof(*irs)); 256 memcpy(irs, &rs, sizeof(*irs));
250 ers = RB_INSERT(revoked_serial_tree, rt, irs); 257 ers = RB_INSERT(revoked_serial_tree, rt, irs);
251 if (ers != NULL) { 258 if (ers != NULL) {
252 KRL_DBG(("%s: bad: ers != NULL", __func__)); 259 KRL_DBG(("%s: bad: ers != NULL", __func__));
253 /* Shouldn't happen */ 260 /* Shouldn't happen */
254 free(irs); 261 free(irs);
255 return -1; 262 return SSH_ERR_INTERNAL_ERROR;
256 } 263 }
257 ers = irs; 264 ers = irs;
258 } else { 265 } else {
@@ -267,6 +274,7 @@ insert_serial_range(struct revoked_serial_tree *rt, u_int64_t lo, u_int64_t hi)
267 if (ers->hi < hi) 274 if (ers->hi < hi)
268 ers->hi = hi; 275 ers->hi = hi;
269 } 276 }
277
270 /* 278 /*
271 * The inserted or revised range might overlap or abut adjacent ones; 279 * The inserted or revised range might overlap or abut adjacent ones;
272 * coalesce as necessary. 280 * coalesce as necessary.
@@ -305,40 +313,42 @@ insert_serial_range(struct revoked_serial_tree *rt, u_int64_t lo, u_int64_t hi)
305} 313}
306 314
307int 315int
308ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl, const Key *ca_key, 316ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl, const struct sshkey *ca_key,
309 u_int64_t serial) 317 u_int64_t serial)
310{ 318{
311 return ssh_krl_revoke_cert_by_serial_range(krl, ca_key, serial, serial); 319 return ssh_krl_revoke_cert_by_serial_range(krl, ca_key, serial, serial);
312} 320}
313 321
314int 322int
315ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl, const Key *ca_key, 323ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl,
316 u_int64_t lo, u_int64_t hi) 324 const struct sshkey *ca_key, u_int64_t lo, u_int64_t hi)
317{ 325{
318 struct revoked_certs *rc; 326 struct revoked_certs *rc;
327 int r;
319 328
320 if (lo > hi || lo == 0) 329 if (lo > hi || lo == 0)
321 return -1; 330 return SSH_ERR_INVALID_ARGUMENT;
322 if (revoked_certs_for_ca_key(krl, ca_key, &rc, 1) != 0) 331 if ((r = revoked_certs_for_ca_key(krl, ca_key, &rc, 1)) != 0)
323 return -1; 332 return r;
324 return insert_serial_range(&rc->revoked_serials, lo, hi); 333 return insert_serial_range(&rc->revoked_serials, lo, hi);
325} 334}
326 335
327int 336int
328ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, const Key *ca_key, 337ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, const struct sshkey *ca_key,
329 const char *key_id) 338 const char *key_id)
330{ 339{
331 struct revoked_key_id *rki, *erki; 340 struct revoked_key_id *rki, *erki;
332 struct revoked_certs *rc; 341 struct revoked_certs *rc;
342 int r;
333 343
334 if (revoked_certs_for_ca_key(krl, ca_key, &rc, 1) != 0) 344 if ((r = revoked_certs_for_ca_key(krl, ca_key, &rc, 1)) != 0)
335 return -1; 345 return r;
336 346
337 debug3("%s: revoke %s", __func__, key_id); 347 KRL_DBG(("%s: revoke %s", __func__, key_id));
338 if ((rki = calloc(1, sizeof(*rki))) == NULL || 348 if ((rki = calloc(1, sizeof(*rki))) == NULL ||
339 (rki->key_id = strdup(key_id)) == NULL) { 349 (rki->key_id = strdup(key_id)) == NULL) {
340 free(rki); 350 free(rki);
341 fatal("%s: strdup", __func__); 351 return SSH_ERR_ALLOC_FAIL;
342 } 352 }
343 erki = RB_INSERT(revoked_key_id_tree, &rc->revoked_key_ids, rki); 353 erki = RB_INSERT(revoked_key_id_tree, &rc->revoked_key_ids, rki);
344 if (erki != NULL) { 354 if (erki != NULL) {
@@ -350,33 +360,32 @@ ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, const Key *ca_key,
350 360
351/* Convert "key" to a public key blob without any certificate information */ 361/* Convert "key" to a public key blob without any certificate information */
352static int 362static int
353plain_key_blob(const Key *key, u_char **blob, u_int *blen) 363plain_key_blob(const struct sshkey *key, u_char **blob, size_t *blen)
354{ 364{
355 Key *kcopy; 365 struct sshkey *kcopy;
356 int r; 366 int r;
357 367
358 if ((kcopy = key_from_private(key)) == NULL) 368 if ((r = sshkey_from_private(key, &kcopy)) != 0)
359 return -1; 369 return r;
360 if (key_is_cert(kcopy)) { 370 if (sshkey_is_cert(kcopy)) {
361 if (key_drop_cert(kcopy) != 0) { 371 if ((r = sshkey_drop_cert(kcopy)) != 0) {
362 error("%s: key_drop_cert", __func__); 372 sshkey_free(kcopy);
363 key_free(kcopy); 373 return r;
364 return -1;
365 } 374 }
366 } 375 }
367 r = key_to_blob(kcopy, blob, blen); 376 r = sshkey_to_blob(kcopy, blob, blen);
368 free(kcopy); 377 sshkey_free(kcopy);
369 return r; 378 return r;
370} 379}
371 380
372/* Revoke a key blob. Ownership of blob is transferred to the tree */ 381/* Revoke a key blob. Ownership of blob is transferred to the tree */
373static int 382static int
374revoke_blob(struct revoked_blob_tree *rbt, u_char *blob, u_int len) 383revoke_blob(struct revoked_blob_tree *rbt, u_char *blob, size_t len)
375{ 384{
376 struct revoked_blob *rb, *erb; 385 struct revoked_blob *rb, *erb;
377 386
378 if ((rb = calloc(1, sizeof(*rb))) == NULL) 387 if ((rb = calloc(1, sizeof(*rb))) == NULL)
379 return -1; 388 return SSH_ERR_ALLOC_FAIL;
380 rb->blob = blob; 389 rb->blob = blob;
381 rb->len = len; 390 rb->len = len;
382 erb = RB_INSERT(revoked_blob_tree, rbt, rb); 391 erb = RB_INSERT(revoked_blob_tree, rbt, rb);
@@ -388,36 +397,39 @@ revoke_blob(struct revoked_blob_tree *rbt, u_char *blob, u_int len)
388} 397}
389 398
390int 399int
391ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const Key *key) 400ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const struct sshkey *key)
392{ 401{
393 u_char *blob; 402 u_char *blob;
394 u_int len; 403 size_t len;
404 int r;
395 405
396 debug3("%s: revoke type %s", __func__, key_type(key)); 406 debug3("%s: revoke type %s", __func__, sshkey_type(key));
397 if (plain_key_blob(key, &blob, &len) < 0) 407 if ((r = plain_key_blob(key, &blob, &len)) != 0)
398 return -1; 408 return r;
399 return revoke_blob(&krl->revoked_keys, blob, len); 409 return revoke_blob(&krl->revoked_keys, blob, len);
400} 410}
401 411
402int 412int
403ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const Key *key) 413ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const struct sshkey *key)
404{ 414{
405 u_char *blob; 415 u_char *blob;
406 u_int len; 416 size_t len;
417 int r;
407 418
408 debug3("%s: revoke type %s by sha1", __func__, key_type(key)); 419 debug3("%s: revoke type %s by sha1", __func__, sshkey_type(key));
409 if ((blob = key_fingerprint_raw(key, SSH_FP_SHA1, &len)) == NULL) 420 if ((r = sshkey_fingerprint_raw(key, SSH_DIGEST_SHA1,
410 return -1; 421 &blob, &len)) != 0)
422 return r;
411 return revoke_blob(&krl->revoked_sha1s, blob, len); 423 return revoke_blob(&krl->revoked_sha1s, blob, len);
412} 424}
413 425
414int 426int
415ssh_krl_revoke_key(struct ssh_krl *krl, const Key *key) 427ssh_krl_revoke_key(struct ssh_krl *krl, const struct sshkey *key)
416{ 428{
417 if (!key_is_cert(key)) 429 if (!sshkey_is_cert(key))
418 return ssh_krl_revoke_key_sha1(krl, key); 430 return ssh_krl_revoke_key_sha1(krl, key);
419 431
420 if (key_cert_is_legacy(key) || key->cert->serial == 0) { 432 if (sshkey_cert_is_legacy(key) || key->cert->serial == 0) {
421 return ssh_krl_revoke_cert_by_key_id(krl, 433 return ssh_krl_revoke_cert_by_key_id(krl,
422 key->cert->signature_key, 434 key->cert->signature_key,
423 key->cert->key_id); 435 key->cert->key_id);
@@ -429,8 +441,8 @@ ssh_krl_revoke_key(struct ssh_krl *krl, const Key *key)
429} 441}
430 442
431/* 443/*
432 * Select a copact next section type to emit in a KRL based on the 444 * Select the most compact section type to emit next in a KRL based on
433 * current section type, the run length of contiguous revoked serial 445 * the current section type, the run length of contiguous revoked serial
434 * numbers and the gaps from the last and to the next revoked serial. 446 * numbers and the gaps from the last and to the next revoked serial.
435 * Applies a mostly-accurate bit cost model to select the section type 447 * Applies a mostly-accurate bit cost model to select the section type
436 * that will minimise the size of the resultant KRL. 448 * that will minimise the size of the resultant KRL.
@@ -500,50 +512,69 @@ choose_next_state(int current_state, u_int64_t contig, int final,
500 *force_new_section = 1; 512 *force_new_section = 1;
501 cost = cost_bitmap_restart; 513 cost = cost_bitmap_restart;
502 } 514 }
503 debug3("%s: contig %llu last_gap %llu next_gap %llu final %d, costs:" 515 KRL_DBG(("%s: contig %llu last_gap %llu next_gap %llu final %d, costs:"
504 "list %llu range %llu bitmap %llu new bitmap %llu, " 516 "list %llu range %llu bitmap %llu new bitmap %llu, "
505 "selected 0x%02x%s", __func__, (long long unsigned)contig, 517 "selected 0x%02x%s", __func__, (long long unsigned)contig,
506 (long long unsigned)last_gap, (long long unsigned)next_gap, final, 518 (long long unsigned)last_gap, (long long unsigned)next_gap, final,
507 (long long unsigned)cost_list, (long long unsigned)cost_range, 519 (long long unsigned)cost_list, (long long unsigned)cost_range,
508 (long long unsigned)cost_bitmap, 520 (long long unsigned)cost_bitmap,
509 (long long unsigned)cost_bitmap_restart, new_state, 521 (long long unsigned)cost_bitmap_restart, new_state,
510 *force_new_section ? " restart" : ""); 522 *force_new_section ? " restart" : ""));
511 return new_state; 523 return new_state;
512} 524}
513 525
526static int
527put_bitmap(struct sshbuf *buf, struct bitmap *bitmap)
528{
529 size_t len;
530 u_char *blob;
531 int r;
532
533 len = bitmap_nbytes(bitmap);
534 if ((blob = malloc(len)) == NULL)
535 return SSH_ERR_ALLOC_FAIL;
536 if (bitmap_to_string(bitmap, blob, len) != 0) {
537 free(blob);
538 return SSH_ERR_INTERNAL_ERROR;
539 }
540 r = sshbuf_put_bignum2_bytes(buf, blob, len);
541 free(blob);
542 return r;
543}
544
514/* Generate a KRL_SECTION_CERTIFICATES KRL section */ 545/* Generate a KRL_SECTION_CERTIFICATES KRL section */
515static int 546static int
516revoked_certs_generate(struct revoked_certs *rc, Buffer *buf) 547revoked_certs_generate(struct revoked_certs *rc, struct sshbuf *buf)
517{ 548{
518 int final, force_new_sect, r = -1; 549 int final, force_new_sect, r = SSH_ERR_INTERNAL_ERROR;
519 u_int64_t i, contig, gap, last = 0, bitmap_start = 0; 550 u_int64_t i, contig, gap, last = 0, bitmap_start = 0;
520 struct revoked_serial *rs, *nrs; 551 struct revoked_serial *rs, *nrs;
521 struct revoked_key_id *rki; 552 struct revoked_key_id *rki;
522 int next_state, state = 0; 553 int next_state, state = 0;
523 Buffer sect; 554 struct sshbuf *sect;
524 u_char *kblob = NULL; 555 struct bitmap *bitmap = NULL;
525 u_int klen;
526 BIGNUM *bitmap = NULL;
527
528 /* Prepare CA scope key blob if we have one supplied */
529 if (key_to_blob(rc->ca_key, &kblob, &klen) == 0)
530 return -1;
531 556
532 buffer_init(&sect); 557 if ((sect = sshbuf_new()) == NULL)
558 return SSH_ERR_ALLOC_FAIL;
533 559
534 /* Store the header */ 560 /* Store the header: optional CA scope key, reserved */
535 buffer_put_string(buf, kblob, klen); 561 if (rc->ca_key == NULL) {
536 buffer_put_string(buf, NULL, 0); /* Reserved */ 562 if ((r = sshbuf_put_string(buf, NULL, 0)) != 0)
537 563 goto out;
538 free(kblob); 564 } else {
565 if ((r = sshkey_puts(rc->ca_key, buf)) != 0)
566 goto out;
567 }
568 if ((r = sshbuf_put_string(buf, NULL, 0)) != 0)
569 goto out;
539 570
540 /* Store the revoked serials. */ 571 /* Store the revoked serials. */
541 for (rs = RB_MIN(revoked_serial_tree, &rc->revoked_serials); 572 for (rs = RB_MIN(revoked_serial_tree, &rc->revoked_serials);
542 rs != NULL; 573 rs != NULL;
543 rs = RB_NEXT(revoked_serial_tree, &rc->revoked_serials, rs)) { 574 rs = RB_NEXT(revoked_serial_tree, &rc->revoked_serials, rs)) {
544 debug3("%s: serial %llu:%llu state 0x%02x", __func__, 575 KRL_DBG(("%s: serial %llu:%llu state 0x%02x", __func__,
545 (long long unsigned)rs->lo, (long long unsigned)rs->hi, 576 (long long unsigned)rs->lo, (long long unsigned)rs->hi,
546 state); 577 state));
547 578
548 /* Check contiguous length and gap to next section (if any) */ 579 /* Check contiguous length and gap to next section (if any) */
549 nrs = RB_NEXT(revoked_serial_tree, &rc->revoked_serials, rs); 580 nrs = RB_NEXT(revoked_serial_tree, &rc->revoked_serials, rs);
@@ -561,37 +592,43 @@ revoked_certs_generate(struct revoked_certs *rc, Buffer *buf)
561 */ 592 */
562 if (state != 0 && (force_new_sect || next_state != state || 593 if (state != 0 && (force_new_sect || next_state != state ||
563 state == KRL_SECTION_CERT_SERIAL_RANGE)) { 594 state == KRL_SECTION_CERT_SERIAL_RANGE)) {
564 debug3("%s: finish state 0x%02x", __func__, state); 595 KRL_DBG(("%s: finish state 0x%02x", __func__, state));
565 switch (state) { 596 switch (state) {
566 case KRL_SECTION_CERT_SERIAL_LIST: 597 case KRL_SECTION_CERT_SERIAL_LIST:
567 case KRL_SECTION_CERT_SERIAL_RANGE: 598 case KRL_SECTION_CERT_SERIAL_RANGE:
568 break; 599 break;
569 case KRL_SECTION_CERT_SERIAL_BITMAP: 600 case KRL_SECTION_CERT_SERIAL_BITMAP:
570 buffer_put_bignum2(&sect, bitmap); 601 if ((r = put_bitmap(sect, bitmap)) != 0)
571 BN_free(bitmap); 602 goto out;
603 bitmap_free(bitmap);
572 bitmap = NULL; 604 bitmap = NULL;
573 break; 605 break;
574 } 606 }
575 buffer_put_char(buf, state); 607 if ((r = sshbuf_put_u8(buf, state)) != 0 ||
576 buffer_put_string(buf, 608 (r = sshbuf_put_stringb(buf, sect)) != 0)
577 buffer_ptr(&sect), buffer_len(&sect)); 609 goto out;
578 buffer_clear(&sect); 610 sshbuf_reset(sect);
579 } 611 }
580 612
581 /* If we are starting a new section then prepare it now */ 613 /* If we are starting a new section then prepare it now */
582 if (next_state != state || force_new_sect) { 614 if (next_state != state || force_new_sect) {
583 debug3("%s: start state 0x%02x", __func__, next_state); 615 KRL_DBG(("%s: start state 0x%02x", __func__,
616 next_state));
584 state = next_state; 617 state = next_state;
585 buffer_clear(&sect); 618 sshbuf_reset(sect);
586 switch (state) { 619 switch (state) {
587 case KRL_SECTION_CERT_SERIAL_LIST: 620 case KRL_SECTION_CERT_SERIAL_LIST:
588 case KRL_SECTION_CERT_SERIAL_RANGE: 621 case KRL_SECTION_CERT_SERIAL_RANGE:
589 break; 622 break;
590 case KRL_SECTION_CERT_SERIAL_BITMAP: 623 case KRL_SECTION_CERT_SERIAL_BITMAP:
591 if ((bitmap = BN_new()) == NULL) 624 if ((bitmap = bitmap_new()) == NULL) {
625 r = SSH_ERR_ALLOC_FAIL;
592 goto out; 626 goto out;
627 }
593 bitmap_start = rs->lo; 628 bitmap_start = rs->lo;
594 buffer_put_int64(&sect, bitmap_start); 629 if ((r = sshbuf_put_u64(sect,
630 bitmap_start)) != 0)
631 goto out;
595 break; 632 break;
596 } 633 }
597 } 634 }
@@ -599,12 +636,15 @@ revoked_certs_generate(struct revoked_certs *rc, Buffer *buf)
599 /* Perform section-specific processing */ 636 /* Perform section-specific processing */
600 switch (state) { 637 switch (state) {
601 case KRL_SECTION_CERT_SERIAL_LIST: 638 case KRL_SECTION_CERT_SERIAL_LIST:
602 for (i = 0; i < contig; i++) 639 for (i = 0; i < contig; i++) {
603 buffer_put_int64(&sect, rs->lo + i); 640 if ((r = sshbuf_put_u64(sect, rs->lo + i)) != 0)
641 goto out;
642 }
604 break; 643 break;
605 case KRL_SECTION_CERT_SERIAL_RANGE: 644 case KRL_SECTION_CERT_SERIAL_RANGE:
606 buffer_put_int64(&sect, rs->lo); 645 if ((r = sshbuf_put_u64(sect, rs->lo)) != 0 ||
607 buffer_put_int64(&sect, rs->hi); 646 (r = sshbuf_put_u64(sect, rs->hi)) != 0)
647 goto out;
608 break; 648 break;
609 case KRL_SECTION_CERT_SERIAL_BITMAP: 649 case KRL_SECTION_CERT_SERIAL_BITMAP:
610 if (rs->lo - bitmap_start > INT_MAX) { 650 if (rs->lo - bitmap_start > INT_MAX) {
@@ -612,9 +652,11 @@ revoked_certs_generate(struct revoked_certs *rc, Buffer *buf)
612 goto out; 652 goto out;
613 } 653 }
614 for (i = 0; i < contig; i++) { 654 for (i = 0; i < contig; i++) {
615 if (BN_set_bit(bitmap, 655 if (bitmap_set_bit(bitmap,
616 rs->lo + i - bitmap_start) != 1) 656 rs->lo + i - bitmap_start) != 0) {
657 r = SSH_ERR_ALLOC_FAIL;
617 goto out; 658 goto out;
659 }
618 } 660 }
619 break; 661 break;
620 } 662 }
@@ -622,119 +664,125 @@ revoked_certs_generate(struct revoked_certs *rc, Buffer *buf)
622 } 664 }
623 /* Flush the remaining section, if any */ 665 /* Flush the remaining section, if any */
624 if (state != 0) { 666 if (state != 0) {
625 debug3("%s: serial final flush for state 0x%02x", 667 KRL_DBG(("%s: serial final flush for state 0x%02x",
626 __func__, state); 668 __func__, state));
627 switch (state) { 669 switch (state) {
628 case KRL_SECTION_CERT_SERIAL_LIST: 670 case KRL_SECTION_CERT_SERIAL_LIST:
629 case KRL_SECTION_CERT_SERIAL_RANGE: 671 case KRL_SECTION_CERT_SERIAL_RANGE:
630 break; 672 break;
631 case KRL_SECTION_CERT_SERIAL_BITMAP: 673 case KRL_SECTION_CERT_SERIAL_BITMAP:
632 buffer_put_bignum2(&sect, bitmap); 674 if ((r = put_bitmap(sect, bitmap)) != 0)
633 BN_free(bitmap); 675 goto out;
676 bitmap_free(bitmap);
634 bitmap = NULL; 677 bitmap = NULL;
635 break; 678 break;
636 } 679 }
637 buffer_put_char(buf, state); 680 if ((r = sshbuf_put_u8(buf, state)) != 0 ||
638 buffer_put_string(buf, 681 (r = sshbuf_put_stringb(buf, sect)) != 0)
639 buffer_ptr(&sect), buffer_len(&sect)); 682 goto out;
640 } 683 }
641 debug3("%s: serial done ", __func__); 684 KRL_DBG(("%s: serial done ", __func__));
642 685
643 /* Now output a section for any revocations by key ID */ 686 /* Now output a section for any revocations by key ID */
644 buffer_clear(&sect); 687 sshbuf_reset(sect);
645 RB_FOREACH(rki, revoked_key_id_tree, &rc->revoked_key_ids) { 688 RB_FOREACH(rki, revoked_key_id_tree, &rc->revoked_key_ids) {
646 debug3("%s: key ID %s", __func__, rki->key_id); 689 KRL_DBG(("%s: key ID %s", __func__, rki->key_id));
647 buffer_put_cstring(&sect, rki->key_id); 690 if ((r = sshbuf_put_cstring(sect, rki->key_id)) != 0)
691 goto out;
648 } 692 }
649 if (buffer_len(&sect) != 0) { 693 if (sshbuf_len(sect) != 0) {
650 buffer_put_char(buf, KRL_SECTION_CERT_KEY_ID); 694 if ((r = sshbuf_put_u8(buf, KRL_SECTION_CERT_KEY_ID)) != 0 ||
651 buffer_put_string(buf, buffer_ptr(&sect), 695 (r = sshbuf_put_stringb(buf, sect)) != 0)
652 buffer_len(&sect)); 696 goto out;
653 } 697 }
654 r = 0; 698 r = 0;
655 out: 699 out:
656 if (bitmap != NULL) 700 bitmap_free(bitmap);
657 BN_free(bitmap); 701 sshbuf_free(sect);
658 buffer_free(&sect);
659 return r; 702 return r;
660} 703}
661 704
662int 705int
663ssh_krl_to_blob(struct ssh_krl *krl, Buffer *buf, const Key **sign_keys, 706ssh_krl_to_blob(struct ssh_krl *krl, struct sshbuf *buf,
664 u_int nsign_keys) 707 const struct sshkey **sign_keys, u_int nsign_keys)
665{ 708{
666 int r = -1; 709 int r = SSH_ERR_INTERNAL_ERROR;
667 struct revoked_certs *rc; 710 struct revoked_certs *rc;
668 struct revoked_blob *rb; 711 struct revoked_blob *rb;
669 Buffer sect; 712 struct sshbuf *sect;
670 u_char *kblob = NULL, *sblob = NULL; 713 u_char *sblob = NULL;
671 u_int klen, slen, i; 714 size_t slen, i;
672 715
673 if (krl->generated_date == 0) 716 if (krl->generated_date == 0)
674 krl->generated_date = time(NULL); 717 krl->generated_date = time(NULL);
675 718
676 buffer_init(&sect); 719 if ((sect = sshbuf_new()) == NULL)
720 return SSH_ERR_ALLOC_FAIL;
677 721
678 /* Store the header */ 722 /* Store the header */
679 buffer_append(buf, KRL_MAGIC, sizeof(KRL_MAGIC) - 1); 723 if ((r = sshbuf_put(buf, KRL_MAGIC, sizeof(KRL_MAGIC) - 1)) != 0 ||
680 buffer_put_int(buf, KRL_FORMAT_VERSION); 724 (r = sshbuf_put_u32(buf, KRL_FORMAT_VERSION)) != 0 ||
681 buffer_put_int64(buf, krl->krl_version); 725 (r = sshbuf_put_u64(buf, krl->krl_version)) != 0 ||
682 buffer_put_int64(buf, krl->generated_date); 726 (r = sshbuf_put_u64(buf, krl->generated_date) != 0) ||
683 buffer_put_int64(buf, krl->flags); 727 (r = sshbuf_put_u64(buf, krl->flags)) != 0 ||
684 buffer_put_string(buf, NULL, 0); 728 (r = sshbuf_put_string(buf, NULL, 0)) != 0 ||
685 buffer_put_cstring(buf, krl->comment ? krl->comment : ""); 729 (r = sshbuf_put_cstring(buf, krl->comment)) != 0)
730 goto out;
686 731
687 /* Store sections for revoked certificates */ 732 /* Store sections for revoked certificates */
688 TAILQ_FOREACH(rc, &krl->revoked_certs, entry) { 733 TAILQ_FOREACH(rc, &krl->revoked_certs, entry) {
689 if (revoked_certs_generate(rc, &sect) != 0) 734 sshbuf_reset(sect);
735 if ((r = revoked_certs_generate(rc, sect)) != 0)
736 goto out;
737 if ((r = sshbuf_put_u8(buf, KRL_SECTION_CERTIFICATES)) != 0 ||
738 (r = sshbuf_put_stringb(buf, sect)) != 0)
690 goto out; 739 goto out;
691 buffer_put_char(buf, KRL_SECTION_CERTIFICATES);
692 buffer_put_string(buf, buffer_ptr(&sect),
693 buffer_len(&sect));
694 } 740 }
695 741
696 /* Finally, output sections for revocations by public key/hash */ 742 /* Finally, output sections for revocations by public key/hash */
697 buffer_clear(&sect); 743 sshbuf_reset(sect);
698 RB_FOREACH(rb, revoked_blob_tree, &krl->revoked_keys) { 744 RB_FOREACH(rb, revoked_blob_tree, &krl->revoked_keys) {
699 debug3("%s: key len %u ", __func__, rb->len); 745 KRL_DBG(("%s: key len %zu ", __func__, rb->len));
700 buffer_put_string(&sect, rb->blob, rb->len); 746 if ((r = sshbuf_put_string(sect, rb->blob, rb->len)) != 0)
747 goto out;
701 } 748 }
702 if (buffer_len(&sect) != 0) { 749 if (sshbuf_len(sect) != 0) {
703 buffer_put_char(buf, KRL_SECTION_EXPLICIT_KEY); 750 if ((r = sshbuf_put_u8(buf, KRL_SECTION_EXPLICIT_KEY)) != 0 ||
704 buffer_put_string(buf, buffer_ptr(&sect), 751 (r = sshbuf_put_stringb(buf, sect)) != 0)
705 buffer_len(&sect)); 752 goto out;
706 } 753 }
707 buffer_clear(&sect); 754 sshbuf_reset(sect);
708 RB_FOREACH(rb, revoked_blob_tree, &krl->revoked_sha1s) { 755 RB_FOREACH(rb, revoked_blob_tree, &krl->revoked_sha1s) {
709 debug3("%s: hash len %u ", __func__, rb->len); 756 KRL_DBG(("%s: hash len %zu ", __func__, rb->len));
710 buffer_put_string(&sect, rb->blob, rb->len); 757 if ((r = sshbuf_put_string(sect, rb->blob, rb->len)) != 0)
758 goto out;
711 } 759 }
712 if (buffer_len(&sect) != 0) { 760 if (sshbuf_len(sect) != 0) {
713 buffer_put_char(buf, KRL_SECTION_FINGERPRINT_SHA1); 761 if ((r = sshbuf_put_u8(buf,
714 buffer_put_string(buf, buffer_ptr(&sect), 762 KRL_SECTION_FINGERPRINT_SHA1)) != 0 ||
715 buffer_len(&sect)); 763 (r = sshbuf_put_stringb(buf, sect)) != 0)
764 goto out;
716 } 765 }
717 766
718 for (i = 0; i < nsign_keys; i++) { 767 for (i = 0; i < nsign_keys; i++) {
719 if (key_to_blob(sign_keys[i], &kblob, &klen) == 0) 768 KRL_DBG(("%s: signature key %s", __func__,
769 sshkey_ssh_name(sign_keys[i])));
770 if ((r = sshbuf_put_u8(buf, KRL_SECTION_SIGNATURE)) != 0 ||
771 (r = sshkey_puts(sign_keys[i], buf)) != 0)
720 goto out; 772 goto out;
721 773
722 debug3("%s: signature key len %u", __func__, klen); 774 if ((r = sshkey_sign(sign_keys[i], &sblob, &slen,
723 buffer_put_char(buf, KRL_SECTION_SIGNATURE); 775 sshbuf_ptr(buf), sshbuf_len(buf), 0)) == -1)
724 buffer_put_string(buf, kblob, klen); 776 goto out;
725 777 KRL_DBG(("%s: signature sig len %zu", __func__, slen));
726 if (key_sign(sign_keys[i], &sblob, &slen, 778 if ((r = sshbuf_put_string(buf, sblob, slen)) != 0)
727 buffer_ptr(buf), buffer_len(buf)) == -1)
728 goto out; 779 goto out;
729 debug3("%s: signature sig len %u", __func__, slen);
730 buffer_put_string(buf, sblob, slen);
731 } 780 }
732 781
733 r = 0; 782 r = 0;
734 out: 783 out:
735 free(kblob);
736 free(sblob); 784 free(sblob);
737 buffer_free(&sect); 785 sshbuf_free(sect);
738 return r; 786 return r;
739} 787}
740 788
@@ -746,194 +794,178 @@ format_timestamp(u_int64_t timestamp, char *ts, size_t nts)
746 794
747 t = timestamp; 795 t = timestamp;
748 tm = localtime(&t); 796 tm = localtime(&t);
749 *ts = '\0'; 797 if (tm == NULL)
750 strftime(ts, nts, "%Y%m%dT%H%M%S", tm); 798 strlcpy(ts, "<INVALID>", nts);
799 else {
800 *ts = '\0';
801 strftime(ts, nts, "%Y%m%dT%H%M%S", tm);
802 }
751} 803}
752 804
753static int 805static int
754parse_revoked_certs(Buffer *buf, struct ssh_krl *krl) 806parse_revoked_certs(struct sshbuf *buf, struct ssh_krl *krl)
755{ 807{
756 int ret = -1, nbits; 808 int r = SSH_ERR_INTERNAL_ERROR;
757 u_char type; 809 u_char type;
758 const u_char *blob; 810 const u_char *blob;
759 u_int blen; 811 size_t blen, nbits;
760 Buffer subsect; 812 struct sshbuf *subsect = NULL;
761 u_int64_t serial, serial_lo, serial_hi; 813 u_int64_t serial, serial_lo, serial_hi;
762 BIGNUM *bitmap = NULL; 814 struct bitmap *bitmap = NULL;
763 char *key_id = NULL; 815 char *key_id = NULL;
764 Key *ca_key = NULL; 816 struct sshkey *ca_key = NULL;
765 817
766 buffer_init(&subsect); 818 if ((subsect = sshbuf_new()) == NULL)
819 return SSH_ERR_ALLOC_FAIL;
767 820
768 if ((blob = buffer_get_string_ptr_ret(buf, &blen)) == NULL || 821 /* Header: key, reserved */
769 buffer_get_string_ptr_ret(buf, NULL) == NULL) { /* reserved */ 822 if ((r = sshbuf_get_string_direct(buf, &blob, &blen)) != 0 ||
770 error("%s: buffer error", __func__); 823 (r = sshbuf_skip_string(buf)) != 0)
771 goto out; 824 goto out;
772 } 825 if (blen != 0 && (r = sshkey_from_blob(blob, blen, &ca_key)) != 0)
773 if ((ca_key = key_from_blob(blob, blen)) == NULL)
774 goto out; 826 goto out;
775 827
776 while (buffer_len(buf) > 0) { 828 while (sshbuf_len(buf) > 0) {
777 if (buffer_get_char_ret(&type, buf) != 0 || 829 if (subsect != NULL) {
778 (blob = buffer_get_string_ptr_ret(buf, &blen)) == NULL) { 830 sshbuf_free(subsect);
779 error("%s: buffer error", __func__); 831 subsect = NULL;
780 goto out;
781 } 832 }
782 buffer_clear(&subsect); 833 if ((r = sshbuf_get_u8(buf, &type)) != 0 ||
783 buffer_append(&subsect, blob, blen); 834 (r = sshbuf_froms(buf, &subsect)) != 0)
784 debug3("%s: subsection type 0x%02x", __func__, type); 835 goto out;
785 /* buffer_dump(&subsect); */ 836 KRL_DBG(("%s: subsection type 0x%02x", __func__, type));
837 /* sshbuf_dump(subsect, stderr); */
786 838
787 switch (type) { 839 switch (type) {
788 case KRL_SECTION_CERT_SERIAL_LIST: 840 case KRL_SECTION_CERT_SERIAL_LIST:
789 while (buffer_len(&subsect) > 0) { 841 while (sshbuf_len(subsect) > 0) {
790 if (buffer_get_int64_ret(&serial, 842 if ((r = sshbuf_get_u64(subsect, &serial)) != 0)
791 &subsect) != 0) {
792 error("%s: buffer error", __func__);
793 goto out; 843 goto out;
794 } 844 if ((r = ssh_krl_revoke_cert_by_serial(krl,
795 if (ssh_krl_revoke_cert_by_serial(krl, ca_key, 845 ca_key, serial)) != 0)
796 serial) != 0) {
797 error("%s: update failed", __func__);
798 goto out; 846 goto out;
799 }
800 } 847 }
801 break; 848 break;
802 case KRL_SECTION_CERT_SERIAL_RANGE: 849 case KRL_SECTION_CERT_SERIAL_RANGE:
803 if (buffer_get_int64_ret(&serial_lo, &subsect) != 0 || 850 if ((r = sshbuf_get_u64(subsect, &serial_lo)) != 0 ||
804 buffer_get_int64_ret(&serial_hi, &subsect) != 0) { 851 (r = sshbuf_get_u64(subsect, &serial_hi)) != 0)
805 error("%s: buffer error", __func__);
806 goto out; 852 goto out;
807 } 853 if ((r = ssh_krl_revoke_cert_by_serial_range(krl,
808 if (ssh_krl_revoke_cert_by_serial_range(krl, ca_key, 854 ca_key, serial_lo, serial_hi)) != 0)
809 serial_lo, serial_hi) != 0) {
810 error("%s: update failed", __func__);
811 goto out; 855 goto out;
812 }
813 break; 856 break;
814 case KRL_SECTION_CERT_SERIAL_BITMAP: 857 case KRL_SECTION_CERT_SERIAL_BITMAP:
815 if ((bitmap = BN_new()) == NULL) { 858 if ((bitmap = bitmap_new()) == NULL) {
816 error("%s: BN_new", __func__); 859 r = SSH_ERR_ALLOC_FAIL;
817 goto out; 860 goto out;
818 } 861 }
819 if (buffer_get_int64_ret(&serial_lo, &subsect) != 0 || 862 if ((r = sshbuf_get_u64(subsect, &serial_lo)) != 0 ||
820 buffer_get_bignum2_ret(&subsect, bitmap) != 0) { 863 (r = sshbuf_get_bignum2_bytes_direct(subsect,
821 error("%s: buffer error", __func__); 864 &blob, &blen)) != 0)
822 goto out; 865 goto out;
823 } 866 if (bitmap_from_string(bitmap, blob, blen) != 0) {
824 if ((nbits = BN_num_bits(bitmap)) < 0) { 867 r = SSH_ERR_INVALID_FORMAT;
825 error("%s: bitmap bits < 0", __func__);
826 goto out; 868 goto out;
827 } 869 }
828 for (serial = 0; serial < (u_int)nbits; serial++) { 870 nbits = bitmap_nbits(bitmap);
871 for (serial = 0; serial < (u_int64_t)nbits; serial++) {
829 if (serial > 0 && serial_lo + serial == 0) { 872 if (serial > 0 && serial_lo + serial == 0) {
830 error("%s: bitmap wraps u64", __func__); 873 error("%s: bitmap wraps u64", __func__);
874 r = SSH_ERR_INVALID_FORMAT;
831 goto out; 875 goto out;
832 } 876 }
833 if (!BN_is_bit_set(bitmap, serial)) 877 if (!bitmap_test_bit(bitmap, serial))
834 continue; 878 continue;
835 if (ssh_krl_revoke_cert_by_serial(krl, ca_key, 879 if ((r = ssh_krl_revoke_cert_by_serial(krl,
836 serial_lo + serial) != 0) { 880 ca_key, serial_lo + serial)) != 0)
837 error("%s: update failed", __func__);
838 goto out; 881 goto out;
839 }
840 } 882 }
841 BN_free(bitmap); 883 bitmap_free(bitmap);
842 bitmap = NULL; 884 bitmap = NULL;
843 break; 885 break;
844 case KRL_SECTION_CERT_KEY_ID: 886 case KRL_SECTION_CERT_KEY_ID:
845 while (buffer_len(&subsect) > 0) { 887 while (sshbuf_len(subsect) > 0) {
846 if ((key_id = buffer_get_cstring_ret(&subsect, 888 if ((r = sshbuf_get_cstring(subsect,
847 NULL)) == NULL) { 889 &key_id, NULL)) != 0)
848 error("%s: buffer error", __func__);
849 goto out; 890 goto out;
850 } 891 if ((r = ssh_krl_revoke_cert_by_key_id(krl,
851 if (ssh_krl_revoke_cert_by_key_id(krl, ca_key, 892 ca_key, key_id)) != 0)
852 key_id) != 0) {
853 error("%s: update failed", __func__);
854 goto out; 893 goto out;
855 }
856 free(key_id); 894 free(key_id);
857 key_id = NULL; 895 key_id = NULL;
858 } 896 }
859 break; 897 break;
860 default: 898 default:
861 error("Unsupported KRL certificate section %u", type); 899 error("Unsupported KRL certificate section %u", type);
900 r = SSH_ERR_INVALID_FORMAT;
862 goto out; 901 goto out;
863 } 902 }
864 if (buffer_len(&subsect) > 0) { 903 if (sshbuf_len(subsect) > 0) {
865 error("KRL certificate section contains unparsed data"); 904 error("KRL certificate section contains unparsed data");
905 r = SSH_ERR_INVALID_FORMAT;
866 goto out; 906 goto out;
867 } 907 }
868 } 908 }
869 909
870 ret = 0; 910 r = 0;
871 out: 911 out:
872 if (ca_key != NULL)
873 key_free(ca_key);
874 if (bitmap != NULL) 912 if (bitmap != NULL)
875 BN_free(bitmap); 913 bitmap_free(bitmap);
876 free(key_id); 914 free(key_id);
877 buffer_free(&subsect); 915 sshkey_free(ca_key);
878 return ret; 916 sshbuf_free(subsect);
917 return r;
879} 918}
880 919
881 920
882/* Attempt to parse a KRL, checking its signature (if any) with sign_ca_keys. */ 921/* Attempt to parse a KRL, checking its signature (if any) with sign_ca_keys. */
883int 922int
884ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp, 923ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp,
885 const Key **sign_ca_keys, u_int nsign_ca_keys) 924 const struct sshkey **sign_ca_keys, size_t nsign_ca_keys)
886{ 925{
887 Buffer copy, sect; 926 struct sshbuf *copy = NULL, *sect = NULL;
888 struct ssh_krl *krl; 927 struct ssh_krl *krl = NULL;
889 char timestamp[64]; 928 char timestamp[64];
890 int ret = -1, r, sig_seen; 929 int r = SSH_ERR_INTERNAL_ERROR, sig_seen;
891 Key *key = NULL, **ca_used = NULL; 930 struct sshkey *key = NULL, **ca_used = NULL, **tmp_ca_used;
892 u_char type, *rdata = NULL; 931 u_char type, *rdata = NULL;
893 const u_char *blob; 932 const u_char *blob;
894 u_int i, j, sig_off, sects_off, rlen, blen, format_version, nca_used; 933 size_t i, j, sig_off, sects_off, rlen, blen, nca_used;
934 u_int format_version;
895 935
896 nca_used = 0; 936 nca_used = 0;
897 *krlp = NULL; 937 *krlp = NULL;
898 if (buffer_len(buf) < sizeof(KRL_MAGIC) - 1 || 938 if (sshbuf_len(buf) < sizeof(KRL_MAGIC) - 1 ||
899 memcmp(buffer_ptr(buf), KRL_MAGIC, sizeof(KRL_MAGIC) - 1) != 0) { 939 memcmp(sshbuf_ptr(buf), KRL_MAGIC, sizeof(KRL_MAGIC) - 1) != 0) {
900 debug3("%s: not a KRL", __func__); 940 debug3("%s: not a KRL", __func__);
901 /* 941 return SSH_ERR_KRL_BAD_MAGIC;
902 * Return success but a NULL *krlp here to signal that the
903 * file might be a simple list of keys.
904 */
905 return 0;
906 } 942 }
907 943
908 /* Take a copy of the KRL buffer so we can verify its signature later */ 944 /* Take a copy of the KRL buffer so we can verify its signature later */
909 buffer_init(&copy); 945 if ((copy = sshbuf_fromb(buf)) == NULL) {
910 buffer_append(&copy, buffer_ptr(buf), buffer_len(buf)); 946 r = SSH_ERR_ALLOC_FAIL;
911 947 goto out;
912 buffer_init(&sect); 948 }
913 buffer_consume(&copy, sizeof(KRL_MAGIC) - 1); 949 if ((r = sshbuf_consume(copy, sizeof(KRL_MAGIC) - 1)) != 0)
950 goto out;
914 951
915 if ((krl = ssh_krl_init()) == NULL) { 952 if ((krl = ssh_krl_init()) == NULL) {
916 error("%s: alloc failed", __func__); 953 error("%s: alloc failed", __func__);
917 goto out; 954 goto out;
918 } 955 }
919 956
920 if (buffer_get_int_ret(&format_version, &copy) != 0) { 957 if ((r = sshbuf_get_u32(copy, &format_version)) != 0)
921 error("%s: KRL truncated", __func__);
922 goto out; 958 goto out;
923 }
924 if (format_version != KRL_FORMAT_VERSION) { 959 if (format_version != KRL_FORMAT_VERSION) {
925 error("%s: KRL unsupported format version %u", 960 r = SSH_ERR_INVALID_FORMAT;
926 __func__, format_version);
927 goto out; 961 goto out;
928 } 962 }
929 if (buffer_get_int64_ret(&krl->krl_version, &copy) != 0 || 963 if ((r = sshbuf_get_u64(copy, &krl->krl_version)) != 0 ||
930 buffer_get_int64_ret(&krl->generated_date, &copy) != 0 || 964 (r = sshbuf_get_u64(copy, &krl->generated_date)) != 0 ||
931 buffer_get_int64_ret(&krl->flags, &copy) != 0 || 965 (r = sshbuf_get_u64(copy, &krl->flags)) != 0 ||
932 buffer_get_string_ptr_ret(&copy, NULL) == NULL || /* reserved */ 966 (r = sshbuf_skip_string(copy)) != 0 ||
933 (krl->comment = buffer_get_cstring_ret(&copy, NULL)) == NULL) { 967 (r = sshbuf_get_cstring(copy, &krl->comment, NULL)) != 0)
934 error("%s: buffer error", __func__);
935 goto out; 968 goto out;
936 }
937 969
938 format_timestamp(krl->generated_date, timestamp, sizeof(timestamp)); 970 format_timestamp(krl->generated_date, timestamp, sizeof(timestamp));
939 debug("KRL version %llu generated at %s%s%s", 971 debug("KRL version %llu generated at %s%s%s",
@@ -945,18 +977,22 @@ ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp,
945 * detailed parsing of data whose provenance is unverified. 977 * detailed parsing of data whose provenance is unverified.
946 */ 978 */
947 sig_seen = 0; 979 sig_seen = 0;
948 sects_off = buffer_len(buf) - buffer_len(&copy); 980 if (sshbuf_len(buf) < sshbuf_len(copy)) {
949 while (buffer_len(&copy) > 0) { 981 /* Shouldn't happen */
950 if (buffer_get_char_ret(&type, &copy) != 0 || 982 r = SSH_ERR_INTERNAL_ERROR;
951 (blob = buffer_get_string_ptr_ret(&copy, &blen)) == NULL) { 983 goto out;
952 error("%s: buffer error", __func__); 984 }
985 sects_off = sshbuf_len(buf) - sshbuf_len(copy);
986 while (sshbuf_len(copy) > 0) {
987 if ((r = sshbuf_get_u8(copy, &type)) != 0 ||
988 (r = sshbuf_get_string_direct(copy, &blob, &blen)) != 0)
953 goto out; 989 goto out;
954 } 990 KRL_DBG(("%s: first pass, section 0x%02x", __func__, type));
955 debug3("%s: first pass, section 0x%02x", __func__, type);
956 if (type != KRL_SECTION_SIGNATURE) { 991 if (type != KRL_SECTION_SIGNATURE) {
957 if (sig_seen) { 992 if (sig_seen) {
958 error("KRL contains non-signature section " 993 error("KRL contains non-signature section "
959 "after signature"); 994 "after signature");
995 r = SSH_ERR_INVALID_FORMAT;
960 goto out; 996 goto out;
961 } 997 }
962 /* Not interested for now. */ 998 /* Not interested for now. */
@@ -964,94 +1000,114 @@ ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp,
964 } 1000 }
965 sig_seen = 1; 1001 sig_seen = 1;
966 /* First string component is the signing key */ 1002 /* First string component is the signing key */
967 if ((key = key_from_blob(blob, blen)) == NULL) { 1003 if ((r = sshkey_from_blob(blob, blen, &key)) != 0) {
968 error("%s: invalid signature key", __func__); 1004 r = SSH_ERR_INVALID_FORMAT;
1005 goto out;
1006 }
1007 if (sshbuf_len(buf) < sshbuf_len(copy)) {
1008 /* Shouldn't happen */
1009 r = SSH_ERR_INTERNAL_ERROR;
969 goto out; 1010 goto out;
970 } 1011 }
971 sig_off = buffer_len(buf) - buffer_len(&copy); 1012 sig_off = sshbuf_len(buf) - sshbuf_len(copy);
972 /* Second string component is the signature itself */ 1013 /* Second string component is the signature itself */
973 if ((blob = buffer_get_string_ptr_ret(&copy, &blen)) == NULL) { 1014 if ((r = sshbuf_get_string_direct(copy, &blob, &blen)) != 0) {
974 error("%s: buffer error", __func__); 1015 r = SSH_ERR_INVALID_FORMAT;
975 goto out; 1016 goto out;
976 } 1017 }
977 /* Check signature over entire KRL up to this point */ 1018 /* Check signature over entire KRL up to this point */
978 if (key_verify(key, blob, blen, 1019 if ((r = sshkey_verify(key, blob, blen,
979 buffer_ptr(buf), buffer_len(buf) - sig_off) != 1) { 1020 sshbuf_ptr(buf), sshbuf_len(buf) - sig_off, 0)) != 0)
980 error("bad signaure on KRL");
981 goto out; 1021 goto out;
982 }
983 /* Check if this key has already signed this KRL */ 1022 /* Check if this key has already signed this KRL */
984 for (i = 0; i < nca_used; i++) { 1023 for (i = 0; i < nca_used; i++) {
985 if (key_equal(ca_used[i], key)) { 1024 if (sshkey_equal(ca_used[i], key)) {
986 error("KRL signed more than once with " 1025 error("KRL signed more than once with "
987 "the same key"); 1026 "the same key");
1027 r = SSH_ERR_INVALID_FORMAT;
988 goto out; 1028 goto out;
989 } 1029 }
990 } 1030 }
991 /* Record keys used to sign the KRL */ 1031 /* Record keys used to sign the KRL */
992 ca_used = xrealloc(ca_used, nca_used + 1, sizeof(*ca_used)); 1032 tmp_ca_used = reallocarray(ca_used, nca_used + 1,
1033 sizeof(*ca_used));
1034 if (tmp_ca_used == NULL) {
1035 r = SSH_ERR_ALLOC_FAIL;
1036 goto out;
1037 }
1038 ca_used = tmp_ca_used;
993 ca_used[nca_used++] = key; 1039 ca_used[nca_used++] = key;
994 key = NULL; 1040 key = NULL;
995 break; 1041 break;
996 } 1042 }
997 1043
1044 if (sshbuf_len(copy) != 0) {
1045 /* Shouldn't happen */
1046 r = SSH_ERR_INTERNAL_ERROR;
1047 goto out;
1048 }
1049
998 /* 1050 /*
999 * 2nd pass: parse and load the KRL, skipping the header to the point 1051 * 2nd pass: parse and load the KRL, skipping the header to the point
1000 * where the section start. 1052 * where the section start.
1001 */ 1053 */
1002 buffer_append(&copy, (u_char*)buffer_ptr(buf) + sects_off, 1054 sshbuf_free(copy);
1003 buffer_len(buf) - sects_off); 1055 if ((copy = sshbuf_fromb(buf)) == NULL) {
1004 while (buffer_len(&copy) > 0) { 1056 r = SSH_ERR_ALLOC_FAIL;
1005 if (buffer_get_char_ret(&type, &copy) != 0 || 1057 goto out;
1006 (blob = buffer_get_string_ptr_ret(&copy, &blen)) == NULL) { 1058 }
1007 error("%s: buffer error", __func__); 1059 if ((r = sshbuf_consume(copy, sects_off)) != 0)
1008 goto out; 1060 goto out;
1061 while (sshbuf_len(copy) > 0) {
1062 if (sect != NULL) {
1063 sshbuf_free(sect);
1064 sect = NULL;
1009 } 1065 }
1010 debug3("%s: second pass, section 0x%02x", __func__, type); 1066 if ((r = sshbuf_get_u8(copy, &type)) != 0 ||
1011 buffer_clear(&sect); 1067 (r = sshbuf_froms(copy, &sect)) != 0)
1012 buffer_append(&sect, blob, blen); 1068 goto out;
1069 KRL_DBG(("%s: second pass, section 0x%02x", __func__, type));
1013 1070
1014 switch (type) { 1071 switch (type) {
1015 case KRL_SECTION_CERTIFICATES: 1072 case KRL_SECTION_CERTIFICATES:
1016 if ((r = parse_revoked_certs(&sect, krl)) != 0) 1073 if ((r = parse_revoked_certs(sect, krl)) != 0)
1017 goto out; 1074 goto out;
1018 break; 1075 break;
1019 case KRL_SECTION_EXPLICIT_KEY: 1076 case KRL_SECTION_EXPLICIT_KEY:
1020 case KRL_SECTION_FINGERPRINT_SHA1: 1077 case KRL_SECTION_FINGERPRINT_SHA1:
1021 while (buffer_len(&sect) > 0) { 1078 while (sshbuf_len(sect) > 0) {
1022 if ((rdata = buffer_get_string_ret(&sect, 1079 if ((r = sshbuf_get_string(sect,
1023 &rlen)) == NULL) { 1080 &rdata, &rlen)) != 0)
1024 error("%s: buffer error", __func__);
1025 goto out; 1081 goto out;
1026 }
1027 if (type == KRL_SECTION_FINGERPRINT_SHA1 && 1082 if (type == KRL_SECTION_FINGERPRINT_SHA1 &&
1028 rlen != 20) { 1083 rlen != 20) {
1029 error("%s: bad SHA1 length", __func__); 1084 error("%s: bad SHA1 length", __func__);
1085 r = SSH_ERR_INVALID_FORMAT;
1030 goto out; 1086 goto out;
1031 } 1087 }
1032 if (revoke_blob( 1088 if ((r = revoke_blob(
1033 type == KRL_SECTION_EXPLICIT_KEY ? 1089 type == KRL_SECTION_EXPLICIT_KEY ?
1034 &krl->revoked_keys : &krl->revoked_sha1s, 1090 &krl->revoked_keys : &krl->revoked_sha1s,
1035 rdata, rlen) != 0) 1091 rdata, rlen)) != 0)
1036 goto out; 1092 goto out;
1037 rdata = NULL; /* revoke_blob frees blob */ 1093 rdata = NULL; /* revoke_blob frees rdata */
1038 } 1094 }
1039 break; 1095 break;
1040 case KRL_SECTION_SIGNATURE: 1096 case KRL_SECTION_SIGNATURE:
1041 /* Handled above, but still need to stay in synch */ 1097 /* Handled above, but still need to stay in synch */
1042 buffer_clear(&sect); 1098 sshbuf_reset(sect);
1043 if ((blob = buffer_get_string_ptr_ret(&copy, 1099 sect = NULL;
1044 &blen)) == NULL) { 1100 if ((r = sshbuf_skip_string(copy)) != 0)
1045 error("%s: buffer error", __func__);
1046 goto out; 1101 goto out;
1047 }
1048 break; 1102 break;
1049 default: 1103 default:
1050 error("Unsupported KRL section %u", type); 1104 error("Unsupported KRL section %u", type);
1105 r = SSH_ERR_INVALID_FORMAT;
1051 goto out; 1106 goto out;
1052 } 1107 }
1053 if (buffer_len(&sect) > 0) { 1108 if (sshbuf_len(sect) > 0) {
1054 error("KRL section contains unparsed data"); 1109 error("KRL section contains unparsed data");
1110 r = SSH_ERR_INVALID_FORMAT;
1055 goto out; 1111 goto out;
1056 } 1112 }
1057 } 1113 }
@@ -1062,12 +1118,13 @@ ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp,
1062 if (ssh_krl_check_key(krl, ca_used[i]) == 0) 1118 if (ssh_krl_check_key(krl, ca_used[i]) == 0)
1063 sig_seen = 1; 1119 sig_seen = 1;
1064 else { 1120 else {
1065 key_free(ca_used[i]); 1121 sshkey_free(ca_used[i]);
1066 ca_used[i] = NULL; 1122 ca_used[i] = NULL;
1067 } 1123 }
1068 } 1124 }
1069 if (nca_used && !sig_seen) { 1125 if (nca_used && !sig_seen) {
1070 error("All keys used to sign KRL were revoked"); 1126 error("All keys used to sign KRL were revoked");
1127 r = SSH_ERR_KEY_REVOKED;
1071 goto out; 1128 goto out;
1072 } 1129 }
1073 1130
@@ -1078,163 +1135,169 @@ ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp,
1078 for (j = 0; j < nca_used; j++) { 1135 for (j = 0; j < nca_used; j++) {
1079 if (ca_used[j] == NULL) 1136 if (ca_used[j] == NULL)
1080 continue; 1137 continue;
1081 if (key_equal(ca_used[j], sign_ca_keys[i])) { 1138 if (sshkey_equal(ca_used[j], sign_ca_keys[i])) {
1082 sig_seen = 1; 1139 sig_seen = 1;
1083 break; 1140 break;
1084 } 1141 }
1085 } 1142 }
1086 } 1143 }
1087 if (!sig_seen) { 1144 if (!sig_seen) {
1145 r = SSH_ERR_SIGNATURE_INVALID;
1088 error("KRL not signed with any trusted key"); 1146 error("KRL not signed with any trusted key");
1089 goto out; 1147 goto out;
1090 } 1148 }
1091 } 1149 }
1092 1150
1093 *krlp = krl; 1151 *krlp = krl;
1094 ret = 0; 1152 r = 0;
1095 out: 1153 out:
1096 if (ret != 0) 1154 if (r != 0)
1097 ssh_krl_free(krl); 1155 ssh_krl_free(krl);
1098 for (i = 0; i < nca_used; i++) { 1156 for (i = 0; i < nca_used; i++)
1099 if (ca_used[i] != NULL) 1157 sshkey_free(ca_used[i]);
1100 key_free(ca_used[i]);
1101 }
1102 free(ca_used); 1158 free(ca_used);
1103 free(rdata); 1159 free(rdata);
1104 if (key != NULL) 1160 sshkey_free(key);
1105 key_free(key); 1161 sshbuf_free(copy);
1106 buffer_free(&copy); 1162 sshbuf_free(sect);
1107 buffer_free(&sect); 1163 return r;
1108 return ret;
1109} 1164}
1110 1165
1111/* Checks whether a given key/cert is revoked. Does not check its CA */ 1166/* Checks certificate serial number and key ID revocation */
1112static int 1167static int
1113is_key_revoked(struct ssh_krl *krl, const Key *key) 1168is_cert_revoked(const struct sshkey *key, struct revoked_certs *rc)
1114{ 1169{
1115 struct revoked_blob rb, *erb;
1116 struct revoked_serial rs, *ers; 1170 struct revoked_serial rs, *ers;
1117 struct revoked_key_id rki, *erki; 1171 struct revoked_key_id rki, *erki;
1118 struct revoked_certs *rc;
1119
1120 /* Check explicitly revoked hashes first */
1121 memset(&rb, 0, sizeof(rb));
1122 if ((rb.blob = key_fingerprint_raw(key, SSH_FP_SHA1, &rb.len)) == NULL)
1123 return -1;
1124 erb = RB_FIND(revoked_blob_tree, &krl->revoked_sha1s, &rb);
1125 free(rb.blob);
1126 if (erb != NULL) {
1127 debug("%s: revoked by key SHA1", __func__);
1128 return -1;
1129 }
1130
1131 /* Next, explicit keys */
1132 memset(&rb, 0, sizeof(rb));
1133 if (plain_key_blob(key, &rb.blob, &rb.len) < 0)
1134 return -1;
1135 erb = RB_FIND(revoked_blob_tree, &krl->revoked_keys, &rb);
1136 free(rb.blob);
1137 if (erb != NULL) {
1138 debug("%s: revoked by explicit key", __func__);
1139 return -1;
1140 }
1141
1142 if (!key_is_cert(key))
1143 return 0;
1144
1145 /* Check cert revocation */
1146 if (revoked_certs_for_ca_key(krl, key->cert->signature_key,
1147 &rc, 0) != 0)
1148 return -1;
1149 if (rc == NULL)
1150 return 0; /* No entry for this CA */
1151 1172
1152 /* Check revocation by cert key ID */ 1173 /* Check revocation by cert key ID */
1153 memset(&rki, 0, sizeof(rki)); 1174 memset(&rki, 0, sizeof(rki));
1154 rki.key_id = key->cert->key_id; 1175 rki.key_id = key->cert->key_id;
1155 erki = RB_FIND(revoked_key_id_tree, &rc->revoked_key_ids, &rki); 1176 erki = RB_FIND(revoked_key_id_tree, &rc->revoked_key_ids, &rki);
1156 if (erki != NULL) { 1177 if (erki != NULL) {
1157 debug("%s: revoked by key ID", __func__); 1178 KRL_DBG(("%s: revoked by key ID", __func__));
1158 return -1; 1179 return SSH_ERR_KEY_REVOKED;
1159 } 1180 }
1160 1181
1161 /* 1182 /*
1162 * Legacy cert formats lack serial numbers. Zero serials numbers 1183 * Legacy cert formats lack serial numbers. Zero serials numbers
1163 * are ignored (it's the default when the CA doesn't specify one). 1184 * are ignored (it's the default when the CA doesn't specify one).
1164 */ 1185 */
1165 if (key_cert_is_legacy(key) || key->cert->serial == 0) 1186 if (sshkey_cert_is_legacy(key) || key->cert->serial == 0)
1166 return 0; 1187 return 0;
1167 1188
1168 memset(&rs, 0, sizeof(rs)); 1189 memset(&rs, 0, sizeof(rs));
1169 rs.lo = rs.hi = key->cert->serial; 1190 rs.lo = rs.hi = key->cert->serial;
1170 ers = RB_FIND(revoked_serial_tree, &rc->revoked_serials, &rs); 1191 ers = RB_FIND(revoked_serial_tree, &rc->revoked_serials, &rs);
1171 if (ers != NULL) { 1192 if (ers != NULL) {
1172 KRL_DBG(("%s: %llu matched %llu:%llu", __func__, 1193 KRL_DBG(("%s: revoked serial %llu matched %llu:%llu", __func__,
1173 key->cert->serial, ers->lo, ers->hi)); 1194 key->cert->serial, ers->lo, ers->hi));
1174 debug("%s: revoked by serial", __func__); 1195 return SSH_ERR_KEY_REVOKED;
1175 return -1;
1176 } 1196 }
1177 KRL_DBG(("%s: %llu no match", __func__, key->cert->serial)); 1197 return 0;
1198}
1199
1200/* Checks whether a given key/cert is revoked. Does not check its CA */
1201static int
1202is_key_revoked(struct ssh_krl *krl, const struct sshkey *key)
1203{
1204 struct revoked_blob rb, *erb;
1205 struct revoked_certs *rc;
1206 int r;
1207
1208 /* Check explicitly revoked hashes first */
1209 memset(&rb, 0, sizeof(rb));
1210 if ((r = sshkey_fingerprint_raw(key, SSH_DIGEST_SHA1,
1211 &rb.blob, &rb.len)) != 0)
1212 return r;
1213 erb = RB_FIND(revoked_blob_tree, &krl->revoked_sha1s, &rb);
1214 free(rb.blob);
1215 if (erb != NULL) {
1216 KRL_DBG(("%s: revoked by key SHA1", __func__));
1217 return SSH_ERR_KEY_REVOKED;
1218 }
1219
1220 /* Next, explicit keys */
1221 memset(&rb, 0, sizeof(rb));
1222 if ((r = plain_key_blob(key, &rb.blob, &rb.len)) != 0)
1223 return r;
1224 erb = RB_FIND(revoked_blob_tree, &krl->revoked_keys, &rb);
1225 free(rb.blob);
1226 if (erb != NULL) {
1227 KRL_DBG(("%s: revoked by explicit key", __func__));
1228 return SSH_ERR_KEY_REVOKED;
1229 }
1230
1231 if (!sshkey_is_cert(key))
1232 return 0;
1178 1233
1234 /* Check cert revocation for the specified CA */
1235 if ((r = revoked_certs_for_ca_key(krl, key->cert->signature_key,
1236 &rc, 0)) != 0)
1237 return r;
1238 if (rc != NULL) {
1239 if ((r = is_cert_revoked(key, rc)) != 0)
1240 return r;
1241 }
1242 /* Check cert revocation for the wildcard CA */
1243 if ((r = revoked_certs_for_ca_key(krl, NULL, &rc, 0)) != 0)
1244 return r;
1245 if (rc != NULL) {
1246 if ((r = is_cert_revoked(key, rc)) != 0)
1247 return r;
1248 }
1249
1250 KRL_DBG(("%s: %llu no match", __func__, key->cert->serial));
1179 return 0; 1251 return 0;
1180} 1252}
1181 1253
1182int 1254int
1183ssh_krl_check_key(struct ssh_krl *krl, const Key *key) 1255ssh_krl_check_key(struct ssh_krl *krl, const struct sshkey *key)
1184{ 1256{
1185 int r; 1257 int r;
1186 1258
1187 debug2("%s: checking key", __func__); 1259 KRL_DBG(("%s: checking key", __func__));
1188 if ((r = is_key_revoked(krl, key)) != 0) 1260 if ((r = is_key_revoked(krl, key)) != 0)
1189 return r; 1261 return r;
1190 if (key_is_cert(key)) { 1262 if (sshkey_is_cert(key)) {
1191 debug2("%s: checking CA key", __func__); 1263 debug2("%s: checking CA key", __func__);
1192 if ((r = is_key_revoked(krl, key->cert->signature_key)) != 0) 1264 if ((r = is_key_revoked(krl, key->cert->signature_key)) != 0)
1193 return r; 1265 return r;
1194 } 1266 }
1195 debug3("%s: key okay", __func__); 1267 KRL_DBG(("%s: key okay", __func__));
1196 return 0; 1268 return 0;
1197} 1269}
1198 1270
1199/* Returns 0 on success, -1 on error or key revoked, -2 if path is not a KRL */
1200int 1271int
1201ssh_krl_file_contains_key(const char *path, const Key *key) 1272ssh_krl_file_contains_key(const char *path, const struct sshkey *key)
1202{ 1273{
1203 Buffer krlbuf; 1274 struct sshbuf *krlbuf = NULL;
1204 struct ssh_krl *krl; 1275 struct ssh_krl *krl = NULL;
1205 int revoked, fd; 1276 int oerrno = 0, r, fd;
1206 1277
1207 if (path == NULL) 1278 if (path == NULL)
1208 return 0; 1279 return 0;
1209 1280
1281 if ((krlbuf = sshbuf_new()) == NULL)
1282 return SSH_ERR_ALLOC_FAIL;
1210 if ((fd = open(path, O_RDONLY)) == -1) { 1283 if ((fd = open(path, O_RDONLY)) == -1) {
1211 error("open %s: %s", path, strerror(errno)); 1284 r = SSH_ERR_SYSTEM_ERROR;
1212 error("Revoked keys file not accessible - refusing public key " 1285 oerrno = errno;
1213 "authentication"); 1286 goto out;
1214 return -1;
1215 }
1216 buffer_init(&krlbuf);
1217 if (!key_load_file(fd, path, &krlbuf)) {
1218 close(fd);
1219 buffer_free(&krlbuf);
1220 error("Revoked keys file not readable - refusing public key "
1221 "authentication");
1222 return -1;
1223 }
1224 close(fd);
1225 if (ssh_krl_from_blob(&krlbuf, &krl, NULL, 0) != 0) {
1226 buffer_free(&krlbuf);
1227 error("Invalid KRL, refusing public key "
1228 "authentication");
1229 return -1;
1230 } 1287 }
1231 buffer_free(&krlbuf); 1288 if ((r = sshkey_load_file(fd, krlbuf)) != 0) {
1232 if (krl == NULL) { 1289 oerrno = errno;
1233 debug3("%s: %s is not a KRL file", __func__, path); 1290 goto out;
1234 return -2;
1235 } 1291 }
1292 if ((r = ssh_krl_from_blob(krlbuf, &krl, NULL, 0)) != 0)
1293 goto out;
1236 debug2("%s: checking KRL %s", __func__, path); 1294 debug2("%s: checking KRL %s", __func__, path);
1237 revoked = ssh_krl_check_key(krl, key) != 0; 1295 r = ssh_krl_check_key(krl, key);
1296 out:
1297 close(fd);
1298 sshbuf_free(krlbuf);
1238 ssh_krl_free(krl); 1299 ssh_krl_free(krl);
1239 return revoked ? -1 : 0; 1300 if (r != 0)
1301 errno = oerrno;
1302 return r;
1240} 1303}
diff --git a/krl.h b/krl.h
index 2c43f5bb2..4e12befc3 100644
--- a/krl.h
+++ b/krl.h
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17/* $OpenBSD: krl.h,v 1.2 2013/01/18 00:24:58 djm Exp $ */ 17/* $OpenBSD: krl.h,v 1.4 2015/01/13 19:06:49 djm Exp $ */
18 18
19#ifndef _KRL_H 19#ifndef _KRL_H
20#define _KRL_H 20#define _KRL_H
@@ -36,28 +36,30 @@
36#define KRL_SECTION_CERT_SERIAL_BITMAP 0x22 36#define KRL_SECTION_CERT_SERIAL_BITMAP 0x22
37#define KRL_SECTION_CERT_KEY_ID 0x23 37#define KRL_SECTION_CERT_KEY_ID 0x23
38 38
39struct sshkey;
40struct sshbuf;
39struct ssh_krl; 41struct ssh_krl;
40 42
41struct ssh_krl *ssh_krl_init(void); 43struct ssh_krl *ssh_krl_init(void);
42void ssh_krl_free(struct ssh_krl *krl); 44void ssh_krl_free(struct ssh_krl *krl);
43void ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version); 45void ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version);
44void ssh_krl_set_sign_key(struct ssh_krl *krl, const Key *sign_key); 46void ssh_krl_set_sign_key(struct ssh_krl *krl, const struct sshkey *sign_key);
45void ssh_krl_set_comment(struct ssh_krl *krl, const char *comment); 47int ssh_krl_set_comment(struct ssh_krl *krl, const char *comment);
46int ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl, const Key *ca_key, 48int ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl,
47 u_int64_t serial); 49 const struct sshkey *ca_key, u_int64_t serial);
48int ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl, const Key *ca_key, 50int ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl,
49 u_int64_t lo, u_int64_t hi); 51 const struct sshkey *ca_key, u_int64_t lo, u_int64_t hi);
50int ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, const Key *ca_key, 52int ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl,
51 const char *key_id); 53 const struct sshkey *ca_key, const char *key_id);
52int ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const Key *key); 54int ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const struct sshkey *key);
53int ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const Key *key); 55int ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const struct sshkey *key);
54int ssh_krl_revoke_key(struct ssh_krl *krl, const Key *key); 56int ssh_krl_revoke_key(struct ssh_krl *krl, const struct sshkey *key);
55int ssh_krl_to_blob(struct ssh_krl *krl, Buffer *buf, const Key **sign_keys, 57int ssh_krl_to_blob(struct ssh_krl *krl, struct sshbuf *buf,
56 u_int nsign_keys); 58 const struct sshkey **sign_keys, u_int nsign_keys);
57int ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp, 59int ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp,
58 const Key **sign_ca_keys, u_int nsign_ca_keys); 60 const struct sshkey **sign_ca_keys, size_t nsign_ca_keys);
59int ssh_krl_check_key(struct ssh_krl *krl, const Key *key); 61int ssh_krl_check_key(struct ssh_krl *krl, const struct sshkey *key);
60int ssh_krl_file_contains_key(const char *path, const Key *key); 62int ssh_krl_file_contains_key(const char *path, const struct sshkey *key);
61 63
62#endif /* _KRL_H */ 64#endif /* _KRL_H */
63 65
diff --git a/loginrec.c b/loginrec.c
index 4219b9aef..94ae81dc6 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -787,12 +787,12 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx)
787 /* this is just a 128-bit IPv6 address */ 787 /* this is just a 128-bit IPv6 address */
788 if (li->hostaddr.sa.sa_family == AF_INET6) { 788 if (li->hostaddr.sa.sa_family == AF_INET6) {
789 sa6 = ((struct sockaddr_in6 *)&li->hostaddr.sa); 789 sa6 = ((struct sockaddr_in6 *)&li->hostaddr.sa);
790 memcpy(ut->ut_addr_v6, sa6->sin6_addr.s6_addr, 16); 790 memcpy(utx->ut_addr_v6, sa6->sin6_addr.s6_addr, 16);
791 if (IN6_IS_ADDR_V4MAPPED(&sa6->sin6_addr)) { 791 if (IN6_IS_ADDR_V4MAPPED(&sa6->sin6_addr)) {
792 ut->ut_addr_v6[0] = ut->ut_addr_v6[3]; 792 utx->ut_addr_v6[0] = utx->ut_addr_v6[3];
793 ut->ut_addr_v6[1] = 0; 793 utx->ut_addr_v6[1] = 0;
794 ut->ut_addr_v6[2] = 0; 794 utx->ut_addr_v6[2] = 0;
795 ut->ut_addr_v6[3] = 0; 795 utx->ut_addr_v6[3] = 0;
796 } 796 }
797 } 797 }
798# endif 798# endif
diff --git a/mac.c b/mac.c
index 402dc984c..f63fbff09 100644
--- a/mac.c
+++ b/mac.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mac.c,v 1.30 2014/04/30 19:07:48 naddy Exp $ */ 1/* $OpenBSD: mac.c,v 1.32 2015/01/15 18:32:54 naddy Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * 4 *
@@ -27,22 +27,16 @@
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29 29
30#include <stdarg.h>
31#include <string.h> 30#include <string.h>
32#include <signal.h> 31#include <stdio.h>
33
34#include "xmalloc.h"
35#include "log.h"
36#include "cipher.h"
37#include "buffer.h"
38#include "key.h"
39#include "kex.h"
40#include "mac.h"
41#include "misc.h"
42 32
43#include "digest.h" 33#include "digest.h"
44#include "hmac.h" 34#include "hmac.h"
45#include "umac.h" 35#include "umac.h"
36#include "mac.h"
37#include "misc.h"
38#include "ssherr.h"
39#include "sshbuf.h"
46 40
47#include "openbsd-compat/openssl-compat.h" 41#include "openbsd-compat/openssl-compat.h"
48 42
@@ -95,7 +89,7 @@ static const struct macalg macs[] = {
95char * 89char *
96mac_alg_list(char sep) 90mac_alg_list(char sep)
97{ 91{
98 char *ret = NULL; 92 char *ret = NULL, *tmp;
99 size_t nlen, rlen = 0; 93 size_t nlen, rlen = 0;
100 const struct macalg *m; 94 const struct macalg *m;
101 95
@@ -103,20 +97,24 @@ mac_alg_list(char sep)
103 if (ret != NULL) 97 if (ret != NULL)
104 ret[rlen++] = sep; 98 ret[rlen++] = sep;
105 nlen = strlen(m->name); 99 nlen = strlen(m->name);
106 ret = xrealloc(ret, 1, rlen + nlen + 2); 100 if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
101 free(ret);
102 return NULL;
103 }
104 ret = tmp;
107 memcpy(ret + rlen, m->name, nlen + 1); 105 memcpy(ret + rlen, m->name, nlen + 1);
108 rlen += nlen; 106 rlen += nlen;
109 } 107 }
110 return ret; 108 return ret;
111} 109}
112 110
113static void 111static int
114mac_setup_by_alg(Mac *mac, const struct macalg *macalg) 112mac_setup_by_alg(struct sshmac *mac, const struct macalg *macalg)
115{ 113{
116 mac->type = macalg->type; 114 mac->type = macalg->type;
117 if (mac->type == SSH_DIGEST) { 115 if (mac->type == SSH_DIGEST) {
118 if ((mac->hmac_ctx = ssh_hmac_start(macalg->alg)) == NULL) 116 if ((mac->hmac_ctx = ssh_hmac_start(macalg->alg)) == NULL)
119 fatal("ssh_hmac_start(alg=%d) failed", macalg->alg); 117 return SSH_ERR_ALLOC_FAIL;
120 mac->key_len = mac->mac_len = ssh_hmac_bytes(macalg->alg); 118 mac->key_len = mac->mac_len = ssh_hmac_bytes(macalg->alg);
121 } else { 119 } else {
122 mac->mac_len = macalg->len / 8; 120 mac->mac_len = macalg->len / 8;
@@ -126,61 +124,61 @@ mac_setup_by_alg(Mac *mac, const struct macalg *macalg)
126 if (macalg->truncatebits != 0) 124 if (macalg->truncatebits != 0)
127 mac->mac_len = macalg->truncatebits / 8; 125 mac->mac_len = macalg->truncatebits / 8;
128 mac->etm = macalg->etm; 126 mac->etm = macalg->etm;
127 return 0;
129} 128}
130 129
131int 130int
132mac_setup(Mac *mac, char *name) 131mac_setup(struct sshmac *mac, char *name)
133{ 132{
134 const struct macalg *m; 133 const struct macalg *m;
135 134
136 for (m = macs; m->name != NULL; m++) { 135 for (m = macs; m->name != NULL; m++) {
137 if (strcmp(name, m->name) != 0) 136 if (strcmp(name, m->name) != 0)
138 continue; 137 continue;
139 if (mac != NULL) { 138 if (mac != NULL)
140 mac_setup_by_alg(mac, m); 139 return mac_setup_by_alg(mac, m);
141 debug2("mac_setup: setup %s", name); 140 return 0;
142 }
143 return (0);
144 } 141 }
145 debug2("mac_setup: unknown %s", name); 142 return SSH_ERR_INVALID_ARGUMENT;
146 return (-1);
147} 143}
148 144
149int 145int
150mac_init(Mac *mac) 146mac_init(struct sshmac *mac)
151{ 147{
152 if (mac->key == NULL) 148 if (mac->key == NULL)
153 fatal("%s: no key", __func__); 149 return SSH_ERR_INVALID_ARGUMENT;
154 switch (mac->type) { 150 switch (mac->type) {
155 case SSH_DIGEST: 151 case SSH_DIGEST:
156 if (mac->hmac_ctx == NULL || 152 if (mac->hmac_ctx == NULL ||
157 ssh_hmac_init(mac->hmac_ctx, mac->key, mac->key_len) < 0) 153 ssh_hmac_init(mac->hmac_ctx, mac->key, mac->key_len) < 0)
158 return -1; 154 return SSH_ERR_INVALID_ARGUMENT;
159 return 0; 155 return 0;
160 case SSH_UMAC: 156 case SSH_UMAC:
161 mac->umac_ctx = umac_new(mac->key); 157 if ((mac->umac_ctx = umac_new(mac->key)) == NULL)
158 return SSH_ERR_ALLOC_FAIL;
162 return 0; 159 return 0;
163 case SSH_UMAC128: 160 case SSH_UMAC128:
164 mac->umac_ctx = umac128_new(mac->key); 161 if ((mac->umac_ctx = umac128_new(mac->key)) == NULL)
162 return SSH_ERR_ALLOC_FAIL;
165 return 0; 163 return 0;
166 default: 164 default:
167 return -1; 165 return SSH_ERR_INVALID_ARGUMENT;
168 } 166 }
169} 167}
170 168
171u_char * 169int
172mac_compute(Mac *mac, u_int32_t seqno, u_char *data, int datalen) 170mac_compute(struct sshmac *mac, u_int32_t seqno, const u_char *data, int datalen,
171 u_char *digest, size_t dlen)
173{ 172{
174 static union { 173 static union {
175 u_char m[EVP_MAX_MD_SIZE]; 174 u_char m[SSH_DIGEST_MAX_LENGTH];
176 u_int64_t for_align; 175 u_int64_t for_align;
177 } u; 176 } u;
178 u_char b[4]; 177 u_char b[4];
179 u_char nonce[8]; 178 u_char nonce[8];
180 179
181 if (mac->mac_len > sizeof(u)) 180 if (mac->mac_len > sizeof(u))
182 fatal("mac_compute: mac too long %u %zu", 181 return SSH_ERR_INTERNAL_ERROR;
183 mac->mac_len, sizeof(u));
184 182
185 switch (mac->type) { 183 switch (mac->type) {
186 case SSH_DIGEST: 184 case SSH_DIGEST:
@@ -190,10 +188,10 @@ mac_compute(Mac *mac, u_int32_t seqno, u_char *data, int datalen)
190 ssh_hmac_update(mac->hmac_ctx, b, sizeof(b)) < 0 || 188 ssh_hmac_update(mac->hmac_ctx, b, sizeof(b)) < 0 ||
191 ssh_hmac_update(mac->hmac_ctx, data, datalen) < 0 || 189 ssh_hmac_update(mac->hmac_ctx, data, datalen) < 0 ||
192 ssh_hmac_final(mac->hmac_ctx, u.m, sizeof(u.m)) < 0) 190 ssh_hmac_final(mac->hmac_ctx, u.m, sizeof(u.m)) < 0)
193 fatal("ssh_hmac failed"); 191 return SSH_ERR_LIBCRYPTO_ERROR;
194 break; 192 break;
195 case SSH_UMAC: 193 case SSH_UMAC:
196 put_u64(nonce, seqno); 194 POKE_U64(nonce, seqno);
197 umac_update(mac->umac_ctx, data, datalen); 195 umac_update(mac->umac_ctx, data, datalen);
198 umac_final(mac->umac_ctx, u.m, nonce); 196 umac_final(mac->umac_ctx, u.m, nonce);
199 break; 197 break;
@@ -203,13 +201,18 @@ mac_compute(Mac *mac, u_int32_t seqno, u_char *data, int datalen)
203 umac128_final(mac->umac_ctx, u.m, nonce); 201 umac128_final(mac->umac_ctx, u.m, nonce);
204 break; 202 break;
205 default: 203 default:
206 fatal("mac_compute: unknown MAC type"); 204 return SSH_ERR_INVALID_ARGUMENT;
207 } 205 }
208 return (u.m); 206 if (digest != NULL) {
207 if (dlen > mac->mac_len)
208 dlen = mac->mac_len;
209 memcpy(digest, u.m, dlen);
210 }
211 return 0;
209} 212}
210 213
211void 214void
212mac_clear(Mac *mac) 215mac_clear(struct sshmac *mac)
213{ 216{
214 if (mac->type == SSH_UMAC) { 217 if (mac->type == SSH_UMAC) {
215 if (mac->umac_ctx != NULL) 218 if (mac->umac_ctx != NULL)
@@ -231,17 +234,16 @@ mac_valid(const char *names)
231 char *maclist, *cp, *p; 234 char *maclist, *cp, *p;
232 235
233 if (names == NULL || strcmp(names, "") == 0) 236 if (names == NULL || strcmp(names, "") == 0)
234 return (0); 237 return 0;
235 maclist = cp = xstrdup(names); 238 if ((maclist = cp = strdup(names)) == NULL)
239 return 0;
236 for ((p = strsep(&cp, MAC_SEP)); p && *p != '\0'; 240 for ((p = strsep(&cp, MAC_SEP)); p && *p != '\0';
237 (p = strsep(&cp, MAC_SEP))) { 241 (p = strsep(&cp, MAC_SEP))) {
238 if (mac_setup(NULL, p) < 0) { 242 if (mac_setup(NULL, p) < 0) {
239 debug("bad mac %s [%s]", p, names);
240 free(maclist); 243 free(maclist);
241 return (0); 244 return 0;
242 } 245 }
243 } 246 }
244 debug3("macs ok: [%s]", names);
245 free(maclist); 247 free(maclist);
246 return (1); 248 return 1;
247} 249}
diff --git a/mac.h b/mac.h
index fbe18c463..e5f6b84d9 100644
--- a/mac.h
+++ b/mac.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: mac.h,v 1.8 2013/11/07 11:58:27 dtucker Exp $ */ 1/* $OpenBSD: mac.h,v 1.9 2015/01/13 19:31:40 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * 4 *
@@ -23,9 +23,29 @@
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26#ifndef SSHMAC_H
27#define SSHMAC_H
28
29#include <sys/types.h>
30
31struct sshmac {
32 char *name;
33 int enabled;
34 u_int mac_len;
35 u_char *key;
36 u_int key_len;
37 int type;
38 int etm; /* Encrypt-then-MAC */
39 struct ssh_hmac_ctx *hmac_ctx;
40 struct umac_ctx *umac_ctx;
41};
42
26int mac_valid(const char *); 43int mac_valid(const char *);
27char *mac_alg_list(char); 44char *mac_alg_list(char);
28int mac_setup(Mac *, char *); 45int mac_setup(struct sshmac *, char *);
29int mac_init(Mac *); 46int mac_init(struct sshmac *);
30u_char *mac_compute(Mac *, u_int32_t, u_char *, int); 47int mac_compute(struct sshmac *, u_int32_t, const u_char *, int,
31void mac_clear(Mac *); 48 u_char *, size_t);
49void mac_clear(struct sshmac *);
50
51#endif /* SSHMAC_H */
diff --git a/misc.c b/misc.c
index 94b05b08e..38af3dfe3 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.94 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: misc.c,v 1.96 2015/01/16 06:40:12 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved. 4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -30,8 +30,8 @@
30#include <sys/ioctl.h> 30#include <sys/ioctl.h>
31#include <sys/socket.h> 31#include <sys/socket.h>
32#include <sys/un.h> 32#include <sys/un.h>
33#include <sys/param.h>
34 33
34#include <limits.h>
35#include <stdarg.h> 35#include <stdarg.h>
36#include <stdio.h> 36#include <stdio.h>
37#include <stdlib.h> 37#include <stdlib.h>
@@ -551,7 +551,7 @@ tilde_expand_filename(const char *filename, uid_t uid)
551 if (path != NULL) 551 if (path != NULL)
552 filename = path + 1; 552 filename = path + 1;
553 553
554 if (xasprintf(&ret, "%s%s%s", pw->pw_dir, sep, filename) >= MAXPATHLEN) 554 if (xasprintf(&ret, "%s%s%s", pw->pw_dir, sep, filename) >= PATH_MAX)
555 fatal("tilde_expand_filename: Path too long"); 555 fatal("tilde_expand_filename: Path too long");
556 556
557 return (ret); 557 return (ret);
diff --git a/moduli.0 b/moduli.0
index d9aaadba9..1c580d46c 100644
--- a/moduli.0
+++ b/moduli.0
@@ -1,7 +1,7 @@
1MODULI(5) File Formats Manual MODULI(5) 1MODULI(5) File Formats Manual MODULI(5)
2 2
3NAME 3NAME
4 moduli - Diffie-Hellman moduli 4 moduli M-bM-^@M-^S Diffie-Hellman moduli
5 5
6DESCRIPTION 6DESCRIPTION
7 The /etc/moduli file contains prime numbers and generators for use by 7 The /etc/moduli file contains prime numbers and generators for use by
@@ -38,7 +38,7 @@ DESCRIPTION
38 bitmask of the following values: 38 bitmask of the following values:
39 39
40 0x00 Not tested. 40 0x00 Not tested.
41 0x01 Composite number - not prime. 41 0x01 Composite number M-bM-^@M-^S not prime.
42 0x02 Sieve of Eratosthenes. 42 0x02 Sieve of Eratosthenes.
43 0x04 Probabilistic Miller-Rabin primality tests. 43 0x04 Probabilistic Miller-Rabin primality tests.
44 44
@@ -71,4 +71,4 @@ STANDARDS
71 the Secure Shell (SSH) Transport Layer Protocol, RFC 4419, March 2006, 71 the Secure Shell (SSH) Transport Layer Protocol, RFC 4419, March 2006,
72 2006. 72 2006.
73 73
74OpenBSD 5.6 September 26, 2012 OpenBSD 5.6 74OpenBSD 5.7 September 26, 2012 OpenBSD 5.7
diff --git a/moduli.c b/moduli.c
index bb4dd7beb..ed1bdc946 100644
--- a/moduli.c
+++ b/moduli.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: moduli.c,v 1.28 2013/10/24 00:49:49 dtucker Exp $ */ 1/* $OpenBSD: moduli.c,v 1.30 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright 1994 Phil Karn <karn@qualcomm.com> 3 * Copyright 1994 Phil Karn <karn@qualcomm.com>
4 * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com> 4 * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com>
@@ -39,7 +39,9 @@
39 39
40#include "includes.h" 40#include "includes.h"
41 41
42#include <sys/param.h> 42#ifdef WITH_OPENSSL
43
44#include <sys/param.h> /* MAX */
43#include <sys/types.h> 45#include <sys/types.h>
44 46
45#include <openssl/bn.h> 47#include <openssl/bn.h>
@@ -52,6 +54,7 @@
52#include <stdarg.h> 54#include <stdarg.h>
53#include <time.h> 55#include <time.h>
54#include <unistd.h> 56#include <unistd.h>
57#include <limits.h>
55 58
56#include "xmalloc.h" 59#include "xmalloc.h"
57#include "dh.h" 60#include "dh.h"
@@ -447,11 +450,11 @@ static void
447write_checkpoint(char *cpfile, u_int32_t lineno) 450write_checkpoint(char *cpfile, u_int32_t lineno)
448{ 451{
449 FILE *fp; 452 FILE *fp;
450 char tmp[MAXPATHLEN]; 453 char tmp[PATH_MAX];
451 int r; 454 int r;
452 455
453 r = snprintf(tmp, sizeof(tmp), "%s.XXXXXXXXXX", cpfile); 456 r = snprintf(tmp, sizeof(tmp), "%s.XXXXXXXXXX", cpfile);
454 if (r == -1 || r >= MAXPATHLEN) { 457 if (r == -1 || r >= PATH_MAX) {
455 logit("write_checkpoint: temp pathname too long"); 458 logit("write_checkpoint: temp pathname too long");
456 return; 459 return;
457 } 460 }
@@ -461,6 +464,7 @@ write_checkpoint(char *cpfile, u_int32_t lineno)
461 } 464 }
462 if ((fp = fdopen(r, "w")) == NULL) { 465 if ((fp = fdopen(r, "w")) == NULL) {
463 logit("write_checkpoint: fdopen: %s", strerror(errno)); 466 logit("write_checkpoint: fdopen: %s", strerror(errno));
467 unlink(tmp);
464 close(r); 468 close(r);
465 return; 469 return;
466 } 470 }
@@ -801,3 +805,5 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted,
801 805
802 return (res); 806 return (res);
803} 807}
808
809#endif /* WITH_OPENSSL */
diff --git a/monitor.c b/monitor.c
index dbe29f128..bab6ce87e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor.c,v 1.135 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: monitor.c,v 1.145 2015/02/20 22:17:21 djm Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -28,7 +28,6 @@
28#include "includes.h" 28#include "includes.h"
29 29
30#include <sys/types.h> 30#include <sys/types.h>
31#include <sys/param.h>
32#include <sys/socket.h> 31#include <sys/socket.h>
33#include "openbsd-compat/sys-tree.h" 32#include "openbsd-compat/sys-tree.h"
34#include <sys/wait.h> 33#include <sys/wait.h>
@@ -40,6 +39,9 @@
40#endif 39#endif
41#include <pwd.h> 40#include <pwd.h>
42#include <signal.h> 41#include <signal.h>
42#ifdef HAVE_STDINT_H
43#include <stdint.h>
44#endif
43#include <stdlib.h> 45#include <stdlib.h>
44#include <string.h> 46#include <string.h>
45#include <stdarg.h> 47#include <stdarg.h>
@@ -100,6 +102,8 @@
100#include "ssh2.h" 102#include "ssh2.h"
101#include "roaming.h" 103#include "roaming.h"
102#include "authfd.h" 104#include "authfd.h"
105#include "match.h"
106#include "ssherr.h"
103 107
104#ifdef GSSAPI 108#ifdef GSSAPI
105static Gssctxt *gsscontext = NULL; 109static Gssctxt *gsscontext = NULL;
@@ -108,38 +112,13 @@ static Gssctxt *gsscontext = NULL;
108/* Imports */ 112/* Imports */
109extern ServerOptions options; 113extern ServerOptions options;
110extern u_int utmp_len; 114extern u_int utmp_len;
111extern Newkeys *current_keys[];
112extern z_stream incoming_stream;
113extern z_stream outgoing_stream;
114extern u_char session_id[]; 115extern u_char session_id[];
115extern Buffer auth_debug; 116extern Buffer auth_debug;
116extern int auth_debug_init; 117extern int auth_debug_init;
117extern Buffer loginmsg; 118extern Buffer loginmsg;
118 119
119/* State exported from the child */ 120/* State exported from the child */
120 121static struct sshbuf *child_state;
121struct {
122 z_stream incoming;
123 z_stream outgoing;
124 u_char *keyin;
125 u_int keyinlen;
126 u_char *keyout;
127 u_int keyoutlen;
128 u_char *ivin;
129 u_int ivinlen;
130 u_char *ivout;
131 u_int ivoutlen;
132 u_char *ssh1key;
133 u_int ssh1keylen;
134 int ssh1cipher;
135 int ssh1protoflags;
136 u_char *input;
137 u_int ilen;
138 u_char *output;
139 u_int olen;
140 u_int64_t sent_bytes;
141 u_int64_t recv_bytes;
142} child_state;
143 122
144/* Functions on the monitor that answer unprivileged requests */ 123/* Functions on the monitor that answer unprivileged requests */
145 124
@@ -504,6 +483,27 @@ monitor_sync(struct monitor *pmonitor)
504 } 483 }
505} 484}
506 485
486/* Allocation functions for zlib */
487static void *
488mm_zalloc(struct mm_master *mm, u_int ncount, u_int size)
489{
490 size_t len = (size_t) size * ncount;
491 void *address;
492
493 if (len == 0 || ncount > SIZE_MAX / size)
494 fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size);
495
496 address = mm_malloc(mm, len);
497
498 return (address);
499}
500
501static void
502mm_zfree(struct mm_master *mm, void *address)
503{
504 mm_free(mm, address);
505}
506
507static int 507static int
508monitor_read_log(struct monitor *pmonitor) 508monitor_read_log(struct monitor *pmonitor)
509{ 509{
@@ -684,28 +684,60 @@ mm_answer_moduli(int sock, Buffer *m)
684} 684}
685#endif 685#endif
686 686
687extern AuthenticationConnection *auth_conn;
688
689int 687int
690mm_answer_sign(int sock, Buffer *m) 688mm_answer_sign(int sock, Buffer *m)
691{ 689{
692 Key *key; 690 struct ssh *ssh = active_state; /* XXX */
691 extern int auth_sock; /* XXX move to state struct? */
692 struct sshkey *key;
693 struct sshbuf *sigbuf;
693 u_char *p; 694 u_char *p;
694 u_char *signature; 695 u_char *signature;
695 u_int siglen, datlen; 696 size_t datlen, siglen;
696 int keyid; 697 int r, keyid, is_proof = 0;
698 const char proof_req[] = "hostkeys-prove-00@openssh.com";
697 699
698 debug3("%s", __func__); 700 debug3("%s", __func__);
699 701
700 keyid = buffer_get_int(m); 702 if ((r = sshbuf_get_u32(m, &keyid)) != 0 ||
701 p = buffer_get_string(m, &datlen); 703 (r = sshbuf_get_string(m, &p, &datlen)) != 0)
704 fatal("%s: buffer error: %s", __func__, ssh_err(r));
702 705
703 /* 706 /*
704 * Supported KEX types use SHA1 (20 bytes), SHA256 (32 bytes), 707 * Supported KEX types use SHA1 (20 bytes), SHA256 (32 bytes),
705 * SHA384 (48 bytes) and SHA512 (64 bytes). 708 * SHA384 (48 bytes) and SHA512 (64 bytes).
709 *
710 * Otherwise, verify the signature request is for a hostkey
711 * proof.
712 *
713 * XXX perform similar check for KEX signature requests too?
714 * it's not trivial, since what is signed is the hash, rather
715 * than the full kex structure...
706 */ 716 */
707 if (datlen != 20 && datlen != 32 && datlen != 48 && datlen != 64) 717 if (datlen != 20 && datlen != 32 && datlen != 48 && datlen != 64) {
708 fatal("%s: data length incorrect: %u", __func__, datlen); 718 /*
719 * Construct expected hostkey proof and compare it to what
720 * the client sent us.
721 */
722 if (session_id2_len == 0) /* hostkeys is never first */
723 fatal("%s: bad data length: %zu", __func__, datlen);
724 if ((key = get_hostkey_public_by_index(keyid, ssh)) == NULL)
725 fatal("%s: no hostkey for index %d", __func__, keyid);
726 if ((sigbuf = sshbuf_new()) == NULL)
727 fatal("%s: sshbuf_new", __func__);
728 if ((r = sshbuf_put_cstring(sigbuf, proof_req)) != 0 ||
729 (r = sshbuf_put_string(sigbuf, session_id2,
730 session_id2_len) != 0) ||
731 (r = sshkey_puts(key, sigbuf)) != 0)
732 fatal("%s: couldn't prepare private key "
733 "proof buffer: %s", __func__, ssh_err(r));
734 if (datlen != sshbuf_len(sigbuf) ||
735 memcmp(p, sshbuf_ptr(sigbuf), sshbuf_len(sigbuf)) != 0)
736 fatal("%s: bad data length: %zu, hostkey proof len %zu",
737 __func__, datlen, sshbuf_len(sigbuf));
738 sshbuf_free(sigbuf);
739 is_proof = 1;
740 }
709 741
710 /* save session id, it will be passed on the first call */ 742 /* save session id, it will be passed on the first call */
711 if (session_id2_len == 0) { 743 if (session_id2_len == 0) {
@@ -715,20 +747,26 @@ mm_answer_sign(int sock, Buffer *m)
715 } 747 }
716 748
717 if ((key = get_hostkey_by_index(keyid)) != NULL) { 749 if ((key = get_hostkey_by_index(keyid)) != NULL) {
718 if (key_sign(key, &signature, &siglen, p, datlen) < 0) 750 if ((r = sshkey_sign(key, &signature, &siglen, p, datlen,
719 fatal("%s: key_sign failed", __func__); 751 datafellows)) != 0)
720 } else if ((key = get_hostkey_public_by_index(keyid)) != NULL && 752 fatal("%s: sshkey_sign failed: %s",
721 auth_conn != NULL) { 753 __func__, ssh_err(r));
722 if (ssh_agent_sign(auth_conn, key, &signature, &siglen, p, 754 } else if ((key = get_hostkey_public_by_index(keyid, ssh)) != NULL &&
723 datlen) < 0) 755 auth_sock > 0) {
724 fatal("%s: ssh_agent_sign failed", __func__); 756 if ((r = ssh_agent_sign(auth_sock, key, &signature, &siglen,
757 p, datlen, datafellows)) != 0) {
758 fatal("%s: ssh_agent_sign failed: %s",
759 __func__, ssh_err(r));
760 }
725 } else 761 } else
726 fatal("%s: no hostkey from index %d", __func__, keyid); 762 fatal("%s: no hostkey from index %d", __func__, keyid);
727 763
728 debug3("%s: signature %p(%u)", __func__, signature, siglen); 764 debug3("%s: %s signature %p(%zu)", __func__,
765 is_proof ? "KEX" : "hostkey proof", signature, siglen);
729 766
730 buffer_clear(m); 767 sshbuf_reset(m);
731 buffer_put_string(m, signature, siglen); 768 if ((r = sshbuf_put_string(m, signature, siglen)) != 0)
769 fatal("%s: buffer error: %s", __func__, ssh_err(r));
732 770
733 free(p); 771 free(p);
734 free(signature); 772 free(signature);
@@ -1167,9 +1205,18 @@ mm_answer_keyallowed(int sock, Buffer *m)
1167 debug3("%s: key_from_blob: %p", __func__, key); 1205 debug3("%s: key_from_blob: %p", __func__, key);
1168 1206
1169 if (key != NULL && authctxt->valid) { 1207 if (key != NULL && authctxt->valid) {
1208 /* These should not make it past the privsep child */
1209 if (key_type_plain(key->type) == KEY_RSA &&
1210 (datafellows & SSH_BUG_RSASIGMD5) != 0)
1211 fatal("%s: passed a SSH_BUG_RSASIGMD5 key", __func__);
1212
1170 switch (type) { 1213 switch (type) {
1171 case MM_USERKEY: 1214 case MM_USERKEY:
1172 allowed = options.pubkey_authentication && 1215 allowed = options.pubkey_authentication &&
1216 !auth2_userkey_already_used(authctxt, key) &&
1217 match_pattern_list(sshkey_ssh_name(key),
1218 options.pubkey_key_types,
1219 strlen(options.pubkey_key_types), 0) == 1 &&
1173 user_key_allowed(authctxt->pw, key); 1220 user_key_allowed(authctxt->pw, key);
1174 pubkey_auth_info(authctxt, key, NULL); 1221 pubkey_auth_info(authctxt, key, NULL);
1175 auth_method = "publickey"; 1222 auth_method = "publickey";
@@ -1178,6 +1225,9 @@ mm_answer_keyallowed(int sock, Buffer *m)
1178 break; 1225 break;
1179 case MM_HOSTKEY: 1226 case MM_HOSTKEY:
1180 allowed = options.hostbased_authentication && 1227 allowed = options.hostbased_authentication &&
1228 match_pattern_list(sshkey_ssh_name(key),
1229 options.hostbased_key_types,
1230 strlen(options.hostbased_key_types), 0) == 1 &&
1181 hostbased_key_allowed(authctxt->pw, 1231 hostbased_key_allowed(authctxt->pw,
1182 cuser, chost, key); 1232 cuser, chost, key);
1183 pubkey_auth_info(authctxt, key, 1233 pubkey_auth_info(authctxt, key,
@@ -1397,7 +1447,12 @@ mm_answer_keyverify(int sock, Buffer *m)
1397 debug3("%s: key %p signature %s", 1447 debug3("%s: key %p signature %s",
1398 __func__, key, (verified == 1) ? "verified" : "unverified"); 1448 __func__, key, (verified == 1) ? "verified" : "unverified");
1399 1449
1400 key_free(key); 1450 /* If auth was successful then record key to ensure it isn't reused */
1451 if (verified == 1)
1452 auth2_record_userkey(authctxt, key);
1453 else
1454 key_free(key);
1455
1401 free(blob); 1456 free(blob);
1402 free(signature); 1457 free(signature);
1403 free(data); 1458 free(data);
@@ -1783,105 +1838,40 @@ mm_answer_audit_command(int socket, Buffer *m)
1783void 1838void
1784monitor_apply_keystate(struct monitor *pmonitor) 1839monitor_apply_keystate(struct monitor *pmonitor)
1785{ 1840{
1786 if (compat20) { 1841 struct ssh *ssh = active_state; /* XXX */
1787 set_newkeys(MODE_IN); 1842 struct kex *kex;
1788 set_newkeys(MODE_OUT); 1843 int r;
1789 } else { 1844
1790 packet_set_protocol_flags(child_state.ssh1protoflags); 1845 debug3("%s: packet_set_state", __func__);
1791 packet_set_encryption_key(child_state.ssh1key, 1846 if ((r = ssh_packet_set_state(ssh, child_state)) != 0)
1792 child_state.ssh1keylen, child_state.ssh1cipher); 1847 fatal("%s: packet_set_state: %s", __func__, ssh_err(r));
1793 free(child_state.ssh1key); 1848 sshbuf_free(child_state);
1794 } 1849 child_state = NULL;
1795 1850
1796 /* for rc4 and other stateful ciphers */ 1851 if ((kex = ssh->kex) != 0) {
1797 packet_set_keycontext(MODE_OUT, child_state.keyout); 1852 /* XXX set callbacks */
1798 free(child_state.keyout); 1853#ifdef WITH_OPENSSL
1799 packet_set_keycontext(MODE_IN, child_state.keyin); 1854 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
1800 free(child_state.keyin); 1855 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
1801 1856 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
1802 if (!compat20) { 1857 kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
1803 packet_set_iv(MODE_OUT, child_state.ivout); 1858# ifdef OPENSSL_HAS_ECC
1804 free(child_state.ivout); 1859 kex->kex[KEX_ECDH_SHA2] = kexecdh_server;
1805 packet_set_iv(MODE_IN, child_state.ivin); 1860# endif
1806 free(child_state.ivin); 1861#endif /* WITH_OPENSSL */
1862 kex->kex[KEX_C25519_SHA256] = kexc25519_server;
1863 kex->load_host_public_key=&get_hostkey_public_by_type;
1864 kex->load_host_private_key=&get_hostkey_private_by_type;
1865 kex->host_key_index=&get_hostkey_index;
1866 kex->sign = sshd_hostkey_sign;
1807 } 1867 }
1808 1868
1809 memcpy(&incoming_stream, &child_state.incoming,
1810 sizeof(incoming_stream));
1811 memcpy(&outgoing_stream, &child_state.outgoing,
1812 sizeof(outgoing_stream));
1813
1814 /* Update with new address */ 1869 /* Update with new address */
1815 if (options.compression) 1870 if (options.compression) {
1816 mm_init_compression(pmonitor->m_zlib); 1871 ssh_packet_set_compress_hooks(ssh, pmonitor->m_zlib,
1817 1872 (ssh_packet_comp_alloc_func *)mm_zalloc,
1818 packet_set_postauth(); 1873 (ssh_packet_comp_free_func *)mm_zfree);
1819 1874 }
1820 if (options.rekey_limit || options.rekey_interval)
1821 packet_set_rekey_limits((u_int32_t)options.rekey_limit,
1822 (time_t)options.rekey_interval);
1823
1824 /* Network I/O buffers */
1825 /* XXX inefficient for large buffers, need: buffer_init_from_string */
1826 buffer_clear(packet_get_input());
1827 buffer_append(packet_get_input(), child_state.input, child_state.ilen);
1828 explicit_bzero(child_state.input, child_state.ilen);
1829 free(child_state.input);
1830
1831 buffer_clear(packet_get_output());
1832 buffer_append(packet_get_output(), child_state.output,
1833 child_state.olen);
1834 explicit_bzero(child_state.output, child_state.olen);
1835 free(child_state.output);
1836
1837 /* Roaming */
1838 if (compat20)
1839 roam_set_bytes(child_state.sent_bytes, child_state.recv_bytes);
1840}
1841
1842static Kex *
1843mm_get_kex(Buffer *m)
1844{
1845 Kex *kex;
1846 void *blob;
1847 u_int bloblen;
1848
1849 kex = xcalloc(1, sizeof(*kex));
1850 kex->session_id = buffer_get_string(m, &kex->session_id_len);
1851 if (session_id2 == NULL ||
1852 kex->session_id_len != session_id2_len ||
1853 timingsafe_bcmp(kex->session_id, session_id2, session_id2_len) != 0)
1854 fatal("mm_get_get: internal error: bad session id");
1855 kex->we_need = buffer_get_int(m);
1856#ifdef WITH_OPENSSL
1857 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
1858 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
1859 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
1860 kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
1861 kex->kex[KEX_ECDH_SHA2] = kexecdh_server;
1862#endif
1863 kex->kex[KEX_C25519_SHA256] = kexc25519_server;
1864 kex->server = 1;
1865 kex->hostkey_type = buffer_get_int(m);
1866 kex->kex_type = buffer_get_int(m);
1867 blob = buffer_get_string(m, &bloblen);
1868 buffer_init(&kex->my);
1869 buffer_append(&kex->my, blob, bloblen);
1870 free(blob);
1871 blob = buffer_get_string(m, &bloblen);
1872 buffer_init(&kex->peer);
1873 buffer_append(&kex->peer, blob, bloblen);
1874 free(blob);
1875 kex->done = 1;
1876 kex->flags = buffer_get_int(m);
1877 kex->client_version_string = buffer_get_string(m, NULL);
1878 kex->server_version_string = buffer_get_string(m, NULL);
1879 kex->load_host_public_key=&get_hostkey_public_by_type;
1880 kex->load_host_private_key=&get_hostkey_private_by_type;
1881 kex->host_key_index=&get_hostkey_index;
1882 kex->sign = sshd_hostkey_sign;
1883
1884 return (kex);
1885} 1875}
1886 1876
1887/* This function requries careful sanity checking */ 1877/* This function requries careful sanity checking */
@@ -1889,118 +1879,16 @@ mm_get_kex(Buffer *m)
1889void 1879void
1890mm_get_keystate(struct monitor *pmonitor) 1880mm_get_keystate(struct monitor *pmonitor)
1891{ 1881{
1892 Buffer m;
1893 u_char *blob, *p;
1894 u_int bloblen, plen;
1895 u_int32_t seqnr, packets;
1896 u_int64_t blocks, bytes;
1897
1898 debug3("%s: Waiting for new keys", __func__); 1882 debug3("%s: Waiting for new keys", __func__);
1899 1883
1900 buffer_init(&m); 1884 if ((child_state = sshbuf_new()) == NULL)
1901 mm_request_receive_expect(pmonitor->m_sendfd, MONITOR_REQ_KEYEXPORT, &m); 1885 fatal("%s: sshbuf_new failed", __func__);
1902 if (!compat20) { 1886 mm_request_receive_expect(pmonitor->m_sendfd, MONITOR_REQ_KEYEXPORT,
1903 child_state.ssh1protoflags = buffer_get_int(&m); 1887 child_state);
1904 child_state.ssh1cipher = buffer_get_int(&m); 1888 debug3("%s: GOT new keys", __func__);
1905 child_state.ssh1key = buffer_get_string(&m,
1906 &child_state.ssh1keylen);
1907 child_state.ivout = buffer_get_string(&m,
1908 &child_state.ivoutlen);
1909 child_state.ivin = buffer_get_string(&m, &child_state.ivinlen);
1910 goto skip;
1911 } else {
1912 /* Get the Kex for rekeying */
1913 *pmonitor->m_pkex = mm_get_kex(&m);
1914 }
1915
1916 blob = buffer_get_string(&m, &bloblen);
1917 current_keys[MODE_OUT] = mm_newkeys_from_blob(blob, bloblen);
1918 free(blob);
1919
1920 debug3("%s: Waiting for second key", __func__);
1921 blob = buffer_get_string(&m, &bloblen);
1922 current_keys[MODE_IN] = mm_newkeys_from_blob(blob, bloblen);
1923 free(blob);
1924
1925 /* Now get sequence numbers for the packets */
1926 seqnr = buffer_get_int(&m);
1927 blocks = buffer_get_int64(&m);
1928 packets = buffer_get_int(&m);
1929 bytes = buffer_get_int64(&m);
1930 packet_set_state(MODE_OUT, seqnr, blocks, packets, bytes);
1931 seqnr = buffer_get_int(&m);
1932 blocks = buffer_get_int64(&m);
1933 packets = buffer_get_int(&m);
1934 bytes = buffer_get_int64(&m);
1935 packet_set_state(MODE_IN, seqnr, blocks, packets, bytes);
1936
1937 skip:
1938 /* Get the key context */
1939 child_state.keyout = buffer_get_string(&m, &child_state.keyoutlen);
1940 child_state.keyin = buffer_get_string(&m, &child_state.keyinlen);
1941
1942 debug3("%s: Getting compression state", __func__);
1943 /* Get compression state */
1944 p = buffer_get_string(&m, &plen);
1945 if (plen != sizeof(child_state.outgoing))
1946 fatal("%s: bad request size", __func__);
1947 memcpy(&child_state.outgoing, p, sizeof(child_state.outgoing));
1948 free(p);
1949
1950 p = buffer_get_string(&m, &plen);
1951 if (plen != sizeof(child_state.incoming))
1952 fatal("%s: bad request size", __func__);
1953 memcpy(&child_state.incoming, p, sizeof(child_state.incoming));
1954 free(p);
1955
1956 /* Network I/O buffers */
1957 debug3("%s: Getting Network I/O buffers", __func__);
1958 child_state.input = buffer_get_string(&m, &child_state.ilen);
1959 child_state.output = buffer_get_string(&m, &child_state.olen);
1960
1961 /* Roaming */
1962 if (compat20) {
1963 child_state.sent_bytes = buffer_get_int64(&m);
1964 child_state.recv_bytes = buffer_get_int64(&m);
1965 }
1966
1967 buffer_free(&m);
1968} 1889}
1969 1890
1970 1891
1971/* Allocation functions for zlib */
1972void *
1973mm_zalloc(struct mm_master *mm, u_int ncount, u_int size)
1974{
1975 size_t len = (size_t) size * ncount;
1976 void *address;
1977
1978 if (len == 0 || ncount > SIZE_T_MAX / size)
1979 fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size);
1980
1981 address = mm_malloc(mm, len);
1982
1983 return (address);
1984}
1985
1986void
1987mm_zfree(struct mm_master *mm, void *address)
1988{
1989 mm_free(mm, address);
1990}
1991
1992void
1993mm_init_compression(struct mm_master *mm)
1994{
1995 outgoing_stream.zalloc = (alloc_func)mm_zalloc;
1996 outgoing_stream.zfree = (free_func)mm_zfree;
1997 outgoing_stream.opaque = mm;
1998
1999 incoming_stream.zalloc = (alloc_func)mm_zalloc;
2000 incoming_stream.zfree = (free_func)mm_zfree;
2001 incoming_stream.opaque = mm;
2002}
2003
2004/* XXX */ 1892/* XXX */
2005 1893
2006#define FD_CLOSEONEXEC(x) do { \ 1894#define FD_CLOSEONEXEC(x) do { \
@@ -2036,6 +1924,7 @@ monitor_openfds(struct monitor *mon, int do_logfds)
2036struct monitor * 1924struct monitor *
2037monitor_init(void) 1925monitor_init(void)
2038{ 1926{
1927 struct ssh *ssh = active_state; /* XXX */
2039 struct monitor *mon; 1928 struct monitor *mon;
2040 1929
2041 mon = xcalloc(1, sizeof(*mon)); 1930 mon = xcalloc(1, sizeof(*mon));
@@ -2048,7 +1937,9 @@ monitor_init(void)
2048 mon->m_zlib = mm_create(mon->m_zback, 20 * MM_MEMSIZE); 1937 mon->m_zlib = mm_create(mon->m_zback, 20 * MM_MEMSIZE);
2049 1938
2050 /* Compression needs to share state across borders */ 1939 /* Compression needs to share state across borders */
2051 mm_init_compression(mon->m_zlib); 1940 ssh_packet_set_compress_hooks(ssh, mon->m_zlib,
1941 (ssh_packet_comp_alloc_func *)mm_zalloc,
1942 (ssh_packet_comp_free_func *)mm_zfree);
2052 } 1943 }
2053 1944
2054 return mon; 1945 return mon;
diff --git a/monitor.h b/monitor.h
index 5bc41b513..93b8b66dd 100644
--- a/monitor.h
+++ b/monitor.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor.h,v 1.18 2014/01/29 06:18:35 djm Exp $ */ 1/* $OpenBSD: monitor.h,v 1.19 2015/01/19 19:52:16 markus Exp $ */
2 2
3/* 3/*
4 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 4 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
@@ -75,7 +75,7 @@ struct monitor {
75 int m_log_sendfd; 75 int m_log_sendfd;
76 struct mm_master *m_zback; 76 struct mm_master *m_zback;
77 struct mm_master *m_zlib; 77 struct mm_master *m_zlib;
78 struct Kex **m_pkex; 78 struct kex **m_pkex;
79 pid_t m_pid; 79 pid_t m_pid;
80}; 80};
81 81
diff --git a/monitor_fdpass.c b/monitor_fdpass.c
index 100fa5660..2ddd80732 100644
--- a/monitor_fdpass.c
+++ b/monitor_fdpass.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_fdpass.c,v 1.19 2010/01/12 00:58:25 djm Exp $ */ 1/* $OpenBSD: monitor_fdpass.c,v 1.20 2015/02/25 23:05:47 djm Exp $ */
2/* 2/*
3 * Copyright 2001 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2001 Niels Provos <provos@citi.umich.edu>
4 * All rights reserved. 4 * All rights reserved.
@@ -70,6 +70,7 @@ mm_send_fd(int sock, int fd)
70 msg.msg_accrights = (caddr_t)&fd; 70 msg.msg_accrights = (caddr_t)&fd;
71 msg.msg_accrightslen = sizeof(fd); 71 msg.msg_accrightslen = sizeof(fd);
72#else 72#else
73 memset(&cmsgbuf, 0, sizeof(cmsgbuf));
73 msg.msg_control = (caddr_t)&cmsgbuf.buf; 74 msg.msg_control = (caddr_t)&cmsgbuf.buf;
74 msg.msg_controllen = sizeof(cmsgbuf.buf); 75 msg.msg_controllen = sizeof(cmsgbuf.buf);
75 cmsg = CMSG_FIRSTHDR(&msg); 76 cmsg = CMSG_FIRSTHDR(&msg);
@@ -136,6 +137,7 @@ mm_receive_fd(int sock)
136 msg.msg_accrights = (caddr_t)&fd; 137 msg.msg_accrights = (caddr_t)&fd;
137 msg.msg_accrightslen = sizeof(fd); 138 msg.msg_accrightslen = sizeof(fd);
138#else 139#else
140 memset(&cmsgbuf, 0, sizeof(cmsgbuf));
139 msg.msg_control = &cmsgbuf.buf; 141 msg.msg_control = &cmsgbuf.buf;
140 msg.msg_controllen = sizeof(cmsgbuf.buf); 142 msg.msg_controllen = sizeof(cmsgbuf.buf);
141#endif 143#endif
diff --git a/monitor_mm.c b/monitor_mm.c
index 0ba0658a1..aa47b2ed5 100644
--- a/monitor_mm.c
+++ b/monitor_mm.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_mm.c,v 1.19 2014/01/04 17:50:55 tedu Exp $ */ 1/* $OpenBSD: monitor_mm.c,v 1.21 2015/02/06 23:21:59 millert Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * All rights reserved. 4 * All rights reserved.
@@ -30,12 +30,14 @@
30#ifdef HAVE_SYS_MMAN_H 30#ifdef HAVE_SYS_MMAN_H
31#include <sys/mman.h> 31#include <sys/mman.h>
32#endif 32#endif
33#include <sys/param.h>
34#include "openbsd-compat/sys-tree.h" 33#include "openbsd-compat/sys-tree.h"
35 34
36#include <errno.h> 35#include <errno.h>
37#include <stdarg.h> 36#include <stdarg.h>
38#include <stddef.h> 37#include <stddef.h>
38#ifdef HAVE_STDINT_H
39#include <stdint.h>
40#endif
39#include <stdlib.h> 41#include <stdlib.h>
40#include <string.h> 42#include <string.h>
41 43
@@ -176,7 +178,7 @@ mm_malloc(struct mm_master *mm, size_t size)
176 178
177 if (size == 0) 179 if (size == 0)
178 fatal("mm_malloc: try to allocate 0 space"); 180 fatal("mm_malloc: try to allocate 0 space");
179 if (size > SIZE_T_MAX - MM_MINSIZE + 1) 181 if (size > SIZE_MAX - MM_MINSIZE + 1)
180 fatal("mm_malloc: size too big"); 182 fatal("mm_malloc: size too big");
181 183
182 size = ((size + (MM_MINSIZE - 1)) / MM_MINSIZE) * MM_MINSIZE; 184 size = ((size + (MM_MINSIZE - 1)) / MM_MINSIZE) * MM_MINSIZE;
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 45dc16951..b379f0555 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_wrap.c,v 1.80 2014/04/29 18:01:49 markus Exp $ */ 1/* $OpenBSD: monitor_wrap.c,v 1.84 2015/02/16 22:13:32 djm Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -82,6 +82,8 @@
82#include "servconf.h" 82#include "servconf.h"
83#include "roaming.h" 83#include "roaming.h"
84 84
85#include "ssherr.h"
86
85/* Imports */ 87/* Imports */
86extern int compat20; 88extern int compat20;
87extern z_stream incoming_stream; 89extern z_stream incoming_stream;
@@ -151,8 +153,10 @@ mm_request_receive(int sock, Buffer *m)
151 debug3("%s entering", __func__); 153 debug3("%s entering", __func__);
152 154
153 if (atomicio(read, sock, buf, sizeof(buf)) != sizeof(buf)) { 155 if (atomicio(read, sock, buf, sizeof(buf)) != sizeof(buf)) {
154 if (errno == EPIPE) 156 if (errno == EPIPE) {
157 error("%s: socket closed", __func__);
155 cleanup_exit(255); 158 cleanup_exit(255);
159 }
156 fatal("%s: read: %s", __func__, strerror(errno)); 160 fatal("%s: read: %s", __func__, strerror(errno));
157 } 161 }
158 msg_len = get_u32(buf); 162 msg_len = get_u32(buf);
@@ -215,15 +219,16 @@ mm_choose_dh(int min, int nbits, int max)
215#endif 219#endif
216 220
217int 221int
218mm_key_sign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen) 222mm_key_sign(Key *key, u_char **sigp, u_int *lenp,
223 const u_char *data, u_int datalen)
219{ 224{
220 Kex *kex = *pmonitor->m_pkex; 225 struct kex *kex = *pmonitor->m_pkex;
221 Buffer m; 226 Buffer m;
222 227
223 debug3("%s entering", __func__); 228 debug3("%s entering", __func__);
224 229
225 buffer_init(&m); 230 buffer_init(&m);
226 buffer_put_int(&m, kex->host_key_index(key)); 231 buffer_put_int(&m, kex->host_key_index(key, 0, active_state));
227 buffer_put_string(&m, data, datalen); 232 buffer_put_string(&m, data, datalen);
228 233
229 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, &m); 234 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, &m);
@@ -468,239 +473,21 @@ mm_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen)
468 return (verified); 473 return (verified);
469} 474}
470 475
471/* Export key state after authentication */
472Newkeys *
473mm_newkeys_from_blob(u_char *blob, int blen)
474{
475 Buffer b;
476 u_int len;
477 Newkeys *newkey = NULL;
478 Enc *enc;
479 Mac *mac;
480 Comp *comp;
481
482 debug3("%s: %p(%d)", __func__, blob, blen);
483#ifdef DEBUG_PK
484 dump_base64(stderr, blob, blen);
485#endif
486 buffer_init(&b);
487 buffer_append(&b, blob, blen);
488
489 newkey = xcalloc(1, sizeof(*newkey));
490 enc = &newkey->enc;
491 mac = &newkey->mac;
492 comp = &newkey->comp;
493
494 /* Enc structure */
495 enc->name = buffer_get_string(&b, NULL);
496 buffer_get(&b, &enc->cipher, sizeof(enc->cipher));
497 enc->enabled = buffer_get_int(&b);
498 enc->block_size = buffer_get_int(&b);
499 enc->key = buffer_get_string(&b, &enc->key_len);
500 enc->iv = buffer_get_string(&b, &enc->iv_len);
501
502 if (enc->name == NULL || cipher_by_name(enc->name) != enc->cipher)
503 fatal("%s: bad cipher name %s or pointer %p", __func__,
504 enc->name, enc->cipher);
505
506 /* Mac structure */
507 if (cipher_authlen(enc->cipher) == 0) {
508 mac->name = buffer_get_string(&b, NULL);
509 if (mac->name == NULL || mac_setup(mac, mac->name) == -1)
510 fatal("%s: can not setup mac %s", __func__, mac->name);
511 mac->enabled = buffer_get_int(&b);
512 mac->key = buffer_get_string(&b, &len);
513 if (len > mac->key_len)
514 fatal("%s: bad mac key length: %u > %d", __func__, len,
515 mac->key_len);
516 mac->key_len = len;
517 }
518
519 /* Comp structure */
520 comp->type = buffer_get_int(&b);
521 comp->enabled = buffer_get_int(&b);
522 comp->name = buffer_get_string(&b, NULL);
523
524 len = buffer_len(&b);
525 if (len != 0)
526 error("newkeys_from_blob: remaining bytes in blob %u", len);
527 buffer_free(&b);
528 return (newkey);
529}
530
531int
532mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp)
533{
534 Buffer b;
535 int len;
536 Enc *enc;
537 Mac *mac;
538 Comp *comp;
539 Newkeys *newkey = (Newkeys *)packet_get_newkeys(mode);
540
541 debug3("%s: converting %p", __func__, newkey);
542
543 if (newkey == NULL) {
544 error("%s: newkey == NULL", __func__);
545 return 0;
546 }
547 enc = &newkey->enc;
548 mac = &newkey->mac;
549 comp = &newkey->comp;
550
551 buffer_init(&b);
552 /* Enc structure */
553 buffer_put_cstring(&b, enc->name);
554 /* The cipher struct is constant and shared, you export pointer */
555 buffer_append(&b, &enc->cipher, sizeof(enc->cipher));
556 buffer_put_int(&b, enc->enabled);
557 buffer_put_int(&b, enc->block_size);
558 buffer_put_string(&b, enc->key, enc->key_len);
559 packet_get_keyiv(mode, enc->iv, enc->iv_len);
560 buffer_put_string(&b, enc->iv, enc->iv_len);
561
562 /* Mac structure */
563 if (cipher_authlen(enc->cipher) == 0) {
564 buffer_put_cstring(&b, mac->name);
565 buffer_put_int(&b, mac->enabled);
566 buffer_put_string(&b, mac->key, mac->key_len);
567 }
568
569 /* Comp structure */
570 buffer_put_int(&b, comp->type);
571 buffer_put_int(&b, comp->enabled);
572 buffer_put_cstring(&b, comp->name);
573
574 len = buffer_len(&b);
575 if (lenp != NULL)
576 *lenp = len;
577 if (blobp != NULL) {
578 *blobp = xmalloc(len);
579 memcpy(*blobp, buffer_ptr(&b), len);
580 }
581 explicit_bzero(buffer_ptr(&b), len);
582 buffer_free(&b);
583 return len;
584}
585
586static void
587mm_send_kex(Buffer *m, Kex *kex)
588{
589 buffer_put_string(m, kex->session_id, kex->session_id_len);
590 buffer_put_int(m, kex->we_need);
591 buffer_put_int(m, kex->hostkey_type);
592 buffer_put_int(m, kex->kex_type);
593 buffer_put_string(m, buffer_ptr(&kex->my), buffer_len(&kex->my));
594 buffer_put_string(m, buffer_ptr(&kex->peer), buffer_len(&kex->peer));
595 buffer_put_int(m, kex->flags);
596 buffer_put_cstring(m, kex->client_version_string);
597 buffer_put_cstring(m, kex->server_version_string);
598}
599
600void 476void
601mm_send_keystate(struct monitor *monitor) 477mm_send_keystate(struct monitor *monitor)
602{ 478{
603 Buffer m, *input, *output; 479 struct ssh *ssh = active_state; /* XXX */
604 u_char *blob, *p; 480 struct sshbuf *m;
605 u_int bloblen, plen; 481 int r;
606 u_int32_t seqnr, packets; 482
607 u_int64_t blocks, bytes; 483 if ((m = sshbuf_new()) == NULL)
608 484 fatal("%s: sshbuf_new failed", __func__);
609 buffer_init(&m); 485 if ((r = ssh_packet_get_state(ssh, m)) != 0)
610 486 fatal("%s: get_state failed: %s",
611 if (!compat20) { 487 __func__, ssh_err(r));
612 u_char iv[24]; 488 mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, m);
613 u_char *key;
614 u_int ivlen, keylen;
615
616 buffer_put_int(&m, packet_get_protocol_flags());
617
618 buffer_put_int(&m, packet_get_ssh1_cipher());
619
620 debug3("%s: Sending ssh1 KEY+IV", __func__);
621 keylen = packet_get_encryption_key(NULL);
622 key = xmalloc(keylen+1); /* add 1 if keylen == 0 */
623 keylen = packet_get_encryption_key(key);
624 buffer_put_string(&m, key, keylen);
625 explicit_bzero(key, keylen);
626 free(key);
627
628 ivlen = packet_get_keyiv_len(MODE_OUT);
629 packet_get_keyiv(MODE_OUT, iv, ivlen);
630 buffer_put_string(&m, iv, ivlen);
631 ivlen = packet_get_keyiv_len(MODE_IN);
632 packet_get_keyiv(MODE_IN, iv, ivlen);
633 buffer_put_string(&m, iv, ivlen);
634 goto skip;
635 } else {
636 /* Kex for rekeying */
637 mm_send_kex(&m, *monitor->m_pkex);
638 }
639
640 debug3("%s: Sending new keys: %p %p",
641 __func__, packet_get_newkeys(MODE_OUT),
642 packet_get_newkeys(MODE_IN));
643
644 /* Keys from Kex */
645 if (!mm_newkeys_to_blob(MODE_OUT, &blob, &bloblen))
646 fatal("%s: conversion of newkeys failed", __func__);
647
648 buffer_put_string(&m, blob, bloblen);
649 free(blob);
650
651 if (!mm_newkeys_to_blob(MODE_IN, &blob, &bloblen))
652 fatal("%s: conversion of newkeys failed", __func__);
653
654 buffer_put_string(&m, blob, bloblen);
655 free(blob);
656
657 packet_get_state(MODE_OUT, &seqnr, &blocks, &packets, &bytes);
658 buffer_put_int(&m, seqnr);
659 buffer_put_int64(&m, blocks);
660 buffer_put_int(&m, packets);
661 buffer_put_int64(&m, bytes);
662 packet_get_state(MODE_IN, &seqnr, &blocks, &packets, &bytes);
663 buffer_put_int(&m, seqnr);
664 buffer_put_int64(&m, blocks);
665 buffer_put_int(&m, packets);
666 buffer_put_int64(&m, bytes);
667
668 debug3("%s: New keys have been sent", __func__);
669 skip:
670 /* More key context */
671 plen = packet_get_keycontext(MODE_OUT, NULL);
672 p = xmalloc(plen+1);
673 packet_get_keycontext(MODE_OUT, p);
674 buffer_put_string(&m, p, plen);
675 free(p);
676
677 plen = packet_get_keycontext(MODE_IN, NULL);
678 p = xmalloc(plen+1);
679 packet_get_keycontext(MODE_IN, p);
680 buffer_put_string(&m, p, plen);
681 free(p);
682
683 /* Compression state */
684 debug3("%s: Sending compression state", __func__);
685 buffer_put_string(&m, &outgoing_stream, sizeof(outgoing_stream));
686 buffer_put_string(&m, &incoming_stream, sizeof(incoming_stream));
687
688 /* Network I/O buffers */
689 input = (Buffer *)packet_get_input();
690 output = (Buffer *)packet_get_output();
691 buffer_put_string(&m, buffer_ptr(input), buffer_len(input));
692 buffer_put_string(&m, buffer_ptr(output), buffer_len(output));
693
694 /* Roaming */
695 if (compat20) {
696 buffer_put_int64(&m, get_sent_bytes());
697 buffer_put_int64(&m, get_recv_bytes());
698 }
699
700 mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m);
701 debug3("%s: Finished sending state", __func__); 489 debug3("%s: Finished sending state", __func__);
702 490 sshbuf_free(m);
703 buffer_free(&m);
704} 491}
705 492
706int 493int
diff --git a/monitor_wrap.h b/monitor_wrap.h
index 18c25010d..e18784ac4 100644
--- a/monitor_wrap.h
+++ b/monitor_wrap.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_wrap.h,v 1.24 2014/01/29 06:18:35 djm Exp $ */ 1/* $OpenBSD: monitor_wrap.h,v 1.26 2015/02/16 22:13:32 djm Exp $ */
2 2
3/* 3/*
4 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 4 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
@@ -40,7 +40,7 @@ struct Authctxt;
40void mm_log_handler(LogLevel, const char *, void *); 40void mm_log_handler(LogLevel, const char *, void *);
41int mm_is_monitor(void); 41int mm_is_monitor(void);
42DH *mm_choose_dh(int, int, int); 42DH *mm_choose_dh(int, int, int);
43int mm_key_sign(Key *, u_char **, u_int *, u_char *, u_int); 43int mm_key_sign(Key *, u_char **, u_int *, const u_char *, u_int);
44void mm_inform_authserv(char *, char *); 44void mm_inform_authserv(char *, char *);
45struct passwd *mm_getpwnamallow(const char *); 45struct passwd *mm_getpwnamallow(const char *);
46char *mm_auth2_read_banner(void); 46char *mm_auth2_read_banner(void);
@@ -87,7 +87,7 @@ void mm_ssh1_session_id(u_char *);
87int mm_ssh1_session_key(BIGNUM *); 87int mm_ssh1_session_key(BIGNUM *);
88 88
89/* Key export functions */ 89/* Key export functions */
90struct Newkeys *mm_newkeys_from_blob(u_char *, int); 90struct newkeys *mm_newkeys_from_blob(u_char *, int);
91int mm_newkeys_to_blob(int, u_char **, u_int *); 91int mm_newkeys_to_blob(int, u_char **, u_int *);
92 92
93void monitor_apply_keystate(struct monitor *); 93void monitor_apply_keystate(struct monitor *);
@@ -103,9 +103,6 @@ int mm_skey_query(void *, char **, char **, u_int *, char ***, u_int **);
103int mm_skey_respond(void *, u_int, char **); 103int mm_skey_respond(void *, u_int, char **);
104 104
105/* zlib allocation hooks */ 105/* zlib allocation hooks */
106
107void *mm_zalloc(struct mm_master *, u_int, u_int);
108void mm_zfree(struct mm_master *, void *);
109void mm_init_compression(struct mm_master *); 106void mm_init_compression(struct mm_master *);
110 107
111#endif /* _MM_WRAP_H_ */ 108#endif /* _MM_WRAP_H_ */
diff --git a/msg.c b/msg.c
index cd5f98c4f..5a7b8ca91 100644
--- a/msg.c
+++ b/msg.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: msg.c,v 1.15 2006/08/03 03:34:42 deraadt Exp $ */ 1/* $OpenBSD: msg.c,v 1.16 2015/01/15 09:40:00 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2002 Markus Friedl. All rights reserved. 3 * Copyright (c) 2002 Markus Friedl. All rights reserved.
4 * 4 *
@@ -34,17 +34,18 @@
34#include <unistd.h> 34#include <unistd.h>
35#include <stdarg.h> 35#include <stdarg.h>
36 36
37#include "buffer.h" 37#include "sshbuf.h"
38#include "ssherr.h"
38#include "log.h" 39#include "log.h"
39#include "atomicio.h" 40#include "atomicio.h"
40#include "msg.h" 41#include "msg.h"
41#include "misc.h" 42#include "misc.h"
42 43
43int 44int
44ssh_msg_send(int fd, u_char type, Buffer *m) 45ssh_msg_send(int fd, u_char type, struct sshbuf *m)
45{ 46{
46 u_char buf[5]; 47 u_char buf[5];
47 u_int mlen = buffer_len(m); 48 u_int mlen = sshbuf_len(m);
48 49
49 debug3("ssh_msg_send: type %u", (unsigned int)type & 0xff); 50 debug3("ssh_msg_send: type %u", (unsigned int)type & 0xff);
50 51
@@ -54,7 +55,7 @@ ssh_msg_send(int fd, u_char type, Buffer *m)
54 error("ssh_msg_send: write"); 55 error("ssh_msg_send: write");
55 return (-1); 56 return (-1);
56 } 57 }
57 if (atomicio(vwrite, fd, buffer_ptr(m), mlen) != mlen) { 58 if (atomicio(vwrite, fd, (u_char *)sshbuf_ptr(m), mlen) != mlen) {
58 error("ssh_msg_send: write"); 59 error("ssh_msg_send: write");
59 return (-1); 60 return (-1);
60 } 61 }
@@ -62,10 +63,11 @@ ssh_msg_send(int fd, u_char type, Buffer *m)
62} 63}
63 64
64int 65int
65ssh_msg_recv(int fd, Buffer *m) 66ssh_msg_recv(int fd, struct sshbuf *m)
66{ 67{
67 u_char buf[4]; 68 u_char buf[4], *p;
68 u_int msg_len; 69 u_int msg_len;
70 int r;
69 71
70 debug3("ssh_msg_recv entering"); 72 debug3("ssh_msg_recv entering");
71 73
@@ -79,9 +81,12 @@ ssh_msg_recv(int fd, Buffer *m)
79 error("ssh_msg_recv: read: bad msg_len %u", msg_len); 81 error("ssh_msg_recv: read: bad msg_len %u", msg_len);
80 return (-1); 82 return (-1);
81 } 83 }
82 buffer_clear(m); 84 sshbuf_reset(m);
83 buffer_append_space(m, msg_len); 85 if ((r = sshbuf_reserve(m, msg_len, &p)) != 0) {
84 if (atomicio(read, fd, buffer_ptr(m), msg_len) != msg_len) { 86 error("%s: buffer error: %s", __func__, ssh_err(r));
87 return -1;
88 }
89 if (atomicio(read, fd, p, msg_len) != msg_len) {
85 error("ssh_msg_recv: read: %s", strerror(errno)); 90 error("ssh_msg_recv: read: %s", strerror(errno));
86 return (-1); 91 return (-1);
87 } 92 }
diff --git a/msg.h b/msg.h
index b0cb9b52b..dfb34247c 100644
--- a/msg.h
+++ b/msg.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: msg.h,v 1.4 2006/03/25 22:22:43 djm Exp $ */ 1/* $OpenBSD: msg.h,v 1.5 2015/01/15 09:40:00 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2002 Markus Friedl. All rights reserved. 3 * Copyright (c) 2002 Markus Friedl. All rights reserved.
4 * 4 *
@@ -25,7 +25,8 @@
25#ifndef SSH_MSG_H 25#ifndef SSH_MSG_H
26#define SSH_MSG_H 26#define SSH_MSG_H
27 27
28int ssh_msg_send(int, u_char, Buffer *); 28struct sshbuf;
29int ssh_msg_recv(int, Buffer *); 29int ssh_msg_send(int, u_char, struct sshbuf *);
30int ssh_msg_recv(int, struct sshbuf *);
30 31
31#endif 32#endif
diff --git a/mux.c b/mux.c
index 48f7a050f..f3faaeec9 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mux.c,v 1.48 2014/07/17 07:22:19 djm Exp $ */ 1/* $OpenBSD: mux.c,v 1.50 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -33,7 +33,6 @@
33#include "includes.h" 33#include "includes.h"
34 34
35#include <sys/types.h> 35#include <sys/types.h>
36#include <sys/param.h>
37#include <sys/stat.h> 36#include <sys/stat.h>
38#include <sys/socket.h> 37#include <sys/socket.h>
39#include <sys/un.h> 38#include <sys/un.h>
@@ -1689,7 +1688,8 @@ mux_client_forward(int fd, int cancel_flag, u_int ftype, struct Forward *fwd)
1689 buffer_put_cstring(&m, fwd->listen_path); 1688 buffer_put_cstring(&m, fwd->listen_path);
1690 } else { 1689 } else {
1691 buffer_put_cstring(&m, 1690 buffer_put_cstring(&m,
1692 fwd->listen_host == NULL ? "" : fwd->listen_host); 1691 fwd->listen_host == NULL ? "" :
1692 (*fwd->listen_host == '\0' ? "*" : fwd->listen_host));
1693 } 1693 }
1694 buffer_put_int(&m, fwd->listen_port); 1694 buffer_put_int(&m, fwd->listen_port);
1695 if (fwd->connect_path != NULL) { 1695 if (fwd->connect_path != NULL) {
diff --git a/opacket.c b/opacket.c
new file mode 100644
index 000000000..b9160d59d
--- /dev/null
+++ b/opacket.c
@@ -0,0 +1,349 @@
1/* Written by Markus Friedl. Placed in the public domain. */
2
3#include "includes.h"
4
5#include "ssherr.h"
6#include "packet.h"
7#include "log.h"
8
9struct ssh *active_state, *backup_state;
10
11/* Map old to new API */
12
13void
14ssh_packet_start(struct ssh *ssh, u_char type)
15{
16 int r;
17
18 if ((r = sshpkt_start(ssh, type)) != 0)
19 fatal("%s: %s", __func__, ssh_err(r));
20}
21
22void
23ssh_packet_put_char(struct ssh *ssh, int value)
24{
25 u_char ch = value;
26 int r;
27
28 if ((r = sshpkt_put_u8(ssh, ch)) != 0)
29 fatal("%s: %s", __func__, ssh_err(r));
30}
31
32void
33ssh_packet_put_int(struct ssh *ssh, u_int value)
34{
35 int r;
36
37 if ((r = sshpkt_put_u32(ssh, value)) != 0)
38 fatal("%s: %s", __func__, ssh_err(r));
39}
40
41void
42ssh_packet_put_int64(struct ssh *ssh, u_int64_t value)
43{
44 int r;
45
46 if ((r = sshpkt_put_u64(ssh, value)) != 0)
47 fatal("%s: %s", __func__, ssh_err(r));
48}
49
50void
51ssh_packet_put_string(struct ssh *ssh, const void *buf, u_int len)
52{
53 int r;
54
55 if ((r = sshpkt_put_string(ssh, buf, len)) != 0)
56 fatal("%s: %s", __func__, ssh_err(r));
57}
58
59void
60ssh_packet_put_cstring(struct ssh *ssh, const char *str)
61{
62 int r;
63
64 if ((r = sshpkt_put_cstring(ssh, str)) != 0)
65 fatal("%s: %s", __func__, ssh_err(r));
66}
67
68void
69ssh_packet_put_raw(struct ssh *ssh, const void *buf, u_int len)
70{
71 int r;
72
73 if ((r = sshpkt_put(ssh, buf, len)) != 0)
74 fatal("%s: %s", __func__, ssh_err(r));
75}
76
77#ifdef WITH_SSH1
78void
79ssh_packet_put_bignum(struct ssh *ssh, BIGNUM * value)
80{
81 int r;
82
83 if ((r = sshpkt_put_bignum1(ssh, value)) != 0)
84 fatal("%s: %s", __func__, ssh_err(r));
85}
86#endif
87
88#ifdef WITH_OPENSSL
89void
90ssh_packet_put_bignum2(struct ssh *ssh, BIGNUM * value)
91{
92 int r;
93
94 if ((r = sshpkt_put_bignum2(ssh, value)) != 0)
95 fatal("%s: %s", __func__, ssh_err(r));
96}
97
98# ifdef OPENSSL_HAS_ECC
99void
100ssh_packet_put_ecpoint(struct ssh *ssh, const EC_GROUP *curve,
101 const EC_POINT *point)
102{
103 int r;
104
105 if ((r = sshpkt_put_ec(ssh, point, curve)) != 0)
106 fatal("%s: %s", __func__, ssh_err(r));
107}
108# endif
109#endif /* WITH_OPENSSL */
110
111void
112ssh_packet_send(struct ssh *ssh)
113{
114 int r;
115
116 if ((r = sshpkt_send(ssh)) != 0)
117 fatal("%s: %s", __func__, ssh_err(r));
118}
119
120u_int
121ssh_packet_get_char(struct ssh *ssh)
122{
123 u_char ch;
124 int r;
125
126 if ((r = sshpkt_get_u8(ssh, &ch)) != 0)
127 fatal("%s: %s", __func__, ssh_err(r));
128 return ch;
129}
130
131u_int
132ssh_packet_get_int(struct ssh *ssh)
133{
134 u_int val;
135 int r;
136
137 if ((r = sshpkt_get_u32(ssh, &val)) != 0)
138 fatal("%s: %s", __func__, ssh_err(r));
139 return val;
140}
141
142u_int64_t
143ssh_packet_get_int64(struct ssh *ssh)
144{
145 u_int64_t val;
146 int r;
147
148 if ((r = sshpkt_get_u64(ssh, &val)) != 0)
149 fatal("%s: %s", __func__, ssh_err(r));
150 return val;
151}
152
153#ifdef WITH_SSH1
154void
155ssh_packet_get_bignum(struct ssh *ssh, BIGNUM * value)
156{
157 int r;
158
159 if ((r = sshpkt_get_bignum1(ssh, value)) != 0)
160 fatal("%s: %s", __func__, ssh_err(r));
161}
162#endif
163
164#ifdef WITH_OPENSSL
165void
166ssh_packet_get_bignum2(struct ssh *ssh, BIGNUM * value)
167{
168 int r;
169
170 if ((r = sshpkt_get_bignum2(ssh, value)) != 0)
171 fatal("%s: %s", __func__, ssh_err(r));
172}
173
174# ifdef OPENSSL_HAS_ECC
175void
176ssh_packet_get_ecpoint(struct ssh *ssh, const EC_GROUP *curve, EC_POINT *point)
177{
178 int r;
179
180 if ((r = sshpkt_get_ec(ssh, point, curve)) != 0)
181 fatal("%s: %s", __func__, ssh_err(r));
182}
183# endif
184#endif /* WITH_OPENSSL */
185
186void *
187ssh_packet_get_string(struct ssh *ssh, u_int *length_ptr)
188{
189 int r;
190 size_t len;
191 u_char *val;
192
193 if ((r = sshpkt_get_string(ssh, &val, &len)) != 0)
194 fatal("%s: %s", __func__, ssh_err(r));
195 if (length_ptr != NULL)
196 *length_ptr = (u_int)len;
197 return val;
198}
199
200const void *
201ssh_packet_get_string_ptr(struct ssh *ssh, u_int *length_ptr)
202{
203 int r;
204 size_t len;
205 const u_char *val;
206
207 if ((r = sshpkt_get_string_direct(ssh, &val, &len)) != 0)
208 fatal("%s: %s", __func__, ssh_err(r));
209 if (length_ptr != NULL)
210 *length_ptr = (u_int)len;
211 return val;
212}
213
214char *
215ssh_packet_get_cstring(struct ssh *ssh, u_int *length_ptr)
216{
217 int r;
218 size_t len;
219 char *val;
220
221 if ((r = sshpkt_get_cstring(ssh, &val, &len)) != 0)
222 fatal("%s: %s", __func__, ssh_err(r));
223 if (length_ptr != NULL)
224 *length_ptr = (u_int)len;
225 return val;
226}
227
228/* Old API, that had to be reimplemented */
229
230void
231packet_set_connection(int fd_in, int fd_out)
232{
233 active_state = ssh_packet_set_connection(active_state, fd_in, fd_out);
234 if (active_state == NULL)
235 fatal("%s: ssh_packet_set_connection failed", __func__);
236}
237
238void
239packet_backup_state(void)
240{
241 ssh_packet_backup_state(active_state, backup_state);
242}
243
244void
245packet_restore_state(void)
246{
247 ssh_packet_restore_state(active_state, backup_state);
248}
249
250u_int
251packet_get_char(void)
252{
253 return (ssh_packet_get_char(active_state));
254}
255
256u_int
257packet_get_int(void)
258{
259 return (ssh_packet_get_int(active_state));
260}
261
262int
263packet_read_seqnr(u_int32_t *seqnr)
264{
265 u_char type;
266 int r;
267
268 if ((r = ssh_packet_read_seqnr(active_state, &type, seqnr)) != 0)
269 sshpkt_fatal(active_state, __func__, r);
270 return type;
271}
272
273int
274packet_read_poll_seqnr(u_int32_t *seqnr)
275{
276 u_char type;
277 int r;
278
279 if ((r = ssh_packet_read_poll_seqnr(active_state, &type, seqnr)))
280 sshpkt_fatal(active_state, __func__, r);
281 return type;
282}
283
284void
285packet_close(void)
286{
287 ssh_packet_close(active_state);
288 active_state = NULL;
289}
290
291void
292packet_process_incoming(const char *buf, u_int len)
293{
294 int r;
295
296 if ((r = ssh_packet_process_incoming(active_state, buf, len)) != 0)
297 sshpkt_fatal(active_state, __func__, r);
298}
299
300void
301packet_write_wait(void)
302{
303 int r;
304
305 if ((r = ssh_packet_write_wait(active_state)) != 0)
306 sshpkt_fatal(active_state, __func__, r);
307}
308
309void
310packet_write_poll(void)
311{
312 int r;
313
314 if ((r = ssh_packet_write_poll(active_state)) != 0)
315 sshpkt_fatal(active_state, __func__, r);
316}
317
318void
319packet_read_expect(int expected_type)
320{
321 int r;
322
323 if ((r = ssh_packet_read_expect(active_state, expected_type)) != 0)
324 sshpkt_fatal(active_state, __func__, r);
325}
326
327void
328packet_disconnect(const char *fmt, ...)
329{
330 char buf[1024];
331 va_list args;
332
333 va_start(args, fmt);
334 vsnprintf(buf, sizeof(buf), fmt, args);
335 va_end(args);
336 ssh_packet_disconnect(active_state, "%s", buf);
337}
338
339void
340packet_send_debug(const char *fmt, ...)
341{
342 char buf[1024];
343 va_list args;
344
345 va_start(args, fmt);
346 vsnprintf(buf, sizeof(buf), fmt, args);
347 va_end(args);
348 ssh_packet_send_debug(active_state, "%s", buf);
349}
diff --git a/opacket.h b/opacket.h
new file mode 100644
index 000000000..a0a60e550
--- /dev/null
+++ b/opacket.h
@@ -0,0 +1,168 @@
1#ifndef _OPACKET_H
2/* Written by Markus Friedl. Placed in the public domain. */
3
4/* Map old to new API */
5void ssh_packet_start(struct ssh *, u_char);
6void ssh_packet_put_char(struct ssh *, int ch);
7void ssh_packet_put_int(struct ssh *, u_int value);
8void ssh_packet_put_int64(struct ssh *, u_int64_t value);
9void ssh_packet_put_bignum(struct ssh *, BIGNUM * value);
10void ssh_packet_put_bignum2(struct ssh *, BIGNUM * value);
11void ssh_packet_put_ecpoint(struct ssh *, const EC_GROUP *, const EC_POINT *);
12void ssh_packet_put_string(struct ssh *, const void *buf, u_int len);
13void ssh_packet_put_cstring(struct ssh *, const char *str);
14void ssh_packet_put_raw(struct ssh *, const void *buf, u_int len);
15void ssh_packet_send(struct ssh *);
16
17u_int ssh_packet_get_char(struct ssh *);
18u_int ssh_packet_get_int(struct ssh *);
19u_int64_t ssh_packet_get_int64(struct ssh *);
20void ssh_packet_get_bignum(struct ssh *, BIGNUM * value);
21void ssh_packet_get_bignum2(struct ssh *, BIGNUM * value);
22void ssh_packet_get_ecpoint(struct ssh *, const EC_GROUP *, EC_POINT *);
23void *ssh_packet_get_string(struct ssh *, u_int *length_ptr);
24char *ssh_packet_get_cstring(struct ssh *, u_int *length_ptr);
25
26/* don't allow remaining bytes after the end of the message */
27#define ssh_packet_check_eom(ssh) \
28do { \
29 int _len = ssh_packet_remaining(ssh); \
30 if (_len > 0) { \
31 logit("Packet integrity error (%d bytes remaining) at %s:%d", \
32 _len ,__FILE__, __LINE__); \
33 ssh_packet_disconnect(ssh, \
34 "Packet integrity error."); \
35 } \
36} while (0)
37
38/* old API */
39void packet_close(void);
40u_int packet_get_char(void);
41u_int packet_get_int(void);
42void packet_backup_state(void);
43void packet_restore_state(void);
44void packet_set_connection(int, int);
45int packet_read_seqnr(u_int32_t *);
46int packet_read_poll_seqnr(u_int32_t *);
47void packet_process_incoming(const char *buf, u_int len);
48void packet_write_wait(void);
49void packet_write_poll(void);
50void packet_read_expect(int expected_type);
51#define packet_set_timeout(timeout, count) \
52 ssh_packet_set_timeout(active_state, (timeout), (count))
53#define packet_connection_is_on_socket() \
54 ssh_packet_connection_is_on_socket(active_state)
55#define packet_set_nonblocking() \
56 ssh_packet_set_nonblocking(active_state)
57#define packet_get_connection_in() \
58 ssh_packet_get_connection_in(active_state)
59#define packet_get_connection_out() \
60 ssh_packet_get_connection_out(active_state)
61#define packet_set_protocol_flags(protocol_flags) \
62 ssh_packet_set_protocol_flags(active_state, (protocol_flags))
63#define packet_get_protocol_flags() \
64 ssh_packet_get_protocol_flags(active_state)
65#define packet_start_compression(level) \
66 ssh_packet_start_compression(active_state, (level))
67#define packet_set_encryption_key(key, keylen, number) \
68 ssh_packet_set_encryption_key(active_state, (key), (keylen), (number))
69#define packet_start(type) \
70 ssh_packet_start(active_state, (type))
71#define packet_put_char(value) \
72 ssh_packet_put_char(active_state, (value))
73#define packet_put_int(value) \
74 ssh_packet_put_int(active_state, (value))
75#define packet_put_int64(value) \
76 ssh_packet_put_int64(active_state, (value))
77#define packet_put_string( buf, len) \
78 ssh_packet_put_string(active_state, (buf), (len))
79#define packet_put_cstring(str) \
80 ssh_packet_put_cstring(active_state, (str))
81#define packet_put_raw(buf, len) \
82 ssh_packet_put_raw(active_state, (buf), (len))
83#define packet_put_bignum(value) \
84 ssh_packet_put_bignum(active_state, (value))
85#define packet_put_bignum2(value) \
86 ssh_packet_put_bignum2(active_state, (value))
87#define packet_send() \
88 ssh_packet_send(active_state)
89#define packet_read() \
90 ssh_packet_read(active_state)
91#define packet_get_int64() \
92 ssh_packet_get_int64(active_state)
93#define packet_get_bignum(value) \
94 ssh_packet_get_bignum(active_state, (value))
95#define packet_get_bignum2(value) \
96 ssh_packet_get_bignum2(active_state, (value))
97#define packet_remaining() \
98 ssh_packet_remaining(active_state)
99#define packet_get_string(length_ptr) \
100 ssh_packet_get_string(active_state, (length_ptr))
101#define packet_get_string_ptr(length_ptr) \
102 ssh_packet_get_string_ptr(active_state, (length_ptr))
103#define packet_get_cstring(length_ptr) \
104 ssh_packet_get_cstring(active_state, (length_ptr))
105void packet_send_debug(const char *, ...)
106 __attribute__((format(printf, 1, 2)));
107void packet_disconnect(const char *, ...)
108 __attribute__((format(printf, 1, 2)))
109 __attribute__((noreturn));
110#define packet_have_data_to_write() \
111 ssh_packet_have_data_to_write(active_state)
112#define packet_not_very_much_data_to_write() \
113 ssh_packet_not_very_much_data_to_write(active_state)
114#define packet_set_interactive(interactive, qos_interactive, qos_bulk) \
115 ssh_packet_set_interactive(active_state, (interactive), (qos_interactive), (qos_bulk))
116#define packet_is_interactive() \
117 ssh_packet_is_interactive(active_state)
118#define packet_set_maxsize(s) \
119 ssh_packet_set_maxsize(active_state, (s))
120#define packet_inc_alive_timeouts() \
121 ssh_packet_inc_alive_timeouts(active_state)
122#define packet_set_alive_timeouts(ka) \
123 ssh_packet_set_alive_timeouts(active_state, (ka))
124#define packet_get_maxsize() \
125 ssh_packet_get_maxsize(active_state)
126#define packet_add_padding(pad) \
127 sshpkt_add_padding(active_state, (pad))
128#define packet_send_ignore(nbytes) \
129 ssh_packet_send_ignore(active_state, (nbytes))
130#define packet_need_rekeying() \
131 ssh_packet_need_rekeying(active_state)
132#define packet_set_server() \
133 ssh_packet_set_server(active_state)
134#define packet_set_authenticated() \
135 ssh_packet_set_authenticated(active_state)
136#define packet_get_input() \
137 ssh_packet_get_input(active_state)
138#define packet_get_output() \
139 ssh_packet_get_output(active_state)
140#define packet_set_compress_hooks(ctx, allocfunc, freefunc) \
141 ssh_packet_set_compress_hooks(active_state, ctx, \
142 allocfunc, freefunc);
143#define packet_check_eom() \
144 ssh_packet_check_eom(active_state)
145#define set_newkeys(mode) \
146 ssh_set_newkeys(active_state, (mode))
147#define packet_get_state(m) \
148 ssh_packet_get_state(active_state, m)
149#define packet_set_state(m) \
150 ssh_packet_set_state(active_state, m)
151#if 0
152#define get_remote_ipaddr() \
153 ssh_remote_ipaddr(active_state)
154#endif
155#define packet_get_raw(lenp) \
156 sshpkt_ptr(active_state, lenp)
157#define packet_get_ecpoint(c,p) \
158 ssh_packet_get_ecpoint(active_state, c, p)
159#define packet_put_ecpoint(c,p) \
160 ssh_packet_put_ecpoint(active_state, c, p)
161#define packet_get_rekey_timeout() \
162 ssh_packet_get_rekey_timeout(active_state)
163#define packet_set_rekey_limits(x,y) \
164 ssh_packet_set_rekey_limits(active_state, x, y)
165#define packet_get_bytes(x,y) \
166 ssh_packet_get_bytes(active_state, x, y)
167
168#endif /* _OPACKET_H */
diff --git a/openbsd-compat/.cvsignore b/openbsd-compat/.cvsignore
new file mode 100644
index 000000000..f3c7a7c5d
--- /dev/null
+++ b/openbsd-compat/.cvsignore
@@ -0,0 +1 @@
Makefile
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index ab1a3e315..3c5e3b7f7 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -16,7 +16,7 @@ RANLIB=@RANLIB@
16INSTALL=@INSTALL@ 16INSTALL=@INSTALL@
17LDFLAGS=-L. @LDFLAGS@ 17LDFLAGS=-L. @LDFLAGS@
18 18
19OPENBSD=base64.o basename.o bcrypt_pbkdf.o bindresvport.o blowfish.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt_long.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o blowfish.o bcrypt_pbkdf.o explicit_bzero.o 19OPENBSD=base64.o basename.o bcrypt_pbkdf.o bindresvport.o blowfish.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt_long.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o reallocarray.o realpath.o rresvport.o setenv.o setproctitle.o sha1.o sha2.o rmd160.o md5.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o blowfish.o bcrypt_pbkdf.o explicit_bzero.o
20 20
21COMPAT=arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o kludge-fd_set.o 21COMPAT=arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o kludge-fd_set.o
22 22
diff --git a/openbsd-compat/arc4random.c b/openbsd-compat/arc4random.c
index 09dbfda16..046f57e61 100644
--- a/openbsd-compat/arc4random.c
+++ b/openbsd-compat/arc4random.c
@@ -26,15 +26,19 @@
26 26
27#include "includes.h" 27#include "includes.h"
28 28
29#include <sys/types.h>
30
31#include <fcntl.h>
29#include <stdlib.h> 32#include <stdlib.h>
30#include <string.h> 33#include <string.h>
31#include <unistd.h> 34#include <unistd.h>
32#include <sys/types.h>
33 35
34#ifndef HAVE_ARC4RANDOM 36#ifndef HAVE_ARC4RANDOM
35 37
38#ifdef WITH_OPENSSL
36#include <openssl/rand.h> 39#include <openssl/rand.h>
37#include <openssl/err.h> 40#include <openssl/err.h>
41#endif
38 42
39#include "log.h" 43#include "log.h"
40 44
@@ -73,14 +77,44 @@ _rs_init(u_char *buf, size_t n)
73 chacha_ivsetup(&rs, buf + KEYSZ); 77 chacha_ivsetup(&rs, buf + KEYSZ);
74} 78}
75 79
80#ifndef WITH_OPENSSL
81#define SSH_RANDOM_DEV "/dev/urandom"
82/* XXX use getrandom() if supported on Linux */
83static void
84getrnd(u_char *s, size_t len)
85{
86 int fd;
87 ssize_t r;
88 size_t o = 0;
89
90 if ((fd = open(SSH_RANDOM_DEV, O_RDONLY)) == -1)
91 fatal("Couldn't open %s: %s", SSH_RANDOM_DEV, strerror(errno));
92 while (o < len) {
93 r = read(fd, s + o, len - o);
94 if (r < 0) {
95 if (errno == EAGAIN || errno == EINTR ||
96 errno == EWOULDBLOCK)
97 continue;
98 fatal("read %s: %s", SSH_RANDOM_DEV, strerror(errno));
99 }
100 o += r;
101 }
102 close(fd);
103}
104#endif
105
76static void 106static void
77_rs_stir(void) 107_rs_stir(void)
78{ 108{
79 u_char rnd[KEYSZ + IVSZ]; 109 u_char rnd[KEYSZ + IVSZ];
80 110
111#ifdef WITH_OPENSSL
81 if (RAND_bytes(rnd, sizeof(rnd)) <= 0) 112 if (RAND_bytes(rnd, sizeof(rnd)) <= 0)
82 fatal("Couldn't obtain random bytes (error %ld)", 113 fatal("Couldn't obtain random bytes (error %ld)",
83 ERR_get_error()); 114 ERR_get_error());
115#else
116 getrnd(rnd, sizeof(rnd));
117#endif
84 118
85 if (!rs_initialized) { 119 if (!rs_initialized) {
86 rs_initialized = 1; 120 rs_initialized = 1;
diff --git a/openbsd-compat/bcrypt_pbkdf.c b/openbsd-compat/bcrypt_pbkdf.c
index 91b6ba07b..16912575a 100644
--- a/openbsd-compat/bcrypt_pbkdf.c
+++ b/openbsd-compat/bcrypt_pbkdf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bcrypt_pbkdf.c,v 1.4 2013/07/29 00:55:53 tedu Exp $ */ 1/* $OpenBSD: bcrypt_pbkdf.c,v 1.9 2014/07/13 21:21:25 tedu Exp $ */
2/* 2/*
3 * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org> 3 * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
4 * 4 *
@@ -32,6 +32,9 @@
32#endif 32#endif
33 33
34#include "crypto_api.h" 34#include "crypto_api.h"
35#ifdef SHA512_DIGEST_LENGTH
36# undef SHA512_DIGEST_LENGTH
37#endif
35#define SHA512_DIGEST_LENGTH crypto_hash_sha512_BYTES 38#define SHA512_DIGEST_LENGTH crypto_hash_sha512_BYTES
36 39
37/* 40/*
@@ -51,8 +54,8 @@
51 * 54 *
52 * One modification from official pbkdf2. Instead of outputting key material 55 * One modification from official pbkdf2. Instead of outputting key material
53 * linearly, we mix it. pbkdf2 has a known weakness where if one uses it to 56 * linearly, we mix it. pbkdf2 has a known weakness where if one uses it to
54 * generate (i.e.) 512 bits of key material for use as two 256 bit keys, an 57 * generate (e.g.) 512 bits of key material for use as two 256 bit keys, an
55 * attacker can merely run once through the outer loop below, but the user 58 * attacker can merely run once through the outer loop, but the user
56 * always runs it twice. Shuffling output bytes requires computing the 59 * always runs it twice. Shuffling output bytes requires computing the
57 * entirety of the key material to assemble any subkey. This is something a 60 * entirety of the key material to assemble any subkey. This is something a
58 * wise caller could do; we just do it for you. 61 * wise caller could do; we just do it for you.
@@ -97,9 +100,9 @@ bcrypt_hash(u_int8_t *sha2pass, u_int8_t *sha2salt, u_int8_t *out)
97 } 100 }
98 101
99 /* zap */ 102 /* zap */
100 memset(ciphertext, 0, sizeof(ciphertext)); 103 explicit_bzero(ciphertext, sizeof(ciphertext));
101 memset(cdata, 0, sizeof(cdata)); 104 explicit_bzero(cdata, sizeof(cdata));
102 memset(&state, 0, sizeof(state)); 105 explicit_bzero(&state, sizeof(state));
103} 106}
104 107
105int 108int
@@ -113,6 +116,7 @@ bcrypt_pbkdf(const char *pass, size_t passlen, const u_int8_t *salt, size_t salt
113 u_int8_t *countsalt; 116 u_int8_t *countsalt;
114 size_t i, j, amt, stride; 117 size_t i, j, amt, stride;
115 uint32_t count; 118 uint32_t count;
119 size_t origkeylen = keylen;
116 120
117 /* nothing crazy */ 121 /* nothing crazy */
118 if (rounds < 1) 122 if (rounds < 1)
@@ -155,14 +159,17 @@ bcrypt_pbkdf(const char *pass, size_t passlen, const u_int8_t *salt, size_t salt
155 * pbkdf2 deviation: ouput the key material non-linearly. 159 * pbkdf2 deviation: ouput the key material non-linearly.
156 */ 160 */
157 amt = MIN(amt, keylen); 161 amt = MIN(amt, keylen);
158 for (i = 0; i < amt; i++) 162 for (i = 0; i < amt; i++) {
159 key[i * stride + (count - 1)] = out[i]; 163 size_t dest = i * stride + (count - 1);
160 keylen -= amt; 164 if (dest >= origkeylen)
165 break;
166 key[dest] = out[i];
167 }
168 keylen -= i;
161 } 169 }
162 170
163 /* zap */ 171 /* zap */
164 memset(out, 0, sizeof(out)); 172 explicit_bzero(out, sizeof(out));
165 memset(countsalt, 0, saltlen + 4);
166 free(countsalt); 173 free(countsalt);
167 174
168 return 0; 175 return 0;
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 65e800397..f7be415ec 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -31,8 +31,6 @@
31#include <time.h> 31#include <time.h>
32#include <unistd.h> 32#include <unistd.h>
33 33
34#include "xmalloc.h"
35
36#ifndef HAVE___PROGNAME 34#ifndef HAVE___PROGNAME
37char *__progname; 35char *__progname;
38#endif 36#endif
@@ -43,13 +41,12 @@ char *__progname;
43 */ 41 */
44char *ssh_get_progname(char *argv0) 42char *ssh_get_progname(char *argv0)
45{ 43{
44 char *p, *q;
46#ifdef HAVE___PROGNAME 45#ifdef HAVE___PROGNAME
47 extern char *__progname; 46 extern char *__progname;
48 47
49 return xstrdup(__progname); 48 p = __progname;
50#else 49#else
51 char *p;
52
53 if (argv0 == NULL) 50 if (argv0 == NULL)
54 return ("unknown"); /* XXX */ 51 return ("unknown"); /* XXX */
55 p = strrchr(argv0, '/'); 52 p = strrchr(argv0, '/');
@@ -57,9 +54,12 @@ char *ssh_get_progname(char *argv0)
57 p = argv0; 54 p = argv0;
58 else 55 else
59 p++; 56 p++;
60
61 return (xstrdup(p));
62#endif 57#endif
58 if ((q = strdup(p)) == NULL) {
59 perror("strdup");
60 exit(1);
61 }
62 return q;
63} 63}
64 64
65#ifndef HAVE_SETLOGIN 65#ifndef HAVE_SETLOGIN
diff --git a/openbsd-compat/fake-rfc2553.h b/openbsd-compat/fake-rfc2553.h
index 3e9090fc8..6426f7bf6 100644
--- a/openbsd-compat/fake-rfc2553.h
+++ b/openbsd-compat/fake-rfc2553.h
@@ -109,6 +109,9 @@ struct sockaddr_in6 {
109#ifndef AI_NUMERICHOST 109#ifndef AI_NUMERICHOST
110# define AI_NUMERICHOST (1<<2) 110# define AI_NUMERICHOST (1<<2)
111#endif 111#endif
112#ifndef AI_NUMERICSERV
113# define AI_NUMERICSERV (1<<3)
114#endif
112 115
113#ifndef NI_MAXSERV 116#ifndef NI_MAXSERV
114# define NI_MAXSERV 32 117# define NI_MAXSERV 32
diff --git a/openbsd-compat/getrrsetbyname-ldns.c b/openbsd-compat/getrrsetbyname-ldns.c
index 343720f10..4647b623b 100644
--- a/openbsd-compat/getrrsetbyname-ldns.c
+++ b/openbsd-compat/getrrsetbyname-ldns.c
@@ -69,7 +69,7 @@ getrrsetbyname(const char *hostname, unsigned int rdclass,
69 struct rrsetinfo *rrset = NULL; 69 struct rrsetinfo *rrset = NULL;
70 struct rdatainfo *rdata; 70 struct rdatainfo *rdata;
71 size_t len; 71 size_t len;
72 ldns_resolver *ldns_res; 72 ldns_resolver *ldns_res = NULL;
73 ldns_rdf *domain = NULL; 73 ldns_rdf *domain = NULL;
74 ldns_pkt *pkt = NULL; 74 ldns_pkt *pkt = NULL;
75 ldns_rr_list *rrsigs = NULL, *rrdata = NULL; 75 ldns_rr_list *rrsigs = NULL, *rrdata = NULL;
diff --git a/openbsd-compat/md5.c b/openbsd-compat/md5.c
new file mode 100644
index 000000000..195ab515d
--- /dev/null
+++ b/openbsd-compat/md5.c
@@ -0,0 +1,251 @@
1/* $OpenBSD: md5.c,v 1.9 2014/01/08 06:14:57 tedu Exp $ */
2
3/*
4 * This code implements the MD5 message-digest algorithm.
5 * The algorithm is due to Ron Rivest. This code was
6 * written by Colin Plumb in 1993, no copyright is claimed.
7 * This code is in the public domain; do with it what you wish.
8 *
9 * Equivalent code is available from RSA Data Security, Inc.
10 * This code has been tested against that, and is equivalent,
11 * except that you don't need to include two pages of legalese
12 * with every copy.
13 *
14 * To compute the message digest of a chunk of bytes, declare an
15 * MD5Context structure, pass it to MD5Init, call MD5Update as
16 * needed on buffers full of bytes, and then call MD5Final, which
17 * will fill a supplied 16-byte array with the digest.
18 */
19
20#include "includes.h"
21
22#ifndef WITH_OPENSSL
23
24#include <sys/types.h>
25#include <string.h>
26#include "md5.h"
27
28#define PUT_64BIT_LE(cp, value) do { \
29 (cp)[7] = (value) >> 56; \
30 (cp)[6] = (value) >> 48; \
31 (cp)[5] = (value) >> 40; \
32 (cp)[4] = (value) >> 32; \
33 (cp)[3] = (value) >> 24; \
34 (cp)[2] = (value) >> 16; \
35 (cp)[1] = (value) >> 8; \
36 (cp)[0] = (value); } while (0)
37
38#define PUT_32BIT_LE(cp, value) do { \
39 (cp)[3] = (value) >> 24; \
40 (cp)[2] = (value) >> 16; \
41 (cp)[1] = (value) >> 8; \
42 (cp)[0] = (value); } while (0)
43
44static u_int8_t PADDING[MD5_BLOCK_LENGTH] = {
45 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
46 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
47 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
48};
49
50/*
51 * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
52 * initialization constants.
53 */
54void
55MD5Init(MD5_CTX *ctx)
56{
57 ctx->count = 0;
58 ctx->state[0] = 0x67452301;
59 ctx->state[1] = 0xefcdab89;
60 ctx->state[2] = 0x98badcfe;
61 ctx->state[3] = 0x10325476;
62}
63
64/*
65 * Update context to reflect the concatenation of another buffer full
66 * of bytes.
67 */
68void
69MD5Update(MD5_CTX *ctx, const unsigned char *input, size_t len)
70{
71 size_t have, need;
72
73 /* Check how many bytes we already have and how many more we need. */
74 have = (size_t)((ctx->count >> 3) & (MD5_BLOCK_LENGTH - 1));
75 need = MD5_BLOCK_LENGTH - have;
76
77 /* Update bitcount */
78 ctx->count += (u_int64_t)len << 3;
79
80 if (len >= need) {
81 if (have != 0) {
82 memcpy(ctx->buffer + have, input, need);
83 MD5Transform(ctx->state, ctx->buffer);
84 input += need;
85 len -= need;
86 have = 0;
87 }
88
89 /* Process data in MD5_BLOCK_LENGTH-byte chunks. */
90 while (len >= MD5_BLOCK_LENGTH) {
91 MD5Transform(ctx->state, input);
92 input += MD5_BLOCK_LENGTH;
93 len -= MD5_BLOCK_LENGTH;
94 }
95 }
96
97 /* Handle any remaining bytes of data. */
98 if (len != 0)
99 memcpy(ctx->buffer + have, input, len);
100}
101
102/*
103 * Pad pad to 64-byte boundary with the bit pattern
104 * 1 0* (64-bit count of bits processed, MSB-first)
105 */
106void
107MD5Pad(MD5_CTX *ctx)
108{
109 u_int8_t count[8];
110 size_t padlen;
111
112 /* Convert count to 8 bytes in little endian order. */
113 PUT_64BIT_LE(count, ctx->count);
114
115 /* Pad out to 56 mod 64. */
116 padlen = MD5_BLOCK_LENGTH -
117 ((ctx->count >> 3) & (MD5_BLOCK_LENGTH - 1));
118 if (padlen < 1 + 8)
119 padlen += MD5_BLOCK_LENGTH;
120 MD5Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
121 MD5Update(ctx, count, 8);
122}
123
124/*
125 * Final wrapup--call MD5Pad, fill in digest and zero out ctx.
126 */
127void
128MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], MD5_CTX *ctx)
129{
130 int i;
131
132 MD5Pad(ctx);
133 for (i = 0; i < 4; i++)
134 PUT_32BIT_LE(digest + i * 4, ctx->state[i]);
135 memset(ctx, 0, sizeof(*ctx));
136}
137
138
139/* The four core functions - F1 is optimized somewhat */
140
141/* #define F1(x, y, z) (x & y | ~x & z) */
142#define F1(x, y, z) (z ^ (x & (y ^ z)))
143#define F2(x, y, z) F1(z, x, y)
144#define F3(x, y, z) (x ^ y ^ z)
145#define F4(x, y, z) (y ^ (x | ~z))
146
147/* This is the central step in the MD5 algorithm. */
148#define MD5STEP(f, w, x, y, z, data, s) \
149 ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
150
151/*
152 * The core of the MD5 algorithm, this alters an existing MD5 hash to
153 * reflect the addition of 16 longwords of new data. MD5Update blocks
154 * the data and converts bytes into longwords for this routine.
155 */
156void
157MD5Transform(u_int32_t state[4], const u_int8_t block[MD5_BLOCK_LENGTH])
158{
159 u_int32_t a, b, c, d, in[MD5_BLOCK_LENGTH / 4];
160
161#if BYTE_ORDER == LITTLE_ENDIAN
162 memcpy(in, block, sizeof(in));
163#else
164 for (a = 0; a < MD5_BLOCK_LENGTH / 4; a++) {
165 in[a] = (u_int32_t)(
166 (u_int32_t)(block[a * 4 + 0]) |
167 (u_int32_t)(block[a * 4 + 1]) << 8 |
168 (u_int32_t)(block[a * 4 + 2]) << 16 |
169 (u_int32_t)(block[a * 4 + 3]) << 24);
170 }
171#endif
172
173 a = state[0];
174 b = state[1];
175 c = state[2];
176 d = state[3];
177
178 MD5STEP(F1, a, b, c, d, in[ 0] + 0xd76aa478, 7);
179 MD5STEP(F1, d, a, b, c, in[ 1] + 0xe8c7b756, 12);
180 MD5STEP(F1, c, d, a, b, in[ 2] + 0x242070db, 17);
181 MD5STEP(F1, b, c, d, a, in[ 3] + 0xc1bdceee, 22);
182 MD5STEP(F1, a, b, c, d, in[ 4] + 0xf57c0faf, 7);
183 MD5STEP(F1, d, a, b, c, in[ 5] + 0x4787c62a, 12);
184 MD5STEP(F1, c, d, a, b, in[ 6] + 0xa8304613, 17);
185 MD5STEP(F1, b, c, d, a, in[ 7] + 0xfd469501, 22);
186 MD5STEP(F1, a, b, c, d, in[ 8] + 0x698098d8, 7);
187 MD5STEP(F1, d, a, b, c, in[ 9] + 0x8b44f7af, 12);
188 MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
189 MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
190 MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
191 MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
192 MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
193 MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
194
195 MD5STEP(F2, a, b, c, d, in[ 1] + 0xf61e2562, 5);
196 MD5STEP(F2, d, a, b, c, in[ 6] + 0xc040b340, 9);
197 MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
198 MD5STEP(F2, b, c, d, a, in[ 0] + 0xe9b6c7aa, 20);
199 MD5STEP(F2, a, b, c, d, in[ 5] + 0xd62f105d, 5);
200 MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
201 MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
202 MD5STEP(F2, b, c, d, a, in[ 4] + 0xe7d3fbc8, 20);
203 MD5STEP(F2, a, b, c, d, in[ 9] + 0x21e1cde6, 5);
204 MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
205 MD5STEP(F2, c, d, a, b, in[ 3] + 0xf4d50d87, 14);
206 MD5STEP(F2, b, c, d, a, in[ 8] + 0x455a14ed, 20);
207 MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
208 MD5STEP(F2, d, a, b, c, in[ 2] + 0xfcefa3f8, 9);
209 MD5STEP(F2, c, d, a, b, in[ 7] + 0x676f02d9, 14);
210 MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
211
212 MD5STEP(F3, a, b, c, d, in[ 5] + 0xfffa3942, 4);
213 MD5STEP(F3, d, a, b, c, in[ 8] + 0x8771f681, 11);
214 MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
215 MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
216 MD5STEP(F3, a, b, c, d, in[ 1] + 0xa4beea44, 4);
217 MD5STEP(F3, d, a, b, c, in[ 4] + 0x4bdecfa9, 11);
218 MD5STEP(F3, c, d, a, b, in[ 7] + 0xf6bb4b60, 16);
219 MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
220 MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
221 MD5STEP(F3, d, a, b, c, in[ 0] + 0xeaa127fa, 11);
222 MD5STEP(F3, c, d, a, b, in[ 3] + 0xd4ef3085, 16);
223 MD5STEP(F3, b, c, d, a, in[ 6] + 0x04881d05, 23);
224 MD5STEP(F3, a, b, c, d, in[ 9] + 0xd9d4d039, 4);
225 MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
226 MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
227 MD5STEP(F3, b, c, d, a, in[2 ] + 0xc4ac5665, 23);
228
229 MD5STEP(F4, a, b, c, d, in[ 0] + 0xf4292244, 6);
230 MD5STEP(F4, d, a, b, c, in[7 ] + 0x432aff97, 10);
231 MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
232 MD5STEP(F4, b, c, d, a, in[5 ] + 0xfc93a039, 21);
233 MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
234 MD5STEP(F4, d, a, b, c, in[3 ] + 0x8f0ccc92, 10);
235 MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
236 MD5STEP(F4, b, c, d, a, in[1 ] + 0x85845dd1, 21);
237 MD5STEP(F4, a, b, c, d, in[8 ] + 0x6fa87e4f, 6);
238 MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
239 MD5STEP(F4, c, d, a, b, in[6 ] + 0xa3014314, 15);
240 MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
241 MD5STEP(F4, a, b, c, d, in[4 ] + 0xf7537e82, 6);
242 MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
243 MD5STEP(F4, c, d, a, b, in[2 ] + 0x2ad7d2bb, 15);
244 MD5STEP(F4, b, c, d, a, in[9 ] + 0xeb86d391, 21);
245
246 state[0] += a;
247 state[1] += b;
248 state[2] += c;
249 state[3] += d;
250}
251#endif /* !WITH_OPENSSL */
diff --git a/openbsd-compat/md5.h b/openbsd-compat/md5.h
new file mode 100644
index 000000000..c83c19dca
--- /dev/null
+++ b/openbsd-compat/md5.h
@@ -0,0 +1,51 @@
1/* $OpenBSD: md5.h,v 1.17 2012/12/05 23:19:57 deraadt Exp $ */
2
3/*
4 * This code implements the MD5 message-digest algorithm.
5 * The algorithm is due to Ron Rivest. This code was
6 * written by Colin Plumb in 1993, no copyright is claimed.
7 * This code is in the public domain; do with it what you wish.
8 *
9 * Equivalent code is available from RSA Data Security, Inc.
10 * This code has been tested against that, and is equivalent,
11 * except that you don't need to include two pages of legalese
12 * with every copy.
13 */
14
15#ifndef _MD5_H_
16#define _MD5_H_
17
18#ifndef WITH_OPENSSL
19
20#define MD5_BLOCK_LENGTH 64
21#define MD5_DIGEST_LENGTH 16
22#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)
23
24typedef struct MD5Context {
25 u_int32_t state[4]; /* state */
26 u_int64_t count; /* number of bits, mod 2^64 */
27 u_int8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
28} MD5_CTX;
29
30void MD5Init(MD5_CTX *);
31void MD5Update(MD5_CTX *, const u_int8_t *, size_t)
32 __attribute__((__bounded__(__string__,2,3)));
33void MD5Pad(MD5_CTX *);
34void MD5Final(u_int8_t [MD5_DIGEST_LENGTH], MD5_CTX *)
35 __attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH)));
36void MD5Transform(u_int32_t [4], const u_int8_t [MD5_BLOCK_LENGTH])
37 __attribute__((__bounded__(__minbytes__,1,4)))
38 __attribute__((__bounded__(__minbytes__,2,MD5_BLOCK_LENGTH)));
39char *MD5End(MD5_CTX *, char *)
40 __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
41char *MD5File(const char *, char *)
42 __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
43char *MD5FileChunk(const char *, char *, off_t, off_t)
44 __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
45char *MD5Data(const u_int8_t *, size_t, char *)
46 __attribute__((__bounded__(__string__,1,2)))
47 __attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH)));
48
49#endif /* !WITH_OPENSSL */
50
51#endif /* _MD5_H_ */
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index ce6abae82..1cffefe06 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -43,7 +43,10 @@
43#include "readpassphrase.h" 43#include "readpassphrase.h"
44#include "vis.h" 44#include "vis.h"
45#include "getrrsetbyname.h" 45#include "getrrsetbyname.h"
46#include "sha1.h"
46#include "sha2.h" 47#include "sha2.h"
48#include "rmd160.h"
49#include "md5.h"
47#include "blf.h" 50#include "blf.h"
48 51
49#ifndef HAVE_BASENAME 52#ifndef HAVE_BASENAME
@@ -62,6 +65,10 @@ void closefrom(int);
62char *getcwd(char *pt, size_t size); 65char *getcwd(char *pt, size_t size);
63#endif 66#endif
64 67
68#ifndef HAVE_REALLOCARRAY
69void *reallocarray(void *, size_t, size_t);
70#endif
71
65#if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH) 72#if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH)
66char *realpath(const char *path, char *resolved); 73char *realpath(const char *path, char *resolved);
67#endif 74#endif
diff --git a/openbsd-compat/openssl-compat.c b/openbsd-compat/openssl-compat.c
index 36570e4ad..63a660c7a 100644
--- a/openbsd-compat/openssl-compat.c
+++ b/openbsd-compat/openssl-compat.c
@@ -19,6 +19,8 @@
19#define SSH_DONT_OVERLOAD_OPENSSL_FUNCS 19#define SSH_DONT_OVERLOAD_OPENSSL_FUNCS
20#include "includes.h" 20#include "includes.h"
21 21
22#ifdef WITH_OPENSSL
23
22#include <stdarg.h> 24#include <stdarg.h>
23#include <string.h> 25#include <string.h>
24 26
@@ -78,3 +80,5 @@ ssh_OpenSSL_add_all_algorithms(void)
78 OPENSSL_config(NULL); 80 OPENSSL_config(NULL);
79} 81}
80#endif 82#endif
83
84#endif /* WITH_OPENSSL */
diff --git a/openbsd-compat/openssl-compat.h b/openbsd-compat/openssl-compat.h
index 3695d412b..8917551d3 100644
--- a/openbsd-compat/openssl-compat.h
+++ b/openbsd-compat/openssl-compat.h
@@ -20,6 +20,8 @@
20#define _OPENSSL_COMPAT_H 20#define _OPENSSL_COMPAT_H
21 21
22#include "includes.h" 22#include "includes.h"
23#ifdef WITH_OPENSSL
24
23#include <openssl/opensslv.h> 25#include <openssl/opensslv.h>
24#include <openssl/evp.h> 26#include <openssl/evp.h>
25#include <openssl/rsa.h> 27#include <openssl/rsa.h>
@@ -90,4 +92,5 @@ void ssh_OpenSSL_add_all_algorithms(void);
90 92
91#endif /* SSH_DONT_OVERLOAD_OPENSSL_FUNCS */ 93#endif /* SSH_DONT_OVERLOAD_OPENSSL_FUNCS */
92 94
95#endif /* WITH_OPENSSL */
93#endif /* _OPENSSL_COMPAT_H */ 96#endif /* _OPENSSL_COMPAT_H */
diff --git a/openbsd-compat/port-tun.c b/openbsd-compat/port-tun.c
index 0d756f74f..49e7b4d99 100644
--- a/openbsd-compat/port-tun.c
+++ b/openbsd-compat/port-tun.c
@@ -32,8 +32,9 @@
32#include "openbsd-compat/sys-queue.h" 32#include "openbsd-compat/sys-queue.h"
33#include "log.h" 33#include "log.h"
34#include "misc.h" 34#include "misc.h"
35#include "buffer.h" 35#include "sshbuf.h"
36#include "channels.h" 36#include "channels.h"
37#include "ssherr.h"
37 38
38/* 39/*
39 * This is the portable version of the SSH tunnel forwarding, it 40 * This is the portable version of the SSH tunnel forwarding, it
@@ -210,6 +211,7 @@ sys_tun_infilter(struct Channel *c, char *buf, int len)
210#endif 211#endif
211 u_int32_t *af; 212 u_int32_t *af;
212 char *ptr = buf; 213 char *ptr = buf;
214 int r;
213 215
214#if defined(SSH_TUN_PREPEND_AF) 216#if defined(SSH_TUN_PREPEND_AF)
215 if (len <= 0 || len > (int)(sizeof(rbuf) - sizeof(*af))) 217 if (len <= 0 || len > (int)(sizeof(rbuf) - sizeof(*af)))
@@ -242,7 +244,8 @@ sys_tun_infilter(struct Channel *c, char *buf, int len)
242 *af = htonl(OPENBSD_AF_INET); 244 *af = htonl(OPENBSD_AF_INET);
243#endif 245#endif
244 246
245 buffer_put_string(&c->input, ptr, len); 247 if ((r = sshbuf_put_string(&c->input, ptr, len)) != 0)
248 fatal("%s: buffer error: %s", __func__, ssh_err(r));
246 return (0); 249 return (0);
247} 250}
248 251
@@ -251,8 +254,14 @@ sys_tun_outfilter(struct Channel *c, u_char **data, u_int *dlen)
251{ 254{
252 u_char *buf; 255 u_char *buf;
253 u_int32_t *af; 256 u_int32_t *af;
254 257 int r;
255 *data = buffer_get_string(&c->output, dlen); 258 size_t xxx_dlen;
259
260 /* XXX new API is incompatible with this signature. */
261 if ((r = sshbuf_get_string(&c->output, data, &xxx_dlen)) != 0)
262 fatal("%s: buffer error: %s", __func__, ssh_err(r));
263 if (dlen != NULL)
264 *dlen = xxx_dlen;
256 if (*dlen < sizeof(*af)) 265 if (*dlen < sizeof(*af))
257 return (NULL); 266 return (NULL);
258 buf = *data; 267 buf = *data;
diff --git a/openbsd-compat/readpassphrase.c b/openbsd-compat/readpassphrase.c
index 62b6d0d84..d63cdf2f0 100644
--- a/openbsd-compat/readpassphrase.c
+++ b/openbsd-compat/readpassphrase.c
@@ -46,6 +46,14 @@
46# define _POSIX_VDISABLE VDISABLE 46# define _POSIX_VDISABLE VDISABLE
47#endif 47#endif
48 48
49#ifndef _NSIG
50# ifdef NSIG
51# define _NSIG NSIG
52# else
53# define _NSIG 128
54# endif
55#endif
56
49static volatile sig_atomic_t signo[_NSIG]; 57static volatile sig_atomic_t signo[_NSIG];
50 58
51static void handler(int); 59static void handler(int);
diff --git a/openbsd-compat/reallocarray.c b/openbsd-compat/reallocarray.c
new file mode 100644
index 000000000..1a52acc62
--- /dev/null
+++ b/openbsd-compat/reallocarray.c
@@ -0,0 +1,46 @@
1/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */
2/*
3 * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18/* OPENBSD ORIGINAL: lib/libc/stdlib/reallocarray.c */
19
20#include "includes.h"
21#ifndef HAVE_REALLOCARRAY
22
23#include <sys/types.h>
24#include <errno.h>
25#ifdef HAVE_STDINT_H
26#include <stdint.h>
27#endif
28#include <stdlib.h>
29
30/*
31 * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
32 * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
33 */
34#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
35
36void *
37reallocarray(void *optr, size_t nmemb, size_t size)
38{
39 if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
40 nmemb > 0 && SIZE_MAX / nmemb < size) {
41 errno = ENOMEM;
42 return NULL;
43 }
44 return realloc(optr, size * nmemb);
45}
46#endif /* HAVE_REALLOCARRAY */
diff --git a/openbsd-compat/regress/.cvsignore b/openbsd-compat/regress/.cvsignore
new file mode 100644
index 000000000..33074f4a3
--- /dev/null
+++ b/openbsd-compat/regress/.cvsignore
@@ -0,0 +1,6 @@
1Makefile
2snprintftest
3strduptest
4strtonumtest
5closefromtest
6opensslvertest
diff --git a/openbsd-compat/rmd160.c b/openbsd-compat/rmd160.c
new file mode 100644
index 000000000..2a14dd7b0
--- /dev/null
+++ b/openbsd-compat/rmd160.c
@@ -0,0 +1,376 @@
1/*
2 * Copyright (c) 2001 Markus Friedl. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24/*
25 * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160",
26 * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997,
27 * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf
28 */
29
30#include "includes.h"
31
32#ifndef WITH_OPENSSL
33
34#include <sys/types.h>
35#include <endian.h>
36#include <string.h>
37#include <rmd160.h>
38
39#define PUT_64BIT_LE(cp, value) do { \
40 (cp)[7] = (value) >> 56; \
41 (cp)[6] = (value) >> 48; \
42 (cp)[5] = (value) >> 40; \
43 (cp)[4] = (value) >> 32; \
44 (cp)[3] = (value) >> 24; \
45 (cp)[2] = (value) >> 16; \
46 (cp)[1] = (value) >> 8; \
47 (cp)[0] = (value); } while (0)
48
49#define PUT_32BIT_LE(cp, value) do { \
50 (cp)[3] = (value) >> 24; \
51 (cp)[2] = (value) >> 16; \
52 (cp)[1] = (value) >> 8; \
53 (cp)[0] = (value); } while (0)
54
55#define H0 0x67452301U
56#define H1 0xEFCDAB89U
57#define H2 0x98BADCFEU
58#define H3 0x10325476U
59#define H4 0xC3D2E1F0U
60
61#define K0 0x00000000U
62#define K1 0x5A827999U
63#define K2 0x6ED9EBA1U
64#define K3 0x8F1BBCDCU
65#define K4 0xA953FD4EU
66
67#define KK0 0x50A28BE6U
68#define KK1 0x5C4DD124U
69#define KK2 0x6D703EF3U
70#define KK3 0x7A6D76E9U
71#define KK4 0x00000000U
72
73/* rotate x left n bits. */
74#define ROL(n, x) (((x) << (n)) | ((x) >> (32-(n))))
75
76#define F0(x, y, z) ((x) ^ (y) ^ (z))
77#define F1(x, y, z) (((x) & (y)) | ((~x) & (z)))
78#define F2(x, y, z) (((x) | (~y)) ^ (z))
79#define F3(x, y, z) (((x) & (z)) | ((y) & (~z)))
80#define F4(x, y, z) ((x) ^ ((y) | (~z)))
81
82#define R(a, b, c, d, e, Fj, Kj, sj, rj) \
83 do { \
84 a = ROL(sj, a + Fj(b,c,d) + X(rj) + Kj) + e; \
85 c = ROL(10, c); \
86 } while(0)
87
88#define X(i) x[i]
89
90static u_int8_t PADDING[RMD160_BLOCK_LENGTH] = {
91 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
92 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
93 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
94};
95
96void
97RMD160Init(RMD160_CTX *ctx)
98{
99 ctx->count = 0;
100 ctx->state[0] = H0;
101 ctx->state[1] = H1;
102 ctx->state[2] = H2;
103 ctx->state[3] = H3;
104 ctx->state[4] = H4;
105}
106
107void
108RMD160Update(RMD160_CTX *ctx, const u_int8_t *input, size_t len)
109{
110 size_t have, off, need;
111
112 have = (ctx->count / 8) % RMD160_BLOCK_LENGTH;
113 need = RMD160_BLOCK_LENGTH - have;
114 ctx->count += 8 * len;
115 off = 0;
116
117 if (len >= need) {
118 if (have) {
119 memcpy(ctx->buffer + have, input, need);
120 RMD160Transform(ctx->state, ctx->buffer);
121 off = need;
122 have = 0;
123 }
124 /* now the buffer is empty */
125 while (off + RMD160_BLOCK_LENGTH <= len) {
126 RMD160Transform(ctx->state, input+off);
127 off += RMD160_BLOCK_LENGTH;
128 }
129 }
130 if (off < len)
131 memcpy(ctx->buffer + have, input+off, len-off);
132}
133
134void
135RMD160Pad(RMD160_CTX *ctx)
136{
137 u_int8_t size[8];
138 size_t padlen;
139
140 PUT_64BIT_LE(size, ctx->count);
141
142 /*
143 * pad to RMD160_BLOCK_LENGTH byte blocks, at least one byte from
144 * PADDING plus 8 bytes for the size
145 */
146 padlen = RMD160_BLOCK_LENGTH - ((ctx->count / 8) % RMD160_BLOCK_LENGTH);
147 if (padlen < 1 + 8)
148 padlen += RMD160_BLOCK_LENGTH;
149 RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
150 RMD160Update(ctx, size, 8);
151}
152
153void
154RMD160Final(u_int8_t digest[RMD160_DIGEST_LENGTH], RMD160_CTX *ctx)
155{
156 int i;
157
158 RMD160Pad(ctx);
159 for (i = 0; i < 5; i++)
160 PUT_32BIT_LE(digest + i*4, ctx->state[i]);
161 memset(ctx, 0, sizeof (*ctx));
162}
163
164void
165RMD160Transform(u_int32_t state[5], const u_int8_t block[RMD160_BLOCK_LENGTH])
166{
167 u_int32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16];
168
169#if BYTE_ORDER == LITTLE_ENDIAN
170 memcpy(x, block, RMD160_BLOCK_LENGTH);
171#else
172 int i;
173
174 for (i = 0; i < 16; i++)
175 x[i] = (u_int32_t)(
176 (u_int32_t)(block[i*4 + 0]) |
177 (u_int32_t)(block[i*4 + 1]) << 8 |
178 (u_int32_t)(block[i*4 + 2]) << 16 |
179 (u_int32_t)(block[i*4 + 3]) << 24);
180#endif
181
182 a = state[0];
183 b = state[1];
184 c = state[2];
185 d = state[3];
186 e = state[4];
187
188 /* Round 1 */
189 R(a, b, c, d, e, F0, K0, 11, 0);
190 R(e, a, b, c, d, F0, K0, 14, 1);
191 R(d, e, a, b, c, F0, K0, 15, 2);
192 R(c, d, e, a, b, F0, K0, 12, 3);
193 R(b, c, d, e, a, F0, K0, 5, 4);
194 R(a, b, c, d, e, F0, K0, 8, 5);
195 R(e, a, b, c, d, F0, K0, 7, 6);
196 R(d, e, a, b, c, F0, K0, 9, 7);
197 R(c, d, e, a, b, F0, K0, 11, 8);
198 R(b, c, d, e, a, F0, K0, 13, 9);
199 R(a, b, c, d, e, F0, K0, 14, 10);
200 R(e, a, b, c, d, F0, K0, 15, 11);
201 R(d, e, a, b, c, F0, K0, 6, 12);
202 R(c, d, e, a, b, F0, K0, 7, 13);
203 R(b, c, d, e, a, F0, K0, 9, 14);
204 R(a, b, c, d, e, F0, K0, 8, 15); /* #15 */
205 /* Round 2 */
206 R(e, a, b, c, d, F1, K1, 7, 7);
207 R(d, e, a, b, c, F1, K1, 6, 4);
208 R(c, d, e, a, b, F1, K1, 8, 13);
209 R(b, c, d, e, a, F1, K1, 13, 1);
210 R(a, b, c, d, e, F1, K1, 11, 10);
211 R(e, a, b, c, d, F1, K1, 9, 6);
212 R(d, e, a, b, c, F1, K1, 7, 15);
213 R(c, d, e, a, b, F1, K1, 15, 3);
214 R(b, c, d, e, a, F1, K1, 7, 12);
215 R(a, b, c, d, e, F1, K1, 12, 0);
216 R(e, a, b, c, d, F1, K1, 15, 9);
217 R(d, e, a, b, c, F1, K1, 9, 5);
218 R(c, d, e, a, b, F1, K1, 11, 2);
219 R(b, c, d, e, a, F1, K1, 7, 14);
220 R(a, b, c, d, e, F1, K1, 13, 11);
221 R(e, a, b, c, d, F1, K1, 12, 8); /* #31 */
222 /* Round 3 */
223 R(d, e, a, b, c, F2, K2, 11, 3);
224 R(c, d, e, a, b, F2, K2, 13, 10);
225 R(b, c, d, e, a, F2, K2, 6, 14);
226 R(a, b, c, d, e, F2, K2, 7, 4);
227 R(e, a, b, c, d, F2, K2, 14, 9);
228 R(d, e, a, b, c, F2, K2, 9, 15);
229 R(c, d, e, a, b, F2, K2, 13, 8);
230 R(b, c, d, e, a, F2, K2, 15, 1);
231 R(a, b, c, d, e, F2, K2, 14, 2);
232 R(e, a, b, c, d, F2, K2, 8, 7);
233 R(d, e, a, b, c, F2, K2, 13, 0);
234 R(c, d, e, a, b, F2, K2, 6, 6);
235 R(b, c, d, e, a, F2, K2, 5, 13);
236 R(a, b, c, d, e, F2, K2, 12, 11);
237 R(e, a, b, c, d, F2, K2, 7, 5);
238 R(d, e, a, b, c, F2, K2, 5, 12); /* #47 */
239 /* Round 4 */
240 R(c, d, e, a, b, F3, K3, 11, 1);
241 R(b, c, d, e, a, F3, K3, 12, 9);
242 R(a, b, c, d, e, F3, K3, 14, 11);
243 R(e, a, b, c, d, F3, K3, 15, 10);
244 R(d, e, a, b, c, F3, K3, 14, 0);
245 R(c, d, e, a, b, F3, K3, 15, 8);
246 R(b, c, d, e, a, F3, K3, 9, 12);
247 R(a, b, c, d, e, F3, K3, 8, 4);
248 R(e, a, b, c, d, F3, K3, 9, 13);
249 R(d, e, a, b, c, F3, K3, 14, 3);
250 R(c, d, e, a, b, F3, K3, 5, 7);
251 R(b, c, d, e, a, F3, K3, 6, 15);
252 R(a, b, c, d, e, F3, K3, 8, 14);
253 R(e, a, b, c, d, F3, K3, 6, 5);
254 R(d, e, a, b, c, F3, K3, 5, 6);
255 R(c, d, e, a, b, F3, K3, 12, 2); /* #63 */
256 /* Round 5 */
257 R(b, c, d, e, a, F4, K4, 9, 4);
258 R(a, b, c, d, e, F4, K4, 15, 0);
259 R(e, a, b, c, d, F4, K4, 5, 5);
260 R(d, e, a, b, c, F4, K4, 11, 9);
261 R(c, d, e, a, b, F4, K4, 6, 7);
262 R(b, c, d, e, a, F4, K4, 8, 12);
263 R(a, b, c, d, e, F4, K4, 13, 2);
264 R(e, a, b, c, d, F4, K4, 12, 10);
265 R(d, e, a, b, c, F4, K4, 5, 14);
266 R(c, d, e, a, b, F4, K4, 12, 1);
267 R(b, c, d, e, a, F4, K4, 13, 3);
268 R(a, b, c, d, e, F4, K4, 14, 8);
269 R(e, a, b, c, d, F4, K4, 11, 11);
270 R(d, e, a, b, c, F4, K4, 8, 6);
271 R(c, d, e, a, b, F4, K4, 5, 15);
272 R(b, c, d, e, a, F4, K4, 6, 13); /* #79 */
273
274 aa = a ; bb = b; cc = c; dd = d; ee = e;
275
276 a = state[0];
277 b = state[1];
278 c = state[2];
279 d = state[3];
280 e = state[4];
281
282 /* Parallel round 1 */
283 R(a, b, c, d, e, F4, KK0, 8, 5);
284 R(e, a, b, c, d, F4, KK0, 9, 14);
285 R(d, e, a, b, c, F4, KK0, 9, 7);
286 R(c, d, e, a, b, F4, KK0, 11, 0);
287 R(b, c, d, e, a, F4, KK0, 13, 9);
288 R(a, b, c, d, e, F4, KK0, 15, 2);
289 R(e, a, b, c, d, F4, KK0, 15, 11);
290 R(d, e, a, b, c, F4, KK0, 5, 4);
291 R(c, d, e, a, b, F4, KK0, 7, 13);
292 R(b, c, d, e, a, F4, KK0, 7, 6);
293 R(a, b, c, d, e, F4, KK0, 8, 15);
294 R(e, a, b, c, d, F4, KK0, 11, 8);
295 R(d, e, a, b, c, F4, KK0, 14, 1);
296 R(c, d, e, a, b, F4, KK0, 14, 10);
297 R(b, c, d, e, a, F4, KK0, 12, 3);
298 R(a, b, c, d, e, F4, KK0, 6, 12); /* #15 */
299 /* Parallel round 2 */
300 R(e, a, b, c, d, F3, KK1, 9, 6);
301 R(d, e, a, b, c, F3, KK1, 13, 11);
302 R(c, d, e, a, b, F3, KK1, 15, 3);
303 R(b, c, d, e, a, F3, KK1, 7, 7);
304 R(a, b, c, d, e, F3, KK1, 12, 0);
305 R(e, a, b, c, d, F3, KK1, 8, 13);
306 R(d, e, a, b, c, F3, KK1, 9, 5);
307 R(c, d, e, a, b, F3, KK1, 11, 10);
308 R(b, c, d, e, a, F3, KK1, 7, 14);
309 R(a, b, c, d, e, F3, KK1, 7, 15);
310 R(e, a, b, c, d, F3, KK1, 12, 8);
311 R(d, e, a, b, c, F3, KK1, 7, 12);
312 R(c, d, e, a, b, F3, KK1, 6, 4);
313 R(b, c, d, e, a, F3, KK1, 15, 9);
314 R(a, b, c, d, e, F3, KK1, 13, 1);
315 R(e, a, b, c, d, F3, KK1, 11, 2); /* #31 */
316 /* Parallel round 3 */
317 R(d, e, a, b, c, F2, KK2, 9, 15);
318 R(c, d, e, a, b, F2, KK2, 7, 5);
319 R(b, c, d, e, a, F2, KK2, 15, 1);
320 R(a, b, c, d, e, F2, KK2, 11, 3);
321 R(e, a, b, c, d, F2, KK2, 8, 7);
322 R(d, e, a, b, c, F2, KK2, 6, 14);
323 R(c, d, e, a, b, F2, KK2, 6, 6);
324 R(b, c, d, e, a, F2, KK2, 14, 9);
325 R(a, b, c, d, e, F2, KK2, 12, 11);
326 R(e, a, b, c, d, F2, KK2, 13, 8);
327 R(d, e, a, b, c, F2, KK2, 5, 12);
328 R(c, d, e, a, b, F2, KK2, 14, 2);
329 R(b, c, d, e, a, F2, KK2, 13, 10);
330 R(a, b, c, d, e, F2, KK2, 13, 0);
331 R(e, a, b, c, d, F2, KK2, 7, 4);
332 R(d, e, a, b, c, F2, KK2, 5, 13); /* #47 */
333 /* Parallel round 4 */
334 R(c, d, e, a, b, F1, KK3, 15, 8);
335 R(b, c, d, e, a, F1, KK3, 5, 6);
336 R(a, b, c, d, e, F1, KK3, 8, 4);
337 R(e, a, b, c, d, F1, KK3, 11, 1);
338 R(d, e, a, b, c, F1, KK3, 14, 3);
339 R(c, d, e, a, b, F1, KK3, 14, 11);
340 R(b, c, d, e, a, F1, KK3, 6, 15);
341 R(a, b, c, d, e, F1, KK3, 14, 0);
342 R(e, a, b, c, d, F1, KK3, 6, 5);
343 R(d, e, a, b, c, F1, KK3, 9, 12);
344 R(c, d, e, a, b, F1, KK3, 12, 2);
345 R(b, c, d, e, a, F1, KK3, 9, 13);
346 R(a, b, c, d, e, F1, KK3, 12, 9);
347 R(e, a, b, c, d, F1, KK3, 5, 7);
348 R(d, e, a, b, c, F1, KK3, 15, 10);
349 R(c, d, e, a, b, F1, KK3, 8, 14); /* #63 */
350 /* Parallel round 5 */
351 R(b, c, d, e, a, F0, KK4, 8, 12);
352 R(a, b, c, d, e, F0, KK4, 5, 15);
353 R(e, a, b, c, d, F0, KK4, 12, 10);
354 R(d, e, a, b, c, F0, KK4, 9, 4);
355 R(c, d, e, a, b, F0, KK4, 12, 1);
356 R(b, c, d, e, a, F0, KK4, 5, 5);
357 R(a, b, c, d, e, F0, KK4, 14, 8);
358 R(e, a, b, c, d, F0, KK4, 6, 7);
359 R(d, e, a, b, c, F0, KK4, 8, 6);
360 R(c, d, e, a, b, F0, KK4, 13, 2);
361 R(b, c, d, e, a, F0, KK4, 6, 13);
362 R(a, b, c, d, e, F0, KK4, 5, 14);
363 R(e, a, b, c, d, F0, KK4, 15, 0);
364 R(d, e, a, b, c, F0, KK4, 13, 3);
365 R(c, d, e, a, b, F0, KK4, 11, 9);
366 R(b, c, d, e, a, F0, KK4, 11, 11); /* #79 */
367
368 t = state[1] + cc + d;
369 state[1] = state[2] + dd + e;
370 state[2] = state[3] + ee + a;
371 state[3] = state[4] + aa + b;
372 state[4] = state[0] + bb + c;
373 state[0] = t;
374}
375
376#endif /* !WITH_OPENSSL */
diff --git a/openbsd-compat/rmd160.h b/openbsd-compat/rmd160.h
new file mode 100644
index 000000000..99c1dcdc0
--- /dev/null
+++ b/openbsd-compat/rmd160.h
@@ -0,0 +1,61 @@
1/* $OpenBSD: rmd160.h,v 1.17 2012/12/05 23:19:57 deraadt Exp $ */
2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25#ifndef _RMD160_H
26#define _RMD160_H
27
28#ifndef WITH_OPENSSL
29
30#define RMD160_BLOCK_LENGTH 64
31#define RMD160_DIGEST_LENGTH 20
32#define RMD160_DIGEST_STRING_LENGTH (RMD160_DIGEST_LENGTH * 2 + 1)
33
34/* RMD160 context. */
35typedef struct RMD160Context {
36 u_int32_t state[5]; /* state */
37 u_int64_t count; /* number of bits, mod 2^64 */
38 u_int8_t buffer[RMD160_BLOCK_LENGTH]; /* input buffer */
39} RMD160_CTX;
40
41void RMD160Init(RMD160_CTX *);
42void RMD160Transform(u_int32_t [5], const u_int8_t [RMD160_BLOCK_LENGTH])
43 __attribute__((__bounded__(__minbytes__,1,5)))
44 __attribute__((__bounded__(__minbytes__,2,RMD160_BLOCK_LENGTH)));
45void RMD160Update(RMD160_CTX *, const u_int8_t *, size_t)
46 __attribute__((__bounded__(__string__,2,3)));
47void RMD160Pad(RMD160_CTX *);
48void RMD160Final(u_int8_t [RMD160_DIGEST_LENGTH], RMD160_CTX *)
49 __attribute__((__bounded__(__minbytes__,1,RMD160_DIGEST_LENGTH)));
50char *RMD160End(RMD160_CTX *, char *)
51 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));
52char *RMD160File(const char *, char *)
53 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));
54char *RMD160FileChunk(const char *, char *, off_t, off_t)
55 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));
56char *RMD160Data(const u_int8_t *, size_t, char *)
57 __attribute__((__bounded__(__string__,1,2)))
58 __attribute__((__bounded__(__minbytes__,3,RMD160_DIGEST_STRING_LENGTH)));
59
60#endif /* !WITH_OPENSSL */
61#endif /* _RMD160_H */
diff --git a/openbsd-compat/sha1.c b/openbsd-compat/sha1.c
new file mode 100644
index 000000000..4b5381f87
--- /dev/null
+++ b/openbsd-compat/sha1.c
@@ -0,0 +1,177 @@
1/* $OpenBSD: sha1.c,v 1.23 2014/01/08 06:14:57 tedu Exp $ */
2
3/*
4 * SHA-1 in C
5 * By Steve Reid <steve@edmweb.com>
6 * 100% Public Domain
7 *
8 * Test Vectors (from FIPS PUB 180-1)
9 * "abc"
10 * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
11 * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
12 * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
13 * A million repetitions of "a"
14 * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
15 */
16
17#include "includes.h"
18
19#ifndef WITH_OPENSSL
20
21#include <sys/param.h>
22#include <string.h>
23
24#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
25
26/*
27 * blk0() and blk() perform the initial expand.
28 * I got the idea of expanding during the round function from SSLeay
29 */
30#if BYTE_ORDER == LITTLE_ENDIAN
31# define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
32 |(rol(block->l[i],8)&0x00FF00FF))
33#else
34# define blk0(i) block->l[i]
35#endif
36#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
37 ^block->l[(i+2)&15]^block->l[i&15],1))
38
39/*
40 * (R0+R1), R2, R3, R4 are the different operations (rounds) used in SHA1
41 */
42#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
43#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
44#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
45#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
46#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
47
48typedef union {
49 u_int8_t c[64];
50 u_int32_t l[16];
51} CHAR64LONG16;
52
53/*
54 * Hash a single 512-bit block. This is the core of the algorithm.
55 */
56void
57SHA1Transform(u_int32_t state[5], const u_int8_t buffer[SHA1_BLOCK_LENGTH])
58{
59 u_int32_t a, b, c, d, e;
60 u_int8_t workspace[SHA1_BLOCK_LENGTH];
61 CHAR64LONG16 *block = (CHAR64LONG16 *)workspace;
62
63 (void)memcpy(block, buffer, SHA1_BLOCK_LENGTH);
64
65 /* Copy context->state[] to working vars */
66 a = state[0];
67 b = state[1];
68 c = state[2];
69 d = state[3];
70 e = state[4];
71
72 /* 4 rounds of 20 operations each. Loop unrolled. */
73 R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
74 R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
75 R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
76 R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
77 R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
78 R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
79 R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
80 R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
81 R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
82 R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
83 R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
84 R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
85 R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
86 R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
87 R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
88 R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
89 R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
90 R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
91 R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
92 R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
93
94 /* Add the working vars back into context.state[] */
95 state[0] += a;
96 state[1] += b;
97 state[2] += c;
98 state[3] += d;
99 state[4] += e;
100
101 /* Wipe variables */
102 a = b = c = d = e = 0;
103}
104
105
106/*
107 * SHA1Init - Initialize new context
108 */
109void
110SHA1Init(SHA1_CTX *context)
111{
112
113 /* SHA1 initialization constants */
114 context->count = 0;
115 context->state[0] = 0x67452301;
116 context->state[1] = 0xEFCDAB89;
117 context->state[2] = 0x98BADCFE;
118 context->state[3] = 0x10325476;
119 context->state[4] = 0xC3D2E1F0;
120}
121
122
123/*
124 * Run your data through this.
125 */
126void
127SHA1Update(SHA1_CTX *context, const u_int8_t *data, size_t len)
128{
129 size_t i, j;
130
131 j = (size_t)((context->count >> 3) & 63);
132 context->count += (len << 3);
133 if ((j + len) > 63) {
134 (void)memcpy(&context->buffer[j], data, (i = 64-j));
135 SHA1Transform(context->state, context->buffer);
136 for ( ; i + 63 < len; i += 64)
137 SHA1Transform(context->state, (u_int8_t *)&data[i]);
138 j = 0;
139 } else {
140 i = 0;
141 }
142 (void)memcpy(&context->buffer[j], &data[i], len - i);
143}
144
145
146/*
147 * Add padding and return the message digest.
148 */
149void
150SHA1Pad(SHA1_CTX *context)
151{
152 u_int8_t finalcount[8];
153 u_int i;
154
155 for (i = 0; i < 8; i++) {
156 finalcount[i] = (u_int8_t)((context->count >>
157 ((7 - (i & 7)) * 8)) & 255); /* Endian independent */
158 }
159 SHA1Update(context, (u_int8_t *)"\200", 1);
160 while ((context->count & 504) != 448)
161 SHA1Update(context, (u_int8_t *)"\0", 1);
162 SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
163}
164
165void
166SHA1Final(u_int8_t digest[SHA1_DIGEST_LENGTH], SHA1_CTX *context)
167{
168 u_int i;
169
170 SHA1Pad(context);
171 for (i = 0; i < SHA1_DIGEST_LENGTH; i++) {
172 digest[i] = (u_int8_t)
173 ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
174 }
175 memset(context, 0, sizeof(*context));
176}
177#endif /* !WITH_OPENSSL */
diff --git a/openbsd-compat/sha1.h b/openbsd-compat/sha1.h
new file mode 100644
index 000000000..327d94cd5
--- /dev/null
+++ b/openbsd-compat/sha1.h
@@ -0,0 +1,58 @@
1/* $OpenBSD: sha1.h,v 1.24 2012/12/05 23:19:57 deraadt Exp $ */
2
3/*
4 * SHA-1 in C
5 * By Steve Reid <steve@edmweb.com>
6 * 100% Public Domain
7 */
8
9#ifndef _SHA1_H
10#define _SHA1_H
11
12#ifndef WITH_OPENSSL
13
14#define SHA1_BLOCK_LENGTH 64
15#define SHA1_DIGEST_LENGTH 20
16#define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
17
18typedef struct {
19 u_int32_t state[5];
20 u_int64_t count;
21 u_int8_t buffer[SHA1_BLOCK_LENGTH];
22} SHA1_CTX;
23
24void SHA1Init(SHA1_CTX *);
25void SHA1Pad(SHA1_CTX *);
26void SHA1Transform(u_int32_t [5], const u_int8_t [SHA1_BLOCK_LENGTH])
27 __attribute__((__bounded__(__minbytes__,1,5)))
28 __attribute__((__bounded__(__minbytes__,2,SHA1_BLOCK_LENGTH)));
29void SHA1Update(SHA1_CTX *, const u_int8_t *, size_t)
30 __attribute__((__bounded__(__string__,2,3)));
31void SHA1Final(u_int8_t [SHA1_DIGEST_LENGTH], SHA1_CTX *)
32 __attribute__((__bounded__(__minbytes__,1,SHA1_DIGEST_LENGTH)));
33char *SHA1End(SHA1_CTX *, char *)
34 __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH)));
35char *SHA1File(const char *, char *)
36 __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH)));
37char *SHA1FileChunk(const char *, char *, off_t, off_t)
38 __attribute__((__bounded__(__minbytes__,2,SHA1_DIGEST_STRING_LENGTH)));
39char *SHA1Data(const u_int8_t *, size_t, char *)
40 __attribute__((__bounded__(__string__,1,2)))
41 __attribute__((__bounded__(__minbytes__,3,SHA1_DIGEST_STRING_LENGTH)));
42
43#define HTONDIGEST(x) do { \
44 x[0] = htonl(x[0]); \
45 x[1] = htonl(x[1]); \
46 x[2] = htonl(x[2]); \
47 x[3] = htonl(x[3]); \
48 x[4] = htonl(x[4]); } while (0)
49
50#define NTOHDIGEST(x) do { \
51 x[0] = ntohl(x[0]); \
52 x[1] = ntohl(x[1]); \
53 x[2] = ntohl(x[2]); \
54 x[3] = ntohl(x[3]); \
55 x[4] = ntohl(x[4]); } while (0)
56
57#endif /* !WITH_OPENSSL */
58#endif /* _SHA1_H */
diff --git a/openbsd-compat/sha2.c b/openbsd-compat/sha2.c
index f5bf74d1f..737935d46 100644
--- a/openbsd-compat/sha2.c
+++ b/openbsd-compat/sha2.c
@@ -38,13 +38,18 @@
38 38
39#include "includes.h" 39#include "includes.h"
40 40
41#include <openssl/opensslv.h> 41#ifdef WITH_OPENSSL
42# include <openssl/opensslv.h>
43# if !defined(HAVE_EVP_SHA256) && (OPENSSL_VERSION_NUMBER >= 0x00907000L)
44# define _NEED_SHA2 1
45# endif
46#else
47# define _NEED_SHA2 1
48#endif
49
50#if defined(_NEED_SHA2) && !defined(HAVE_SHA256_UPDATE)
42 51
43#if !defined(HAVE_EVP_SHA256) && !defined(HAVE_SHA256_UPDATE) && \
44 (OPENSSL_VERSION_NUMBER >= 0x00907000L)
45#include <sys/types.h>
46#include <string.h> 52#include <string.h>
47#include "sha2.h"
48 53
49/* 54/*
50 * UNROLLED TRANSFORM LOOP NOTE: 55 * UNROLLED TRANSFORM LOOP NOTE:
@@ -838,7 +843,6 @@ SHA512_Final(u_int8_t digest[SHA512_DIGEST_LENGTH], SHA512_CTX *context)
838} 843}
839 844
840 845
841#if 0
842/*** SHA-384: *********************************************************/ 846/*** SHA-384: *********************************************************/
843void 847void
844SHA384_Init(SHA384_CTX *context) 848SHA384_Init(SHA384_CTX *context)
@@ -851,9 +855,29 @@ SHA384_Init(SHA384_CTX *context)
851 context->bitcount[0] = context->bitcount[1] = 0; 855 context->bitcount[0] = context->bitcount[1] = 0;
852} 856}
853 857
858#if 0
854__weak_alias(SHA384_Transform, SHA512_Transform); 859__weak_alias(SHA384_Transform, SHA512_Transform);
855__weak_alias(SHA384_Update, SHA512_Update); 860__weak_alias(SHA384_Update, SHA512_Update);
856__weak_alias(SHA384_Pad, SHA512_Pad); 861__weak_alias(SHA384_Pad, SHA512_Pad);
862#endif
863
864void
865SHA384_Transform(u_int64_t state[8], const u_int8_t data[SHA512_BLOCK_LENGTH])
866{
867 return SHA512_Transform(state, data);
868}
869
870void
871SHA384_Update(SHA512_CTX *context, const u_int8_t *data, size_t len)
872{
873 SHA512_Update(context, data, len);
874}
875
876void
877SHA384_Pad(SHA512_CTX *context)
878{
879 SHA512_Pad(context);
880}
857 881
858void 882void
859SHA384_Final(u_int8_t digest[SHA384_DIGEST_LENGTH], SHA384_CTX *context) 883SHA384_Final(u_int8_t digest[SHA384_DIGEST_LENGTH], SHA384_CTX *context)
@@ -876,7 +900,5 @@ SHA384_Final(u_int8_t digest[SHA384_DIGEST_LENGTH], SHA384_CTX *context)
876 /* Zero out state data */ 900 /* Zero out state data */
877 memset(context, 0, sizeof(*context)); 901 memset(context, 0, sizeof(*context));
878} 902}
879#endif
880 903
881#endif /* !defined(HAVE_EVP_SHA256) && !defined(HAVE_SHA256_UPDATE) && \ 904#endif /* defined(_NEED_SHA2) && !defined(HAVE_SHA256_UPDATE) */
882 (OPENSSL_VERSION_NUMBER >= 0x00907000L) */
diff --git a/openbsd-compat/sha2.h b/openbsd-compat/sha2.h
index 73e94f150..c8bfc3cd1 100644
--- a/openbsd-compat/sha2.h
+++ b/openbsd-compat/sha2.h
@@ -41,10 +41,16 @@
41 41
42#include "includes.h" 42#include "includes.h"
43 43
44#include <openssl/opensslv.h> 44#ifdef WITH_OPENSSL
45# include <openssl/opensslv.h>
46# if !defined(HAVE_EVP_SHA256) && (OPENSSL_VERSION_NUMBER >= 0x00907000L)
47# define _NEED_SHA2 1
48# endif
49#else
50# define _NEED_SHA2 1
51#endif
45 52
46#if !defined(HAVE_EVP_SHA256) && !defined(HAVE_SHA256_UPDATE) && \ 53#if defined(_NEED_SHA2) && !defined(HAVE_SHA256_UPDATE)
47 (OPENSSL_VERSION_NUMBER >= 0x00907000L)
48 54
49/*** SHA-256/384/512 Various Length Definitions ***********************/ 55/*** SHA-256/384/512 Various Length Definitions ***********************/
50#define SHA256_BLOCK_LENGTH 64 56#define SHA256_BLOCK_LENGTH 64
@@ -70,9 +76,7 @@ typedef struct _SHA512_CTX {
70 u_int8_t buffer[SHA512_BLOCK_LENGTH]; 76 u_int8_t buffer[SHA512_BLOCK_LENGTH];
71} SHA512_CTX; 77} SHA512_CTX;
72 78
73#if 0
74typedef SHA512_CTX SHA384_CTX; 79typedef SHA512_CTX SHA384_CTX;
75#endif
76 80
77void SHA256_Init(SHA256_CTX *); 81void SHA256_Init(SHA256_CTX *);
78void SHA256_Transform(u_int32_t state[8], const u_int8_t [SHA256_BLOCK_LENGTH]); 82void SHA256_Transform(u_int32_t state[8], const u_int8_t [SHA256_BLOCK_LENGTH]);
@@ -91,7 +95,6 @@ char *SHA256_Data(const u_int8_t *, size_t, char *)
91 __attribute__((__bounded__(__string__,1,2))) 95 __attribute__((__bounded__(__string__,1,2)))
92 __attribute__((__bounded__(__minbytes__,3,SHA256_DIGEST_STRING_LENGTH))); 96 __attribute__((__bounded__(__minbytes__,3,SHA256_DIGEST_STRING_LENGTH)));
93 97
94#if 0
95void SHA384_Init(SHA384_CTX *); 98void SHA384_Init(SHA384_CTX *);
96void SHA384_Transform(u_int64_t state[8], const u_int8_t [SHA384_BLOCK_LENGTH]); 99void SHA384_Transform(u_int64_t state[8], const u_int8_t [SHA384_BLOCK_LENGTH]);
97void SHA384_Update(SHA384_CTX *, const u_int8_t *, size_t) 100void SHA384_Update(SHA384_CTX *, const u_int8_t *, size_t)
@@ -108,7 +111,6 @@ char *SHA384_FileChunk(const char *, char *, off_t, off_t)
108char *SHA384_Data(const u_int8_t *, size_t, char *) 111char *SHA384_Data(const u_int8_t *, size_t, char *)
109 __attribute__((__bounded__(__string__,1,2))) 112 __attribute__((__bounded__(__string__,1,2)))
110 __attribute__((__bounded__(__minbytes__,3,SHA384_DIGEST_STRING_LENGTH))); 113 __attribute__((__bounded__(__minbytes__,3,SHA384_DIGEST_STRING_LENGTH)));
111#endif /* 0 */
112 114
113void SHA512_Init(SHA512_CTX *); 115void SHA512_Init(SHA512_CTX *);
114void SHA512_Transform(u_int64_t state[8], const u_int8_t [SHA512_BLOCK_LENGTH]); 116void SHA512_Transform(u_int64_t state[8], const u_int8_t [SHA512_BLOCK_LENGTH]);
@@ -127,7 +129,6 @@ char *SHA512_Data(const u_int8_t *, size_t, char *)
127 __attribute__((__bounded__(__string__,1,2))) 129 __attribute__((__bounded__(__string__,1,2)))
128 __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH))); 130 __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH)));
129 131
130#endif /* !defined(HAVE_EVP_SHA256) && !defined(HAVE_SHA256_UPDATE) && \ 132#endif /* defined(_NEED_SHA2) && !defined(HAVE_SHA256_UPDATE) */
131 (OPENSSL_VERSION_NUMBER >= 0x00907000L) */
132 133
133#endif /* _SSHSHA2_H */ 134#endif /* _SSHSHA2_H */
diff --git a/openbsd-compat/xcrypt.c b/openbsd-compat/xcrypt.c
index c8aea461d..8577cbd8a 100644
--- a/openbsd-compat/xcrypt.c
+++ b/openbsd-compat/xcrypt.c
@@ -57,7 +57,7 @@
57# include "md5crypt.h" 57# include "md5crypt.h"
58# endif 58# endif
59 59
60# if !defined(HAVE_CRYPT) && defined(HAVE_DES_CRYPT) 60# if defined(WITH_OPENSSL) && !defined(HAVE_CRYPT) && defined(HAVE_DES_CRYPT)
61# include <openssl/des.h> 61# include <openssl/des.h>
62# define crypt DES_crypt 62# define crypt DES_crypt
63# endif 63# endif
diff --git a/packet.c b/packet.c
index 6e7b87757..b1219c85b 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.198 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: packet.c,v 1.208 2015/02/13 18:57:00 markus Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -39,9 +39,9 @@
39 39
40#include "includes.h" 40#include "includes.h"
41 41
42#include <sys/param.h> /* MIN roundup */
42#include <sys/types.h> 43#include <sys/types.h>
43#include "openbsd-compat/sys-queue.h" 44#include "openbsd-compat/sys-queue.h"
44#include <sys/param.h>
45#include <sys/socket.h> 45#include <sys/socket.h>
46#ifdef HAVE_SYS_TIME_H 46#ifdef HAVE_SYS_TIME_H
47# include <sys/time.h> 47# include <sys/time.h>
@@ -57,29 +57,35 @@
57#include <stdlib.h> 57#include <stdlib.h>
58#include <string.h> 58#include <string.h>
59#include <unistd.h> 59#include <unistd.h>
60#include <limits.h>
60#include <signal.h> 61#include <signal.h>
61#include <time.h> 62#include <time.h>
62 63
64#include <zlib.h>
65
66#include "buffer.h" /* typedefs XXX */
67#include "key.h" /* typedefs XXX */
68
63#include "xmalloc.h" 69#include "xmalloc.h"
64#include "buffer.h"
65#include "packet.h"
66#include "crc32.h" 70#include "crc32.h"
67#include "compress.h"
68#include "deattack.h" 71#include "deattack.h"
69#include "compat.h" 72#include "compat.h"
70#include "ssh1.h" 73#include "ssh1.h"
71#include "ssh2.h" 74#include "ssh2.h"
72#include "cipher.h" 75#include "cipher.h"
73#include "key.h" 76#include "sshkey.h"
74#include "kex.h" 77#include "kex.h"
78#include "digest.h"
75#include "mac.h" 79#include "mac.h"
76#include "log.h" 80#include "log.h"
77#include "canohost.h" 81#include "canohost.h"
78#include "misc.h" 82#include "misc.h"
79#include "channels.h" 83#include "channels.h"
80#include "ssh.h" 84#include "ssh.h"
81#include "ssherr.h" 85#include "packet.h"
82#include "roaming.h" 86#include "roaming.h"
87#include "ssherr.h"
88#include "sshbuf.h"
83 89
84#ifdef PACKET_DEBUG 90#ifdef PACKET_DEBUG
85#define DBG(x) x 91#define DBG(x) x
@@ -99,7 +105,7 @@ struct packet_state {
99struct packet { 105struct packet {
100 TAILQ_ENTRY(packet) next; 106 TAILQ_ENTRY(packet) next;
101 u_char type; 107 u_char type;
102 Buffer payload; 108 struct sshbuf *payload;
103}; 109};
104 110
105struct session_state { 111struct session_state {
@@ -116,26 +122,33 @@ struct session_state {
116 u_int remote_protocol_flags; 122 u_int remote_protocol_flags;
117 123
118 /* Encryption context for receiving data. Only used for decryption. */ 124 /* Encryption context for receiving data. Only used for decryption. */
119 CipherContext receive_context; 125 struct sshcipher_ctx receive_context;
120 126
121 /* Encryption context for sending data. Only used for encryption. */ 127 /* Encryption context for sending data. Only used for encryption. */
122 CipherContext send_context; 128 struct sshcipher_ctx send_context;
123 129
124 /* Buffer for raw input data from the socket. */ 130 /* Buffer for raw input data from the socket. */
125 Buffer input; 131 struct sshbuf *input;
126 132
127 /* Buffer for raw output data going to the socket. */ 133 /* Buffer for raw output data going to the socket. */
128 Buffer output; 134 struct sshbuf *output;
129 135
130 /* Buffer for the partial outgoing packet being constructed. */ 136 /* Buffer for the partial outgoing packet being constructed. */
131 Buffer outgoing_packet; 137 struct sshbuf *outgoing_packet;
132 138
133 /* Buffer for the incoming packet currently being processed. */ 139 /* Buffer for the incoming packet currently being processed. */
134 Buffer incoming_packet; 140 struct sshbuf *incoming_packet;
135 141
136 /* Scratch buffer for packet compression/decompression. */ 142 /* Scratch buffer for packet compression/decompression. */
137 Buffer compression_buffer; 143 struct sshbuf *compression_buffer;
138 int compression_buffer_ready; 144
145 /* Incoming/outgoing compression dictionaries */
146 z_stream compression_in_stream;
147 z_stream compression_out_stream;
148 int compression_in_started;
149 int compression_out_started;
150 int compression_in_failures;
151 int compression_out_failures;
139 152
140 /* 153 /*
141 * Flag indicating whether packet compression/decompression is 154 * Flag indicating whether packet compression/decompression is
@@ -164,7 +177,7 @@ struct session_state {
164 int packet_timeout_ms; 177 int packet_timeout_ms;
165 178
166 /* Session key information for Encryption and MAC */ 179 /* Session key information for Encryption and MAC */
167 Newkeys *newkeys[MODE_MAX]; 180 struct newkeys *newkeys[MODE_MAX];
168 struct packet_state p_read, p_send; 181 struct packet_state p_read, p_send;
169 182
170 /* Volume-based rekeying */ 183 /* Volume-based rekeying */
@@ -172,7 +185,7 @@ struct session_state {
172 u_int32_t rekey_limit; 185 u_int32_t rekey_limit;
173 186
174 /* Time-based rekeying */ 187 /* Time-based rekeying */
175 time_t rekey_interval; /* how often in seconds */ 188 u_int32_t rekey_interval; /* how often in seconds */
176 time_t rekey_time; /* time of last rekeying */ 189 time_t rekey_time; /* time of last rekeying */
177 190
178 /* Session key for protocol v1 */ 191 /* Session key for protocol v1 */
@@ -184,7 +197,7 @@ struct session_state {
184 197
185 /* XXX discard incoming data after MAC error */ 198 /* XXX discard incoming data after MAC error */
186 u_int packet_discard; 199 u_int packet_discard;
187 Mac *packet_discard_mac; 200 struct sshmac *packet_discard_mac;
188 201
189 /* Used in packet_read_poll2() */ 202 /* Used in packet_read_poll2() */
190 u_int packlen; 203 u_int packlen;
@@ -198,121 +211,177 @@ struct session_state {
198 /* Used in packet_set_maxsize */ 211 /* Used in packet_set_maxsize */
199 int set_maxsize_called; 212 int set_maxsize_called;
200 213
201 TAILQ_HEAD(, packet) outgoing; 214 /* One-off warning about weak ciphers */
202}; 215 int cipher_warning_done;
203 216
204static struct session_state *active_state, *backup_state; 217 /* SSH1 CRC compensation attack detector */
218 struct deattack_ctx deattack;
205 219
206static struct session_state * 220 TAILQ_HEAD(, packet) outgoing;
207alloc_session_state(void) 221};
208{
209 struct session_state *s = xcalloc(1, sizeof(*s));
210 222
211 s->connection_in = -1; 223struct ssh *
212 s->connection_out = -1; 224ssh_alloc_session_state(void)
213 s->max_packet_size = 32768; 225{
214 s->packet_timeout_ms = -1; 226 struct ssh *ssh = NULL;
215 return s; 227 struct session_state *state = NULL;
228
229 if ((ssh = calloc(1, sizeof(*ssh))) == NULL ||
230 (state = calloc(1, sizeof(*state))) == NULL ||
231 (state->input = sshbuf_new()) == NULL ||
232 (state->output = sshbuf_new()) == NULL ||
233 (state->outgoing_packet = sshbuf_new()) == NULL ||
234 (state->incoming_packet = sshbuf_new()) == NULL)
235 goto fail;
236 TAILQ_INIT(&state->outgoing);
237 TAILQ_INIT(&ssh->private_keys);
238 TAILQ_INIT(&ssh->public_keys);
239 state->connection_in = -1;
240 state->connection_out = -1;
241 state->max_packet_size = 32768;
242 state->packet_timeout_ms = -1;
243 state->p_send.packets = state->p_read.packets = 0;
244 state->initialized = 1;
245 /*
246 * ssh_packet_send2() needs to queue packets until
247 * we've done the initial key exchange.
248 */
249 state->rekeying = 1;
250 ssh->state = state;
251 return ssh;
252 fail:
253 if (state) {
254 sshbuf_free(state->input);
255 sshbuf_free(state->output);
256 sshbuf_free(state->incoming_packet);
257 sshbuf_free(state->outgoing_packet);
258 free(state);
259 }
260 free(ssh);
261 return NULL;
216} 262}
217 263
218/* 264/*
219 * Sets the descriptors used for communication. Disables encryption until 265 * Sets the descriptors used for communication. Disables encryption until
220 * packet_set_encryption_key is called. 266 * packet_set_encryption_key is called.
221 */ 267 */
222void 268struct ssh *
223packet_set_connection(int fd_in, int fd_out) 269ssh_packet_set_connection(struct ssh *ssh, int fd_in, int fd_out)
224{ 270{
225 const Cipher *none = cipher_by_name("none"); 271 struct session_state *state;
272 const struct sshcipher *none = cipher_by_name("none");
226 int r; 273 int r;
227 274
228 if (none == NULL) 275 if (none == NULL) {
229 fatal("packet_set_connection: cannot load cipher 'none'"); 276 error("%s: cannot load cipher 'none'", __func__);
230 if (active_state == NULL) 277 return NULL;
231 active_state = alloc_session_state(); 278 }
232 active_state->connection_in = fd_in; 279 if (ssh == NULL)
233 active_state->connection_out = fd_out; 280 ssh = ssh_alloc_session_state();
234 if ((r = cipher_init(&active_state->send_context, none, 281 if (ssh == NULL) {
282 error("%s: cound not allocate state", __func__);
283 return NULL;
284 }
285 state = ssh->state;
286 state->connection_in = fd_in;
287 state->connection_out = fd_out;
288 if ((r = cipher_init(&state->send_context, none,
235 (const u_char *)"", 0, NULL, 0, CIPHER_ENCRYPT)) != 0 || 289 (const u_char *)"", 0, NULL, 0, CIPHER_ENCRYPT)) != 0 ||
236 (r = cipher_init(&active_state->receive_context, none, 290 (r = cipher_init(&state->receive_context, none,
237 (const u_char *)"", 0, NULL, 0, CIPHER_DECRYPT)) != 0) 291 (const u_char *)"", 0, NULL, 0, CIPHER_DECRYPT)) != 0) {
238 fatal("%s: cipher_init: %s", __func__, ssh_err(r)); 292 error("%s: cipher_init failed: %s", __func__, ssh_err(r));
239 active_state->newkeys[MODE_IN] = active_state->newkeys[MODE_OUT] = NULL; 293 return NULL;
240 if (!active_state->initialized) {
241 active_state->initialized = 1;
242 buffer_init(&active_state->input);
243 buffer_init(&active_state->output);
244 buffer_init(&active_state->outgoing_packet);
245 buffer_init(&active_state->incoming_packet);
246 TAILQ_INIT(&active_state->outgoing);
247 active_state->p_send.packets = active_state->p_read.packets = 0;
248 } 294 }
295 state->newkeys[MODE_IN] = state->newkeys[MODE_OUT] = NULL;
296 deattack_init(&state->deattack);
297 /*
298 * Cache the IP address of the remote connection for use in error
299 * messages that might be generated after the connection has closed.
300 */
301 (void)ssh_remote_ipaddr(ssh);
302 return ssh;
249} 303}
250 304
251void 305void
252packet_set_timeout(int timeout, int count) 306ssh_packet_set_timeout(struct ssh *ssh, int timeout, int count)
253{ 307{
308 struct session_state *state = ssh->state;
309
254 if (timeout <= 0 || count <= 0) { 310 if (timeout <= 0 || count <= 0) {
255 active_state->packet_timeout_ms = -1; 311 state->packet_timeout_ms = -1;
256 return; 312 return;
257 } 313 }
258 if ((INT_MAX / 1000) / count < timeout) 314 if ((INT_MAX / 1000) / count < timeout)
259 active_state->packet_timeout_ms = INT_MAX; 315 state->packet_timeout_ms = INT_MAX;
260 else 316 else
261 active_state->packet_timeout_ms = timeout * count * 1000; 317 state->packet_timeout_ms = timeout * count * 1000;
262} 318}
263 319
264static void 320int
265packet_stop_discard(void) 321ssh_packet_stop_discard(struct ssh *ssh)
266{ 322{
267 if (active_state->packet_discard_mac) { 323 struct session_state *state = ssh->state;
324 int r;
325
326 if (state->packet_discard_mac) {
268 char buf[1024]; 327 char buf[1024];
269 328
270 memset(buf, 'a', sizeof(buf)); 329 memset(buf, 'a', sizeof(buf));
271 while (buffer_len(&active_state->incoming_packet) < 330 while (sshbuf_len(state->incoming_packet) <
272 PACKET_MAX_SIZE) 331 PACKET_MAX_SIZE)
273 buffer_append(&active_state->incoming_packet, buf, 332 if ((r = sshbuf_put(state->incoming_packet, buf,
274 sizeof(buf)); 333 sizeof(buf))) != 0)
275 (void) mac_compute(active_state->packet_discard_mac, 334 return r;
276 active_state->p_read.seqnr, 335 (void) mac_compute(state->packet_discard_mac,
277 buffer_ptr(&active_state->incoming_packet), 336 state->p_read.seqnr,
278 PACKET_MAX_SIZE); 337 sshbuf_ptr(state->incoming_packet), PACKET_MAX_SIZE,
279 } 338 NULL, 0);
280 logit("Finished discarding for %.200s", get_remote_ipaddr()); 339 }
281 cleanup_exit(255); 340 logit("Finished discarding for %.200s", ssh_remote_ipaddr(ssh));
341 return SSH_ERR_MAC_INVALID;
282} 342}
283 343
284static void 344static int
285packet_start_discard(Enc *enc, Mac *mac, u_int packet_length, u_int discard) 345ssh_packet_start_discard(struct ssh *ssh, struct sshenc *enc,
346 struct sshmac *mac, u_int packet_length, u_int discard)
286{ 347{
287 if (enc == NULL || !cipher_is_cbc(enc->cipher) || (mac && mac->etm)) 348 struct session_state *state = ssh->state;
288 packet_disconnect("Packet corrupt"); 349 int r;
350
351 if (enc == NULL || !cipher_is_cbc(enc->cipher) || (mac && mac->etm)) {
352 if ((r = sshpkt_disconnect(ssh, "Packet corrupt")) != 0)
353 return r;
354 return SSH_ERR_MAC_INVALID;
355 }
289 if (packet_length != PACKET_MAX_SIZE && mac && mac->enabled) 356 if (packet_length != PACKET_MAX_SIZE && mac && mac->enabled)
290 active_state->packet_discard_mac = mac; 357 state->packet_discard_mac = mac;
291 if (buffer_len(&active_state->input) >= discard) 358 if (sshbuf_len(state->input) >= discard &&
292 packet_stop_discard(); 359 (r = ssh_packet_stop_discard(ssh)) != 0)
293 active_state->packet_discard = discard - 360 return r;
294 buffer_len(&active_state->input); 361 state->packet_discard = discard - sshbuf_len(state->input);
362 return 0;
295} 363}
296 364
297/* Returns 1 if remote host is connected via socket, 0 if not. */ 365/* Returns 1 if remote host is connected via socket, 0 if not. */
298 366
299int 367int
300packet_connection_is_on_socket(void) 368ssh_packet_connection_is_on_socket(struct ssh *ssh)
301{ 369{
370 struct session_state *state = ssh->state;
302 struct sockaddr_storage from, to; 371 struct sockaddr_storage from, to;
303 socklen_t fromlen, tolen; 372 socklen_t fromlen, tolen;
304 373
305 /* filedescriptors in and out are the same, so it's a socket */ 374 /* filedescriptors in and out are the same, so it's a socket */
306 if (active_state->connection_in == active_state->connection_out) 375 if (state->connection_in == state->connection_out)
307 return 1; 376 return 1;
308 fromlen = sizeof(from); 377 fromlen = sizeof(from);
309 memset(&from, 0, sizeof(from)); 378 memset(&from, 0, sizeof(from));
310 if (getpeername(active_state->connection_in, (struct sockaddr *)&from, 379 if (getpeername(state->connection_in, (struct sockaddr *)&from,
311 &fromlen) < 0) 380 &fromlen) < 0)
312 return 0; 381 return 0;
313 tolen = sizeof(to); 382 tolen = sizeof(to);
314 memset(&to, 0, sizeof(to)); 383 memset(&to, 0, sizeof(to));
315 if (getpeername(active_state->connection_out, (struct sockaddr *)&to, 384 if (getpeername(state->connection_out, (struct sockaddr *)&to,
316 &tolen) < 0) 385 &tolen) < 0)
317 return 0; 386 return 0;
318 if (fromlen != tolen || memcmp(&from, &to, fromlen) != 0) 387 if (fromlen != tolen || memcmp(&from, &to, fromlen) != 0)
@@ -322,127 +391,23 @@ packet_connection_is_on_socket(void)
322 return 1; 391 return 1;
323} 392}
324 393
325/*
326 * Exports an IV from the CipherContext required to export the key
327 * state back from the unprivileged child to the privileged parent
328 * process.
329 */
330
331void
332packet_get_keyiv(int mode, u_char *iv, u_int len)
333{
334 CipherContext *cc;
335 int r;
336
337 if (mode == MODE_OUT)
338 cc = &active_state->send_context;
339 else
340 cc = &active_state->receive_context;
341
342 if ((r = cipher_get_keyiv(cc, iv, len)) != 0)
343 fatal("%s: cipher_get_keyiv: %s", __func__, ssh_err(r));
344}
345
346int
347packet_get_keycontext(int mode, u_char *dat)
348{
349 CipherContext *cc;
350
351 if (mode == MODE_OUT)
352 cc = &active_state->send_context;
353 else
354 cc = &active_state->receive_context;
355
356 return (cipher_get_keycontext(cc, dat));
357}
358
359void
360packet_set_keycontext(int mode, u_char *dat)
361{
362 CipherContext *cc;
363
364 if (mode == MODE_OUT)
365 cc = &active_state->send_context;
366 else
367 cc = &active_state->receive_context;
368
369 cipher_set_keycontext(cc, dat);
370}
371
372int
373packet_get_keyiv_len(int mode)
374{
375 CipherContext *cc;
376
377 if (mode == MODE_OUT)
378 cc = &active_state->send_context;
379 else
380 cc = &active_state->receive_context;
381
382 return (cipher_get_keyiv_len(cc));
383}
384
385void 394void
386packet_set_iv(int mode, u_char *dat) 395ssh_packet_get_bytes(struct ssh *ssh, u_int64_t *ibytes, u_int64_t *obytes)
387{ 396{
388 CipherContext *cc; 397 if (ibytes)
389 int r; 398 *ibytes = ssh->state->p_read.bytes;
390 399 if (obytes)
391 if (mode == MODE_OUT) 400 *obytes = ssh->state->p_send.bytes;
392 cc = &active_state->send_context;
393 else
394 cc = &active_state->receive_context;
395
396 if ((r = cipher_set_keyiv(cc, dat)) != 0)
397 fatal("%s: cipher_set_keyiv: %s", __func__, ssh_err(r));
398} 401}
399 402
400int 403int
401packet_get_ssh1_cipher(void) 404ssh_packet_connection_af(struct ssh *ssh)
402{
403 return (cipher_get_number(active_state->receive_context.cipher));
404}
405
406void
407packet_get_state(int mode, u_int32_t *seqnr, u_int64_t *blocks,
408 u_int32_t *packets, u_int64_t *bytes)
409{
410 struct packet_state *state;
411
412 state = (mode == MODE_IN) ?
413 &active_state->p_read : &active_state->p_send;
414 if (seqnr)
415 *seqnr = state->seqnr;
416 if (blocks)
417 *blocks = state->blocks;
418 if (packets)
419 *packets = state->packets;
420 if (bytes)
421 *bytes = state->bytes;
422}
423
424void
425packet_set_state(int mode, u_int32_t seqnr, u_int64_t blocks, u_int32_t packets,
426 u_int64_t bytes)
427{
428 struct packet_state *state;
429
430 state = (mode == MODE_IN) ?
431 &active_state->p_read : &active_state->p_send;
432 state->seqnr = seqnr;
433 state->blocks = blocks;
434 state->packets = packets;
435 state->bytes = bytes;
436}
437
438static int
439packet_connection_af(void)
440{ 405{
441 struct sockaddr_storage to; 406 struct sockaddr_storage to;
442 socklen_t tolen = sizeof(to); 407 socklen_t tolen = sizeof(to);
443 408
444 memset(&to, 0, sizeof(to)); 409 memset(&to, 0, sizeof(to));
445 if (getsockname(active_state->connection_out, (struct sockaddr *)&to, 410 if (getsockname(ssh->state->connection_out, (struct sockaddr *)&to,
446 &tolen) < 0) 411 &tolen) < 0)
447 return 0; 412 return 0;
448#ifdef IPV4_IN_IPV6 413#ifdef IPV4_IN_IPV6
@@ -456,72 +421,125 @@ packet_connection_af(void)
456/* Sets the connection into non-blocking mode. */ 421/* Sets the connection into non-blocking mode. */
457 422
458void 423void
459packet_set_nonblocking(void) 424ssh_packet_set_nonblocking(struct ssh *ssh)
460{ 425{
461 /* Set the socket into non-blocking mode. */ 426 /* Set the socket into non-blocking mode. */
462 set_nonblock(active_state->connection_in); 427 set_nonblock(ssh->state->connection_in);
463 428
464 if (active_state->connection_out != active_state->connection_in) 429 if (ssh->state->connection_out != ssh->state->connection_in)
465 set_nonblock(active_state->connection_out); 430 set_nonblock(ssh->state->connection_out);
466} 431}
467 432
468/* Returns the socket used for reading. */ 433/* Returns the socket used for reading. */
469 434
470int 435int
471packet_get_connection_in(void) 436ssh_packet_get_connection_in(struct ssh *ssh)
472{ 437{
473 return active_state->connection_in; 438 return ssh->state->connection_in;
474} 439}
475 440
476/* Returns the descriptor used for writing. */ 441/* Returns the descriptor used for writing. */
477 442
478int 443int
479packet_get_connection_out(void) 444ssh_packet_get_connection_out(struct ssh *ssh)
445{
446 return ssh->state->connection_out;
447}
448
449/*
450 * Returns the IP-address of the remote host as a string. The returned
451 * string must not be freed.
452 */
453
454const char *
455ssh_remote_ipaddr(struct ssh *ssh)
480{ 456{
481 return active_state->connection_out; 457 /* Check whether we have cached the ipaddr. */
458 if (ssh->remote_ipaddr == NULL)
459 ssh->remote_ipaddr = ssh_packet_connection_is_on_socket(ssh) ?
460 get_peer_ipaddr(ssh->state->connection_in) :
461 strdup("UNKNOWN");
462 if (ssh->remote_ipaddr == NULL)
463 return "UNKNOWN";
464 return ssh->remote_ipaddr;
482} 465}
483 466
484/* Closes the connection and clears and frees internal data structures. */ 467/* Closes the connection and clears and frees internal data structures. */
485 468
486void 469void
487packet_close(void) 470ssh_packet_close(struct ssh *ssh)
488{ 471{
489 if (!active_state->initialized) 472 struct session_state *state = ssh->state;
473 int r;
474 u_int mode;
475
476 if (!state->initialized)
490 return; 477 return;
491 active_state->initialized = 0; 478 state->initialized = 0;
492 if (active_state->connection_in == active_state->connection_out) { 479 if (state->connection_in == state->connection_out) {
493 shutdown(active_state->connection_out, SHUT_RDWR); 480 shutdown(state->connection_out, SHUT_RDWR);
494 close(active_state->connection_out); 481 close(state->connection_out);
495 } else { 482 } else {
496 close(active_state->connection_in); 483 close(state->connection_in);
497 close(active_state->connection_out); 484 close(state->connection_out);
498 } 485 }
499 buffer_free(&active_state->input); 486 sshbuf_free(state->input);
500 buffer_free(&active_state->output); 487 sshbuf_free(state->output);
501 buffer_free(&active_state->outgoing_packet); 488 sshbuf_free(state->outgoing_packet);
502 buffer_free(&active_state->incoming_packet); 489 sshbuf_free(state->incoming_packet);
503 if (active_state->compression_buffer_ready) { 490 for (mode = 0; mode < MODE_MAX; mode++)
504 buffer_free(&active_state->compression_buffer); 491 kex_free_newkeys(state->newkeys[mode]);
505 buffer_compress_uninit(); 492 if (state->compression_buffer) {
493 sshbuf_free(state->compression_buffer);
494 if (state->compression_out_started) {
495 z_streamp stream = &state->compression_out_stream;
496 debug("compress outgoing: "
497 "raw data %llu, compressed %llu, factor %.2f",
498 (unsigned long long)stream->total_in,
499 (unsigned long long)stream->total_out,
500 stream->total_in == 0 ? 0.0 :
501 (double) stream->total_out / stream->total_in);
502 if (state->compression_out_failures == 0)
503 deflateEnd(stream);
504 }
505 if (state->compression_in_started) {
506 z_streamp stream = &state->compression_out_stream;
507 debug("compress incoming: "
508 "raw data %llu, compressed %llu, factor %.2f",
509 (unsigned long long)stream->total_out,
510 (unsigned long long)stream->total_in,
511 stream->total_out == 0 ? 0.0 :
512 (double) stream->total_in / stream->total_out);
513 if (state->compression_in_failures == 0)
514 inflateEnd(stream);
515 }
506 } 516 }
507 cipher_cleanup(&active_state->send_context); 517 if ((r = cipher_cleanup(&state->send_context)) != 0)
508 cipher_cleanup(&active_state->receive_context); 518 error("%s: cipher_cleanup failed: %s", __func__, ssh_err(r));
519 if ((r = cipher_cleanup(&state->receive_context)) != 0)
520 error("%s: cipher_cleanup failed: %s", __func__, ssh_err(r));
521 if (ssh->remote_ipaddr) {
522 free(ssh->remote_ipaddr);
523 ssh->remote_ipaddr = NULL;
524 }
525 free(ssh->state);
526 ssh->state = NULL;
509} 527}
510 528
511/* Sets remote side protocol flags. */ 529/* Sets remote side protocol flags. */
512 530
513void 531void
514packet_set_protocol_flags(u_int protocol_flags) 532ssh_packet_set_protocol_flags(struct ssh *ssh, u_int protocol_flags)
515{ 533{
516 active_state->remote_protocol_flags = protocol_flags; 534 ssh->state->remote_protocol_flags = protocol_flags;
517} 535}
518 536
519/* Returns the remote protocol flags set earlier by the above function. */ 537/* Returns the remote protocol flags set earlier by the above function. */
520 538
521u_int 539u_int
522packet_get_protocol_flags(void) 540ssh_packet_get_protocol_flags(struct ssh *ssh)
523{ 541{
524 return active_state->remote_protocol_flags; 542 return ssh->state->remote_protocol_flags;
525} 543}
526 544
527/* 545/*
@@ -529,251 +547,403 @@ packet_get_protocol_flags(void)
529 * Level is compression level 1 (fastest) - 9 (slow, best) as in gzip. 547 * Level is compression level 1 (fastest) - 9 (slow, best) as in gzip.
530 */ 548 */
531 549
532static void 550static int
533packet_init_compression(void) 551ssh_packet_init_compression(struct ssh *ssh)
534{ 552{
535 if (active_state->compression_buffer_ready == 1) 553 if (!ssh->state->compression_buffer &&
536 return; 554 ((ssh->state->compression_buffer = sshbuf_new()) == NULL))
537 active_state->compression_buffer_ready = 1; 555 return SSH_ERR_ALLOC_FAIL;
538 buffer_init(&active_state->compression_buffer); 556 return 0;
539} 557}
540 558
541void 559static int
542packet_start_compression(int level) 560start_compression_out(struct ssh *ssh, int level)
543{ 561{
544 if (active_state->packet_compression && !compat20) 562 if (level < 1 || level > 9)
545 fatal("Compression already enabled."); 563 return SSH_ERR_INVALID_ARGUMENT;
546 active_state->packet_compression = 1; 564 debug("Enabling compression at level %d.", level);
547 packet_init_compression(); 565 if (ssh->state->compression_out_started == 1)
548 buffer_compress_init_send(level); 566 deflateEnd(&ssh->state->compression_out_stream);
549 buffer_compress_init_recv(); 567 switch (deflateInit(&ssh->state->compression_out_stream, level)) {
568 case Z_OK:
569 ssh->state->compression_out_started = 1;
570 break;
571 case Z_MEM_ERROR:
572 return SSH_ERR_ALLOC_FAIL;
573 default:
574 return SSH_ERR_INTERNAL_ERROR;
575 }
576 return 0;
550} 577}
551 578
552/* 579static int
553 * Causes any further packets to be encrypted using the given key. The same 580start_compression_in(struct ssh *ssh)
554 * key is used for both sending and reception. However, both directions are 581{
555 * encrypted independently of each other. 582 if (ssh->state->compression_in_started == 1)
556 */ 583 inflateEnd(&ssh->state->compression_in_stream);
584 switch (inflateInit(&ssh->state->compression_in_stream)) {
585 case Z_OK:
586 ssh->state->compression_in_started = 1;
587 break;
588 case Z_MEM_ERROR:
589 return SSH_ERR_ALLOC_FAIL;
590 default:
591 return SSH_ERR_INTERNAL_ERROR;
592 }
593 return 0;
594}
557 595
558void 596int
559packet_set_encryption_key(const u_char *key, u_int keylen, int number) 597ssh_packet_start_compression(struct ssh *ssh, int level)
560{ 598{
561 const Cipher *cipher = cipher_by_number(number);
562 int r; 599 int r;
563 600
564 if (cipher == NULL) 601 if (ssh->state->packet_compression && !compat20)
565 fatal("packet_set_encryption_key: unknown cipher number %d", number); 602 return SSH_ERR_INTERNAL_ERROR;
566 if (keylen < 20) 603 ssh->state->packet_compression = 1;
567 fatal("packet_set_encryption_key: keylen too small: %d", keylen); 604 if ((r = ssh_packet_init_compression(ssh)) != 0 ||
568 if (keylen > SSH_SESSION_KEY_LENGTH) 605 (r = start_compression_in(ssh)) != 0 ||
569 fatal("packet_set_encryption_key: keylen too big: %d", keylen); 606 (r = start_compression_out(ssh, level)) != 0)
570 memcpy(active_state->ssh1_key, key, keylen); 607 return r;
571 active_state->ssh1_keylen = keylen; 608 return 0;
572 if ((r = cipher_init(&active_state->send_context, cipher,
573 key, keylen, NULL, 0, CIPHER_ENCRYPT)) != 0 ||
574 (r = cipher_init(&active_state->receive_context, cipher,
575 key, keylen, NULL, 0, CIPHER_DECRYPT)) != 0)
576 fatal("%s: cipher_init: %s", __func__, ssh_err(r));
577} 609}
578 610
579u_int 611/* XXX remove need for separate compression buffer */
580packet_get_encryption_key(u_char *key) 612static int
613compress_buffer(struct ssh *ssh, struct sshbuf *in, struct sshbuf *out)
581{ 614{
582 if (key == NULL) 615 u_char buf[4096];
583 return (active_state->ssh1_keylen); 616 int r, status;
584 memcpy(key, active_state->ssh1_key, active_state->ssh1_keylen);
585 return (active_state->ssh1_keylen);
586}
587 617
588/* Start constructing a packet to send. */ 618 if (ssh->state->compression_out_started != 1)
589void 619 return SSH_ERR_INTERNAL_ERROR;
590packet_start(u_char type)
591{
592 u_char buf[9];
593 int len;
594 620
595 DBG(debug("packet_start[%d]", type)); 621 /* This case is not handled below. */
596 len = compat20 ? 6 : 9; 622 if (sshbuf_len(in) == 0)
597 memset(buf, 0, len - 1); 623 return 0;
598 buf[len - 1] = type; 624
599 buffer_clear(&active_state->outgoing_packet); 625 /* Input is the contents of the input buffer. */
600 buffer_append(&active_state->outgoing_packet, buf, len); 626 if ((ssh->state->compression_out_stream.next_in =
627 sshbuf_mutable_ptr(in)) == NULL)
628 return SSH_ERR_INTERNAL_ERROR;
629 ssh->state->compression_out_stream.avail_in = sshbuf_len(in);
630
631 /* Loop compressing until deflate() returns with avail_out != 0. */
632 do {
633 /* Set up fixed-size output buffer. */
634 ssh->state->compression_out_stream.next_out = buf;
635 ssh->state->compression_out_stream.avail_out = sizeof(buf);
636
637 /* Compress as much data into the buffer as possible. */
638 status = deflate(&ssh->state->compression_out_stream,
639 Z_PARTIAL_FLUSH);
640 switch (status) {
641 case Z_MEM_ERROR:
642 return SSH_ERR_ALLOC_FAIL;
643 case Z_OK:
644 /* Append compressed data to output_buffer. */
645 if ((r = sshbuf_put(out, buf, sizeof(buf) -
646 ssh->state->compression_out_stream.avail_out)) != 0)
647 return r;
648 break;
649 case Z_STREAM_ERROR:
650 default:
651 ssh->state->compression_out_failures++;
652 return SSH_ERR_INVALID_FORMAT;
653 }
654 } while (ssh->state->compression_out_stream.avail_out == 0);
655 return 0;
601} 656}
602 657
603/* Append payload. */ 658static int
604void 659uncompress_buffer(struct ssh *ssh, struct sshbuf *in, struct sshbuf *out)
605packet_put_char(int value)
606{ 660{
607 char ch = value; 661 u_char buf[4096];
662 int r, status;
608 663
609 buffer_append(&active_state->outgoing_packet, &ch, 1); 664 if (ssh->state->compression_in_started != 1)
610} 665 return SSH_ERR_INTERNAL_ERROR;
611 666
612void 667 if ((ssh->state->compression_in_stream.next_in =
613packet_put_int(u_int value) 668 sshbuf_mutable_ptr(in)) == NULL)
614{ 669 return SSH_ERR_INTERNAL_ERROR;
615 buffer_put_int(&active_state->outgoing_packet, value); 670 ssh->state->compression_in_stream.avail_in = sshbuf_len(in);
616}
617 671
618void 672 for (;;) {
619packet_put_int64(u_int64_t value) 673 /* Set up fixed-size output buffer. */
620{ 674 ssh->state->compression_in_stream.next_out = buf;
621 buffer_put_int64(&active_state->outgoing_packet, value); 675 ssh->state->compression_in_stream.avail_out = sizeof(buf);
676
677 status = inflate(&ssh->state->compression_in_stream,
678 Z_PARTIAL_FLUSH);
679 switch (status) {
680 case Z_OK:
681 if ((r = sshbuf_put(out, buf, sizeof(buf) -
682 ssh->state->compression_in_stream.avail_out)) != 0)
683 return r;
684 break;
685 case Z_BUF_ERROR:
686 /*
687 * Comments in zlib.h say that we should keep calling
688 * inflate() until we get an error. This appears to
689 * be the error that we get.
690 */
691 return 0;
692 case Z_DATA_ERROR:
693 return SSH_ERR_INVALID_FORMAT;
694 case Z_MEM_ERROR:
695 return SSH_ERR_ALLOC_FAIL;
696 case Z_STREAM_ERROR:
697 default:
698 ssh->state->compression_in_failures++;
699 return SSH_ERR_INTERNAL_ERROR;
700 }
701 }
702 /* NOTREACHED */
622} 703}
623 704
624void 705/* Serialise compression state into a blob for privsep */
625packet_put_string(const void *buf, u_int len) 706static int
707ssh_packet_get_compress_state(struct sshbuf *m, struct ssh *ssh)
626{ 708{
627 buffer_put_string(&active_state->outgoing_packet, buf, len); 709 struct session_state *state = ssh->state;
628} 710 struct sshbuf *b;
711 int r;
629 712
630void 713 if ((b = sshbuf_new()) == NULL)
631packet_put_cstring(const char *str) 714 return SSH_ERR_ALLOC_FAIL;
715 if (state->compression_in_started) {
716 if ((r = sshbuf_put_string(b, &state->compression_in_stream,
717 sizeof(state->compression_in_stream))) != 0)
718 goto out;
719 } else if ((r = sshbuf_put_string(b, NULL, 0)) != 0)
720 goto out;
721 if (state->compression_out_started) {
722 if ((r = sshbuf_put_string(b, &state->compression_out_stream,
723 sizeof(state->compression_out_stream))) != 0)
724 goto out;
725 } else if ((r = sshbuf_put_string(b, NULL, 0)) != 0)
726 goto out;
727 r = sshbuf_put_stringb(m, b);
728 out:
729 sshbuf_free(b);
730 return r;
731}
732
733/* Deserialise compression state from a blob for privsep */
734static int
735ssh_packet_set_compress_state(struct ssh *ssh, struct sshbuf *m)
632{ 736{
633 buffer_put_cstring(&active_state->outgoing_packet, str); 737 struct session_state *state = ssh->state;
738 struct sshbuf *b = NULL;
739 int r;
740 const u_char *inblob, *outblob;
741 size_t inl, outl;
742
743 if ((r = sshbuf_froms(m, &b)) != 0)
744 goto out;
745 if ((r = sshbuf_get_string_direct(b, &inblob, &inl)) != 0 ||
746 (r = sshbuf_get_string_direct(b, &outblob, &outl)) != 0)
747 goto out;
748 if (inl == 0)
749 state->compression_in_started = 0;
750 else if (inl != sizeof(state->compression_in_stream)) {
751 r = SSH_ERR_INTERNAL_ERROR;
752 goto out;
753 } else {
754 state->compression_in_started = 1;
755 memcpy(&state->compression_in_stream, inblob, inl);
756 }
757 if (outl == 0)
758 state->compression_out_started = 0;
759 else if (outl != sizeof(state->compression_out_stream)) {
760 r = SSH_ERR_INTERNAL_ERROR;
761 goto out;
762 } else {
763 state->compression_out_started = 1;
764 memcpy(&state->compression_out_stream, outblob, outl);
765 }
766 r = 0;
767 out:
768 sshbuf_free(b);
769 return r;
634} 770}
635 771
636void 772void
637packet_put_raw(const void *buf, u_int len) 773ssh_packet_set_compress_hooks(struct ssh *ssh, void *ctx,
774 void *(*allocfunc)(void *, u_int, u_int),
775 void (*freefunc)(void *, void *))
638{ 776{
639 buffer_append(&active_state->outgoing_packet, buf, len); 777 ssh->state->compression_out_stream.zalloc = (alloc_func)allocfunc;
778 ssh->state->compression_out_stream.zfree = (free_func)freefunc;
779 ssh->state->compression_out_stream.opaque = ctx;
780 ssh->state->compression_in_stream.zalloc = (alloc_func)allocfunc;
781 ssh->state->compression_in_stream.zfree = (free_func)freefunc;
782 ssh->state->compression_in_stream.opaque = ctx;
640} 783}
641 784
642#ifdef WITH_OPENSSL 785/*
643void 786 * Causes any further packets to be encrypted using the given key. The same
644packet_put_bignum(BIGNUM * value) 787 * key is used for both sending and reception. However, both directions are
645{ 788 * encrypted independently of each other.
646 buffer_put_bignum(&active_state->outgoing_packet, value); 789 */
647}
648 790
649void 791void
650packet_put_bignum2(BIGNUM * value) 792ssh_packet_set_encryption_key(struct ssh *ssh, const u_char *key, u_int keylen, int number)
651{ 793{
652 buffer_put_bignum2(&active_state->outgoing_packet, value); 794#ifdef WITH_SSH1
653} 795 struct session_state *state = ssh->state;
654#endif 796 const struct sshcipher *cipher = cipher_by_number(number);
797 int r;
798 const char *wmsg;
655 799
656#ifdef OPENSSL_HAS_ECC 800 if (cipher == NULL)
657void 801 fatal("%s: unknown cipher number %d", __func__, number);
658packet_put_ecpoint(const EC_GROUP *curve, const EC_POINT *point) 802 if (keylen < 20)
659{ 803 fatal("%s: keylen too small: %d", __func__, keylen);
660 buffer_put_ecpoint(&active_state->outgoing_packet, curve, point); 804 if (keylen > SSH_SESSION_KEY_LENGTH)
805 fatal("%s: keylen too big: %d", __func__, keylen);
806 memcpy(state->ssh1_key, key, keylen);
807 state->ssh1_keylen = keylen;
808 if ((r = cipher_init(&state->send_context, cipher, key, keylen,
809 NULL, 0, CIPHER_ENCRYPT)) != 0 ||
810 (r = cipher_init(&state->receive_context, cipher, key, keylen,
811 NULL, 0, CIPHER_DECRYPT) != 0))
812 fatal("%s: cipher_init failed: %s", __func__, ssh_err(r));
813 if (!state->cipher_warning_done &&
814 ((wmsg = cipher_warning_message(&state->send_context)) != NULL ||
815 (wmsg = cipher_warning_message(&state->send_context)) != NULL)) {
816 error("Warning: %s", wmsg);
817 state->cipher_warning_done = 1;
818 }
819#endif /* WITH_SSH1 */
661} 820}
662#endif
663 821
664/* 822/*
665 * Finalizes and sends the packet. If the encryption key has been set, 823 * Finalizes and sends the packet. If the encryption key has been set,
666 * encrypts the packet before sending. 824 * encrypts the packet before sending.
667 */ 825 */
668 826
669static void 827int
670packet_send1(void) 828ssh_packet_send1(struct ssh *ssh)
671{ 829{
830 struct session_state *state = ssh->state;
672 u_char buf[8], *cp; 831 u_char buf[8], *cp;
673 int i, padding, len; 832 int r, padding, len;
674 u_int checksum; 833 u_int checksum;
675 u_int32_t rnd = 0;
676 834
677 /* 835 /*
678 * If using packet compression, compress the payload of the outgoing 836 * If using packet compression, compress the payload of the outgoing
679 * packet. 837 * packet.
680 */ 838 */
681 if (active_state->packet_compression) { 839 if (state->packet_compression) {
682 buffer_clear(&active_state->compression_buffer); 840 sshbuf_reset(state->compression_buffer);
683 /* Skip padding. */ 841 /* Skip padding. */
684 buffer_consume(&active_state->outgoing_packet, 8); 842 if ((r = sshbuf_consume(state->outgoing_packet, 8)) != 0)
843 goto out;
685 /* padding */ 844 /* padding */
686 buffer_append(&active_state->compression_buffer, 845 if ((r = sshbuf_put(state->compression_buffer,
687 "\0\0\0\0\0\0\0\0", 8); 846 "\0\0\0\0\0\0\0\0", 8)) != 0)
688 buffer_compress(&active_state->outgoing_packet, 847 goto out;
689 &active_state->compression_buffer); 848 if ((r = compress_buffer(ssh, state->outgoing_packet,
690 buffer_clear(&active_state->outgoing_packet); 849 state->compression_buffer)) != 0)
691 buffer_append(&active_state->outgoing_packet, 850 goto out;
692 buffer_ptr(&active_state->compression_buffer), 851 sshbuf_reset(state->outgoing_packet);
693 buffer_len(&active_state->compression_buffer)); 852 if ((r = sshbuf_putb(state->outgoing_packet,
853 state->compression_buffer)) != 0)
854 goto out;
694 } 855 }
695 /* Compute packet length without padding (add checksum, remove padding). */ 856 /* Compute packet length without padding (add checksum, remove padding). */
696 len = buffer_len(&active_state->outgoing_packet) + 4 - 8; 857 len = sshbuf_len(state->outgoing_packet) + 4 - 8;
697 858
698 /* Insert padding. Initialized to zero in packet_start1() */ 859 /* Insert padding. Initialized to zero in packet_start1() */
699 padding = 8 - len % 8; 860 padding = 8 - len % 8;
700 if (!active_state->send_context.plaintext) { 861 if (!state->send_context.plaintext) {
701 cp = buffer_ptr(&active_state->outgoing_packet); 862 cp = sshbuf_mutable_ptr(state->outgoing_packet);
702 for (i = 0; i < padding; i++) { 863 if (cp == NULL) {
703 if (i % 4 == 0) 864 r = SSH_ERR_INTERNAL_ERROR;
704 rnd = arc4random(); 865 goto out;
705 cp[7 - i] = rnd & 0xff;
706 rnd >>= 8;
707 } 866 }
867 arc4random_buf(cp + 8 - padding, padding);
708 } 868 }
709 buffer_consume(&active_state->outgoing_packet, 8 - padding); 869 if ((r = sshbuf_consume(state->outgoing_packet, 8 - padding)) != 0)
870 goto out;
710 871
711 /* Add check bytes. */ 872 /* Add check bytes. */
712 checksum = ssh_crc32(buffer_ptr(&active_state->outgoing_packet), 873 checksum = ssh_crc32(sshbuf_ptr(state->outgoing_packet),
713 buffer_len(&active_state->outgoing_packet)); 874 sshbuf_len(state->outgoing_packet));
714 put_u32(buf, checksum); 875 POKE_U32(buf, checksum);
715 buffer_append(&active_state->outgoing_packet, buf, 4); 876 if ((r = sshbuf_put(state->outgoing_packet, buf, 4)) != 0)
877 goto out;
716 878
717#ifdef PACKET_DEBUG 879#ifdef PACKET_DEBUG
718 fprintf(stderr, "packet_send plain: "); 880 fprintf(stderr, "packet_send plain: ");
719 buffer_dump(&active_state->outgoing_packet); 881 sshbuf_dump(state->outgoing_packet, stderr);
720#endif 882#endif
721 883
722 /* Append to output. */ 884 /* Append to output. */
723 put_u32(buf, len); 885 POKE_U32(buf, len);
724 buffer_append(&active_state->output, buf, 4); 886 if ((r = sshbuf_put(state->output, buf, 4)) != 0)
725 cp = buffer_append_space(&active_state->output, 887 goto out;
726 buffer_len(&active_state->outgoing_packet)); 888 if ((r = sshbuf_reserve(state->output,
727 if (cipher_crypt(&active_state->send_context, 0, cp, 889 sshbuf_len(state->outgoing_packet), &cp)) != 0)
728 buffer_ptr(&active_state->outgoing_packet), 890 goto out;
729 buffer_len(&active_state->outgoing_packet), 0, 0) != 0) 891 if ((r = cipher_crypt(&state->send_context, 0, cp,
730 fatal("%s: cipher_crypt failed", __func__); 892 sshbuf_ptr(state->outgoing_packet),
893 sshbuf_len(state->outgoing_packet), 0, 0)) != 0)
894 goto out;
731 895
732#ifdef PACKET_DEBUG 896#ifdef PACKET_DEBUG
733 fprintf(stderr, "encrypted: "); 897 fprintf(stderr, "encrypted: ");
734 buffer_dump(&active_state->output); 898 sshbuf_dump(state->output, stderr);
735#endif 899#endif
736 active_state->p_send.packets++; 900 state->p_send.packets++;
737 active_state->p_send.bytes += len + 901 state->p_send.bytes += len +
738 buffer_len(&active_state->outgoing_packet); 902 sshbuf_len(state->outgoing_packet);
739 buffer_clear(&active_state->outgoing_packet); 903 sshbuf_reset(state->outgoing_packet);
740 904
741 /* 905 /*
742 * Note that the packet is now only buffered in output. It won't be 906 * Note that the packet is now only buffered in output. It won't be
743 * actually sent until packet_write_wait or packet_write_poll is 907 * actually sent until ssh_packet_write_wait or ssh_packet_write_poll
744 * called. 908 * is called.
745 */ 909 */
910 r = 0;
911 out:
912 return r;
746} 913}
747 914
748void 915int
749set_newkeys(int mode) 916ssh_set_newkeys(struct ssh *ssh, int mode)
750{ 917{
751 Enc *enc; 918 struct session_state *state = ssh->state;
752 Mac *mac; 919 struct sshenc *enc;
753 Comp *comp; 920 struct sshmac *mac;
754 CipherContext *cc; 921 struct sshcomp *comp;
922 struct sshcipher_ctx *cc;
755 u_int64_t *max_blocks; 923 u_int64_t *max_blocks;
924 const char *wmsg;
756 int r, crypt_type; 925 int r, crypt_type;
757 926
758 debug2("set_newkeys: mode %d", mode); 927 debug2("set_newkeys: mode %d", mode);
759 928
760 if (mode == MODE_OUT) { 929 if (mode == MODE_OUT) {
761 cc = &active_state->send_context; 930 cc = &state->send_context;
762 crypt_type = CIPHER_ENCRYPT; 931 crypt_type = CIPHER_ENCRYPT;
763 active_state->p_send.packets = active_state->p_send.blocks = 0; 932 state->p_send.packets = state->p_send.blocks = 0;
764 max_blocks = &active_state->max_blocks_out; 933 max_blocks = &state->max_blocks_out;
765 } else { 934 } else {
766 cc = &active_state->receive_context; 935 cc = &state->receive_context;
767 crypt_type = CIPHER_DECRYPT; 936 crypt_type = CIPHER_DECRYPT;
768 active_state->p_read.packets = active_state->p_read.blocks = 0; 937 state->p_read.packets = state->p_read.blocks = 0;
769 max_blocks = &active_state->max_blocks_in; 938 max_blocks = &state->max_blocks_in;
770 } 939 }
771 if (active_state->newkeys[mode] != NULL) { 940 if (state->newkeys[mode] != NULL) {
772 debug("set_newkeys: rekeying"); 941 debug("set_newkeys: rekeying");
773 cipher_cleanup(cc); 942 if ((r = cipher_cleanup(cc)) != 0)
774 enc = &active_state->newkeys[mode]->enc; 943 return r;
775 mac = &active_state->newkeys[mode]->mac; 944 enc = &state->newkeys[mode]->enc;
776 comp = &active_state->newkeys[mode]->comp; 945 mac = &state->newkeys[mode]->mac;
946 comp = &state->newkeys[mode]->comp;
777 mac_clear(mac); 947 mac_clear(mac);
778 explicit_bzero(enc->iv, enc->iv_len); 948 explicit_bzero(enc->iv, enc->iv_len);
779 explicit_bzero(enc->key, enc->key_len); 949 explicit_bzero(enc->key, enc->key_len);
@@ -784,32 +954,45 @@ set_newkeys(int mode)
784 free(mac->name); 954 free(mac->name);
785 free(mac->key); 955 free(mac->key);
786 free(comp->name); 956 free(comp->name);
787 free(active_state->newkeys[mode]); 957 free(state->newkeys[mode]);
788 } 958 }
789 active_state->newkeys[mode] = kex_get_newkeys(mode); 959 /* move newkeys from kex to state */
790 if (active_state->newkeys[mode] == NULL) 960 if ((state->newkeys[mode] = ssh->kex->newkeys[mode]) == NULL)
791 fatal("newkeys: no keys for mode %d", mode); 961 return SSH_ERR_INTERNAL_ERROR;
792 enc = &active_state->newkeys[mode]->enc; 962 ssh->kex->newkeys[mode] = NULL;
793 mac = &active_state->newkeys[mode]->mac; 963 enc = &state->newkeys[mode]->enc;
794 comp = &active_state->newkeys[mode]->comp; 964 mac = &state->newkeys[mode]->mac;
795 if (cipher_authlen(enc->cipher) == 0 && mac_init(mac) == 0) 965 comp = &state->newkeys[mode]->comp;
796 mac->enabled = 1; 966 if (cipher_authlen(enc->cipher) == 0) {
967 if ((r = mac_init(mac)) != 0)
968 return r;
969 }
970 mac->enabled = 1;
797 DBG(debug("cipher_init_context: %d", mode)); 971 DBG(debug("cipher_init_context: %d", mode));
798 if ((r = cipher_init(cc, enc->cipher, enc->key, enc->key_len, 972 if ((r = cipher_init(cc, enc->cipher, enc->key, enc->key_len,
799 enc->iv, enc->iv_len, crypt_type)) != 0) 973 enc->iv, enc->iv_len, crypt_type)) != 0)
800 fatal("%s: cipher_init: %s", __func__, ssh_err(r)); 974 return r;
975 if (!state->cipher_warning_done &&
976 (wmsg = cipher_warning_message(cc)) != NULL) {
977 error("Warning: %s", wmsg);
978 state->cipher_warning_done = 1;
979 }
801 /* Deleting the keys does not gain extra security */ 980 /* Deleting the keys does not gain extra security */
802 /* explicit_bzero(enc->iv, enc->block_size); 981 /* explicit_bzero(enc->iv, enc->block_size);
803 explicit_bzero(enc->key, enc->key_len); 982 explicit_bzero(enc->key, enc->key_len);
804 explicit_bzero(mac->key, mac->key_len); */ 983 explicit_bzero(mac->key, mac->key_len); */
805 if ((comp->type == COMP_ZLIB || 984 if ((comp->type == COMP_ZLIB ||
806 (comp->type == COMP_DELAYED && 985 (comp->type == COMP_DELAYED &&
807 active_state->after_authentication)) && comp->enabled == 0) { 986 state->after_authentication)) && comp->enabled == 0) {
808 packet_init_compression(); 987 if ((r = ssh_packet_init_compression(ssh)) < 0)
809 if (mode == MODE_OUT) 988 return r;
810 buffer_compress_init_send(6); 989 if (mode == MODE_OUT) {
811 else 990 if ((r = start_compression_out(ssh, 6)) != 0)
812 buffer_compress_init_recv(); 991 return r;
992 } else {
993 if ((r = start_compression_in(ssh)) != 0)
994 return r;
995 }
813 comp->enabled = 1; 996 comp->enabled = 1;
814 } 997 }
815 /* 998 /*
@@ -820,9 +1003,10 @@ set_newkeys(int mode)
820 *max_blocks = (u_int64_t)1 << (enc->block_size*2); 1003 *max_blocks = (u_int64_t)1 << (enc->block_size*2);
821 else 1004 else
822 *max_blocks = ((u_int64_t)1 << 30) / enc->block_size; 1005 *max_blocks = ((u_int64_t)1 << 30) / enc->block_size;
823 if (active_state->rekey_limit) 1006 if (state->rekey_limit)
824 *max_blocks = MIN(*max_blocks, 1007 *max_blocks = MIN(*max_blocks,
825 active_state->rekey_limit / enc->block_size); 1008 state->rekey_limit / enc->block_size);
1009 return 0;
826} 1010}
827 1011
828/* 1012/*
@@ -830,52 +1014,59 @@ set_newkeys(int mode)
830 * This happens on the server side after a SSH2_MSG_USERAUTH_SUCCESS is sent, 1014 * This happens on the server side after a SSH2_MSG_USERAUTH_SUCCESS is sent,
831 * and on the client side after a SSH2_MSG_USERAUTH_SUCCESS is received. 1015 * and on the client side after a SSH2_MSG_USERAUTH_SUCCESS is received.
832 */ 1016 */
833static void 1017static int
834packet_enable_delayed_compress(void) 1018ssh_packet_enable_delayed_compress(struct ssh *ssh)
835{ 1019{
836 Comp *comp = NULL; 1020 struct session_state *state = ssh->state;
837 int mode; 1021 struct sshcomp *comp = NULL;
1022 int r, mode;
838 1023
839 /* 1024 /*
840 * Remember that we are past the authentication step, so rekeying 1025 * Remember that we are past the authentication step, so rekeying
841 * with COMP_DELAYED will turn on compression immediately. 1026 * with COMP_DELAYED will turn on compression immediately.
842 */ 1027 */
843 active_state->after_authentication = 1; 1028 state->after_authentication = 1;
844 for (mode = 0; mode < MODE_MAX; mode++) { 1029 for (mode = 0; mode < MODE_MAX; mode++) {
845 /* protocol error: USERAUTH_SUCCESS received before NEWKEYS */ 1030 /* protocol error: USERAUTH_SUCCESS received before NEWKEYS */
846 if (active_state->newkeys[mode] == NULL) 1031 if (state->newkeys[mode] == NULL)
847 continue; 1032 continue;
848 comp = &active_state->newkeys[mode]->comp; 1033 comp = &state->newkeys[mode]->comp;
849 if (comp && !comp->enabled && comp->type == COMP_DELAYED) { 1034 if (comp && !comp->enabled && comp->type == COMP_DELAYED) {
850 packet_init_compression(); 1035 if ((r = ssh_packet_init_compression(ssh)) != 0)
851 if (mode == MODE_OUT) 1036 return r;
852 buffer_compress_init_send(6); 1037 if (mode == MODE_OUT) {
853 else 1038 if ((r = start_compression_out(ssh, 6)) != 0)
854 buffer_compress_init_recv(); 1039 return r;
1040 } else {
1041 if ((r = start_compression_in(ssh)) != 0)
1042 return r;
1043 }
855 comp->enabled = 1; 1044 comp->enabled = 1;
856 } 1045 }
857 } 1046 }
1047 return 0;
858} 1048}
859 1049
860/* 1050/*
861 * Finalize packet in SSH2 format (compress, mac, encrypt, enqueue) 1051 * Finalize packet in SSH2 format (compress, mac, encrypt, enqueue)
862 */ 1052 */
863static void 1053int
864packet_send2_wrapped(void) 1054ssh_packet_send2_wrapped(struct ssh *ssh)
865{ 1055{
866 u_char type, *cp, *macbuf = NULL; 1056 struct session_state *state = ssh->state;
1057 u_char type, *cp, macbuf[SSH_DIGEST_MAX_LENGTH];
867 u_char padlen, pad = 0; 1058 u_char padlen, pad = 0;
868 u_int i, len, authlen = 0, aadlen = 0; 1059 u_int authlen = 0, aadlen = 0;
869 u_int32_t rnd = 0; 1060 u_int len;
870 Enc *enc = NULL; 1061 struct sshenc *enc = NULL;
871 Mac *mac = NULL; 1062 struct sshmac *mac = NULL;
872 Comp *comp = NULL; 1063 struct sshcomp *comp = NULL;
873 int block_size; 1064 int r, block_size;
874 1065
875 if (active_state->newkeys[MODE_OUT] != NULL) { 1066 if (state->newkeys[MODE_OUT] != NULL) {
876 enc = &active_state->newkeys[MODE_OUT]->enc; 1067 enc = &state->newkeys[MODE_OUT]->enc;
877 mac = &active_state->newkeys[MODE_OUT]->mac; 1068 mac = &state->newkeys[MODE_OUT]->mac;
878 comp = &active_state->newkeys[MODE_OUT]->comp; 1069 comp = &state->newkeys[MODE_OUT]->comp;
879 /* disable mac for authenticated encryption */ 1070 /* disable mac for authenticated encryption */
880 if ((authlen = cipher_authlen(enc->cipher)) != 0) 1071 if ((authlen = cipher_authlen(enc->cipher)) != 0)
881 mac = NULL; 1072 mac = NULL;
@@ -883,32 +1074,34 @@ packet_send2_wrapped(void)
883 block_size = enc ? enc->block_size : 8; 1074 block_size = enc ? enc->block_size : 8;
884 aadlen = (mac && mac->enabled && mac->etm) || authlen ? 4 : 0; 1075 aadlen = (mac && mac->enabled && mac->etm) || authlen ? 4 : 0;
885 1076
886 cp = buffer_ptr(&active_state->outgoing_packet); 1077 type = (sshbuf_ptr(state->outgoing_packet))[5];
887 type = cp[5];
888 1078
889#ifdef PACKET_DEBUG 1079#ifdef PACKET_DEBUG
890 fprintf(stderr, "plain: "); 1080 fprintf(stderr, "plain: ");
891 buffer_dump(&active_state->outgoing_packet); 1081 sshbuf_dump(state->outgoing_packet, stderr);
892#endif 1082#endif
893 1083
894 if (comp && comp->enabled) { 1084 if (comp && comp->enabled) {
895 len = buffer_len(&active_state->outgoing_packet); 1085 len = sshbuf_len(state->outgoing_packet);
896 /* skip header, compress only payload */ 1086 /* skip header, compress only payload */
897 buffer_consume(&active_state->outgoing_packet, 5); 1087 if ((r = sshbuf_consume(state->outgoing_packet, 5)) != 0)
898 buffer_clear(&active_state->compression_buffer); 1088 goto out;
899 buffer_compress(&active_state->outgoing_packet, 1089 sshbuf_reset(state->compression_buffer);
900 &active_state->compression_buffer); 1090 if ((r = compress_buffer(ssh, state->outgoing_packet,
901 buffer_clear(&active_state->outgoing_packet); 1091 state->compression_buffer)) != 0)
902 buffer_append(&active_state->outgoing_packet, "\0\0\0\0\0", 5); 1092 goto out;
903 buffer_append(&active_state->outgoing_packet, 1093 sshbuf_reset(state->outgoing_packet);
904 buffer_ptr(&active_state->compression_buffer), 1094 if ((r = sshbuf_put(state->outgoing_packet,
905 buffer_len(&active_state->compression_buffer)); 1095 "\0\0\0\0\0", 5)) != 0 ||
906 DBG(debug("compression: raw %d compressed %d", len, 1096 (r = sshbuf_putb(state->outgoing_packet,
907 buffer_len(&active_state->outgoing_packet))); 1097 state->compression_buffer)) != 0)
1098 goto out;
1099 DBG(debug("compression: raw %d compressed %zd", len,
1100 sshbuf_len(state->outgoing_packet)));
908 } 1101 }
909 1102
910 /* sizeof (packet_len + pad_len + payload) */ 1103 /* sizeof (packet_len + pad_len + payload) */
911 len = buffer_len(&active_state->outgoing_packet); 1104 len = sshbuf_len(state->outgoing_packet);
912 1105
913 /* 1106 /*
914 * calc size of padding, alloc space, get random data, 1107 * calc size of padding, alloc space, get random data,
@@ -918,139 +1111,145 @@ packet_send2_wrapped(void)
918 padlen = block_size - (len % block_size); 1111 padlen = block_size - (len % block_size);
919 if (padlen < 4) 1112 if (padlen < 4)
920 padlen += block_size; 1113 padlen += block_size;
921 if (active_state->extra_pad) { 1114 if (state->extra_pad) {
922 /* will wrap if extra_pad+padlen > 255 */ 1115 /* will wrap if extra_pad+padlen > 255 */
923 active_state->extra_pad = 1116 state->extra_pad =
924 roundup(active_state->extra_pad, block_size); 1117 roundup(state->extra_pad, block_size);
925 pad = active_state->extra_pad - 1118 pad = state->extra_pad -
926 ((len + padlen) % active_state->extra_pad); 1119 ((len + padlen) % state->extra_pad);
927 DBG(debug3("%s: adding %d (len %d padlen %d extra_pad %d)", 1120 DBG(debug3("%s: adding %d (len %d padlen %d extra_pad %d)",
928 __func__, pad, len, padlen, active_state->extra_pad)); 1121 __func__, pad, len, padlen, state->extra_pad));
929 padlen += pad; 1122 padlen += pad;
930 active_state->extra_pad = 0; 1123 state->extra_pad = 0;
931 } 1124 }
932 cp = buffer_append_space(&active_state->outgoing_packet, padlen); 1125 if ((r = sshbuf_reserve(state->outgoing_packet, padlen, &cp)) != 0)
933 if (enc && !active_state->send_context.plaintext) { 1126 goto out;
1127 if (enc && !state->send_context.plaintext) {
934 /* random padding */ 1128 /* random padding */
935 for (i = 0; i < padlen; i++) { 1129 arc4random_buf(cp, padlen);
936 if (i % 4 == 0)
937 rnd = arc4random();
938 cp[i] = rnd & 0xff;
939 rnd >>= 8;
940 }
941 } else { 1130 } else {
942 /* clear padding */ 1131 /* clear padding */
943 explicit_bzero(cp, padlen); 1132 explicit_bzero(cp, padlen);
944 } 1133 }
945 /* sizeof (packet_len + pad_len + payload + padding) */ 1134 /* sizeof (packet_len + pad_len + payload + padding) */
946 len = buffer_len(&active_state->outgoing_packet); 1135 len = sshbuf_len(state->outgoing_packet);
947 cp = buffer_ptr(&active_state->outgoing_packet); 1136 cp = sshbuf_mutable_ptr(state->outgoing_packet);
1137 if (cp == NULL) {
1138 r = SSH_ERR_INTERNAL_ERROR;
1139 goto out;
1140 }
948 /* packet_length includes payload, padding and padding length field */ 1141 /* packet_length includes payload, padding and padding length field */
949 put_u32(cp, len - 4); 1142 POKE_U32(cp, len - 4);
950 cp[4] = padlen; 1143 cp[4] = padlen;
951 DBG(debug("send: len %d (includes padlen %d, aadlen %d)", 1144 DBG(debug("send: len %d (includes padlen %d, aadlen %d)",
952 len, padlen, aadlen)); 1145 len, padlen, aadlen));
953 1146
954 /* compute MAC over seqnr and packet(length fields, payload, padding) */ 1147 /* compute MAC over seqnr and packet(length fields, payload, padding) */
955 if (mac && mac->enabled && !mac->etm) { 1148 if (mac && mac->enabled && !mac->etm) {
956 macbuf = mac_compute(mac, active_state->p_send.seqnr, 1149 if ((r = mac_compute(mac, state->p_send.seqnr,
957 buffer_ptr(&active_state->outgoing_packet), len); 1150 sshbuf_ptr(state->outgoing_packet), len,
958 DBG(debug("done calc MAC out #%d", active_state->p_send.seqnr)); 1151 macbuf, sizeof(macbuf))) != 0)
1152 goto out;
1153 DBG(debug("done calc MAC out #%d", state->p_send.seqnr));
959 } 1154 }
960 /* encrypt packet and append to output buffer. */ 1155 /* encrypt packet and append to output buffer. */
961 cp = buffer_append_space(&active_state->output, len + authlen); 1156 if ((r = sshbuf_reserve(state->output,
962 if (cipher_crypt(&active_state->send_context, active_state->p_send.seqnr, 1157 sshbuf_len(state->outgoing_packet) + authlen, &cp)) != 0)
963 cp, buffer_ptr(&active_state->outgoing_packet), 1158 goto out;
964 len - aadlen, aadlen, authlen) != 0) 1159 if ((r = cipher_crypt(&state->send_context, state->p_send.seqnr, cp,
965 fatal("%s: cipher_crypt failed", __func__); 1160 sshbuf_ptr(state->outgoing_packet),
1161 len - aadlen, aadlen, authlen)) != 0)
1162 goto out;
966 /* append unencrypted MAC */ 1163 /* append unencrypted MAC */
967 if (mac && mac->enabled) { 1164 if (mac && mac->enabled) {
968 if (mac->etm) { 1165 if (mac->etm) {
969 /* EtM: compute mac over aadlen + cipher text */ 1166 /* EtM: compute mac over aadlen + cipher text */
970 macbuf = mac_compute(mac, 1167 if ((r = mac_compute(mac, state->p_send.seqnr,
971 active_state->p_send.seqnr, cp, len); 1168 cp, len, macbuf, sizeof(macbuf))) != 0)
1169 goto out;
972 DBG(debug("done calc MAC(EtM) out #%d", 1170 DBG(debug("done calc MAC(EtM) out #%d",
973 active_state->p_send.seqnr)); 1171 state->p_send.seqnr));
974 } 1172 }
975 buffer_append(&active_state->output, macbuf, mac->mac_len); 1173 if ((r = sshbuf_put(state->output, macbuf, mac->mac_len)) != 0)
1174 goto out;
976 } 1175 }
977#ifdef PACKET_DEBUG 1176#ifdef PACKET_DEBUG
978 fprintf(stderr, "encrypted: "); 1177 fprintf(stderr, "encrypted: ");
979 buffer_dump(&active_state->output); 1178 sshbuf_dump(state->output, stderr);
980#endif 1179#endif
981 /* increment sequence number for outgoing packets */ 1180 /* increment sequence number for outgoing packets */
982 if (++active_state->p_send.seqnr == 0) 1181 if (++state->p_send.seqnr == 0)
983 logit("outgoing seqnr wraps around"); 1182 logit("outgoing seqnr wraps around");
984 if (++active_state->p_send.packets == 0) 1183 if (++state->p_send.packets == 0)
985 if (!(datafellows & SSH_BUG_NOREKEY)) 1184 if (!(ssh->compat & SSH_BUG_NOREKEY))
986 fatal("XXX too many packets with same key"); 1185 return SSH_ERR_NEED_REKEY;
987 active_state->p_send.blocks += len / block_size; 1186 state->p_send.blocks += len / block_size;
988 active_state->p_send.bytes += len; 1187 state->p_send.bytes += len;
989 buffer_clear(&active_state->outgoing_packet); 1188 sshbuf_reset(state->outgoing_packet);
990 1189
991 if (type == SSH2_MSG_NEWKEYS) 1190 if (type == SSH2_MSG_NEWKEYS)
992 set_newkeys(MODE_OUT); 1191 r = ssh_set_newkeys(ssh, MODE_OUT);
993 else if (type == SSH2_MSG_USERAUTH_SUCCESS && active_state->server_side) 1192 else if (type == SSH2_MSG_USERAUTH_SUCCESS && state->server_side)
994 packet_enable_delayed_compress(); 1193 r = ssh_packet_enable_delayed_compress(ssh);
1194 else
1195 r = 0;
1196 out:
1197 return r;
995} 1198}
996 1199
997static void 1200int
998packet_send2(void) 1201ssh_packet_send2(struct ssh *ssh)
999{ 1202{
1203 struct session_state *state = ssh->state;
1000 struct packet *p; 1204 struct packet *p;
1001 u_char type, *cp; 1205 u_char type;
1206 int r;
1002 1207
1003 cp = buffer_ptr(&active_state->outgoing_packet); 1208 type = sshbuf_ptr(state->outgoing_packet)[5];
1004 type = cp[5];
1005 1209
1006 /* during rekeying we can only send key exchange messages */ 1210 /* during rekeying we can only send key exchange messages */
1007 if (active_state->rekeying) { 1211 if (state->rekeying) {
1008 if ((type < SSH2_MSG_TRANSPORT_MIN) || 1212 if ((type < SSH2_MSG_TRANSPORT_MIN) ||
1009 (type > SSH2_MSG_TRANSPORT_MAX) || 1213 (type > SSH2_MSG_TRANSPORT_MAX) ||
1010 (type == SSH2_MSG_SERVICE_REQUEST) || 1214 (type == SSH2_MSG_SERVICE_REQUEST) ||
1011 (type == SSH2_MSG_SERVICE_ACCEPT)) { 1215 (type == SSH2_MSG_SERVICE_ACCEPT)) {
1012 debug("enqueue packet: %u", type); 1216 debug("enqueue packet: %u", type);
1013 p = xcalloc(1, sizeof(*p)); 1217 p = calloc(1, sizeof(*p));
1218 if (p == NULL)
1219 return SSH_ERR_ALLOC_FAIL;
1014 p->type = type; 1220 p->type = type;
1015 memcpy(&p->payload, &active_state->outgoing_packet, 1221 p->payload = state->outgoing_packet;
1016 sizeof(Buffer)); 1222 TAILQ_INSERT_TAIL(&state->outgoing, p, next);
1017 buffer_init(&active_state->outgoing_packet); 1223 state->outgoing_packet = sshbuf_new();
1018 TAILQ_INSERT_TAIL(&active_state->outgoing, p, next); 1224 if (state->outgoing_packet == NULL)
1019 return; 1225 return SSH_ERR_ALLOC_FAIL;
1226 return 0;
1020 } 1227 }
1021 } 1228 }
1022 1229
1023 /* rekeying starts with sending KEXINIT */ 1230 /* rekeying starts with sending KEXINIT */
1024 if (type == SSH2_MSG_KEXINIT) 1231 if (type == SSH2_MSG_KEXINIT)
1025 active_state->rekeying = 1; 1232 state->rekeying = 1;
1026 1233
1027 packet_send2_wrapped(); 1234 if ((r = ssh_packet_send2_wrapped(ssh)) != 0)
1235 return r;
1028 1236
1029 /* after a NEWKEYS message we can send the complete queue */ 1237 /* after a NEWKEYS message we can send the complete queue */
1030 if (type == SSH2_MSG_NEWKEYS) { 1238 if (type == SSH2_MSG_NEWKEYS) {
1031 active_state->rekeying = 0; 1239 state->rekeying = 0;
1032 active_state->rekey_time = monotime(); 1240 state->rekey_time = monotime();
1033 while ((p = TAILQ_FIRST(&active_state->outgoing))) { 1241 while ((p = TAILQ_FIRST(&state->outgoing))) {
1034 type = p->type; 1242 type = p->type;
1035 debug("dequeue packet: %u", type); 1243 debug("dequeue packet: %u", type);
1036 buffer_free(&active_state->outgoing_packet); 1244 sshbuf_free(state->outgoing_packet);
1037 memcpy(&active_state->outgoing_packet, &p->payload, 1245 state->outgoing_packet = p->payload;
1038 sizeof(Buffer)); 1246 TAILQ_REMOVE(&state->outgoing, p, next);
1039 TAILQ_REMOVE(&active_state->outgoing, p, next);
1040 free(p); 1247 free(p);
1041 packet_send2_wrapped(); 1248 if ((r = ssh_packet_send2_wrapped(ssh)) != 0)
1249 return r;
1042 } 1250 }
1043 } 1251 }
1044} 1252 return 0;
1045
1046void
1047packet_send(void)
1048{
1049 if (compat20)
1050 packet_send2();
1051 else
1052 packet_send1();
1053 DBG(debug("packet_send done"));
1054} 1253}
1055 1254
1056/* 1255/*
@@ -1060,95 +1259,106 @@ packet_send(void)
1060 */ 1259 */
1061 1260
1062int 1261int
1063packet_read_seqnr(u_int32_t *seqnr_p) 1262ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
1064{ 1263{
1065 int type, len, ret, cont, ms_remain = 0; 1264 struct session_state *state = ssh->state;
1265 int len, r, ms_remain, cont;
1066 fd_set *setp; 1266 fd_set *setp;
1067 char buf[8192]; 1267 char buf[8192];
1068 struct timeval timeout, start, *timeoutp = NULL; 1268 struct timeval timeout, start, *timeoutp = NULL;
1069 1269
1070 DBG(debug("packet_read()")); 1270 DBG(debug("packet_read()"));
1071 1271
1072 setp = (fd_set *)xcalloc(howmany(active_state->connection_in + 1, 1272 setp = (fd_set *)calloc(howmany(state->connection_in + 1,
1073 NFDBITS), sizeof(fd_mask)); 1273 NFDBITS), sizeof(fd_mask));
1274 if (setp == NULL)
1275 return SSH_ERR_ALLOC_FAIL;
1074 1276
1075 /* Since we are blocking, ensure that all written packets have been sent. */ 1277 /*
1076 packet_write_wait(); 1278 * Since we are blocking, ensure that all written packets have
1279 * been sent.
1280 */
1281 if ((r = ssh_packet_write_wait(ssh)) != 0)
1282 return r;
1077 1283
1078 /* Stay in the loop until we have received a complete packet. */ 1284 /* Stay in the loop until we have received a complete packet. */
1079 for (;;) { 1285 for (;;) {
1080 /* Try to read a packet from the buffer. */ 1286 /* Try to read a packet from the buffer. */
1081 type = packet_read_poll_seqnr(seqnr_p); 1287 r = ssh_packet_read_poll_seqnr(ssh, typep, seqnr_p);
1288 if (r != 0)
1289 break;
1082 if (!compat20 && ( 1290 if (!compat20 && (
1083 type == SSH_SMSG_SUCCESS 1291 *typep == SSH_SMSG_SUCCESS
1084 || type == SSH_SMSG_FAILURE 1292 || *typep == SSH_SMSG_FAILURE
1085 || type == SSH_CMSG_EOF 1293 || *typep == SSH_CMSG_EOF
1086 || type == SSH_CMSG_EXIT_CONFIRMATION)) 1294 || *typep == SSH_CMSG_EXIT_CONFIRMATION))
1087 packet_check_eom(); 1295 if ((r = sshpkt_get_end(ssh)) != 0)
1296 break;
1088 /* If we got a packet, return it. */ 1297 /* If we got a packet, return it. */
1089 if (type != SSH_MSG_NONE) { 1298 if (*typep != SSH_MSG_NONE)
1090 free(setp); 1299 break;
1091 return type;
1092 }
1093 /* 1300 /*
1094 * Otherwise, wait for some data to arrive, add it to the 1301 * Otherwise, wait for some data to arrive, add it to the
1095 * buffer, and try again. 1302 * buffer, and try again.
1096 */ 1303 */
1097 memset(setp, 0, howmany(active_state->connection_in + 1, 1304 memset(setp, 0, howmany(state->connection_in + 1,
1098 NFDBITS) * sizeof(fd_mask)); 1305 NFDBITS) * sizeof(fd_mask));
1099 FD_SET(active_state->connection_in, setp); 1306 FD_SET(state->connection_in, setp);
1100 1307
1101 if (active_state->packet_timeout_ms > 0) { 1308 if (state->packet_timeout_ms > 0) {
1102 ms_remain = active_state->packet_timeout_ms; 1309 ms_remain = state->packet_timeout_ms;
1103 timeoutp = &timeout; 1310 timeoutp = &timeout;
1104 } 1311 }
1105 /* Wait for some data to arrive. */ 1312 /* Wait for some data to arrive. */
1106 for (;;) { 1313 for (;;) {
1107 if (active_state->packet_timeout_ms != -1) { 1314 if (state->packet_timeout_ms != -1) {
1108 ms_to_timeval(&timeout, ms_remain); 1315 ms_to_timeval(&timeout, ms_remain);
1109 gettimeofday(&start, NULL); 1316 gettimeofday(&start, NULL);
1110 } 1317 }
1111 if ((ret = select(active_state->connection_in + 1, setp, 1318 if ((r = select(state->connection_in + 1, setp,
1112 NULL, NULL, timeoutp)) >= 0) 1319 NULL, NULL, timeoutp)) >= 0)
1113 break; 1320 break;
1114 if (errno != EAGAIN && errno != EINTR && 1321 if (errno != EAGAIN && errno != EINTR &&
1115 errno != EWOULDBLOCK) 1322 errno != EWOULDBLOCK)
1116 break; 1323 break;
1117 if (active_state->packet_timeout_ms == -1) 1324 if (state->packet_timeout_ms == -1)
1118 continue; 1325 continue;
1119 ms_subtract_diff(&start, &ms_remain); 1326 ms_subtract_diff(&start, &ms_remain);
1120 if (ms_remain <= 0) { 1327 if (ms_remain <= 0) {
1121 ret = 0; 1328 r = 0;
1122 break; 1329 break;
1123 } 1330 }
1124 } 1331 }
1125 if (ret == 0) { 1332 if (r == 0)
1126 logit("Connection to %.200s timed out while " 1333 return SSH_ERR_CONN_TIMEOUT;
1127 "waiting to read", get_remote_ipaddr());
1128 cleanup_exit(255);
1129 }
1130 /* Read data from the socket. */ 1334 /* Read data from the socket. */
1131 do { 1335 do {
1132 cont = 0; 1336 cont = 0;
1133 len = roaming_read(active_state->connection_in, buf, 1337 len = roaming_read(state->connection_in, buf,
1134 sizeof(buf), &cont); 1338 sizeof(buf), &cont);
1135 } while (len == 0 && cont); 1339 } while (len == 0 && cont);
1136 if (len == 0) { 1340 if (len == 0)
1137 logit("Connection closed by %.200s", get_remote_ipaddr()); 1341 return SSH_ERR_CONN_CLOSED;
1138 cleanup_exit(255);
1139 }
1140 if (len < 0) 1342 if (len < 0)
1141 fatal("Read from socket failed: %.100s", strerror(errno)); 1343 return SSH_ERR_SYSTEM_ERROR;
1344
1142 /* Append it to the buffer. */ 1345 /* Append it to the buffer. */
1143 packet_process_incoming(buf, len); 1346 if ((r = ssh_packet_process_incoming(ssh, buf, len)) != 0)
1347 return r;
1144 } 1348 }
1145 /* NOTREACHED */ 1349 free(setp);
1350 return r;
1146} 1351}
1147 1352
1148int 1353int
1149packet_read(void) 1354ssh_packet_read(struct ssh *ssh)
1150{ 1355{
1151 return packet_read_seqnr(NULL); 1356 u_char type;
1357 int r;
1358
1359 if ((r = ssh_packet_read_seqnr(ssh, &type, NULL)) != 0)
1360 fatal("%s: %s", __func__, ssh_err(r));
1361 return type;
1152} 1362}
1153 1363
1154/* 1364/*
@@ -1156,15 +1366,22 @@ packet_read(void)
1156 * that given, and gives a fatal error and exits if there is a mismatch. 1366 * that given, and gives a fatal error and exits if there is a mismatch.
1157 */ 1367 */
1158 1368
1159void 1369int
1160packet_read_expect(int expected_type) 1370ssh_packet_read_expect(struct ssh *ssh, u_int expected_type)
1161{ 1371{
1162 int type; 1372 int r;
1373 u_char type;
1163 1374
1164 type = packet_read(); 1375 if ((r = ssh_packet_read_seqnr(ssh, &type, NULL)) != 0)
1165 if (type != expected_type) 1376 return r;
1166 packet_disconnect("Protocol error: expected packet type %d, got %d", 1377 if (type != expected_type) {
1167 expected_type, type); 1378 if ((r = sshpkt_disconnect(ssh,
1379 "Protocol error: expected packet type %d, got %d",
1380 expected_type, type)) != 0)
1381 return r;
1382 return SSH_ERR_PROTOCOL_ERROR;
1383 }
1384 return 0;
1168} 1385}
1169 1386
1170/* Checks if a full packet is available in the data received so far via 1387/* Checks if a full packet is available in the data received so far via
@@ -1176,115 +1393,165 @@ packet_read_expect(int expected_type)
1176 * to higher levels. 1393 * to higher levels.
1177 */ 1394 */
1178 1395
1179static int 1396int
1180packet_read_poll1(void) 1397ssh_packet_read_poll1(struct ssh *ssh, u_char *typep)
1181{ 1398{
1399 struct session_state *state = ssh->state;
1182 u_int len, padded_len; 1400 u_int len, padded_len;
1183 u_char *cp, type; 1401 const char *emsg;
1402 const u_char *cp;
1403 u_char *p;
1184 u_int checksum, stored_checksum; 1404 u_int checksum, stored_checksum;
1405 int r;
1406
1407 *typep = SSH_MSG_NONE;
1185 1408
1186 /* Check if input size is less than minimum packet size. */ 1409 /* Check if input size is less than minimum packet size. */
1187 if (buffer_len(&active_state->input) < 4 + 8) 1410 if (sshbuf_len(state->input) < 4 + 8)
1188 return SSH_MSG_NONE; 1411 return 0;
1189 /* Get length of incoming packet. */ 1412 /* Get length of incoming packet. */
1190 cp = buffer_ptr(&active_state->input); 1413 len = PEEK_U32(sshbuf_ptr(state->input));
1191 len = get_u32(cp); 1414 if (len < 1 + 2 + 2 || len > 256 * 1024) {
1192 if (len < 1 + 2 + 2 || len > 256 * 1024) 1415 if ((r = sshpkt_disconnect(ssh, "Bad packet length %u",
1193 packet_disconnect("Bad packet length %u.", len); 1416 len)) != 0)
1417 return r;
1418 return SSH_ERR_CONN_CORRUPT;
1419 }
1194 padded_len = (len + 8) & ~7; 1420 padded_len = (len + 8) & ~7;
1195 1421
1196 /* Check if the packet has been entirely received. */ 1422 /* Check if the packet has been entirely received. */
1197 if (buffer_len(&active_state->input) < 4 + padded_len) 1423 if (sshbuf_len(state->input) < 4 + padded_len)
1198 return SSH_MSG_NONE; 1424 return 0;
1199 1425
1200 /* The entire packet is in buffer. */ 1426 /* The entire packet is in buffer. */
1201 1427
1202 /* Consume packet length. */ 1428 /* Consume packet length. */
1203 buffer_consume(&active_state->input, 4); 1429 if ((r = sshbuf_consume(state->input, 4)) != 0)
1430 goto out;
1204 1431
1205 /* 1432 /*
1206 * Cryptographic attack detector for ssh 1433 * Cryptographic attack detector for ssh
1207 * (C)1998 CORE-SDI, Buenos Aires Argentina 1434 * (C)1998 CORE-SDI, Buenos Aires Argentina
1208 * Ariel Futoransky(futo@core-sdi.com) 1435 * Ariel Futoransky(futo@core-sdi.com)
1209 */ 1436 */
1210 if (!active_state->receive_context.plaintext) { 1437 if (!state->receive_context.plaintext) {
1211 switch (detect_attack(buffer_ptr(&active_state->input), 1438 emsg = NULL;
1212 padded_len)) { 1439 switch (detect_attack(&state->deattack,
1440 sshbuf_ptr(state->input), padded_len)) {
1441 case DEATTACK_OK:
1442 break;
1213 case DEATTACK_DETECTED: 1443 case DEATTACK_DETECTED:
1214 packet_disconnect("crc32 compensation attack: " 1444 emsg = "crc32 compensation attack detected";
1215 "network attack detected"); 1445 break;
1216 case DEATTACK_DOS_DETECTED: 1446 case DEATTACK_DOS_DETECTED:
1217 packet_disconnect("deattack denial of " 1447 emsg = "deattack denial of service detected";
1218 "service detected"); 1448 break;
1449 default:
1450 emsg = "deattack error";
1451 break;
1452 }
1453 if (emsg != NULL) {
1454 error("%s", emsg);
1455 if ((r = sshpkt_disconnect(ssh, "%s", emsg)) != 0 ||
1456 (r = ssh_packet_write_wait(ssh)) != 0)
1457 return r;
1458 return SSH_ERR_CONN_CORRUPT;
1219 } 1459 }
1220 } 1460 }
1221 1461
1222 /* Decrypt data to incoming_packet. */ 1462 /* Decrypt data to incoming_packet. */
1223 buffer_clear(&active_state->incoming_packet); 1463 sshbuf_reset(state->incoming_packet);
1224 cp = buffer_append_space(&active_state->incoming_packet, padded_len); 1464 if ((r = sshbuf_reserve(state->incoming_packet, padded_len, &p)) != 0)
1225 if (cipher_crypt(&active_state->receive_context, 0, cp, 1465 goto out;
1226 buffer_ptr(&active_state->input), padded_len, 0, 0) != 0) 1466 if ((r = cipher_crypt(&state->receive_context, 0, p,
1227 fatal("%s: cipher_crypt failed", __func__); 1467 sshbuf_ptr(state->input), padded_len, 0, 0)) != 0)
1468 goto out;
1228 1469
1229 buffer_consume(&active_state->input, padded_len); 1470 if ((r = sshbuf_consume(state->input, padded_len)) != 0)
1471 goto out;
1230 1472
1231#ifdef PACKET_DEBUG 1473#ifdef PACKET_DEBUG
1232 fprintf(stderr, "read_poll plain: "); 1474 fprintf(stderr, "read_poll plain: ");
1233 buffer_dump(&active_state->incoming_packet); 1475 sshbuf_dump(state->incoming_packet, stderr);
1234#endif 1476#endif
1235 1477
1236 /* Compute packet checksum. */ 1478 /* Compute packet checksum. */
1237 checksum = ssh_crc32(buffer_ptr(&active_state->incoming_packet), 1479 checksum = ssh_crc32(sshbuf_ptr(state->incoming_packet),
1238 buffer_len(&active_state->incoming_packet) - 4); 1480 sshbuf_len(state->incoming_packet) - 4);
1239 1481
1240 /* Skip padding. */ 1482 /* Skip padding. */
1241 buffer_consume(&active_state->incoming_packet, 8 - len % 8); 1483 if ((r = sshbuf_consume(state->incoming_packet, 8 - len % 8)) != 0)
1484 goto out;
1242 1485
1243 /* Test check bytes. */ 1486 /* Test check bytes. */
1244 if (len != buffer_len(&active_state->incoming_packet)) 1487 if (len != sshbuf_len(state->incoming_packet)) {
1245 packet_disconnect("packet_read_poll1: len %d != buffer_len %d.", 1488 error("%s: len %d != sshbuf_len %zd", __func__,
1246 len, buffer_len(&active_state->incoming_packet)); 1489 len, sshbuf_len(state->incoming_packet));
1247 1490 if ((r = sshpkt_disconnect(ssh, "invalid packet length")) != 0 ||
1248 cp = (u_char *)buffer_ptr(&active_state->incoming_packet) + len - 4; 1491 (r = ssh_packet_write_wait(ssh)) != 0)
1249 stored_checksum = get_u32(cp); 1492 return r;
1250 if (checksum != stored_checksum) 1493 return SSH_ERR_CONN_CORRUPT;
1251 packet_disconnect("Corrupted check bytes on input."); 1494 }
1252 buffer_consume_end(&active_state->incoming_packet, 4); 1495
1253 1496 cp = sshbuf_ptr(state->incoming_packet) + len - 4;
1254 if (active_state->packet_compression) { 1497 stored_checksum = PEEK_U32(cp);
1255 buffer_clear(&active_state->compression_buffer); 1498 if (checksum != stored_checksum) {
1256 buffer_uncompress(&active_state->incoming_packet, 1499 error("Corrupted check bytes on input");
1257 &active_state->compression_buffer); 1500 if ((r = sshpkt_disconnect(ssh, "connection corrupted")) != 0 ||
1258 buffer_clear(&active_state->incoming_packet); 1501 (r = ssh_packet_write_wait(ssh)) != 0)
1259 buffer_append(&active_state->incoming_packet, 1502 return r;
1260 buffer_ptr(&active_state->compression_buffer), 1503 return SSH_ERR_CONN_CORRUPT;
1261 buffer_len(&active_state->compression_buffer)); 1504 }
1262 } 1505 if ((r = sshbuf_consume_end(state->incoming_packet, 4)) < 0)
1263 active_state->p_read.packets++; 1506 goto out;
1264 active_state->p_read.bytes += padded_len + 4; 1507
1265 type = buffer_get_char(&active_state->incoming_packet); 1508 if (state->packet_compression) {
1266 if (type < SSH_MSG_MIN || type > SSH_MSG_MAX) 1509 sshbuf_reset(state->compression_buffer);
1267 packet_disconnect("Invalid ssh1 packet type: %d", type); 1510 if ((r = uncompress_buffer(ssh, state->incoming_packet,
1268 return type; 1511 state->compression_buffer)) != 0)
1512 goto out;
1513 sshbuf_reset(state->incoming_packet);
1514 if ((r = sshbuf_putb(state->incoming_packet,
1515 state->compression_buffer)) != 0)
1516 goto out;
1517 }
1518 state->p_read.packets++;
1519 state->p_read.bytes += padded_len + 4;
1520 if ((r = sshbuf_get_u8(state->incoming_packet, typep)) != 0)
1521 goto out;
1522 if (*typep < SSH_MSG_MIN || *typep > SSH_MSG_MAX) {
1523 error("Invalid ssh1 packet type: %d", *typep);
1524 if ((r = sshpkt_disconnect(ssh, "invalid packet type")) != 0 ||
1525 (r = ssh_packet_write_wait(ssh)) != 0)
1526 return r;
1527 return SSH_ERR_PROTOCOL_ERROR;
1528 }
1529 r = 0;
1530 out:
1531 return r;
1269} 1532}
1270 1533
1271static int 1534int
1272packet_read_poll2(u_int32_t *seqnr_p) 1535ssh_packet_read_poll2(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
1273{ 1536{
1537 struct session_state *state = ssh->state;
1274 u_int padlen, need; 1538 u_int padlen, need;
1275 u_char *macbuf = NULL, *cp, type; 1539 u_char *cp, macbuf[SSH_DIGEST_MAX_LENGTH];
1276 u_int maclen, authlen = 0, aadlen = 0, block_size; 1540 u_int maclen, aadlen = 0, authlen = 0, block_size;
1277 Enc *enc = NULL; 1541 struct sshenc *enc = NULL;
1278 Mac *mac = NULL; 1542 struct sshmac *mac = NULL;
1279 Comp *comp = NULL; 1543 struct sshcomp *comp = NULL;
1280 1544 int r;
1281 if (active_state->packet_discard) 1545
1282 return SSH_MSG_NONE; 1546 *typep = SSH_MSG_NONE;
1283 1547
1284 if (active_state->newkeys[MODE_IN] != NULL) { 1548 if (state->packet_discard)
1285 enc = &active_state->newkeys[MODE_IN]->enc; 1549 return 0;
1286 mac = &active_state->newkeys[MODE_IN]->mac; 1550
1287 comp = &active_state->newkeys[MODE_IN]->comp; 1551 if (state->newkeys[MODE_IN] != NULL) {
1552 enc = &state->newkeys[MODE_IN]->enc;
1553 mac = &state->newkeys[MODE_IN]->mac;
1554 comp = &state->newkeys[MODE_IN]->comp;
1288 /* disable mac for authenticated encryption */ 1555 /* disable mac for authenticated encryption */
1289 if ((authlen = cipher_authlen(enc->cipher)) != 0) 1556 if ((authlen = cipher_authlen(enc->cipher)) != 0)
1290 mac = NULL; 1557 mac = NULL;
@@ -1293,69 +1560,71 @@ packet_read_poll2(u_int32_t *seqnr_p)
1293 block_size = enc ? enc->block_size : 8; 1560 block_size = enc ? enc->block_size : 8;
1294 aadlen = (mac && mac->enabled && mac->etm) || authlen ? 4 : 0; 1561 aadlen = (mac && mac->enabled && mac->etm) || authlen ? 4 : 0;
1295 1562
1296 if (aadlen && active_state->packlen == 0) { 1563 if (aadlen && state->packlen == 0) {
1297 if (cipher_get_length(&active_state->receive_context, 1564 if (cipher_get_length(&state->receive_context,
1298 &active_state->packlen, 1565 &state->packlen, state->p_read.seqnr,
1299 active_state->p_read.seqnr, 1566 sshbuf_ptr(state->input), sshbuf_len(state->input)) != 0)
1300 buffer_ptr(&active_state->input), 1567 return 0;
1301 buffer_len(&active_state->input)) != 0) 1568 if (state->packlen < 1 + 4 ||
1302 return SSH_MSG_NONE; 1569 state->packlen > PACKET_MAX_SIZE) {
1303 if (active_state->packlen < 1 + 4 ||
1304 active_state->packlen > PACKET_MAX_SIZE) {
1305#ifdef PACKET_DEBUG 1570#ifdef PACKET_DEBUG
1306 buffer_dump(&active_state->input); 1571 sshbuf_dump(state->input, stderr);
1307#endif 1572#endif
1308 logit("Bad packet length %u.", active_state->packlen); 1573 logit("Bad packet length %u.", state->packlen);
1309 packet_disconnect("Packet corrupt"); 1574 if ((r = sshpkt_disconnect(ssh, "Packet corrupt")) != 0)
1575 return r;
1310 } 1576 }
1311 buffer_clear(&active_state->incoming_packet); 1577 sshbuf_reset(state->incoming_packet);
1312 } else if (active_state->packlen == 0) { 1578 } else if (state->packlen == 0) {
1313 /* 1579 /*
1314 * check if input size is less than the cipher block size, 1580 * check if input size is less than the cipher block size,
1315 * decrypt first block and extract length of incoming packet 1581 * decrypt first block and extract length of incoming packet
1316 */ 1582 */
1317 if (buffer_len(&active_state->input) < block_size) 1583 if (sshbuf_len(state->input) < block_size)
1318 return SSH_MSG_NONE; 1584 return 0;
1319 buffer_clear(&active_state->incoming_packet); 1585 sshbuf_reset(state->incoming_packet);
1320 cp = buffer_append_space(&active_state->incoming_packet, 1586 if ((r = sshbuf_reserve(state->incoming_packet, block_size,
1321 block_size); 1587 &cp)) != 0)
1322 if (cipher_crypt(&active_state->receive_context, 1588 goto out;
1323 active_state->p_read.seqnr, cp, 1589 if ((r = cipher_crypt(&state->receive_context,
1324 buffer_ptr(&active_state->input), block_size, 0, 0) != 0) 1590 state->p_send.seqnr, cp, sshbuf_ptr(state->input),
1325 fatal("Decryption integrity check failed"); 1591 block_size, 0, 0)) != 0)
1326 cp = buffer_ptr(&active_state->incoming_packet); 1592 goto out;
1327 active_state->packlen = get_u32(cp); 1593 state->packlen = PEEK_U32(sshbuf_ptr(state->incoming_packet));
1328 if (active_state->packlen < 1 + 4 || 1594 if (state->packlen < 1 + 4 ||
1329 active_state->packlen > PACKET_MAX_SIZE) { 1595 state->packlen > PACKET_MAX_SIZE) {
1330#ifdef PACKET_DEBUG 1596#ifdef PACKET_DEBUG
1331 buffer_dump(&active_state->incoming_packet); 1597 fprintf(stderr, "input: \n");
1598 sshbuf_dump(state->input, stderr);
1599 fprintf(stderr, "incoming_packet: \n");
1600 sshbuf_dump(state->incoming_packet, stderr);
1332#endif 1601#endif
1333 logit("Bad packet length %u.", active_state->packlen); 1602 logit("Bad packet length %u.", state->packlen);
1334 packet_start_discard(enc, mac, active_state->packlen, 1603 return ssh_packet_start_discard(ssh, enc, mac,
1335 PACKET_MAX_SIZE); 1604 state->packlen, PACKET_MAX_SIZE);
1336 return SSH_MSG_NONE;
1337 } 1605 }
1338 buffer_consume(&active_state->input, block_size); 1606 if ((r = sshbuf_consume(state->input, block_size)) != 0)
1607 goto out;
1339 } 1608 }
1340 DBG(debug("input: packet len %u", active_state->packlen+4)); 1609 DBG(debug("input: packet len %u", state->packlen+4));
1610
1341 if (aadlen) { 1611 if (aadlen) {
1342 /* only the payload is encrypted */ 1612 /* only the payload is encrypted */
1343 need = active_state->packlen; 1613 need = state->packlen;
1344 } else { 1614 } else {
1345 /* 1615 /*
1346 * the payload size and the payload are encrypted, but we 1616 * the payload size and the payload are encrypted, but we
1347 * have a partial packet of block_size bytes 1617 * have a partial packet of block_size bytes
1348 */ 1618 */
1349 need = 4 + active_state->packlen - block_size; 1619 need = 4 + state->packlen - block_size;
1350 } 1620 }
1351 DBG(debug("partial packet: block %d, need %d, maclen %d, authlen %d," 1621 DBG(debug("partial packet: block %d, need %d, maclen %d, authlen %d,"
1352 " aadlen %d", block_size, need, maclen, authlen, aadlen)); 1622 " aadlen %d", block_size, need, maclen, authlen, aadlen));
1353 if (need % block_size != 0) { 1623 if (need % block_size != 0) {
1354 logit("padding error: need %d block %d mod %d", 1624 logit("padding error: need %d block %d mod %d",
1355 need, block_size, need % block_size); 1625 need, block_size, need % block_size);
1356 packet_start_discard(enc, mac, active_state->packlen, 1626 return ssh_packet_start_discard(ssh, enc, mac,
1357 PACKET_MAX_SIZE - block_size); 1627 state->packlen, PACKET_MAX_SIZE - block_size);
1358 return SSH_MSG_NONE;
1359 } 1628 }
1360 /* 1629 /*
1361 * check if the entire packet has been received and 1630 * check if the entire packet has been received and
@@ -1365,167 +1634,197 @@ packet_read_poll2(u_int32_t *seqnr_p)
1365 * 'authlen' bytes of authentication tag or 1634 * 'authlen' bytes of authentication tag or
1366 * 'maclen' bytes of message authentication code. 1635 * 'maclen' bytes of message authentication code.
1367 */ 1636 */
1368 if (buffer_len(&active_state->input) < aadlen + need + authlen + maclen) 1637 if (sshbuf_len(state->input) < aadlen + need + authlen + maclen)
1369 return SSH_MSG_NONE; 1638 return 0;
1370#ifdef PACKET_DEBUG 1639#ifdef PACKET_DEBUG
1371 fprintf(stderr, "read_poll enc/full: "); 1640 fprintf(stderr, "read_poll enc/full: ");
1372 buffer_dump(&active_state->input); 1641 sshbuf_dump(state->input, stderr);
1373#endif 1642#endif
1374 /* EtM: compute mac over encrypted input */ 1643 /* EtM: compute mac over encrypted input */
1375 if (mac && mac->enabled && mac->etm) 1644 if (mac && mac->enabled && mac->etm) {
1376 macbuf = mac_compute(mac, active_state->p_read.seqnr, 1645 if ((r = mac_compute(mac, state->p_read.seqnr,
1377 buffer_ptr(&active_state->input), aadlen + need); 1646 sshbuf_ptr(state->input), aadlen + need,
1378 cp = buffer_append_space(&active_state->incoming_packet, aadlen + need); 1647 macbuf, sizeof(macbuf))) != 0)
1379 if (cipher_crypt(&active_state->receive_context, 1648 goto out;
1380 active_state->p_read.seqnr, cp, 1649 }
1381 buffer_ptr(&active_state->input), need, aadlen, authlen) != 0) 1650 if ((r = sshbuf_reserve(state->incoming_packet, aadlen + need,
1382 fatal("Decryption integrity check failed"); 1651 &cp)) != 0)
1383 buffer_consume(&active_state->input, aadlen + need + authlen); 1652 goto out;
1653 if ((r = cipher_crypt(&state->receive_context, state->p_read.seqnr, cp,
1654 sshbuf_ptr(state->input), need, aadlen, authlen)) != 0)
1655 goto out;
1656 if ((r = sshbuf_consume(state->input, aadlen + need + authlen)) != 0)
1657 goto out;
1384 /* 1658 /*
1385 * compute MAC over seqnr and packet, 1659 * compute MAC over seqnr and packet,
1386 * increment sequence number for incoming packet 1660 * increment sequence number for incoming packet
1387 */ 1661 */
1388 if (mac && mac->enabled) { 1662 if (mac && mac->enabled) {
1389 if (!mac->etm) 1663 if (!mac->etm)
1390 macbuf = mac_compute(mac, active_state->p_read.seqnr, 1664 if ((r = mac_compute(mac, state->p_read.seqnr,
1391 buffer_ptr(&active_state->incoming_packet), 1665 sshbuf_ptr(state->incoming_packet),
1392 buffer_len(&active_state->incoming_packet)); 1666 sshbuf_len(state->incoming_packet),
1393 if (timingsafe_bcmp(macbuf, buffer_ptr(&active_state->input), 1667 macbuf, sizeof(macbuf))) != 0)
1668 goto out;
1669 if (timingsafe_bcmp(macbuf, sshbuf_ptr(state->input),
1394 mac->mac_len) != 0) { 1670 mac->mac_len) != 0) {
1395 logit("Corrupted MAC on input."); 1671 logit("Corrupted MAC on input.");
1396 if (need > PACKET_MAX_SIZE) 1672 if (need > PACKET_MAX_SIZE)
1397 fatal("internal error need %d", need); 1673 return SSH_ERR_INTERNAL_ERROR;
1398 packet_start_discard(enc, mac, active_state->packlen, 1674 return ssh_packet_start_discard(ssh, enc, mac,
1399 PACKET_MAX_SIZE - need); 1675 state->packlen, PACKET_MAX_SIZE - need);
1400 return SSH_MSG_NONE;
1401 } 1676 }
1402 1677
1403 DBG(debug("MAC #%d ok", active_state->p_read.seqnr)); 1678 DBG(debug("MAC #%d ok", state->p_read.seqnr));
1404 buffer_consume(&active_state->input, mac->mac_len); 1679 if ((r = sshbuf_consume(state->input, mac->mac_len)) != 0)
1680 goto out;
1405 } 1681 }
1406 /* XXX now it's safe to use fatal/packet_disconnect */
1407 if (seqnr_p != NULL) 1682 if (seqnr_p != NULL)
1408 *seqnr_p = active_state->p_read.seqnr; 1683 *seqnr_p = state->p_read.seqnr;
1409 if (++active_state->p_read.seqnr == 0) 1684 if (++state->p_read.seqnr == 0)
1410 logit("incoming seqnr wraps around"); 1685 logit("incoming seqnr wraps around");
1411 if (++active_state->p_read.packets == 0) 1686 if (++state->p_read.packets == 0)
1412 if (!(datafellows & SSH_BUG_NOREKEY)) 1687 if (!(ssh->compat & SSH_BUG_NOREKEY))
1413 fatal("XXX too many packets with same key"); 1688 return SSH_ERR_NEED_REKEY;
1414 active_state->p_read.blocks += (active_state->packlen + 4) / block_size; 1689 state->p_read.blocks += (state->packlen + 4) / block_size;
1415 active_state->p_read.bytes += active_state->packlen + 4; 1690 state->p_read.bytes += state->packlen + 4;
1416 1691
1417 /* get padlen */ 1692 /* get padlen */
1418 cp = buffer_ptr(&active_state->incoming_packet); 1693 padlen = sshbuf_ptr(state->incoming_packet)[4];
1419 padlen = cp[4];
1420 DBG(debug("input: padlen %d", padlen)); 1694 DBG(debug("input: padlen %d", padlen));
1421 if (padlen < 4) 1695 if (padlen < 4) {
1422 packet_disconnect("Corrupted padlen %d on input.", padlen); 1696 if ((r = sshpkt_disconnect(ssh,
1697 "Corrupted padlen %d on input.", padlen)) != 0 ||
1698 (r = ssh_packet_write_wait(ssh)) != 0)
1699 return r;
1700 return SSH_ERR_CONN_CORRUPT;
1701 }
1423 1702
1424 /* skip packet size + padlen, discard padding */ 1703 /* skip packet size + padlen, discard padding */
1425 buffer_consume(&active_state->incoming_packet, 4 + 1); 1704 if ((r = sshbuf_consume(state->incoming_packet, 4 + 1)) != 0 ||
1426 buffer_consume_end(&active_state->incoming_packet, padlen); 1705 ((r = sshbuf_consume_end(state->incoming_packet, padlen)) != 0))
1706 goto out;
1427 1707
1428 DBG(debug("input: len before de-compress %d", 1708 DBG(debug("input: len before de-compress %zd",
1429 buffer_len(&active_state->incoming_packet))); 1709 sshbuf_len(state->incoming_packet)));
1430 if (comp && comp->enabled) { 1710 if (comp && comp->enabled) {
1431 buffer_clear(&active_state->compression_buffer); 1711 sshbuf_reset(state->compression_buffer);
1432 buffer_uncompress(&active_state->incoming_packet, 1712 if ((r = uncompress_buffer(ssh, state->incoming_packet,
1433 &active_state->compression_buffer); 1713 state->compression_buffer)) != 0)
1434 buffer_clear(&active_state->incoming_packet); 1714 goto out;
1435 buffer_append(&active_state->incoming_packet, 1715 sshbuf_reset(state->incoming_packet);
1436 buffer_ptr(&active_state->compression_buffer), 1716 if ((r = sshbuf_putb(state->incoming_packet,
1437 buffer_len(&active_state->compression_buffer)); 1717 state->compression_buffer)) != 0)
1438 DBG(debug("input: len after de-compress %d", 1718 goto out;
1439 buffer_len(&active_state->incoming_packet))); 1719 DBG(debug("input: len after de-compress %zd",
1720 sshbuf_len(state->incoming_packet)));
1440 } 1721 }
1441 /* 1722 /*
1442 * get packet type, implies consume. 1723 * get packet type, implies consume.
1443 * return length of payload (without type field) 1724 * return length of payload (without type field)
1444 */ 1725 */
1445 type = buffer_get_char(&active_state->incoming_packet); 1726 if ((r = sshbuf_get_u8(state->incoming_packet, typep)) != 0)
1446 if (type < SSH2_MSG_MIN || type >= SSH2_MSG_LOCAL_MIN) 1727 goto out;
1447 packet_disconnect("Invalid ssh2 packet type: %d", type); 1728 if (*typep < SSH2_MSG_MIN || *typep >= SSH2_MSG_LOCAL_MIN) {
1448 if (type == SSH2_MSG_NEWKEYS) 1729 if ((r = sshpkt_disconnect(ssh,
1449 set_newkeys(MODE_IN); 1730 "Invalid ssh2 packet type: %d", *typep)) != 0 ||
1450 else if (type == SSH2_MSG_USERAUTH_SUCCESS && 1731 (r = ssh_packet_write_wait(ssh)) != 0)
1451 !active_state->server_side) 1732 return r;
1452 packet_enable_delayed_compress(); 1733 return SSH_ERR_PROTOCOL_ERROR;
1734 }
1735 if (*typep == SSH2_MSG_NEWKEYS)
1736 r = ssh_set_newkeys(ssh, MODE_IN);
1737 else if (*typep == SSH2_MSG_USERAUTH_SUCCESS && !state->server_side)
1738 r = ssh_packet_enable_delayed_compress(ssh);
1739 else
1740 r = 0;
1453#ifdef PACKET_DEBUG 1741#ifdef PACKET_DEBUG
1454 fprintf(stderr, "read/plain[%d]:\r\n", type); 1742 fprintf(stderr, "read/plain[%d]:\r\n", *typep);
1455 buffer_dump(&active_state->incoming_packet); 1743 sshbuf_dump(state->incoming_packet, stderr);
1456#endif 1744#endif
1457 /* reset for next packet */ 1745 /* reset for next packet */
1458 active_state->packlen = 0; 1746 state->packlen = 0;
1459 return type; 1747 out:
1748 return r;
1460} 1749}
1461 1750
1462int 1751int
1463packet_read_poll_seqnr(u_int32_t *seqnr_p) 1752ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
1464{ 1753{
1754 struct session_state *state = ssh->state;
1465 u_int reason, seqnr; 1755 u_int reason, seqnr;
1466 u_char type; 1756 int r;
1467 char *msg; 1757 u_char *msg;
1468 1758
1469 for (;;) { 1759 for (;;) {
1760 msg = NULL;
1470 if (compat20) { 1761 if (compat20) {
1471 type = packet_read_poll2(seqnr_p); 1762 r = ssh_packet_read_poll2(ssh, typep, seqnr_p);
1472 if (type) { 1763 if (r != 0)
1473 active_state->keep_alive_timeouts = 0; 1764 return r;
1474 DBG(debug("received packet type %d", type)); 1765 if (*typep) {
1766 state->keep_alive_timeouts = 0;
1767 DBG(debug("received packet type %d", *typep));
1475 } 1768 }
1476 switch (type) { 1769 switch (*typep) {
1477 case SSH2_MSG_IGNORE: 1770 case SSH2_MSG_IGNORE:
1478 debug3("Received SSH2_MSG_IGNORE"); 1771 debug3("Received SSH2_MSG_IGNORE");
1479 break; 1772 break;
1480 case SSH2_MSG_DEBUG: 1773 case SSH2_MSG_DEBUG:
1481 packet_get_char(); 1774 if ((r = sshpkt_get_u8(ssh, NULL)) != 0 ||
1482 msg = packet_get_string(NULL); 1775 (r = sshpkt_get_string(ssh, &msg, NULL)) != 0 ||
1776 (r = sshpkt_get_string(ssh, NULL, NULL)) != 0) {
1777 if (msg)
1778 free(msg);
1779 return r;
1780 }
1483 debug("Remote: %.900s", msg); 1781 debug("Remote: %.900s", msg);
1484 free(msg); 1782 free(msg);
1485 msg = packet_get_string(NULL);
1486 free(msg);
1487 break; 1783 break;
1488 case SSH2_MSG_DISCONNECT: 1784 case SSH2_MSG_DISCONNECT:
1489 reason = packet_get_int(); 1785 if ((r = sshpkt_get_u32(ssh, &reason)) != 0 ||
1490 msg = packet_get_string(NULL); 1786 (r = sshpkt_get_string(ssh, &msg, NULL)) != 0)
1787 return r;
1491 /* Ignore normal client exit notifications */ 1788 /* Ignore normal client exit notifications */
1492 do_log2(active_state->server_side && 1789 do_log2(ssh->state->server_side &&
1493 reason == SSH2_DISCONNECT_BY_APPLICATION ? 1790 reason == SSH2_DISCONNECT_BY_APPLICATION ?
1494 SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_ERROR, 1791 SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_ERROR,
1495 "Received disconnect from %s: %u: %.400s", 1792 "Received disconnect from %s: %u: %.400s",
1496 get_remote_ipaddr(), reason, msg); 1793 ssh_remote_ipaddr(ssh), reason, msg);
1497 free(msg); 1794 free(msg);
1498 cleanup_exit(255); 1795 return SSH_ERR_DISCONNECTED;
1499 break;
1500 case SSH2_MSG_UNIMPLEMENTED: 1796 case SSH2_MSG_UNIMPLEMENTED:
1501 seqnr = packet_get_int(); 1797 if ((r = sshpkt_get_u32(ssh, &seqnr)) != 0)
1798 return r;
1502 debug("Received SSH2_MSG_UNIMPLEMENTED for %u", 1799 debug("Received SSH2_MSG_UNIMPLEMENTED for %u",
1503 seqnr); 1800 seqnr);
1504 break; 1801 break;
1505 default: 1802 default:
1506 return type; 1803 return 0;
1507 } 1804 }
1508 } else { 1805 } else {
1509 type = packet_read_poll1(); 1806 r = ssh_packet_read_poll1(ssh, typep);
1510 switch (type) { 1807 switch (*typep) {
1511 case SSH_MSG_NONE: 1808 case SSH_MSG_NONE:
1512 return SSH_MSG_NONE; 1809 return SSH_MSG_NONE;
1513 case SSH_MSG_IGNORE: 1810 case SSH_MSG_IGNORE:
1514 break; 1811 break;
1515 case SSH_MSG_DEBUG: 1812 case SSH_MSG_DEBUG:
1516 msg = packet_get_string(NULL); 1813 if ((r = sshpkt_get_string(ssh, &msg, NULL)) != 0)
1814 return r;
1517 debug("Remote: %.900s", msg); 1815 debug("Remote: %.900s", msg);
1518 free(msg); 1816 free(msg);
1519 break; 1817 break;
1520 case SSH_MSG_DISCONNECT: 1818 case SSH_MSG_DISCONNECT:
1521 msg = packet_get_string(NULL); 1819 if ((r = sshpkt_get_string(ssh, &msg, NULL)) != 0)
1820 return r;
1522 error("Received disconnect from %s: %.400s", 1821 error("Received disconnect from %s: %.400s",
1523 get_remote_ipaddr(), msg); 1822 ssh_remote_ipaddr(ssh), msg);
1524 cleanup_exit(255); 1823 free(msg);
1525 break; 1824 return SSH_ERR_DISCONNECTED;
1526 default: 1825 default:
1527 DBG(debug("received packet type %d", type)); 1826 DBG(debug("received packet type %d", *typep));
1528 return type; 1827 return 0;
1529 } 1828 }
1530 } 1829 }
1531 } 1830 }
@@ -1536,113 +1835,31 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p)
1536 * together with packet_read_poll. 1835 * together with packet_read_poll.
1537 */ 1836 */
1538 1837
1539void
1540packet_process_incoming(const char *buf, u_int len)
1541{
1542 if (active_state->packet_discard) {
1543 active_state->keep_alive_timeouts = 0; /* ?? */
1544 if (len >= active_state->packet_discard)
1545 packet_stop_discard();
1546 active_state->packet_discard -= len;
1547 return;
1548 }
1549 buffer_append(&active_state->input, buf, len);
1550}
1551
1552/* Returns a character from the packet. */
1553
1554u_int
1555packet_get_char(void)
1556{
1557 char ch;
1558
1559 buffer_get(&active_state->incoming_packet, &ch, 1);
1560 return (u_char) ch;
1561}
1562
1563/* Returns an integer from the packet data. */
1564
1565u_int
1566packet_get_int(void)
1567{
1568 return buffer_get_int(&active_state->incoming_packet);
1569}
1570
1571/* Returns an 64 bit integer from the packet data. */
1572
1573u_int64_t
1574packet_get_int64(void)
1575{
1576 return buffer_get_int64(&active_state->incoming_packet);
1577}
1578
1579/*
1580 * Returns an arbitrary precision integer from the packet data. The integer
1581 * must have been initialized before this call.
1582 */
1583
1584#ifdef WITH_OPENSSL
1585void
1586packet_get_bignum(BIGNUM * value)
1587{
1588 buffer_get_bignum(&active_state->incoming_packet, value);
1589}
1590
1591void
1592packet_get_bignum2(BIGNUM * value)
1593{
1594 buffer_get_bignum2(&active_state->incoming_packet, value);
1595}
1596
1597#ifdef OPENSSL_HAS_ECC
1598void
1599packet_get_ecpoint(const EC_GROUP *curve, EC_POINT *point)
1600{
1601 buffer_get_ecpoint(&active_state->incoming_packet, curve, point);
1602}
1603#endif
1604
1605void *
1606packet_get_raw(u_int *length_ptr)
1607{
1608 u_int bytes = buffer_len(&active_state->incoming_packet);
1609
1610 if (length_ptr != NULL)
1611 *length_ptr = bytes;
1612 return buffer_ptr(&active_state->incoming_packet);
1613}
1614#endif
1615
1616int 1838int
1617packet_remaining(void) 1839ssh_packet_process_incoming(struct ssh *ssh, const char *buf, u_int len)
1618{ 1840{
1619 return buffer_len(&active_state->incoming_packet); 1841 struct session_state *state = ssh->state;
1620} 1842 int r;
1621
1622/*
1623 * Returns a string from the packet data. The string is allocated using
1624 * xmalloc; it is the responsibility of the calling program to free it when
1625 * no longer needed. The length_ptr argument may be NULL, or point to an
1626 * integer into which the length of the string is stored.
1627 */
1628 1843
1629void * 1844 if (state->packet_discard) {
1630packet_get_string(u_int *length_ptr) 1845 state->keep_alive_timeouts = 0; /* ?? */
1631{ 1846 if (len >= state->packet_discard) {
1632 return buffer_get_string(&active_state->incoming_packet, length_ptr); 1847 if ((r = ssh_packet_stop_discard(ssh)) != 0)
1633} 1848 return r;
1849 }
1850 state->packet_discard -= len;
1851 return 0;
1852 }
1853 if ((r = sshbuf_put(ssh->state->input, buf, len)) != 0)
1854 return r;
1634 1855
1635const void * 1856 return 0;
1636packet_get_string_ptr(u_int *length_ptr)
1637{
1638 return buffer_get_string_ptr(&active_state->incoming_packet, length_ptr);
1639} 1857}
1640 1858
1641/* Ensures the returned string has no embedded \0 characters in it. */ 1859int
1642char * 1860ssh_packet_remaining(struct ssh *ssh)
1643packet_get_cstring(u_int *length_ptr)
1644{ 1861{
1645 return buffer_get_cstring(&active_state->incoming_packet, length_ptr); 1862 return sshbuf_len(ssh->state->incoming_packet);
1646} 1863}
1647 1864
1648/* 1865/*
@@ -1651,16 +1868,16 @@ packet_get_cstring(u_int *length_ptr)
1651 * message is printed immediately, but only if the client is being executed 1868 * message is printed immediately, but only if the client is being executed
1652 * in verbose mode. These messages are primarily intended to ease debugging 1869 * in verbose mode. These messages are primarily intended to ease debugging
1653 * authentication problems. The length of the formatted message must not 1870 * authentication problems. The length of the formatted message must not
1654 * exceed 1024 bytes. This will automatically call packet_write_wait. 1871 * exceed 1024 bytes. This will automatically call ssh_packet_write_wait.
1655 */ 1872 */
1656
1657void 1873void
1658packet_send_debug(const char *fmt,...) 1874ssh_packet_send_debug(struct ssh *ssh, const char *fmt,...)
1659{ 1875{
1660 char buf[1024]; 1876 char buf[1024];
1661 va_list args; 1877 va_list args;
1878 int r;
1662 1879
1663 if (compat20 && (datafellows & SSH_BUG_DEBUG)) 1880 if (compat20 && (ssh->compat & SSH_BUG_DEBUG))
1664 return; 1881 return;
1665 1882
1666 va_start(args, fmt); 1883 va_start(args, fmt);
@@ -1668,16 +1885,41 @@ packet_send_debug(const char *fmt,...)
1668 va_end(args); 1885 va_end(args);
1669 1886
1670 if (compat20) { 1887 if (compat20) {
1671 packet_start(SSH2_MSG_DEBUG); 1888 if ((r = sshpkt_start(ssh, SSH2_MSG_DEBUG)) != 0 ||
1672 packet_put_char(0); /* bool: always display */ 1889 (r = sshpkt_put_u8(ssh, 0)) != 0 || /* always display */
1673 packet_put_cstring(buf); 1890 (r = sshpkt_put_cstring(ssh, buf)) != 0 ||
1674 packet_put_cstring(""); 1891 (r = sshpkt_put_cstring(ssh, "")) != 0 ||
1892 (r = sshpkt_send(ssh)) != 0)
1893 fatal("%s: %s", __func__, ssh_err(r));
1675 } else { 1894 } else {
1676 packet_start(SSH_MSG_DEBUG); 1895 if ((r = sshpkt_start(ssh, SSH_MSG_DEBUG)) != 0 ||
1677 packet_put_cstring(buf); 1896 (r = sshpkt_put_cstring(ssh, buf)) != 0 ||
1897 (r = sshpkt_send(ssh)) != 0)
1898 fatal("%s: %s", __func__, ssh_err(r));
1899 }
1900 if ((r = ssh_packet_write_wait(ssh)) != 0)
1901 fatal("%s: %s", __func__, ssh_err(r));
1902}
1903
1904/*
1905 * Pretty-print connection-terminating errors and exit.
1906 */
1907void
1908sshpkt_fatal(struct ssh *ssh, const char *tag, int r)
1909{
1910 switch (r) {
1911 case SSH_ERR_CONN_CLOSED:
1912 logit("Connection closed by %.200s", ssh_remote_ipaddr(ssh));
1913 cleanup_exit(255);
1914 case SSH_ERR_CONN_TIMEOUT:
1915 logit("Connection to %.200s timed out while "
1916 "waiting to write", ssh_remote_ipaddr(ssh));
1917 cleanup_exit(255);
1918 default:
1919 fatal("%s%sConnection to %.200s: %s",
1920 tag != NULL ? tag : "", tag != NULL ? ": " : "",
1921 ssh_remote_ipaddr(ssh), ssh_err(r));
1678 } 1922 }
1679 packet_send();
1680 packet_write_wait();
1681} 1923}
1682 1924
1683/* 1925/*
@@ -1686,13 +1928,13 @@ packet_send_debug(const char *fmt,...)
1686 * should not contain a newline. The length of the formatted message must 1928 * should not contain a newline. The length of the formatted message must
1687 * not exceed 1024 bytes. 1929 * not exceed 1024 bytes.
1688 */ 1930 */
1689
1690void 1931void
1691packet_disconnect(const char *fmt,...) 1932ssh_packet_disconnect(struct ssh *ssh, const char *fmt,...)
1692{ 1933{
1693 char buf[1024]; 1934 char buf[1024];
1694 va_list args; 1935 va_list args;
1695 static int disconnecting = 0; 1936 static int disconnecting = 0;
1937 int r;
1696 1938
1697 if (disconnecting) /* Guard against recursive invocations. */ 1939 if (disconnecting) /* Guard against recursive invocations. */
1698 fatal("packet_disconnect called recursively."); 1940 fatal("packet_disconnect called recursively.");
@@ -1709,87 +1951,88 @@ packet_disconnect(const char *fmt,...)
1709 /* Display the error locally */ 1951 /* Display the error locally */
1710 logit("Disconnecting: %.100s", buf); 1952 logit("Disconnecting: %.100s", buf);
1711 1953
1712 /* Send the disconnect message to the other side, and wait for it to get sent. */ 1954 /*
1713 if (compat20) { 1955 * Send the disconnect message to the other side, and wait
1714 packet_start(SSH2_MSG_DISCONNECT); 1956 * for it to get sent.
1715 packet_put_int(SSH2_DISCONNECT_PROTOCOL_ERROR); 1957 */
1716 packet_put_cstring(buf); 1958 if ((r = sshpkt_disconnect(ssh, "%s", buf)) != 0)
1717 packet_put_cstring(""); 1959 sshpkt_fatal(ssh, __func__, r);
1718 } else {
1719 packet_start(SSH_MSG_DISCONNECT);
1720 packet_put_cstring(buf);
1721 }
1722 packet_send();
1723 packet_write_wait();
1724 1960
1725 /* Stop listening for connections. */ 1961 if ((r = ssh_packet_write_wait(ssh)) != 0)
1726 channel_close_all(); 1962 sshpkt_fatal(ssh, __func__, r);
1727 1963
1728 /* Close the connection. */ 1964 /* Close the connection. */
1729 packet_close(); 1965 ssh_packet_close(ssh);
1730 cleanup_exit(255); 1966 cleanup_exit(255);
1731} 1967}
1732 1968
1733/* Checks if there is any buffered output, and tries to write some of the output. */ 1969/*
1734 1970 * Checks if there is any buffered output, and tries to write some of
1735void 1971 * the output.
1736packet_write_poll(void) 1972 */
1973int
1974ssh_packet_write_poll(struct ssh *ssh)
1737{ 1975{
1738 int len = buffer_len(&active_state->output); 1976 struct session_state *state = ssh->state;
1739 int cont; 1977 int len = sshbuf_len(state->output);
1978 int cont, r;
1740 1979
1741 if (len > 0) { 1980 if (len > 0) {
1742 cont = 0; 1981 cont = 0;
1743 len = roaming_write(active_state->connection_out, 1982 len = roaming_write(state->connection_out,
1744 buffer_ptr(&active_state->output), len, &cont); 1983 sshbuf_ptr(state->output), len, &cont);
1745 if (len == -1) { 1984 if (len == -1) {
1746 if (errno == EINTR || errno == EAGAIN || 1985 if (errno == EINTR || errno == EAGAIN ||
1747 errno == EWOULDBLOCK) 1986 errno == EWOULDBLOCK)
1748 return; 1987 return 0;
1749 fatal("Write failed: %.100s", strerror(errno)); 1988 return SSH_ERR_SYSTEM_ERROR;
1750 } 1989 }
1751 if (len == 0 && !cont) 1990 if (len == 0 && !cont)
1752 fatal("Write connection closed"); 1991 return SSH_ERR_CONN_CLOSED;
1753 buffer_consume(&active_state->output, len); 1992 if ((r = sshbuf_consume(state->output, len)) != 0)
1993 return r;
1754 } 1994 }
1995 return 0;
1755} 1996}
1756 1997
1757/* 1998/*
1758 * Calls packet_write_poll repeatedly until all pending output data has been 1999 * Calls packet_write_poll repeatedly until all pending output data has been
1759 * written. 2000 * written.
1760 */ 2001 */
1761 2002int
1762void 2003ssh_packet_write_wait(struct ssh *ssh)
1763packet_write_wait(void)
1764{ 2004{
1765 fd_set *setp; 2005 fd_set *setp;
1766 int ret, ms_remain = 0; 2006 int ret, r, ms_remain = 0;
1767 struct timeval start, timeout, *timeoutp = NULL; 2007 struct timeval start, timeout, *timeoutp = NULL;
2008 struct session_state *state = ssh->state;
1768 2009
1769 setp = (fd_set *)xcalloc(howmany(active_state->connection_out + 1, 2010 setp = (fd_set *)calloc(howmany(state->connection_out + 1,
1770 NFDBITS), sizeof(fd_mask)); 2011 NFDBITS), sizeof(fd_mask));
1771 packet_write_poll(); 2012 if (setp == NULL)
1772 while (packet_have_data_to_write()) { 2013 return SSH_ERR_ALLOC_FAIL;
1773 memset(setp, 0, howmany(active_state->connection_out + 1, 2014 ssh_packet_write_poll(ssh);
2015 while (ssh_packet_have_data_to_write(ssh)) {
2016 memset(setp, 0, howmany(state->connection_out + 1,
1774 NFDBITS) * sizeof(fd_mask)); 2017 NFDBITS) * sizeof(fd_mask));
1775 FD_SET(active_state->connection_out, setp); 2018 FD_SET(state->connection_out, setp);
1776 2019
1777 if (active_state->packet_timeout_ms > 0) { 2020 if (state->packet_timeout_ms > 0) {
1778 ms_remain = active_state->packet_timeout_ms; 2021 ms_remain = state->packet_timeout_ms;
1779 timeoutp = &timeout; 2022 timeoutp = &timeout;
1780 } 2023 }
1781 for (;;) { 2024 for (;;) {
1782 if (active_state->packet_timeout_ms != -1) { 2025 if (state->packet_timeout_ms != -1) {
1783 ms_to_timeval(&timeout, ms_remain); 2026 ms_to_timeval(&timeout, ms_remain);
1784 gettimeofday(&start, NULL); 2027 gettimeofday(&start, NULL);
1785 } 2028 }
1786 if ((ret = select(active_state->connection_out + 1, 2029 if ((ret = select(state->connection_out + 1,
1787 NULL, setp, NULL, timeoutp)) >= 0) 2030 NULL, setp, NULL, timeoutp)) >= 0)
1788 break; 2031 break;
1789 if (errno != EAGAIN && errno != EINTR && 2032 if (errno != EAGAIN && errno != EINTR &&
1790 errno != EWOULDBLOCK) 2033 errno != EWOULDBLOCK)
1791 break; 2034 break;
1792 if (active_state->packet_timeout_ms == -1) 2035 if (state->packet_timeout_ms == -1)
1793 continue; 2036 continue;
1794 ms_subtract_diff(&start, &ms_remain); 2037 ms_subtract_diff(&start, &ms_remain);
1795 if (ms_remain <= 0) { 2038 if (ms_remain <= 0) {
@@ -1798,45 +2041,48 @@ packet_write_wait(void)
1798 } 2041 }
1799 } 2042 }
1800 if (ret == 0) { 2043 if (ret == 0) {
1801 logit("Connection to %.200s timed out while " 2044 free(setp);
1802 "waiting to write", get_remote_ipaddr()); 2045 return SSH_ERR_CONN_TIMEOUT;
1803 cleanup_exit(255); 2046 }
2047 if ((r = ssh_packet_write_poll(ssh)) != 0) {
2048 free(setp);
2049 return r;
1804 } 2050 }
1805 packet_write_poll();
1806 } 2051 }
1807 free(setp); 2052 free(setp);
2053 return 0;
1808} 2054}
1809 2055
1810/* Returns true if there is buffered data to write to the connection. */ 2056/* Returns true if there is buffered data to write to the connection. */
1811 2057
1812int 2058int
1813packet_have_data_to_write(void) 2059ssh_packet_have_data_to_write(struct ssh *ssh)
1814{ 2060{
1815 return buffer_len(&active_state->output) != 0; 2061 return sshbuf_len(ssh->state->output) != 0;
1816} 2062}
1817 2063
1818/* Returns true if there is not too much data to write to the connection. */ 2064/* Returns true if there is not too much data to write to the connection. */
1819 2065
1820int 2066int
1821packet_not_very_much_data_to_write(void) 2067ssh_packet_not_very_much_data_to_write(struct ssh *ssh)
1822{ 2068{
1823 if (active_state->interactive_mode) 2069 if (ssh->state->interactive_mode)
1824 return buffer_len(&active_state->output) < 16384; 2070 return sshbuf_len(ssh->state->output) < 16384;
1825 else 2071 else
1826 return buffer_len(&active_state->output) < 128 * 1024; 2072 return sshbuf_len(ssh->state->output) < 128 * 1024;
1827} 2073}
1828 2074
1829static void 2075void
1830packet_set_tos(int tos) 2076ssh_packet_set_tos(struct ssh *ssh, int tos)
1831{ 2077{
1832#ifndef IP_TOS_IS_BROKEN 2078#ifndef IP_TOS_IS_BROKEN
1833 if (!packet_connection_is_on_socket()) 2079 if (!ssh_packet_connection_is_on_socket(ssh))
1834 return; 2080 return;
1835 switch (packet_connection_af()) { 2081 switch (ssh_packet_connection_af(ssh)) {
1836# ifdef IP_TOS 2082# ifdef IP_TOS
1837 case AF_INET: 2083 case AF_INET:
1838 debug3("%s: set IP_TOS 0x%02x", __func__, tos); 2084 debug3("%s: set IP_TOS 0x%02x", __func__, tos);
1839 if (setsockopt(active_state->connection_in, 2085 if (setsockopt(ssh->state->connection_in,
1840 IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) 2086 IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0)
1841 error("setsockopt IP_TOS %d: %.100s:", 2087 error("setsockopt IP_TOS %d: %.100s:",
1842 tos, strerror(errno)); 2088 tos, strerror(errno));
@@ -1845,7 +2091,7 @@ packet_set_tos(int tos)
1845# ifdef IPV6_TCLASS 2091# ifdef IPV6_TCLASS
1846 case AF_INET6: 2092 case AF_INET6:
1847 debug3("%s: set IPV6_TCLASS 0x%02x", __func__, tos); 2093 debug3("%s: set IPV6_TCLASS 0x%02x", __func__, tos);
1848 if (setsockopt(active_state->connection_in, 2094 if (setsockopt(ssh->state->connection_in,
1849 IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)) < 0) 2095 IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)) < 0)
1850 error("setsockopt IPV6_TCLASS %d: %.100s:", 2096 error("setsockopt IPV6_TCLASS %d: %.100s:",
1851 tos, strerror(errno)); 2097 tos, strerror(errno));
@@ -1858,71 +2104,69 @@ packet_set_tos(int tos)
1858/* Informs that the current session is interactive. Sets IP flags for that. */ 2104/* Informs that the current session is interactive. Sets IP flags for that. */
1859 2105
1860void 2106void
1861packet_set_interactive(int interactive, int qos_interactive, int qos_bulk) 2107ssh_packet_set_interactive(struct ssh *ssh, int interactive, int qos_interactive, int qos_bulk)
1862{ 2108{
1863 if (active_state->set_interactive_called) 2109 struct session_state *state = ssh->state;
2110
2111 if (state->set_interactive_called)
1864 return; 2112 return;
1865 active_state->set_interactive_called = 1; 2113 state->set_interactive_called = 1;
1866 2114
1867 /* Record that we are in interactive mode. */ 2115 /* Record that we are in interactive mode. */
1868 active_state->interactive_mode = interactive; 2116 state->interactive_mode = interactive;
1869 2117
1870 /* Only set socket options if using a socket. */ 2118 /* Only set socket options if using a socket. */
1871 if (!packet_connection_is_on_socket()) 2119 if (!ssh_packet_connection_is_on_socket(ssh))
1872 return; 2120 return;
1873 set_nodelay(active_state->connection_in); 2121 set_nodelay(state->connection_in);
1874 packet_set_tos(interactive ? qos_interactive : qos_bulk); 2122 ssh_packet_set_tos(ssh, interactive ? qos_interactive :
2123 qos_bulk);
1875} 2124}
1876 2125
1877/* Returns true if the current connection is interactive. */ 2126/* Returns true if the current connection is interactive. */
1878 2127
1879int 2128int
1880packet_is_interactive(void) 2129ssh_packet_is_interactive(struct ssh *ssh)
1881{ 2130{
1882 return active_state->interactive_mode; 2131 return ssh->state->interactive_mode;
1883} 2132}
1884 2133
1885int 2134int
1886packet_set_maxsize(u_int s) 2135ssh_packet_set_maxsize(struct ssh *ssh, u_int s)
1887{ 2136{
1888 if (active_state->set_maxsize_called) { 2137 struct session_state *state = ssh->state;
2138
2139 if (state->set_maxsize_called) {
1889 logit("packet_set_maxsize: called twice: old %d new %d", 2140 logit("packet_set_maxsize: called twice: old %d new %d",
1890 active_state->max_packet_size, s); 2141 state->max_packet_size, s);
1891 return -1; 2142 return -1;
1892 } 2143 }
1893 if (s < 4 * 1024 || s > 1024 * 1024) { 2144 if (s < 4 * 1024 || s > 1024 * 1024) {
1894 logit("packet_set_maxsize: bad size %d", s); 2145 logit("packet_set_maxsize: bad size %d", s);
1895 return -1; 2146 return -1;
1896 } 2147 }
1897 active_state->set_maxsize_called = 1; 2148 state->set_maxsize_called = 1;
1898 debug("packet_set_maxsize: setting to %d", s); 2149 debug("packet_set_maxsize: setting to %d", s);
1899 active_state->max_packet_size = s; 2150 state->max_packet_size = s;
1900 return s; 2151 return s;
1901} 2152}
1902 2153
1903int 2154int
1904packet_inc_alive_timeouts(void) 2155ssh_packet_inc_alive_timeouts(struct ssh *ssh)
1905{ 2156{
1906 return ++active_state->keep_alive_timeouts; 2157 return ++ssh->state->keep_alive_timeouts;
1907} 2158}
1908 2159
1909void 2160void
1910packet_set_alive_timeouts(int ka) 2161ssh_packet_set_alive_timeouts(struct ssh *ssh, int ka)
1911{ 2162{
1912 active_state->keep_alive_timeouts = ka; 2163 ssh->state->keep_alive_timeouts = ka;
1913} 2164}
1914 2165
1915u_int 2166u_int
1916packet_get_maxsize(void) 2167ssh_packet_get_maxsize(struct ssh *ssh)
1917{ 2168{
1918 return active_state->max_packet_size; 2169 return ssh->state->max_packet_size;
1919}
1920
1921/* roundup current message to pad bytes */
1922void
1923packet_add_padding(u_char pad)
1924{
1925 active_state->extra_pad = pad;
1926} 2170}
1927 2171
1928/* 2172/*
@@ -1937,155 +2181,718 @@ packet_add_padding(u_char pad)
1937 * protection measure against advanced traffic analysis techniques. 2181 * protection measure against advanced traffic analysis techniques.
1938 */ 2182 */
1939void 2183void
1940packet_send_ignore(int nbytes) 2184ssh_packet_send_ignore(struct ssh *ssh, int nbytes)
1941{ 2185{
1942 u_int32_t rnd = 0; 2186 u_int32_t rnd = 0;
1943 int i; 2187 int r, i;
1944 2188
1945 packet_start(compat20 ? SSH2_MSG_IGNORE : SSH_MSG_IGNORE); 2189 if ((r = sshpkt_start(ssh, compat20 ?
1946 packet_put_int(nbytes); 2190 SSH2_MSG_IGNORE : SSH_MSG_IGNORE)) != 0 ||
2191 (r = sshpkt_put_u32(ssh, nbytes)) != 0)
2192 fatal("%s: %s", __func__, ssh_err(r));
1947 for (i = 0; i < nbytes; i++) { 2193 for (i = 0; i < nbytes; i++) {
1948 if (i % 4 == 0) 2194 if (i % 4 == 0)
1949 rnd = arc4random(); 2195 rnd = arc4random();
1950 packet_put_char((u_char)rnd & 0xff); 2196 if ((r = sshpkt_put_u8(ssh, (u_char)rnd & 0xff)) != 0)
2197 fatal("%s: %s", __func__, ssh_err(r));
1951 rnd >>= 8; 2198 rnd >>= 8;
1952 } 2199 }
1953} 2200}
1954 2201
1955#define MAX_PACKETS (1U<<31) 2202#define MAX_PACKETS (1U<<31)
1956int 2203int
1957packet_need_rekeying(void) 2204ssh_packet_need_rekeying(struct ssh *ssh)
1958{ 2205{
1959 if (datafellows & SSH_BUG_NOREKEY) 2206 struct session_state *state = ssh->state;
2207
2208 if (ssh->compat & SSH_BUG_NOREKEY)
1960 return 0; 2209 return 0;
1961 return 2210 return
1962 (active_state->p_send.packets > MAX_PACKETS) || 2211 (state->p_send.packets > MAX_PACKETS) ||
1963 (active_state->p_read.packets > MAX_PACKETS) || 2212 (state->p_read.packets > MAX_PACKETS) ||
1964 (active_state->max_blocks_out && 2213 (state->max_blocks_out &&
1965 (active_state->p_send.blocks > active_state->max_blocks_out)) || 2214 (state->p_send.blocks > state->max_blocks_out)) ||
1966 (active_state->max_blocks_in && 2215 (state->max_blocks_in &&
1967 (active_state->p_read.blocks > active_state->max_blocks_in)) || 2216 (state->p_read.blocks > state->max_blocks_in)) ||
1968 (active_state->rekey_interval != 0 && active_state->rekey_time + 2217 (state->rekey_interval != 0 && state->rekey_time +
1969 active_state->rekey_interval <= monotime()); 2218 state->rekey_interval <= monotime());
1970} 2219}
1971 2220
1972void 2221void
1973packet_set_rekey_limits(u_int32_t bytes, time_t seconds) 2222ssh_packet_set_rekey_limits(struct ssh *ssh, u_int32_t bytes, time_t seconds)
1974{ 2223{
1975 debug3("rekey after %lld bytes, %d seconds", (long long)bytes, 2224 debug3("rekey after %lld bytes, %d seconds", (long long)bytes,
1976 (int)seconds); 2225 (int)seconds);
1977 active_state->rekey_limit = bytes; 2226 ssh->state->rekey_limit = bytes;
1978 active_state->rekey_interval = seconds; 2227 ssh->state->rekey_interval = seconds;
1979 /*
1980 * We set the time here so that in post-auth privsep slave we count
1981 * from the completion of the authentication.
1982 */
1983 active_state->rekey_time = monotime();
1984} 2228}
1985 2229
1986time_t 2230time_t
1987packet_get_rekey_timeout(void) 2231ssh_packet_get_rekey_timeout(struct ssh *ssh)
1988{ 2232{
1989 time_t seconds; 2233 time_t seconds;
1990 2234
1991 seconds = active_state->rekey_time + active_state->rekey_interval - 2235 seconds = ssh->state->rekey_time + ssh->state->rekey_interval -
1992 monotime(); 2236 monotime();
1993 return (seconds <= 0 ? 1 : seconds); 2237 return (seconds <= 0 ? 1 : seconds);
1994} 2238}
1995 2239
1996void 2240void
1997packet_set_server(void) 2241ssh_packet_set_server(struct ssh *ssh)
1998{ 2242{
1999 active_state->server_side = 1; 2243 ssh->state->server_side = 1;
2000} 2244}
2001 2245
2002void 2246void
2003packet_set_authenticated(void) 2247ssh_packet_set_authenticated(struct ssh *ssh)
2004{
2005 active_state->after_authentication = 1;
2006}
2007
2008void *
2009packet_get_input(void)
2010{ 2248{
2011 return (void *)&active_state->input; 2249 ssh->state->after_authentication = 1;
2012} 2250}
2013 2251
2014void * 2252void *
2015packet_get_output(void) 2253ssh_packet_get_input(struct ssh *ssh)
2016{ 2254{
2017 return (void *)&active_state->output; 2255 return (void *)ssh->state->input;
2018} 2256}
2019 2257
2020void * 2258void *
2021packet_get_newkeys(int mode) 2259ssh_packet_get_output(struct ssh *ssh)
2022{ 2260{
2023 return (void *)active_state->newkeys[mode]; 2261 return (void *)ssh->state->output;
2024} 2262}
2025 2263
2264/* XXX TODO update roaming to new API (does not work anyway) */
2026/* 2265/*
2027 * Save the state for the real connection, and use a separate state when 2266 * Save the state for the real connection, and use a separate state when
2028 * resuming a suspended connection. 2267 * resuming a suspended connection.
2029 */ 2268 */
2030void 2269void
2031packet_backup_state(void) 2270ssh_packet_backup_state(struct ssh *ssh,
2271 struct ssh *backup_state)
2032{ 2272{
2033 struct session_state *tmp; 2273 struct ssh *tmp;
2034 2274
2035 close(active_state->connection_in); 2275 close(ssh->state->connection_in);
2036 active_state->connection_in = -1; 2276 ssh->state->connection_in = -1;
2037 close(active_state->connection_out); 2277 close(ssh->state->connection_out);
2038 active_state->connection_out = -1; 2278 ssh->state->connection_out = -1;
2039 if (backup_state) 2279 if (backup_state)
2040 tmp = backup_state; 2280 tmp = backup_state;
2041 else 2281 else
2042 tmp = alloc_session_state(); 2282 tmp = ssh_alloc_session_state();
2043 backup_state = active_state; 2283 backup_state = ssh;
2044 active_state = tmp; 2284 ssh = tmp;
2045} 2285}
2046 2286
2287/* XXX FIXME FIXME FIXME */
2047/* 2288/*
2048 * Swap in the old state when resuming a connecion. 2289 * Swap in the old state when resuming a connecion.
2049 */ 2290 */
2050void 2291void
2051packet_restore_state(void) 2292ssh_packet_restore_state(struct ssh *ssh,
2293 struct ssh *backup_state)
2052{ 2294{
2053 struct session_state *tmp; 2295 struct ssh *tmp;
2054 void *buf;
2055 u_int len; 2296 u_int len;
2297 int r;
2056 2298
2057 tmp = backup_state; 2299 tmp = backup_state;
2058 backup_state = active_state; 2300 backup_state = ssh;
2059 active_state = tmp; 2301 ssh = tmp;
2060 active_state->connection_in = backup_state->connection_in; 2302 ssh->state->connection_in = backup_state->state->connection_in;
2061 backup_state->connection_in = -1; 2303 backup_state->state->connection_in = -1;
2062 active_state->connection_out = backup_state->connection_out; 2304 ssh->state->connection_out = backup_state->state->connection_out;
2063 backup_state->connection_out = -1; 2305 backup_state->state->connection_out = -1;
2064 len = buffer_len(&backup_state->input); 2306 len = sshbuf_len(backup_state->state->input);
2065 if (len > 0) { 2307 if (len > 0) {
2066 buf = buffer_ptr(&backup_state->input); 2308 if ((r = sshbuf_putb(ssh->state->input,
2067 buffer_append(&active_state->input, buf, len); 2309 backup_state->state->input)) != 0)
2068 buffer_clear(&backup_state->input); 2310 fatal("%s: %s", __func__, ssh_err(r));
2311 sshbuf_reset(backup_state->state->input);
2069 add_recv_bytes(len); 2312 add_recv_bytes(len);
2070 } 2313 }
2071} 2314}
2072 2315
2073/* Reset after_authentication and reset compression in post-auth privsep */ 2316/* Reset after_authentication and reset compression in post-auth privsep */
2074void 2317static int
2075packet_set_postauth(void) 2318ssh_packet_set_postauth(struct ssh *ssh)
2076{ 2319{
2077 Comp *comp; 2320 struct sshcomp *comp;
2078 int mode; 2321 int r, mode;
2079 2322
2080 debug("%s: called", __func__); 2323 debug("%s: called", __func__);
2081 /* This was set in net child, but is not visible in user child */ 2324 /* This was set in net child, but is not visible in user child */
2082 active_state->after_authentication = 1; 2325 ssh->state->after_authentication = 1;
2083 active_state->rekeying = 0; 2326 ssh->state->rekeying = 0;
2084 for (mode = 0; mode < MODE_MAX; mode++) { 2327 for (mode = 0; mode < MODE_MAX; mode++) {
2085 if (active_state->newkeys[mode] == NULL) 2328 if (ssh->state->newkeys[mode] == NULL)
2086 continue; 2329 continue;
2087 comp = &active_state->newkeys[mode]->comp; 2330 comp = &ssh->state->newkeys[mode]->comp;
2088 if (comp && comp->enabled) 2331 if (comp && comp->enabled &&
2089 packet_init_compression(); 2332 (r = ssh_packet_init_compression(ssh)) != 0)
2333 return r;
2334 }
2335 return 0;
2336}
2337
2338/* Packet state (de-)serialization for privsep */
2339
2340/* turn kex into a blob for packet state serialization */
2341static int
2342kex_to_blob(struct sshbuf *m, struct kex *kex)
2343{
2344 int r;
2345
2346 if ((r = sshbuf_put_string(m, kex->session_id,
2347 kex->session_id_len)) != 0 ||
2348 (r = sshbuf_put_u32(m, kex->we_need)) != 0 ||
2349 (r = sshbuf_put_u32(m, kex->hostkey_type)) != 0 ||
2350 (r = sshbuf_put_u32(m, kex->kex_type)) != 0 ||
2351 (r = sshbuf_put_stringb(m, kex->my)) != 0 ||
2352 (r = sshbuf_put_stringb(m, kex->peer)) != 0 ||
2353 (r = sshbuf_put_u32(m, kex->flags)) != 0 ||
2354 (r = sshbuf_put_cstring(m, kex->client_version_string)) != 0 ||
2355 (r = sshbuf_put_cstring(m, kex->server_version_string)) != 0)
2356 return r;
2357 return 0;
2358}
2359
2360/* turn key exchange results into a blob for packet state serialization */
2361static int
2362newkeys_to_blob(struct sshbuf *m, struct ssh *ssh, int mode)
2363{
2364 struct sshbuf *b;
2365 struct sshcipher_ctx *cc;
2366 struct sshcomp *comp;
2367 struct sshenc *enc;
2368 struct sshmac *mac;
2369 struct newkeys *newkey;
2370 int r;
2371
2372 if ((newkey = ssh->state->newkeys[mode]) == NULL)
2373 return SSH_ERR_INTERNAL_ERROR;
2374 enc = &newkey->enc;
2375 mac = &newkey->mac;
2376 comp = &newkey->comp;
2377 cc = (mode == MODE_OUT) ? &ssh->state->send_context :
2378 &ssh->state->receive_context;
2379 if ((r = cipher_get_keyiv(cc, enc->iv, enc->iv_len)) != 0)
2380 return r;
2381 if ((b = sshbuf_new()) == NULL)
2382 return SSH_ERR_ALLOC_FAIL;
2383 /* The cipher struct is constant and shared, you export pointer */
2384 if ((r = sshbuf_put_cstring(b, enc->name)) != 0 ||
2385 (r = sshbuf_put(b, &enc->cipher, sizeof(enc->cipher))) != 0 ||
2386 (r = sshbuf_put_u32(b, enc->enabled)) != 0 ||
2387 (r = sshbuf_put_u32(b, enc->block_size)) != 0 ||
2388 (r = sshbuf_put_string(b, enc->key, enc->key_len)) != 0 ||
2389 (r = sshbuf_put_string(b, enc->iv, enc->iv_len)) != 0)
2390 goto out;
2391 if (cipher_authlen(enc->cipher) == 0) {
2392 if ((r = sshbuf_put_cstring(b, mac->name)) != 0 ||
2393 (r = sshbuf_put_u32(b, mac->enabled)) != 0 ||
2394 (r = sshbuf_put_string(b, mac->key, mac->key_len)) != 0)
2395 goto out;
2396 }
2397 if ((r = sshbuf_put_u32(b, comp->type)) != 0 ||
2398 (r = sshbuf_put_u32(b, comp->enabled)) != 0 ||
2399 (r = sshbuf_put_cstring(b, comp->name)) != 0)
2400 goto out;
2401 r = sshbuf_put_stringb(m, b);
2402 out:
2403 if (b != NULL)
2404 sshbuf_free(b);
2405 return r;
2406}
2407
2408/* serialize packet state into a blob */
2409int
2410ssh_packet_get_state(struct ssh *ssh, struct sshbuf *m)
2411{
2412 struct session_state *state = ssh->state;
2413 u_char *p;
2414 size_t slen, rlen;
2415 int r, ssh1cipher;
2416
2417 if (!compat20) {
2418 ssh1cipher = cipher_get_number(state->receive_context.cipher);
2419 slen = cipher_get_keyiv_len(&state->send_context);
2420 rlen = cipher_get_keyiv_len(&state->receive_context);
2421 if ((r = sshbuf_put_u32(m, state->remote_protocol_flags)) != 0 ||
2422 (r = sshbuf_put_u32(m, ssh1cipher)) != 0 ||
2423 (r = sshbuf_put_string(m, state->ssh1_key, state->ssh1_keylen)) != 0 ||
2424 (r = sshbuf_put_u32(m, slen)) != 0 ||
2425 (r = sshbuf_reserve(m, slen, &p)) != 0 ||
2426 (r = cipher_get_keyiv(&state->send_context, p, slen)) != 0 ||
2427 (r = sshbuf_put_u32(m, rlen)) != 0 ||
2428 (r = sshbuf_reserve(m, rlen, &p)) != 0 ||
2429 (r = cipher_get_keyiv(&state->receive_context, p, rlen)) != 0)
2430 return r;
2431 } else {
2432 if ((r = kex_to_blob(m, ssh->kex)) != 0 ||
2433 (r = newkeys_to_blob(m, ssh, MODE_OUT)) != 0 ||
2434 (r = newkeys_to_blob(m, ssh, MODE_IN)) != 0 ||
2435 (r = sshbuf_put_u32(m, state->rekey_limit)) != 0 ||
2436 (r = sshbuf_put_u32(m, state->rekey_interval)) != 0 ||
2437 (r = sshbuf_put_u32(m, state->p_send.seqnr)) != 0 ||
2438 (r = sshbuf_put_u64(m, state->p_send.blocks)) != 0 ||
2439 (r = sshbuf_put_u32(m, state->p_send.packets)) != 0 ||
2440 (r = sshbuf_put_u64(m, state->p_send.bytes)) != 0 ||
2441 (r = sshbuf_put_u32(m, state->p_read.seqnr)) != 0 ||
2442 (r = sshbuf_put_u64(m, state->p_read.blocks)) != 0 ||
2443 (r = sshbuf_put_u32(m, state->p_read.packets)) != 0 ||
2444 (r = sshbuf_put_u64(m, state->p_read.bytes)) != 0)
2445 return r;
2446 }
2447
2448 slen = cipher_get_keycontext(&state->send_context, NULL);
2449 rlen = cipher_get_keycontext(&state->receive_context, NULL);
2450 if ((r = sshbuf_put_u32(m, slen)) != 0 ||
2451 (r = sshbuf_reserve(m, slen, &p)) != 0)
2452 return r;
2453 if (cipher_get_keycontext(&state->send_context, p) != (int)slen)
2454 return SSH_ERR_INTERNAL_ERROR;
2455 if ((r = sshbuf_put_u32(m, rlen)) != 0 ||
2456 (r = sshbuf_reserve(m, rlen, &p)) != 0)
2457 return r;
2458 if (cipher_get_keycontext(&state->receive_context, p) != (int)rlen)
2459 return SSH_ERR_INTERNAL_ERROR;
2460
2461 if ((r = ssh_packet_get_compress_state(m, ssh)) != 0 ||
2462 (r = sshbuf_put_stringb(m, state->input)) != 0 ||
2463 (r = sshbuf_put_stringb(m, state->output)) != 0)
2464 return r;
2465
2466 if (compat20) {
2467 if ((r = sshbuf_put_u64(m, get_sent_bytes())) != 0 ||
2468 (r = sshbuf_put_u64(m, get_recv_bytes())) != 0)
2469 return r;
2470 }
2471 return 0;
2472}
2473
2474/* restore key exchange results from blob for packet state de-serialization */
2475static int
2476newkeys_from_blob(struct sshbuf *m, struct ssh *ssh, int mode)
2477{
2478 struct sshbuf *b = NULL;
2479 struct sshcomp *comp;
2480 struct sshenc *enc;
2481 struct sshmac *mac;
2482 struct newkeys *newkey = NULL;
2483 size_t keylen, ivlen, maclen;
2484 int r;
2485
2486 if ((newkey = calloc(1, sizeof(*newkey))) == NULL) {
2487 r = SSH_ERR_ALLOC_FAIL;
2488 goto out;
2489 }
2490 if ((r = sshbuf_froms(m, &b)) != 0)
2491 goto out;
2492#ifdef DEBUG_PK
2493 sshbuf_dump(b, stderr);
2494#endif
2495 enc = &newkey->enc;
2496 mac = &newkey->mac;
2497 comp = &newkey->comp;
2498
2499 if ((r = sshbuf_get_cstring(b, &enc->name, NULL)) != 0 ||
2500 (r = sshbuf_get(b, &enc->cipher, sizeof(enc->cipher))) != 0 ||
2501 (r = sshbuf_get_u32(b, (u_int *)&enc->enabled)) != 0 ||
2502 (r = sshbuf_get_u32(b, &enc->block_size)) != 0 ||
2503 (r = sshbuf_get_string(b, &enc->key, &keylen)) != 0 ||
2504 (r = sshbuf_get_string(b, &enc->iv, &ivlen)) != 0)
2505 goto out;
2506 if (cipher_authlen(enc->cipher) == 0) {
2507 if ((r = sshbuf_get_cstring(b, &mac->name, NULL)) != 0)
2508 goto out;
2509 if ((r = mac_setup(mac, mac->name)) != 0)
2510 goto out;
2511 if ((r = sshbuf_get_u32(b, (u_int *)&mac->enabled)) != 0 ||
2512 (r = sshbuf_get_string(b, &mac->key, &maclen)) != 0)
2513 goto out;
2514 if (maclen > mac->key_len) {
2515 r = SSH_ERR_INVALID_FORMAT;
2516 goto out;
2517 }
2518 mac->key_len = maclen;
2519 }
2520 if ((r = sshbuf_get_u32(b, &comp->type)) != 0 ||
2521 (r = sshbuf_get_u32(b, (u_int *)&comp->enabled)) != 0 ||
2522 (r = sshbuf_get_cstring(b, &comp->name, NULL)) != 0)
2523 goto out;
2524 if (enc->name == NULL ||
2525 cipher_by_name(enc->name) != enc->cipher) {
2526 r = SSH_ERR_INVALID_FORMAT;
2527 goto out;
2528 }
2529 if (sshbuf_len(b) != 0) {
2530 r = SSH_ERR_INVALID_FORMAT;
2531 goto out;
2532 }
2533 enc->key_len = keylen;
2534 enc->iv_len = ivlen;
2535 ssh->kex->newkeys[mode] = newkey;
2536 newkey = NULL;
2537 r = 0;
2538 out:
2539 if (newkey != NULL)
2540 free(newkey);
2541 if (b != NULL)
2542 sshbuf_free(b);
2543 return r;
2544}
2545
2546/* restore kex from blob for packet state de-serialization */
2547static int
2548kex_from_blob(struct sshbuf *m, struct kex **kexp)
2549{
2550 struct kex *kex;
2551 int r;
2552
2553 if ((kex = calloc(1, sizeof(struct kex))) == NULL ||
2554 (kex->my = sshbuf_new()) == NULL ||
2555 (kex->peer = sshbuf_new()) == NULL) {
2556 r = SSH_ERR_ALLOC_FAIL;
2557 goto out;
2558 }
2559 if ((r = sshbuf_get_string(m, &kex->session_id, &kex->session_id_len)) != 0 ||
2560 (r = sshbuf_get_u32(m, &kex->we_need)) != 0 ||
2561 (r = sshbuf_get_u32(m, (u_int *)&kex->hostkey_type)) != 0 ||
2562 (r = sshbuf_get_u32(m, &kex->kex_type)) != 0 ||
2563 (r = sshbuf_get_stringb(m, kex->my)) != 0 ||
2564 (r = sshbuf_get_stringb(m, kex->peer)) != 0 ||
2565 (r = sshbuf_get_u32(m, &kex->flags)) != 0 ||
2566 (r = sshbuf_get_cstring(m, &kex->client_version_string, NULL)) != 0 ||
2567 (r = sshbuf_get_cstring(m, &kex->server_version_string, NULL)) != 0)
2568 goto out;
2569 kex->server = 1;
2570 kex->done = 1;
2571 r = 0;
2572 out:
2573 if (r != 0 || kexp == NULL) {
2574 if (kex != NULL) {
2575 if (kex->my != NULL)
2576 sshbuf_free(kex->my);
2577 if (kex->peer != NULL)
2578 sshbuf_free(kex->peer);
2579 free(kex);
2580 }
2581 if (kexp != NULL)
2582 *kexp = NULL;
2583 } else {
2584 *kexp = kex;
2585 }
2586 return r;
2587}
2588
2589/*
2590 * Restore packet state from content of blob 'm' (de-serialization).
2591 * Note that 'm' will be partially consumed on parsing or any other errors.
2592 */
2593int
2594ssh_packet_set_state(struct ssh *ssh, struct sshbuf *m)
2595{
2596 struct session_state *state = ssh->state;
2597 const u_char *ssh1key, *ivin, *ivout, *keyin, *keyout, *input, *output;
2598 size_t ssh1keylen, rlen, slen, ilen, olen;
2599 int r;
2600 u_int ssh1cipher = 0;
2601 u_int64_t sent_bytes = 0, recv_bytes = 0;
2602
2603 if (!compat20) {
2604 if ((r = sshbuf_get_u32(m, &state->remote_protocol_flags)) != 0 ||
2605 (r = sshbuf_get_u32(m, &ssh1cipher)) != 0 ||
2606 (r = sshbuf_get_string_direct(m, &ssh1key, &ssh1keylen)) != 0 ||
2607 (r = sshbuf_get_string_direct(m, &ivout, &slen)) != 0 ||
2608 (r = sshbuf_get_string_direct(m, &ivin, &rlen)) != 0)
2609 return r;
2610 if (ssh1cipher > INT_MAX)
2611 return SSH_ERR_KEY_UNKNOWN_CIPHER;
2612 ssh_packet_set_encryption_key(ssh, ssh1key, ssh1keylen,
2613 (int)ssh1cipher);
2614 if (cipher_get_keyiv_len(&state->send_context) != (int)slen ||
2615 cipher_get_keyiv_len(&state->receive_context) != (int)rlen)
2616 return SSH_ERR_INVALID_FORMAT;
2617 if ((r = cipher_set_keyiv(&state->send_context, ivout)) != 0 ||
2618 (r = cipher_set_keyiv(&state->receive_context, ivin)) != 0)
2619 return r;
2620 } else {
2621 if ((r = kex_from_blob(m, &ssh->kex)) != 0 ||
2622 (r = newkeys_from_blob(m, ssh, MODE_OUT)) != 0 ||
2623 (r = newkeys_from_blob(m, ssh, MODE_IN)) != 0 ||
2624 (r = sshbuf_get_u32(m, &state->rekey_limit)) != 0 ||
2625 (r = sshbuf_get_u32(m, &state->rekey_interval)) != 0 ||
2626 (r = sshbuf_get_u32(m, &state->p_send.seqnr)) != 0 ||
2627 (r = sshbuf_get_u64(m, &state->p_send.blocks)) != 0 ||
2628 (r = sshbuf_get_u32(m, &state->p_send.packets)) != 0 ||
2629 (r = sshbuf_get_u64(m, &state->p_send.bytes)) != 0 ||
2630 (r = sshbuf_get_u32(m, &state->p_read.seqnr)) != 0 ||
2631 (r = sshbuf_get_u64(m, &state->p_read.blocks)) != 0 ||
2632 (r = sshbuf_get_u32(m, &state->p_read.packets)) != 0 ||
2633 (r = sshbuf_get_u64(m, &state->p_read.bytes)) != 0)
2634 return r;
2635 /*
2636 * We set the time here so that in post-auth privsep slave we
2637 * count from the completion of the authentication.
2638 */
2639 state->rekey_time = monotime();
2640 /* XXX ssh_set_newkeys overrides p_read.packets? XXX */
2641 if ((r = ssh_set_newkeys(ssh, MODE_IN)) != 0 ||
2642 (r = ssh_set_newkeys(ssh, MODE_OUT)) != 0)
2643 return r;
2644 }
2645 if ((r = sshbuf_get_string_direct(m, &keyout, &slen)) != 0 ||
2646 (r = sshbuf_get_string_direct(m, &keyin, &rlen)) != 0)
2647 return r;
2648 if (cipher_get_keycontext(&state->send_context, NULL) != (int)slen ||
2649 cipher_get_keycontext(&state->receive_context, NULL) != (int)rlen)
2650 return SSH_ERR_INVALID_FORMAT;
2651 cipher_set_keycontext(&state->send_context, keyout);
2652 cipher_set_keycontext(&state->receive_context, keyin);
2653
2654 if ((r = ssh_packet_set_compress_state(ssh, m)) != 0 ||
2655 (r = ssh_packet_set_postauth(ssh)) != 0)
2656 return r;
2657
2658 sshbuf_reset(state->input);
2659 sshbuf_reset(state->output);
2660 if ((r = sshbuf_get_string_direct(m, &input, &ilen)) != 0 ||
2661 (r = sshbuf_get_string_direct(m, &output, &olen)) != 0 ||
2662 (r = sshbuf_put(state->input, input, ilen)) != 0 ||
2663 (r = sshbuf_put(state->output, output, olen)) != 0)
2664 return r;
2665
2666 if (compat20) {
2667 if ((r = sshbuf_get_u64(m, &sent_bytes)) != 0 ||
2668 (r = sshbuf_get_u64(m, &recv_bytes)) != 0)
2669 return r;
2670 roam_set_bytes(sent_bytes, recv_bytes);
2090 } 2671 }
2672 if (sshbuf_len(m))
2673 return SSH_ERR_INVALID_FORMAT;
2674 debug3("%s: done", __func__);
2675 return 0;
2676}
2677
2678/* NEW API */
2679
2680/* put data to the outgoing packet */
2681
2682int
2683sshpkt_put(struct ssh *ssh, const void *v, size_t len)
2684{
2685 return sshbuf_put(ssh->state->outgoing_packet, v, len);
2686}
2687
2688int
2689sshpkt_putb(struct ssh *ssh, const struct sshbuf *b)
2690{
2691 return sshbuf_putb(ssh->state->outgoing_packet, b);
2692}
2693
2694int
2695sshpkt_put_u8(struct ssh *ssh, u_char val)
2696{
2697 return sshbuf_put_u8(ssh->state->outgoing_packet, val);
2698}
2699
2700int
2701sshpkt_put_u32(struct ssh *ssh, u_int32_t val)
2702{
2703 return sshbuf_put_u32(ssh->state->outgoing_packet, val);
2704}
2705
2706int
2707sshpkt_put_u64(struct ssh *ssh, u_int64_t val)
2708{
2709 return sshbuf_put_u64(ssh->state->outgoing_packet, val);
2710}
2711
2712int
2713sshpkt_put_string(struct ssh *ssh, const void *v, size_t len)
2714{
2715 return sshbuf_put_string(ssh->state->outgoing_packet, v, len);
2716}
2717
2718int
2719sshpkt_put_cstring(struct ssh *ssh, const void *v)
2720{
2721 return sshbuf_put_cstring(ssh->state->outgoing_packet, v);
2722}
2723
2724int
2725sshpkt_put_stringb(struct ssh *ssh, const struct sshbuf *v)
2726{
2727 return sshbuf_put_stringb(ssh->state->outgoing_packet, v);
2728}
2729
2730#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC)
2731int
2732sshpkt_put_ec(struct ssh *ssh, const EC_POINT *v, const EC_GROUP *g)
2733{
2734 return sshbuf_put_ec(ssh->state->outgoing_packet, v, g);
2735}
2736#endif /* WITH_OPENSSL && OPENSSL_HAS_ECC */
2737
2738#ifdef WITH_SSH1
2739int
2740sshpkt_put_bignum1(struct ssh *ssh, const BIGNUM *v)
2741{
2742 return sshbuf_put_bignum1(ssh->state->outgoing_packet, v);
2743}
2744#endif /* WITH_SSH1 */
2745
2746#ifdef WITH_OPENSSL
2747int
2748sshpkt_put_bignum2(struct ssh *ssh, const BIGNUM *v)
2749{
2750 return sshbuf_put_bignum2(ssh->state->outgoing_packet, v);
2751}
2752#endif /* WITH_OPENSSL */
2753
2754/* fetch data from the incoming packet */
2755
2756int
2757sshpkt_get(struct ssh *ssh, void *valp, size_t len)
2758{
2759 return sshbuf_get(ssh->state->incoming_packet, valp, len);
2760}
2761
2762int
2763sshpkt_get_u8(struct ssh *ssh, u_char *valp)
2764{
2765 return sshbuf_get_u8(ssh->state->incoming_packet, valp);
2766}
2767
2768int
2769sshpkt_get_u32(struct ssh *ssh, u_int32_t *valp)
2770{
2771 return sshbuf_get_u32(ssh->state->incoming_packet, valp);
2772}
2773
2774int
2775sshpkt_get_u64(struct ssh *ssh, u_int64_t *valp)
2776{
2777 return sshbuf_get_u64(ssh->state->incoming_packet, valp);
2778}
2779
2780int
2781sshpkt_get_string(struct ssh *ssh, u_char **valp, size_t *lenp)
2782{
2783 return sshbuf_get_string(ssh->state->incoming_packet, valp, lenp);
2784}
2785
2786int
2787sshpkt_get_string_direct(struct ssh *ssh, const u_char **valp, size_t *lenp)
2788{
2789 return sshbuf_get_string_direct(ssh->state->incoming_packet, valp, lenp);
2790}
2791
2792int
2793sshpkt_get_cstring(struct ssh *ssh, char **valp, size_t *lenp)
2794{
2795 return sshbuf_get_cstring(ssh->state->incoming_packet, valp, lenp);
2796}
2797
2798#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC)
2799int
2800sshpkt_get_ec(struct ssh *ssh, EC_POINT *v, const EC_GROUP *g)
2801{
2802 return sshbuf_get_ec(ssh->state->incoming_packet, v, g);
2803}
2804#endif /* WITH_OPENSSL && OPENSSL_HAS_ECC */
2805
2806#ifdef WITH_SSH1
2807int
2808sshpkt_get_bignum1(struct ssh *ssh, BIGNUM *v)
2809{
2810 return sshbuf_get_bignum1(ssh->state->incoming_packet, v);
2811}
2812#endif /* WITH_SSH1 */
2813
2814#ifdef WITH_OPENSSL
2815int
2816sshpkt_get_bignum2(struct ssh *ssh, BIGNUM *v)
2817{
2818 return sshbuf_get_bignum2(ssh->state->incoming_packet, v);
2819}
2820#endif /* WITH_OPENSSL */
2821
2822int
2823sshpkt_get_end(struct ssh *ssh)
2824{
2825 if (sshbuf_len(ssh->state->incoming_packet) > 0)
2826 return SSH_ERR_UNEXPECTED_TRAILING_DATA;
2827 return 0;
2828}
2829
2830const u_char *
2831sshpkt_ptr(struct ssh *ssh, size_t *lenp)
2832{
2833 if (lenp != NULL)
2834 *lenp = sshbuf_len(ssh->state->incoming_packet);
2835 return sshbuf_ptr(ssh->state->incoming_packet);
2836}
2837
2838/* start a new packet */
2839
2840int
2841sshpkt_start(struct ssh *ssh, u_char type)
2842{
2843 u_char buf[9];
2844 int len;
2845
2846 DBG(debug("packet_start[%d]", type));
2847 len = compat20 ? 6 : 9;
2848 memset(buf, 0, len - 1);
2849 buf[len - 1] = type;
2850 sshbuf_reset(ssh->state->outgoing_packet);
2851 return sshbuf_put(ssh->state->outgoing_packet, buf, len);
2852}
2853
2854/* send it */
2855
2856int
2857sshpkt_send(struct ssh *ssh)
2858{
2859 if (compat20)
2860 return ssh_packet_send2(ssh);
2861 else
2862 return ssh_packet_send1(ssh);
2863}
2864
2865int
2866sshpkt_disconnect(struct ssh *ssh, const char *fmt,...)
2867{
2868 char buf[1024];
2869 va_list args;
2870 int r;
2871
2872 va_start(args, fmt);
2873 vsnprintf(buf, sizeof(buf), fmt, args);
2874 va_end(args);
2875
2876 if (compat20) {
2877 if ((r = sshpkt_start(ssh, SSH2_MSG_DISCONNECT)) != 0 ||
2878 (r = sshpkt_put_u32(ssh, SSH2_DISCONNECT_PROTOCOL_ERROR)) != 0 ||
2879 (r = sshpkt_put_cstring(ssh, buf)) != 0 ||
2880 (r = sshpkt_put_cstring(ssh, "")) != 0 ||
2881 (r = sshpkt_send(ssh)) != 0)
2882 return r;
2883 } else {
2884 if ((r = sshpkt_start(ssh, SSH_MSG_DISCONNECT)) != 0 ||
2885 (r = sshpkt_put_cstring(ssh, buf)) != 0 ||
2886 (r = sshpkt_send(ssh)) != 0)
2887 return r;
2888 }
2889 return 0;
2890}
2891
2892/* roundup current message to pad bytes */
2893int
2894sshpkt_add_padding(struct ssh *ssh, u_char pad)
2895{
2896 ssh->state->extra_pad = pad;
2897 return 0;
2091} 2898}
diff --git a/packet.h b/packet.h
index e7b5fcba9..7b06544e8 100644
--- a/packet.h
+++ b/packet.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.h,v 1.61 2014/05/03 17:20:34 markus Exp $ */ 1/* $OpenBSD: packet.h,v 1.66 2015/01/30 01:13:33 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -18,111 +18,189 @@
18 18
19#include <termios.h> 19#include <termios.h>
20 20
21#include <openssl/bn.h> 21#ifdef WITH_OPENSSL
22#ifdef OPENSSL_HAS_ECC 22# include <openssl/bn.h>
23#include <openssl/ec.h> 23# ifdef OPENSSL_HAS_ECC
24#endif 24# include <openssl/ec.h>
25 25# else /* OPENSSL_HAS_ECC */
26void packet_set_connection(int, int); 26# define EC_KEY void
27void packet_set_timeout(int, int); 27# define EC_GROUP void
28void packet_set_nonblocking(void); 28# define EC_POINT void
29int packet_get_connection_in(void); 29# endif /* OPENSSL_HAS_ECC */
30int packet_get_connection_out(void); 30#else /* WITH_OPENSSL */
31void packet_close(void); 31# define BIGNUM void
32void packet_set_encryption_key(const u_char *, u_int, int); 32# define EC_KEY void
33u_int packet_get_encryption_key(u_char *); 33# define EC_GROUP void
34void packet_set_protocol_flags(u_int); 34# define EC_POINT void
35u_int packet_get_protocol_flags(void); 35#endif /* WITH_OPENSSL */
36void packet_start_compression(int); 36
37void packet_set_interactive(int, int, int); 37#include <signal.h>
38int packet_is_interactive(void); 38#include "openbsd-compat/sys-queue.h"
39void packet_set_server(void); 39
40void packet_set_authenticated(void); 40struct kex;
41 41struct sshkey;
42void packet_start(u_char); 42struct sshbuf;
43void packet_put_char(int ch); 43struct session_state; /* private session data */
44void packet_put_int(u_int value); 44
45void packet_put_int64(u_int64_t value); 45#include "dispatch.h" /* typedef, DISPATCH_MAX */
46void packet_put_bignum(BIGNUM * value); 46
47void packet_put_bignum2(BIGNUM * value); 47struct key_entry {
48#ifdef OPENSSL_HAS_ECC 48 TAILQ_ENTRY(key_entry) next;
49void packet_put_ecpoint(const EC_GROUP *, const EC_POINT *); 49 struct sshkey *key;
50#endif 50};
51void packet_put_string(const void *buf, u_int len); 51
52void packet_put_cstring(const char *str); 52struct ssh {
53void packet_put_raw(const void *buf, u_int len); 53 /* Session state */
54void packet_send(void); 54 struct session_state *state;
55 55
56int packet_read(void); 56 /* Key exchange */
57void packet_read_expect(int type); 57 struct kex *kex;
58void packet_process_incoming(const char *buf, u_int len); 58
59int packet_read_seqnr(u_int32_t *seqnr_p); 59 /* cached remote ip address and port*/
60int packet_read_poll_seqnr(u_int32_t *seqnr_p); 60 char *remote_ipaddr;
61 61 int remote_port;
62u_int packet_get_char(void); 62
63u_int packet_get_int(void); 63 /* Dispatcher table */
64u_int64_t packet_get_int64(void); 64 dispatch_fn *dispatch[DISPATCH_MAX];
65void packet_get_bignum(BIGNUM * value); 65 /* number of packets to ignore in the dispatcher */
66void packet_get_bignum2(BIGNUM * value); 66 int dispatch_skip_packets;
67#ifdef OPENSSL_HAS_ECC 67
68void packet_get_ecpoint(const EC_GROUP *, EC_POINT *); 68 /* datafellows */
69#endif 69 int compat;
70void *packet_get_raw(u_int *length_ptr); 70
71void *packet_get_string(u_int *length_ptr); 71 /* Lists for private and public keys */
72char *packet_get_cstring(u_int *length_ptr); 72 TAILQ_HEAD(, key_entry) private_keys;
73const void *packet_get_string_ptr(u_int *length_ptr); 73 TAILQ_HEAD(, key_entry) public_keys;
74void packet_disconnect(const char *fmt,...) __attribute__((noreturn)) __attribute__((format(printf, 1, 2))); 74
75void packet_send_debug(const char *fmt,...) __attribute__((format(printf, 1, 2))); 75 /* APP data */
76 76 void *app_data;
77void set_newkeys(int mode); 77};
78int packet_get_keyiv_len(int); 78
79void packet_get_keyiv(int, u_char *, u_int); 79struct ssh *ssh_alloc_session_state(void);
80int packet_get_keycontext(int, u_char *); 80struct ssh *ssh_packet_set_connection(struct ssh *, int, int);
81void packet_set_keycontext(int, u_char *); 81void ssh_packet_set_timeout(struct ssh *, int, int);
82void packet_get_state(int, u_int32_t *, u_int64_t *, u_int32_t *, u_int64_t *); 82int ssh_packet_stop_discard(struct ssh *);
83void packet_set_state(int, u_int32_t, u_int64_t, u_int32_t, u_int64_t); 83int ssh_packet_connection_af(struct ssh *);
84int packet_get_ssh1_cipher(void); 84void ssh_packet_set_nonblocking(struct ssh *);
85void packet_set_iv(int, u_char *); 85int ssh_packet_get_connection_in(struct ssh *);
86void *packet_get_newkeys(int); 86int ssh_packet_get_connection_out(struct ssh *);
87 87void ssh_packet_close(struct ssh *);
88void packet_write_poll(void); 88void ssh_packet_set_encryption_key(struct ssh *, const u_char *, u_int, int);
89void packet_write_wait(void); 89void ssh_packet_set_protocol_flags(struct ssh *, u_int);
90int packet_have_data_to_write(void); 90u_int ssh_packet_get_protocol_flags(struct ssh *);
91int packet_not_very_much_data_to_write(void); 91int ssh_packet_start_compression(struct ssh *, int);
92 92void ssh_packet_set_tos(struct ssh *, int);
93int packet_connection_is_on_socket(void); 93void ssh_packet_set_interactive(struct ssh *, int, int, int);
94int packet_remaining(void); 94int ssh_packet_is_interactive(struct ssh *);
95void packet_send_ignore(int); 95void ssh_packet_set_server(struct ssh *);
96void packet_add_padding(u_char); 96void ssh_packet_set_authenticated(struct ssh *);
97
98int ssh_packet_send1(struct ssh *);
99int ssh_packet_send2_wrapped(struct ssh *);
100int ssh_packet_send2(struct ssh *);
101
102int ssh_packet_read(struct ssh *);
103int ssh_packet_read_expect(struct ssh *, u_int type);
104int ssh_packet_read_poll(struct ssh *);
105int ssh_packet_read_poll1(struct ssh *, u_char *);
106int ssh_packet_read_poll2(struct ssh *, u_char *, u_int32_t *seqnr_p);
107int ssh_packet_process_incoming(struct ssh *, const char *buf, u_int len);
108int ssh_packet_read_seqnr(struct ssh *, u_char *, u_int32_t *seqnr_p);
109int ssh_packet_read_poll_seqnr(struct ssh *, u_char *, u_int32_t *seqnr_p);
110
111const void *ssh_packet_get_string_ptr(struct ssh *, u_int *length_ptr);
112void ssh_packet_disconnect(struct ssh *, const char *fmt, ...)
113 __attribute__((format(printf, 2, 3)))
114 __attribute__((noreturn));
115void ssh_packet_send_debug(struct ssh *, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
116
117int ssh_set_newkeys(struct ssh *, int mode);
118void ssh_packet_get_bytes(struct ssh *, u_int64_t *, u_int64_t *);
119
120typedef void *(ssh_packet_comp_alloc_func)(void *, u_int, u_int);
121typedef void (ssh_packet_comp_free_func)(void *, void *);
122void ssh_packet_set_compress_hooks(struct ssh *, void *,
123 ssh_packet_comp_alloc_func *, ssh_packet_comp_free_func *);
124
125int ssh_packet_write_poll(struct ssh *);
126int ssh_packet_write_wait(struct ssh *);
127int ssh_packet_have_data_to_write(struct ssh *);
128int ssh_packet_not_very_much_data_to_write(struct ssh *);
129
130int ssh_packet_connection_is_on_socket(struct ssh *);
131int ssh_packet_remaining(struct ssh *);
132void ssh_packet_send_ignore(struct ssh *, int);
97 133
98void tty_make_modes(int, struct termios *); 134void tty_make_modes(int, struct termios *);
99void tty_parse_modes(int, int *); 135void tty_parse_modes(int, int *);
100 136
101void packet_set_alive_timeouts(int); 137void ssh_packet_set_alive_timeouts(struct ssh *, int);
102int packet_inc_alive_timeouts(void); 138int ssh_packet_inc_alive_timeouts(struct ssh *);
103int packet_set_maxsize(u_int); 139int ssh_packet_set_maxsize(struct ssh *, u_int);
104u_int packet_get_maxsize(void); 140u_int ssh_packet_get_maxsize(struct ssh *);
105 141
106/* don't allow remaining bytes after the end of the message */ 142int ssh_packet_get_state(struct ssh *, struct sshbuf *);
107#define packet_check_eom() \ 143int ssh_packet_set_state(struct ssh *, struct sshbuf *);
108do { \ 144
109 int _len = packet_remaining(); \ 145const char *ssh_remote_ipaddr(struct ssh *);
110 if (_len > 0) { \ 146
111 logit("Packet integrity error (%d bytes remaining) at %s:%d", \ 147int ssh_packet_need_rekeying(struct ssh *);
112 _len ,__FILE__, __LINE__); \ 148void ssh_packet_set_rekey_limits(struct ssh *, u_int32_t, time_t);
113 packet_disconnect("Packet integrity error."); \ 149time_t ssh_packet_get_rekey_timeout(struct ssh *);
114 } \ 150
115} while (0) 151/* XXX FIXME */
116 152void ssh_packet_backup_state(struct ssh *, struct ssh *);
117int packet_need_rekeying(void); 153void ssh_packet_restore_state(struct ssh *, struct ssh *);
118void packet_set_rekey_limits(u_int32_t, time_t); 154
119time_t packet_get_rekey_timeout(void); 155void *ssh_packet_get_input(struct ssh *);
120 156void *ssh_packet_get_output(struct ssh *);
121void packet_backup_state(void); 157
122void packet_restore_state(void); 158/* new API */
123void packet_set_postauth(void); 159int sshpkt_start(struct ssh *ssh, u_char type);
124 160int sshpkt_send(struct ssh *ssh);
125void *packet_get_input(void); 161int sshpkt_disconnect(struct ssh *, const char *fmt, ...)
126void *packet_get_output(void); 162 __attribute__((format(printf, 2, 3)));
163int sshpkt_add_padding(struct ssh *, u_char);
164void sshpkt_fatal(struct ssh *ssh, const char *tag, int r);
165
166int sshpkt_put(struct ssh *ssh, const void *v, size_t len);
167int sshpkt_putb(struct ssh *ssh, const struct sshbuf *b);
168int sshpkt_put_u8(struct ssh *ssh, u_char val);
169int sshpkt_put_u32(struct ssh *ssh, u_int32_t val);
170int sshpkt_put_u64(struct ssh *ssh, u_int64_t val);
171int sshpkt_put_string(struct ssh *ssh, const void *v, size_t len);
172int sshpkt_put_cstring(struct ssh *ssh, const void *v);
173int sshpkt_put_stringb(struct ssh *ssh, const struct sshbuf *v);
174int sshpkt_put_ec(struct ssh *ssh, const EC_POINT *v, const EC_GROUP *g);
175int sshpkt_put_bignum1(struct ssh *ssh, const BIGNUM *v);
176int sshpkt_put_bignum2(struct ssh *ssh, const BIGNUM *v);
177
178int sshpkt_get(struct ssh *ssh, void *valp, size_t len);
179int sshpkt_get_u8(struct ssh *ssh, u_char *valp);
180int sshpkt_get_u32(struct ssh *ssh, u_int32_t *valp);
181int sshpkt_get_u64(struct ssh *ssh, u_int64_t *valp);
182int sshpkt_get_string(struct ssh *ssh, u_char **valp, size_t *lenp);
183int sshpkt_get_string_direct(struct ssh *ssh, const u_char **valp, size_t *lenp);
184int sshpkt_get_cstring(struct ssh *ssh, char **valp, size_t *lenp);
185int sshpkt_get_ec(struct ssh *ssh, EC_POINT *v, const EC_GROUP *g);
186int sshpkt_get_bignum1(struct ssh *ssh, BIGNUM *v);
187int sshpkt_get_bignum2(struct ssh *ssh, BIGNUM *v);
188int sshpkt_get_end(struct ssh *ssh);
189const u_char *sshpkt_ptr(struct ssh *, size_t *lenp);
190
191/* OLD API */
192extern struct ssh *active_state;
193#include "opacket.h"
194
195#if !defined(WITH_OPENSSL)
196# undef BIGNUM
197# undef EC_KEY
198# undef EC_GROUP
199# undef EC_POINT
200#elif !defined(OPENSSL_HAS_ECC)
201# undef EC_KEY
202# undef EC_GROUP
203# undef EC_POINT
204#endif
127 205
128#endif /* PACKET_H */ 206#endif /* PACKET_H */
diff --git a/progressmeter.c b/progressmeter.c
index bbbc7066b..319b7470a 100644
--- a/progressmeter.c
+++ b/progressmeter.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: progressmeter.c,v 1.40 2013/09/19 00:24:52 djm Exp $ */ 1/* $OpenBSD: progressmeter.c,v 1.41 2015/01/14 13:54:13 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2003 Nils Nordman. All rights reserved. 3 * Copyright (c) 2003 Nils Nordman. All rights reserved.
4 * 4 *
@@ -65,7 +65,7 @@ static void update_progress_meter(int);
65 65
66static time_t start; /* start progress */ 66static time_t start; /* start progress */
67static time_t last_update; /* last progress update */ 67static time_t last_update; /* last progress update */
68static char *file; /* name of the file being transferred */ 68static const char *file; /* name of the file being transferred */
69static off_t start_pos; /* initial position of transfer */ 69static off_t start_pos; /* initial position of transfer */
70static off_t end_pos; /* ending position of transfer */ 70static off_t end_pos; /* ending position of transfer */
71static off_t cur_pos; /* transfer position as of last refresh */ 71static off_t cur_pos; /* transfer position as of last refresh */
@@ -248,7 +248,7 @@ update_progress_meter(int ignore)
248} 248}
249 249
250void 250void
251start_progress_meter(char *f, off_t filesize, off_t *ctr) 251start_progress_meter(const char *f, off_t filesize, off_t *ctr)
252{ 252{
253 start = last_update = monotime(); 253 start = last_update = monotime();
254 file = f; 254 file = f;
diff --git a/progressmeter.h b/progressmeter.h
index 10bab99ba..bf179dca6 100644
--- a/progressmeter.h
+++ b/progressmeter.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: progressmeter.h,v 1.2 2006/03/25 22:22:43 djm Exp $ */ 1/* $OpenBSD: progressmeter.h,v 1.3 2015/01/14 13:54:13 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2002 Nils Nordman. All rights reserved. 3 * Copyright (c) 2002 Nils Nordman. All rights reserved.
4 * 4 *
@@ -23,5 +23,5 @@
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26void start_progress_meter(char *, off_t, off_t *); 26void start_progress_meter(const char *, off_t, off_t *);
27void stop_progress_meter(void); 27void stop_progress_meter(void);
diff --git a/readconf.c b/readconf.c
index 7948ce1cd..42a2961fa 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.220 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: readconf.c,v 1.232 2015/02/16 22:13:32 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -28,6 +28,7 @@
28#include <ctype.h> 28#include <ctype.h>
29#include <errno.h> 29#include <errno.h>
30#include <fcntl.h> 30#include <fcntl.h>
31#include <limits.h>
31#include <netdb.h> 32#include <netdb.h>
32#ifdef HAVE_PATHS_H 33#ifdef HAVE_PATHS_H
33# include <paths.h> 34# include <paths.h>
@@ -41,6 +42,9 @@
41#ifdef HAVE_UTIL_H 42#ifdef HAVE_UTIL_H
42#include <util.h> 43#include <util.h>
43#endif 44#endif
45#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS)
46# include <vis.h>
47#endif
44 48
45#include "xmalloc.h" 49#include "xmalloc.h"
46#include "ssh.h" 50#include "ssh.h"
@@ -48,14 +52,15 @@
48#include "cipher.h" 52#include "cipher.h"
49#include "pathnames.h" 53#include "pathnames.h"
50#include "log.h" 54#include "log.h"
51#include "key.h" 55#include "sshkey.h"
52#include "misc.h" 56#include "misc.h"
53#include "readconf.h" 57#include "readconf.h"
54#include "match.h" 58#include "match.h"
55#include "buffer.h"
56#include "kex.h" 59#include "kex.h"
57#include "mac.h" 60#include "mac.h"
58#include "uidswap.h" 61#include "uidswap.h"
62#include "myproposal.h"
63#include "digest.h"
59 64
60/* Format of the configuration file: 65/* Format of the configuration file:
61 66
@@ -135,7 +140,7 @@ typedef enum {
135 oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression, 140 oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression,
136 oCompressionLevel, oTCPKeepAlive, oNumberOfPasswordPrompts, 141 oCompressionLevel, oTCPKeepAlive, oNumberOfPasswordPrompts,
137 oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oMacs, 142 oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oMacs,
138 oGlobalKnownHostsFile2, oUserKnownHostsFile2, oPubkeyAuthentication, 143 oPubkeyAuthentication,
139 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias, 144 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias,
140 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication, 145 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication,
141 oHostKeyAlgorithms, oBindAddress, oPKCS11Provider, 146 oHostKeyAlgorithms, oBindAddress, oPKCS11Provider,
@@ -150,7 +155,8 @@ typedef enum {
150 oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass, 155 oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass,
151 oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots, 156 oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots,
152 oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs, 157 oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs,
153 oStreamLocalBindMask, oStreamLocalBindUnlink, 158 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
159 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
154 oIgnoredUnknownOption, oDeprecated, oUnsupported 160 oIgnoredUnknownOption, oDeprecated, oUnsupported
155} OpCodes; 161} OpCodes;
156 162
@@ -212,7 +218,7 @@ static struct {
212 { "globalknownhostsfile", oGlobalKnownHostsFile }, 218 { "globalknownhostsfile", oGlobalKnownHostsFile },
213 { "globalknownhostsfile2", oDeprecated }, 219 { "globalknownhostsfile2", oDeprecated },
214 { "userknownhostsfile", oUserKnownHostsFile }, 220 { "userknownhostsfile", oUserKnownHostsFile },
215 { "userknownhostsfile2", oDeprecated }, 221 { "userknownhostsfile2", oDeprecated },
216 { "connectionattempts", oConnectionAttempts }, 222 { "connectionattempts", oConnectionAttempts },
217 { "batchmode", oBatchMode }, 223 { "batchmode", oBatchMode },
218 { "checkhostip", oCheckHostIP }, 224 { "checkhostip", oCheckHostIP },
@@ -265,6 +271,10 @@ static struct {
265 { "canonicalizepermittedcnames", oCanonicalizePermittedCNAMEs }, 271 { "canonicalizepermittedcnames", oCanonicalizePermittedCNAMEs },
266 { "streamlocalbindmask", oStreamLocalBindMask }, 272 { "streamlocalbindmask", oStreamLocalBindMask },
267 { "streamlocalbindunlink", oStreamLocalBindUnlink }, 273 { "streamlocalbindunlink", oStreamLocalBindUnlink },
274 { "revokedhostkeys", oRevokedHostKeys },
275 { "fingerprinthash", oFingerprintHash },
276 { "updatehostkeys", oUpdateHostkeys },
277 { "hostbasedkeytypes", oHostbasedKeyTypes },
268 { "ignoreunknown", oIgnoreUnknown }, 278 { "ignoreunknown", oIgnoreUnknown },
269 279
270 { NULL, oBadOption } 280 { NULL, oBadOption }
@@ -466,7 +476,7 @@ execute_in_shell(const char *cmd)
466 if (!WIFEXITED(status)) { 476 if (!WIFEXITED(status)) {
467 error("command '%.100s' exited abnormally", cmd); 477 error("command '%.100s' exited abnormally", cmd);
468 return -1; 478 return -1;
469 } 479 }
470 debug3("command returned status %d", WEXITSTATUS(status)); 480 debug3("command returned status %d", WEXITSTATUS(status));
471 return WEXITSTATUS(status); 481 return WEXITSTATUS(status);
472} 482}
@@ -476,11 +486,12 @@ execute_in_shell(const char *cmd)
476 */ 486 */
477static int 487static int
478match_cfg_line(Options *options, char **condition, struct passwd *pw, 488match_cfg_line(Options *options, char **condition, struct passwd *pw,
479 const char *host_arg, const char *filename, int linenum) 489 const char *host_arg, const char *original_host, int post_canon,
490 const char *filename, int linenum)
480{ 491{
481 char *arg, *attrib, *cmd, *cp = *condition, *host; 492 char *arg, *oattrib, *attrib, *cmd, *cp = *condition, *host, *criteria;
482 const char *ruser; 493 const char *ruser;
483 int r, port, result = 1, attributes = 0; 494 int r, port, this_result, result = 1, attributes = 0, negate;
484 size_t len; 495 size_t len;
485 char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; 496 char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV];
486 497
@@ -497,21 +508,38 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw,
497 } else 508 } else
498 host = xstrdup(host_arg); 509 host = xstrdup(host_arg);
499 510
500 debug3("checking match for '%s' host %s", cp, host); 511 debug2("checking match for '%s' host %s originally %s",
501 while ((attrib = strdelim(&cp)) && *attrib != '\0') { 512 cp, host, original_host);
502 attributes++; 513 while ((oattrib = attrib = strdelim(&cp)) && *attrib != '\0') {
514 criteria = NULL;
515 this_result = 1;
516 if ((negate = attrib[0] == '!'))
517 attrib++;
518 /* criteria "all" and "canonical" have no argument */
503 if (strcasecmp(attrib, "all") == 0) { 519 if (strcasecmp(attrib, "all") == 0) {
504 if (attributes != 1 || 520 if (attributes > 1 ||
505 ((arg = strdelim(&cp)) != NULL && *arg != '\0')) { 521 ((arg = strdelim(&cp)) != NULL && *arg != '\0')) {
506 error("'all' cannot be combined with other " 522 error("%.200s line %d: '%s' cannot be combined "
507 "Match attributes"); 523 "with other Match attributes",
524 filename, linenum, oattrib);
508 result = -1; 525 result = -1;
509 goto out; 526 goto out;
510 } 527 }
511 *condition = cp; 528 if (result)
512 result = 1; 529 result = negate ? 0 : 1;
513 goto out; 530 goto out;
514 } 531 }
532 attributes++;
533 if (strcasecmp(attrib, "canonical") == 0) {
534 r = !!post_canon; /* force bitmask member to boolean */
535 if (r == (negate ? 1 : 0))
536 this_result = result = 0;
537 debug3("%.200s line %d: %smatched '%s'",
538 filename, linenum,
539 this_result ? "" : "not ", oattrib);
540 continue;
541 }
542 /* All other criteria require an argument */
515 if ((arg = strdelim(&cp)) == NULL || *arg == '\0') { 543 if ((arg = strdelim(&cp)) == NULL || *arg == '\0') {
516 error("Missing Match criteria for %s", attrib); 544 error("Missing Match criteria for %s", attrib);
517 result = -1; 545 result = -1;
@@ -519,31 +547,25 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw,
519 } 547 }
520 len = strlen(arg); 548 len = strlen(arg);
521 if (strcasecmp(attrib, "host") == 0) { 549 if (strcasecmp(attrib, "host") == 0) {
522 if (match_hostname(host, arg, len) != 1) 550 criteria = xstrdup(host);
523 result = 0; 551 r = match_hostname(host, arg, len) == 1;
524 else 552 if (r == (negate ? 1 : 0))
525 debug("%.200s line %d: matched 'Host %.100s' ", 553 this_result = result = 0;
526 filename, linenum, host);
527 } else if (strcasecmp(attrib, "originalhost") == 0) { 554 } else if (strcasecmp(attrib, "originalhost") == 0) {
528 if (match_hostname(host_arg, arg, len) != 1) 555 criteria = xstrdup(original_host);
529 result = 0; 556 r = match_hostname(original_host, arg, len) == 1;
530 else 557 if (r == (negate ? 1 : 0))
531 debug("%.200s line %d: matched " 558 this_result = result = 0;
532 "'OriginalHost %.100s' ",
533 filename, linenum, host_arg);
534 } else if (strcasecmp(attrib, "user") == 0) { 559 } else if (strcasecmp(attrib, "user") == 0) {
535 if (match_pattern_list(ruser, arg, len, 0) != 1) 560 criteria = xstrdup(ruser);
536 result = 0; 561 r = match_pattern_list(ruser, arg, len, 0) == 1;
537 else 562 if (r == (negate ? 1 : 0))
538 debug("%.200s line %d: matched 'User %.100s' ", 563 this_result = result = 0;
539 filename, linenum, ruser);
540 } else if (strcasecmp(attrib, "localuser") == 0) { 564 } else if (strcasecmp(attrib, "localuser") == 0) {
541 if (match_pattern_list(pw->pw_name, arg, len, 0) != 1) 565 criteria = xstrdup(pw->pw_name);
542 result = 0; 566 r = match_pattern_list(pw->pw_name, arg, len, 0) == 1;
543 else 567 if (r == (negate ? 1 : 0))
544 debug("%.200s line %d: matched " 568 this_result = result = 0;
545 "'LocalUser %.100s' ",
546 filename, linenum, pw->pw_name);
547 } else if (strcasecmp(attrib, "exec") == 0) { 569 } else if (strcasecmp(attrib, "exec") == 0) {
548 if (gethostname(thishost, sizeof(thishost)) == -1) 570 if (gethostname(thishost, sizeof(thishost)) == -1)
549 fatal("gethostname: %s", strerror(errno)); 571 fatal("gethostname: %s", strerror(errno));
@@ -556,47 +578,49 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw,
556 "d", pw->pw_dir, 578 "d", pw->pw_dir,
557 "h", host, 579 "h", host,
558 "l", thishost, 580 "l", thishost,
559 "n", host_arg, 581 "n", original_host,
560 "p", portstr, 582 "p", portstr,
561 "r", ruser, 583 "r", ruser,
562 "u", pw->pw_name, 584 "u", pw->pw_name,
563 (char *)NULL); 585 (char *)NULL);
564 if (result != 1) { 586 if (result != 1) {
565 /* skip execution if prior predicate failed */ 587 /* skip execution if prior predicate failed */
566 debug("%.200s line %d: skipped exec \"%.100s\"", 588 debug3("%.200s line %d: skipped exec "
567 filename, linenum, cmd); 589 "\"%.100s\"", filename, linenum, cmd);
568 } else { 590 free(cmd);
569 r = execute_in_shell(cmd); 591 continue;
570 if (r == -1) {
571 fatal("%.200s line %d: match exec "
572 "'%.100s' error", filename,
573 linenum, cmd);
574 } else if (r == 0) {
575 debug("%.200s line %d: matched "
576 "'exec \"%.100s\"'", filename,
577 linenum, cmd);
578 } else {
579 debug("%.200s line %d: no match "
580 "'exec \"%.100s\"'", filename,
581 linenum, cmd);
582 result = 0;
583 }
584 } 592 }
593 r = execute_in_shell(cmd);
594 if (r == -1) {
595 fatal("%.200s line %d: match exec "
596 "'%.100s' error", filename,
597 linenum, cmd);
598 }
599 criteria = xstrdup(cmd);
585 free(cmd); 600 free(cmd);
601 /* Force exit status to boolean */
602 r = r == 0;
603 if (r == (negate ? 1 : 0))
604 this_result = result = 0;
586 } else { 605 } else {
587 error("Unsupported Match attribute %s", attrib); 606 error("Unsupported Match attribute %s", attrib);
588 result = -1; 607 result = -1;
589 goto out; 608 goto out;
590 } 609 }
610 debug3("%.200s line %d: %smatched '%s \"%.100s\"' ",
611 filename, linenum, this_result ? "": "not ",
612 oattrib, criteria);
613 free(criteria);
591 } 614 }
592 if (attributes == 0) { 615 if (attributes == 0) {
593 error("One or more attributes required for Match"); 616 error("One or more attributes required for Match");
594 result = -1; 617 result = -1;
595 goto out; 618 goto out;
596 } 619 }
597 debug3("match %sfound", result ? "" : "not ");
598 *condition = cp;
599 out: 620 out:
621 if (result != -1)
622 debug2("match %sfound", result ? "" : "not ");
623 *condition = cp;
600 free(host); 624 free(host);
601 return result; 625 return result;
602} 626}
@@ -719,7 +743,8 @@ static const struct multistate multistate_canonicalizehostname[] = {
719#define WHITESPACE " \t\r\n" 743#define WHITESPACE " \t\r\n"
720int 744int
721process_config_line(Options *options, struct passwd *pw, const char *host, 745process_config_line(Options *options, struct passwd *pw, const char *host,
722 char *line, const char *filename, int linenum, int *activep, int userconfig) 746 const char *original_host, char *line, const char *filename,
747 int linenum, int *activep, int flags)
723{ 748{
724 char *s, **charptr, *endofnumber, *keyword, *arg, *arg2; 749 char *s, **charptr, *endofnumber, *keyword, *arg, *arg2;
725 char **cpptr, fwdarg[256]; 750 char **cpptr, fwdarg[256];
@@ -775,7 +800,9 @@ parse_time:
775 if (!arg || *arg == '\0') 800 if (!arg || *arg == '\0')
776 fatal("%s line %d: missing time value.", 801 fatal("%s line %d: missing time value.",
777 filename, linenum); 802 filename, linenum);
778 if ((value = convtime(arg)) == -1) 803 if (strcmp(arg, "none") == 0)
804 value = -1;
805 else if ((value = convtime(arg)) == -1)
779 fatal("%s line %d: invalid time value.", 806 fatal("%s line %d: invalid time value.",
780 filename, linenum); 807 filename, linenum);
781 if (*activep && *intptr == -1) 808 if (*activep && *intptr == -1)
@@ -812,7 +839,7 @@ parse_time:
812 case oForwardX11Trusted: 839 case oForwardX11Trusted:
813 intptr = &options->forward_x11_trusted; 840 intptr = &options->forward_x11_trusted;
814 goto parse_flag; 841 goto parse_flag;
815 842
816 case oForwardX11Timeout: 843 case oForwardX11Timeout:
817 intptr = &options->forward_x11_timeout; 844 intptr = &options->forward_x11_timeout;
818 goto parse_time; 845 goto parse_time;
@@ -947,7 +974,8 @@ parse_time:
947 if (*intptr >= SSH_MAX_IDENTITY_FILES) 974 if (*intptr >= SSH_MAX_IDENTITY_FILES)
948 fatal("%.200s line %d: Too many identity files specified (max %d).", 975 fatal("%.200s line %d: Too many identity files specified (max %d).",
949 filename, linenum, SSH_MAX_IDENTITY_FILES); 976 filename, linenum, SSH_MAX_IDENTITY_FILES);
950 add_identity_file(options, NULL, arg, userconfig); 977 add_identity_file(options, NULL,
978 arg, flags & SSHCONF_USERCONF);
951 } 979 }
952 break; 980 break;
953 981
@@ -1090,7 +1118,7 @@ parse_int:
1090 arg = strdelim(&s); 1118 arg = strdelim(&s);
1091 if (!arg || *arg == '\0') 1119 if (!arg || *arg == '\0')
1092 fatal("%.200s line %d: Missing argument.", filename, linenum); 1120 fatal("%.200s line %d: Missing argument.", filename, linenum);
1093 if (!key_names_valid2(arg)) 1121 if (!sshkey_names_valid2(arg, 1))
1094 fatal("%.200s line %d: Bad protocol 2 host key algorithms '%s'.", 1122 fatal("%.200s line %d: Bad protocol 2 host key algorithms '%s'.",
1095 filename, linenum, arg ? arg : "<NONE>"); 1123 filename, linenum, arg ? arg : "<NONE>");
1096 if (*activep && options->hostkeyalgorithms == NULL) 1124 if (*activep && options->hostkeyalgorithms == NULL)
@@ -1195,8 +1223,8 @@ parse_int:
1195 if (cmdline) 1223 if (cmdline)
1196 fatal("Host directive not supported as a command-line " 1224 fatal("Host directive not supported as a command-line "
1197 "option"); 1225 "option");
1198 value = match_cfg_line(options, &s, pw, host, 1226 value = match_cfg_line(options, &s, pw, host, original_host,
1199 filename, linenum); 1227 flags & SSHCONF_POSTCANON, filename, linenum);
1200 if (value < 0) 1228 if (value < 0)
1201 fatal("%.200s line %d: Bad Match condition", filename, 1229 fatal("%.200s line %d: Bad Match condition", filename,
1202 linenum); 1230 linenum);
@@ -1433,6 +1461,41 @@ parse_int:
1433 intptr = &options->fwd_opts.streamlocal_bind_unlink; 1461 intptr = &options->fwd_opts.streamlocal_bind_unlink;
1434 goto parse_flag; 1462 goto parse_flag;
1435 1463
1464 case oRevokedHostKeys:
1465 charptr = &options->revoked_host_keys;
1466 goto parse_string;
1467
1468 case oFingerprintHash:
1469 intptr = &options->fingerprint_hash;
1470 arg = strdelim(&s);
1471 if (!arg || *arg == '\0')
1472 fatal("%.200s line %d: Missing argument.",
1473 filename, linenum);
1474 if ((value = ssh_digest_alg_by_name(arg)) == -1)
1475 fatal("%.200s line %d: Invalid hash algorithm \"%s\".",
1476 filename, linenum, arg);
1477 if (*activep && *intptr == -1)
1478 *intptr = value;
1479 break;
1480
1481 case oUpdateHostkeys:
1482 intptr = &options->update_hostkeys;
1483 multistate_ptr = multistate_yesnoask;
1484 goto parse_multistate;
1485
1486 case oHostbasedKeyTypes:
1487 charptr = &options->hostbased_key_types;
1488 arg = strdelim(&s);
1489 if (!arg || *arg == '\0')
1490 fatal("%.200s line %d: Missing argument.",
1491 filename, linenum);
1492 if (!sshkey_names_valid2(arg, 1))
1493 fatal("%s line %d: Bad key types '%s'.",
1494 filename, linenum, arg ? arg : "<NONE>");
1495 if (*activep && *charptr == NULL)
1496 *charptr = xstrdup(arg);
1497 break;
1498
1436 case oDeprecated: 1499 case oDeprecated:
1437 debug("%s line %d: Deprecated option \"%s\"", 1500 debug("%s line %d: Deprecated option \"%s\"",
1438 filename, linenum, keyword); 1501 filename, linenum, keyword);
@@ -1444,7 +1507,7 @@ parse_int:
1444 return 0; 1507 return 0;
1445 1508
1446 default: 1509 default:
1447 fatal("process_config_line: Unimplemented opcode %d", opcode); 1510 fatal("%s: Unimplemented opcode %d", __func__, opcode);
1448 } 1511 }
1449 1512
1450 /* Check that there is no garbage at end of line. */ 1513 /* Check that there is no garbage at end of line. */
@@ -1464,7 +1527,7 @@ parse_int:
1464 1527
1465int 1528int
1466read_config_file(const char *filename, struct passwd *pw, const char *host, 1529read_config_file(const char *filename, struct passwd *pw, const char *host,
1467 Options *options, int flags) 1530 const char *original_host, Options *options, int flags)
1468{ 1531{
1469 FILE *f; 1532 FILE *f;
1470 char line[1024]; 1533 char line[1024];
@@ -1495,8 +1558,8 @@ read_config_file(const char *filename, struct passwd *pw, const char *host,
1495 while (fgets(line, sizeof(line), f)) { 1558 while (fgets(line, sizeof(line), f)) {
1496 /* Update line number counter. */ 1559 /* Update line number counter. */
1497 linenum++; 1560 linenum++;
1498 if (process_config_line(options, pw, host, line, filename, 1561 if (process_config_line(options, pw, host, original_host,
1499 linenum, &active, flags & SSHCONF_USERCONF) != 0) 1562 line, filename, linenum, &active, flags) != 0)
1500 bad_options++; 1563 bad_options++;
1501 } 1564 }
1502 fclose(f); 1565 fclose(f);
@@ -1609,6 +1672,10 @@ initialize_options(Options * options)
1609 options->canonicalize_max_dots = -1; 1672 options->canonicalize_max_dots = -1;
1610 options->canonicalize_fallback_local = -1; 1673 options->canonicalize_fallback_local = -1;
1611 options->canonicalize_hostname = -1; 1674 options->canonicalize_hostname = -1;
1675 options->revoked_host_keys = NULL;
1676 options->fingerprint_hash = -1;
1677 options->update_hostkeys = -1;
1678 options->hostbased_key_types = NULL;
1612} 1679}
1613 1680
1614/* 1681/*
@@ -1786,6 +1853,13 @@ fill_default_options(Options * options)
1786 options->canonicalize_fallback_local = 1; 1853 options->canonicalize_fallback_local = 1;
1787 if (options->canonicalize_hostname == -1) 1854 if (options->canonicalize_hostname == -1)
1788 options->canonicalize_hostname = SSH_CANONICALISE_NO; 1855 options->canonicalize_hostname = SSH_CANONICALISE_NO;
1856 if (options->fingerprint_hash == -1)
1857 options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
1858 if (options->update_hostkeys == -1)
1859 options->update_hostkeys = 0;
1860 if (options->hostbased_key_types == NULL)
1861 options->hostbased_key_types = xstrdup("*");
1862
1789#define CLEAR_ON_NONE(v) \ 1863#define CLEAR_ON_NONE(v) \
1790 do { \ 1864 do { \
1791 if (option_clear_or_none(v)) { \ 1865 if (option_clear_or_none(v)) { \
@@ -1796,6 +1870,7 @@ fill_default_options(Options * options)
1796 CLEAR_ON_NONE(options->local_command); 1870 CLEAR_ON_NONE(options->local_command);
1797 CLEAR_ON_NONE(options->proxy_command); 1871 CLEAR_ON_NONE(options->proxy_command);
1798 CLEAR_ON_NONE(options->control_path); 1872 CLEAR_ON_NONE(options->control_path);
1873 CLEAR_ON_NONE(options->revoked_host_keys);
1799 /* options->user will be set in the main program if appropriate */ 1874 /* options->user will be set in the main program if appropriate */
1800 /* options->hostname will be set in the main program if appropriate */ 1875 /* options->hostname will be set in the main program if appropriate */
1801 /* options->host_key_alias should not be set by default */ 1876 /* options->host_key_alias should not be set by default */
@@ -2009,3 +2084,303 @@ parse_forward(struct Forward *fwd, const char *fwdspec, int dynamicfwd, int remo
2009 fwd->listen_path = NULL; 2084 fwd->listen_path = NULL;
2010 return (0); 2085 return (0);
2011} 2086}
2087
2088/* XXX the following is a near-vebatim copy from servconf.c; refactor */
2089static const char *
2090fmt_multistate_int(int val, const struct multistate *m)
2091{
2092 u_int i;
2093
2094 for (i = 0; m[i].key != NULL; i++) {
2095 if (m[i].value == val)
2096 return m[i].key;
2097 }
2098 return "UNKNOWN";
2099}
2100
2101static const char *
2102fmt_intarg(OpCodes code, int val)
2103{
2104 if (val == -1)
2105 return "unset";
2106 switch (code) {
2107 case oAddressFamily:
2108 return fmt_multistate_int(val, multistate_addressfamily);
2109 case oVerifyHostKeyDNS:
2110 case oStrictHostKeyChecking:
2111 case oUpdateHostkeys:
2112 return fmt_multistate_int(val, multistate_yesnoask);
2113 case oControlMaster:
2114 return fmt_multistate_int(val, multistate_controlmaster);
2115 case oTunnel:
2116 return fmt_multistate_int(val, multistate_tunnel);
2117 case oRequestTTY:
2118 return fmt_multistate_int(val, multistate_requesttty);
2119 case oCanonicalizeHostname:
2120 return fmt_multistate_int(val, multistate_canonicalizehostname);
2121 case oFingerprintHash:
2122 return ssh_digest_alg_name(val);
2123 case oProtocol:
2124 switch (val) {
2125 case SSH_PROTO_1:
2126 return "1";
2127 case SSH_PROTO_2:
2128 return "2";
2129 case (SSH_PROTO_1|SSH_PROTO_2):
2130 return "2,1";
2131 default:
2132 return "UNKNOWN";
2133 }
2134 default:
2135 switch (val) {
2136 case 0:
2137 return "no";
2138 case 1:
2139 return "yes";
2140 default:
2141 return "UNKNOWN";
2142 }
2143 }
2144}
2145
2146static const char *
2147lookup_opcode_name(OpCodes code)
2148{
2149 u_int i;
2150
2151 for (i = 0; keywords[i].name != NULL; i++)
2152 if (keywords[i].opcode == code)
2153 return(keywords[i].name);
2154 return "UNKNOWN";
2155}
2156
2157static void
2158dump_cfg_int(OpCodes code, int val)
2159{
2160 printf("%s %d\n", lookup_opcode_name(code), val);
2161}
2162
2163static void
2164dump_cfg_fmtint(OpCodes code, int val)
2165{
2166 printf("%s %s\n", lookup_opcode_name(code), fmt_intarg(code, val));
2167}
2168
2169static void
2170dump_cfg_string(OpCodes code, const char *val)
2171{
2172 if (val == NULL)
2173 return;
2174 printf("%s %s\n", lookup_opcode_name(code), val);
2175}
2176
2177static void
2178dump_cfg_strarray(OpCodes code, u_int count, char **vals)
2179{
2180 u_int i;
2181
2182 for (i = 0; i < count; i++)
2183 printf("%s %s\n", lookup_opcode_name(code), vals[i]);
2184}
2185
2186static void
2187dump_cfg_strarray_oneline(OpCodes code, u_int count, char **vals)
2188{
2189 u_int i;
2190
2191 printf("%s", lookup_opcode_name(code));
2192 for (i = 0; i < count; i++)
2193 printf(" %s", vals[i]);
2194 printf("\n");
2195}
2196
2197static void
2198dump_cfg_forwards(OpCodes code, u_int count, const struct Forward *fwds)
2199{
2200 const struct Forward *fwd;
2201 u_int i;
2202
2203 /* oDynamicForward */
2204 for (i = 0; i < count; i++) {
2205 fwd = &fwds[i];
2206 if (code == oDynamicForward &&
2207 strcmp(fwd->connect_host, "socks") != 0)
2208 continue;
2209 if (code == oLocalForward &&
2210 strcmp(fwd->connect_host, "socks") == 0)
2211 continue;
2212 printf("%s", lookup_opcode_name(code));
2213 if (fwd->listen_port == PORT_STREAMLOCAL)
2214 printf(" %s", fwd->listen_path);
2215 else if (fwd->listen_host == NULL)
2216 printf(" %d", fwd->listen_port);
2217 else {
2218 printf(" [%s]:%d",
2219 fwd->listen_host, fwd->listen_port);
2220 }
2221 if (code != oDynamicForward) {
2222 if (fwd->connect_port == PORT_STREAMLOCAL)
2223 printf(" %s", fwd->connect_path);
2224 else if (fwd->connect_host == NULL)
2225 printf(" %d", fwd->connect_port);
2226 else {
2227 printf(" [%s]:%d",
2228 fwd->connect_host, fwd->connect_port);
2229 }
2230 }
2231 printf("\n");
2232 }
2233}
2234
2235void
2236dump_client_config(Options *o, const char *host)
2237{
2238 int i;
2239 char vbuf[5];
2240
2241 /* Most interesting options first: user, host, port */
2242 dump_cfg_string(oUser, o->user);
2243 dump_cfg_string(oHostName, host);
2244 dump_cfg_int(oPort, o->port);
2245
2246 /* Flag options */
2247 dump_cfg_fmtint(oAddressFamily, o->address_family);
2248 dump_cfg_fmtint(oBatchMode, o->batch_mode);
2249 dump_cfg_fmtint(oCanonicalizeFallbackLocal, o->canonicalize_fallback_local);
2250 dump_cfg_fmtint(oCanonicalizeHostname, o->canonicalize_hostname);
2251 dump_cfg_fmtint(oChallengeResponseAuthentication, o->challenge_response_authentication);
2252 dump_cfg_fmtint(oCheckHostIP, o->check_host_ip);
2253 dump_cfg_fmtint(oCompression, o->compression);
2254 dump_cfg_fmtint(oControlMaster, o->control_master);
2255 dump_cfg_fmtint(oEnableSSHKeysign, o->enable_ssh_keysign);
2256 dump_cfg_fmtint(oExitOnForwardFailure, o->exit_on_forward_failure);
2257 dump_cfg_fmtint(oFingerprintHash, o->fingerprint_hash);
2258 dump_cfg_fmtint(oForwardAgent, o->forward_agent);
2259 dump_cfg_fmtint(oForwardX11, o->forward_x11);
2260 dump_cfg_fmtint(oForwardX11Trusted, o->forward_x11_trusted);
2261 dump_cfg_fmtint(oGatewayPorts, o->fwd_opts.gateway_ports);
2262#ifdef GSSAPI
2263 dump_cfg_fmtint(oGssAuthentication, o->gss_authentication);
2264 dump_cfg_fmtint(oGssDelegateCreds, o->gss_deleg_creds);
2265#endif /* GSSAPI */
2266 dump_cfg_fmtint(oHashKnownHosts, o->hash_known_hosts);
2267 dump_cfg_fmtint(oHostbasedAuthentication, o->hostbased_authentication);
2268 dump_cfg_fmtint(oIdentitiesOnly, o->identities_only);
2269 dump_cfg_fmtint(oKbdInteractiveAuthentication, o->kbd_interactive_authentication);
2270 dump_cfg_fmtint(oNoHostAuthenticationForLocalhost, o->no_host_authentication_for_localhost);
2271 dump_cfg_fmtint(oPasswordAuthentication, o->password_authentication);
2272 dump_cfg_fmtint(oPermitLocalCommand, o->permit_local_command);
2273 dump_cfg_fmtint(oProtocol, o->protocol);
2274 dump_cfg_fmtint(oProxyUseFdpass, o->proxy_use_fdpass);
2275 dump_cfg_fmtint(oPubkeyAuthentication, o->pubkey_authentication);
2276 dump_cfg_fmtint(oRequestTTY, o->request_tty);
2277 dump_cfg_fmtint(oRhostsRSAAuthentication, o->rhosts_rsa_authentication);
2278 dump_cfg_fmtint(oRSAAuthentication, o->rsa_authentication);
2279 dump_cfg_fmtint(oStreamLocalBindUnlink, o->fwd_opts.streamlocal_bind_unlink);
2280 dump_cfg_fmtint(oStrictHostKeyChecking, o->strict_host_key_checking);
2281 dump_cfg_fmtint(oTCPKeepAlive, o->tcp_keep_alive);
2282 dump_cfg_fmtint(oTunnel, o->tun_open);
2283 dump_cfg_fmtint(oUsePrivilegedPort, o->use_privileged_port);
2284 dump_cfg_fmtint(oVerifyHostKeyDNS, o->verify_host_key_dns);
2285 dump_cfg_fmtint(oVisualHostKey, o->visual_host_key);
2286 dump_cfg_fmtint(oUpdateHostkeys, o->update_hostkeys);
2287
2288 /* Integer options */
2289 dump_cfg_int(oCanonicalizeMaxDots, o->canonicalize_max_dots);
2290 dump_cfg_int(oCompressionLevel, o->compression_level);
2291 dump_cfg_int(oConnectionAttempts, o->connection_attempts);
2292 dump_cfg_int(oForwardX11Timeout, o->forward_x11_timeout);
2293 dump_cfg_int(oNumberOfPasswordPrompts, o->number_of_password_prompts);
2294 dump_cfg_int(oServerAliveCountMax, o->server_alive_count_max);
2295 dump_cfg_int(oServerAliveInterval, o->server_alive_interval);
2296
2297 /* String options */
2298 dump_cfg_string(oBindAddress, o->bind_address);
2299 dump_cfg_string(oCiphers, o->ciphers ? o->ciphers : KEX_CLIENT_ENCRYPT);
2300 dump_cfg_string(oControlPath, o->control_path);
2301 dump_cfg_string(oHostKeyAlgorithms, o->hostkeyalgorithms ? o->hostkeyalgorithms : KEX_DEFAULT_PK_ALG);
2302 dump_cfg_string(oHostKeyAlias, o->host_key_alias);
2303 dump_cfg_string(oHostbasedKeyTypes, o->hostbased_key_types);
2304 dump_cfg_string(oKbdInteractiveDevices, o->kbd_interactive_devices);
2305 dump_cfg_string(oKexAlgorithms, o->kex_algorithms ? o->kex_algorithms : KEX_CLIENT_KEX);
2306 dump_cfg_string(oLocalCommand, o->local_command);
2307 dump_cfg_string(oLogLevel, log_level_name(o->log_level));
2308 dump_cfg_string(oMacs, o->macs ? o->macs : KEX_CLIENT_MAC);
2309 dump_cfg_string(oPKCS11Provider, o->pkcs11_provider);
2310 dump_cfg_string(oPreferredAuthentications, o->preferred_authentications);
2311 dump_cfg_string(oProxyCommand, o->proxy_command);
2312 dump_cfg_string(oRevokedHostKeys, o->revoked_host_keys);
2313 dump_cfg_string(oXAuthLocation, o->xauth_location);
2314
2315 /* Forwards */
2316 dump_cfg_forwards(oDynamicForward, o->num_local_forwards, o->local_forwards);
2317 dump_cfg_forwards(oLocalForward, o->num_local_forwards, o->local_forwards);
2318 dump_cfg_forwards(oRemoteForward, o->num_remote_forwards, o->remote_forwards);
2319
2320 /* String array options */
2321 dump_cfg_strarray(oIdentityFile, o->num_identity_files, o->identity_files);
2322 dump_cfg_strarray_oneline(oCanonicalDomains, o->num_canonical_domains, o->canonical_domains);
2323 dump_cfg_strarray_oneline(oGlobalKnownHostsFile, o->num_system_hostfiles, o->system_hostfiles);
2324 dump_cfg_strarray_oneline(oUserKnownHostsFile, o->num_user_hostfiles, o->user_hostfiles);
2325 dump_cfg_strarray(oSendEnv, o->num_send_env, o->send_env);
2326
2327 /* Special cases */
2328
2329 /* oConnectTimeout */
2330 if (o->connection_timeout == -1)
2331 printf("connecttimeout none\n");
2332 else
2333 dump_cfg_int(oConnectTimeout, o->connection_timeout);
2334
2335 /* oTunnelDevice */
2336 printf("tunneldevice");
2337 if (o->tun_local == SSH_TUNID_ANY)
2338 printf(" any");
2339 else
2340 printf(" %d", o->tun_local);
2341 if (o->tun_remote == SSH_TUNID_ANY)
2342 printf(":any");
2343 else
2344 printf(":%d", o->tun_remote);
2345 printf("\n");
2346
2347 /* oCanonicalizePermittedCNAMEs */
2348 if ( o->num_permitted_cnames > 0) {
2349 printf("canonicalizePermittedcnames");
2350 for (i = 0; i < o->num_permitted_cnames; i++) {
2351 printf(" %s:%s", o->permitted_cnames[i].source_list,
2352 o->permitted_cnames[i].target_list);
2353 }
2354 printf("\n");
2355 }
2356
2357 /* oCipher */
2358 if (o->cipher != SSH_CIPHER_NOT_SET)
2359 printf("Cipher %s\n", cipher_name(o->cipher));
2360
2361 /* oControlPersist */
2362 if (o->control_persist == 0 || o->control_persist_timeout == 0)
2363 dump_cfg_fmtint(oControlPersist, o->control_persist);
2364 else
2365 dump_cfg_int(oControlPersist, o->control_persist_timeout);
2366
2367 /* oEscapeChar */
2368 if (o->escape_char == SSH_ESCAPECHAR_NONE)
2369 printf("escapechar none\n");
2370 else {
2371 vis(vbuf, o->escape_char, VIS_WHITE, 0);
2372 printf("escapechar %s\n", vbuf);
2373 }
2374
2375 /* oIPQoS */
2376 printf("ipqos %s ", iptos2str(o->ip_qos_interactive));
2377 printf("%s\n", iptos2str(o->ip_qos_bulk));
2378
2379 /* oRekeyLimit */
2380 printf("rekeylimit %lld %d\n",
2381 (long long)o->rekey_limit, o->rekey_interval);
2382
2383 /* oStreamLocalBindMask */
2384 printf("streamlocalbindmask 0%o\n",
2385 o->fwd_opts.streamlocal_bind_mask);
2386}
diff --git a/readconf.h b/readconf.h
index 0b9cb777a..576b9e352 100644
--- a/readconf.h
+++ b/readconf.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.h,v 1.102 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: readconf.h,v 1.109 2015/02/16 22:13:32 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -93,7 +93,7 @@ typedef struct {
93 int num_identity_files; /* Number of files for RSA/DSA identities. */ 93 int num_identity_files; /* Number of files for RSA/DSA identities. */
94 char *identity_files[SSH_MAX_IDENTITY_FILES]; 94 char *identity_files[SSH_MAX_IDENTITY_FILES];
95 int identity_file_userprovided[SSH_MAX_IDENTITY_FILES]; 95 int identity_file_userprovided[SSH_MAX_IDENTITY_FILES];
96 Key *identity_keys[SSH_MAX_IDENTITY_FILES]; 96 struct sshkey *identity_keys[SSH_MAX_IDENTITY_FILES];
97 97
98 /* Local TCP/IP forward requests. */ 98 /* Local TCP/IP forward requests. */
99 int num_local_forwards; 99 int num_local_forwards;
@@ -144,6 +144,14 @@ typedef struct {
144 int num_permitted_cnames; 144 int num_permitted_cnames;
145 struct allowed_cname permitted_cnames[MAX_CANON_DOMAINS]; 145 struct allowed_cname permitted_cnames[MAX_CANON_DOMAINS];
146 146
147 char *revoked_host_keys;
148
149 int fingerprint_hash;
150
151 int update_hostkeys; /* one of SSH_UPDATE_HOSTKEYS_* */
152
153 char *hostbased_key_types;
154
147 char *ignored_unknown; /* Pattern list of unknown tokens to ignore */ 155 char *ignored_unknown; /* Pattern list of unknown tokens to ignore */
148} Options; 156} Options;
149 157
@@ -164,17 +172,23 @@ typedef struct {
164 172
165#define SSHCONF_CHECKPERM 1 /* check permissions on config file */ 173#define SSHCONF_CHECKPERM 1 /* check permissions on config file */
166#define SSHCONF_USERCONF 2 /* user provided config file not system */ 174#define SSHCONF_USERCONF 2 /* user provided config file not system */
175#define SSHCONF_POSTCANON 4 /* After hostname canonicalisation */
176
177#define SSH_UPDATE_HOSTKEYS_NO 0
178#define SSH_UPDATE_HOSTKEYS_YES 1
179#define SSH_UPDATE_HOSTKEYS_ASK 2
167 180
168void initialize_options(Options *); 181void initialize_options(Options *);
169void fill_default_options(Options *); 182void fill_default_options(Options *);
170void fill_default_options_for_canonicalization(Options *); 183void fill_default_options_for_canonicalization(Options *);
171int process_config_line(Options *, struct passwd *, const char *, char *, 184int process_config_line(Options *, struct passwd *, const char *,
172 const char *, int, int *, int); 185 const char *, char *, const char *, int, int *, int);
173int read_config_file(const char *, struct passwd *, const char *, 186int read_config_file(const char *, struct passwd *, const char *,
174 Options *, int); 187 const char *, Options *, int);
175int parse_forward(struct Forward *, const char *, int, int); 188int parse_forward(struct Forward *, const char *, int, int);
176int default_ssh_port(void); 189int default_ssh_port(void);
177int option_clear_or_none(const char *); 190int option_clear_or_none(const char *);
191void dump_client_config(Options *o, const char *host);
178 192
179void add_local_forward(Options *, const struct Forward *); 193void add_local_forward(Options *, const struct Forward *);
180void add_remote_forward(Options *, const struct Forward *); 194void add_remote_forward(Options *, const struct Forward *);
diff --git a/regress/.cvsignore b/regress/.cvsignore
new file mode 100644
index 000000000..3fd25b02e
--- /dev/null
+++ b/regress/.cvsignore
@@ -0,0 +1,31 @@
1*-agent
2*.copy
3*.log
4*.prv
5*.pub
6actual
7authorized_keys_*
8batch
9copy.dd*
10data
11expect
12host.rsa*
13key.*
14known_hosts
15krl-*
16modpipe
17remote_pid
18revoked-*
19revoked-ca
20revoked-keyid
21revoked-serials
22rsa
23rsa1
24sftp-server.sh
25ssh-log-wrapper.sh
26ssh_config
27ssh_proxy*
28sshd_config
29sshd_proxy*
30t*.out
31t*.out[0-9]
diff --git a/regress/Makefile b/regress/Makefile
index 3feb7a997..99a7d60f5 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,11 +1,14 @@
1# $OpenBSD: Makefile,v 1.70 2014/06/24 01:14:17 djm Exp $ 1# $OpenBSD: Makefile,v 1.78 2015/01/26 06:12:18 djm Exp $
2 2
3REGRESS_TARGETS= unit t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t-exec 3REGRESS_TARGETS= unit t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t-exec
4tests: $(REGRESS_TARGETS) 4tests: prep $(REGRESS_TARGETS)
5 5
6# Interop tests are not run by default 6# Interop tests are not run by default
7interop interop-tests: t-exec-interop 7interop interop-tests: t-exec-interop
8 8
9prep:
10 test "x${USE_VALGRIND}" = "x" || mkdir -p $(OBJ)/valgrind-out
11
9clean: 12clean:
10 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done 13 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
11 test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN} 14 test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN}
@@ -64,7 +67,14 @@ LTESTS= connect \
64 keys-command \ 67 keys-command \
65 forward-control \ 68 forward-control \
66 integrity \ 69 integrity \
67 krl 70 krl \
71 multipubkey \
72 limit-keytype \
73 hostkey-agent \
74 keygen-knownhosts \
75 hostkey-rotate
76
77
68# dhgex \ 78# dhgex \
69 79
70INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers 80INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
@@ -75,6 +85,7 @@ INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
75USER!= id -un 85USER!= id -un
76CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ 86CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
77 t8.out t8.out.pub t9.out t9.out.pub t10.out t10.out.pub \ 87 t8.out t8.out.pub t9.out t9.out.pub t10.out t10.out.pub \
88 t12.out t12.out.pub \
78 authorized_keys_${USER} known_hosts pidfile testdata \ 89 authorized_keys_${USER} known_hosts pidfile testdata \
79 ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \ 90 ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \
80 rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \ 91 rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
@@ -91,7 +102,8 @@ CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
91 regress.log failed-regress.log ssh-log-wrapper.sh \ 102 regress.log failed-regress.log ssh-log-wrapper.sh \
92 sftp-server.sh sftp-server.log sftp.log setuid-allowed \ 103 sftp-server.sh sftp-server.log sftp.log setuid-allowed \
93 data ed25519-agent ed25519-agent.pub key.ed25519-512 \ 104 data ed25519-agent ed25519-agent.pub key.ed25519-512 \
94 key.ed25519-512.pub 105 key.ed25519-512.pub netcat host_krl_* host_revoked_* \
106 kh.* user_*key* agent-key.* known_hosts.* hkr.*
95 107
96SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER} 108SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER}
97 109
@@ -119,7 +131,7 @@ t3:
119 ${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub 131 ${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub
120 132
121t4: 133t4:
122 ${TEST_SSH_SSHKEYGEN} -lf ${.CURDIR}/rsa_openssh.pub |\ 134 ${TEST_SSH_SSHKEYGEN} -E md5 -lf ${.CURDIR}/rsa_openssh.pub |\
123 awk '{print $$2}' | diff - ${.CURDIR}/t4.ok 135 awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
124 136
125t5: 137t5:
@@ -164,6 +176,16 @@ t10: $(OBJ)/t10.out
164 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t10.out > /dev/null 176 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t10.out > /dev/null
165 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t10.out > /dev/null 177 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t10.out > /dev/null
166 178
179t11:
180 ${TEST_SSH_SSHKEYGEN} -E sha256 -lf ${.CURDIR}/rsa_openssh.pub |\
181 awk '{print $$2}' | diff - ${.CURDIR}/t11.ok
182
183t12.out:
184 ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -C 'test-comment-1234' -f $(OBJ)/$@
185
186t12: t12.out
187 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t12.out.pub | grep test-comment-1234 >/dev/null
188
167t-exec: ${LTESTS:=.sh} 189t-exec: ${LTESTS:=.sh}
168 @if [ "x$?" = "x" ]; then exit 0; fi; \ 190 @if [ "x$?" = "x" ]; then exit 0; fi; \
169 for TEST in ""$?; do \ 191 for TEST in ""$?; do \
@@ -184,7 +206,14 @@ interop: ${INTEROP_TARGETS}
184# Unit tests, built by top-level Makefile 206# Unit tests, built by top-level Makefile
185unit: 207unit:
186 set -e ; if test -z "${SKIP_UNIT}" ; then \ 208 set -e ; if test -z "${SKIP_UNIT}" ; then \
187 ${.OBJDIR}/unittests/sshbuf/test_sshbuf ; \ 209 V="" ; \
188 ${.OBJDIR}/unittests/sshkey/test_sshkey \ 210 test "x${USE_VALGRIND}" = "x" || \
189 -d ${.CURDIR}//unittests/sshkey/testdata ; \ 211 V=${.CURDIR}/valgrind-unit.sh ; \
212 $$V ${.OBJDIR}/unittests/sshbuf/test_sshbuf ; \
213 $$V ${.OBJDIR}/unittests/sshkey/test_sshkey \
214 -d ${.CURDIR}/unittests/sshkey/testdata ; \
215 $$V ${.OBJDIR}/unittests/bitmap/test_bitmap ; \
216 $$V ${.OBJDIR}/unittests/kex/test_kex ; \
217 $$V ${.OBJDIR}/unittests/hostkeys/test_hostkeys \
218 -d ${.CURDIR}/unittests/hostkeys/testdata ; \
190 fi 219 fi
diff --git a/regress/agent-pkcs11.sh b/regress/agent-pkcs11.sh
index db33ab37e..3aa20c8b1 100644
--- a/regress/agent-pkcs11.sh
+++ b/regress/agent-pkcs11.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: agent-pkcs11.sh,v 1.1 2010/02/08 10:52:47 markus Exp $ 1# $OpenBSD: agent-pkcs11.sh,v 1.2 2015/01/12 11:46:32 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="pkcs11 agent test" 4tid="pkcs11 agent test"
@@ -6,6 +6,8 @@ tid="pkcs11 agent test"
6TEST_SSH_PIN="" 6TEST_SSH_PIN=""
7TEST_SSH_PKCS11=/usr/local/lib/soft-pkcs11.so.0.0 7TEST_SSH_PKCS11=/usr/local/lib/soft-pkcs11.so.0.0
8 8
9test -f "$TEST_SSH_PKCS11" || fatal "$TEST_SSH_PKCS11 does not exist"
10
9# setup environment for soft-pkcs11 token 11# setup environment for soft-pkcs11 token
10SOFTPKCS11RC=$OBJ/pkcs11.info 12SOFTPKCS11RC=$OBJ/pkcs11.info
11export SOFTPKCS11RC 13export SOFTPKCS11RC
diff --git a/regress/agent-timeout.sh b/regress/agent-timeout.sh
index 68826594e..9598c2032 100644
--- a/regress/agent-timeout.sh
+++ b/regress/agent-timeout.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: agent-timeout.sh,v 1.2 2013/05/17 01:16:09 dtucker Exp $ 1# $OpenBSD: agent-timeout.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="agent timeout test" 4tid="agent timeout test"
@@ -12,7 +12,7 @@ if [ $r -ne 0 ]; then
12 fail "could not start ssh-agent: exit code $r" 12 fail "could not start ssh-agent: exit code $r"
13else 13else
14 trace "add keys with timeout" 14 trace "add keys with timeout"
15 for t in rsa rsa1; do 15 for t in ${SSH_KEYTYPES}; do
16 ${SSHADD} -t ${SSHAGENT_TIMEOUT} $OBJ/$t > /dev/null 2>&1 16 ${SSHADD} -t ${SSHAGENT_TIMEOUT} $OBJ/$t > /dev/null 2>&1
17 if [ $? -ne 0 ]; then 17 if [ $? -ne 0 ]; then
18 fail "ssh-add did succeed exit code 0" 18 fail "ssh-add did succeed exit code 0"
diff --git a/regress/agent.sh b/regress/agent.sh
index caad3c88e..c5e2794b7 100644
--- a/regress/agent.sh
+++ b/regress/agent.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: agent.sh,v 1.10 2014/02/27 21:21:25 djm Exp $ 1# $OpenBSD: agent.sh,v 1.11 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="simple agent test" 4tid="simple agent test"
@@ -20,7 +20,7 @@ else
20 fi 20 fi
21 trace "overwrite authorized keys" 21 trace "overwrite authorized keys"
22 printf '' > $OBJ/authorized_keys_$USER 22 printf '' > $OBJ/authorized_keys_$USER
23 for t in ed25519 rsa rsa1; do 23 for t in ${SSH_KEYTYPES}; do
24 # generate user key for agent 24 # generate user key for agent
25 rm -f $OBJ/$t-agent 25 rm -f $OBJ/$t-agent
26 ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t-agent ||\ 26 ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t-agent ||\
@@ -46,7 +46,7 @@ else
46 fi 46 fi
47 47
48 trace "simple connect via agent" 48 trace "simple connect via agent"
49 for p in 1 2; do 49 for p in ${SSH_PROTOCOLS}; do
50 ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p 50 ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p
51 r=$? 51 r=$?
52 if [ $r -ne 5$p ]; then 52 if [ $r -ne 5$p ]; then
@@ -55,7 +55,7 @@ else
55 done 55 done
56 56
57 trace "agent forwarding" 57 trace "agent forwarding"
58 for p in 1 2; do 58 for p in ${SSH_PROTOCOLS}; do
59 ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1 59 ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1
60 r=$? 60 r=$?
61 if [ $r -ne 0 ]; then 61 if [ $r -ne 0 ]; then
diff --git a/regress/broken-pipe.sh b/regress/broken-pipe.sh
index c08c849a7..a416f7a3b 100644
--- a/regress/broken-pipe.sh
+++ b/regress/broken-pipe.sh
@@ -1,9 +1,9 @@
1# $OpenBSD: broken-pipe.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ 1# $OpenBSD: broken-pipe.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="broken pipe test" 4tid="broken pipe test"
5 5
6for p in 1 2; do 6for p in ${SSH_PROTOCOLS}; do
7 trace "protocol $p" 7 trace "protocol $p"
8 for i in 1 2 3 4; do 8 for i in 1 2 3 4; do
9 ${SSH} -$p -F $OBJ/ssh_config_config nexthost echo $i 2> /dev/null | true 9 ${SSH} -$p -F $OBJ/ssh_config_config nexthost echo $i 2> /dev/null | true
diff --git a/regress/cert-hostkey.sh b/regress/cert-hostkey.sh
index 1d9e0ed8e..51685dc2b 100644
--- a/regress/cert-hostkey.sh
+++ b/regress/cert-hostkey.sh
@@ -1,21 +1,29 @@
1# $OpenBSD: cert-hostkey.sh,v 1.9 2014/01/26 10:22:10 djm Exp $ 1# $OpenBSD: cert-hostkey.sh,v 1.11 2015/01/19 06:01:32 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="certified host keys" 4tid="certified host keys"
5 5
6rm -f $OBJ/known_hosts-cert $OBJ/host_ca_key* $OBJ/cert_host_key* 6rm -f $OBJ/known_hosts-cert* $OBJ/host_ca_key* $OBJ/host_revoked_*
7rm -f $OBJ/cert_host_key* $OBJ/host_krl_*
7cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak 8cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
8 9
9HOSTS='localhost-with-alias,127.0.0.1,::1' 10HOSTS='localhost-with-alias,127.0.0.1,::1'
10 11
11# Create a CA key and add it to known hosts 12# Create a CA key and add it to known hosts. Ed25519 chosed for speed.
12${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/host_ca_key ||\ 13${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/host_ca_key ||\
13 fail "ssh-keygen of host_ca_key failed" 14 fail "ssh-keygen of host_ca_key failed"
14( 15(
15 printf '@cert-authority ' 16 printf '@cert-authority '
16 printf "$HOSTS " 17 printf "$HOSTS "
17 cat $OBJ/host_ca_key.pub 18 cat $OBJ/host_ca_key.pub
18) > $OBJ/known_hosts-cert 19) > $OBJ/known_hosts-cert.orig
20cp $OBJ/known_hosts-cert.orig $OBJ/known_hosts-cert
21
22# Plain text revocation files
23touch $OBJ/host_revoked_empty
24touch $OBJ/host_revoked_plain
25touch $OBJ/host_revoked_cert
26cp $OBJ/host_ca_key.pub $OBJ/host_revoked_ca
19 27
20PLAIN_TYPES=`$SSH -Q key-plain | sed 's/^ssh-dss/ssh-dsa/g;s/^ssh-//'` 28PLAIN_TYPES=`$SSH -Q key-plain | sed 's/^ssh-dss/ssh-dsa/g;s/^ssh-//'`
21 29
@@ -26,17 +34,33 @@ type_has_legacy() {
26 return 0 34 return 0
27} 35}
28 36
37# Prepare certificate, plain key and CA KRLs
38${SSHKEYGEN} -kf $OBJ/host_krl_empty || fatal "KRL init failed"
39${SSHKEYGEN} -kf $OBJ/host_krl_plain || fatal "KRL init failed"
40${SSHKEYGEN} -kf $OBJ/host_krl_cert || fatal "KRL init failed"
41${SSHKEYGEN} -kf $OBJ/host_krl_ca $OBJ/host_ca_key.pub \
42 || fatal "KRL init failed"
43
29# Generate and sign host keys 44# Generate and sign host keys
45serial=1
30for ktype in $PLAIN_TYPES ; do 46for ktype in $PLAIN_TYPES ; do
31 verbose "$tid: sign host ${ktype} cert" 47 verbose "$tid: sign host ${ktype} cert"
32 # Generate and sign a host key 48 # Generate and sign a host key
33 ${SSHKEYGEN} -q -N '' -t ${ktype} \ 49 ${SSHKEYGEN} -q -N '' -t ${ktype} \
34 -f $OBJ/cert_host_key_${ktype} || \ 50 -f $OBJ/cert_host_key_${ktype} || \
35 fail "ssh-keygen of cert_host_key_${ktype} failed" 51 fatal "ssh-keygen of cert_host_key_${ktype} failed"
36 ${SSHKEYGEN} -h -q -s $OBJ/host_ca_key \ 52 ${SSHKEYGEN} -ukf $OBJ/host_krl_plain \
53 $OBJ/cert_host_key_${ktype}.pub || fatal "KRL update failed"
54 cat $OBJ/cert_host_key_${ktype}.pub >> $OBJ/host_revoked_plain
55 ${SSHKEYGEN} -h -q -s $OBJ/host_ca_key -z $serial \
37 -I "regress host key for $USER" \ 56 -I "regress host key for $USER" \
38 -n $HOSTS $OBJ/cert_host_key_${ktype} || 57 -n $HOSTS $OBJ/cert_host_key_${ktype} ||
39 fail "couldn't sign cert_host_key_${ktype}" 58 fatal "couldn't sign cert_host_key_${ktype}"
59 ${SSHKEYGEN} -ukf $OBJ/host_krl_cert \
60 $OBJ/cert_host_key_${ktype}-cert.pub || \
61 fatal "KRL update failed"
62 cat $OBJ/cert_host_key_${ktype}-cert.pub >> $OBJ/host_revoked_cert
63 serial=`expr $serial + 1`
40 type_has_legacy $ktype || continue 64 type_has_legacy $ktype || continue
41 cp $OBJ/cert_host_key_${ktype} $OBJ/cert_host_key_${ktype}_v00 65 cp $OBJ/cert_host_key_${ktype} $OBJ/cert_host_key_${ktype}_v00
42 cp $OBJ/cert_host_key_${ktype}.pub $OBJ/cert_host_key_${ktype}_v00.pub 66 cp $OBJ/cert_host_key_${ktype}.pub $OBJ/cert_host_key_${ktype}_v00.pub
@@ -44,10 +68,35 @@ for ktype in $PLAIN_TYPES ; do
44 ${SSHKEYGEN} -t v00 -h -q -s $OBJ/host_ca_key \ 68 ${SSHKEYGEN} -t v00 -h -q -s $OBJ/host_ca_key \
45 -I "regress host key for $USER" \ 69 -I "regress host key for $USER" \
46 -n $HOSTS $OBJ/cert_host_key_${ktype}_v00 || 70 -n $HOSTS $OBJ/cert_host_key_${ktype}_v00 ||
47 fail "couldn't sign cert_host_key_${ktype}_v00" 71 fatal "couldn't sign cert_host_key_${ktype}_v00"
72 ${SSHKEYGEN} -ukf $OBJ/host_krl_cert \
73 $OBJ/cert_host_key_${ktype}_v00-cert.pub || \
74 fatal "KRL update failed"
75 cat $OBJ/cert_host_key_${ktype}_v00-cert.pub >> $OBJ/host_revoked_cert
48done 76done
49 77
50# Basic connect tests 78attempt_connect() {
79 _ident="$1"
80 _expect_success="$2"
81 shift; shift
82 verbose "$tid: $_ident expect success $_expect_success"
83 cp $OBJ/known_hosts-cert.orig $OBJ/known_hosts-cert
84 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
85 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
86 "$@" -F $OBJ/ssh_proxy somehost true
87 _r=$?
88 if [ "x$_expect_success" = "xyes" ] ; then
89 if [ $_r -ne 0 ]; then
90 fail "ssh cert connect $_ident failed"
91 fi
92 else
93 if [ $_r -eq 0 ]; then
94 fail "ssh cert connect $_ident succeeded unexpectedly"
95 fi
96 fi
97}
98
99# Basic connect and revocation tests.
51for privsep in yes no ; do 100for privsep in yes no ; do
52 for ktype in $PLAIN_TYPES rsa_v00 dsa_v00; do 101 for ktype in $PLAIN_TYPES rsa_v00 dsa_v00; do
53 verbose "$tid: host ${ktype} cert connect privsep $privsep" 102 verbose "$tid: host ${ktype} cert connect privsep $privsep"
@@ -58,12 +107,24 @@ for privsep in yes no ; do
58 echo UsePrivilegeSeparation $privsep 107 echo UsePrivilegeSeparation $privsep
59 ) > $OBJ/sshd_proxy 108 ) > $OBJ/sshd_proxy
60 109
61 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \ 110 # test name expect success
62 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \ 111 attempt_connect "$ktype basic connect" "yes"
63 -F $OBJ/ssh_proxy somehost true 112 attempt_connect "$ktype empty KRL" "yes" \
64 if [ $? -ne 0 ]; then 113 -oRevokedHostKeys=$OBJ/host_krl_empty
65 fail "ssh cert connect failed" 114 attempt_connect "$ktype KRL w/ plain key revoked" "no" \
66 fi 115 -oRevokedHostKeys=$OBJ/host_krl_plain
116 attempt_connect "$ktype KRL w/ cert revoked" "no" \
117 -oRevokedHostKeys=$OBJ/host_krl_cert
118 attempt_connect "$ktype KRL w/ CA revoked" "no" \
119 -oRevokedHostKeys=$OBJ/host_krl_ca
120 attempt_connect "$ktype empty plaintext revocation" "yes" \
121 -oRevokedHostKeys=$OBJ/host_revoked_empty
122 attempt_connect "$ktype plain key plaintext revocation" "no" \
123 -oRevokedHostKeys=$OBJ/host_revoked_plain
124 attempt_connect "$ktype cert plaintext revocation" "no" \
125 -oRevokedHostKeys=$OBJ/host_revoked_cert
126 attempt_connect "$ktype CA plaintext revocation" "no" \
127 -oRevokedHostKeys=$OBJ/host_revoked_ca
67 done 128 done
68done 129done
69 130
@@ -76,7 +137,8 @@ done
76 test -f "$OBJ/cert_host_key_${ktype}.pub" || fatal "no pubkey" 137 test -f "$OBJ/cert_host_key_${ktype}.pub" || fatal "no pubkey"
77 printf "@revoked * `cat $OBJ/cert_host_key_${ktype}.pub`\n" 138 printf "@revoked * `cat $OBJ/cert_host_key_${ktype}.pub`\n"
78 done 139 done
79) > $OBJ/known_hosts-cert 140) > $OBJ/known_hosts-cert.orig
141cp $OBJ/known_hosts-cert.orig $OBJ/known_hosts-cert
80for privsep in yes no ; do 142for privsep in yes no ; do
81 for ktype in $PLAIN_TYPES rsa_v00 dsa_v00; do 143 for ktype in $PLAIN_TYPES rsa_v00 dsa_v00; do
82 verbose "$tid: host ${ktype} revoked cert privsep $privsep" 144 verbose "$tid: host ${ktype} revoked cert privsep $privsep"
@@ -87,6 +149,7 @@ for privsep in yes no ; do
87 echo UsePrivilegeSeparation $privsep 149 echo UsePrivilegeSeparation $privsep
88 ) > $OBJ/sshd_proxy 150 ) > $OBJ/sshd_proxy
89 151
152 cp $OBJ/known_hosts-cert.orig $OBJ/known_hosts-cert
90 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \ 153 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
91 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \ 154 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
92 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1 155 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1
@@ -104,7 +167,8 @@ done
104 printf '@revoked ' 167 printf '@revoked '
105 printf "* " 168 printf "* "
106 cat $OBJ/host_ca_key.pub 169 cat $OBJ/host_ca_key.pub
107) > $OBJ/known_hosts-cert 170) > $OBJ/known_hosts-cert.orig
171cp $OBJ/known_hosts-cert.orig $OBJ/known_hosts-cert
108for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do 172for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do
109 verbose "$tid: host ${ktype} revoked cert" 173 verbose "$tid: host ${ktype} revoked cert"
110 ( 174 (
@@ -112,6 +176,7 @@ for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do
112 echo HostKey $OBJ/cert_host_key_${ktype} 176 echo HostKey $OBJ/cert_host_key_${ktype}
113 echo HostCertificate $OBJ/cert_host_key_${ktype}-cert.pub 177 echo HostCertificate $OBJ/cert_host_key_${ktype}-cert.pub
114 ) > $OBJ/sshd_proxy 178 ) > $OBJ/sshd_proxy
179 cp $OBJ/known_hosts-cert.orig $OBJ/known_hosts-cert
115 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \ 180 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
116 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \ 181 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
117 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1 182 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1
@@ -125,7 +190,8 @@ done
125 printf '@cert-authority ' 190 printf '@cert-authority '
126 printf "$HOSTS " 191 printf "$HOSTS "
127 cat $OBJ/host_ca_key.pub 192 cat $OBJ/host_ca_key.pub
128) > $OBJ/known_hosts-cert 193) > $OBJ/known_hosts-cert.orig
194cp $OBJ/known_hosts-cert.orig $OBJ/known_hosts-cert
129 195
130test_one() { 196test_one() {
131 ident=$1 197 ident=$1
@@ -150,6 +216,7 @@ test_one() {
150 echo HostCertificate $OBJ/cert_host_key_${kt}-cert.pub 216 echo HostCertificate $OBJ/cert_host_key_${kt}-cert.pub
151 ) > $OBJ/sshd_proxy 217 ) > $OBJ/sshd_proxy
152 218
219 cp $OBJ/known_hosts-cert.orig $OBJ/known_hosts-cert
153 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \ 220 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
154 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \ 221 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
155 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1 222 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1
@@ -212,7 +279,8 @@ done
212 printf '@cert-authority ' 279 printf '@cert-authority '
213 printf "$HOSTS " 280 printf "$HOSTS "
214 cat $OBJ/host_ca_key.pub 281 cat $OBJ/host_ca_key.pub
215) > $OBJ/known_hosts-cert 282) > $OBJ/known_hosts-cert.orig
283cp $OBJ/known_hosts-cert.orig $OBJ/known_hosts-cert
216for v in v01 v00 ; do 284for v in v01 v00 ; do
217 for kt in $PLAIN_TYPES ; do 285 for kt in $PLAIN_TYPES ; do
218 type_has_legacy $kt || continue 286 type_has_legacy $kt || continue
@@ -232,6 +300,7 @@ for v in v01 v00 ; do
232 echo HostCertificate $OBJ/cert_host_key_${kt}-cert.pub 300 echo HostCertificate $OBJ/cert_host_key_${kt}-cert.pub
233 ) > $OBJ/sshd_proxy 301 ) > $OBJ/sshd_proxy
234 302
303 cp $OBJ/known_hosts-cert.orig $OBJ/known_hosts-cert
235 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \ 304 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
236 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \ 305 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
237 -F $OBJ/ssh_proxy -q somehost true >/dev/null 2>&1 306 -F $OBJ/ssh_proxy -q somehost true >/dev/null 2>&1
@@ -241,4 +310,4 @@ for v in v01 v00 ; do
241 done 310 done
242done 311done
243 312
244rm -f $OBJ/known_hosts-cert $OBJ/host_ca_key* $OBJ/cert_host_key* 313rm -f $OBJ/known_hosts-cert* $OBJ/host_ca_key* $OBJ/cert_host_key*
diff --git a/regress/cfgmatch.sh b/regress/cfgmatch.sh
index 80cf22930..056296398 100644
--- a/regress/cfgmatch.sh
+++ b/regress/cfgmatch.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: cfgmatch.sh,v 1.8 2013/05/17 00:37:40 dtucker Exp $ 1# $OpenBSD: cfgmatch.sh,v 1.9 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sshd_config match" 4tid="sshd_config match"
@@ -56,7 +56,7 @@ start_sshd
56#set -x 56#set -x
57 57
58# Test Match + PermitOpen in sshd_config. This should be permitted 58# Test Match + PermitOpen in sshd_config. This should be permitted
59for p in 1 2; do 59for p in ${SSH_PROTOCOLS}; do
60 trace "match permitopen localhost proto $p" 60 trace "match permitopen localhost proto $p"
61 start_client -F $OBJ/ssh_config 61 start_client -F $OBJ/ssh_config
62 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \ 62 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \
@@ -65,7 +65,7 @@ for p in 1 2; do
65done 65done
66 66
67# Same but from different source. This should not be permitted 67# Same but from different source. This should not be permitted
68for p in 1 2; do 68for p in ${SSH_PROTOCOLS}; do
69 trace "match permitopen proxy proto $p" 69 trace "match permitopen proxy proto $p"
70 start_client -F $OBJ/ssh_proxy 70 start_client -F $OBJ/ssh_proxy
71 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \ 71 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \
@@ -74,11 +74,12 @@ for p in 1 2; do
74done 74done
75 75
76# Retry previous with key option, should also be denied. 76# Retry previous with key option, should also be denied.
77printf 'permitopen="127.0.0.1:'$PORT'" ' >$OBJ/authorized_keys_$USER 77cp /dev/null $OBJ/authorized_keys_$USER
78cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER 78for t in ${SSH_KEYTYPES}; do
79printf 'permitopen="127.0.0.1:'$PORT'" ' >>$OBJ/authorized_keys_$USER 79 printf 'permitopen="127.0.0.1:'$PORT'" ' >> $OBJ/authorized_keys_$USER
80cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER 80 cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER
81for p in 1 2; do 81done
82for p in ${SSH_PROTOCOLS}; do
82 trace "match permitopen proxy w/key opts proto $p" 83 trace "match permitopen proxy w/key opts proto $p"
83 start_client -F $OBJ/ssh_proxy 84 start_client -F $OBJ/ssh_proxy
84 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \ 85 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \
@@ -88,7 +89,7 @@ done
88 89
89# Test both sshd_config and key options permitting the same dst/port pair. 90# Test both sshd_config and key options permitting the same dst/port pair.
90# Should be permitted. 91# Should be permitted.
91for p in 1 2; do 92for p in ${SSH_PROTOCOLS}; do
92 trace "match permitopen localhost proto $p" 93 trace "match permitopen localhost proto $p"
93 start_client -F $OBJ/ssh_config 94 start_client -F $OBJ/ssh_config
94 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \ 95 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \
@@ -102,7 +103,7 @@ echo "Match User $USER" >>$OBJ/sshd_proxy
102echo "PermitOpen 127.0.0.1:1 127.0.0.1:2" >>$OBJ/sshd_proxy 103echo "PermitOpen 127.0.0.1:1 127.0.0.1:2" >>$OBJ/sshd_proxy
103 104
104# Test that a Match overrides a PermitOpen in the global section 105# Test that a Match overrides a PermitOpen in the global section
105for p in 1 2; do 106for p in ${SSH_PROTOCOLS}; do
106 trace "match permitopen proxy w/key opts proto $p" 107 trace "match permitopen proxy w/key opts proto $p"
107 start_client -F $OBJ/ssh_proxy 108 start_client -F $OBJ/ssh_proxy
108 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \ 109 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \
@@ -117,7 +118,7 @@ echo "PermitOpen 127.0.0.1:1 127.0.0.1:2" >>$OBJ/sshd_proxy
117 118
118# Test that a rule that doesn't match doesn't override, plus test a 119# Test that a rule that doesn't match doesn't override, plus test a
119# PermitOpen entry that's not at the start of the list 120# PermitOpen entry that's not at the start of the list
120for p in 1 2; do 121for p in ${SSH_PROTOCOLS}; do
121 trace "nomatch permitopen proxy w/key opts proto $p" 122 trace "nomatch permitopen proxy w/key opts proto $p"
122 start_client -F $OBJ/ssh_proxy 123 start_client -F $OBJ/ssh_proxy
123 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \ 124 ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \
diff --git a/regress/cipher-speed.sh b/regress/cipher-speed.sh
index a6d53a78d..ad2f9b90b 100644
--- a/regress/cipher-speed.sh
+++ b/regress/cipher-speed.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: cipher-speed.sh,v 1.11 2013/11/21 03:18:51 djm Exp $ 1# $OpenBSD: cipher-speed.sh,v 1.12 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="cipher speed" 4tid="cipher speed"
@@ -31,7 +31,11 @@ for c in `${SSH} -Q cipher`; do n=0; for m in `${SSH} -Q mac`; do
31 n=`expr $n + 1` 31 n=`expr $n + 1`
32done; done 32done; done
33 33
34ciphers="3des blowfish" 34if ssh_version 1; then
35 ciphers="3des blowfish"
36else
37 ciphers=""
38fi
35for c in $ciphers; do 39for c in $ciphers; do
36 trace "proto 1 cipher $c" 40 trace "proto 1 cipher $c"
37 for x in $tries; do 41 for x in $tries; do
diff --git a/regress/connect-privsep.sh b/regress/connect-privsep.sh
index 41cb7af69..9a51f5690 100644
--- a/regress/connect-privsep.sh
+++ b/regress/connect-privsep.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: connect-privsep.sh,v 1.5 2014/05/04 10:40:59 logan Exp $ 1# $OpenBSD: connect-privsep.sh,v 1.6 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="proxy connect with privsep" 4tid="proxy connect with privsep"
@@ -6,7 +6,7 @@ tid="proxy connect with privsep"
6cp $OBJ/sshd_proxy $OBJ/sshd_proxy.orig 6cp $OBJ/sshd_proxy $OBJ/sshd_proxy.orig
7echo 'UsePrivilegeSeparation yes' >> $OBJ/sshd_proxy 7echo 'UsePrivilegeSeparation yes' >> $OBJ/sshd_proxy
8 8
9for p in 1 2; do 9for p in ${SSH_PROTOCOLS}; do
10 ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true 10 ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true
11 if [ $? -ne 0 ]; then 11 if [ $? -ne 0 ]; then
12 fail "ssh privsep+proxyconnect protocol $p failed" 12 fail "ssh privsep+proxyconnect protocol $p failed"
@@ -16,7 +16,7 @@ done
16cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy 16cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
17echo 'UsePrivilegeSeparation sandbox' >> $OBJ/sshd_proxy 17echo 'UsePrivilegeSeparation sandbox' >> $OBJ/sshd_proxy
18 18
19for p in 1 2; do 19for p in ${SSH_PROTOCOLS}; do
20 ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true 20 ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true
21 if [ $? -ne 0 ]; then 21 if [ $? -ne 0 ]; then
22 # XXX replace this with fail once sandbox has stabilised 22 # XXX replace this with fail once sandbox has stabilised
@@ -27,7 +27,7 @@ done
27# Because sandbox is sensitive to changes in libc, especially malloc, retest 27# Because sandbox is sensitive to changes in libc, especially malloc, retest
28# with every malloc.conf option (and none). 28# with every malloc.conf option (and none).
29for m in '' A F G H J P R S X '<' '>'; do 29for m in '' A F G H J P R S X '<' '>'; do
30 for p in 1 2; do 30 for p in ${SSH_PROTOCOLS}; do
31 env MALLOC_OPTIONS="$m" ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true 31 env MALLOC_OPTIONS="$m" ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true
32 if [ $? -ne 0 ]; then 32 if [ $? -ne 0 ]; then
33 fail "ssh privsep/sandbox+proxyconnect protocol $p mopt '$m' failed" 33 fail "ssh privsep/sandbox+proxyconnect protocol $p mopt '$m' failed"
diff --git a/regress/connect.sh b/regress/connect.sh
index 2186fa6e7..f0d55d343 100644
--- a/regress/connect.sh
+++ b/regress/connect.sh
@@ -1,11 +1,11 @@
1# $OpenBSD: connect.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ 1# $OpenBSD: connect.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="simple connect" 4tid="simple connect"
5 5
6start_sshd 6start_sshd
7 7
8for p in 1 2; do 8for p in ${SSH_PROTOCOLS}; do
9 ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true 9 ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true
10 if [ $? -ne 0 ]; then 10 if [ $? -ne 0 ]; then
11 fail "ssh connect with protocol $p failed" 11 fail "ssh connect with protocol $p failed"
diff --git a/regress/dynamic-forward.sh b/regress/dynamic-forward.sh
index 42fa8acdc..dd67c9639 100644
--- a/regress/dynamic-forward.sh
+++ b/regress/dynamic-forward.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: dynamic-forward.sh,v 1.10 2013/05/17 04:29:14 dtucker Exp $ 1# $OpenBSD: dynamic-forward.sh,v 1.11 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="dynamic forwarding" 4tid="dynamic forwarding"
@@ -17,7 +17,7 @@ trace "will use ProxyCommand $proxycmd"
17 17
18start_sshd 18start_sshd
19 19
20for p in 1 2; do 20for p in ${SSH_PROTOCOLS}; do
21 n=0 21 n=0
22 error="1" 22 error="1"
23 trace "start dynamic forwarding, fork to background" 23 trace "start dynamic forwarding, fork to background"
diff --git a/regress/exit-status.sh b/regress/exit-status.sh
index 56b78a622..397d8d732 100644
--- a/regress/exit-status.sh
+++ b/regress/exit-status.sh
@@ -1,9 +1,9 @@
1# $OpenBSD: exit-status.sh,v 1.6 2002/03/15 13:08:56 markus Exp $ 1# $OpenBSD: exit-status.sh,v 1.7 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="remote exit status" 4tid="remote exit status"
5 5
6for p in 1 2; do 6for p in ${SSH_PROTOCOLS}; do
7 for s in 0 1 4 5 44; do 7 for s in 0 1 4 5 44; do
8 trace "proto $p status $s" 8 trace "proto $p status $s"
9 verbose "test $tid: proto $p status $s" 9 verbose "test $tid: proto $p status $s"
diff --git a/regress/forcecommand.sh b/regress/forcecommand.sh
index 44d2b7ffd..8a9b090ea 100644
--- a/regress/forcecommand.sh
+++ b/regress/forcecommand.sh
@@ -1,30 +1,32 @@
1# $OpenBSD: forcecommand.sh,v 1.2 2013/05/17 00:37:40 dtucker Exp $ 1# $OpenBSD: forcecommand.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="forced command" 4tid="forced command"
5 5
6cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak 6cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
7 7
8printf 'command="true" ' >$OBJ/authorized_keys_$USER 8cp /dev/null $OBJ/authorized_keys_$USER
9cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER 9for t in ${SSH_KEYTYPES}; do
10printf 'command="true" ' >>$OBJ/authorized_keys_$USER 10 printf 'command="true" ' >>$OBJ/authorized_keys_$USER
11cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER 11 cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER
12done
12 13
13for p in 1 2; do 14for p in ${SSH_PROTOCOLS}; do
14 trace "forced command in key option proto $p" 15 trace "forced command in key option proto $p"
15 ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ || 16 ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ ||
16 fail "forced command in key proto $p" 17 fail "forced command in key proto $p"
17done 18done
18 19
19printf 'command="false" ' >$OBJ/authorized_keys_$USER 20cp /dev/null $OBJ/authorized_keys_$USER
20cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER 21for t in ${SSH_KEYTYPES}; do
21printf 'command="false" ' >>$OBJ/authorized_keys_$USER 22 printf 'command="false" ' >> $OBJ/authorized_keys_$USER
22cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER 23 cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER
24done
23 25
24cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy 26cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
25echo "ForceCommand true" >> $OBJ/sshd_proxy 27echo "ForceCommand true" >> $OBJ/sshd_proxy
26 28
27for p in 1 2; do 29for p in ${SSH_PROTOCOLS}; do
28 trace "forced command in sshd_config overrides key option proto $p" 30 trace "forced command in sshd_config overrides key option proto $p"
29 ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ || 31 ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ ||
30 fail "forced command in key proto $p" 32 fail "forced command in key proto $p"
@@ -35,7 +37,7 @@ echo "ForceCommand false" >> $OBJ/sshd_proxy
35echo "Match User $USER" >> $OBJ/sshd_proxy 37echo "Match User $USER" >> $OBJ/sshd_proxy
36echo " ForceCommand true" >> $OBJ/sshd_proxy 38echo " ForceCommand true" >> $OBJ/sshd_proxy
37 39
38for p in 1 2; do 40for p in ${SSH_PROTOCOLS}; do
39 trace "forced command with match proto $p" 41 trace "forced command with match proto $p"
40 ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ || 42 ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ ||
41 fail "forced command in key proto $p" 43 fail "forced command in key proto $p"
diff --git a/regress/forward-control.sh b/regress/forward-control.sh
index 7f7d105e8..91957098f 100644
--- a/regress/forward-control.sh
+++ b/regress/forward-control.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: forward-control.sh,v 1.2 2013/11/18 05:09:32 naddy Exp $ 1# $OpenBSD: forward-control.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sshd control of local and remote forwarding" 4tid="sshd control of local and remote forwarding"
@@ -99,7 +99,7 @@ cp ${OBJ}/sshd_proxy ${OBJ}/sshd_proxy.bak
99cp ${OBJ}/authorized_keys_${USER} ${OBJ}/authorized_keys_${USER}.bak 99cp ${OBJ}/authorized_keys_${USER} ${OBJ}/authorized_keys_${USER}.bak
100 100
101# Sanity check: ensure the default config allows forwarding 101# Sanity check: ensure the default config allows forwarding
102for p in 1 2 ; do 102for p in ${SSH_PROTOCOLS} ; do
103 check_lfwd $p Y "proto $p, default configuration" 103 check_lfwd $p Y "proto $p, default configuration"
104 check_rfwd $p Y "proto $p, default configuration" 104 check_rfwd $p Y "proto $p, default configuration"
105done 105done
@@ -115,7 +115,7 @@ all_tests() {
115 _permit_rfwd=$7 115 _permit_rfwd=$7
116 _badfwd=127.0.0.1:22 116 _badfwd=127.0.0.1:22
117 _goodfwd=127.0.0.1:${PORT} 117 _goodfwd=127.0.0.1:${PORT}
118 for _proto in 1 2 ; do 118 for _proto in ${SSH_PROTOCOLS} ; do
119 cp ${OBJ}/authorized_keys_${USER}.bak \ 119 cp ${OBJ}/authorized_keys_${USER}.bak \
120 ${OBJ}/authorized_keys_${USER} 120 ${OBJ}/authorized_keys_${USER}
121 _prefix="proto $_proto, AllowTcpForwarding=$_tcpfwd" 121 _prefix="proto $_proto, AllowTcpForwarding=$_tcpfwd"
diff --git a/regress/forwarding.sh b/regress/forwarding.sh
index f799d4951..fb4f35aff 100644
--- a/regress/forwarding.sh
+++ b/regress/forwarding.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: forwarding.sh,v 1.12 2014/07/15 15:54:15 millert Exp $ 1# $OpenBSD: forwarding.sh,v 1.15 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="local and remote forwarding" 4tid="local and remote forwarding"
@@ -10,6 +10,9 @@ start_sshd
10base=33 10base=33
11last=$PORT 11last=$PORT
12fwd="" 12fwd=""
13CTL=$OBJ/ctl-sock
14rm -f $CTL
15
13for j in 0 1 2; do 16for j in 0 1 2; do
14 for i in 0 1 2; do 17 for i in 0 1 2; do
15 a=$base$j$i 18 a=$base$j$i
@@ -20,8 +23,11 @@ for j in 0 1 2; do
20 last=$a 23 last=$a
21 done 24 done
22done 25done
23for p in 1 2; do 26for p in ${SSH_PROTOCOLS}; do
24 q=`expr 3 - $p` 27 q=`expr 3 - $p`
28 if ! ssh_version $q; then
29 q=$p
30 fi
25 trace "start forwarding, fork to background" 31 trace "start forwarding, fork to background"
26 ${SSH} -$p -F $OBJ/ssh_config -f $fwd somehost sleep 10 32 ${SSH} -$p -F $OBJ/ssh_config -f $fwd somehost sleep 10
27 33
@@ -34,7 +40,7 @@ for p in 1 2; do
34 sleep 10 40 sleep 10
35done 41done
36 42
37for p in 1 2; do 43for p in ${SSH_PROTOCOLS}; do
38for d in L R; do 44for d in L R; do
39 trace "exit on -$d forward failure, proto $p" 45 trace "exit on -$d forward failure, proto $p"
40 46
@@ -64,7 +70,7 @@ for d in L R; do
64done 70done
65done 71done
66 72
67for p in 1 2; do 73for p in ${SSH_PROTOCOLS}; do
68 trace "simple clear forwarding proto $p" 74 trace "simple clear forwarding proto $p"
69 ${SSH} -$p -F $OBJ/ssh_config -oClearAllForwardings=yes somehost true 75 ${SSH} -$p -F $OBJ/ssh_config -oClearAllForwardings=yes somehost true
70 76
@@ -107,9 +113,9 @@ done
107 113
108echo "LocalForward ${base}01 127.0.0.1:$PORT" >> $OBJ/ssh_config 114echo "LocalForward ${base}01 127.0.0.1:$PORT" >> $OBJ/ssh_config
109echo "RemoteForward ${base}02 127.0.0.1:${base}01" >> $OBJ/ssh_config 115echo "RemoteForward ${base}02 127.0.0.1:${base}01" >> $OBJ/ssh_config
110for p in 1 2; do 116for p in ${SSH_PROTOCOLS}; do
111 trace "config file: start forwarding, fork to background" 117 trace "config file: start forwarding, fork to background"
112 ${SSH} -$p -F $OBJ/ssh_config -f somehost sleep 10 118 ${SSH} -S $CTL -M -$p -F $OBJ/ssh_config -f somehost sleep 10
113 119
114 trace "config file: transfer over forwarded channels and check result" 120 trace "config file: transfer over forwarded channels and check result"
115 ${SSH} -F $OBJ/ssh_config -p${base}02 -o 'ConnectionAttempts=4' \ 121 ${SSH} -F $OBJ/ssh_config -p${base}02 -o 'ConnectionAttempts=4' \
@@ -117,7 +123,7 @@ for p in 1 2; do
117 test -s ${COPY} || fail "failed copy of ${DATA}" 123 test -s ${COPY} || fail "failed copy of ${DATA}"
118 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}" 124 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
119 125
120 wait 126 ${SSH} -S $CTL -O exit somehost
121done 127done
122 128
123for p in 2; do 129for p in 2; do
diff --git a/regress/host-expand.sh b/regress/host-expand.sh
index 6cc0e6055..2a95bfe1b 100644
--- a/regress/host-expand.sh
+++ b/regress/host-expand.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: host-expand.sh,v 1.3 2014/02/27 23:17:41 djm Exp $ 1# $OpenBSD: host-expand.sh,v 1.4 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="expand %h and %n" 4tid="expand %h and %n"
@@ -11,7 +11,7 @@ somehost
11127.0.0.1 11127.0.0.1
12EOE 12EOE
13 13
14for p in 1 2; do 14for p in ${SSH_PROTOCOLS}; do
15 verbose "test $tid: proto $p" 15 verbose "test $tid: proto $p"
16 ${SSH} -F $OBJ/ssh_proxy -$p somehost true >$OBJ/actual 16 ${SSH} -F $OBJ/ssh_proxy -$p somehost true >$OBJ/actual
17 diff $OBJ/expect $OBJ/actual || fail "$tid proto $p" 17 diff $OBJ/expect $OBJ/actual || fail "$tid proto $p"
diff --git a/regress/hostkey-agent.sh b/regress/hostkey-agent.sh
new file mode 100644
index 000000000..a011ec831
--- /dev/null
+++ b/regress/hostkey-agent.sh
@@ -0,0 +1,52 @@
1# $OpenBSD: hostkey-agent.sh,v 1.5 2015/02/21 20:51:02 djm Exp $
2# Placed in the Public Domain.
3
4tid="hostkey agent"
5
6rm -f $OBJ/agent-key.* $OBJ/ssh_proxy.orig $OBJ/known_hosts.orig
7
8trace "start agent"
9eval `${SSHAGENT} -s` > /dev/null
10r=$?
11[ $r -ne 0 ] && fatal "could not start ssh-agent: exit code $r"
12
13grep -vi 'hostkey' $OBJ/sshd_proxy > $OBJ/sshd_proxy.orig
14echo "HostKeyAgent $SSH_AUTH_SOCK" >> $OBJ/sshd_proxy.orig
15
16trace "load hostkeys"
17for k in `${SSH} -Q key-plain` ; do
18 ${SSHKEYGEN} -qt $k -f $OBJ/agent-key.$k -N '' || fatal "ssh-keygen $k"
19 (
20 printf 'localhost-with-alias,127.0.0.1,::1 '
21 cat $OBJ/agent-key.$k.pub
22 ) >> $OBJ/known_hosts.orig
23 ${SSHADD} $OBJ/agent-key.$k >/dev/null 2>&1 || \
24 fatal "couldn't load key $OBJ/agent-key.$k"
25 echo "Hostkey $OBJ/agent-key.${k}" >> $OBJ/sshd_proxy.orig
26 # Remove private key so the server can't use it.
27 rm $OBJ/agent-key.$k || fatal "couldn't rm $OBJ/agent-key.$k"
28done
29cp $OBJ/known_hosts.orig $OBJ/known_hosts
30
31unset SSH_AUTH_SOCK
32
33for ps in no yes; do
34 cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
35 echo "UsePrivilegeSeparation $ps" >> $OBJ/sshd_proxy
36 for k in `${SSH} -Q key-plain` ; do
37 verbose "key type $k privsep=$ps"
38 opts="-oHostKeyAlgorithms=$k -F $OBJ/ssh_proxy"
39 cp $OBJ/known_hosts.orig $OBJ/known_hosts
40 SSH_CONNECTION=`${SSH} $opts host 'echo $SSH_CONNECTION'`
41 if [ $? -ne 0 ]; then
42 fail "protocol $p privsep=$ps failed"
43 fi
44 if [ "$SSH_CONNECTION" != "UNKNOWN 65535 UNKNOWN 65535" ]; then
45 fail "bad SSH_CONNECTION key type $k privsep=$ps"
46 fi
47 done
48done
49
50trace "kill agent"
51${SSHAGENT} -k > /dev/null
52
diff --git a/regress/hostkey-rotate.sh b/regress/hostkey-rotate.sh
new file mode 100644
index 000000000..b5d542d12
--- /dev/null
+++ b/regress/hostkey-rotate.sh
@@ -0,0 +1,128 @@
1# $OpenBSD: hostkey-rotate.sh,v 1.2 2015/03/03 17:53:40 djm Exp $
2# Placed in the Public Domain.
3
4tid="hostkey rotate"
5
6# Need full names here since they are used in HostKeyAlgorithms
7HOSTKEY_TYPES="ecdsa-sha2-nistp256 ssh-ed25519 ssh-rsa ssh-dss"
8
9rm -f $OBJ/hkr.* $OBJ/ssh_proxy.orig
10
11grep -vi 'hostkey' $OBJ/sshd_proxy > $OBJ/sshd_proxy.orig
12echo "UpdateHostkeys=yes" >> $OBJ/ssh_proxy
13rm $OBJ/known_hosts
14
15trace "prepare hostkeys"
16nkeys=0
17all_algs=""
18for k in `ssh -Q key-plain` ; do
19 ${SSHKEYGEN} -qt $k -f $OBJ/hkr.$k -N '' || fatal "ssh-keygen $k"
20 echo "Hostkey $OBJ/hkr.${k}" >> $OBJ/sshd_proxy.orig
21 nkeys=`expr $nkeys + 1`
22 test "x$all_algs" = "x" || all_algs="${all_algs},"
23 all_algs="${all_algs}$k"
24done
25
26dossh() {
27 # All ssh should succeed in this test
28 ${SSH} -F $OBJ/ssh_proxy "$@" x true || fail "ssh $@ failed"
29}
30
31expect_nkeys() {
32 _expected=$1
33 _message=$2
34 _n=`wc -l $OBJ/known_hosts | awk '{ print $1 }'` || fatal "wc failed"
35 [ "x$_n" = "x$_expected" ] || fail "$_message (got $_n wanted $_expected)"
36}
37
38check_key_present() {
39 _type=$1
40 _kfile=$2
41 test "x$_kfile" = "x" && _kfile="$OBJ/hkr.${_type}.pub"
42 _kpub=`awk "/$_type /"' { print $2 }' < $_kfile` || \
43 fatal "awk failed"
44 fgrep "$_kpub" $OBJ/known_hosts > /dev/null
45}
46
47cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
48
49# Connect to sshd with StrictHostkeyChecking=no
50verbose "learn hostkey with StrictHostKeyChecking=no"
51>$OBJ/known_hosts
52dossh -oHostKeyAlgorithms=ssh-ed25519 -oStrictHostKeyChecking=no
53# Verify no additional keys learned
54expect_nkeys 1 "unstrict connect keys"
55check_key_present ssh-ed25519 || fail "unstrict didn't learn key"
56
57# Connect to sshd as usual
58verbose "learn additional hostkeys"
59dossh -oStrictHostKeyChecking=yes
60# Check that other keys learned
61expect_nkeys $nkeys "learn hostkeys"
62check_key_present ssh-rsa || fail "didn't learn keys"
63
64# Check each key type
65for k in `ssh -Q key-plain` ; do
66 verbose "learn additional hostkeys, type=$k"
67 dossh -oStrictHostKeyChecking=yes -oHostKeyAlgorithms=$k,$all_algs
68 expect_nkeys $nkeys "learn hostkeys $k"
69 check_key_present $k || fail "didn't learn $k"
70done
71
72# Change one hostkey (non primary) and relearn
73verbose "learn changed non-primary hostkey"
74mv $OBJ/hkr.ssh-rsa.pub $OBJ/hkr.ssh-rsa.pub.old
75rm -f $OBJ/hkr.ssh-rsa
76${SSHKEYGEN} -qt ssh-rsa -f $OBJ/hkr.ssh-rsa -N '' || fatal "ssh-keygen $k"
77dossh -oStrictHostKeyChecking=yes
78# Check that the key was replaced
79expect_nkeys $nkeys "learn hostkeys"
80check_key_present ssh-rsa $OBJ/hkr.ssh-rsa.pub.old && fail "old key present"
81check_key_present ssh-rsa || fail "didn't learn changed key"
82
83# Add new hostkey (primary type) to sshd and connect
84verbose "learn new primary hostkey"
85${SSHKEYGEN} -qt ssh-rsa -f $OBJ/hkr.ssh-rsa-new -N '' || fatal "ssh-keygen $k"
86( cat $OBJ/sshd_proxy.orig ; echo HostKey $OBJ/hkr.ssh-rsa-new ) \
87 > $OBJ/sshd_proxy
88# Check new hostkey added
89dossh -oStrictHostKeyChecking=yes -oHostKeyAlgorithms=ssh-rsa,$all_algs
90expect_nkeys `expr $nkeys + 1` "learn hostkeys"
91check_key_present ssh-rsa || fail "current key missing"
92check_key_present ssh-rsa $OBJ/hkr.ssh-rsa-new.pub || fail "new key missing"
93
94# Remove old hostkey (primary type) from sshd
95verbose "rotate primary hostkey"
96cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
97mv $OBJ/hkr.ssh-rsa.pub $OBJ/hkr.ssh-rsa.pub.old
98mv $OBJ/hkr.ssh-rsa-new.pub $OBJ/hkr.ssh-rsa.pub
99mv $OBJ/hkr.ssh-rsa-new $OBJ/hkr.ssh-rsa
100# Check old hostkey removed
101dossh -oStrictHostKeyChecking=yes -oHostKeyAlgorithms=ssh-rsa,$all_algs
102expect_nkeys $nkeys "learn hostkeys"
103check_key_present ssh-rsa $OBJ/hkr.ssh-rsa.pub.old && fail "old key present"
104check_key_present ssh-rsa || fail "didn't learn changed key"
105
106# Connect again, forcing rotated key
107verbose "check rotate primary hostkey"
108dossh -oStrictHostKeyChecking=yes -oHostKeyAlgorithms=ssh-rsa
109expect_nkeys 1 "learn hostkeys"
110check_key_present ssh-rsa || fail "didn't learn changed key"
111
112# $OpenBSD: hostkey-rotate.sh,v 1.2 2015/03/03 17:53:40 djm Exp $
113# Placed in the Public Domain.
114
115tid="hostkey rotate"
116
117# Prepare hostkeys file with one key
118
119# Connect to sshd
120
121# Check that other keys learned
122
123# Change one hostkey (non primary)
124
125# Connect to sshd
126
127# Check that the key was replaced
128
diff --git a/regress/integrity.sh b/regress/integrity.sh
index d3a489ff7..2ff8b3f17 100644
--- a/regress/integrity.sh
+++ b/regress/integrity.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: integrity.sh,v 1.14 2014/05/21 07:04:21 djm Exp $ 1# $OpenBSD: integrity.sh,v 1.15 2015/01/19 20:42:31 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="integrity" 4tid="integrity"
@@ -20,7 +20,7 @@ echo "KexAlgorithms diffie-hellman-group14-sha1,diffie-hellman-group1-sha1" \
20 >> $OBJ/ssh_proxy 20 >> $OBJ/ssh_proxy
21 21
22# sshd-command for proxy (see test-exec.sh) 22# sshd-command for proxy (see test-exec.sh)
23cmd="$SUDO sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy" 23cmd="$SUDO sh ${SRC}/sshd-log-wrapper.sh ${TEST_SSHD_LOGFILE} ${SSHD} -i -f $OBJ/sshd_proxy"
24 24
25for m in $macs; do 25for m in $macs; do
26 trace "test $tid: mac $m" 26 trace "test $tid: mac $m"
@@ -58,7 +58,7 @@ for m in $macs; do
58 tr -s '\r\n' '.') 58 tr -s '\r\n' '.')
59 case "$out" in 59 case "$out" in
60 Bad?packet*) elen=`expr $elen + 1`; skip=3;; 60 Bad?packet*) elen=`expr $elen + 1`; skip=3;;
61 Corrupted?MAC* | Decryption?integrity?check?failed*) 61 Corrupted?MAC* | *message?authentication?code?incorrect*)
62 emac=`expr $emac + 1`; skip=0;; 62 emac=`expr $emac + 1`; skip=0;;
63 padding*) epad=`expr $epad + 1`; skip=0;; 63 padding*) epad=`expr $epad + 1`; skip=0;;
64 *) fail "unexpected error mac $m at $off: $out";; 64 *) fail "unexpected error mac $m at $off: $out";;
diff --git a/regress/key-options.sh b/regress/key-options.sh
index f98d78b30..7a68ad358 100644
--- a/regress/key-options.sh
+++ b/regress/key-options.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: key-options.sh,v 1.2 2008/06/30 08:07:34 djm Exp $ 1# $OpenBSD: key-options.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="key options" 4tid="key options"
@@ -8,7 +8,7 @@ authkeys="$OBJ/authorized_keys_${USER}"
8cp $authkeys $origkeys 8cp $authkeys $origkeys
9 9
10# Test command= forced command 10# Test command= forced command
11for p in 1 2; do 11for p in ${SSH_PROTOCOLS}; do
12 for c in 'command="echo bar"' 'no-pty,command="echo bar"'; do 12 for c in 'command="echo bar"' 'no-pty,command="echo bar"'; do
13 sed "s/.*/$c &/" $origkeys >$authkeys 13 sed "s/.*/$c &/" $origkeys >$authkeys
14 verbose "key option proto $p $c" 14 verbose "key option proto $p $c"
@@ -24,7 +24,7 @@ done
24 24
25# Test no-pty 25# Test no-pty
26sed 's/.*/no-pty &/' $origkeys >$authkeys 26sed 's/.*/no-pty &/' $origkeys >$authkeys
27for p in 1 2; do 27for p in ${SSH_PROTOCOLS}; do
28 verbose "key option proto $p no-pty" 28 verbose "key option proto $p no-pty"
29 r=`${SSH} -$p -q -F $OBJ/ssh_proxy somehost tty` 29 r=`${SSH} -$p -q -F $OBJ/ssh_proxy somehost tty`
30 if [ -f "$r" ]; then 30 if [ -f "$r" ]; then
@@ -35,7 +35,7 @@ done
35# Test environment= 35# Test environment=
36echo 'PermitUserEnvironment yes' >> $OBJ/sshd_proxy 36echo 'PermitUserEnvironment yes' >> $OBJ/sshd_proxy
37sed 's/.*/environment="FOO=bar" &/' $origkeys >$authkeys 37sed 's/.*/environment="FOO=bar" &/' $origkeys >$authkeys
38for p in 1 2; do 38for p in ${SSH_PROTOCOLS}; do
39 verbose "key option proto $p environment" 39 verbose "key option proto $p environment"
40 r=`${SSH} -$p -q -F $OBJ/ssh_proxy somehost 'echo $FOO'` 40 r=`${SSH} -$p -q -F $OBJ/ssh_proxy somehost 'echo $FOO'`
41 if [ "$r" != "bar" ]; then 41 if [ "$r" != "bar" ]; then
@@ -45,7 +45,7 @@ done
45 45
46# Test from= restriction 46# Test from= restriction
47start_sshd 47start_sshd
48for p in 1 2; do 48for p in ${SSH_PROTOCOLS}; do
49 for f in 127.0.0.1 '127.0.0.0\/8'; do 49 for f in 127.0.0.1 '127.0.0.0\/8'; do
50 cat $origkeys >$authkeys 50 cat $origkeys >$authkeys
51 ${SSH} -$p -q -F $OBJ/ssh_proxy somehost true 51 ${SSH} -$p -q -F $OBJ/ssh_proxy somehost true
diff --git a/regress/keygen-change.sh b/regress/keygen-change.sh
index 08d359023..e56185050 100644
--- a/regress/keygen-change.sh
+++ b/regress/keygen-change.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: keygen-change.sh,v 1.2 2002/07/16 09:15:55 markus Exp $ 1# $OpenBSD: keygen-change.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="change passphrase for key" 4tid="change passphrase for key"
@@ -6,7 +6,12 @@ tid="change passphrase for key"
6S1="secret1" 6S1="secret1"
7S2="2secret" 7S2="2secret"
8 8
9for t in rsa dsa rsa1; do 9KEYTYPES=`${SSH} -Q key-plain`
10if ssh_version 1; then
11 KEYTYPES="${KEYTYPES} rsa1"
12fi
13
14for t in $KEYTYPES; do
10 # generate user key for agent 15 # generate user key for agent
11 trace "generating $t key" 16 trace "generating $t key"
12 rm -f $OBJ/$t-key 17 rm -f $OBJ/$t-key
diff --git a/regress/keygen-knownhosts.sh b/regress/keygen-knownhosts.sh
new file mode 100644
index 000000000..085aac650
--- /dev/null
+++ b/regress/keygen-knownhosts.sh
@@ -0,0 +1,197 @@
1# $OpenBSD: keygen-knownhosts.sh,v 1.2 2015/01/27 12:01:36 djm Exp $
2# Placed in the Public Domain.
3
4tid="ssh-keygen known_hosts"
5
6rm -f $OBJ/kh.*
7
8# Generate some keys for testing (just ed25519 for speed) and make a hosts file.
9for x in host-a host-b host-c host-d host-e host-f host-a2 host-b2; do
10 ${SSHKEYGEN} -qt ed25519 -f $OBJ/kh.$x -C "$x" -N "" || \
11 fatal "ssh-keygen failed"
12 # Add a comment that we expect should be preserved.
13 echo "# $x" >> $OBJ/kh.hosts
14 (
15 case "$x" in
16 host-a|host-b) printf "$x " ;;
17 host-c) printf "@cert-authority $x " ;;
18 host-d) printf "@revoked $x " ;;
19 host-e) printf "host-e* " ;;
20 host-f) printf "host-f,host-g,host-h " ;;
21 host-a2) printf "host-a " ;;
22 host-b2) printf "host-b " ;;
23 esac
24 cat $OBJ/kh.${x}.pub
25 # Blank line should be preserved.
26 echo "" >> $OBJ/kh.hosts
27 ) >> $OBJ/kh.hosts
28done
29
30# Generate a variant with an invalid line. We'll use this for most tests,
31# because keygen should be able to cope and it should be preserved in any
32# output file.
33cat $OBJ/kh.hosts >> $OBJ/kh.invalid
34echo "host-i " >> $OBJ/kh.invalid
35
36cp $OBJ/kh.invalid $OBJ/kh.invalid.orig
37cp $OBJ/kh.hosts $OBJ/kh.hosts.orig
38
39expect_key() {
40 _host=$1
41 _hosts=$2
42 _key=$3
43 _line=$4
44 _mark=$5
45 _marker=""
46 test "x$_mark" = "xCA" && _marker="@cert-authority "
47 test "x$_mark" = "xREVOKED" && _marker="@revoked "
48 test "x$_line" != "x" &&
49 echo "# Host $_host found: line $_line $_mark" >> $OBJ/kh.expect
50 printf "${_marker}$_hosts " >> $OBJ/kh.expect
51 cat $OBJ/kh.${_key}.pub >> $OBJ/kh.expect ||
52 fatal "${_key}.pub missing"
53}
54
55check_find() {
56 _host=$1
57 _name=$2
58 _keygenopt=$3
59 ${SSHKEYGEN} $_keygenopt -f $OBJ/kh.invalid -F $_host > $OBJ/kh.result
60 if ! diff -uw $OBJ/kh.expect $OBJ/kh.result ; then
61 fail "didn't find $_name"
62 fi
63}
64
65# Find key
66rm -f $OBJ/kh.expect
67expect_key host-a host-a host-a 2
68expect_key host-a host-a host-a2 20
69check_find host-a "simple find"
70
71# find CA key
72rm -f $OBJ/kh.expect
73expect_key host-c host-c host-c 8 CA
74check_find host-c "find CA key"
75
76# find revoked key
77rm -f $OBJ/kh.expect
78expect_key host-d host-d host-d 11 REVOKED
79check_find host-d "find revoked key"
80
81# find key with wildcard
82rm -f $OBJ/kh.expect
83expect_key host-e.somedomain "host-e*" host-e 14
84check_find host-e.somedomain "find wildcard key"
85
86# find key among multiple hosts
87rm -f $OBJ/kh.expect
88expect_key host-h "host-f,host-g,host-h " host-f 17
89check_find host-h "find multiple hosts"
90
91check_hashed_find() {
92 _host=$1
93 _name=$2
94 _file=$3
95 test "x$_file" = "x" && _file=$OBJ/kh.invalid
96 ${SSHKEYGEN} -f $_file -HF $_host | grep '|1|' | \
97 sed "s/^[^ ]*/$_host/" > $OBJ/kh.result
98 if ! diff -uw $OBJ/kh.expect $OBJ/kh.result ; then
99 fail "didn't find $_name"
100 fi
101}
102
103# Find key and hash
104rm -f $OBJ/kh.expect
105expect_key host-a host-a host-a
106expect_key host-a host-a host-a2
107check_hashed_find host-a "find simple and hash"
108
109# Find CA key and hash
110rm -f $OBJ/kh.expect
111expect_key host-c host-c host-c "" CA
112# CA key output is not hashed.
113check_find host-c "find simple and hash" -H
114
115# Find revoked key and hash
116rm -f $OBJ/kh.expect
117expect_key host-d host-d host-d "" REVOKED
118# Revoked key output is not hashed.
119check_find host-d "find simple and hash" -H
120
121# find key with wildcard and hash
122rm -f $OBJ/kh.expect
123expect_key host-e "host-e*" host-e ""
124# Key with wildcard hostname should not be hashed.
125check_find host-e "find wildcard key" -H
126
127# find key among multiple hosts
128rm -f $OBJ/kh.expect
129# Comma-separated hostnames should be expanded and hashed.
130expect_key host-f "host-h " host-f
131expect_key host-g "host-h " host-f
132expect_key host-h "host-h " host-f
133check_hashed_find host-h "find multiple hosts"
134
135# Attempt remove key on invalid file.
136cp $OBJ/kh.invalid.orig $OBJ/kh.invalid
137${SSHKEYGEN} -qf $OBJ/kh.invalid -R host-a 2>/dev/null
138diff -u $OBJ/kh.invalid $OBJ/kh.invalid.orig || fail "remove on invalid succeeded"
139
140# Remove key
141cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
142${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-a 2>/dev/null
143grep -v "^host-a " $OBJ/kh.hosts.orig > $OBJ/kh.expect
144diff -u $OBJ/kh.hosts $OBJ/kh.expect || fail "remove simple"
145
146# Remove CA key
147cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
148${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-c 2>/dev/null
149# CA key should not be removed.
150diff -u $OBJ/kh.hosts $OBJ/kh.hosts.orig || fail "remove CA"
151
152# Remove revoked key
153cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
154${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-d 2>/dev/null
155# revoked key should not be removed.
156diff -u $OBJ/kh.hosts $OBJ/kh.hosts.orig || fail "remove revoked"
157
158# Remove wildcard
159cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
160${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-e.blahblah 2>/dev/null
161grep -v "^host-e[*] " $OBJ/kh.hosts.orig > $OBJ/kh.expect
162diff -u $OBJ/kh.hosts $OBJ/kh.expect || fail "remove wildcard"
163
164# Remove multiple
165cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
166${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-h 2>/dev/null
167grep -v "^host-f," $OBJ/kh.hosts.orig > $OBJ/kh.expect
168diff -u $OBJ/kh.hosts $OBJ/kh.expect || fail "remove wildcard"
169
170# Attempt hash on invalid file
171cp $OBJ/kh.invalid.orig $OBJ/kh.invalid
172${SSHKEYGEN} -qf $OBJ/kh.invalid -H 2>/dev/null && fail "hash invalid succeeded"
173diff -u $OBJ/kh.invalid $OBJ/kh.invalid.orig || fail "invalid file modified"
174
175# Hash valid file
176cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
177${SSHKEYGEN} -qf $OBJ/kh.hosts -H 2>/dev/null || fail "hash failed"
178diff -u $OBJ/kh.hosts.old $OBJ/kh.hosts.orig || fail "backup differs"
179grep "^host-[abfgh]" $OBJ/kh.hosts && fail "original hostnames persist"
180
181cp $OBJ/kh.hosts $OBJ/kh.hashed.orig
182
183# Test lookup
184rm -f $OBJ/kh.expect
185expect_key host-a host-a host-a
186expect_key host-a host-a host-a2
187check_hashed_find host-a "find simple in hashed" $OBJ/kh.hosts
188
189# Test multiple expanded
190rm -f $OBJ/kh.expect
191expect_key host-h host-h host-f
192check_hashed_find host-h "find simple in hashed" $OBJ/kh.hosts
193
194# Test remove
195cp $OBJ/kh.hashed.orig $OBJ/kh.hashed
196${SSHKEYGEN} -qf $OBJ/kh.hashed -R host-a 2>/dev/null
197${SSHKEYGEN} -qf $OBJ/kh.hashed -F host-a && fail "found key after hashed remove"
diff --git a/regress/keyscan.sh b/regress/keyscan.sh
index 33f14f0fc..886f3295a 100644
--- a/regress/keyscan.sh
+++ b/regress/keyscan.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: keyscan.sh,v 1.3 2002/03/15 13:08:56 markus Exp $ 1# $OpenBSD: keyscan.sh,v 1.4 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="keyscan" 4tid="keyscan"
@@ -8,7 +8,12 @@ rm -f ${OBJ}/host.dsa
8 8
9start_sshd 9start_sshd
10 10
11for t in rsa1 rsa dsa; do 11KEYTYPES="rsa dsa"
12if ssh_version 1; then
13 KEYTYPES="${KEYTYPES} rsa1"
14fi
15
16for t in $KEYTYPES; do
12 trace "keyscan type $t" 17 trace "keyscan type $t"
13 ${SSHKEYSCAN} -t $t -p $PORT 127.0.0.1 127.0.0.1 127.0.0.1 \ 18 ${SSHKEYSCAN} -t $t -p $PORT 127.0.0.1 127.0.0.1 127.0.0.1 \
14 > /dev/null 2>&1 19 > /dev/null 2>&1
diff --git a/regress/krl.sh b/regress/krl.sh
index 287384b4a..1077358ff 100644
--- a/regress/krl.sh
+++ b/regress/krl.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: krl.sh,v 1.3 2014/06/24 01:04:43 djm Exp $ 1# $OpenBSD: krl.sh,v 1.6 2015/01/30 01:11:39 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="key revocation lists" 4tid="key revocation lists"
@@ -17,6 +17,8 @@ rm -f $OBJ/revoked-* $OBJ/krl-*
17# Generate a CA key 17# Generate a CA key
18$SSHKEYGEN -t $ECDSA -f $OBJ/revoked-ca -C "" -N "" > /dev/null || 18$SSHKEYGEN -t $ECDSA -f $OBJ/revoked-ca -C "" -N "" > /dev/null ||
19 fatal "$SSHKEYGEN CA failed" 19 fatal "$SSHKEYGEN CA failed"
20$SSHKEYGEN -t ed25519 -f $OBJ/revoked-ca2 -C "" -N "" > /dev/null ||
21 fatal "$SSHKEYGEN CA2 failed"
20 22
21# A specification that revokes some certificates by serial numbers 23# A specification that revokes some certificates by serial numbers
22# The serial pattern is chosen to ensure the KRL includes list, range and 24# The serial pattern is chosen to ensure the KRL includes list, range and
@@ -45,6 +47,7 @@ EOF
45# A specification that revokes some certificated by key ID. 47# A specification that revokes some certificated by key ID.
46touch $OBJ/revoked-keyid 48touch $OBJ/revoked-keyid
47for n in 1 2 3 4 10 15 30 50 `jot 500 300` 999 1000 1001 1002; do 49for n in 1 2 3 4 10 15 30 50 `jot 500 300` 999 1000 1001 1002; do
50 test "x$n" = "x499" && continue
48 # Fill in by-ID revocation spec. 51 # Fill in by-ID revocation spec.
49 echo "id: revoked $n" >> $OBJ/revoked-keyid 52 echo "id: revoked $n" >> $OBJ/revoked-keyid
50done 53done
@@ -56,7 +59,7 @@ keygen() {
56 keytype=$ECDSA 59 keytype=$ECDSA
57 case $N in 60 case $N in
58 2 | 10 | 510 | 1001) keytype=rsa;; 61 2 | 10 | 510 | 1001) keytype=rsa;;
59 4 | 30 | 520 | 1002) keytype=dsa;; 62 4 | 30 | 520 | 1002) keytype=ed25519;;
60 esac 63 esac
61 $SSHKEYGEN -t $keytype -f $f -C "" -N "" > /dev/null \ 64 $SSHKEYGEN -t $keytype -f $f -C "" -N "" > /dev/null \
62 || fatal "$SSHKEYGEN failed" 65 || fatal "$SSHKEYGEN failed"
@@ -71,37 +74,48 @@ verbose "$tid: generating test keys"
71REVOKED_SERIALS="1 4 10 50 500 510 520 799 999" 74REVOKED_SERIALS="1 4 10 50 500 510 520 799 999"
72for n in $REVOKED_SERIALS ; do 75for n in $REVOKED_SERIALS ; do
73 f=`keygen $n` 76 f=`keygen $n`
74 REVOKED_KEYS="$REVOKED_KEYS ${f}.pub" 77 RKEYS="$RKEYS ${f}.pub"
75 REVOKED_CERTS="$REVOKED_CERTS ${f}-cert.pub" 78 RCERTS="$RCERTS ${f}-cert.pub"
76done 79done
77NOTREVOKED_SERIALS="5 9 14 16 29 30 49 51 499 800 1000 1001" 80UNREVOKED_SERIALS="5 9 14 16 29 49 51 499 800 1010 1011"
78NOTREVOKED="" 81UNREVOKED=""
79for n in $NOTREVOKED_SERIALS ; do 82for n in $UNREVOKED_SERIALS ; do
80 NOTREVOKED_KEYS="$NOTREVOKED_KEYS ${f}.pub" 83 f=`keygen $n`
81 NOTREVOKED_CERTS="$NOTREVOKED_CERTS ${f}-cert.pub" 84 UKEYS="$UKEYS ${f}.pub"
85 UCERTS="$UCERTS ${f}-cert.pub"
82done 86done
83 87
84genkrls() { 88genkrls() {
85 OPTS=$1 89 OPTS=$1
86$SSHKEYGEN $OPTS -kf $OBJ/krl-empty - </dev/null \ 90$SSHKEYGEN $OPTS -kf $OBJ/krl-empty - </dev/null \
87 >/dev/null || fatal "$SSHKEYGEN KRL failed" 91 >/dev/null || fatal "$SSHKEYGEN KRL failed"
88$SSHKEYGEN $OPTS -kf $OBJ/krl-keys $REVOKED_KEYS \ 92$SSHKEYGEN $OPTS -kf $OBJ/krl-keys $RKEYS \
89 >/dev/null || fatal "$SSHKEYGEN KRL failed" 93 >/dev/null || fatal "$SSHKEYGEN KRL failed"
90$SSHKEYGEN $OPTS -kf $OBJ/krl-cert $REVOKED_CERTS \ 94$SSHKEYGEN $OPTS -kf $OBJ/krl-cert $RCERTS \
91 >/dev/null || fatal "$SSHKEYGEN KRL failed" 95 >/dev/null || fatal "$SSHKEYGEN KRL failed"
92$SSHKEYGEN $OPTS -kf $OBJ/krl-all $REVOKED_KEYS $REVOKED_CERTS \ 96$SSHKEYGEN $OPTS -kf $OBJ/krl-all $RKEYS $RCERTS \
93 >/dev/null || fatal "$SSHKEYGEN KRL failed" 97 >/dev/null || fatal "$SSHKEYGEN KRL failed"
94$SSHKEYGEN $OPTS -kf $OBJ/krl-ca $OBJ/revoked-ca.pub \ 98$SSHKEYGEN $OPTS -kf $OBJ/krl-ca $OBJ/revoked-ca.pub \
95 >/dev/null || fatal "$SSHKEYGEN KRL failed" 99 >/dev/null || fatal "$SSHKEYGEN KRL failed"
96# KRLs from serial/key-id spec need the CA specified. 100# This should fail as KRLs from serial/key-id spec need the CA specified.
97$SSHKEYGEN $OPTS -kf $OBJ/krl-serial $OBJ/revoked-serials \ 101$SSHKEYGEN $OPTS -kf $OBJ/krl-serial $OBJ/revoked-serials \
98 >/dev/null 2>&1 && fatal "$SSHKEYGEN KRL succeeded unexpectedly" 102 >/dev/null 2>&1 && fatal "$SSHKEYGEN KRL succeeded unexpectedly"
99$SSHKEYGEN $OPTS -kf $OBJ/krl-keyid $OBJ/revoked-keyid \ 103$SSHKEYGEN $OPTS -kf $OBJ/krl-keyid $OBJ/revoked-keyid \
100 >/dev/null 2>&1 && fatal "$SSHKEYGEN KRL succeeded unexpectedly" 104 >/dev/null 2>&1 && fatal "$SSHKEYGEN KRL succeeded unexpectedly"
101$SSHKEYGEN $OPTS -kf $OBJ/krl-serial -s $OBJ/revoked-ca $OBJ/revoked-serials \ 105# These should succeed; they specify an explicit CA key.
106$SSHKEYGEN $OPTS -kf $OBJ/krl-serial -s $OBJ/revoked-ca \
107 $OBJ/revoked-serials >/dev/null || fatal "$SSHKEYGEN KRL failed"
108$SSHKEYGEN $OPTS -kf $OBJ/krl-keyid -s $OBJ/revoked-ca.pub \
109 $OBJ/revoked-keyid >/dev/null || fatal "$SSHKEYGEN KRL failed"
110# These should succeed; they specify an wildcard CA key.
111$SSHKEYGEN $OPTS -kf $OBJ/krl-serial-wild -s NONE $OBJ/revoked-serials \
102 >/dev/null || fatal "$SSHKEYGEN KRL failed" 112 >/dev/null || fatal "$SSHKEYGEN KRL failed"
103$SSHKEYGEN $OPTS -kf $OBJ/krl-keyid -s $OBJ/revoked-ca.pub $OBJ/revoked-keyid \ 113$SSHKEYGEN $OPTS -kf $OBJ/krl-keyid-wild -s NONE $OBJ/revoked-keyid \
104 >/dev/null || fatal "$SSHKEYGEN KRL failed" 114 >/dev/null || fatal "$SSHKEYGEN KRL failed"
115# Revoke the same serials with the second CA key to ensure a multi-CA
116# KRL is generated.
117$SSHKEYGEN $OPTS -kf $OBJ/krl-serial -u -s $OBJ/revoked-ca2 \
118 $OBJ/revoked-serials >/dev/null || fatal "$SSHKEYGEN KRL failed"
105} 119}
106 120
107## XXX dump with trace and grep for set cert serials 121## XXX dump with trace and grep for set cert serials
@@ -123,7 +137,7 @@ check_krl() {
123 fatal "key $KEY unexpectedly revoked by KRL $KRL: $TAG" 137 fatal "key $KEY unexpectedly revoked by KRL $KRL: $TAG"
124 fi 138 fi
125} 139}
126test_all() { 140test_rev() {
127 FILES=$1 141 FILES=$1
128 TAG=$2 142 TAG=$2
129 KEYS_RESULT=$3 143 KEYS_RESULT=$3
@@ -132,32 +146,40 @@ test_all() {
132 KEYID_RESULT=$6 146 KEYID_RESULT=$6
133 CERTS_RESULT=$7 147 CERTS_RESULT=$7
134 CA_RESULT=$8 148 CA_RESULT=$8
149 SERIAL_WRESULT=$9
150 KEYID_WRESULT=$10
135 verbose "$tid: checking revocations for $TAG" 151 verbose "$tid: checking revocations for $TAG"
136 for f in $FILES ; do 152 for f in $FILES ; do
137 check_krl $f $OBJ/krl-empty no "$TAG" 153 check_krl $f $OBJ/krl-empty no "$TAG"
138 check_krl $f $OBJ/krl-keys $KEYS_RESULT "$TAG" 154 check_krl $f $OBJ/krl-keys $KEYS_RESULT "$TAG"
139 check_krl $f $OBJ/krl-all $ALL_RESULT "$TAG" 155 check_krl $f $OBJ/krl-all $ALL_RESULT "$TAG"
140 check_krl $f $OBJ/krl-serial $SERIAL_RESULT "$TAG" 156 check_krl $f $OBJ/krl-serial $SERIAL_RESULT "$TAG"
141 check_krl $f $OBJ/krl-keyid $KEYID_RESULT "$TAG" 157 check_krl $f $OBJ/krl-keyid $KEYID_RESULT "$TAG"
142 check_krl $f $OBJ/krl-cert $CERTS_RESULT "$TAG" 158 check_krl $f $OBJ/krl-cert $CERTS_RESULT "$TAG"
143 check_krl $f $OBJ/krl-ca $CA_RESULT "$TAG" 159 check_krl $f $OBJ/krl-ca $CA_RESULT "$TAG"
160 check_krl $f $OBJ/krl-serial-wild $SERIAL_WRESULT "$TAG"
161 check_krl $f $OBJ/krl-keyid-wild $KEYID_WRESULT "$TAG"
144 done 162 done
145} 163}
146# keys all serial keyid certs CA 164
147test_all "$REVOKED_KEYS" "revoked keys" yes yes no no no no 165test_all() {
148test_all "$UNREVOKED_KEYS" "unrevoked keys" no no no no no no 166 # wildcard
149test_all "$REVOKED_CERTS" "revoked certs" yes yes yes yes yes yes 167 # keys all sr# k.ID cert CA sr.# k.ID
150test_all "$UNREVOKED_CERTS" "unrevoked certs" no no no no no yes 168 test_rev "$RKEYS" "revoked keys" yes yes no no no no no no
169 test_rev "$UKEYS" "unrevoked keys" no no no no no no no no
170 test_rev "$RCERTS" "revoked certs" yes yes yes yes yes yes yes yes
171 test_rev "$UCERTS" "unrevoked certs" no no no no no yes no no
172}
173
174test_all
151 175
152# Check update. Results should be identical. 176# Check update. Results should be identical.
153verbose "$tid: testing KRL update" 177verbose "$tid: testing KRL update"
154for f in $OBJ/krl-keys $OBJ/krl-cert $OBJ/krl-all \ 178for f in $OBJ/krl-keys $OBJ/krl-cert $OBJ/krl-all \
155 $OBJ/krl-ca $OBJ/krl-serial $OBJ/krl-keyid ; do 179 $OBJ/krl-ca $OBJ/krl-serial $OBJ/krl-keyid \
180 $OBJ/krl-serial-wild $OBJ/krl-keyid-wild; do
156 cp -f $OBJ/krl-empty $f 181 cp -f $OBJ/krl-empty $f
157 genkrls -u 182 genkrls -u
158done 183done
159# keys all serial keyid certs CA 184
160test_all "$REVOKED_KEYS" "revoked keys" yes yes no no no no 185test_all
161test_all "$UNREVOKED_KEYS" "unrevoked keys" no no no no no no
162test_all "$REVOKED_CERTS" "revoked certs" yes yes yes yes yes yes
163test_all "$UNREVOKED_CERTS" "unrevoked certs" no no no no no yes
diff --git a/regress/limit-keytype.sh b/regress/limit-keytype.sh
new file mode 100644
index 000000000..2de037bd1
--- /dev/null
+++ b/regress/limit-keytype.sh
@@ -0,0 +1,80 @@
1# $OpenBSD: limit-keytype.sh,v 1.1 2015/01/13 07:49:49 djm Exp $
2# Placed in the Public Domain.
3
4tid="restrict pubkey type"
5
6rm -f $OBJ/authorized_keys_$USER $OBJ/user_ca_key* $OBJ/user_key*
7rm -f $OBJ/authorized_principals_$USER $OBJ/cert_user_key*
8
9mv $OBJ/sshd_proxy $OBJ/sshd_proxy.orig
10mv $OBJ/ssh_proxy $OBJ/ssh_proxy.orig
11
12# Create a CA key
13${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_ca_key ||\
14 fatal "ssh-keygen failed"
15
16# Make some keys and a certificate.
17${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_key1 || \
18 fatal "ssh-keygen failed"
19${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/user_key2 || \
20 fatal "ssh-keygen failed"
21${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/user_key3 || \
22 fatal "ssh-keygen failed"
23${SSHKEYGEN} -q -s $OBJ/user_ca_key -I "regress user key for $USER" \
24 -z $$ -n ${USER},mekmitasdigoat $OBJ/user_key3 ||
25 fatal "couldn't sign user_key1"
26# Copy the private key alongside the cert to allow better control of when
27# it is offered.
28mv $OBJ/user_key3-cert.pub $OBJ/cert_user_key3.pub
29cp -p $OBJ/user_key3 $OBJ/cert_user_key3
30
31grep -v IdentityFile $OBJ/ssh_proxy.orig > $OBJ/ssh_proxy
32
33opts="-oProtocol=2 -F $OBJ/ssh_proxy -oIdentitiesOnly=yes"
34fullopts="$opts -i $OBJ/cert_user_key3 -i $OBJ/user_key1 -i $OBJ/user_key2"
35
36echo mekmitasdigoat > $OBJ/authorized_principals_$USER
37cat $OBJ/user_key1.pub > $OBJ/authorized_keys_$USER
38cat $OBJ/user_key2.pub >> $OBJ/authorized_keys_$USER
39
40prepare_config() {
41 (
42 grep -v "Protocol" $OBJ/sshd_proxy.orig
43 echo "Protocol 2"
44 echo "AuthenticationMethods publickey"
45 echo "TrustedUserCAKeys $OBJ/user_ca_key.pub"
46 echo "AuthorizedPrincipalsFile $OBJ/authorized_principals_%u"
47 for x in "$@" ; do
48 echo "$x"
49 done
50 ) > $OBJ/sshd_proxy
51}
52
53prepare_config
54
55# Check we can log in with all key types.
56${SSH} $opts -i $OBJ/cert_user_key3 proxy true || fatal "cert failed"
57${SSH} $opts -i $OBJ/user_key1 proxy true || fatal "key1 failed"
58${SSH} $opts -i $OBJ/user_key2 proxy true || fatal "key2 failed"
59
60# Allow plain Ed25519 and RSA. The certificate should fail.
61verbose "privsep=$privsep allow rsa,ed25519"
62prepare_config "PubkeyAcceptedKeyTypes ssh-rsa,ssh-ed25519"
63${SSH} $opts -i $OBJ/cert_user_key3 proxy true && fatal "cert succeeded"
64${SSH} $opts -i $OBJ/user_key1 proxy true || fatal "key1 failed"
65${SSH} $opts -i $OBJ/user_key2 proxy true || fatal "key2 failed"
66
67# Allow Ed25519 only.
68verbose "privsep=$privsep allow ed25519"
69prepare_config "PubkeyAcceptedKeyTypes ssh-ed25519"
70${SSH} $opts -i $OBJ/cert_user_key3 proxy true && fatal "cert succeeded"
71${SSH} $opts -i $OBJ/user_key1 proxy true || fatal "key1 failed"
72${SSH} $opts -i $OBJ/user_key2 proxy true && fatal "key2 succeeded"
73
74# Allow all certs. Plain keys should fail.
75verbose "privsep=$privsep allow cert only"
76prepare_config "PubkeyAcceptedKeyTypes ssh-*-cert-v01@openssh.com"
77${SSH} $opts -i $OBJ/cert_user_key3 proxy true || fatal "cert failed"
78${SSH} $opts -i $OBJ/user_key1 proxy true && fatal "key1 succeeded"
79${SSH} $opts -i $OBJ/user_key2 proxy true && fatal "key2 succeeded"
80
diff --git a/regress/localcommand.sh b/regress/localcommand.sh
index 8a9b56971..220f19a4d 100644
--- a/regress/localcommand.sh
+++ b/regress/localcommand.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: localcommand.sh,v 1.2 2013/05/17 10:24:48 dtucker Exp $ 1# $OpenBSD: localcommand.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="localcommand" 4tid="localcommand"
@@ -6,7 +6,7 @@ tid="localcommand"
6echo 'PermitLocalCommand yes' >> $OBJ/ssh_proxy 6echo 'PermitLocalCommand yes' >> $OBJ/ssh_proxy
7echo 'LocalCommand echo foo' >> $OBJ/ssh_proxy 7echo 'LocalCommand echo foo' >> $OBJ/ssh_proxy
8 8
9for p in 1 2; do 9for p in ${SSH_PROTOCOLS}; do
10 verbose "test $tid: proto $p localcommand" 10 verbose "test $tid: proto $p localcommand"
11 a=`${SSH} -F $OBJ/ssh_proxy -$p somehost true` 11 a=`${SSH} -F $OBJ/ssh_proxy -$p somehost true`
12 if [ "$a" != "foo" ] ; then 12 if [ "$a" != "foo" ] ; then
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index 8ee140be6..acb9234d9 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -1,24 +1,11 @@
1# $OpenBSD: multiplex.sh,v 1.25 2014/07/22 01:32:12 djm Exp $ 1# $OpenBSD: multiplex.sh,v 1.27 2014/12/22 06:14:29 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4CTL=/tmp/openssh.regress.ctl-sock.$$ 4CTL=/tmp/openssh.regress.ctl-sock.$$
5 5
6tid="connection multiplexing" 6tid="connection multiplexing"
7 7
8if have_prog nc ; then 8NC=$OBJ/netcat
9 if nc -h 2>&1 | grep -- -N >/dev/null; then
10 NC="nc -N";
11 elif nc -h 2>&1 | grep -- "-U.*Use UNIX" >/dev/null ; then
12 NC="nc"
13 else
14 echo "nc is incompatible"
15 fi
16fi
17
18if test -z "$NC" ; then
19 echo "skipped (no compatible nc found)"
20 exit 0
21fi
22 9
23trace "will use ProxyCommand $proxycmd" 10trace "will use ProxyCommand $proxycmd"
24if config_defined DISABLE_FD_PASSING ; then 11if config_defined DISABLE_FD_PASSING ; then
@@ -90,20 +77,20 @@ cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}"
90rm -f ${COPY} 77rm -f ${COPY}
91verbose "test $tid: forward" 78verbose "test $tid: forward"
92trace "forward over TCP/IP and check result" 79trace "forward over TCP/IP and check result"
93$NC -l 127.0.0.1 $((${PORT} + 1)) < ${DATA} & 80$NC -N -l 127.0.0.1 $((${PORT} + 1)) < ${DATA} > /dev/null &
94netcat_pid=$! 81netcat_pid=$!
95${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L127.0.0.1:$((${PORT} + 2)):127.0.0.1:$((${PORT} + 1)) otherhost >>$TEST_SSH_LOGFILE 2>&1 82${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L127.0.0.1:$((${PORT} + 2)):127.0.0.1:$((${PORT} + 1)) otherhost >>$TEST_SSH_LOGFILE 2>&1
96$NC -d 127.0.0.1 $((${PORT} + 2)) > ${COPY} < /dev/null 83$NC 127.0.0.1 $((${PORT} + 2)) < /dev/null > ${COPY}
97cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}" 84cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}"
98kill $netcat_pid 2>/dev/null 85kill $netcat_pid 2>/dev/null
99rm -f ${COPY} $OBJ/unix-[123].fwd 86rm -f ${COPY} $OBJ/unix-[123].fwd
100 87
101trace "forward over UNIX and check result" 88trace "forward over UNIX and check result"
102$NC -Ul $OBJ/unix-1.fwd < ${DATA} & 89$NC -N -Ul $OBJ/unix-1.fwd < ${DATA} > /dev/null &
103netcat_pid=$! 90netcat_pid=$!
104${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L$OBJ/unix-2.fwd:$OBJ/unix-1.fwd otherhost >>$TEST_SSH_LOGFILE 2>&1 91${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L$OBJ/unix-2.fwd:$OBJ/unix-1.fwd otherhost >>$TEST_SSH_LOGFILE 2>&1
105${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R$OBJ/unix-3.fwd:$OBJ/unix-2.fwd otherhost >>$TEST_SSH_LOGFILE 2>&1 92${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R$OBJ/unix-3.fwd:$OBJ/unix-2.fwd otherhost >>$TEST_SSH_LOGFILE 2>&1
106$NC -d -U $OBJ/unix-3.fwd > ${COPY} </dev/null 93$NC -U $OBJ/unix-3.fwd < /dev/null > ${COPY} 2>/dev/null
107cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}" 94cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}"
108kill $netcat_pid 2>/dev/null 95kill $netcat_pid 2>/dev/null
109rm -f ${COPY} $OBJ/unix-[123].fwd 96rm -f ${COPY} $OBJ/unix-[123].fwd
diff --git a/regress/multipubkey.sh b/regress/multipubkey.sh
new file mode 100644
index 000000000..e9d15306f
--- /dev/null
+++ b/regress/multipubkey.sh
@@ -0,0 +1,66 @@
1# $OpenBSD: multipubkey.sh,v 1.1 2014/12/22 08:06:03 djm Exp $
2# Placed in the Public Domain.
3
4tid="multiple pubkey"
5
6rm -f $OBJ/authorized_keys_$USER $OBJ/user_ca_key* $OBJ/user_key*
7rm -f $OBJ/authorized_principals_$USER $OBJ/cert_user_key*
8
9mv $OBJ/sshd_proxy $OBJ/sshd_proxy.orig
10mv $OBJ/ssh_proxy $OBJ/ssh_proxy.orig
11
12# Create a CA key
13${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_ca_key ||\
14 fatal "ssh-keygen failed"
15
16# Make some keys and a certificate.
17${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_key1 || \
18 fatal "ssh-keygen failed"
19${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_key2 || \
20 fatal "ssh-keygen failed"
21${SSHKEYGEN} -q -s $OBJ/user_ca_key -I "regress user key for $USER" \
22 -z $$ -n ${USER},mekmitasdigoat $OBJ/user_key1 ||
23 fail "couldn't sign user_key1"
24# Copy the private key alongside the cert to allow better control of when
25# it is offered.
26mv $OBJ/user_key1-cert.pub $OBJ/cert_user_key1.pub
27cp -p $OBJ/user_key1 $OBJ/cert_user_key1
28
29grep -v IdentityFile $OBJ/ssh_proxy.orig > $OBJ/ssh_proxy
30
31opts="-oProtocol=2 -F $OBJ/ssh_proxy -oIdentitiesOnly=yes"
32opts="$opts -i $OBJ/cert_user_key1 -i $OBJ/user_key1 -i $OBJ/user_key2"
33
34for privsep in no yes; do
35 (
36 grep -v "Protocol" $OBJ/sshd_proxy.orig
37 echo "Protocol 2"
38 echo "UsePrivilegeSeparation $privsep"
39 echo "AuthenticationMethods publickey,publickey"
40 echo "TrustedUserCAKeys $OBJ/user_ca_key.pub"
41 echo "AuthorizedPrincipalsFile $OBJ/authorized_principals_%u"
42 ) > $OBJ/sshd_proxy
43
44 # Single key should fail.
45 rm -f $OBJ/authorized_principals_$USER
46 cat $OBJ/user_key1.pub > $OBJ/authorized_keys_$USER
47 ${SSH} $opts proxy true && fail "ssh succeeded with key"
48
49 # Single key with same-public cert should fail.
50 echo mekmitasdigoat > $OBJ/authorized_principals_$USER
51 cat $OBJ/user_key1.pub > $OBJ/authorized_keys_$USER
52 ${SSH} $opts proxy true && fail "ssh succeeded with key+cert"
53
54 # Multiple plain keys should succeed.
55 rm -f $OBJ/authorized_principals_$USER
56 cat $OBJ/user_key1.pub $OBJ/user_key2.pub > \
57 $OBJ/authorized_keys_$USER
58 ${SSH} $opts proxy true || fail "ssh failed with multiple keys"
59 # Cert and different key should succeed
60
61 # Key and different-public cert should succeed.
62 echo mekmitasdigoat > $OBJ/authorized_principals_$USER
63 cat $OBJ/user_key2.pub > $OBJ/authorized_keys_$USER
64 ${SSH} $opts proxy true || fail "ssh failed with key/cert"
65done
66
diff --git a/regress/netcat.c b/regress/netcat.c
new file mode 100644
index 000000000..1a9fc8730
--- /dev/null
+++ b/regress/netcat.c
@@ -0,0 +1,1690 @@
1/* $OpenBSD: netcat.c,v 1.126 2014/10/30 16:08:31 tedu Exp $ */
2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/*
30 * Re-written nc(1) for OpenBSD. Original implementation by
31 * *Hobbit* <hobbit@avian.org>.
32 */
33
34#include "includes.h"
35
36#include <sys/types.h>
37#include <sys/socket.h>
38#include <sys/time.h>
39#include <sys/uio.h>
40#include <sys/un.h>
41
42#include <netinet/in.h>
43#include <netinet/tcp.h>
44#include <netinet/ip.h>
45#include <arpa/telnet.h>
46
47#include <errno.h>
48#include <netdb.h>
49#include <stdarg.h>
50#include <stdio.h>
51#include <stdlib.h>
52#include <string.h>
53#include <unistd.h>
54#include <fcntl.h>
55#include <limits.h>
56#include "atomicio.h"
57
58#ifdef HAVE_POLL_H
59#include <poll.h>
60#else
61# ifdef HAVE_SYS_POLL_H
62# include <sys/poll.h>
63# endif
64#endif
65
66#ifndef SUN_LEN
67#define SUN_LEN(su) \
68 (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
69#endif
70
71#define PORT_MAX 65535
72#define PORT_MAX_LEN 6
73#define UNIX_DG_TMP_SOCKET_SIZE 19
74
75#define POLL_STDIN 0
76#define POLL_NETOUT 1
77#define POLL_NETIN 2
78#define POLL_STDOUT 3
79#define BUFSIZE 16384
80
81/* Command Line Options */
82int dflag; /* detached, no stdin */
83int Fflag; /* fdpass sock to stdout */
84unsigned int iflag; /* Interval Flag */
85int kflag; /* More than one connect */
86int lflag; /* Bind to local port */
87int Nflag; /* shutdown() network socket */
88int nflag; /* Don't do name look up */
89char *Pflag; /* Proxy username */
90char *pflag; /* Localport flag */
91int rflag; /* Random ports flag */
92char *sflag; /* Source Address */
93int tflag; /* Telnet Emulation */
94int uflag; /* UDP - Default to TCP */
95int vflag; /* Verbosity */
96int xflag; /* Socks proxy */
97int zflag; /* Port Scan Flag */
98int Dflag; /* sodebug */
99int Iflag; /* TCP receive buffer size */
100int Oflag; /* TCP send buffer size */
101int Sflag; /* TCP MD5 signature option */
102int Tflag = -1; /* IP Type of Service */
103int rtableid = -1;
104
105int timeout = -1;
106int family = AF_UNSPEC;
107char *portlist[PORT_MAX+1];
108char *unix_dg_tmp_socket;
109
110void atelnet(int, unsigned char *, unsigned int);
111void build_ports(char *);
112void help(void);
113int local_listen(char *, char *, struct addrinfo);
114void readwrite(int);
115void fdpass(int nfd) __attribute__((noreturn));
116int remote_connect(const char *, const char *, struct addrinfo);
117int timeout_connect(int, const struct sockaddr *, socklen_t);
118int socks_connect(const char *, const char *, struct addrinfo,
119 const char *, const char *, struct addrinfo, int, const char *);
120int udptest(int);
121int unix_bind(char *);
122int unix_connect(char *);
123int unix_listen(char *);
124void set_common_sockopts(int);
125int map_tos(char *, int *);
126void report_connect(const struct sockaddr *, socklen_t);
127void usage(int);
128ssize_t drainbuf(int, unsigned char *, size_t *);
129ssize_t fillbuf(int, unsigned char *, size_t *);
130
131static void err(int, const char *, ...) __attribute__((format(printf, 2, 3)));
132static void errx(int, const char *, ...) __attribute__((format(printf, 2, 3)));
133static void warn(const char *, ...) __attribute__((format(printf, 1, 2)));
134
135static void
136err(int r, const char *fmt, ...)
137{
138 va_list args;
139
140 va_start(args, fmt);
141 fprintf(stderr, "%s: ", strerror(errno));
142 vfprintf(stderr, fmt, args);
143 fputc('\n', stderr);
144 va_end(args);
145 exit(r);
146}
147
148static void
149errx(int r, const char *fmt, ...)
150{
151 va_list args;
152
153 va_start(args, fmt);
154 vfprintf(stderr, fmt, args);
155 fputc('\n', stderr);
156 va_end(args);
157 exit(r);
158}
159
160static void
161warn(const char *fmt, ...)
162{
163 va_list args;
164
165 va_start(args, fmt);
166 fprintf(stderr, "%s: ", strerror(errno));
167 vfprintf(stderr, fmt, args);
168 fputc('\n', stderr);
169 va_end(args);
170}
171
172int
173main(int argc, char *argv[])
174{
175 int ch, s, ret, socksv;
176 char *host, *uport;
177 struct addrinfo hints;
178 struct servent *sv;
179 socklen_t len;
180 struct sockaddr_storage cliaddr;
181 char *proxy = NULL;
182 const char *errstr, *proxyhost = "", *proxyport = NULL;
183 struct addrinfo proxyhints;
184 char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE];
185
186 ret = 1;
187 s = 0;
188 socksv = 5;
189 host = NULL;
190 uport = NULL;
191 sv = NULL;
192
193 while ((ch = getopt(argc, argv,
194 "46DdFhI:i:klNnO:P:p:rSs:tT:UuV:vw:X:x:z")) != -1) {
195 switch (ch) {
196 case '4':
197 family = AF_INET;
198 break;
199 case '6':
200 family = AF_INET6;
201 break;
202 case 'U':
203 family = AF_UNIX;
204 break;
205 case 'X':
206 if (strcasecmp(optarg, "connect") == 0)
207 socksv = -1; /* HTTP proxy CONNECT */
208 else if (strcmp(optarg, "4") == 0)
209 socksv = 4; /* SOCKS v.4 */
210 else if (strcmp(optarg, "5") == 0)
211 socksv = 5; /* SOCKS v.5 */
212 else
213 errx(1, "unsupported proxy protocol");
214 break;
215 case 'd':
216 dflag = 1;
217 break;
218 case 'F':
219 Fflag = 1;
220 break;
221 case 'h':
222 help();
223 break;
224 case 'i':
225 iflag = strtonum(optarg, 0, UINT_MAX, &errstr);
226 if (errstr)
227 errx(1, "interval %s: %s", errstr, optarg);
228 break;
229 case 'k':
230 kflag = 1;
231 break;
232 case 'l':
233 lflag = 1;
234 break;
235 case 'N':
236 Nflag = 1;
237 break;
238 case 'n':
239 nflag = 1;
240 break;
241 case 'P':
242 Pflag = optarg;
243 break;
244 case 'p':
245 pflag = optarg;
246 break;
247 case 'r':
248 rflag = 1;
249 break;
250 case 's':
251 sflag = optarg;
252 break;
253 case 't':
254 tflag = 1;
255 break;
256 case 'u':
257 uflag = 1;
258 break;
259#ifdef SO_RTABLE
260 case 'V':
261 rtableid = (int)strtonum(optarg, 0,
262 RT_TABLEID_MAX, &errstr);
263 if (errstr)
264 errx(1, "rtable %s: %s", errstr, optarg);
265 break;
266#endif
267 case 'v':
268 vflag = 1;
269 break;
270 case 'w':
271 timeout = strtonum(optarg, 0, INT_MAX / 1000, &errstr);
272 if (errstr)
273 errx(1, "timeout %s: %s", errstr, optarg);
274 timeout *= 1000;
275 break;
276 case 'x':
277 xflag = 1;
278 if ((proxy = strdup(optarg)) == NULL)
279 errx(1, "strdup");
280 break;
281 case 'z':
282 zflag = 1;
283 break;
284 case 'D':
285 Dflag = 1;
286 break;
287 case 'I':
288 Iflag = strtonum(optarg, 1, 65536 << 14, &errstr);
289 if (errstr != NULL)
290 errx(1, "TCP receive window %s: %s",
291 errstr, optarg);
292 break;
293 case 'O':
294 Oflag = strtonum(optarg, 1, 65536 << 14, &errstr);
295 if (errstr != NULL)
296 errx(1, "TCP send window %s: %s",
297 errstr, optarg);
298 break;
299 case 'S':
300 Sflag = 1;
301 break;
302 case 'T':
303 errstr = NULL;
304 errno = 0;
305 if (map_tos(optarg, &Tflag))
306 break;
307 if (strlen(optarg) > 1 && optarg[0] == '0' &&
308 optarg[1] == 'x')
309 Tflag = (int)strtol(optarg, NULL, 16);
310 else
311 Tflag = (int)strtonum(optarg, 0, 255,
312 &errstr);
313 if (Tflag < 0 || Tflag > 255 || errstr || errno)
314 errx(1, "illegal tos value %s", optarg);
315 break;
316 default:
317 usage(1);
318 }
319 }
320 argc -= optind;
321 argv += optind;
322
323 /* Cruft to make sure options are clean, and used properly. */
324 if (argv[0] && !argv[1] && family == AF_UNIX) {
325 host = argv[0];
326 uport = NULL;
327 } else if (argv[0] && !argv[1]) {
328 if (!lflag)
329 usage(1);
330 uport = argv[0];
331 host = NULL;
332 } else if (argv[0] && argv[1]) {
333 host = argv[0];
334 uport = argv[1];
335 } else
336 usage(1);
337
338 if (lflag && sflag)
339 errx(1, "cannot use -s and -l");
340 if (lflag && pflag)
341 errx(1, "cannot use -p and -l");
342 if (lflag && zflag)
343 errx(1, "cannot use -z and -l");
344 if (!lflag && kflag)
345 errx(1, "must use -l with -k");
346
347 /* Get name of temporary socket for unix datagram client */
348 if ((family == AF_UNIX) && uflag && !lflag) {
349 if (sflag) {
350 unix_dg_tmp_socket = sflag;
351 } else {
352 strlcpy(unix_dg_tmp_socket_buf, "/tmp/nc.XXXXXXXXXX",
353 UNIX_DG_TMP_SOCKET_SIZE);
354 if (mktemp(unix_dg_tmp_socket_buf) == NULL)
355 err(1, "mktemp");
356 unix_dg_tmp_socket = unix_dg_tmp_socket_buf;
357 }
358 }
359
360 /* Initialize addrinfo structure. */
361 if (family != AF_UNIX) {
362 memset(&hints, 0, sizeof(struct addrinfo));
363 hints.ai_family = family;
364 hints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
365 hints.ai_protocol = uflag ? IPPROTO_UDP : IPPROTO_TCP;
366 if (nflag)
367 hints.ai_flags |= AI_NUMERICHOST;
368 }
369
370 if (xflag) {
371 if (uflag)
372 errx(1, "no proxy support for UDP mode");
373
374 if (lflag)
375 errx(1, "no proxy support for listen");
376
377 if (family == AF_UNIX)
378 errx(1, "no proxy support for unix sockets");
379
380 /* XXX IPv6 transport to proxy would probably work */
381 if (family == AF_INET6)
382 errx(1, "no proxy support for IPv6");
383
384 if (sflag)
385 errx(1, "no proxy support for local source address");
386
387 proxyhost = strsep(&proxy, ":");
388 proxyport = proxy;
389
390 memset(&proxyhints, 0, sizeof(struct addrinfo));
391 proxyhints.ai_family = family;
392 proxyhints.ai_socktype = SOCK_STREAM;
393 proxyhints.ai_protocol = IPPROTO_TCP;
394 if (nflag)
395 proxyhints.ai_flags |= AI_NUMERICHOST;
396 }
397
398 if (lflag) {
399 int connfd;
400 ret = 0;
401
402 if (family == AF_UNIX) {
403 if (uflag)
404 s = unix_bind(host);
405 else
406 s = unix_listen(host);
407 }
408
409 /* Allow only one connection at a time, but stay alive. */
410 for (;;) {
411 if (family != AF_UNIX)
412 s = local_listen(host, uport, hints);
413 if (s < 0)
414 err(1, "local_listen");
415 /*
416 * For UDP and -k, don't connect the socket, let it
417 * receive datagrams from multiple socket pairs.
418 */
419 if (uflag && kflag)
420 readwrite(s);
421 /*
422 * For UDP and not -k, we will use recvfrom() initially
423 * to wait for a caller, then use the regular functions
424 * to talk to the caller.
425 */
426 else if (uflag && !kflag) {
427 int rv, plen;
428 char buf[16384];
429 struct sockaddr_storage z;
430
431 len = sizeof(z);
432 plen = 2048;
433 rv = recvfrom(s, buf, plen, MSG_PEEK,
434 (struct sockaddr *)&z, &len);
435 if (rv < 0)
436 err(1, "recvfrom");
437
438 rv = connect(s, (struct sockaddr *)&z, len);
439 if (rv < 0)
440 err(1, "connect");
441
442 if (vflag)
443 report_connect((struct sockaddr *)&z, len);
444
445 readwrite(s);
446 } else {
447 len = sizeof(cliaddr);
448 connfd = accept(s, (struct sockaddr *)&cliaddr,
449 &len);
450 if (connfd == -1) {
451 /* For now, all errnos are fatal */
452 err(1, "accept");
453 }
454 if (vflag)
455 report_connect((struct sockaddr *)&cliaddr, len);
456
457 readwrite(connfd);
458 close(connfd);
459 }
460
461 if (family != AF_UNIX)
462 close(s);
463 else if (uflag) {
464 if (connect(s, NULL, 0) < 0)
465 err(1, "connect");
466 }
467
468 if (!kflag)
469 break;
470 }
471 } else if (family == AF_UNIX) {
472 ret = 0;
473
474 if ((s = unix_connect(host)) > 0 && !zflag) {
475 readwrite(s);
476 close(s);
477 } else
478 ret = 1;
479
480 if (uflag)
481 unlink(unix_dg_tmp_socket);
482 exit(ret);
483
484 } else {
485 int i = 0;
486
487 /* Construct the portlist[] array. */
488 build_ports(uport);
489
490 /* Cycle through portlist, connecting to each port. */
491 for (i = 0; portlist[i] != NULL; i++) {
492 if (s)
493 close(s);
494
495 if (xflag)
496 s = socks_connect(host, portlist[i], hints,
497 proxyhost, proxyport, proxyhints, socksv,
498 Pflag);
499 else
500 s = remote_connect(host, portlist[i], hints);
501
502 if (s < 0)
503 continue;
504
505 ret = 0;
506 if (vflag || zflag) {
507 /* For UDP, make sure we are connected. */
508 if (uflag) {
509 if (udptest(s) == -1) {
510 ret = 1;
511 continue;
512 }
513 }
514
515 /* Don't look up port if -n. */
516 if (nflag)
517 sv = NULL;
518 else {
519 sv = getservbyport(
520 ntohs(atoi(portlist[i])),
521 uflag ? "udp" : "tcp");
522 }
523
524 fprintf(stderr,
525 "Connection to %s %s port [%s/%s] "
526 "succeeded!\n", host, portlist[i],
527 uflag ? "udp" : "tcp",
528 sv ? sv->s_name : "*");
529 }
530 if (Fflag)
531 fdpass(s);
532 else if (!zflag)
533 readwrite(s);
534 }
535 }
536
537 if (s)
538 close(s);
539
540 exit(ret);
541}
542
543/*
544 * unix_bind()
545 * Returns a unix socket bound to the given path
546 */
547int
548unix_bind(char *path)
549{
550 struct sockaddr_un sun_sa;
551 int s;
552
553 /* Create unix domain socket. */
554 if ((s = socket(AF_UNIX, uflag ? SOCK_DGRAM : SOCK_STREAM,
555 0)) < 0)
556 return (-1);
557
558 memset(&sun_sa, 0, sizeof(struct sockaddr_un));
559 sun_sa.sun_family = AF_UNIX;
560
561 if (strlcpy(sun_sa.sun_path, path, sizeof(sun_sa.sun_path)) >=
562 sizeof(sun_sa.sun_path)) {
563 close(s);
564 errno = ENAMETOOLONG;
565 return (-1);
566 }
567
568 if (bind(s, (struct sockaddr *)&sun_sa, SUN_LEN(&sun_sa)) < 0) {
569 close(s);
570 return (-1);
571 }
572 return (s);
573}
574
575/*
576 * unix_connect()
577 * Returns a socket connected to a local unix socket. Returns -1 on failure.
578 */
579int
580unix_connect(char *path)
581{
582 struct sockaddr_un sun_sa;
583 int s;
584
585 if (uflag) {
586 if ((s = unix_bind(unix_dg_tmp_socket)) < 0)
587 return (-1);
588 } else {
589 if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
590 return (-1);
591 }
592 (void)fcntl(s, F_SETFD, FD_CLOEXEC);
593
594 memset(&sun_sa, 0, sizeof(struct sockaddr_un));
595 sun_sa.sun_family = AF_UNIX;
596
597 if (strlcpy(sun_sa.sun_path, path, sizeof(sun_sa.sun_path)) >=
598 sizeof(sun_sa.sun_path)) {
599 close(s);
600 errno = ENAMETOOLONG;
601 return (-1);
602 }
603 if (connect(s, (struct sockaddr *)&sun_sa, SUN_LEN(&sun_sa)) < 0) {
604 close(s);
605 return (-1);
606 }
607 return (s);
608
609}
610
611/*
612 * unix_listen()
613 * Create a unix domain socket, and listen on it.
614 */
615int
616unix_listen(char *path)
617{
618 int s;
619 if ((s = unix_bind(path)) < 0)
620 return (-1);
621
622 if (listen(s, 5) < 0) {
623 close(s);
624 return (-1);
625 }
626 return (s);
627}
628
629/*
630 * remote_connect()
631 * Returns a socket connected to a remote host. Properly binds to a local
632 * port or source address if needed. Returns -1 on failure.
633 */
634int
635remote_connect(const char *host, const char *port, struct addrinfo hints)
636{
637 struct addrinfo *res, *res0;
638 int s, error;
639#if defined(SO_RTABLE) || defined(SO_BINDANY)
640 int on = 1;
641#endif
642
643 if ((error = getaddrinfo(host, port, &hints, &res)))
644 errx(1, "getaddrinfo: %s", gai_strerror(error));
645
646 res0 = res;
647 do {
648 if ((s = socket(res0->ai_family, res0->ai_socktype,
649 res0->ai_protocol)) < 0)
650 continue;
651
652#ifdef SO_RTABLE
653 if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE,
654 &rtableid, sizeof(rtableid)) == -1))
655 err(1, "setsockopt SO_RTABLE");
656#endif
657 /* Bind to a local port or source address if specified. */
658 if (sflag || pflag) {
659 struct addrinfo ahints, *ares;
660
661#ifdef SO_BINDANY
662 /* try SO_BINDANY, but don't insist */
663 setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
664#endif
665 memset(&ahints, 0, sizeof(struct addrinfo));
666 ahints.ai_family = res0->ai_family;
667 ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
668 ahints.ai_protocol = uflag ? IPPROTO_UDP : IPPROTO_TCP;
669 ahints.ai_flags = AI_PASSIVE;
670 if ((error = getaddrinfo(sflag, pflag, &ahints, &ares)))
671 errx(1, "getaddrinfo: %s", gai_strerror(error));
672
673 if (bind(s, (struct sockaddr *)ares->ai_addr,
674 ares->ai_addrlen) < 0)
675 err(1, "bind failed");
676 freeaddrinfo(ares);
677 }
678
679 set_common_sockopts(s);
680
681 if (timeout_connect(s, res0->ai_addr, res0->ai_addrlen) == 0)
682 break;
683 else if (vflag)
684 warn("connect to %s port %s (%s) failed", host, port,
685 uflag ? "udp" : "tcp");
686
687 close(s);
688 s = -1;
689 } while ((res0 = res0->ai_next) != NULL);
690
691 freeaddrinfo(res);
692
693 return (s);
694}
695
696int
697timeout_connect(int s, const struct sockaddr *name, socklen_t namelen)
698{
699 struct pollfd pfd;
700 socklen_t optlen;
701 int flags = 0, optval;
702 int ret;
703
704 if (timeout != -1) {
705 flags = fcntl(s, F_GETFL, 0);
706 if (fcntl(s, F_SETFL, flags | O_NONBLOCK) == -1)
707 err(1, "set non-blocking mode");
708 }
709
710 if ((ret = connect(s, name, namelen)) != 0 && errno == EINPROGRESS) {
711 pfd.fd = s;
712 pfd.events = POLLOUT;
713 if ((ret = poll(&pfd, 1, timeout)) == 1) {
714 optlen = sizeof(optval);
715 if ((ret = getsockopt(s, SOL_SOCKET, SO_ERROR,
716 &optval, &optlen)) == 0) {
717 errno = optval;
718 ret = optval == 0 ? 0 : -1;
719 }
720 } else if (ret == 0) {
721 errno = ETIMEDOUT;
722 ret = -1;
723 } else
724 err(1, "poll failed");
725 }
726
727 if (timeout != -1 && fcntl(s, F_SETFL, flags) == -1)
728 err(1, "restoring flags");
729
730 return (ret);
731}
732
733/*
734 * local_listen()
735 * Returns a socket listening on a local port, binds to specified source
736 * address. Returns -1 on failure.
737 */
738int
739local_listen(char *host, char *port, struct addrinfo hints)
740{
741 struct addrinfo *res, *res0;
742 int s, ret, x = 1;
743 int error;
744
745 /* Allow nodename to be null. */
746 hints.ai_flags |= AI_PASSIVE;
747
748 /*
749 * In the case of binding to a wildcard address
750 * default to binding to an ipv4 address.
751 */
752 if (host == NULL && hints.ai_family == AF_UNSPEC)
753 hints.ai_family = AF_INET;
754
755 if ((error = getaddrinfo(host, port, &hints, &res)))
756 errx(1, "getaddrinfo: %s", gai_strerror(error));
757
758 res0 = res;
759 do {
760 if ((s = socket(res0->ai_family, res0->ai_socktype,
761 res0->ai_protocol)) < 0)
762 continue;
763
764#ifdef SO_RTABLE
765 if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE,
766 &rtableid, sizeof(rtableid)) == -1))
767 err(1, "setsockopt SO_RTABLE");
768#endif
769#ifdef SO_REUSEPORT
770 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
771 if (ret == -1)
772 err(1, "setsockopt");
773#endif
774 set_common_sockopts(s);
775
776 if (bind(s, (struct sockaddr *)res0->ai_addr,
777 res0->ai_addrlen) == 0)
778 break;
779
780 close(s);
781 s = -1;
782 } while ((res0 = res0->ai_next) != NULL);
783
784 if (!uflag && s != -1) {
785 if (listen(s, 1) < 0)
786 err(1, "listen");
787 }
788
789 freeaddrinfo(res);
790
791 return (s);
792}
793
794/*
795 * readwrite()
796 * Loop that polls on the network file descriptor and stdin.
797 */
798void
799readwrite(int net_fd)
800{
801 struct pollfd pfd[4];
802 int stdin_fd = STDIN_FILENO;
803 int stdout_fd = STDOUT_FILENO;
804 unsigned char netinbuf[BUFSIZE];
805 size_t netinbufpos = 0;
806 unsigned char stdinbuf[BUFSIZE];
807 size_t stdinbufpos = 0;
808 int n, num_fds;
809 ssize_t ret;
810
811 /* don't read from stdin if requested */
812 if (dflag)
813 stdin_fd = -1;
814
815 /* stdin */
816 pfd[POLL_STDIN].fd = stdin_fd;
817 pfd[POLL_STDIN].events = POLLIN;
818
819 /* network out */
820 pfd[POLL_NETOUT].fd = net_fd;
821 pfd[POLL_NETOUT].events = 0;
822
823 /* network in */
824 pfd[POLL_NETIN].fd = net_fd;
825 pfd[POLL_NETIN].events = POLLIN;
826
827 /* stdout */
828 pfd[POLL_STDOUT].fd = stdout_fd;
829 pfd[POLL_STDOUT].events = 0;
830
831 while (1) {
832 /* both inputs are gone, buffers are empty, we are done */
833 if (pfd[POLL_STDIN].fd == -1 && pfd[POLL_NETIN].fd == -1
834 && stdinbufpos == 0 && netinbufpos == 0) {
835 close(net_fd);
836 return;
837 }
838 /* both outputs are gone, we can't continue */
839 if (pfd[POLL_NETOUT].fd == -1 && pfd[POLL_STDOUT].fd == -1) {
840 close(net_fd);
841 return;
842 }
843 /* listen and net in gone, queues empty, done */
844 if (lflag && pfd[POLL_NETIN].fd == -1
845 && stdinbufpos == 0 && netinbufpos == 0) {
846 close(net_fd);
847 return;
848 }
849
850 /* help says -i is for "wait between lines sent". We read and
851 * write arbitrary amounts of data, and we don't want to start
852 * scanning for newlines, so this is as good as it gets */
853 if (iflag)
854 sleep(iflag);
855
856 /* poll */
857 num_fds = poll(pfd, 4, timeout);
858
859 /* treat poll errors */
860 if (num_fds == -1) {
861 close(net_fd);
862 err(1, "polling error");
863 }
864
865 /* timeout happened */
866 if (num_fds == 0)
867 return;
868
869 /* treat socket error conditions */
870 for (n = 0; n < 4; n++) {
871 if (pfd[n].revents & (POLLERR|POLLNVAL)) {
872 pfd[n].fd = -1;
873 }
874 }
875 /* reading is possible after HUP */
876 if (pfd[POLL_STDIN].events & POLLIN &&
877 pfd[POLL_STDIN].revents & POLLHUP &&
878 ! (pfd[POLL_STDIN].revents & POLLIN))
879 pfd[POLL_STDIN].fd = -1;
880
881 if (pfd[POLL_NETIN].events & POLLIN &&
882 pfd[POLL_NETIN].revents & POLLHUP &&
883 ! (pfd[POLL_NETIN].revents & POLLIN))
884 pfd[POLL_NETIN].fd = -1;
885
886 if (pfd[POLL_NETOUT].revents & POLLHUP) {
887 if (Nflag)
888 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR);
889 pfd[POLL_NETOUT].fd = -1;
890 }
891 /* if HUP, stop watching stdout */
892 if (pfd[POLL_STDOUT].revents & POLLHUP)
893 pfd[POLL_STDOUT].fd = -1;
894 /* if no net out, stop watching stdin */
895 if (pfd[POLL_NETOUT].fd == -1)
896 pfd[POLL_STDIN].fd = -1;
897 /* if no stdout, stop watching net in */
898 if (pfd[POLL_STDOUT].fd == -1) {
899 if (pfd[POLL_NETIN].fd != -1)
900 shutdown(pfd[POLL_NETIN].fd, SHUT_RD);
901 pfd[POLL_NETIN].fd = -1;
902 }
903
904 /* try to read from stdin */
905 if (pfd[POLL_STDIN].revents & POLLIN && stdinbufpos < BUFSIZE) {
906 ret = fillbuf(pfd[POLL_STDIN].fd, stdinbuf,
907 &stdinbufpos);
908 /* error or eof on stdin - remove from pfd */
909 if (ret == 0 || ret == -1)
910 pfd[POLL_STDIN].fd = -1;
911 /* read something - poll net out */
912 if (stdinbufpos > 0)
913 pfd[POLL_NETOUT].events = POLLOUT;
914 /* filled buffer - remove self from polling */
915 if (stdinbufpos == BUFSIZE)
916 pfd[POLL_STDIN].events = 0;
917 }
918 /* try to write to network */
919 if (pfd[POLL_NETOUT].revents & POLLOUT && stdinbufpos > 0) {
920 ret = drainbuf(pfd[POLL_NETOUT].fd, stdinbuf,
921 &stdinbufpos);
922 if (ret == -1)
923 pfd[POLL_NETOUT].fd = -1;
924 /* buffer empty - remove self from polling */
925 if (stdinbufpos == 0)
926 pfd[POLL_NETOUT].events = 0;
927 /* buffer no longer full - poll stdin again */
928 if (stdinbufpos < BUFSIZE)
929 pfd[POLL_STDIN].events = POLLIN;
930 }
931 /* try to read from network */
932 if (pfd[POLL_NETIN].revents & POLLIN && netinbufpos < BUFSIZE) {
933 ret = fillbuf(pfd[POLL_NETIN].fd, netinbuf,
934 &netinbufpos);
935 if (ret == -1)
936 pfd[POLL_NETIN].fd = -1;
937 /* eof on net in - remove from pfd */
938 if (ret == 0) {
939 shutdown(pfd[POLL_NETIN].fd, SHUT_RD);
940 pfd[POLL_NETIN].fd = -1;
941 }
942 /* read something - poll stdout */
943 if (netinbufpos > 0)
944 pfd[POLL_STDOUT].events = POLLOUT;
945 /* filled buffer - remove self from polling */
946 if (netinbufpos == BUFSIZE)
947 pfd[POLL_NETIN].events = 0;
948 /* handle telnet */
949 if (tflag)
950 atelnet(pfd[POLL_NETIN].fd, netinbuf,
951 netinbufpos);
952 }
953 /* try to write to stdout */
954 if (pfd[POLL_STDOUT].revents & POLLOUT && netinbufpos > 0) {
955 ret = drainbuf(pfd[POLL_STDOUT].fd, netinbuf,
956 &netinbufpos);
957 if (ret == -1)
958 pfd[POLL_STDOUT].fd = -1;
959 /* buffer empty - remove self from polling */
960 if (netinbufpos == 0)
961 pfd[POLL_STDOUT].events = 0;
962 /* buffer no longer full - poll net in again */
963 if (netinbufpos < BUFSIZE)
964 pfd[POLL_NETIN].events = POLLIN;
965 }
966
967 /* stdin gone and queue empty? */
968 if (pfd[POLL_STDIN].fd == -1 && stdinbufpos == 0) {
969 if (pfd[POLL_NETOUT].fd != -1 && Nflag)
970 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR);
971 pfd[POLL_NETOUT].fd = -1;
972 }
973 /* net in gone and queue empty? */
974 if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) {
975 pfd[POLL_STDOUT].fd = -1;
976 }
977 }
978}
979
980ssize_t
981drainbuf(int fd, unsigned char *buf, size_t *bufpos)
982{
983 ssize_t n;
984 ssize_t adjust;
985
986 n = write(fd, buf, *bufpos);
987 /* don't treat EAGAIN, EINTR as error */
988 if (n == -1 && (errno == EAGAIN || errno == EINTR))
989 n = -2;
990 if (n <= 0)
991 return n;
992 /* adjust buffer */
993 adjust = *bufpos - n;
994 if (adjust > 0)
995 memmove(buf, buf + n, adjust);
996 *bufpos -= n;
997 return n;
998}
999
1000
1001ssize_t
1002fillbuf(int fd, unsigned char *buf, size_t *bufpos)
1003{
1004 size_t num = BUFSIZE - *bufpos;
1005 ssize_t n;
1006
1007 n = read(fd, buf + *bufpos, num);
1008 /* don't treat EAGAIN, EINTR as error */
1009 if (n == -1 && (errno == EAGAIN || errno == EINTR))
1010 n = -2;
1011 if (n <= 0)
1012 return n;
1013 *bufpos += n;
1014 return n;
1015}
1016
1017/*
1018 * fdpass()
1019 * Pass the connected file descriptor to stdout and exit.
1020 */
1021void
1022fdpass(int nfd)
1023{
1024#if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
1025 struct msghdr msg;
1026#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
1027 union {
1028 struct cmsghdr hdr;
1029 char buf[CMSG_SPACE(sizeof(int))];
1030 } cmsgbuf;
1031 struct cmsghdr *cmsg;
1032#endif
1033 struct iovec vec;
1034 char ch = '\0';
1035 struct pollfd pfd;
1036 ssize_t r;
1037
1038 memset(&msg, 0, sizeof(msg));
1039#ifdef HAVE_ACCRIGHTS_IN_MSGHDR
1040 msg.msg_accrights = (caddr_t)&nfd;
1041 msg.msg_accrightslen = sizeof(nfd);
1042#else
1043 memset(&cmsgbuf, 0, sizeof(cmsgbuf));
1044 msg.msg_control = (caddr_t)&cmsgbuf.buf;
1045 msg.msg_controllen = sizeof(cmsgbuf.buf);
1046 cmsg = CMSG_FIRSTHDR(&msg);
1047 cmsg->cmsg_len = CMSG_LEN(sizeof(int));
1048 cmsg->cmsg_level = SOL_SOCKET;
1049 cmsg->cmsg_type = SCM_RIGHTS;
1050 *(int *)CMSG_DATA(cmsg) = nfd;
1051#endif
1052
1053 vec.iov_base = &ch;
1054 vec.iov_len = 1;
1055 msg.msg_iov = &vec;
1056 msg.msg_iovlen = 1;
1057
1058 bzero(&pfd, sizeof(pfd));
1059 pfd.fd = STDOUT_FILENO;
1060 for (;;) {
1061 r = sendmsg(STDOUT_FILENO, &msg, 0);
1062 if (r == -1) {
1063 if (errno == EAGAIN || errno == EINTR) {
1064 pfd.events = POLLOUT;
1065 if (poll(&pfd, 1, -1) == -1)
1066 err(1, "poll");
1067 continue;
1068 }
1069 err(1, "sendmsg");
1070 } else if (r == -1)
1071 errx(1, "sendmsg: unexpected return value %zd", r);
1072 else
1073 break;
1074 }
1075 exit(0);
1076#else
1077 errx(1, "%s: file descriptor passing not supported", __func__);
1078#endif
1079}
1080
1081/* Deal with RFC 854 WILL/WONT DO/DONT negotiation. */
1082void
1083atelnet(int nfd, unsigned char *buf, unsigned int size)
1084{
1085 unsigned char *p, *end;
1086 unsigned char obuf[4];
1087
1088 if (size < 3)
1089 return;
1090 end = buf + size - 2;
1091
1092 for (p = buf; p < end; p++) {
1093 if (*p != IAC)
1094 continue;
1095
1096 obuf[0] = IAC;
1097 p++;
1098 if ((*p == WILL) || (*p == WONT))
1099 obuf[1] = DONT;
1100 else if ((*p == DO) || (*p == DONT))
1101 obuf[1] = WONT;
1102 else
1103 continue;
1104
1105 p++;
1106 obuf[2] = *p;
1107 if (atomicio(vwrite, nfd, obuf, 3) != 3)
1108 warn("Write Error!");
1109 }
1110}
1111
1112/*
1113 * build_ports()
1114 * Build an array of ports in portlist[], listing each port
1115 * that we should try to connect to.
1116 */
1117void
1118build_ports(char *p)
1119{
1120 const char *errstr;
1121 char *n;
1122 int hi, lo, cp;
1123 int x = 0;
1124
1125 if ((n = strchr(p, '-')) != NULL) {
1126 *n = '\0';
1127 n++;
1128
1129 /* Make sure the ports are in order: lowest->highest. */
1130 hi = strtonum(n, 1, PORT_MAX, &errstr);
1131 if (errstr)
1132 errx(1, "port number %s: %s", errstr, n);
1133 lo = strtonum(p, 1, PORT_MAX, &errstr);
1134 if (errstr)
1135 errx(1, "port number %s: %s", errstr, p);
1136
1137 if (lo > hi) {
1138 cp = hi;
1139 hi = lo;
1140 lo = cp;
1141 }
1142
1143 /* Load ports sequentially. */
1144 for (cp = lo; cp <= hi; cp++) {
1145 portlist[x] = calloc(1, PORT_MAX_LEN);
1146 if (portlist[x] == NULL)
1147 errx(1, "calloc");
1148 snprintf(portlist[x], PORT_MAX_LEN, "%d", cp);
1149 x++;
1150 }
1151
1152 /* Randomly swap ports. */
1153 if (rflag) {
1154 int y;
1155 char *c;
1156
1157 for (x = 0; x <= (hi - lo); x++) {
1158 y = (arc4random() & 0xFFFF) % (hi - lo);
1159 c = portlist[x];
1160 portlist[x] = portlist[y];
1161 portlist[y] = c;
1162 }
1163 }
1164 } else {
1165 hi = strtonum(p, 1, PORT_MAX, &errstr);
1166 if (errstr)
1167 errx(1, "port number %s: %s", errstr, p);
1168 portlist[0] = strdup(p);
1169 if (portlist[0] == NULL)
1170 errx(1, "strdup");
1171 }
1172}
1173
1174/*
1175 * udptest()
1176 * Do a few writes to see if the UDP port is there.
1177 * Fails once PF state table is full.
1178 */
1179int
1180udptest(int s)
1181{
1182 int i, ret;
1183
1184 for (i = 0; i <= 3; i++) {
1185 if (write(s, "X", 1) == 1)
1186 ret = 1;
1187 else
1188 ret = -1;
1189 }
1190 return (ret);
1191}
1192
1193void
1194set_common_sockopts(int s)
1195{
1196 int x = 1;
1197
1198#ifdef TCP_MD5SIG
1199 if (Sflag) {
1200 if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
1201 &x, sizeof(x)) == -1)
1202 err(1, "setsockopt");
1203 }
1204#endif
1205 if (Dflag) {
1206 if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
1207 &x, sizeof(x)) == -1)
1208 err(1, "setsockopt");
1209 }
1210 if (Tflag != -1) {
1211 if (setsockopt(s, IPPROTO_IP, IP_TOS,
1212 &Tflag, sizeof(Tflag)) == -1)
1213 err(1, "set IP ToS");
1214 }
1215 if (Iflag) {
1216 if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
1217 &Iflag, sizeof(Iflag)) == -1)
1218 err(1, "set TCP receive buffer size");
1219 }
1220 if (Oflag) {
1221 if (setsockopt(s, SOL_SOCKET, SO_SNDBUF,
1222 &Oflag, sizeof(Oflag)) == -1)
1223 err(1, "set TCP send buffer size");
1224 }
1225}
1226
1227int
1228map_tos(char *s, int *val)
1229{
1230 /* DiffServ Codepoints and other TOS mappings */
1231 const struct toskeywords {
1232 const char *keyword;
1233 int val;
1234 } *t, toskeywords[] = {
1235 { "af11", IPTOS_DSCP_AF11 },
1236 { "af12", IPTOS_DSCP_AF12 },
1237 { "af13", IPTOS_DSCP_AF13 },
1238 { "af21", IPTOS_DSCP_AF21 },
1239 { "af22", IPTOS_DSCP_AF22 },
1240 { "af23", IPTOS_DSCP_AF23 },
1241 { "af31", IPTOS_DSCP_AF31 },
1242 { "af32", IPTOS_DSCP_AF32 },
1243 { "af33", IPTOS_DSCP_AF33 },
1244 { "af41", IPTOS_DSCP_AF41 },
1245 { "af42", IPTOS_DSCP_AF42 },
1246 { "af43", IPTOS_DSCP_AF43 },
1247 { "critical", IPTOS_PREC_CRITIC_ECP },
1248 { "cs0", IPTOS_DSCP_CS0 },
1249 { "cs1", IPTOS_DSCP_CS1 },
1250 { "cs2", IPTOS_DSCP_CS2 },
1251 { "cs3", IPTOS_DSCP_CS3 },
1252 { "cs4", IPTOS_DSCP_CS4 },
1253 { "cs5", IPTOS_DSCP_CS5 },
1254 { "cs6", IPTOS_DSCP_CS6 },
1255 { "cs7", IPTOS_DSCP_CS7 },
1256 { "ef", IPTOS_DSCP_EF },
1257 { "inetcontrol", IPTOS_PREC_INTERNETCONTROL },
1258 { "lowdelay", IPTOS_LOWDELAY },
1259 { "netcontrol", IPTOS_PREC_NETCONTROL },
1260 { "reliability", IPTOS_RELIABILITY },
1261 { "throughput", IPTOS_THROUGHPUT },
1262 { NULL, -1 },
1263 };
1264
1265 for (t = toskeywords; t->keyword != NULL; t++) {
1266 if (strcmp(s, t->keyword) == 0) {
1267 *val = t->val;
1268 return (1);
1269 }
1270 }
1271
1272 return (0);
1273}
1274
1275void
1276report_connect(const struct sockaddr *sa, socklen_t salen)
1277{
1278 char remote_host[NI_MAXHOST];
1279 char remote_port[NI_MAXSERV];
1280 int herr;
1281 int flags = NI_NUMERICSERV;
1282
1283 if (nflag)
1284 flags |= NI_NUMERICHOST;
1285
1286 if ((herr = getnameinfo(sa, salen,
1287 remote_host, sizeof(remote_host),
1288 remote_port, sizeof(remote_port),
1289 flags)) != 0) {
1290 if (herr == EAI_SYSTEM)
1291 err(1, "getnameinfo");
1292 else
1293 errx(1, "getnameinfo: %s", gai_strerror(herr));
1294 }
1295
1296 fprintf(stderr,
1297 "Connection from %s %s "
1298 "received!\n", remote_host, remote_port);
1299}
1300
1301void
1302help(void)
1303{
1304 usage(0);
1305 fprintf(stderr, "\tCommand Summary:\n\
1306 \t-4 Use IPv4\n\
1307 \t-6 Use IPv6\n\
1308 \t-D Enable the debug socket option\n\
1309 \t-d Detach from stdin\n\
1310 \t-F Pass socket fd\n\
1311 \t-h This help text\n\
1312 \t-I length TCP receive buffer length\n\
1313 \t-i secs\t Delay interval for lines sent, ports scanned\n\
1314 \t-k Keep inbound sockets open for multiple connects\n\
1315 \t-l Listen mode, for inbound connects\n\
1316 \t-N Shutdown the network socket after EOF on stdin\n\
1317 \t-n Suppress name/port resolutions\n\
1318 \t-O length TCP send buffer length\n\
1319 \t-P proxyuser\tUsername for proxy authentication\n\
1320 \t-p port\t Specify local port for remote connects\n\
1321 \t-r Randomize remote ports\n\
1322 \t-S Enable the TCP MD5 signature option\n\
1323 \t-s addr\t Local source address\n\
1324 \t-T toskeyword\tSet IP Type of Service\n\
1325 \t-t Answer TELNET negotiation\n\
1326 \t-U Use UNIX domain socket\n\
1327 \t-u UDP mode\n\
1328 \t-V rtable Specify alternate routing table\n\
1329 \t-v Verbose\n\
1330 \t-w secs\t Timeout for connects and final net reads\n\
1331 \t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\
1332 \t-x addr[:port]\tSpecify proxy address and port\n\
1333 \t-z Zero-I/O mode [used for scanning]\n\
1334 Port numbers can be individual or ranges: lo-hi [inclusive]\n");
1335 exit(1);
1336}
1337
1338void
1339usage(int ret)
1340{
1341 fprintf(stderr,
1342 "usage: nc [-46DdFhklNnrStUuvz] [-I length] [-i interval] [-O length]\n"
1343 "\t [-P proxy_username] [-p source_port] [-s source] [-T ToS]\n"
1344 "\t [-V rtable] [-w timeout] [-X proxy_protocol]\n"
1345 "\t [-x proxy_address[:port]] [destination] [port]\n");
1346 if (ret)
1347 exit(1);
1348}
1349
1350/* *** src/usr.bin/nc/socks.c *** */
1351
1352
1353/* $OpenBSD: socks.c,v 1.20 2012/03/08 09:56:28 espie Exp $ */
1354
1355/*
1356 * Copyright (c) 1999 Niklas Hallqvist. All rights reserved.
1357 * Copyright (c) 2004, 2005 Damien Miller. All rights reserved.
1358 *
1359 * Redistribution and use in source and binary forms, with or without
1360 * modification, are permitted provided that the following conditions
1361 * are met:
1362 * 1. Redistributions of source code must retain the above copyright
1363 * notice, this list of conditions and the following disclaimer.
1364 * 2. Redistributions in binary form must reproduce the above copyright
1365 * notice, this list of conditions and the following disclaimer in the
1366 * documentation and/or other materials provided with the distribution.
1367 *
1368 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1369 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1370 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1371 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1372 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1373 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1374 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1375 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1376 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1377 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1378 */
1379
1380#include <sys/types.h>
1381#include <sys/socket.h>
1382#include <netinet/in.h>
1383#include <arpa/inet.h>
1384
1385#include <errno.h>
1386#include <netdb.h>
1387#include <stdio.h>
1388#include <stdlib.h>
1389#include <string.h>
1390#include <unistd.h>
1391#include <resolv.h>
1392
1393#define SOCKS_PORT "1080"
1394#define HTTP_PROXY_PORT "3128"
1395#define HTTP_MAXHDRS 64
1396#define SOCKS_V5 5
1397#define SOCKS_V4 4
1398#define SOCKS_NOAUTH 0
1399#define SOCKS_NOMETHOD 0xff
1400#define SOCKS_CONNECT 1
1401#define SOCKS_IPV4 1
1402#define SOCKS_DOMAIN 3
1403#define SOCKS_IPV6 4
1404
1405int remote_connect(const char *, const char *, struct addrinfo);
1406int socks_connect(const char *, const char *, struct addrinfo,
1407 const char *, const char *, struct addrinfo, int,
1408 const char *);
1409
1410static int
1411decode_addrport(const char *h, const char *p, struct sockaddr *addr,
1412 socklen_t addrlen, int v4only, int numeric)
1413{
1414 int r;
1415 struct addrinfo hints, *res;
1416
1417 bzero(&hints, sizeof(hints));
1418 hints.ai_family = v4only ? PF_INET : PF_UNSPEC;
1419 hints.ai_flags = numeric ? AI_NUMERICHOST : 0;
1420 hints.ai_socktype = SOCK_STREAM;
1421 r = getaddrinfo(h, p, &hints, &res);
1422 /* Don't fatal when attempting to convert a numeric address */
1423 if (r != 0) {
1424 if (!numeric) {
1425 errx(1, "getaddrinfo(\"%.64s\", \"%.64s\"): %s", h, p,
1426 gai_strerror(r));
1427 }
1428 return (-1);
1429 }
1430 if (addrlen < res->ai_addrlen) {
1431 freeaddrinfo(res);
1432 errx(1, "internal error: addrlen < res->ai_addrlen");
1433 }
1434 memcpy(addr, res->ai_addr, res->ai_addrlen);
1435 freeaddrinfo(res);
1436 return (0);
1437}
1438
1439static int
1440proxy_read_line(int fd, char *buf, size_t bufsz)
1441{
1442 size_t off;
1443
1444 for(off = 0;;) {
1445 if (off >= bufsz)
1446 errx(1, "proxy read too long");
1447 if (atomicio(read, fd, buf + off, 1) != 1)
1448 err(1, "proxy read");
1449 /* Skip CR */
1450 if (buf[off] == '\r')
1451 continue;
1452 if (buf[off] == '\n') {
1453 buf[off] = '\0';
1454 break;
1455 }
1456 off++;
1457 }
1458 return (off);
1459}
1460
1461static const char *
1462getproxypass(const char *proxyuser, const char *proxyhost)
1463{
1464 char prompt[512];
1465 static char pw[256];
1466
1467 snprintf(prompt, sizeof(prompt), "Proxy password for %s@%s: ",
1468 proxyuser, proxyhost);
1469 if (readpassphrase(prompt, pw, sizeof(pw), RPP_REQUIRE_TTY) == NULL)
1470 errx(1, "Unable to read proxy passphrase");
1471 return (pw);
1472}
1473
1474int
1475socks_connect(const char *host, const char *port,
1476 struct addrinfo hints __attribute__ ((__unused__)),
1477 const char *proxyhost, const char *proxyport, struct addrinfo proxyhints,
1478 int socksv, const char *proxyuser)
1479{
1480 int proxyfd, r, authretry = 0;
1481 size_t hlen, wlen = 0;
1482 unsigned char buf[1024];
1483 size_t cnt;
1484 struct sockaddr_storage addr;
1485 struct sockaddr_in *in4 = (struct sockaddr_in *)&addr;
1486 struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&addr;
1487 in_port_t serverport;
1488 const char *proxypass = NULL;
1489
1490 if (proxyport == NULL)
1491 proxyport = (socksv == -1) ? HTTP_PROXY_PORT : SOCKS_PORT;
1492
1493 /* Abuse API to lookup port */
1494 if (decode_addrport("0.0.0.0", port, (struct sockaddr *)&addr,
1495 sizeof(addr), 1, 1) == -1)
1496 errx(1, "unknown port \"%.64s\"", port);
1497 serverport = in4->sin_port;
1498
1499 again:
1500 if (authretry++ > 3)
1501 errx(1, "Too many authentication failures");
1502
1503 proxyfd = remote_connect(proxyhost, proxyport, proxyhints);
1504
1505 if (proxyfd < 0)
1506 return (-1);
1507
1508 if (socksv == 5) {
1509 if (decode_addrport(host, port, (struct sockaddr *)&addr,
1510 sizeof(addr), 0, 1) == -1)
1511 addr.ss_family = 0; /* used in switch below */
1512
1513 /* Version 5, one method: no authentication */
1514 buf[0] = SOCKS_V5;
1515 buf[1] = 1;
1516 buf[2] = SOCKS_NOAUTH;
1517 cnt = atomicio(vwrite, proxyfd, buf, 3);
1518 if (cnt != 3)
1519 err(1, "write failed (%zu/3)", cnt);
1520
1521 cnt = atomicio(read, proxyfd, buf, 2);
1522 if (cnt != 2)
1523 err(1, "read failed (%zu/3)", cnt);
1524
1525 if (buf[1] == SOCKS_NOMETHOD)
1526 errx(1, "authentication method negotiation failed");
1527
1528 switch (addr.ss_family) {
1529 case 0:
1530 /* Version 5, connect: domain name */
1531
1532 /* Max domain name length is 255 bytes */
1533 hlen = strlen(host);
1534 if (hlen > 255)
1535 errx(1, "host name too long for SOCKS5");
1536 buf[0] = SOCKS_V5;
1537 buf[1] = SOCKS_CONNECT;
1538 buf[2] = 0;
1539 buf[3] = SOCKS_DOMAIN;
1540 buf[4] = hlen;
1541 memcpy(buf + 5, host, hlen);
1542 memcpy(buf + 5 + hlen, &serverport, sizeof serverport);
1543 wlen = 7 + hlen;
1544 break;
1545 case AF_INET:
1546 /* Version 5, connect: IPv4 address */
1547 buf[0] = SOCKS_V5;
1548 buf[1] = SOCKS_CONNECT;
1549 buf[2] = 0;
1550 buf[3] = SOCKS_IPV4;
1551 memcpy(buf + 4, &in4->sin_addr, sizeof in4->sin_addr);
1552 memcpy(buf + 8, &in4->sin_port, sizeof in4->sin_port);
1553 wlen = 10;
1554 break;
1555 case AF_INET6:
1556 /* Version 5, connect: IPv6 address */
1557 buf[0] = SOCKS_V5;
1558 buf[1] = SOCKS_CONNECT;
1559 buf[2] = 0;
1560 buf[3] = SOCKS_IPV6;
1561 memcpy(buf + 4, &in6->sin6_addr, sizeof in6->sin6_addr);
1562 memcpy(buf + 20, &in6->sin6_port,
1563 sizeof in6->sin6_port);
1564 wlen = 22;
1565 break;
1566 default:
1567 errx(1, "internal error: silly AF");
1568 }
1569
1570 cnt = atomicio(vwrite, proxyfd, buf, wlen);
1571 if (cnt != wlen)
1572 err(1, "write failed (%zu/%zu)", cnt, wlen);
1573
1574 cnt = atomicio(read, proxyfd, buf, 4);
1575 if (cnt != 4)
1576 err(1, "read failed (%zu/4)", cnt);
1577 if (buf[1] != 0)
1578 errx(1, "connection failed, SOCKS error %d", buf[1]);
1579 switch (buf[3]) {
1580 case SOCKS_IPV4:
1581 cnt = atomicio(read, proxyfd, buf + 4, 6);
1582 if (cnt != 6)
1583 err(1, "read failed (%zu/6)", cnt);
1584 break;
1585 case SOCKS_IPV6:
1586 cnt = atomicio(read, proxyfd, buf + 4, 18);
1587 if (cnt != 18)
1588 err(1, "read failed (%zu/18)", cnt);
1589 break;
1590 default:
1591 errx(1, "connection failed, unsupported address type");
1592 }
1593 } else if (socksv == 4) {
1594 /* This will exit on lookup failure */
1595 decode_addrport(host, port, (struct sockaddr *)&addr,
1596 sizeof(addr), 1, 0);
1597
1598 /* Version 4 */
1599 buf[0] = SOCKS_V4;
1600 buf[1] = SOCKS_CONNECT; /* connect */
1601 memcpy(buf + 2, &in4->sin_port, sizeof in4->sin_port);
1602 memcpy(buf + 4, &in4->sin_addr, sizeof in4->sin_addr);
1603 buf[8] = 0; /* empty username */
1604 wlen = 9;
1605
1606 cnt = atomicio(vwrite, proxyfd, buf, wlen);
1607 if (cnt != wlen)
1608 err(1, "write failed (%zu/%zu)", cnt, wlen);
1609
1610 cnt = atomicio(read, proxyfd, buf, 8);
1611 if (cnt != 8)
1612 err(1, "read failed (%zu/8)", cnt);
1613 if (buf[1] != 90)
1614 errx(1, "connection failed, SOCKS error %d", buf[1]);
1615 } else if (socksv == -1) {
1616 /* HTTP proxy CONNECT */
1617
1618 /* Disallow bad chars in hostname */
1619 if (strcspn(host, "\r\n\t []:") != strlen(host))
1620 errx(1, "Invalid hostname");
1621
1622 /* Try to be sane about numeric IPv6 addresses */
1623 if (strchr(host, ':') != NULL) {
1624 r = snprintf(buf, sizeof(buf),
1625 "CONNECT [%s]:%d HTTP/1.0\r\n",
1626 host, ntohs(serverport));
1627 } else {
1628 r = snprintf(buf, sizeof(buf),
1629 "CONNECT %s:%d HTTP/1.0\r\n",
1630 host, ntohs(serverport));
1631 }
1632 if (r == -1 || (size_t)r >= sizeof(buf))
1633 errx(1, "hostname too long");
1634 r = strlen(buf);
1635
1636 cnt = atomicio(vwrite, proxyfd, buf, r);
1637 if (cnt != (size_t)r)
1638 err(1, "write failed (%zu/%d)", cnt, r);
1639
1640 if (authretry > 1) {
1641 char resp[1024];
1642
1643 proxypass = getproxypass(proxyuser, proxyhost);
1644 r = snprintf(buf, sizeof(buf), "%s:%s",
1645 proxyuser, proxypass);
1646 if (r == -1 || (size_t)r >= sizeof(buf) ||
1647 b64_ntop(buf, strlen(buf), resp,
1648 sizeof(resp)) == -1)
1649 errx(1, "Proxy username/password too long");
1650 r = snprintf(buf, sizeof(buf), "Proxy-Authorization: "
1651 "Basic %s\r\n", resp);
1652 if (r == -1 || (size_t)r >= sizeof(buf))
1653 errx(1, "Proxy auth response too long");
1654 r = strlen(buf);
1655 if ((cnt = atomicio(vwrite, proxyfd, buf, r)) != (size_t)r)
1656 err(1, "write failed (%zu/%d)", cnt, r);
1657 }
1658
1659 /* Terminate headers */
1660 if ((r = atomicio(vwrite, proxyfd, "\r\n", 2)) != 2)
1661 err(1, "write failed (2/%d)", r);
1662
1663 /* Read status reply */
1664 proxy_read_line(proxyfd, buf, sizeof(buf));
1665 if (proxyuser != NULL &&
1666 strncmp(buf, "HTTP/1.0 407 ", 12) == 0) {
1667 if (authretry > 1) {
1668 fprintf(stderr, "Proxy authentication "
1669 "failed\n");
1670 }
1671 close(proxyfd);
1672 goto again;
1673 } else if (strncmp(buf, "HTTP/1.0 200 ", 12) != 0 &&
1674 strncmp(buf, "HTTP/1.1 200 ", 12) != 0)
1675 errx(1, "Proxy error: \"%s\"", buf);
1676
1677 /* Headers continue until we hit an empty line */
1678 for (r = 0; r < HTTP_MAXHDRS; r++) {
1679 proxy_read_line(proxyfd, buf, sizeof(buf));
1680 if (*buf == '\0')
1681 break;
1682 }
1683 if (*buf != '\0')
1684 errx(1, "Too many proxy headers received");
1685 } else
1686 errx(1, "Unknown proxy protocol %d", socksv);
1687
1688 return (proxyfd);
1689}
1690
diff --git a/regress/proto-mismatch.sh b/regress/proto-mismatch.sh
index fb521f214..9e8024beb 100644
--- a/regress/proto-mismatch.sh
+++ b/regress/proto-mismatch.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: proto-mismatch.sh,v 1.3 2002/03/15 13:08:56 markus Exp $ 1# $OpenBSD: proto-mismatch.sh,v 1.4 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="protocol version mismatch" 4tid="protocol version mismatch"
@@ -16,4 +16,6 @@ mismatch ()
16} 16}
17 17
18mismatch 2 SSH-1.5-HALLO 18mismatch 2 SSH-1.5-HALLO
19mismatch 1 SSH-2.0-HALLO 19if ssh_version 1; then
20 mismatch 1 SSH-2.0-HALLO
21fi
diff --git a/regress/proto-version.sh b/regress/proto-version.sh
index b876dd7ec..cf4946115 100644
--- a/regress/proto-version.sh
+++ b/regress/proto-version.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: proto-version.sh,v 1.4 2013/05/17 00:37:40 dtucker Exp $ 1# $OpenBSD: proto-version.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sshd version with different protocol combinations" 4tid="sshd version with different protocol combinations"
@@ -28,7 +28,9 @@ check_version ()
28 fi 28 fi
29} 29}
30 30
31check_version 2,1 199
32check_version 1,2 199
33check_version 2 20 31check_version 2 20
34check_version 1 15 32if ssh_version 1; then
33 check_version 2,1 199
34 check_version 1,2 199
35 check_version 1 15
36fi
diff --git a/regress/proxy-connect.sh b/regress/proxy-connect.sh
index 023ba7367..f816962b5 100644
--- a/regress/proxy-connect.sh
+++ b/regress/proxy-connect.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: proxy-connect.sh,v 1.7 2014/05/03 18:46:14 dtucker Exp $ 1# $OpenBSD: proxy-connect.sh,v 1.8 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="proxy connect" 4tid="proxy connect"
@@ -9,7 +9,7 @@ for ps in no yes; do
9 cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy 9 cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
10 echo "UsePrivilegeSeparation $ps" >> $OBJ/sshd_proxy 10 echo "UsePrivilegeSeparation $ps" >> $OBJ/sshd_proxy
11 11
12 for p in 1 2; do 12 for p in ${SSH_PROTOCOLS}; do
13 for c in no yes; do 13 for c in no yes; do
14 verbose "plain username protocol $p privsep=$ps comp=$c" 14 verbose "plain username protocol $p privsep=$ps comp=$c"
15 opts="-$p -oCompression=$c -F $OBJ/ssh_proxy" 15 opts="-$p -oCompression=$c -F $OBJ/ssh_proxy"
@@ -24,7 +24,7 @@ for ps in no yes; do
24 done 24 done
25done 25done
26 26
27for p in 1 2; do 27for p in ${SSH_PROTOCOLS}; do
28 verbose "username with style protocol $p" 28 verbose "username with style protocol $p"
29 ${SSH} -$p -F $OBJ/ssh_proxy ${USER}:style@999.999.999.999 true || \ 29 ${SSH} -$p -F $OBJ/ssh_proxy ${USER}:style@999.999.999.999 true || \
30 fail "ssh proxyconnect protocol $p failed" 30 fail "ssh proxyconnect protocol $p failed"
diff --git a/regress/reconfigure.sh b/regress/reconfigure.sh
index 9fd289531..eecddd3c7 100644
--- a/regress/reconfigure.sh
+++ b/regress/reconfigure.sh
@@ -1,20 +1,30 @@
1# $OpenBSD: reconfigure.sh,v 1.2 2003/06/21 09:14:05 markus Exp $ 1# $OpenBSD: reconfigure.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="simple connect after reconfigure" 4tid="simple connect after reconfigure"
5 5
6# we need the full path to sshd for -HUP 6# we need the full path to sshd for -HUP
7case $SSHD in 7if test "x$USE_VALGRIND" = "x" ; then
8/*) 8 case $SSHD in
9 # full path is OK 9 /*)
10 ;; 10 # full path is OK
11*) 11 ;;
12 # otherwise make fully qualified 12 *)
13 SSHD=$OBJ/$SSHD 13 # otherwise make fully qualified
14esac 14 SSHD=$OBJ/$SSHD
15 esac
16fi
15 17
16start_sshd 18start_sshd
17 19
20trace "connect before restart"
21for p in ${SSH_PROTOCOLS} ; do
22 ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true
23 if [ $? -ne 0 ]; then
24 fail "ssh connect with protocol $p failed before reconfigure"
25 fi
26done
27
18PID=`$SUDO cat $PIDFILE` 28PID=`$SUDO cat $PIDFILE`
19rm -f $PIDFILE 29rm -f $PIDFILE
20$SUDO kill -HUP $PID 30$SUDO kill -HUP $PID
@@ -28,7 +38,8 @@ done
28 38
29test -f $PIDFILE || fatal "sshd did not restart" 39test -f $PIDFILE || fatal "sshd did not restart"
30 40
31for p in 1 2; do 41trace "connect after restart"
42for p in ${SSH_PROTOCOLS} ; do
32 ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true 43 ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true
33 if [ $? -ne 0 ]; then 44 if [ $? -ne 0 ]; then
34 fail "ssh connect with protocol $p failed after reconfigure" 45 fail "ssh connect with protocol $p failed after reconfigure"
diff --git a/regress/reexec.sh b/regress/reexec.sh
index 433573f06..5c0a7b46f 100644
--- a/regress/reexec.sh
+++ b/regress/reexec.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: reexec.sh,v 1.7 2013/05/17 10:23:52 dtucker Exp $ 1# $OpenBSD: reexec.sh,v 1.8 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="reexec tests" 4tid="reexec tests"
@@ -19,7 +19,7 @@ start_sshd_copy ()
19copy_tests () 19copy_tests ()
20{ 20{
21 rm -f ${COPY} 21 rm -f ${COPY}
22 for p in 1 2; do 22 for p in ${SSH_PROTOCOLS} ; do
23 verbose "$tid: proto $p" 23 verbose "$tid: proto $p"
24 ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \ 24 ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \
25 cat ${DATA} > ${COPY} 25 cat ${DATA} > ${COPY}
diff --git a/regress/rekey.sh b/regress/rekey.sh
index fd452b034..0d4444d03 100644
--- a/regress/rekey.sh
+++ b/regress/rekey.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: rekey.sh,v 1.15 2014/04/21 22:15:37 djm Exp $ 1# $OpenBSD: rekey.sh,v 1.16 2015/02/14 12:43:16 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="rekey" 4tid="rekey"
@@ -100,9 +100,29 @@ for s in 5 10; do
100 fi 100 fi
101done 101done
102 102
103echo "rekeylimit default 5" >>$OBJ/sshd_proxy 103for s in 16 1k 128k 256k; do
104 verbose "server rekeylimit ${s}"
105 cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
106 echo "rekeylimit ${s}" >>$OBJ/sshd_proxy
107 rm -f ${COPY} ${LOG}
108 ${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "cat ${DATA}" \
109 > ${COPY}
110 if [ $? -ne 0 ]; then
111 fail "ssh failed"
112 fi
113 cmp ${DATA} ${COPY} || fail "corrupted copy"
114 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
115 n=`expr $n - 1`
116 trace "$n rekeying(s)"
117 if [ $n -lt 1 ]; then
118 fail "no rekeying occured"
119 fi
120done
121
104for s in 5 10; do 122for s in 5 10; do
105 verbose "server rekeylimit default ${s} no data" 123 verbose "server rekeylimit default ${s} no data"
124 cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
125 echo "rekeylimit default ${s}" >>$OBJ/sshd_proxy
106 rm -f ${COPY} ${LOG} 126 rm -f ${COPY} ${LOG}
107 ${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "sleep $s;sleep 3" 127 ${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "sleep $s;sleep 3"
108 if [ $? -ne 0 ]; then 128 if [ $? -ne 0 ]; then
diff --git a/regress/sshd-log-wrapper.sh b/regress/sshd-log-wrapper.sh
index a9386be4d..c00934c78 100644
--- a/regress/sshd-log-wrapper.sh
+++ b/regress/sshd-log-wrapper.sh
@@ -3,11 +3,9 @@
3# Placed in the Public Domain. 3# Placed in the Public Domain.
4# 4#
5# simple wrapper for sshd proxy mode to catch stderr output 5# simple wrapper for sshd proxy mode to catch stderr output
6# sh sshd-log-wrapper.sh /path/to/sshd /path/to/logfile 6# sh sshd-log-wrapper.sh /path/to/logfile /path/to/sshd [args...]
7 7
8sshd=$1 8log=$1
9log=$2
10shift
11shift 9shift
12 10
13exec $sshd -E$log $@ 11exec "$@" -E$log
diff --git a/regress/stderr-data.sh b/regress/stderr-data.sh
index b0bd2355c..8c8149a73 100644
--- a/regress/stderr-data.sh
+++ b/regress/stderr-data.sh
@@ -1,10 +1,10 @@
1# $OpenBSD: stderr-data.sh,v 1.3 2013/05/17 04:29:14 dtucker Exp $ 1# $OpenBSD: stderr-data.sh,v 1.4 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="stderr data transfer" 4tid="stderr data transfer"
5 5
6for n in '' -n; do 6for n in '' -n; do
7for p in 1 2; do 7for p in ${SSH_PROTOCOLS}; do
8 verbose "test $tid: proto $p ($n)" 8 verbose "test $tid: proto $p ($n)"
9 ${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \ 9 ${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
10 exec sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \ 10 exec sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
diff --git a/regress/t11.ok b/regress/t11.ok
new file mode 100644
index 000000000..1925bb470
--- /dev/null
+++ b/regress/t11.ok
@@ -0,0 +1 @@
SHA256:4w1rnrek3klTJOTVhwuCIFd5k+pq9Bfo5KTxxb8BqbY
diff --git a/regress/t4.ok b/regress/t4.ok
index 8c4942bf1..4631ea8c7 100644
--- a/regress/t4.ok
+++ b/regress/t4.ok
@@ -1 +1 @@
3b:dd:44:e9:49:18:84:95:f1:e7:33:6b:9d:93:b1:36 MD5:3b:dd:44:e9:49:18:84:95:f1:e7:33:6b:9d:93:b1:36
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index a1bab832f..0f766620d 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: test-exec.sh,v 1.48 2014/07/06 07:42:03 djm Exp $ 1# $OpenBSD: test-exec.sh,v 1.51 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4#SUDO=sudo 4#SUDO=sudo
@@ -130,6 +130,11 @@ if [ "x$TEST_SSH_CONCH" != "x" ]; then
130 esac 130 esac
131fi 131fi
132 132
133SSH_PROTOCOLS=`$SSH -Q protocol-version`
134if [ "x$TEST_SSH_PROTOCOLS" != "x" ]; then
135 SSH_PROTOCOLS="${TEST_SSH_PROTOCOLS}"
136fi
137
133# Path to sshd must be absolute for rexec 138# Path to sshd must be absolute for rexec
134case "$SSHD" in 139case "$SSHD" in
135/*) ;; 140/*) ;;
@@ -141,6 +146,55 @@ case "$SSHAGENT" in
141*) SSHAGENT=`which $SSHAGENT` ;; 146*) SSHAGENT=`which $SSHAGENT` ;;
142esac 147esac
143 148
149# Record the actual binaries used.
150SSH_BIN=${SSH}
151SSHD_BIN=${SSHD}
152SSHAGENT_BIN=${SSHAGENT}
153SSHADD_BIN=${SSHADD}
154SSHKEYGEN_BIN=${SSHKEYGEN}
155SSHKEYSCAN_BIN=${SSHKEYSCAN}
156SFTP_BIN=${SFTP}
157SFTPSERVER_BIN=${SFTPSERVER}
158SCP_BIN=${SCP}
159
160if [ "x$USE_VALGRIND" != "x" ]; then
161 mkdir -p $OBJ/valgrind-out
162 VG_TEST=`basename $SCRIPT .sh`
163
164 # Some tests are difficult to fix.
165 case "$VG_TEST" in
166 connect-privsep|reexec)
167 VG_SKIP=1 ;;
168 esac
169
170 if [ x"$VG_SKIP" = "x" ]; then
171 VG_IGNORE="/bin/*,/sbin/*,/usr/*,/var/*"
172 VG_LOG="$OBJ/valgrind-out/${VG_TEST}."
173 VG_OPTS="--track-origins=yes --leak-check=full"
174 VG_OPTS="$VG_OPTS --trace-children=yes"
175 VG_OPTS="$VG_OPTS --trace-children-skip=${VG_IGNORE}"
176 VG_PATH="valgrind"
177 if [ "x$VALGRIND_PATH" != "x" ]; then
178 VG_PATH="$VALGRIND_PATH"
179 fi
180 VG="$VG_PATH $VG_OPTS"
181 SSH="$VG --log-file=${VG_LOG}ssh.%p $SSH"
182 SSHD="$VG --log-file=${VG_LOG}sshd.%p $SSHD"
183 SSHAGENT="$VG --log-file=${VG_LOG}ssh-agent.%p $SSHAGENT"
184 SSHADD="$VG --log-file=${VG_LOG}ssh-add.%p $SSHADD"
185 SSHKEYGEN="$VG --log-file=${VG_LOG}ssh-keygen.%p $SSHKEYGEN"
186 SSHKEYSCAN="$VG --log-file=${VG_LOG}ssh-keyscan.%p $SSHKEYSCAN"
187 SFTP="$VG --log-file=${VG_LOG}sftp.%p ${SFTP}"
188 SCP="$VG --log-file=${VG_LOG}scp.%p $SCP"
189 cat > $OBJ/valgrind-sftp-server.sh << EOF
190#!/bin/sh
191exec $VG --log-file=${VG_LOG}sftp-server.%p $SFTPSERVER "\$@"
192EOF
193 chmod a+rx $OBJ/valgrind-sftp-server.sh
194 SFTPSERVER="$OBJ/valgrind-sftp-server.sh"
195 fi
196fi
197
144# Logfiles. 198# Logfiles.
145# SSH_LOGFILE should be the debug output of ssh(1) only 199# SSH_LOGFILE should be the debug output of ssh(1) only
146# SSHD_LOGFILE should be the debug output of sshd(8) only 200# SSHD_LOGFILE should be the debug output of sshd(8) only
@@ -175,7 +229,7 @@ SSH="$SSHLOGWRAP"
175# [kbytes] to ensure the file is at least that large. 229# [kbytes] to ensure the file is at least that large.
176DATANAME=data 230DATANAME=data
177DATA=$OBJ/${DATANAME} 231DATA=$OBJ/${DATANAME}
178cat ${SSHAGENT} >${DATA} 232cat ${SSHAGENT_BIN} >${DATA}
179chmod u+w ${DATA} 233chmod u+w ${DATA}
180COPY=$OBJ/copy 234COPY=$OBJ/copy
181rm -f ${COPY} 235rm -f ${COPY}
@@ -183,7 +237,7 @@ rm -f ${COPY}
183increase_datafile_size() 237increase_datafile_size()
184{ 238{
185 while [ `du -k ${DATA} | cut -f1` -lt $1 ]; do 239 while [ `du -k ${DATA} | cut -f1` -lt $1 ]; do
186 cat ${SSHAGENT} >>${DATA} 240 cat ${SSHAGENT_BIN} >>${DATA}
187 done 241 done
188} 242}
189 243
@@ -325,16 +379,27 @@ fatal ()
325 exit $RESULT 379 exit $RESULT
326} 380}
327 381
382ssh_version ()
383{
384 echo ${SSH_PROTOCOLS} | grep "$1" >/dev/null
385}
386
328RESULT=0 387RESULT=0
329PIDFILE=$OBJ/pidfile 388PIDFILE=$OBJ/pidfile
330 389
331trap fatal 3 2 390trap fatal 3 2
332 391
392if ssh_version 1; then
393 PROTO="2,1"
394else
395 PROTO="2"
396fi
397
333# create server config 398# create server config
334cat << EOF > $OBJ/sshd_config 399cat << EOF > $OBJ/sshd_config
335 StrictModes no 400 StrictModes no
336 Port $PORT 401 Port $PORT
337 Protocol 2,1 402 Protocol $PROTO
338 AddressFamily inet 403 AddressFamily inet
339 ListenAddress 127.0.0.1 404 ListenAddress 127.0.0.1
340 #ListenAddress ::1 405 #ListenAddress ::1
@@ -360,7 +425,7 @@ echo 'StrictModes no' >> $OBJ/sshd_proxy
360# create client config 425# create client config
361cat << EOF > $OBJ/ssh_config 426cat << EOF > $OBJ/ssh_config
362Host * 427Host *
363 Protocol 2,1 428 Protocol $PROTO
364 Hostname 127.0.0.1 429 Hostname 127.0.0.1
365 HostKeyAlias localhost-with-alias 430 HostKeyAlias localhost-with-alias
366 Port $PORT 431 Port $PORT
@@ -385,10 +450,15 @@ fi
385 450
386rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER 451rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER
387 452
453if ssh_version 1; then
454 SSH_KEYTYPES="rsa rsa1"
455else
456 SSH_KEYTYPES="rsa ed25519"
457fi
388trace "generate keys" 458trace "generate keys"
389for t in rsa rsa1; do 459for t in ${SSH_KEYTYPES}; do
390 # generate user key 460 # generate user key
391 if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN} -nt $OBJ/$t ]; then 461 if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN_BIN} -nt $OBJ/$t ]; then
392 rm -f $OBJ/$t 462 rm -f $OBJ/$t
393 ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t ||\ 463 ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t ||\
394 fail "ssh-keygen for $t failed" 464 fail "ssh-keygen for $t failed"
@@ -451,7 +521,7 @@ if test "$REGRESS_INTEROP_PUTTY" = "yes" ; then
451 echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy 521 echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy
452 echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy 522 echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy
453 echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy 523 echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy
454 echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy 524 echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${TEST_SSHD_LOGFILE} ${SSHD} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy
455 525
456 REGRESS_INTEROP_PUTTY=yes 526 REGRESS_INTEROP_PUTTY=yes
457fi 527fi
@@ -459,7 +529,7 @@ fi
459# create a proxy version of the client config 529# create a proxy version of the client config
460( 530(
461 cat $OBJ/ssh_config 531 cat $OBJ/ssh_config
462 echo proxycommand ${SUDO} sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy 532 echo proxycommand ${SUDO} sh ${SRC}/sshd-log-wrapper.sh ${TEST_SSHD_LOGFILE} ${SSHD} -i -f $OBJ/sshd_proxy
463) > $OBJ/ssh_proxy 533) > $OBJ/ssh_proxy
464 534
465# check proxy config 535# check proxy config
diff --git a/regress/transfer.sh b/regress/transfer.sh
index 1ae3ef5bf..36c14634a 100644
--- a/regress/transfer.sh
+++ b/regress/transfer.sh
@@ -1,9 +1,9 @@
1# $OpenBSD: transfer.sh,v 1.2 2013/05/17 04:29:14 dtucker Exp $ 1# $OpenBSD: transfer.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="transfer data" 4tid="transfer data"
5 5
6for p in 1 2; do 6for p in ${SSH_PROTOCOLS}; do
7 verbose "$tid: proto $p" 7 verbose "$tid: proto $p"
8 rm -f ${COPY} 8 rm -f ${COPY}
9 ${SSH} -n -q -$p -F $OBJ/ssh_proxy somehost cat ${DATA} > ${COPY} 9 ${SSH} -n -q -$p -F $OBJ/ssh_proxy somehost cat ${DATA} > ${COPY}
diff --git a/regress/try-ciphers.sh b/regress/try-ciphers.sh
index 2881ce16c..4165c7b88 100644
--- a/regress/try-ciphers.sh
+++ b/regress/try-ciphers.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: try-ciphers.sh,v 1.23 2014/04/21 22:15:37 djm Exp $ 1# $OpenBSD: try-ciphers.sh,v 1.24 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="try ciphers" 4tid="try ciphers"
@@ -26,7 +26,11 @@ for c in `${SSH} -Q cipher`; do
26 done 26 done
27done 27done
28 28
29ciphers="3des blowfish" 29if ssh_version 1; then
30 ciphers="3des blowfish"
31else
32 ciphers=""
33fi
30for c in $ciphers; do 34for c in $ciphers; do
31 trace "proto 1 cipher $c" 35 trace "proto 1 cipher $c"
32 verbose "test $tid: proto 1 cipher $c" 36 verbose "test $tid: proto 1 cipher $c"
diff --git a/regress/unittests/Makefile b/regress/unittests/Makefile
index bdb4574e2..d3d90823f 100644
--- a/regress/unittests/Makefile
+++ b/regress/unittests/Makefile
@@ -1,5 +1,5 @@
1# $OpenBSD: Makefile,v 1.1 2014/04/30 05:32:00 djm Exp $ 1# $OpenBSD: Makefile,v 1.5 2015/02/16 22:21:03 djm Exp $
2 2REGRESS_FAIL_EARLY= yes
3SUBDIR= test_helper sshbuf sshkey 3SUBDIR= test_helper sshbuf sshkey bitmap kex hostkeys
4 4
5.include <bsd.subdir.mk> 5.include <bsd.subdir.mk>
diff --git a/regress/unittests/Makefile.inc b/regress/unittests/Makefile.inc
index 4c3363749..c55d00c61 100644
--- a/regress/unittests/Makefile.inc
+++ b/regress/unittests/Makefile.inc
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile.inc,v 1.1 2014/04/30 05:32:00 djm Exp $ 1# $OpenBSD: Makefile.inc,v 1.3 2015/01/23 21:21:23 miod Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4.include <bsd.obj.mk> 4.include <bsd.obj.mk>
@@ -21,7 +21,6 @@ CDIAGFLAGS+= -Wmissing-declarations
21CDIAGFLAGS+= -Wmissing-prototypes 21CDIAGFLAGS+= -Wmissing-prototypes
22CDIAGFLAGS+= -Wparentheses 22CDIAGFLAGS+= -Wparentheses
23CDIAGFLAGS+= -Wpointer-arith 23CDIAGFLAGS+= -Wpointer-arith
24CDIAGFLAGS+= -Wpointer-sign
25CDIAGFLAGS+= -Wreturn-type 24CDIAGFLAGS+= -Wreturn-type
26CDIAGFLAGS+= -Wshadow 25CDIAGFLAGS+= -Wshadow
27CDIAGFLAGS+= -Wsign-compare 26CDIAGFLAGS+= -Wsign-compare
@@ -32,6 +31,7 @@ CDIAGFLAGS+= -Wtrigraphs
32CDIAGFLAGS+= -Wuninitialized 31CDIAGFLAGS+= -Wuninitialized
33CDIAGFLAGS+= -Wunused 32CDIAGFLAGS+= -Wunused
34.if ${COMPILER_VERSION} == "gcc4" 33.if ${COMPILER_VERSION} == "gcc4"
34CDIAGFLAGS+= -Wpointer-sign
35CDIAGFLAGS+= -Wold-style-definition 35CDIAGFLAGS+= -Wold-style-definition
36.endif 36.endif
37 37
diff --git a/regress/unittests/bitmap/Makefile b/regress/unittests/bitmap/Makefile
new file mode 100644
index 000000000..b704d22d6
--- /dev/null
+++ b/regress/unittests/bitmap/Makefile
@@ -0,0 +1,12 @@
1# $OpenBSD: Makefile,v 1.1 2015/01/15 07:36:28 djm Exp $
2
3TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
4
5PROG=test_bitmap
6SRCS=tests.c
7REGRESS_TARGETS=run-regress-${PROG}
8
9run-regress-${PROG}: ${PROG}
10 env ${TEST_ENV} ./${PROG}
11
12.include <bsd.regress.mk>
diff --git a/regress/unittests/bitmap/tests.c b/regress/unittests/bitmap/tests.c
new file mode 100644
index 000000000..23025f90a
--- /dev/null
+++ b/regress/unittests/bitmap/tests.c
@@ -0,0 +1,135 @@
1/* $OpenBSD: tests.c,v 1.1 2015/01/15 07:36:28 djm Exp $ */
2/*
3 * Regress test for bitmap.h bitmap API
4 *
5 * Placed in the public domain
6 */
7
8#include "includes.h"
9
10#include <sys/types.h>
11#include <sys/param.h>
12#include <stdio.h>
13#ifdef HAVE_STDINT_H
14#include <stdint.h>
15#endif
16#include <stdlib.h>
17#include <string.h>
18
19#include <openssl/bn.h>
20
21#include "../test_helper/test_helper.h"
22
23#include "bitmap.h"
24
25#define NTESTS 131
26
27void
28tests(void)
29{
30 struct bitmap *b;
31 BIGNUM *bn;
32 size_t len;
33 int i, j, k, n;
34 u_char bbuf[1024], bnbuf[1024];
35 int r;
36
37 TEST_START("bitmap_new");
38 b = bitmap_new();
39 ASSERT_PTR_NE(b, NULL);
40 bn = BN_new();
41 ASSERT_PTR_NE(bn, NULL);
42 TEST_DONE();
43
44 TEST_START("bitmap_set_bit / bitmap_test_bit");
45 for (i = -1; i < NTESTS; i++) {
46 for (j = -1; j < NTESTS; j++) {
47 for (k = -1; k < NTESTS; k++) {
48 bitmap_zero(b);
49 BN_clear(bn);
50
51 test_subtest_info("set %d/%d/%d", i, j, k);
52 /* Set bits */
53 if (i >= 0) {
54 ASSERT_INT_EQ(bitmap_set_bit(b, i), 0);
55 ASSERT_INT_EQ(BN_set_bit(bn, i), 1);
56 }
57 if (j >= 0) {
58 ASSERT_INT_EQ(bitmap_set_bit(b, j), 0);
59 ASSERT_INT_EQ(BN_set_bit(bn, j), 1);
60 }
61 if (k >= 0) {
62 ASSERT_INT_EQ(bitmap_set_bit(b, k), 0);
63 ASSERT_INT_EQ(BN_set_bit(bn, k), 1);
64 }
65
66 /* Check perfect match between bitmap and bn */
67 test_subtest_info("match %d/%d/%d", i, j, k);
68 for (n = 0; n < NTESTS; n++) {
69 ASSERT_INT_EQ(BN_is_bit_set(bn, n),
70 bitmap_test_bit(b, n));
71 }
72
73 /* Test length calculations */
74 test_subtest_info("length %d/%d/%d", i, j, k);
75 ASSERT_INT_EQ(BN_num_bits(bn),
76 (int)bitmap_nbits(b));
77 ASSERT_INT_EQ(BN_num_bytes(bn),
78 (int)bitmap_nbytes(b));
79
80 /* Test serialisation */
81 test_subtest_info("serialise %d/%d/%d",
82 i, j, k);
83 len = bitmap_nbytes(b);
84 memset(bbuf, 0xfc, sizeof(bbuf));
85 ASSERT_INT_EQ(bitmap_to_string(b, bbuf,
86 sizeof(bbuf)), 0);
87 for (n = len; n < (int)sizeof(bbuf); n++)
88 ASSERT_U8_EQ(bbuf[n], 0xfc);
89 r = BN_bn2bin(bn, bnbuf);
90 ASSERT_INT_GE(r, 0);
91 ASSERT_INT_EQ(r, (int)len);
92 ASSERT_MEM_EQ(bbuf, bnbuf, len);
93
94 /* Test deserialisation */
95 test_subtest_info("deserialise %d/%d/%d",
96 i, j, k);
97 bitmap_zero(b);
98 ASSERT_INT_EQ(bitmap_from_string(b, bnbuf,
99 len), 0);
100 for (n = 0; n < NTESTS; n++) {
101 ASSERT_INT_EQ(BN_is_bit_set(bn, n),
102 bitmap_test_bit(b, n));
103 }
104
105 /* Test clearing bits */
106 test_subtest_info("clear %d/%d/%d",
107 i, j, k);
108 for (n = 0; n < NTESTS; n++) {
109 ASSERT_INT_EQ(bitmap_set_bit(b, n), 0);
110 ASSERT_INT_EQ(BN_set_bit(bn, n), 1);
111 }
112 if (i >= 0) {
113 bitmap_clear_bit(b, i);
114 BN_clear_bit(bn, i);
115 }
116 if (j >= 0) {
117 bitmap_clear_bit(b, j);
118 BN_clear_bit(bn, j);
119 }
120 if (k >= 0) {
121 bitmap_clear_bit(b, k);
122 BN_clear_bit(bn, k);
123 }
124 for (n = 0; n < NTESTS; n++) {
125 ASSERT_INT_EQ(BN_is_bit_set(bn, n),
126 bitmap_test_bit(b, n));
127 }
128 }
129 }
130 }
131 bitmap_free(b);
132 BN_free(bn);
133 TEST_DONE();
134}
135
diff --git a/regress/unittests/hostkeys/Makefile b/regress/unittests/hostkeys/Makefile
new file mode 100644
index 000000000..f52a85fb1
--- /dev/null
+++ b/regress/unittests/hostkeys/Makefile
@@ -0,0 +1,12 @@
1# $OpenBSD: Makefile,v 1.1 2015/02/16 22:18:34 djm Exp $
2
3TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
4
5PROG=test_hostkeys
6SRCS=tests.c test_iterate.c
7REGRESS_TARGETS=run-regress-${PROG}
8
9run-regress-${PROG}: ${PROG}
10 env ${TEST_ENV} ./${PROG} -d ${.CURDIR}/testdata
11
12.include <bsd.regress.mk>
diff --git a/regress/unittests/hostkeys/mktestdata.sh b/regress/unittests/hostkeys/mktestdata.sh
new file mode 100644
index 000000000..36890ba11
--- /dev/null
+++ b/regress/unittests/hostkeys/mktestdata.sh
@@ -0,0 +1,94 @@
1#!/bin/sh
2# $OpenBSD: mktestdata.sh,v 1.1 2015/02/16 22:18:34 djm Exp $
3
4set -ex
5
6cd testdata
7
8rm -f rsa1* rsa* dsa* ecdsa* ed25519*
9rm -f known_hosts*
10
11gen_all() {
12 _n=$1
13 _ecdsa_bits=256
14 test "x$_n" = "x1" && _ecdsa_bits=384
15 test "x$_n" = "x2" && _ecdsa_bits=521
16 ssh-keygen -qt rsa1 -b 1024 -C "RSA1 #$_n" -N "" -f rsa1_$_n
17 ssh-keygen -qt rsa -b 1024 -C "RSA #$_n" -N "" -f rsa_$_n
18 ssh-keygen -qt dsa -b 1024 -C "DSA #$_n" -N "" -f dsa_$_n
19 ssh-keygen -qt ecdsa -b $_ecdsa_bits -C "ECDSA #$_n" -N "" -f ecdsa_$_n
20 ssh-keygen -qt ed25519 -C "ED25519 #$_n" -N "" -f ed25519_$_n
21 # Don't need private keys
22 rm -f rsa1_$_n rsa_$_n dsa_$_n ecdsa_$_n ed25519_$_n
23}
24
25hentries() {
26 _preamble=$1
27 _kspec=$2
28 for k in `ls -1 $_kspec | sort` ; do
29 printf "$_preamble "
30 cat $k
31 done
32 echo
33}
34
35gen_all 1
36gen_all 2
37gen_all 3
38gen_all 4
39gen_all 5
40gen_all 6
41
42# A section of known_hosts with hashed hostnames.
43(
44 hentries "sisyphus.example.com" "*_5.pub"
45 hentries "prometheus.example.com,192.0.2.1,2001:db8::1" "*_6.pub"
46) > known_hosts_hash_frag
47ssh-keygen -Hf known_hosts_hash_frag
48rm -f known_hosts_hash_frag.old
49
50# Populated known_hosts, including comments, hashed names and invalid lines
51(
52 echo "# Plain host keys, plain host names"
53 hentries "sisyphus.example.com" "*_1.pub"
54
55 echo "# Plain host keys, hostnames + addresses"
56 hentries "prometheus.example.com,192.0.2.1,2001:db8::1" "*_2.pub"
57
58 echo "# Some hosts with wildcard names / IPs"
59 hentries "*.example.com,192.0.2.*,2001:*" "*_3.pub"
60
61 echo "# Hashed hostname and address entries"
62 cat known_hosts_hash_frag
63 rm -f known_hosts_hash_frag
64 echo
65
66 echo "# Revoked and CA keys"
67 printf "@revoked sisyphus.example.com " ; cat rsa1_4.pub
68 printf "@revoked sisyphus.example.com " ; cat ed25519_4.pub
69 printf "@cert-authority prometheus.example.com " ; cat ecdsa_4.pub
70 printf "@cert-authority *.example.com " ; cat dsa_4.pub
71
72 printf "\n"
73 echo "# Some invalid lines"
74 # Invalid marker
75 printf "@what sisyphus.example.com " ; cat rsa1_1.pub
76 # Key missing
77 echo "sisyphus.example.com "
78 # Key blob missing
79 echo "prometheus.example.com ssh-ed25519 "
80 # Key blob truncated
81 echo "sisyphus.example.com ssh-dsa AAAATgAAAAdz"
82 # RSA1 key truncated after key bits
83 echo "prometheus.example.com 1024 "
84 # RSA1 key truncated after exponent
85 echo "sisyphus.example.com 1024 65535 "
86 # RSA1 key incorrect key bits
87 printf "prometheus.example.com 1025 " ; cut -d' ' -f2- < rsa1_1.pub
88 # Invalid type
89 echo "sisyphus.example.com ssh-XXX AAAATgAAAAdzc2gtWFhYAAAAP0ZVQ0tPRkZGVUNLT0ZGRlVDS09GRkZVQ0tPRkZGVUNLT0ZGRlVDS09GRkZVQ0tPRkZGVUNLT0ZGRlVDS09GRg=="
90 # Type mismatch with blob
91 echo "prometheus.example.com ssh-rsa AAAATgAAAAdzc2gtWFhYAAAAP0ZVQ0tPRkZGVUNLT0ZGRlVDS09GRkZVQ0tPRkZGVUNLT0ZGRlVDS09GRkZVQ0tPRkZGVUNLT0ZGRlVDS09GRg=="
92) > known_hosts
93
94echo OK
diff --git a/regress/unittests/hostkeys/test_iterate.c b/regress/unittests/hostkeys/test_iterate.c
new file mode 100644
index 000000000..d81291b68
--- /dev/null
+++ b/regress/unittests/hostkeys/test_iterate.c
@@ -0,0 +1,1171 @@
1/* $OpenBSD: test_iterate.c,v 1.3 2015/03/07 04:41:48 djm Exp $ */
2/*
3 * Regress test for hostfile.h hostkeys_foreach()
4 *
5 * Placed in the public domain
6 */
7
8#include "includes.h"
9
10#include <sys/types.h>
11#include <sys/param.h>
12#include <stdio.h>
13#ifdef HAVE_STDINT_H
14#include <stdint.h>
15#endif
16#include <stdlib.h>
17#include <string.h>
18
19#include "../test_helper/test_helper.h"
20
21#include "sshkey.h"
22#include "authfile.h"
23#include "hostfile.h"
24
25struct expected {
26 const char *key_file; /* Path for key, NULL for none */
27 int no_parse_status; /* Expected status w/o key parsing */
28 int no_parse_keytype; /* Expected keytype w/o key parsing */
29 int match_host_p; /* Match 'prometheus.example.com' */
30 int match_host_s; /* Match 'sisyphus.example.com' */
31 int match_ipv4; /* Match '192.0.2.1' */
32 int match_ipv6; /* Match '2001:db8::1' */
33 int match_flags; /* Expected flags from match */
34 struct hostkey_foreach_line l; /* Expected line contents */
35};
36
37struct cbctx {
38 const struct expected *expected;
39 size_t nexpected;
40 size_t i;
41 int flags;
42 int match_host_p;
43 int match_host_s;
44 int match_ipv4;
45 int match_ipv6;
46};
47
48/*
49 * hostkeys_foreach() iterator callback that verifies the line passed
50 * against an array of expected entries.
51 */
52static int
53check(struct hostkey_foreach_line *l, void *_ctx)
54{
55 struct cbctx *ctx = (struct cbctx *)_ctx;
56 const struct expected *expected;
57 int parse_key = (ctx->flags & HKF_WANT_PARSE_KEY) != 0;
58 const int matching = (ctx->flags & HKF_WANT_MATCH) != 0;
59 u_int expected_status, expected_match;
60 int expected_keytype;
61
62 test_subtest_info("entry %zu/%zu, file line %ld",
63 ctx->i + 1, ctx->nexpected, l->linenum);
64
65 for (;;) {
66 ASSERT_SIZE_T_LT(ctx->i, ctx->nexpected);
67 expected = ctx->expected + ctx->i++;
68 /* If we are matching host/IP then skip entries that don't */
69 if (!matching)
70 break;
71 if (ctx->match_host_p && expected->match_host_p)
72 break;
73 if (ctx->match_host_s && expected->match_host_s)
74 break;
75 if (ctx->match_ipv4 && expected->match_ipv4)
76 break;
77 if (ctx->match_ipv6 && expected->match_ipv6)
78 break;
79 }
80 expected_status = (parse_key || expected->no_parse_status < 0) ?
81 expected->l.status : (u_int)expected->no_parse_status;
82 expected_match = expected->l.match;
83#define UPDATE_MATCH_STATUS(x) do { \
84 if (ctx->x && expected->x) { \
85 expected_match |= expected->x; \
86 if (expected_status == HKF_STATUS_OK) \
87 expected_status = HKF_STATUS_MATCHED; \
88 } \
89 } while (0)
90 expected_keytype = (parse_key || expected->no_parse_keytype < 0) ?
91 expected->l.keytype : expected->no_parse_keytype;
92
93#ifndef WITH_SSH1
94 if (expected->l.keytype == KEY_RSA1 ||
95 expected->no_parse_keytype == KEY_RSA1) {
96 expected_status = HKF_STATUS_INVALID;
97 expected_keytype = KEY_UNSPEC;
98 parse_key = 0;
99 }
100#endif
101#ifndef OPENSSL_HAS_ECC
102 if (expected->l.keytype == KEY_ECDSA ||
103 expected->no_parse_keytype == KEY_ECDSA) {
104 expected_status = HKF_STATUS_INVALID;
105 expected_keytype = KEY_UNSPEC;
106 parse_key = 0;
107 }
108#endif
109
110 UPDATE_MATCH_STATUS(match_host_p);
111 UPDATE_MATCH_STATUS(match_host_s);
112 UPDATE_MATCH_STATUS(match_ipv4);
113 UPDATE_MATCH_STATUS(match_ipv6);
114
115 ASSERT_PTR_NE(l->path, NULL); /* Don't care about path */
116 ASSERT_LONG_LONG_EQ(l->linenum, expected->l.linenum);
117 ASSERT_U_INT_EQ(l->status, expected_status);
118 ASSERT_U_INT_EQ(l->match, expected_match);
119 /* Not all test entries contain fulltext */
120 if (expected->l.line != NULL)
121 ASSERT_STRING_EQ(l->line, expected->l.line);
122 ASSERT_INT_EQ(l->marker, expected->l.marker);
123 /* XXX we skip hashed hostnames for now; implement checking */
124 if (expected->l.hosts != NULL)
125 ASSERT_STRING_EQ(l->hosts, expected->l.hosts);
126 /* Not all test entries contain raw keys */
127 if (expected->l.rawkey != NULL)
128 ASSERT_STRING_EQ(l->rawkey, expected->l.rawkey);
129 /* XXX synthesise raw key for cases lacking and compare */
130 ASSERT_INT_EQ(l->keytype, expected_keytype);
131 if (parse_key) {
132 if (expected->l.key == NULL)
133 ASSERT_PTR_EQ(l->key, NULL);
134 if (expected->l.key != NULL) {
135 ASSERT_PTR_NE(l->key, NULL);
136 ASSERT_INT_EQ(sshkey_equal(l->key, expected->l.key), 1);
137 }
138 }
139 if (parse_key && !(l->comment == NULL && expected->l.comment == NULL))
140 ASSERT_STRING_EQ(l->comment, expected->l.comment);
141 return 0;
142}
143
144/* Loads public keys for a set of expected results */
145static void
146prepare_expected(struct expected *expected, size_t n)
147{
148 size_t i;
149
150 for (i = 0; i < n; i++) {
151 if (expected[i].key_file == NULL)
152 continue;
153#ifndef WITH_SSH1
154 if (expected[i].l.keytype == KEY_RSA1)
155 continue;
156#endif
157#ifndef OPENSSL_HAS_ECC
158 if (expected[i].l.keytype == KEY_ECDSA)
159 continue;
160#endif
161 ASSERT_INT_EQ(sshkey_load_public(
162 test_data_file(expected[i].key_file), &expected[i].l.key,
163 NULL), 0);
164 }
165}
166
167struct expected expected_full[] = {
168 { NULL, -1, -1, 0, 0, 0, 0, -1, {
169 NULL, /* path, don't care */
170 1, /* line number */
171 HKF_STATUS_COMMENT, /* status */
172 0, /* match flags */
173 "# Plain host keys, plain host names", /* full line, optional */
174 MRK_NONE, /* marker (CA / revoked) */
175 NULL, /* hosts text */
176 NULL, /* raw key, optional */
177 KEY_UNSPEC, /* key type */
178 NULL, /* deserialised key */
179 NULL, /* comment */
180 } },
181 { "dsa_1.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
182 NULL,
183 2,
184 HKF_STATUS_OK,
185 0,
186 NULL,
187 MRK_NONE,
188 "sisyphus.example.com",
189 NULL,
190 KEY_DSA,
191 NULL, /* filled at runtime */
192 "DSA #1",
193 } },
194 { "ecdsa_1.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
195 NULL,
196 3,
197 HKF_STATUS_OK,
198 0,
199 NULL,
200 MRK_NONE,
201 "sisyphus.example.com",
202 NULL,
203 KEY_ECDSA,
204 NULL, /* filled at runtime */
205 "ECDSA #1",
206 } },
207 { "ed25519_1.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
208 NULL,
209 4,
210 HKF_STATUS_OK,
211 0,
212 NULL,
213 MRK_NONE,
214 "sisyphus.example.com",
215 NULL,
216 KEY_ED25519,
217 NULL, /* filled at runtime */
218 "ED25519 #1",
219 } },
220 { "rsa1_1.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
221 NULL,
222 5,
223 HKF_STATUS_OK,
224 0,
225 NULL,
226 MRK_NONE,
227 "sisyphus.example.com",
228 NULL,
229 KEY_RSA1,
230 NULL, /* filled at runtime */
231 "RSA1 #1",
232 } },
233 { "rsa_1.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
234 NULL,
235 6,
236 HKF_STATUS_OK,
237 0,
238 NULL,
239 MRK_NONE,
240 "sisyphus.example.com",
241 NULL,
242 KEY_RSA,
243 NULL, /* filled at runtime */
244 "RSA #1",
245 } },
246 { NULL, -1, -1, 0, 0, 0, 0, -1, {
247 NULL,
248 7,
249 HKF_STATUS_COMMENT,
250 0,
251 "",
252 MRK_NONE,
253 NULL,
254 NULL,
255 KEY_UNSPEC,
256 NULL,
257 NULL,
258 } },
259 { NULL, -1, -1, 0, 0, 0, 0, -1, {
260 NULL,
261 8,
262 HKF_STATUS_COMMENT,
263 0,
264 "# Plain host keys, hostnames + addresses",
265 MRK_NONE,
266 NULL,
267 NULL,
268 KEY_UNSPEC,
269 NULL,
270 NULL,
271 } },
272 { "dsa_2.pub" , -1, -1, HKF_MATCH_HOST, 0, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
273 NULL,
274 9,
275 HKF_STATUS_OK,
276 0,
277 NULL,
278 MRK_NONE,
279 "prometheus.example.com,192.0.2.1,2001:db8::1",
280 NULL,
281 KEY_DSA,
282 NULL, /* filled at runtime */
283 "DSA #2",
284 } },
285 { "ecdsa_2.pub" , -1, -1, HKF_MATCH_HOST, 0, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
286 NULL,
287 10,
288 HKF_STATUS_OK,
289 0,
290 NULL,
291 MRK_NONE,
292 "prometheus.example.com,192.0.2.1,2001:db8::1",
293 NULL,
294 KEY_ECDSA,
295 NULL, /* filled at runtime */
296 "ECDSA #2",
297 } },
298 { "ed25519_2.pub" , -1, -1, HKF_MATCH_HOST, 0, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
299 NULL,
300 11,
301 HKF_STATUS_OK,
302 0,
303 NULL,
304 MRK_NONE,
305 "prometheus.example.com,192.0.2.1,2001:db8::1",
306 NULL,
307 KEY_ED25519,
308 NULL, /* filled at runtime */
309 "ED25519 #2",
310 } },
311 { "rsa1_2.pub" , -1, -1, HKF_MATCH_HOST, 0, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
312 NULL,
313 12,
314 HKF_STATUS_OK,
315 0,
316 NULL,
317 MRK_NONE,
318 "prometheus.example.com,192.0.2.1,2001:db8::1",
319 NULL,
320 KEY_RSA1,
321 NULL, /* filled at runtime */
322 "RSA1 #2",
323 } },
324 { "rsa_2.pub" , -1, -1, HKF_MATCH_HOST, 0, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
325 NULL,
326 13,
327 HKF_STATUS_OK,
328 0,
329 NULL,
330 MRK_NONE,
331 "prometheus.example.com,192.0.2.1,2001:db8::1",
332 NULL,
333 KEY_RSA,
334 NULL, /* filled at runtime */
335 "RSA #2",
336 } },
337 { NULL, -1, -1, 0, 0, 0, 0, -1, {
338 NULL,
339 14,
340 HKF_STATUS_COMMENT,
341 0,
342 "",
343 MRK_NONE,
344 NULL,
345 NULL,
346 KEY_UNSPEC,
347 NULL,
348 NULL,
349 } },
350 { NULL, -1, -1, 0, 0, 0, 0, -1, {
351 NULL,
352 15,
353 HKF_STATUS_COMMENT,
354 0,
355 "# Some hosts with wildcard names / IPs",
356 MRK_NONE,
357 NULL,
358 NULL,
359 KEY_UNSPEC,
360 NULL,
361 NULL,
362 } },
363 { "dsa_3.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
364 NULL,
365 16,
366 HKF_STATUS_OK,
367 0,
368 NULL,
369 MRK_NONE,
370 "*.example.com,192.0.2.*,2001:*",
371 NULL,
372 KEY_DSA,
373 NULL, /* filled at runtime */
374 "DSA #3",
375 } },
376 { "ecdsa_3.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
377 NULL,
378 17,
379 HKF_STATUS_OK,
380 0,
381 NULL,
382 MRK_NONE,
383 "*.example.com,192.0.2.*,2001:*",
384 NULL,
385 KEY_ECDSA,
386 NULL, /* filled at runtime */
387 "ECDSA #3",
388 } },
389 { "ed25519_3.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
390 NULL,
391 18,
392 HKF_STATUS_OK,
393 0,
394 NULL,
395 MRK_NONE,
396 "*.example.com,192.0.2.*,2001:*",
397 NULL,
398 KEY_ED25519,
399 NULL, /* filled at runtime */
400 "ED25519 #3",
401 } },
402 { "rsa1_3.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
403 NULL,
404 19,
405 HKF_STATUS_OK,
406 0,
407 NULL,
408 MRK_NONE,
409 "*.example.com,192.0.2.*,2001:*",
410 NULL,
411 KEY_RSA1,
412 NULL, /* filled at runtime */
413 "RSA1 #3",
414 } },
415 { "rsa_3.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
416 NULL,
417 20,
418 HKF_STATUS_OK,
419 0,
420 NULL,
421 MRK_NONE,
422 "*.example.com,192.0.2.*,2001:*",
423 NULL,
424 KEY_RSA,
425 NULL, /* filled at runtime */
426 "RSA #3",
427 } },
428 { NULL, -1, -1, 0, 0, 0, 0, -1, {
429 NULL,
430 21,
431 HKF_STATUS_COMMENT,
432 0,
433 "",
434 MRK_NONE,
435 NULL,
436 NULL,
437 KEY_UNSPEC,
438 NULL,
439 NULL,
440 } },
441 { NULL, -1, -1, 0, 0, 0, 0, -1, {
442 NULL,
443 22,
444 HKF_STATUS_COMMENT,
445 0,
446 "# Hashed hostname and address entries",
447 MRK_NONE,
448 NULL,
449 NULL,
450 KEY_UNSPEC,
451 NULL,
452 NULL,
453 } },
454 { "dsa_5.pub" , -1, -1, 0, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, -1, {
455 NULL,
456 23,
457 HKF_STATUS_OK,
458 0,
459 NULL,
460 MRK_NONE,
461 NULL,
462 NULL,
463 KEY_DSA,
464 NULL, /* filled at runtime */
465 "DSA #5",
466 } },
467 { "ecdsa_5.pub" , -1, -1, 0, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, -1, {
468 NULL,
469 24,
470 HKF_STATUS_OK,
471 0,
472 NULL,
473 MRK_NONE,
474 NULL,
475 NULL,
476 KEY_ECDSA,
477 NULL, /* filled at runtime */
478 "ECDSA #5",
479 } },
480 { "ed25519_5.pub" , -1, -1, 0, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, -1, {
481 NULL,
482 25,
483 HKF_STATUS_OK,
484 0,
485 NULL,
486 MRK_NONE,
487 NULL,
488 NULL,
489 KEY_ED25519,
490 NULL, /* filled at runtime */
491 "ED25519 #5",
492 } },
493 { "rsa1_5.pub" , -1, -1, 0, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, -1, {
494 NULL,
495 26,
496 HKF_STATUS_OK,
497 0,
498 NULL,
499 MRK_NONE,
500 NULL,
501 NULL,
502 KEY_RSA1,
503 NULL, /* filled at runtime */
504 "RSA1 #5",
505 } },
506 { "rsa_5.pub" , -1, -1, 0, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, -1, {
507 NULL,
508 27,
509 HKF_STATUS_OK,
510 0,
511 NULL,
512 MRK_NONE,
513 NULL,
514 NULL,
515 KEY_RSA,
516 NULL, /* filled at runtime */
517 "RSA #5",
518 } },
519 { NULL, -1, -1, 0, 0, 0, 0, -1, {
520 NULL,
521 28,
522 HKF_STATUS_COMMENT,
523 0,
524 "",
525 MRK_NONE,
526 NULL,
527 NULL,
528 KEY_UNSPEC,
529 NULL,
530 NULL,
531 } },
532 /*
533 * The next series have each key listed multiple times, as the
534 * hostname and addresses in the pre-hashed known_hosts are split
535 * to separate lines.
536 */
537 { "dsa_6.pub" , -1, -1, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, 0, -1, {
538 NULL,
539 29,
540 HKF_STATUS_OK,
541 0,
542 NULL,
543 MRK_NONE,
544 NULL,
545 NULL,
546 KEY_DSA,
547 NULL, /* filled at runtime */
548 "DSA #6",
549 } },
550 { "dsa_6.pub" , -1, -1, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, 0, -1, {
551 NULL,
552 30,
553 HKF_STATUS_OK,
554 0,
555 NULL,
556 MRK_NONE,
557 NULL,
558 NULL,
559 KEY_DSA,
560 NULL, /* filled at runtime */
561 "DSA #6",
562 } },
563 { "dsa_6.pub" , -1, -1, 0, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, -1, {
564 NULL,
565 31,
566 HKF_STATUS_OK,
567 0,
568 NULL,
569 MRK_NONE,
570 NULL,
571 NULL,
572 KEY_DSA,
573 NULL, /* filled at runtime */
574 "DSA #6",
575 } },
576 { "ecdsa_6.pub" , -1, -1, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, 0, -1, {
577 NULL,
578 32,
579 HKF_STATUS_OK,
580 0,
581 NULL,
582 MRK_NONE,
583 NULL,
584 NULL,
585 KEY_ECDSA,
586 NULL, /* filled at runtime */
587 "ECDSA #6",
588 } },
589 { "ecdsa_6.pub" , -1, -1, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, 0, -1, {
590 NULL,
591 33,
592 HKF_STATUS_OK,
593 0,
594 NULL,
595 MRK_NONE,
596 NULL,
597 NULL,
598 KEY_ECDSA,
599 NULL, /* filled at runtime */
600 "ECDSA #6",
601 } },
602 { "ecdsa_6.pub" , -1, -1, 0, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, -1, {
603 NULL,
604 34,
605 HKF_STATUS_OK,
606 0,
607 NULL,
608 MRK_NONE,
609 NULL,
610 NULL,
611 KEY_ECDSA,
612 NULL, /* filled at runtime */
613 "ECDSA #6",
614 } },
615 { "ed25519_6.pub" , -1, -1, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, 0, -1, {
616 NULL,
617 35,
618 HKF_STATUS_OK,
619 0,
620 NULL,
621 MRK_NONE,
622 NULL,
623 NULL,
624 KEY_ED25519,
625 NULL, /* filled at runtime */
626 "ED25519 #6",
627 } },
628 { "ed25519_6.pub" , -1, -1, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, 0, -1, {
629 NULL,
630 36,
631 HKF_STATUS_OK,
632 0,
633 NULL,
634 MRK_NONE,
635 NULL,
636 NULL,
637 KEY_ED25519,
638 NULL, /* filled at runtime */
639 "ED25519 #6",
640 } },
641 { "ed25519_6.pub" , -1, -1, 0, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, -1, {
642 NULL,
643 37,
644 HKF_STATUS_OK,
645 0,
646 NULL,
647 MRK_NONE,
648 NULL,
649 NULL,
650 KEY_ED25519,
651 NULL, /* filled at runtime */
652 "ED25519 #6",
653 } },
654 { "rsa1_6.pub" , -1, -1, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, 0, -1, {
655 NULL,
656 38,
657 HKF_STATUS_OK,
658 0,
659 NULL,
660 MRK_NONE,
661 NULL,
662 NULL,
663 KEY_RSA1,
664 NULL, /* filled at runtime */
665 "RSA1 #6",
666 } },
667 { "rsa1_6.pub" , -1, -1, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, 0, -1, {
668 NULL,
669 39,
670 HKF_STATUS_OK,
671 0,
672 NULL,
673 MRK_NONE,
674 NULL,
675 NULL,
676 KEY_RSA1,
677 NULL, /* filled at runtime */
678 "RSA1 #6",
679 } },
680 { "rsa1_6.pub" , -1, -1, 0, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, -1, {
681 NULL,
682 40,
683 HKF_STATUS_OK,
684 0,
685 NULL,
686 MRK_NONE,
687 NULL,
688 NULL,
689 KEY_RSA1,
690 NULL, /* filled at runtime */
691 "RSA1 #6",
692 } },
693 { "rsa_6.pub" , -1, -1, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, 0, -1, {
694 NULL,
695 41,
696 HKF_STATUS_OK,
697 0,
698 NULL,
699 MRK_NONE,
700 NULL,
701 NULL,
702 KEY_RSA,
703 NULL, /* filled at runtime */
704 "RSA #6",
705 } },
706 { "rsa_6.pub" , -1, -1, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, 0, -1, {
707 NULL,
708 42,
709 HKF_STATUS_OK,
710 0,
711 NULL,
712 MRK_NONE,
713 NULL,
714 NULL,
715 KEY_RSA,
716 NULL, /* filled at runtime */
717 "RSA #6",
718 } },
719 { "rsa_6.pub" , -1, -1, 0, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, -1, {
720 NULL,
721 43,
722 HKF_STATUS_OK,
723 0,
724 NULL,
725 MRK_NONE,
726 NULL,
727 NULL,
728 KEY_RSA,
729 NULL, /* filled at runtime */
730 "RSA #6",
731 } },
732 { NULL, -1, -1, 0, 0, 0, 0, -1, {
733 NULL,
734 44,
735 HKF_STATUS_COMMENT,
736 0,
737 "",
738 MRK_NONE,
739 NULL,
740 NULL,
741 KEY_UNSPEC,
742 NULL,
743 NULL,
744 } },
745 { NULL, -1, -1, 0, 0, 0, 0, -1, {
746 NULL,
747 45,
748 HKF_STATUS_COMMENT,
749 0,
750 "",
751 MRK_NONE,
752 NULL,
753 NULL,
754 KEY_UNSPEC,
755 NULL,
756 NULL,
757 } },
758 { NULL, -1, -1, 0, 0, 0, 0, -1, {
759 NULL,
760 46,
761 HKF_STATUS_COMMENT,
762 0,
763 "# Revoked and CA keys",
764 MRK_NONE,
765 NULL,
766 NULL,
767 KEY_UNSPEC,
768 NULL,
769 NULL,
770 } },
771 { "rsa1_4.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
772 NULL,
773 47,
774 HKF_STATUS_OK,
775 0,
776 NULL,
777 MRK_REVOKE,
778 "sisyphus.example.com",
779 NULL,
780 KEY_RSA1,
781 NULL, /* filled at runtime */
782 "RSA1 #4",
783 } },
784 { "ed25519_4.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
785 NULL,
786 48,
787 HKF_STATUS_OK,
788 0,
789 NULL,
790 MRK_REVOKE,
791 "sisyphus.example.com",
792 NULL,
793 KEY_ED25519,
794 NULL, /* filled at runtime */
795 "ED25519 #4",
796 } },
797 { "ecdsa_4.pub" , -1, -1, HKF_MATCH_HOST, 0, 0, 0, -1, {
798 NULL,
799 49,
800 HKF_STATUS_OK,
801 0,
802 NULL,
803 MRK_CA,
804 "prometheus.example.com",
805 NULL,
806 KEY_ECDSA,
807 NULL, /* filled at runtime */
808 "ECDSA #4",
809 } },
810 { "dsa_4.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, 0, 0, -1, {
811 NULL,
812 50,
813 HKF_STATUS_OK,
814 0,
815 NULL,
816 MRK_CA,
817 "*.example.com",
818 NULL,
819 KEY_DSA,
820 NULL, /* filled at runtime */
821 "DSA #4",
822 } },
823 { NULL, -1, -1, 0, 0, 0, 0, -1, {
824 NULL,
825 51,
826 HKF_STATUS_COMMENT,
827 0,
828 "",
829 MRK_NONE,
830 NULL,
831 NULL,
832 KEY_UNSPEC,
833 NULL,
834 NULL,
835 } },
836 { NULL, -1, -1, 0, 0, 0, 0, -1, {
837 NULL,
838 52,
839 HKF_STATUS_COMMENT,
840 0,
841 "# Some invalid lines",
842 MRK_NONE,
843 NULL,
844 NULL,
845 KEY_UNSPEC,
846 NULL,
847 NULL,
848 } },
849 { NULL, -1, -1, 0, 0, 0, 0, -1, {
850 NULL,
851 53,
852 HKF_STATUS_INVALID,
853 0,
854 NULL,
855 MRK_ERROR,
856 NULL,
857 NULL,
858 KEY_UNSPEC,
859 NULL,
860 NULL,
861 } },
862 { NULL, -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
863 NULL,
864 54,
865 HKF_STATUS_INVALID,
866 0,
867 NULL,
868 MRK_NONE,
869 "sisyphus.example.com",
870 NULL,
871 KEY_UNSPEC,
872 NULL,
873 NULL,
874 } },
875 { NULL, -1, -1, HKF_MATCH_HOST, 0, 0, 0, -1, {
876 NULL,
877 55,
878 HKF_STATUS_INVALID,
879 0,
880 NULL,
881 MRK_NONE,
882 "prometheus.example.com",
883 NULL,
884 KEY_UNSPEC,
885 NULL,
886 NULL,
887 } },
888 { NULL, -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
889 NULL,
890 56,
891 HKF_STATUS_INVALID, /* Would be ok if key not parsed */
892 0,
893 NULL,
894 MRK_NONE,
895 "sisyphus.example.com",
896 NULL,
897 KEY_UNSPEC,
898 NULL,
899 NULL,
900 } },
901 { NULL, -1, -1, HKF_MATCH_HOST, 0, 0, 0, -1, {
902 NULL,
903 57,
904 HKF_STATUS_INVALID, /* Would be ok if key not parsed */
905 0,
906 NULL,
907 MRK_NONE,
908 "prometheus.example.com",
909 NULL,
910 KEY_UNSPEC,
911 NULL,
912 NULL,
913 } },
914 { NULL, HKF_STATUS_OK, KEY_RSA1, 0, HKF_MATCH_HOST, 0, 0, -1, {
915 NULL,
916 58,
917 HKF_STATUS_INVALID, /* Would be ok if key not parsed */
918 0,
919 NULL,
920 MRK_NONE,
921 "sisyphus.example.com",
922 NULL,
923 KEY_UNSPEC,
924 NULL,
925 NULL,
926 } },
927 { NULL, HKF_STATUS_OK, KEY_RSA1, HKF_MATCH_HOST, 0, 0, 0, -1, {
928 NULL,
929 59,
930 HKF_STATUS_INVALID, /* Would be ok if key not parsed */
931 0,
932 NULL,
933 MRK_NONE,
934 "prometheus.example.com",
935 NULL,
936 KEY_UNSPEC,
937 NULL, /* filled at runtime */
938 NULL,
939 } },
940 { NULL, -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
941 NULL,
942 60,
943 HKF_STATUS_INVALID,
944 0,
945 NULL,
946 MRK_NONE,
947 "sisyphus.example.com",
948 NULL,
949 KEY_UNSPEC,
950 NULL, /* filled at runtime */
951 NULL,
952 } },
953 { NULL, HKF_STATUS_OK, KEY_RSA, HKF_MATCH_HOST, 0, 0, 0, -1, {
954 NULL,
955 61,
956 HKF_STATUS_INVALID, /* Would be ok if key not parsed */
957 0,
958 NULL,
959 MRK_NONE,
960 "prometheus.example.com",
961 NULL,
962 KEY_UNSPEC,
963 NULL, /* filled at runtime */
964 NULL,
965 } },
966};
967
968void test_iterate(void);
969
970void
971test_iterate(void)
972{
973 struct cbctx ctx;
974
975 TEST_START("hostkeys_iterate all with key parse");
976 memset(&ctx, 0, sizeof(ctx));
977 ctx.expected = expected_full;
978 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
979 ctx.flags = HKF_WANT_PARSE_KEY;
980 prepare_expected(expected_full, ctx.nexpected);
981 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
982 check, &ctx, NULL, NULL, ctx.flags), 0);
983 TEST_DONE();
984
985 TEST_START("hostkeys_iterate all without key parse");
986 memset(&ctx, 0, sizeof(ctx));
987 ctx.expected = expected_full;
988 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
989 ctx.flags = 0;
990 prepare_expected(expected_full, ctx.nexpected);
991 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
992 check, &ctx, NULL, NULL, ctx.flags), 0);
993 TEST_DONE();
994
995 TEST_START("hostkeys_iterate specify host 1");
996 memset(&ctx, 0, sizeof(ctx));
997 ctx.expected = expected_full;
998 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
999 ctx.flags = 0;
1000 ctx.match_host_p = 1;
1001 prepare_expected(expected_full, ctx.nexpected);
1002 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1003 check, &ctx, "prometheus.example.com", NULL, ctx.flags), 0);
1004 TEST_DONE();
1005
1006 TEST_START("hostkeys_iterate specify host 2");
1007 memset(&ctx, 0, sizeof(ctx));
1008 ctx.expected = expected_full;
1009 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1010 ctx.flags = 0;
1011 ctx.match_host_s = 1;
1012 prepare_expected(expected_full, ctx.nexpected);
1013 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1014 check, &ctx, "sisyphus.example.com", NULL, ctx.flags), 0);
1015 TEST_DONE();
1016
1017 TEST_START("hostkeys_iterate match host 1");
1018 memset(&ctx, 0, sizeof(ctx));
1019 ctx.expected = expected_full;
1020 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1021 ctx.flags = HKF_WANT_MATCH;
1022 ctx.match_host_p = 1;
1023 prepare_expected(expected_full, ctx.nexpected);
1024 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1025 check, &ctx, "prometheus.example.com", NULL, ctx.flags), 0);
1026 TEST_DONE();
1027
1028 TEST_START("hostkeys_iterate match host 2");
1029 memset(&ctx, 0, sizeof(ctx));
1030 ctx.expected = expected_full;
1031 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1032 ctx.flags = HKF_WANT_MATCH;
1033 ctx.match_host_s = 1;
1034 prepare_expected(expected_full, ctx.nexpected);
1035 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1036 check, &ctx, "sisyphus.example.com", NULL, ctx.flags), 0);
1037 TEST_DONE();
1038
1039 TEST_START("hostkeys_iterate specify host missing");
1040 memset(&ctx, 0, sizeof(ctx));
1041 ctx.expected = expected_full;
1042 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1043 ctx.flags = 0;
1044 prepare_expected(expected_full, ctx.nexpected);
1045 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1046 check, &ctx, "actaeon.example.org", NULL, ctx.flags), 0);
1047 TEST_DONE();
1048
1049 TEST_START("hostkeys_iterate match host missing");
1050 memset(&ctx, 0, sizeof(ctx));
1051 ctx.expected = expected_full;
1052 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1053 ctx.flags = HKF_WANT_MATCH;
1054 prepare_expected(expected_full, ctx.nexpected);
1055 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1056 check, &ctx, "actaeon.example.org", NULL, ctx.flags), 0);
1057 TEST_DONE();
1058
1059 TEST_START("hostkeys_iterate specify IPv4");
1060 memset(&ctx, 0, sizeof(ctx));
1061 ctx.expected = expected_full;
1062 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1063 ctx.flags = 0;
1064 ctx.match_ipv4 = 1;
1065 prepare_expected(expected_full, ctx.nexpected);
1066 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1067 check, &ctx, "tiresias.example.org", "192.0.2.1", ctx.flags), 0);
1068 TEST_DONE();
1069
1070 TEST_START("hostkeys_iterate specify IPv6");
1071 memset(&ctx, 0, sizeof(ctx));
1072 ctx.expected = expected_full;
1073 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1074 ctx.flags = 0;
1075 ctx.match_ipv6 = 1;
1076 prepare_expected(expected_full, ctx.nexpected);
1077 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1078 check, &ctx, "tiresias.example.org", "2001:db8::1", ctx.flags), 0);
1079 TEST_DONE();
1080
1081 TEST_START("hostkeys_iterate match IPv4");
1082 memset(&ctx, 0, sizeof(ctx));
1083 ctx.expected = expected_full;
1084 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1085 ctx.flags = HKF_WANT_MATCH;
1086 ctx.match_ipv4 = 1;
1087 prepare_expected(expected_full, ctx.nexpected);
1088 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1089 check, &ctx, "tiresias.example.org", "192.0.2.1", ctx.flags), 0);
1090 TEST_DONE();
1091
1092 TEST_START("hostkeys_iterate match IPv6");
1093 memset(&ctx, 0, sizeof(ctx));
1094 ctx.expected = expected_full;
1095 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1096 ctx.flags = HKF_WANT_MATCH;
1097 ctx.match_ipv6 = 1;
1098 prepare_expected(expected_full, ctx.nexpected);
1099 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1100 check, &ctx, "tiresias.example.org", "2001:db8::1", ctx.flags), 0);
1101 TEST_DONE();
1102
1103 TEST_START("hostkeys_iterate specify addr missing");
1104 memset(&ctx, 0, sizeof(ctx));
1105 ctx.expected = expected_full;
1106 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1107 ctx.flags = 0;
1108 prepare_expected(expected_full, ctx.nexpected);
1109 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1110 check, &ctx, "tiresias.example.org", "192.168.0.1", ctx.flags), 0);
1111 TEST_DONE();
1112
1113 TEST_START("hostkeys_iterate match addr missing");
1114 memset(&ctx, 0, sizeof(ctx));
1115 ctx.expected = expected_full;
1116 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1117 ctx.flags = HKF_WANT_MATCH;
1118 prepare_expected(expected_full, ctx.nexpected);
1119 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1120 check, &ctx, "tiresias.example.org", "::1", ctx.flags), 0);
1121 TEST_DONE();
1122
1123 TEST_START("hostkeys_iterate specify host 2 and IPv4");
1124 memset(&ctx, 0, sizeof(ctx));
1125 ctx.expected = expected_full;
1126 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1127 ctx.flags = 0;
1128 ctx.match_host_s = 1;
1129 ctx.match_ipv4 = 1;
1130 prepare_expected(expected_full, ctx.nexpected);
1131 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1132 check, &ctx, "sisyphus.example.com", "192.0.2.1", ctx.flags), 0);
1133 TEST_DONE();
1134
1135 TEST_START("hostkeys_iterate match host 1 and IPv6");
1136 memset(&ctx, 0, sizeof(ctx));
1137 ctx.expected = expected_full;
1138 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1139 ctx.flags = HKF_WANT_MATCH;
1140 ctx.match_host_p = 1;
1141 ctx.match_ipv6 = 1;
1142 prepare_expected(expected_full, ctx.nexpected);
1143 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1144 check, &ctx, "prometheus.example.com", "2001:db8::1", ctx.flags), 0);
1145 TEST_DONE();
1146
1147 TEST_START("hostkeys_iterate specify host 2 and IPv4 w/ key parse");
1148 memset(&ctx, 0, sizeof(ctx));
1149 ctx.expected = expected_full;
1150 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1151 ctx.flags = HKF_WANT_PARSE_KEY;
1152 ctx.match_host_s = 1;
1153 ctx.match_ipv4 = 1;
1154 prepare_expected(expected_full, ctx.nexpected);
1155 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1156 check, &ctx, "sisyphus.example.com", "192.0.2.1", ctx.flags), 0);
1157 TEST_DONE();
1158
1159 TEST_START("hostkeys_iterate match host 1 and IPv6 w/ key parse");
1160 memset(&ctx, 0, sizeof(ctx));
1161 ctx.expected = expected_full;
1162 ctx.nexpected = sizeof(expected_full)/sizeof(*expected_full);
1163 ctx.flags = HKF_WANT_MATCH|HKF_WANT_PARSE_KEY;
1164 ctx.match_host_p = 1;
1165 ctx.match_ipv6 = 1;
1166 prepare_expected(expected_full, ctx.nexpected);
1167 ASSERT_INT_EQ(hostkeys_foreach(test_data_file("known_hosts"),
1168 check, &ctx, "prometheus.example.com", "2001:db8::1", ctx.flags), 0);
1169 TEST_DONE();
1170}
1171
diff --git a/regress/unittests/hostkeys/testdata/dsa_1.pub b/regress/unittests/hostkeys/testdata/dsa_1.pub
new file mode 100644
index 000000000..56e1e3714
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/dsa_1.pub
@@ -0,0 +1 @@
ssh-dss AAAAB3NzaC1kc3MAAACBAOqffHxEW4c+Z9q/r3l4sYK8F7qrBsU8XF9upGsW62T9InROFFq9IO0x3pQ6mDA0Wtw0sqcDmkPCHPyP4Ok/fU3/drLaZusHoVYu8pBBrWsIDrKgkeX9TEodBsSrYdl4Sqtqq9EZv9+DttV6LStZrgYyUTOKwOF95wGantpLynX5AAAAFQDdt+zjRNlETDsgmxcSYFgREirJrQAAAIBQlrPaiPhR24FhnMLcHH4016vL7AqDDID6Qw7PhbXGa4/XlxWMIigjBKrIPKvnZ6p712LSnCKtcbfdx0MtmJlNa01CYqPaRhgRaf+uGdvTkTUcdaq8R5lLJL+JMNwUhcC8ijm3NqEjXjffuebGe1EzIeiITbA7Nndcd+GytwRDegAAAIEAkRYPjSVcUxfUHhHdpP6V8CuY1+CYSs9EPJ7iiWTDuXWVIBTU32oJLAnrmAcOwtIzEfPvm+rff5FI/Yhon2pB3VTXhPPEBjYzE5qANanAT4e6tzAVc5f3DUhHaDknwRYfDz86GFvuLtDjeE/UZ9t6OofYoEsCBpYozLAprBvNIQY= DSA #1
diff --git a/regress/unittests/hostkeys/testdata/dsa_2.pub b/regress/unittests/hostkeys/testdata/dsa_2.pub
new file mode 100644
index 000000000..394e0bf00
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/dsa_2.pub
@@ -0,0 +1 @@
ssh-dss AAAAB3NzaC1kc3MAAACBAI38Hy/61/O5Bp6yUG8J5XQCeNjRS0xvjlCdzKLyXCueMa+L+X2L/u9PWUsy5SVbTjGgpB8sF6UkCNsV+va7S8zCCHas2MZ7GPlxP6GZBkRPTIFR0N/Pu7wfBzDQz0t0iL4VmxBfTBQv/SxkGWZg+yHihIQP9fwdSAwD/7aVh6ItAAAAFQDSyihIUlINlswM0PJ8wXSti3yIMwAAAIB+oqzaB6ozqs8YxpN5oQOBa/9HEBQEsp8RSIlQmVubXRNgktp42n+Ii1waU9UUk8DX5ahhIeR6B7ojWkqmDAji4SKpoHf4kmr6HvYo85ZSTSx0W4YK/gJHSpDJwhlT52tAfb1JCbWSObjl09B4STv7KedCHcR5oXQvvrV+XoKOSAAAAIAue/EXrs2INw1RfaKNHC0oqOMxmRitv0BFMuNVPo1VDj39CE5kA7AHjwvS1TNeaHtK5Hhgeb6vsmLmNPTOc8xCob0ilyQbt9O0GbONeF2Ge7D2UJyULA/hxql+tCYFIC6yUrmo35fF9XiNisXLoaflk9fjp7ROWWVwnki/jstaQw== DSA #2
diff --git a/regress/unittests/hostkeys/testdata/dsa_3.pub b/regress/unittests/hostkeys/testdata/dsa_3.pub
new file mode 100644
index 000000000..e506ea422
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/dsa_3.pub
@@ -0,0 +1 @@
ssh-dss AAAAB3NzaC1kc3MAAACBAI6lz2Ip9bzE7TGuDD4SjO9S4Ac90gq0h6ai1O06eI8t/Ot2uJ5Jk2QyVr2jvIZHDl/5bwBx7+5oyjlwRoUrAPPD814wf5tU2tSnmdu1Wbf0cBswif5q0r4tevzmopp/AtgH11QHo3u0/pfyJd10qBDLV2FaYSKMmZvyPfZJ0s9pAAAAFQD5Eqjl6Rx2qVePodD9OwAPT0bU6wAAAIAfnDm6csZF0sFaJR3NIJvaYgSGr8s7cqlsk2gLltB/1wOOO2yX+NeEC+B0H93hlMfaUsPa08bwgmYxnavSMqEBpmtPceefJiEd68zwYqXd38f88wyWZ9Z5iwaI/6OVZPHzCbDxOa4ewVTevRNYUKP1xUTZNT8/gSMfZLYPk4T2AQAAAIAUKroozRMyV+3V/rxt0gFnNxRXBKk+9cl3vgsQ7ktkI9cYg7V1T2K0XF21AVMK9gODszy6PBJjV6ruXBV6TRiqIbQauivp3bHHKYsG6wiJNqwdbVwIjfvv8nn1qFoZQLXG3sdONr9NwN8KzrX89OV0BlR2dVM5qqp+YxOXymP9yg== DSA #3
diff --git a/regress/unittests/hostkeys/testdata/dsa_4.pub b/regress/unittests/hostkeys/testdata/dsa_4.pub
new file mode 100644
index 000000000..8552c3819
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/dsa_4.pub
@@ -0,0 +1 @@
ssh-dss AAAAB3NzaC1kc3MAAACBAKvjnFHm0VvMr5h2Zu3nURsxQKGoxm+DCzYDxRYcilK07Cm5c4XTrFbA2X86+9sGs++W7QRMcTJUYIg0a+UtIMtAjwORd6ZPXM2K5dBW+gh1oHyvKi767tWX7I2c+1ZPJDY95mUUfZQUEfdy9eGDSBmw/pSsveQ1ur6XNUh/MtP/AAAAFQDHnXk/9jBJAdce1pHtLWnbdPSGdQAAAIEAm2OLy8tZBfiEO3c3X1yyB/GTcDwrQCqRMDkhnsmrliec3dWkOfNTzu+MrdvF8ymTWLEqPpbMheYtvNyZ3TF0HO5W7aVBpdGZbOdOAIfB+6skqGbI8A5Up1d7dak/bSsqL2r5NjwbDOdq+1hBzzvbl/qjh+sQarV2zHrpKoQaV28AAACANtkBVedBbqIAdphCrN/LbUi9WlyuF9UZz+tlpVLYrj8GJVwnplV2tvOmUw6yP5/pzCimTsao8dpL5PWxm7fKxLWVxA+lEsA4WeC885CiZn8xhdaJOCN+NyJ2bqkz+4VPI7oDGBm0aFwUqJn+M1PiSgvI50XdF2dBsFRTRNY0wzA= DSA #4
diff --git a/regress/unittests/hostkeys/testdata/dsa_5.pub b/regress/unittests/hostkeys/testdata/dsa_5.pub
new file mode 100644
index 000000000..149e1efd1
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/dsa_5.pub
@@ -0,0 +1 @@
ssh-dss AAAAB3NzaC1kc3MAAACBALrFy7w5ihlaOG+qR+6fj+vm5EQaO3qwxgACLcgH+VfShuOG4mkx8qFJmf+OZ3fh5iKngjNZfKtfcqI7zHWdk6378TQfQC52/kbZukjNXOLCpyNkogahcjA00onIoTK1RUDuMW28edAHwPFbpttXDTaqis+8JPMY8hZwsZGENCzTAAAAFQD6+It5vozwGgaN9ROYPMlByhi6jwAAAIBz2mcAC694vNzz9b6614gkX9d9E99PzJYfU1MPkXDziKg7MrjBw7Opd5y1jL09S3iL6lSTlHkKwVKvQ3pOwWRwXXRrKVus4I0STveoApm526jmp6mY0YEtqR98vMJ0v97h1ydt8FikKlihefCsnXVicb8887PXs2Y8C6GuFT3tfQAAAIBbmHtV5tPcrMRDkULhaQ/Whap2VKvT2DUhIHA7lx6oy/KpkltOpxDZOIGUHKqffGbiR7Jh01/y090AY5L2eCf0S2Ytx93+eADwVVpJbFJo6zSwfeey2Gm6L2oA+rCz9zTdmtZoekpD3/RAOQjnJIAPwbs7mXwabZTw4xRtiYIRrw== DSA #5
diff --git a/regress/unittests/hostkeys/testdata/dsa_6.pub b/regress/unittests/hostkeys/testdata/dsa_6.pub
new file mode 100644
index 000000000..edbb97643
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/dsa_6.pub
@@ -0,0 +1 @@
ssh-dss AAAAB3NzaC1kc3MAAACBAIutigAse65TCW6hHDOEGXenE9L4L0talHbs65hj3UUNtWflKdQeXLofqXgW8AwaDKmnuRPrxRoxVNXj84n45wtBEdt4ztmdAZteAbXSnHqpcxME3jDxh3EtxzGPXLs+RUmKPVguraSgo7W2oN7KFx6VM+AcAtxANSTlvDid3s47AAAAFQCd9Q3kkHSLWe77sW0eRaayI45ovwAAAIAw6srGF6xvFasI44Y3r9JJ2K+3ezozl3ldL3p2+p2HG3iWafC4SdV8pB6ZIxKlYAywiiFb3LzH/JweGFq1jtoFDRM3MlYORBevydU4zPz7b5QLDVB0sY4evYtWmg2BFJvoWRfhLnlZVW7h5N8v4fNIwdVmVsw4Ljes7iF2HRGhHgAAAIBDFT3fww2Oby1xUA6G9pDAcVikrQFqp1sJRylNTUyeyQ37SNAGzYxwHJFgQr8gZLdRQ1UW+idYpqVbVNcYFMOiw/zSqK2OfVwPZ9U+TTKdc992ChSup6vJEKM/ZVIyDWDbJr7igQ4ahy7jo9mFvm8ljN926EnspQzCvs0Dxk6tHA== DSA #6
diff --git a/regress/unittests/hostkeys/testdata/ecdsa_1.pub b/regress/unittests/hostkeys/testdata/ecdsa_1.pub
new file mode 100644
index 000000000..16a535bcc
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ecdsa_1.pub
@@ -0,0 +1 @@
ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBF6yQEtD9yBw9gmDRf477WBBzvWhAa0ioBI3nbA4emKykj0RbuQd5C4XdQAEOZGzE7v//FcCjwB2wi+JH5eKkxCtN6CjohDASZ1huoIV2UVyYIicZJEEOg1IWjjphvaxtw== ECDSA #1
diff --git a/regress/unittests/hostkeys/testdata/ecdsa_2.pub b/regress/unittests/hostkeys/testdata/ecdsa_2.pub
new file mode 100644
index 000000000..d2bad11e2
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ecdsa_2.pub
@@ -0,0 +1 @@
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAB8qVcXwgBM92NCmReQlPrZAoui4Bz/mW0VUBFOpHXXW1n+15b/Y7Pc6UBd/ITTZmaBciXY+PWaSBGdwc5GdqGdLgFyJ/QAGrFMPNpVutm/82gNQzlxpNwjbMcKyiZEXzSgnjS6DzMQ0WuSMdzIBXq8OW/Kafxg4ZkU6YqALUXxlQMZuQ== ECDSA #2
diff --git a/regress/unittests/hostkeys/testdata/ecdsa_3.pub b/regress/unittests/hostkeys/testdata/ecdsa_3.pub
new file mode 100644
index 000000000..e3ea9254e
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ecdsa_3.pub
@@ -0,0 +1 @@
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIb3BhJZk+vUQPg5TQc1koIzuGqloCq7wjr9LjlhG24IBeiFHLsdWw74HDlH4DrOmlxToVYk2lTdnjARleRByjk= ECDSA #3
diff --git a/regress/unittests/hostkeys/testdata/ecdsa_4.pub b/regress/unittests/hostkeys/testdata/ecdsa_4.pub
new file mode 100644
index 000000000..2d616f5c6
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ecdsa_4.pub
@@ -0,0 +1 @@
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHZd0OXHIWwK3xnjAdMZ1tojxWycdu38pORO/UX5cqsKMgGCKQVBWWO3TFk1ePkGIE9VMWT1hCGqWRRwYlH+dSE= ECDSA #4
diff --git a/regress/unittests/hostkeys/testdata/ecdsa_5.pub b/regress/unittests/hostkeys/testdata/ecdsa_5.pub
new file mode 100644
index 000000000..a3df9b3f4
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ecdsa_5.pub
@@ -0,0 +1 @@
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPIudcagzq4QPtP1jkpje34+0POLB0jwT64hqrbCqhTH2T800KDZ0h2vwlJYa3OP3Oqru9AB5pnuHsKw7mAhUGY= ECDSA #5
diff --git a/regress/unittests/hostkeys/testdata/ecdsa_6.pub b/regress/unittests/hostkeys/testdata/ecdsa_6.pub
new file mode 100644
index 000000000..139f5a7bf
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ecdsa_6.pub
@@ -0,0 +1 @@
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK1wRLyKtvK3Mmhd0XPkKwW4ev1KBVf8J4aG8lESq1TsaqqfOXYGyxMq5pN8fCGiD5UPOqyTYz/ZNzClRhJRHao= ECDSA #6
diff --git a/regress/unittests/hostkeys/testdata/ed25519_1.pub b/regress/unittests/hostkeys/testdata/ed25519_1.pub
new file mode 100644
index 000000000..0b12efedb
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ed25519_1.pub
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK9ks7jkua5YWIwByRnnnc6UPJQWI75O0e/UJdPYU1JI ED25519 #1
diff --git a/regress/unittests/hostkeys/testdata/ed25519_2.pub b/regress/unittests/hostkeys/testdata/ed25519_2.pub
new file mode 100644
index 000000000..78e262bcc
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ed25519_2.pub
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBp6PVW0z2o9C4Ukv/JOgmK7QMFe1pD1s3ADFF7IQob ED25519 #2
diff --git a/regress/unittests/hostkeys/testdata/ed25519_3.pub b/regress/unittests/hostkeys/testdata/ed25519_3.pub
new file mode 100644
index 000000000..64e5f12a6
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ed25519_3.pub
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBlYfExtYZAPqYvYdrlpGlSWhh/XNHcH3v3c2JzsVNbB ED25519 #3
diff --git a/regress/unittests/hostkeys/testdata/ed25519_4.pub b/regress/unittests/hostkeys/testdata/ed25519_4.pub
new file mode 100644
index 000000000..47b6724ec
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ed25519_4.pub
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDFP8L9REfN/iYy1KIRtFqSCn3V2+vOCpoZYENFGLdOF ED25519 #4
diff --git a/regress/unittests/hostkeys/testdata/ed25519_5.pub b/regress/unittests/hostkeys/testdata/ed25519_5.pub
new file mode 100644
index 000000000..72ccae6fe
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ed25519_5.pub
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINf63qSV8rD57N+digID8t28WVhd3Yf2K2UhaoG8TsWQ ED25519 #5
diff --git a/regress/unittests/hostkeys/testdata/ed25519_6.pub b/regress/unittests/hostkeys/testdata/ed25519_6.pub
new file mode 100644
index 000000000..0f719731d
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/ed25519_6.pub
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPLW0ZwCkRQldpLa4I5BpwGa/om+WE6OgC8jdVqakt0Z ED25519 #6
diff --git a/regress/unittests/hostkeys/testdata/known_hosts b/regress/unittests/hostkeys/testdata/known_hosts
new file mode 100644
index 000000000..3740f674b
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/known_hosts
@@ -0,0 +1,61 @@
1# Plain host keys, plain host names
2sisyphus.example.com ssh-dss AAAAB3NzaC1kc3MAAACBAOqffHxEW4c+Z9q/r3l4sYK8F7qrBsU8XF9upGsW62T9InROFFq9IO0x3pQ6mDA0Wtw0sqcDmkPCHPyP4Ok/fU3/drLaZusHoVYu8pBBrWsIDrKgkeX9TEodBsSrYdl4Sqtqq9EZv9+DttV6LStZrgYyUTOKwOF95wGantpLynX5AAAAFQDdt+zjRNlETDsgmxcSYFgREirJrQAAAIBQlrPaiPhR24FhnMLcHH4016vL7AqDDID6Qw7PhbXGa4/XlxWMIigjBKrIPKvnZ6p712LSnCKtcbfdx0MtmJlNa01CYqPaRhgRaf+uGdvTkTUcdaq8R5lLJL+JMNwUhcC8ijm3NqEjXjffuebGe1EzIeiITbA7Nndcd+GytwRDegAAAIEAkRYPjSVcUxfUHhHdpP6V8CuY1+CYSs9EPJ7iiWTDuXWVIBTU32oJLAnrmAcOwtIzEfPvm+rff5FI/Yhon2pB3VTXhPPEBjYzE5qANanAT4e6tzAVc5f3DUhHaDknwRYfDz86GFvuLtDjeE/UZ9t6OofYoEsCBpYozLAprBvNIQY= DSA #1
3sisyphus.example.com ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBF6yQEtD9yBw9gmDRf477WBBzvWhAa0ioBI3nbA4emKykj0RbuQd5C4XdQAEOZGzE7v//FcCjwB2wi+JH5eKkxCtN6CjohDASZ1huoIV2UVyYIicZJEEOg1IWjjphvaxtw== ECDSA #1
4sisyphus.example.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK9ks7jkua5YWIwByRnnnc6UPJQWI75O0e/UJdPYU1JI ED25519 #1
5sisyphus.example.com 1024 65537 153895431603677073925890314548566704948446776958334195280085080329934839226701954473292358821568047724356487621573742372399387931887004184139835510820577359977148363519970774657801798872789118894962853659233045778161859413980935372685480527355016624825696983269800574755126132814333241868538220824608980319407 RSA1 #1
6sisyphus.example.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDg4hB4vAZHJ0PVRiJajOv/GlytFWNpv5/9xgB9+5BIbvp8LOrFZ5D9K0Gsmwpd4G4rfaAz8j896DhMArg0vtkilIPPGt/6VzWMERgvaIQPJ/IE99X3+fjcAG56oAWwy29JX10lQMzBPU6XJIaN/zqpkb6qUBiAHBdLpxrFBBU0/w== RSA #1
7
8# Plain host keys, hostnames + addresses
9prometheus.example.com,192.0.2.1,2001:db8::1 ssh-dss AAAAB3NzaC1kc3MAAACBAI38Hy/61/O5Bp6yUG8J5XQCeNjRS0xvjlCdzKLyXCueMa+L+X2L/u9PWUsy5SVbTjGgpB8sF6UkCNsV+va7S8zCCHas2MZ7GPlxP6GZBkRPTIFR0N/Pu7wfBzDQz0t0iL4VmxBfTBQv/SxkGWZg+yHihIQP9fwdSAwD/7aVh6ItAAAAFQDSyihIUlINlswM0PJ8wXSti3yIMwAAAIB+oqzaB6ozqs8YxpN5oQOBa/9HEBQEsp8RSIlQmVubXRNgktp42n+Ii1waU9UUk8DX5ahhIeR6B7ojWkqmDAji4SKpoHf4kmr6HvYo85ZSTSx0W4YK/gJHSpDJwhlT52tAfb1JCbWSObjl09B4STv7KedCHcR5oXQvvrV+XoKOSAAAAIAue/EXrs2INw1RfaKNHC0oqOMxmRitv0BFMuNVPo1VDj39CE5kA7AHjwvS1TNeaHtK5Hhgeb6vsmLmNPTOc8xCob0ilyQbt9O0GbONeF2Ge7D2UJyULA/hxql+tCYFIC6yUrmo35fF9XiNisXLoaflk9fjp7ROWWVwnki/jstaQw== DSA #2
10prometheus.example.com,192.0.2.1,2001:db8::1 ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAB8qVcXwgBM92NCmReQlPrZAoui4Bz/mW0VUBFOpHXXW1n+15b/Y7Pc6UBd/ITTZmaBciXY+PWaSBGdwc5GdqGdLgFyJ/QAGrFMPNpVutm/82gNQzlxpNwjbMcKyiZEXzSgnjS6DzMQ0WuSMdzIBXq8OW/Kafxg4ZkU6YqALUXxlQMZuQ== ECDSA #2
11prometheus.example.com,192.0.2.1,2001:db8::1 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBp6PVW0z2o9C4Ukv/JOgmK7QMFe1pD1s3ADFF7IQob ED25519 #2
12prometheus.example.com,192.0.2.1,2001:db8::1 1024 65537 135970715082947442639683969597180728933388298633245835186618852623800675939308729462220235058285909679252157995530180587329132927339620517781785310829060832352381015614725360278571924286986474946772141568893116432268565829418506866604294073334978275702221949783314402806080929601995102334442541344606109853641 RSA1 #2
13prometheus.example.com,192.0.2.1,2001:db8::1 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDmbUhNabB5AmBDX6GNHZ3lbn7pRxqfpW+f53QqNGlK0sLV+0gkMIrOfUp1kdE2ZLE6tfzdicatj/RlH6/wuo4yyYb+Pyx3G0vxdmAIiA4aANq38XweDucBC0TZkRWVHK+Gs5V/uV0z7N0axJvkkJujMLvST3CRiiWwlficBc6yVQ== RSA #2
14
15# Some hosts with wildcard names / IPs
16*.example.com,192.0.2.*,2001:* ssh-dss AAAAB3NzaC1kc3MAAACBAI6lz2Ip9bzE7TGuDD4SjO9S4Ac90gq0h6ai1O06eI8t/Ot2uJ5Jk2QyVr2jvIZHDl/5bwBx7+5oyjlwRoUrAPPD814wf5tU2tSnmdu1Wbf0cBswif5q0r4tevzmopp/AtgH11QHo3u0/pfyJd10qBDLV2FaYSKMmZvyPfZJ0s9pAAAAFQD5Eqjl6Rx2qVePodD9OwAPT0bU6wAAAIAfnDm6csZF0sFaJR3NIJvaYgSGr8s7cqlsk2gLltB/1wOOO2yX+NeEC+B0H93hlMfaUsPa08bwgmYxnavSMqEBpmtPceefJiEd68zwYqXd38f88wyWZ9Z5iwaI/6OVZPHzCbDxOa4ewVTevRNYUKP1xUTZNT8/gSMfZLYPk4T2AQAAAIAUKroozRMyV+3V/rxt0gFnNxRXBKk+9cl3vgsQ7ktkI9cYg7V1T2K0XF21AVMK9gODszy6PBJjV6ruXBV6TRiqIbQauivp3bHHKYsG6wiJNqwdbVwIjfvv8nn1qFoZQLXG3sdONr9NwN8KzrX89OV0BlR2dVM5qqp+YxOXymP9yg== DSA #3
17*.example.com,192.0.2.*,2001:* ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIb3BhJZk+vUQPg5TQc1koIzuGqloCq7wjr9LjlhG24IBeiFHLsdWw74HDlH4DrOmlxToVYk2lTdnjARleRByjk= ECDSA #3
18*.example.com,192.0.2.*,2001:* ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBlYfExtYZAPqYvYdrlpGlSWhh/XNHcH3v3c2JzsVNbB ED25519 #3
19*.example.com,192.0.2.*,2001:* 1024 65537 125895605498029643697051635076028105429632810811904702876152645261610759866299221305725069141163240694267669117205342283569102183636228981857946763978553664895308762890072813014496700601576921921752482059207749978374872713540759920335553799711267170948655579130584031555334229966603000896364091459595522912269 RSA1 #3
20*.example.com,192.0.2.*,2001:* ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDX8F93W3SH4ZSus4XUQ2cw9dqcuyUETTlKEeGv3zlknV3YCoe2Mp04naDhiuwj8sOsytrZSESzLY1ZEyzrjxE6ZFVv8NKgck/AbRjcwlRFOcx9oKUxOrXRa0IoXlTq0kyjKCJfaHBKnGitZThknCPTbVmpATkm5xx6J0WEDozfoQ== RSA #3
21
22# Hashed hostname and address entries
23|1|6FWxoqTCAfm8sZ7T/q73OmxCFGM=|S4eQmusok4cbyDzzGEFGIAthDbw= ssh-dss AAAAB3NzaC1kc3MAAACBALrFy7w5ihlaOG+qR+6fj+vm5EQaO3qwxgACLcgH+VfShuOG4mkx8qFJmf+OZ3fh5iKngjNZfKtfcqI7zHWdk6378TQfQC52/kbZukjNXOLCpyNkogahcjA00onIoTK1RUDuMW28edAHwPFbpttXDTaqis+8JPMY8hZwsZGENCzTAAAAFQD6+It5vozwGgaN9ROYPMlByhi6jwAAAIBz2mcAC694vNzz9b6614gkX9d9E99PzJYfU1MPkXDziKg7MrjBw7Opd5y1jL09S3iL6lSTlHkKwVKvQ3pOwWRwXXRrKVus4I0STveoApm526jmp6mY0YEtqR98vMJ0v97h1ydt8FikKlihefCsnXVicb8887PXs2Y8C6GuFT3tfQAAAIBbmHtV5tPcrMRDkULhaQ/Whap2VKvT2DUhIHA7lx6oy/KpkltOpxDZOIGUHKqffGbiR7Jh01/y090AY5L2eCf0S2Ytx93+eADwVVpJbFJo6zSwfeey2Gm6L2oA+rCz9zTdmtZoekpD3/RAOQjnJIAPwbs7mXwabZTw4xRtiYIRrw== DSA #5
24|1|hTrfD0CuuB9ZbOa1CHFYvIk/gKE=|tPmW50t7flncm1UyM+DR97ubDNU= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPIudcagzq4QPtP1jkpje34+0POLB0jwT64hqrbCqhTH2T800KDZ0h2vwlJYa3OP3Oqru9AB5pnuHsKw7mAhUGY= ECDSA #5
25|1|fOGqe75X5ZpTz4c7DitP4E8/y30=|Lmcch2fh54bUYoV//S2VqDFVeiY= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINf63qSV8rD57N+digID8t28WVhd3Yf2K2UhaoG8TsWQ ED25519 #5
26|1|0RVzLjY3lwE3MRweguaAXaCCWk8=|DbcIgJQcRZJMYI6NYDOM6oJycPk= 1024 65537 127931411493401587586867047972295564331543694182352197506125410692673654572057908999642645524647232712160516076508316152810117209181150078352725299319149726341058893406440426414316276977768958023952319602422835879783057966985348561111880658922724668687074412548487722084792283453716871417610020757212399252171 RSA1 #5
27|1|4q79XnHpKBNQhyMLAqbPPDN+JKo=|k1Wvjjb52zDdrXWM801+wX5oH8U= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC/C15Q4sfnk7BZff1er8bscay+5s51oD4eWArlHWMK/ZfYeeTAccTy+7B7Jv+MS4nKCpflrvJI2RQz4kS8vF0ATdBbi4jeWefStlHNg0HLhnCY7NAfDIlRdaN9lm3Pqm2vmr+CkqwcJaSpycDg8nPN9yNAuD6pv7NDuUnECezojQ== RSA #5
28
29|1|0M6PIx6THA3ipIOvTl3fcgn2z+A=|bwEJAOwJz+Sm7orFdgj170mD/zY= ssh-dss AAAAB3NzaC1kc3MAAACBAIutigAse65TCW6hHDOEGXenE9L4L0talHbs65hj3UUNtWflKdQeXLofqXgW8AwaDKmnuRPrxRoxVNXj84n45wtBEdt4ztmdAZteAbXSnHqpcxME3jDxh3EtxzGPXLs+RUmKPVguraSgo7W2oN7KFx6VM+AcAtxANSTlvDid3s47AAAAFQCd9Q3kkHSLWe77sW0eRaayI45ovwAAAIAw6srGF6xvFasI44Y3r9JJ2K+3ezozl3ldL3p2+p2HG3iWafC4SdV8pB6ZIxKlYAywiiFb3LzH/JweGFq1jtoFDRM3MlYORBevydU4zPz7b5QLDVB0sY4evYtWmg2BFJvoWRfhLnlZVW7h5N8v4fNIwdVmVsw4Ljes7iF2HRGhHgAAAIBDFT3fww2Oby1xUA6G9pDAcVikrQFqp1sJRylNTUyeyQ37SNAGzYxwHJFgQr8gZLdRQ1UW+idYpqVbVNcYFMOiw/zSqK2OfVwPZ9U+TTKdc992ChSup6vJEKM/ZVIyDWDbJr7igQ4ahy7jo9mFvm8ljN926EnspQzCvs0Dxk6tHA== DSA #6
30|1|a6WGHcL+9gX3e96tMlgDSDJwtSg=|5Dqlb/yqNEf7jgfllrp/ygLmRV8= ssh-dss AAAAB3NzaC1kc3MAAACBAIutigAse65TCW6hHDOEGXenE9L4L0talHbs65hj3UUNtWflKdQeXLofqXgW8AwaDKmnuRPrxRoxVNXj84n45wtBEdt4ztmdAZteAbXSnHqpcxME3jDxh3EtxzGPXLs+RUmKPVguraSgo7W2oN7KFx6VM+AcAtxANSTlvDid3s47AAAAFQCd9Q3kkHSLWe77sW0eRaayI45ovwAAAIAw6srGF6xvFasI44Y3r9JJ2K+3ezozl3ldL3p2+p2HG3iWafC4SdV8pB6ZIxKlYAywiiFb3LzH/JweGFq1jtoFDRM3MlYORBevydU4zPz7b5QLDVB0sY4evYtWmg2BFJvoWRfhLnlZVW7h5N8v4fNIwdVmVsw4Ljes7iF2HRGhHgAAAIBDFT3fww2Oby1xUA6G9pDAcVikrQFqp1sJRylNTUyeyQ37SNAGzYxwHJFgQr8gZLdRQ1UW+idYpqVbVNcYFMOiw/zSqK2OfVwPZ9U+TTKdc992ChSup6vJEKM/ZVIyDWDbJr7igQ4ahy7jo9mFvm8ljN926EnspQzCvs0Dxk6tHA== DSA #6
31|1|OeCpi7Pn5Q6c8la4fPf9G8YctT8=|sC6D7lDXTafIpokZJ1+1xWg2R6Q= ssh-dss AAAAB3NzaC1kc3MAAACBAIutigAse65TCW6hHDOEGXenE9L4L0talHbs65hj3UUNtWflKdQeXLofqXgW8AwaDKmnuRPrxRoxVNXj84n45wtBEdt4ztmdAZteAbXSnHqpcxME3jDxh3EtxzGPXLs+RUmKPVguraSgo7W2oN7KFx6VM+AcAtxANSTlvDid3s47AAAAFQCd9Q3kkHSLWe77sW0eRaayI45ovwAAAIAw6srGF6xvFasI44Y3r9JJ2K+3ezozl3ldL3p2+p2HG3iWafC4SdV8pB6ZIxKlYAywiiFb3LzH/JweGFq1jtoFDRM3MlYORBevydU4zPz7b5QLDVB0sY4evYtWmg2BFJvoWRfhLnlZVW7h5N8v4fNIwdVmVsw4Ljes7iF2HRGhHgAAAIBDFT3fww2Oby1xUA6G9pDAcVikrQFqp1sJRylNTUyeyQ37SNAGzYxwHJFgQr8gZLdRQ1UW+idYpqVbVNcYFMOiw/zSqK2OfVwPZ9U+TTKdc992ChSup6vJEKM/ZVIyDWDbJr7igQ4ahy7jo9mFvm8ljN926EnspQzCvs0Dxk6tHA== DSA #6
32|1|BHESVyiJ7G2NN0lxrw7vT109jmk=|TKof+015J77bXqibsh0N1Lp0MKk= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK1wRLyKtvK3Mmhd0XPkKwW4ev1KBVf8J4aG8lESq1TsaqqfOXYGyxMq5pN8fCGiD5UPOqyTYz/ZNzClRhJRHao= ECDSA #6
33|1|wY53mZNASDJ5/P3JYCJ4FUNa6WQ=|v8p0MfV5lqlZB2J0yLxl/gsWVQo= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK1wRLyKtvK3Mmhd0XPkKwW4ev1KBVf8J4aG8lESq1TsaqqfOXYGyxMq5pN8fCGiD5UPOqyTYz/ZNzClRhJRHao= ECDSA #6
34|1|horeoyFPwfKhyFN+zJZ5LCfOo/I=|2ofvp0tNwCbKsV8FuiFA4gQG2Z8= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK1wRLyKtvK3Mmhd0XPkKwW4ev1KBVf8J4aG8lESq1TsaqqfOXYGyxMq5pN8fCGiD5UPOqyTYz/ZNzClRhJRHao= ECDSA #6
35|1|Aw4fXumZfx6jEIJuDGIyeEMd81A=|5FdLtdm2JeKNsS8IQeQlGYIadOE= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPLW0ZwCkRQldpLa4I5BpwGa/om+WE6OgC8jdVqakt0Z ED25519 #6
36|1|+dGUNpv6GblrDd5fgHLlOWpSbEo=|He/pQ1yJjtiCyTNWpGwjBD4sZFI= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPLW0ZwCkRQldpLa4I5BpwGa/om+WE6OgC8jdVqakt0Z ED25519 #6
37|1|E/PACGl8m1T7QnPedOoooozstP0=|w6DQAFT8yZgj0Hlkz5R1TppYHCA= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPLW0ZwCkRQldpLa4I5BpwGa/om+WE6OgC8jdVqakt0Z ED25519 #6
38|1|SaoyMStgxpYfwedSXBAghi8Zo0s=|Gz78k69GaE6iViV3OOvbStKqyTA= 1024 65537 140883028436203600354693376066567741282115117509696517282419557936340193768851493584179972504103033755515036493433917203732876685813283050574208967197963391667532902202382549275760997891673884333346000558018002659506756213191532156293935482587878596032743105911487673274674568768638010598205190227631909167257 RSA1 #6
39|1|8qfGeiT5WTCzWYbXPQ+lsLg7km4=|1sIBwiSUr8IGkvrUGm3/9QYurmA= 1024 65537 140883028436203600354693376066567741282115117509696517282419557936340193768851493584179972504103033755515036493433917203732876685813283050574208967197963391667532902202382549275760997891673884333346000558018002659506756213191532156293935482587878596032743105911487673274674568768638010598205190227631909167257 RSA1 #6
40|1|87M1OtyHg1BZiDY3rT6lYsZFnAU=|eddAQVcMNbn2OB87XWXFQnYo6R4= 1024 65537 140883028436203600354693376066567741282115117509696517282419557936340193768851493584179972504103033755515036493433917203732876685813283050574208967197963391667532902202382549275760997891673884333346000558018002659506756213191532156293935482587878596032743105911487673274674568768638010598205190227631909167257 RSA1 #6
41|1|60w3wFfC0XWI+rRmRlxIRhh8lwE=|yMhsGrzBJKiesAdSQ/PVgkCrDKk= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQClu/3I6GG1Ai89Imnw0vXmWJ2OW0ftQwRrsbIAD0qzLFYpkJ76QWnzpCehvK9u0L5hcw7z2Y6mRLcSBsqONc+HVU73Qi7M4zHRvtjprPs3SOyLpf0J9sL1WiHBDwg2P0miHMCdqHDd5nVXkJB2d4eeecmgezGLa29NOHZjbza5yw== RSA #6
42|1|5gdEMmLUJC7grqWhRJPy2OTaSyE=|/XTfmLMa/B8npcVCGFRdaHl+d/0= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQClu/3I6GG1Ai89Imnw0vXmWJ2OW0ftQwRrsbIAD0qzLFYpkJ76QWnzpCehvK9u0L5hcw7z2Y6mRLcSBsqONc+HVU73Qi7M4zHRvtjprPs3SOyLpf0J9sL1WiHBDwg2P0miHMCdqHDd5nVXkJB2d4eeecmgezGLa29NOHZjbza5yw== RSA #6
43|1|6FGCWUr42GHdMB/eifnHNCuwgdk=|ONJvYZ/ANmi59R5HrOhLPmvYENM= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQClu/3I6GG1Ai89Imnw0vXmWJ2OW0ftQwRrsbIAD0qzLFYpkJ76QWnzpCehvK9u0L5hcw7z2Y6mRLcSBsqONc+HVU73Qi7M4zHRvtjprPs3SOyLpf0J9sL1WiHBDwg2P0miHMCdqHDd5nVXkJB2d4eeecmgezGLa29NOHZjbza5yw== RSA #6
44
45
46# Revoked and CA keys
47@revoked sisyphus.example.com 1024 65537 174143366122697048196335388217056770310345753698079464367148030836533360510864881734142526411160017107552815906024399248049666856133771656680462456979369587903909343046704480897527203474513676654933090991684252819423129896444427656841613263783484827101210734799449281639493127615902427443211183258155381810593 RSA1 #4
48@revoked sisyphus.example.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDFP8L9REfN/iYy1KIRtFqSCn3V2+vOCpoZYENFGLdOF ED25519 #4
49@cert-authority prometheus.example.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHZd0OXHIWwK3xnjAdMZ1tojxWycdu38pORO/UX5cqsKMgGCKQVBWWO3TFk1ePkGIE9VMWT1hCGqWRRwYlH+dSE= ECDSA #4
50@cert-authority *.example.com ssh-dss AAAAB3NzaC1kc3MAAACBAKvjnFHm0VvMr5h2Zu3nURsxQKGoxm+DCzYDxRYcilK07Cm5c4XTrFbA2X86+9sGs++W7QRMcTJUYIg0a+UtIMtAjwORd6ZPXM2K5dBW+gh1oHyvKi767tWX7I2c+1ZPJDY95mUUfZQUEfdy9eGDSBmw/pSsveQ1ur6XNUh/MtP/AAAAFQDHnXk/9jBJAdce1pHtLWnbdPSGdQAAAIEAm2OLy8tZBfiEO3c3X1yyB/GTcDwrQCqRMDkhnsmrliec3dWkOfNTzu+MrdvF8ymTWLEqPpbMheYtvNyZ3TF0HO5W7aVBpdGZbOdOAIfB+6skqGbI8A5Up1d7dak/bSsqL2r5NjwbDOdq+1hBzzvbl/qjh+sQarV2zHrpKoQaV28AAACANtkBVedBbqIAdphCrN/LbUi9WlyuF9UZz+tlpVLYrj8GJVwnplV2tvOmUw6yP5/pzCimTsao8dpL5PWxm7fKxLWVxA+lEsA4WeC885CiZn8xhdaJOCN+NyJ2bqkz+4VPI7oDGBm0aFwUqJn+M1PiSgvI50XdF2dBsFRTRNY0wzA= DSA #4
51
52# Some invalid lines
53@what sisyphus.example.com 1024 65537 153895431603677073925890314548566704948446776958334195280085080329934839226701954473292358821568047724356487621573742372399387931887004184139835510820577359977148363519970774657801798872789118894962853659233045778161859413980935372685480527355016624825696983269800574755126132814333241868538220824608980319407 RSA1 #1
54sisyphus.example.com
55prometheus.example.com ssh-ed25519
56sisyphus.example.com ssh-dsa AAAATgAAAAdz
57prometheus.example.com 1024
58sisyphus.example.com 1024 65535
59prometheus.example.com 1025 65537 153895431603677073925890314548566704948446776958334195280085080329934839226701954473292358821568047724356487621573742372399387931887004184139835510820577359977148363519970774657801798872789118894962853659233045778161859413980935372685480527355016624825696983269800574755126132814333241868538220824608980319407 RSA1 #1
60sisyphus.example.com ssh-XXX AAAATgAAAAdzc2gtWFhYAAAAP0ZVQ0tPRkZGVUNLT0ZGRlVDS09GRkZVQ0tPRkZGVUNLT0ZGRlVDS09GRkZVQ0tPRkZGVUNLT0ZGRlVDS09GRg==
61prometheus.example.com ssh-rsa AAAATgAAAAdzc2gtWFhYAAAAP0ZVQ0tPRkZGVUNLT0ZGRlVDS09GRkZVQ0tPRkZGVUNLT0ZGRlVDS09GRkZVQ0tPRkZGVUNLT0ZGRlVDS09GRg==
diff --git a/regress/unittests/hostkeys/testdata/rsa1_1.pub b/regress/unittests/hostkeys/testdata/rsa1_1.pub
new file mode 100644
index 000000000..772ce9c05
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa1_1.pub
@@ -0,0 +1 @@
1024 65537 153895431603677073925890314548566704948446776958334195280085080329934839226701954473292358821568047724356487621573742372399387931887004184139835510820577359977148363519970774657801798872789118894962853659233045778161859413980935372685480527355016624825696983269800574755126132814333241868538220824608980319407 RSA1 #1
diff --git a/regress/unittests/hostkeys/testdata/rsa1_2.pub b/regress/unittests/hostkeys/testdata/rsa1_2.pub
new file mode 100644
index 000000000..78794b941
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa1_2.pub
@@ -0,0 +1 @@
1024 65537 135970715082947442639683969597180728933388298633245835186618852623800675939308729462220235058285909679252157995530180587329132927339620517781785310829060832352381015614725360278571924286986474946772141568893116432268565829418506866604294073334978275702221949783314402806080929601995102334442541344606109853641 RSA1 #2
diff --git a/regress/unittests/hostkeys/testdata/rsa1_3.pub b/regress/unittests/hostkeys/testdata/rsa1_3.pub
new file mode 100644
index 000000000..0c035fe0a
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa1_3.pub
@@ -0,0 +1 @@
1024 65537 125895605498029643697051635076028105429632810811904702876152645261610759866299221305725069141163240694267669117205342283569102183636228981857946763978553664895308762890072813014496700601576921921752482059207749978374872713540759920335553799711267170948655579130584031555334229966603000896364091459595522912269 RSA1 #3
diff --git a/regress/unittests/hostkeys/testdata/rsa1_4.pub b/regress/unittests/hostkeys/testdata/rsa1_4.pub
new file mode 100644
index 000000000..00064423e
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa1_4.pub
@@ -0,0 +1 @@
1024 65537 174143366122697048196335388217056770310345753698079464367148030836533360510864881734142526411160017107552815906024399248049666856133771656680462456979369587903909343046704480897527203474513676654933090991684252819423129896444427656841613263783484827101210734799449281639493127615902427443211183258155381810593 RSA1 #4
diff --git a/regress/unittests/hostkeys/testdata/rsa1_5.pub b/regress/unittests/hostkeys/testdata/rsa1_5.pub
new file mode 100644
index 000000000..bb53c2642
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa1_5.pub
@@ -0,0 +1 @@
1024 65537 127931411493401587586867047972295564331543694182352197506125410692673654572057908999642645524647232712160516076508316152810117209181150078352725299319149726341058893406440426414316276977768958023952319602422835879783057966985348561111880658922724668687074412548487722084792283453716871417610020757212399252171 RSA1 #5
diff --git a/regress/unittests/hostkeys/testdata/rsa1_6.pub b/regress/unittests/hostkeys/testdata/rsa1_6.pub
new file mode 100644
index 000000000..85d6576b5
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa1_6.pub
@@ -0,0 +1 @@
1024 65537 140883028436203600354693376066567741282115117509696517282419557936340193768851493584179972504103033755515036493433917203732876685813283050574208967197963391667532902202382549275760997891673884333346000558018002659506756213191532156293935482587878596032743105911487673274674568768638010598205190227631909167257 RSA1 #6
diff --git a/regress/unittests/hostkeys/testdata/rsa_1.pub b/regress/unittests/hostkeys/testdata/rsa_1.pub
new file mode 100644
index 000000000..2b87885a1
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa_1.pub
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDg4hB4vAZHJ0PVRiJajOv/GlytFWNpv5/9xgB9+5BIbvp8LOrFZ5D9K0Gsmwpd4G4rfaAz8j896DhMArg0vtkilIPPGt/6VzWMERgvaIQPJ/IE99X3+fjcAG56oAWwy29JX10lQMzBPU6XJIaN/zqpkb6qUBiAHBdLpxrFBBU0/w== RSA #1
diff --git a/regress/unittests/hostkeys/testdata/rsa_2.pub b/regress/unittests/hostkeys/testdata/rsa_2.pub
new file mode 100644
index 000000000..33f1fd93b
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa_2.pub
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDmbUhNabB5AmBDX6GNHZ3lbn7pRxqfpW+f53QqNGlK0sLV+0gkMIrOfUp1kdE2ZLE6tfzdicatj/RlH6/wuo4yyYb+Pyx3G0vxdmAIiA4aANq38XweDucBC0TZkRWVHK+Gs5V/uV0z7N0axJvkkJujMLvST3CRiiWwlficBc6yVQ== RSA #2
diff --git a/regress/unittests/hostkeys/testdata/rsa_3.pub b/regress/unittests/hostkeys/testdata/rsa_3.pub
new file mode 100644
index 000000000..c2f6b208c
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa_3.pub
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDX8F93W3SH4ZSus4XUQ2cw9dqcuyUETTlKEeGv3zlknV3YCoe2Mp04naDhiuwj8sOsytrZSESzLY1ZEyzrjxE6ZFVv8NKgck/AbRjcwlRFOcx9oKUxOrXRa0IoXlTq0kyjKCJfaHBKnGitZThknCPTbVmpATkm5xx6J0WEDozfoQ== RSA #3
diff --git a/regress/unittests/hostkeys/testdata/rsa_4.pub b/regress/unittests/hostkeys/testdata/rsa_4.pub
new file mode 100644
index 000000000..35545a713
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa_4.pub
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDI8AdjBAozcdRnIikVlt69iyDHKyrtxmpdkbRy9bWaL86OH+PTmLUk5e+T/ufiakpeE2pm0hkE3e4Sh/FsY+rsQdRoraWVNFfchcMeVlKvuy5RZN0ElvmaQebOJUeNeBn2LLw8aL8bJ4CP/bQRKrmrSSqjz3+4H9YNVyyk1OGBPQ== RSA #4
diff --git a/regress/unittests/hostkeys/testdata/rsa_5.pub b/regress/unittests/hostkeys/testdata/rsa_5.pub
new file mode 100644
index 000000000..befbaa7d9
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa_5.pub
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC/C15Q4sfnk7BZff1er8bscay+5s51oD4eWArlHWMK/ZfYeeTAccTy+7B7Jv+MS4nKCpflrvJI2RQz4kS8vF0ATdBbi4jeWefStlHNg0HLhnCY7NAfDIlRdaN9lm3Pqm2vmr+CkqwcJaSpycDg8nPN9yNAuD6pv7NDuUnECezojQ== RSA #5
diff --git a/regress/unittests/hostkeys/testdata/rsa_6.pub b/regress/unittests/hostkeys/testdata/rsa_6.pub
new file mode 100644
index 000000000..393e11672
--- /dev/null
+++ b/regress/unittests/hostkeys/testdata/rsa_6.pub
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQClu/3I6GG1Ai89Imnw0vXmWJ2OW0ftQwRrsbIAD0qzLFYpkJ76QWnzpCehvK9u0L5hcw7z2Y6mRLcSBsqONc+HVU73Qi7M4zHRvtjprPs3SOyLpf0J9sL1WiHBDwg2P0miHMCdqHDd5nVXkJB2d4eeecmgezGLa29NOHZjbza5yw== RSA #6
diff --git a/regress/unittests/hostkeys/tests.c b/regress/unittests/hostkeys/tests.c
new file mode 100644
index 000000000..92c7646ad
--- /dev/null
+++ b/regress/unittests/hostkeys/tests.c
@@ -0,0 +1,16 @@
1/* $OpenBSD: tests.c,v 1.1 2015/02/16 22:18:34 djm Exp $ */
2/*
3 * Regress test for known_hosts-related API.
4 *
5 * Placed in the public domain
6 */
7
8void tests(void);
9void test_iterate(void); /* test_iterate.c */
10
11void
12tests(void)
13{
14 test_iterate();
15}
16
diff --git a/regress/unittests/kex/Makefile b/regress/unittests/kex/Makefile
new file mode 100644
index 000000000..6532cb00a
--- /dev/null
+++ b/regress/unittests/kex/Makefile
@@ -0,0 +1,14 @@
1# $OpenBSD: Makefile,v 1.2 2015/01/24 10:39:21 miod Exp $
2
3TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
4
5PROG=test_kex
6SRCS=tests.c test_kex.c
7REGRESS_TARGETS=run-regress-${PROG}
8
9run-regress-${PROG}: ${PROG}
10 env ${TEST_ENV} ./${PROG}
11
12.include <bsd.regress.mk>
13
14LDADD+=-lz
diff --git a/regress/unittests/kex/test_kex.c b/regress/unittests/kex/test_kex.c
new file mode 100644
index 000000000..c61e2bdbb
--- /dev/null
+++ b/regress/unittests/kex/test_kex.c
@@ -0,0 +1,197 @@
1/* $OpenBSD: test_kex.c,v 1.1 2015/01/15 23:41:29 markus Exp $ */
2/*
3 * Regress test KEX
4 *
5 * Placed in the public domain
6 */
7
8#include "includes.h"
9
10#include <sys/types.h>
11#include <sys/param.h>
12#include <stdio.h>
13#ifdef HAVE_STDINT_H
14#include <stdint.h>
15#endif
16#include <stdlib.h>
17#include <string.h>
18
19#include "../test_helper/test_helper.h"
20
21#include "ssherr.h"
22#include "ssh_api.h"
23#include "sshbuf.h"
24#include "packet.h"
25#include "myproposal.h"
26
27struct ssh *active_state = NULL; /* XXX - needed for linking */
28
29void kex_tests(void);
30static int do_debug = 0;
31
32static int
33do_send_and_receive(struct ssh *from, struct ssh *to)
34{
35 u_char type;
36 size_t len;
37 const u_char *buf;
38 int r;
39
40 for (;;) {
41 if ((r = ssh_packet_next(from, &type)) != 0) {
42 fprintf(stderr, "ssh_packet_next: %s\n", ssh_err(r));
43 return r;
44 }
45 if (type != 0)
46 return 0;
47 buf = ssh_output_ptr(from, &len);
48 if (do_debug)
49 printf("%zu", len);
50 if (len == 0)
51 return 0;
52 if ((r = ssh_output_consume(from, len)) != 0 ||
53 (r = ssh_input_append(to, buf, len)) != 0)
54 return r;
55 }
56}
57
58static void
59run_kex(struct ssh *client, struct ssh *server)
60{
61 int r = 0;
62
63 while (!server->kex->done || !client->kex->done) {
64 if (do_debug)
65 printf(" S:");
66 if ((r = do_send_and_receive(server, client)))
67 break;
68 if (do_debug)
69 printf(" C:");
70 if ((r = do_send_and_receive(client, server)))
71 break;
72 }
73 if (do_debug)
74 printf("done: %s\n", ssh_err(r));
75 ASSERT_INT_EQ(r, 0);
76 ASSERT_INT_EQ(server->kex->done, 1);
77 ASSERT_INT_EQ(client->kex->done, 1);
78}
79
80static void
81do_kex_with_key(char *kex, int keytype, int bits)
82{
83 struct ssh *client = NULL, *server = NULL, *server2 = NULL;
84 struct sshkey *private, *public;
85 struct sshbuf *state;
86 struct kex_params kex_params;
87 char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT };
88
89 TEST_START("sshkey_generate");
90 ASSERT_INT_EQ(sshkey_generate(keytype, bits, &private), 0);
91 TEST_DONE();
92
93 TEST_START("sshkey_from_private");
94 ASSERT_INT_EQ(sshkey_from_private(private, &public), 0);
95 TEST_DONE();
96
97 TEST_START("ssh_init");
98 memcpy(kex_params.proposal, myproposal, sizeof(myproposal));
99 if (kex != NULL)
100 kex_params.proposal[PROPOSAL_KEX_ALGS] = kex;
101 ASSERT_INT_EQ(ssh_init(&client, 0, &kex_params), 0);
102 ASSERT_INT_EQ(ssh_init(&server, 1, &kex_params), 0);
103 ASSERT_PTR_NE(client, NULL);
104 ASSERT_PTR_NE(server, NULL);
105 TEST_DONE();
106
107 TEST_START("ssh_add_hostkey");
108 ASSERT_INT_EQ(ssh_add_hostkey(server, private), 0);
109 ASSERT_INT_EQ(ssh_add_hostkey(client, public), 0);
110 TEST_DONE();
111
112 TEST_START("kex");
113 run_kex(client, server);
114 TEST_DONE();
115
116 TEST_START("rekeying client");
117 ASSERT_INT_EQ(kex_send_kexinit(client), 0);
118 run_kex(client, server);
119 TEST_DONE();
120
121 TEST_START("rekeying server");
122 ASSERT_INT_EQ(kex_send_kexinit(server), 0);
123 run_kex(client, server);
124 TEST_DONE();
125
126 TEST_START("ssh_packet_get_state");
127 state = sshbuf_new();
128 ASSERT_PTR_NE(state, NULL);
129 ASSERT_INT_EQ(ssh_packet_get_state(server, state), 0);
130 ASSERT_INT_GE(sshbuf_len(state), 1);
131 TEST_DONE();
132
133 TEST_START("ssh_packet_set_state");
134 server2 = NULL;
135 ASSERT_INT_EQ(ssh_init(&server2, 1, NULL), 0);
136 ASSERT_PTR_NE(server2, NULL);
137 ASSERT_INT_EQ(ssh_add_hostkey(server2, private), 0);
138 kex_free(server2->kex); /* XXX or should ssh_packet_set_state()? */
139 ASSERT_INT_EQ(ssh_packet_set_state(server2, state), 0);
140 ASSERT_INT_EQ(sshbuf_len(state), 0);
141 sshbuf_free(state);
142 ASSERT_PTR_NE(server2->kex, NULL);
143 /* XXX we need to set the callbacks */
144 server2->kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
145 server2->kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
146 server2->kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
147 server2->kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
148#ifdef OPENSSL_HAS_ECC
149 server2->kex->kex[KEX_ECDH_SHA2] = kexecdh_server;
150#endif
151 server2->kex->kex[KEX_C25519_SHA256] = kexc25519_server;
152 server2->kex->load_host_public_key = server->kex->load_host_public_key;
153 server2->kex->load_host_private_key = server->kex->load_host_private_key;
154 server2->kex->sign = server->kex->sign;
155 TEST_DONE();
156
157 TEST_START("rekeying server2");
158 ASSERT_INT_EQ(kex_send_kexinit(server2), 0);
159 run_kex(client, server2);
160 ASSERT_INT_EQ(kex_send_kexinit(client), 0);
161 run_kex(client, server2);
162 TEST_DONE();
163
164 TEST_START("cleanup");
165 sshkey_free(private);
166 sshkey_free(public);
167 ssh_free(client);
168 ssh_free(server);
169 ssh_free(server2);
170 TEST_DONE();
171}
172
173static void
174do_kex(char *kex)
175{
176 do_kex_with_key(kex, KEY_RSA, 2048);
177 do_kex_with_key(kex, KEY_DSA, 1024);
178#ifdef OPENSSL_HAS_ECC
179 do_kex_with_key(kex, KEY_ECDSA, 256);
180#endif
181 do_kex_with_key(kex, KEY_ED25519, 256);
182}
183
184void
185kex_tests(void)
186{
187 do_kex("curve25519-sha256@libssh.org");
188#ifdef OPENSSL_HAS_ECC
189 do_kex("ecdh-sha2-nistp256");
190 do_kex("ecdh-sha2-nistp384");
191 do_kex("ecdh-sha2-nistp521");
192#endif
193 do_kex("diffie-hellman-group-exchange-sha256");
194 do_kex("diffie-hellman-group-exchange-sha1");
195 do_kex("diffie-hellman-group14-sha1");
196 do_kex("diffie-hellman-group1-sha1");
197}
diff --git a/regress/unittests/kex/tests.c b/regress/unittests/kex/tests.c
new file mode 100644
index 000000000..e7036ec17
--- /dev/null
+++ b/regress/unittests/kex/tests.c
@@ -0,0 +1,14 @@
1/* $OpenBSD: tests.c,v 1.1 2015/01/15 23:41:29 markus Exp $ */
2/*
3 * Placed in the public domain
4 */
5
6#include "../test_helper/test_helper.h"
7
8void kex_tests(void);
9
10void
11tests(void)
12{
13 kex_tests();
14}
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c b/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
index 0c4c71ecd..a68e1329e 100644
--- a/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
+++ b/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
@@ -32,8 +32,6 @@ void
32sshbuf_getput_crypto_tests(void) 32sshbuf_getput_crypto_tests(void)
33{ 33{
34 struct sshbuf *p1; 34 struct sshbuf *p1;
35 const u_char *d;
36 size_t s;
37 BIGNUM *bn, *bn2; 35 BIGNUM *bn, *bn2;
38 /* This one has num_bits != num_bytes * 8 to test bignum1 encoding */ 36 /* This one has num_bits != num_bytes * 8 to test bignum1 encoding */
39 const char *hexbn1 = "0102030405060708090a0b0c0d0e0f10"; 37 const char *hexbn1 = "0102030405060708090a0b0c0d0e0f10";
@@ -48,7 +46,9 @@ sshbuf_getput_crypto_tests(void)
48 0x70, 0x60, 0x50, 0x40, 0x30, 0x20, 0x10, 0x00, 46 0x70, 0x60, 0x50, 0x40, 0x30, 0x20, 0x10, 0x00,
49 0x7f, 0xff, 0x11 47 0x7f, 0xff, 0x11
50 }; 48 };
51#ifdef OPENSSL_HAS_NISTP256 49#if defined(OPENSSL_HAS_ECC) && defined(OPENSSL_HAS_NISTP256)
50 const u_char *d;
51 size_t s;
52 BIGNUM *bn_x, *bn_y; 52 BIGNUM *bn_x, *bn_y;
53 int ec256_nid = NID_X9_62_prime256v1; 53 int ec256_nid = NID_X9_62_prime256v1;
54 char *ec256_x = "0C828004839D0106AA59575216191357" 54 char *ec256_x = "0C828004839D0106AA59575216191357"
@@ -352,7 +352,7 @@ sshbuf_getput_crypto_tests(void)
352 sshbuf_free(p1); 352 sshbuf_free(p1);
353 TEST_DONE(); 353 TEST_DONE();
354 354
355#ifdef OPENSSL_HAS_NISTP256 355#if defined(OPENSSL_HAS_ECC) && defined(OPENSSL_HAS_NISTP256)
356 TEST_START("sshbuf_put_ec"); 356 TEST_START("sshbuf_put_ec");
357 eck = EC_KEY_new_by_curve_name(ec256_nid); 357 eck = EC_KEY_new_by_curve_name(ec256_nid);
358 ASSERT_PTR_NE(eck, NULL); 358 ASSERT_PTR_NE(eck, NULL);
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
index 8c3269b13..c6b5c29d1 100644
--- a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
+++ b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
@@ -33,7 +33,7 @@ attempt_parse_blob(u_char *blob, size_t len)
33{ 33{
34 struct sshbuf *p1; 34 struct sshbuf *p1;
35 BIGNUM *bn; 35 BIGNUM *bn;
36#ifdef OPENSSL_HAS_NISTP256 36#if defined(OPENSSL_HAS_ECC) && defined(OPENSSL_HAS_NISTP256)
37 EC_KEY *eck; 37 EC_KEY *eck;
38#endif 38#endif
39 u_char *s; 39 u_char *s;
@@ -60,7 +60,7 @@ attempt_parse_blob(u_char *blob, size_t len)
60 bn = BN_new(); 60 bn = BN_new();
61 sshbuf_get_bignum2(p1, bn); 61 sshbuf_get_bignum2(p1, bn);
62 BN_clear_free(bn); 62 BN_clear_free(bn);
63#ifdef OPENSSL_HAS_NISTP256 63#if defined(OPENSSL_HAS_ECC) && defined(OPENSSL_HAS_NISTP256)
64 eck = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); 64 eck = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
65 ASSERT_PTR_NE(eck, NULL); 65 ASSERT_PTR_NE(eck, NULL);
66 sshbuf_get_eckey(p1, eck); 66 sshbuf_get_eckey(p1, eck);
diff --git a/regress/unittests/sshkey/common.c b/regress/unittests/sshkey/common.c
index 0a4b3a90c..b598f05cb 100644
--- a/regress/unittests/sshkey/common.c
+++ b/regress/unittests/sshkey/common.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: common.c,v 1.1 2014/06/24 01:14:18 djm Exp $ */ 1/* $OpenBSD: common.c,v 1.2 2015/01/08 13:10:58 djm Exp $ */
2/* 2/*
3 * Helpers for key API tests 3 * Helpers for key API tests
4 * 4 *
@@ -44,7 +44,7 @@ load_file(const char *name)
44 44
45 ASSERT_PTR_NE(ret = sshbuf_new(), NULL); 45 ASSERT_PTR_NE(ret = sshbuf_new(), NULL);
46 ASSERT_INT_NE(fd = open(test_data_file(name), O_RDONLY), -1); 46 ASSERT_INT_NE(fd = open(test_data_file(name), O_RDONLY), -1);
47 ASSERT_INT_EQ(sshkey_load_file(fd, name, ret), 0); 47 ASSERT_INT_EQ(sshkey_load_file(fd, ret), 0);
48 close(fd); 48 close(fd);
49 return ret; 49 return ret;
50} 50}
diff --git a/regress/unittests/sshkey/mktestdata.sh b/regress/unittests/sshkey/mktestdata.sh
index ee1fe3962..09165af02 100755
--- a/regress/unittests/sshkey/mktestdata.sh
+++ b/regress/unittests/sshkey/mktestdata.sh
@@ -1,5 +1,5 @@
1#!/bin/sh 1#!/bin/sh
2# $OpenBSD: mktestdata.sh,v 1.3 2014/07/22 23:57:40 dtucker Exp $ 2# $OpenBSD: mktestdata.sh,v 1.4 2015/01/18 19:54:46 djm Exp $
3 3
4PW=mekmitasdigoat 4PW=mekmitasdigoat
5 5
@@ -187,4 +187,6 @@ ssh-keygen -Bf dsa_2 | awk '{print $2}' > dsa_2.fp.bb
187ssh-keygen -Bf ecdsa_2 | awk '{print $2}' > ecdsa_2.fp.bb 187ssh-keygen -Bf ecdsa_2 | awk '{print $2}' > ecdsa_2.fp.bb
188ssh-keygen -Bf ed25519_2 | awk '{print $2}' > ed25519_2.fp.bb 188ssh-keygen -Bf ed25519_2 | awk '{print $2}' > ed25519_2.fp.bb
189 189
190# XXX Extend ssh-keygen to do detached signatures (better to test/fuzz against)
191
190echo "$PW" > pw 192echo "$PW" > pw
diff --git a/regress/unittests/sshkey/test_file.c b/regress/unittests/sshkey/test_file.c
index 764f7fb76..fa95212bf 100644
--- a/regress/unittests/sshkey/test_file.c
+++ b/regress/unittests/sshkey/test_file.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_file.c,v 1.1 2014/06/24 01:14:18 djm Exp $ */ 1/* $OpenBSD: test_file.c,v 1.3 2015/03/04 23:22:35 djm Exp $ */
2/* 2/*
3 * Regress test for sshkey.h key management API 3 * Regress test for sshkey.h key management API
4 * 4 *
@@ -33,6 +33,7 @@
33#include "authfile.h" 33#include "authfile.h"
34#include "sshkey.h" 34#include "sshkey.h"
35#include "sshbuf.h" 35#include "sshbuf.h"
36#include "digest.h"
36 37
37#include "common.h" 38#include "common.h"
38 39
@@ -50,6 +51,7 @@ sshkey_file_tests(void)
50 pw = load_text_file("pw"); 51 pw = load_text_file("pw");
51 TEST_DONE(); 52 TEST_DONE();
52 53
54#ifdef WITH_SSH1
53 TEST_START("parse RSA1 from private"); 55 TEST_START("parse RSA1 from private");
54 buf = load_file("rsa1_1"); 56 buf = load_file("rsa1_1");
55 ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "rsa1_1", 57 ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "rsa1_1",
@@ -81,7 +83,7 @@ sshkey_file_tests(void)
81 83
82 TEST_START("RSA1 key hex fingerprint"); 84 TEST_START("RSA1 key hex fingerprint");
83 buf = load_text_file("rsa1_1.fp"); 85 buf = load_text_file("rsa1_1.fp");
84 cp = sshkey_fingerprint(k1, SSH_FP_MD5, SSH_FP_HEX); 86 cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
85 ASSERT_PTR_NE(cp, NULL); 87 ASSERT_PTR_NE(cp, NULL);
86 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 88 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
87 sshbuf_free(buf); 89 sshbuf_free(buf);
@@ -90,7 +92,7 @@ sshkey_file_tests(void)
90 92
91 TEST_START("RSA1 key bubblebabble fingerprint"); 93 TEST_START("RSA1 key bubblebabble fingerprint");
92 buf = load_text_file("rsa1_1.fp.bb"); 94 buf = load_text_file("rsa1_1.fp.bb");
93 cp = sshkey_fingerprint(k1, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE); 95 cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE);
94 ASSERT_PTR_NE(cp, NULL); 96 ASSERT_PTR_NE(cp, NULL);
95 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 97 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
96 sshbuf_free(buf); 98 sshbuf_free(buf);
@@ -98,6 +100,7 @@ sshkey_file_tests(void)
98 TEST_DONE(); 100 TEST_DONE();
99 101
100 sshkey_free(k1); 102 sshkey_free(k1);
103#endif
101 104
102 TEST_START("parse RSA from private"); 105 TEST_START("parse RSA from private");
103 buf = load_file("rsa_1"); 106 buf = load_file("rsa_1");
@@ -164,7 +167,7 @@ sshkey_file_tests(void)
164 167
165 TEST_START("RSA key hex fingerprint"); 168 TEST_START("RSA key hex fingerprint");
166 buf = load_text_file("rsa_1.fp"); 169 buf = load_text_file("rsa_1.fp");
167 cp = sshkey_fingerprint(k1, SSH_FP_MD5, SSH_FP_HEX); 170 cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
168 ASSERT_PTR_NE(cp, NULL); 171 ASSERT_PTR_NE(cp, NULL);
169 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 172 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
170 sshbuf_free(buf); 173 sshbuf_free(buf);
@@ -173,7 +176,7 @@ sshkey_file_tests(void)
173 176
174 TEST_START("RSA cert hex fingerprint"); 177 TEST_START("RSA cert hex fingerprint");
175 buf = load_text_file("rsa_1-cert.fp"); 178 buf = load_text_file("rsa_1-cert.fp");
176 cp = sshkey_fingerprint(k2, SSH_FP_MD5, SSH_FP_HEX); 179 cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
177 ASSERT_PTR_NE(cp, NULL); 180 ASSERT_PTR_NE(cp, NULL);
178 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 181 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
179 sshbuf_free(buf); 182 sshbuf_free(buf);
@@ -183,7 +186,7 @@ sshkey_file_tests(void)
183 186
184 TEST_START("RSA key bubblebabble fingerprint"); 187 TEST_START("RSA key bubblebabble fingerprint");
185 buf = load_text_file("rsa_1.fp.bb"); 188 buf = load_text_file("rsa_1.fp.bb");
186 cp = sshkey_fingerprint(k1, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE); 189 cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE);
187 ASSERT_PTR_NE(cp, NULL); 190 ASSERT_PTR_NE(cp, NULL);
188 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 191 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
189 sshbuf_free(buf); 192 sshbuf_free(buf);
@@ -257,7 +260,7 @@ sshkey_file_tests(void)
257 260
258 TEST_START("DSA key hex fingerprint"); 261 TEST_START("DSA key hex fingerprint");
259 buf = load_text_file("dsa_1.fp"); 262 buf = load_text_file("dsa_1.fp");
260 cp = sshkey_fingerprint(k1, SSH_FP_MD5, SSH_FP_HEX); 263 cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
261 ASSERT_PTR_NE(cp, NULL); 264 ASSERT_PTR_NE(cp, NULL);
262 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 265 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
263 sshbuf_free(buf); 266 sshbuf_free(buf);
@@ -266,7 +269,7 @@ sshkey_file_tests(void)
266 269
267 TEST_START("DSA cert hex fingerprint"); 270 TEST_START("DSA cert hex fingerprint");
268 buf = load_text_file("dsa_1-cert.fp"); 271 buf = load_text_file("dsa_1-cert.fp");
269 cp = sshkey_fingerprint(k2, SSH_FP_MD5, SSH_FP_HEX); 272 cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
270 ASSERT_PTR_NE(cp, NULL); 273 ASSERT_PTR_NE(cp, NULL);
271 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 274 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
272 sshbuf_free(buf); 275 sshbuf_free(buf);
@@ -276,7 +279,7 @@ sshkey_file_tests(void)
276 279
277 TEST_START("DSA key bubblebabble fingerprint"); 280 TEST_START("DSA key bubblebabble fingerprint");
278 buf = load_text_file("dsa_1.fp.bb"); 281 buf = load_text_file("dsa_1.fp.bb");
279 cp = sshkey_fingerprint(k1, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE); 282 cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE);
280 ASSERT_PTR_NE(cp, NULL); 283 ASSERT_PTR_NE(cp, NULL);
281 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 284 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
282 sshbuf_free(buf); 285 sshbuf_free(buf);
@@ -357,7 +360,7 @@ sshkey_file_tests(void)
357 360
358 TEST_START("ECDSA key hex fingerprint"); 361 TEST_START("ECDSA key hex fingerprint");
359 buf = load_text_file("ecdsa_1.fp"); 362 buf = load_text_file("ecdsa_1.fp");
360 cp = sshkey_fingerprint(k1, SSH_FP_MD5, SSH_FP_HEX); 363 cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
361 ASSERT_PTR_NE(cp, NULL); 364 ASSERT_PTR_NE(cp, NULL);
362 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 365 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
363 sshbuf_free(buf); 366 sshbuf_free(buf);
@@ -366,7 +369,7 @@ sshkey_file_tests(void)
366 369
367 TEST_START("ECDSA cert hex fingerprint"); 370 TEST_START("ECDSA cert hex fingerprint");
368 buf = load_text_file("ecdsa_1-cert.fp"); 371 buf = load_text_file("ecdsa_1-cert.fp");
369 cp = sshkey_fingerprint(k2, SSH_FP_MD5, SSH_FP_HEX); 372 cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
370 ASSERT_PTR_NE(cp, NULL); 373 ASSERT_PTR_NE(cp, NULL);
371 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 374 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
372 sshbuf_free(buf); 375 sshbuf_free(buf);
@@ -376,7 +379,7 @@ sshkey_file_tests(void)
376 379
377 TEST_START("ECDSA key bubblebabble fingerprint"); 380 TEST_START("ECDSA key bubblebabble fingerprint");
378 buf = load_text_file("ecdsa_1.fp.bb"); 381 buf = load_text_file("ecdsa_1.fp.bb");
379 cp = sshkey_fingerprint(k1, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE); 382 cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE);
380 ASSERT_PTR_NE(cp, NULL); 383 ASSERT_PTR_NE(cp, NULL);
381 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 384 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
382 sshbuf_free(buf); 385 sshbuf_free(buf);
@@ -424,7 +427,7 @@ sshkey_file_tests(void)
424 427
425 TEST_START("Ed25519 key hex fingerprint"); 428 TEST_START("Ed25519 key hex fingerprint");
426 buf = load_text_file("ed25519_1.fp"); 429 buf = load_text_file("ed25519_1.fp");
427 cp = sshkey_fingerprint(k1, SSH_FP_MD5, SSH_FP_HEX); 430 cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
428 ASSERT_PTR_NE(cp, NULL); 431 ASSERT_PTR_NE(cp, NULL);
429 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 432 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
430 sshbuf_free(buf); 433 sshbuf_free(buf);
@@ -433,7 +436,7 @@ sshkey_file_tests(void)
433 436
434 TEST_START("Ed25519 cert hex fingerprint"); 437 TEST_START("Ed25519 cert hex fingerprint");
435 buf = load_text_file("ed25519_1-cert.fp"); 438 buf = load_text_file("ed25519_1-cert.fp");
436 cp = sshkey_fingerprint(k2, SSH_FP_MD5, SSH_FP_HEX); 439 cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
437 ASSERT_PTR_NE(cp, NULL); 440 ASSERT_PTR_NE(cp, NULL);
438 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 441 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
439 sshbuf_free(buf); 442 sshbuf_free(buf);
@@ -443,7 +446,7 @@ sshkey_file_tests(void)
443 446
444 TEST_START("Ed25519 key bubblebabble fingerprint"); 447 TEST_START("Ed25519 key bubblebabble fingerprint");
445 buf = load_text_file("ed25519_1.fp.bb"); 448 buf = load_text_file("ed25519_1.fp.bb");
446 cp = sshkey_fingerprint(k1, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE); 449 cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE);
447 ASSERT_PTR_NE(cp, NULL); 450 ASSERT_PTR_NE(cp, NULL);
448 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); 451 ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
449 sshbuf_free(buf); 452 sshbuf_free(buf);
diff --git a/regress/unittests/sshkey/test_fuzz.c b/regress/unittests/sshkey/test_fuzz.c
index a3f61a6df..1f08a2e43 100644
--- a/regress/unittests/sshkey/test_fuzz.c
+++ b/regress/unittests/sshkey/test_fuzz.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_fuzz.c,v 1.1 2014/06/24 01:14:18 djm Exp $ */ 1/* $OpenBSD: test_fuzz.c,v 1.4 2015/03/04 23:22:35 djm Exp $ */
2/* 2/*
3 * Fuzz tests for key parsing 3 * Fuzz tests for key parsing
4 * 4 *
@@ -53,7 +53,7 @@ public_fuzz(struct sshkey *k)
53 struct fuzz *fuzz; 53 struct fuzz *fuzz;
54 54
55 ASSERT_PTR_NE(buf = sshbuf_new(), NULL); 55 ASSERT_PTR_NE(buf = sshbuf_new(), NULL);
56 ASSERT_INT_EQ(sshkey_to_blob_buf(k, buf), 0); 56 ASSERT_INT_EQ(sshkey_putb(k, buf), 0);
57 /* XXX need a way to run the tests in "slow, but complete" mode */ 57 /* XXX need a way to run the tests in "slow, but complete" mode */
58 fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | /* XXX too slow FUZZ_2_BIT_FLIP | */ 58 fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | /* XXX too slow FUZZ_2_BIT_FLIP | */
59 FUZZ_1_BYTE_FLIP | /* XXX too slow FUZZ_2_BYTE_FLIP | */ 59 FUZZ_1_BYTE_FLIP | /* XXX too slow FUZZ_2_BYTE_FLIP | */
@@ -87,8 +87,11 @@ sig_fuzz(struct sshkey *k)
87 free(sig); 87 free(sig);
88 TEST_ONERROR(onerror, fuzz); 88 TEST_ONERROR(onerror, fuzz);
89 for(; !fuzz_done(fuzz); fuzz_next(fuzz)) { 89 for(; !fuzz_done(fuzz); fuzz_next(fuzz)) {
90 sshkey_verify(k, fuzz_ptr(fuzz), fuzz_len(fuzz), 90 /* Ensure 1-bit difference at least */
91 c, sizeof(c), 0); 91 if (fuzz_matches_original(fuzz))
92 continue;
93 ASSERT_INT_NE(sshkey_verify(k, fuzz_ptr(fuzz), fuzz_len(fuzz),
94 c, sizeof(c), 0), 0);
92 } 95 }
93 fuzz_cleanup(fuzz); 96 fuzz_cleanup(fuzz);
94} 97}
@@ -101,6 +104,7 @@ sshkey_fuzz_tests(void)
101 struct fuzz *fuzz; 104 struct fuzz *fuzz;
102 int r; 105 int r;
103 106
107#ifdef WITH_SSH1
104 TEST_START("fuzz RSA1 private"); 108 TEST_START("fuzz RSA1 private");
105 buf = load_file("rsa1_1"); 109 buf = load_file("rsa1_1");
106 fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | FUZZ_1_BYTE_FLIP | 110 fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | FUZZ_1_BYTE_FLIP |
@@ -144,6 +148,7 @@ sshkey_fuzz_tests(void)
144 sshbuf_free(fuzzed); 148 sshbuf_free(fuzzed);
145 fuzz_cleanup(fuzz); 149 fuzz_cleanup(fuzz);
146 TEST_DONE(); 150 TEST_DONE();
151#endif
147 152
148 TEST_START("fuzz RSA private"); 153 TEST_START("fuzz RSA private");
149 buf = load_file("rsa_1"); 154 buf = load_file("rsa_1");
diff --git a/regress/unittests/sshkey/test_sshkey.c b/regress/unittests/sshkey/test_sshkey.c
index ef0c67956..ad10c9be2 100644
--- a/regress/unittests/sshkey/test_sshkey.c
+++ b/regress/unittests/sshkey/test_sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_sshkey.c,v 1.1 2014/06/24 01:14:18 djm Exp $ */ 1/* $OpenBSD: test_sshkey.c,v 1.3 2015/01/26 06:11:28 djm Exp $ */
2/* 2/*
3 * Regress test for sshkey.h key management API 3 * Regress test for sshkey.h key management API
4 * 4 *
@@ -19,7 +19,7 @@
19#include <openssl/bn.h> 19#include <openssl/bn.h>
20#include <openssl/rsa.h> 20#include <openssl/rsa.h>
21#include <openssl/dsa.h> 21#include <openssl/dsa.h>
22#ifdef OPENSSL_HAS_NISTP256 22#if defined(OPENSSL_HAS_ECC) && defined(OPENSSL_HAS_NISTP256)
23# include <openssl/ec.h> 23# include <openssl/ec.h>
24#endif 24#endif
25 25
@@ -37,6 +37,20 @@
37void sshkey_tests(void); 37void sshkey_tests(void);
38 38
39static void 39static void
40put_opt(struct sshbuf *b, const char *name, const char *value)
41{
42 struct sshbuf *sect;
43
44 sect = sshbuf_new();
45 ASSERT_PTR_NE(sect, NULL);
46 ASSERT_INT_EQ(sshbuf_put_cstring(b, name), 0);
47 if (value != NULL)
48 ASSERT_INT_EQ(sshbuf_put_cstring(sect, value), 0);
49 ASSERT_INT_EQ(sshbuf_put_stringb(b, sect), 0);
50 sshbuf_free(sect);
51}
52
53static void
40build_cert(struct sshbuf *b, const struct sshkey *k, const char *type, 54build_cert(struct sshbuf *b, const struct sshkey *k, const char *type,
41 const struct sshkey *sign_key, const struct sshkey *ca_key) 55 const struct sshkey *sign_key, const struct sshkey *ca_key)
42{ 56{
@@ -45,25 +59,31 @@ build_cert(struct sshbuf *b, const struct sshkey *k, const char *type,
45 size_t siglen; 59 size_t siglen;
46 60
47 ca_buf = sshbuf_new(); 61 ca_buf = sshbuf_new();
48 ASSERT_INT_EQ(sshkey_to_blob_buf(ca_key, ca_buf), 0); 62 ASSERT_PTR_NE(ca_buf, NULL);
63 ASSERT_INT_EQ(sshkey_putb(ca_key, ca_buf), 0);
49 64
50 /* 65 /*
51 * Get the public key serialisation by rendering the key and skipping 66 * Get the public key serialisation by rendering the key and skipping
52 * the type string. This is a bit of a hack :/ 67 * the type string. This is a bit of a hack :/
53 */ 68 */
54 pk = sshbuf_new(); 69 pk = sshbuf_new();
55 ASSERT_INT_EQ(sshkey_plain_to_blob_buf(k, pk), 0); 70 ASSERT_PTR_NE(pk, NULL);
71 ASSERT_INT_EQ(sshkey_putb_plain(k, pk), 0);
56 ASSERT_INT_EQ(sshbuf_skip_string(pk), 0); 72 ASSERT_INT_EQ(sshbuf_skip_string(pk), 0);
57 73
58 principals = sshbuf_new(); 74 principals = sshbuf_new();
75 ASSERT_PTR_NE(principals, NULL);
59 ASSERT_INT_EQ(sshbuf_put_cstring(principals, "gsamsa"), 0); 76 ASSERT_INT_EQ(sshbuf_put_cstring(principals, "gsamsa"), 0);
60 ASSERT_INT_EQ(sshbuf_put_cstring(principals, "gregor"), 0); 77 ASSERT_INT_EQ(sshbuf_put_cstring(principals, "gregor"), 0);
61 78
62 critopts = sshbuf_new(); 79 critopts = sshbuf_new();
63 /* XXX fill this in */ 80 ASSERT_PTR_NE(critopts, NULL);
81 put_opt(critopts, "force-command", "/usr/local/bin/nethack");
82 put_opt(critopts, "source-address", "192.168.0.0/24,127.0.0.1,::1");
64 83
65 exts = sshbuf_new(); 84 exts = sshbuf_new();
66 /* XXX fill this in */ 85 ASSERT_PTR_NE(exts, NULL);
86 put_opt(critopts, "permit-X11-forwarding", NULL);
67 87
68 ASSERT_INT_EQ(sshbuf_put_cstring(b, type), 0); 88 ASSERT_INT_EQ(sshbuf_put_cstring(b, type), 0);
69 ASSERT_INT_EQ(sshbuf_put_cstring(b, "noncenoncenonce!"), 0); /* nonce */ 89 ASSERT_INT_EQ(sshbuf_put_cstring(b, "noncenoncenonce!"), 0); /* nonce */
@@ -90,10 +110,74 @@ build_cert(struct sshbuf *b, const struct sshkey *k, const char *type,
90 sshbuf_free(pk); 110 sshbuf_free(pk);
91} 111}
92 112
113static void
114signature_test(struct sshkey *k, struct sshkey *bad, const u_char *d, size_t l)
115{
116 size_t len;
117 u_char *sig;
118
119 ASSERT_INT_EQ(sshkey_sign(k, &sig, &len, d, l, 0), 0);
120 ASSERT_SIZE_T_GT(len, 8);
121 ASSERT_PTR_NE(sig, NULL);
122 ASSERT_INT_EQ(sshkey_verify(k, sig, len, d, l, 0), 0);
123 ASSERT_INT_NE(sshkey_verify(bad, sig, len, d, l, 0), 0);
124 /* Fuzz test is more comprehensive, this is just a smoke test */
125 sig[len - 5] ^= 0x10;
126 ASSERT_INT_NE(sshkey_verify(k, sig, len, d, l, 0), 0);
127 free(sig);
128}
129
130static void
131banana(u_char *s, size_t l)
132{
133 size_t o;
134 const u_char the_banana[] = { 'b', 'a', 'n', 'a', 'n', 'a' };
135
136 for (o = 0; o < l; o += sizeof(the_banana)) {
137 if (l - o < sizeof(the_banana)) {
138 memcpy(s + o, "nanananana", l - o);
139 break;
140 }
141 memcpy(s + o, banana, sizeof(the_banana));
142 }
143}
144
145static void
146signature_tests(struct sshkey *k, struct sshkey *bad)
147{
148 u_char i, buf[2049];
149 size_t lens[] = {
150 1, 2, 7, 8, 9, 15, 16, 17, 31, 32, 33, 127, 128, 129,
151 255, 256, 257, 1023, 1024, 1025, 2047, 2048, 2049
152 };
153
154 for (i = 0; i < (sizeof(lens)/sizeof(lens[0])); i++) {
155 test_subtest_info("%s key, banana length %zu",
156 sshkey_type(k), lens[i]);
157 banana(buf, lens[i]);
158 signature_test(k, bad, buf, lens[i]);
159 }
160}
161
162static struct sshkey *
163get_private(const char *n)
164{
165 struct sshbuf *b;
166 struct sshkey *ret;
167
168 b = load_file(n);
169 ASSERT_INT_EQ(sshkey_parse_private_fileblob(b, "", n, &ret, NULL), 0);
170 sshbuf_free(b);
171 return ret;
172}
173
93void 174void
94sshkey_tests(void) 175sshkey_tests(void)
95{ 176{
96 struct sshkey *k1, *k2, *k3, *k4, *kr, *kd, *ke, *kf; 177 struct sshkey *k1, *k2, *k3, *k4, *kr, *kd, *kf;
178#ifdef OPENSSL_HAS_ECC
179 struct sshkey *ke;
180#endif
97 struct sshbuf *b; 181 struct sshbuf *b;
98 182
99 TEST_START("new invalid"); 183 TEST_START("new invalid");
@@ -136,12 +220,14 @@ sshkey_tests(void)
136 sshkey_free(k1); 220 sshkey_free(k1);
137 TEST_DONE(); 221 TEST_DONE();
138 222
223#ifdef OPENSSL_HAS_ECC
139 TEST_START("new/free KEY_ECDSA"); 224 TEST_START("new/free KEY_ECDSA");
140 k1 = sshkey_new(KEY_ECDSA); 225 k1 = sshkey_new(KEY_ECDSA);
141 ASSERT_PTR_NE(k1, NULL); 226 ASSERT_PTR_NE(k1, NULL);
142 ASSERT_PTR_EQ(k1->ecdsa, NULL); /* Can't allocate without NID */ 227 ASSERT_PTR_EQ(k1->ecdsa, NULL); /* Can't allocate without NID */
143 sshkey_free(k1); 228 sshkey_free(k1);
144 TEST_DONE(); 229 TEST_DONE();
230#endif
145 231
146 TEST_START("new/free KEY_ED25519"); 232 TEST_START("new/free KEY_ED25519");
147 k1 = sshkey_new(KEY_ED25519); 233 k1 = sshkey_new(KEY_ED25519);
@@ -192,12 +278,14 @@ sshkey_tests(void)
192 sshkey_free(k1); 278 sshkey_free(k1);
193 TEST_DONE(); 279 TEST_DONE();
194 280
281#ifdef OPENSSL_HAS_ECC
195 TEST_START("generate KEY_ECDSA wrong bits"); 282 TEST_START("generate KEY_ECDSA wrong bits");
196 ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 42, &k1), 283 ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 42, &k1),
197 SSH_ERR_INVALID_ARGUMENT); 284 SSH_ERR_INVALID_ARGUMENT);
198 ASSERT_PTR_EQ(k1, NULL); 285 ASSERT_PTR_EQ(k1, NULL);
199 sshkey_free(k1); 286 sshkey_free(k1);
200 TEST_DONE(); 287 TEST_DONE();
288#endif
201 289
202 TEST_START("generate KEY_RSA"); 290 TEST_START("generate KEY_RSA");
203 ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 768, &kr), 0); 291 ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 768, &kr), 0);
@@ -332,26 +420,100 @@ sshkey_tests(void)
332#endif 420#endif
333 sshkey_free(kf); 421 sshkey_free(kf);
334 422
335/* XXX certify test */ 423 TEST_START("certify key");
336/* XXX sign test */ 424 ASSERT_INT_EQ(sshkey_load_public(test_data_file("ed25519_1.pub"),
337/* XXX verify test */ 425 &k1, NULL), 0);
426 k2 = get_private("ed25519_2");
427 ASSERT_INT_EQ(sshkey_to_certified(k1, 0), 0);
428 ASSERT_PTR_NE(k1->cert, NULL);
429 k1->cert->type = SSH2_CERT_TYPE_USER;
430 k1->cert->serial = 1234;
431 k1->cert->key_id = strdup("estragon");
432 ASSERT_PTR_NE(k1->cert->key_id, NULL);
433 k1->cert->principals = calloc(4, sizeof(*k1->cert->principals));
434 ASSERT_PTR_NE(k1->cert->principals, NULL);
435 k1->cert->principals[0] = strdup("estragon");
436 k1->cert->principals[1] = strdup("vladimir");
437 k1->cert->principals[2] = strdup("pozzo");
438 k1->cert->principals[3] = strdup("lucky");
439 ASSERT_PTR_NE(k1->cert->principals[0], NULL);
440 ASSERT_PTR_NE(k1->cert->principals[1], NULL);
441 ASSERT_PTR_NE(k1->cert->principals[2], NULL);
442 ASSERT_PTR_NE(k1->cert->principals[3], NULL);
443 k1->cert->valid_after = 0;
444 k1->cert->valid_before = (u_int64_t)-1;
445 k1->cert->critical = sshbuf_new();
446 ASSERT_PTR_NE(k1->cert->critical, NULL);
447 k1->cert->extensions = sshbuf_new();
448 ASSERT_PTR_NE(k1->cert->extensions, NULL);
449 put_opt(k1->cert->critical, "force-command", "/usr/bin/true");
450 put_opt(k1->cert->critical, "source-address", "127.0.0.1");
451 put_opt(k1->cert->extensions, "permit-X11-forwarding", NULL);
452 put_opt(k1->cert->extensions, "permit-agent-forwarding", NULL);
453 ASSERT_INT_EQ(sshkey_from_private(k2, &k1->cert->signature_key), 0);
454 ASSERT_INT_EQ(sshkey_certify(k1, k2), 0);
455 b = sshbuf_new();
456 ASSERT_PTR_NE(b, NULL);
457 ASSERT_INT_EQ(sshkey_putb(k1, b), 0);
458 ASSERT_INT_EQ(sshkey_from_blob(sshbuf_ptr(b), sshbuf_len(b), &k3), 0);
459
460 sshkey_free(k1);
461 sshkey_free(k2);
462 sshkey_free(k3);
463 sshbuf_reset(b);
464 TEST_DONE();
465
466 TEST_START("sign and verify RSA");
467 k1 = get_private("rsa_1");
468 ASSERT_INT_EQ(sshkey_load_public(test_data_file("rsa_2.pub"), &k2,
469 NULL), 0);
470 signature_tests(k1, k2);
471 sshkey_free(k1);
472 sshkey_free(k2);
473 TEST_DONE();
474
475 TEST_START("sign and verify DSA");
476 k1 = get_private("dsa_1");
477 ASSERT_INT_EQ(sshkey_load_public(test_data_file("dsa_2.pub"), &k2,
478 NULL), 0);
479 signature_tests(k1, k2);
480 sshkey_free(k1);
481 sshkey_free(k2);
482 TEST_DONE();
483
484#ifdef OPENSSL_HAS_ECC
485 TEST_START("sign and verify ECDSA");
486 k1 = get_private("ecdsa_1");
487 ASSERT_INT_EQ(sshkey_load_public(test_data_file("ecdsa_2.pub"), &k2,
488 NULL), 0);
489 signature_tests(k1, k2);
490 sshkey_free(k1);
491 sshkey_free(k2);
492 TEST_DONE();
493#endif
494
495 TEST_START("sign and verify ED25519");
496 k1 = get_private("ed25519_1");
497 ASSERT_INT_EQ(sshkey_load_public(test_data_file("ed25519_2.pub"), &k2,
498 NULL), 0);
499 signature_tests(k1, k2);
500 sshkey_free(k1);
501 sshkey_free(k2);
502 TEST_DONE();
338 503
339 TEST_START("nested certificate"); 504 TEST_START("nested certificate");
340 ASSERT_INT_EQ(sshkey_load_cert(test_data_file("rsa_1"), &k1), 0); 505 ASSERT_INT_EQ(sshkey_load_cert(test_data_file("rsa_1"), &k1), 0);
341 ASSERT_INT_EQ(sshkey_load_public(test_data_file("rsa_1.pub"), &k2, 506 ASSERT_INT_EQ(sshkey_load_public(test_data_file("rsa_1.pub"), &k2,
342 NULL), 0); 507 NULL), 0);
343 b = load_file("rsa_2"); 508 k3 = get_private("ed25519_2");
344 ASSERT_INT_EQ(sshkey_parse_private_fileblob(b, "", "rsa_1",
345 &k3, NULL), 0);
346 sshbuf_reset(b);
347 build_cert(b, k2, "ssh-rsa-cert-v01@openssh.com", k3, k1); 509 build_cert(b, k2, "ssh-rsa-cert-v01@openssh.com", k3, k1);
348 ASSERT_INT_EQ(sshkey_from_blob(sshbuf_ptr(b), sshbuf_len(b), &k4), 510 ASSERT_INT_EQ(sshkey_from_blob(sshbuf_ptr(b), sshbuf_len(b), &k4),
349 SSH_ERR_KEY_CERT_INVALID_SIGN_KEY); 511 SSH_ERR_KEY_CERT_INVALID_SIGN_KEY);
350 ASSERT_PTR_EQ(k4, NULL); 512 ASSERT_PTR_EQ(k4, NULL);
351 sshbuf_free(b);
352 sshkey_free(k1); 513 sshkey_free(k1);
353 sshkey_free(k2); 514 sshkey_free(k2);
354 sshkey_free(k3); 515 sshkey_free(k3);
516 sshbuf_free(b);
355 TEST_DONE(); 517 TEST_DONE();
356 518
357} 519}
diff --git a/regress/unittests/sshkey/testdata/dsa_1-cert.fp b/regress/unittests/sshkey/testdata/dsa_1-cert.fp
index 56ee1f89b..b26145b24 100644
--- a/regress/unittests/sshkey/testdata/dsa_1-cert.fp
+++ b/regress/unittests/sshkey/testdata/dsa_1-cert.fp
@@ -1 +1 @@
5a:4a:41:8c:4e:fa:4c:52:19:f9:39:49:31:fb:fd:74 MD5:5a:4a:41:8c:4e:fa:4c:52:19:f9:39:49:31:fb:fd:74
diff --git a/regress/unittests/sshkey/testdata/dsa_1.fp b/regress/unittests/sshkey/testdata/dsa_1.fp
index 56ee1f89b..b26145b24 100644
--- a/regress/unittests/sshkey/testdata/dsa_1.fp
+++ b/regress/unittests/sshkey/testdata/dsa_1.fp
@@ -1 +1 @@
5a:4a:41:8c:4e:fa:4c:52:19:f9:39:49:31:fb:fd:74 MD5:5a:4a:41:8c:4e:fa:4c:52:19:f9:39:49:31:fb:fd:74
diff --git a/regress/unittests/sshkey/testdata/dsa_2.fp b/regress/unittests/sshkey/testdata/dsa_2.fp
index ba9de82a8..822657403 100644
--- a/regress/unittests/sshkey/testdata/dsa_2.fp
+++ b/regress/unittests/sshkey/testdata/dsa_2.fp
@@ -1 +1 @@
72:5f:50:6b:e5:64:c5:62:21:92:3f:8b:10:9b:9f:1a MD5:72:5f:50:6b:e5:64:c5:62:21:92:3f:8b:10:9b:9f:1a
diff --git a/regress/unittests/sshkey/testdata/ecdsa_1-cert.fp b/regress/unittests/sshkey/testdata/ecdsa_1-cert.fp
index a56dbc8d0..c3d747aff 100644
--- a/regress/unittests/sshkey/testdata/ecdsa_1-cert.fp
+++ b/regress/unittests/sshkey/testdata/ecdsa_1-cert.fp
@@ -1 +1 @@
f7:be:4c:02:65:ed:4c:11:af:ab:a8:dd:0a:92:e7:44 MD5:f7:be:4c:02:65:ed:4c:11:af:ab:a8:dd:0a:92:e7:44
diff --git a/regress/unittests/sshkey/testdata/ecdsa_1.fp b/regress/unittests/sshkey/testdata/ecdsa_1.fp
index a56dbc8d0..c3d747aff 100644
--- a/regress/unittests/sshkey/testdata/ecdsa_1.fp
+++ b/regress/unittests/sshkey/testdata/ecdsa_1.fp
@@ -1 +1 @@
f7:be:4c:02:65:ed:4c:11:af:ab:a8:dd:0a:92:e7:44 MD5:f7:be:4c:02:65:ed:4c:11:af:ab:a8:dd:0a:92:e7:44
diff --git a/regress/unittests/sshkey/testdata/ecdsa_2.fp b/regress/unittests/sshkey/testdata/ecdsa_2.fp
index eb4bbdf03..fe7526b92 100644
--- a/regress/unittests/sshkey/testdata/ecdsa_2.fp
+++ b/regress/unittests/sshkey/testdata/ecdsa_2.fp
@@ -1 +1 @@
51:bd:ff:2b:6d:26:9b:90:f9:e1:4a:ca:a0:29:8e:70 MD5:51:bd:ff:2b:6d:26:9b:90:f9:e1:4a:ca:a0:29:8e:70
diff --git a/regress/unittests/sshkey/testdata/ed25519_1-cert.fp b/regress/unittests/sshkey/testdata/ed25519_1-cert.fp
index e6d23d0b8..fbde87af0 100644
--- a/regress/unittests/sshkey/testdata/ed25519_1-cert.fp
+++ b/regress/unittests/sshkey/testdata/ed25519_1-cert.fp
@@ -1 +1 @@
19:08:8e:7e:4d:e5:de:86:2a:09:47:65:eb:0a:51:2f MD5:19:08:8e:7e:4d:e5:de:86:2a:09:47:65:eb:0a:51:2f
diff --git a/regress/unittests/sshkey/testdata/ed25519_1.fp b/regress/unittests/sshkey/testdata/ed25519_1.fp
index e6d23d0b8..fbde87af0 100644
--- a/regress/unittests/sshkey/testdata/ed25519_1.fp
+++ b/regress/unittests/sshkey/testdata/ed25519_1.fp
@@ -1 +1 @@
19:08:8e:7e:4d:e5:de:86:2a:09:47:65:eb:0a:51:2f MD5:19:08:8e:7e:4d:e5:de:86:2a:09:47:65:eb:0a:51:2f
diff --git a/regress/unittests/sshkey/testdata/ed25519_2.fp b/regress/unittests/sshkey/testdata/ed25519_2.fp
index 02c684f36..ec1cdbb94 100644
--- a/regress/unittests/sshkey/testdata/ed25519_2.fp
+++ b/regress/unittests/sshkey/testdata/ed25519_2.fp
@@ -1 +1 @@
5c:c9:ae:a3:0c:aa:28:29:b8:fc:7c:64:ba:6e:e9:c9 MD5:5c:c9:ae:a3:0c:aa:28:29:b8:fc:7c:64:ba:6e:e9:c9
diff --git a/regress/unittests/sshkey/testdata/rsa1_1.fp b/regress/unittests/sshkey/testdata/rsa1_1.fp
index 782ece0db..2e1068c64 100644
--- a/regress/unittests/sshkey/testdata/rsa1_1.fp
+++ b/regress/unittests/sshkey/testdata/rsa1_1.fp
@@ -1 +1 @@
a8:82:9b:98:c5:e6:19:d6:83:39:9f:4d:3a:8f:7c:80 MD5:a8:82:9b:98:c5:e6:19:d6:83:39:9f:4d:3a:8f:7c:80
diff --git a/regress/unittests/sshkey/testdata/rsa1_2.fp b/regress/unittests/sshkey/testdata/rsa1_2.fp
index c3325371d..cd0039306 100644
--- a/regress/unittests/sshkey/testdata/rsa1_2.fp
+++ b/regress/unittests/sshkey/testdata/rsa1_2.fp
@@ -1 +1 @@
c0:83:1c:97:5f:32:77:7e:e4:e3:e9:29:b9:eb:76:9c MD5:c0:83:1c:97:5f:32:77:7e:e4:e3:e9:29:b9:eb:76:9c
diff --git a/regress/unittests/sshkey/testdata/rsa_1-cert.fp b/regress/unittests/sshkey/testdata/rsa_1-cert.fp
index bf9c2e362..1cf780dd9 100644
--- a/regress/unittests/sshkey/testdata/rsa_1-cert.fp
+++ b/regress/unittests/sshkey/testdata/rsa_1-cert.fp
@@ -1 +1 @@
be:27:4c:16:27:f5:04:03:62:a8:b7:91:df:a5:b1:3b MD5:be:27:4c:16:27:f5:04:03:62:a8:b7:91:df:a5:b1:3b
diff --git a/regress/unittests/sshkey/testdata/rsa_1.fp b/regress/unittests/sshkey/testdata/rsa_1.fp
index bf9c2e362..1cf780dd9 100644
--- a/regress/unittests/sshkey/testdata/rsa_1.fp
+++ b/regress/unittests/sshkey/testdata/rsa_1.fp
@@ -1 +1 @@
be:27:4c:16:27:f5:04:03:62:a8:b7:91:df:a5:b1:3b MD5:be:27:4c:16:27:f5:04:03:62:a8:b7:91:df:a5:b1:3b
diff --git a/regress/unittests/sshkey/testdata/rsa_2.fp b/regress/unittests/sshkey/testdata/rsa_2.fp
index 53939f413..8d4367610 100644
--- a/regress/unittests/sshkey/testdata/rsa_2.fp
+++ b/regress/unittests/sshkey/testdata/rsa_2.fp
@@ -1 +1 @@
fb:8f:7b:26:3d:42:40:ef:ed:f1:ed:ee:66:9e:ba:b0 MD5:fb:8f:7b:26:3d:42:40:ef:ed:f1:ed:ee:66:9e:ba:b0
diff --git a/regress/unittests/test_helper/Makefile b/regress/unittests/test_helper/Makefile
index 3e90903ef..5b3894cbf 100644
--- a/regress/unittests/test_helper/Makefile
+++ b/regress/unittests/test_helper/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.1 2014/04/30 05:32:00 djm Exp $ 1# $OpenBSD: Makefile,v 1.2 2015/01/20 22:58:57 djm Exp $
2 2
3LIB= test_helper 3LIB= test_helper
4SRCS= test_helper.c fuzz.c 4SRCS= test_helper.c fuzz.c
@@ -7,6 +7,9 @@ DEBUGLIBS= no
7NOPROFILE= yes 7NOPROFILE= yes
8NOPIC= yes 8NOPIC= yes
9 9
10# Hack to allow building with SUBDIR in ../../Makefile
11regress: all
12
10install: 13install:
11 @echo -n 14 @echo -n
12 15
diff --git a/regress/unittests/test_helper/fuzz.c b/regress/unittests/test_helper/fuzz.c
index 77c6e7cad..99f1d036c 100644
--- a/regress/unittests/test_helper/fuzz.c
+++ b/regress/unittests/test_helper/fuzz.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: fuzz.c,v 1.3 2014/05/02 09:41:32 andre Exp $ */ 1/* $OpenBSD: fuzz.c,v 1.8 2015/03/03 20:42:49 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -20,6 +20,7 @@
20#include "includes.h" 20#include "includes.h"
21 21
22#include <sys/types.h> 22#include <sys/types.h>
23#include <sys/uio.h>
23 24
24#include <assert.h> 25#include <assert.h>
25#include <ctype.h> 26#include <ctype.h>
@@ -29,9 +30,11 @@
29#endif 30#endif
30#include <stdlib.h> 31#include <stdlib.h>
31#include <string.h> 32#include <string.h>
32#include <assert.h> 33#include <signal.h>
34#include <unistd.h>
33 35
34#include "test_helper.h" 36#include "test_helper.h"
37#include "atomicio.h"
35 38
36/* #define FUZZ_DEBUG */ 39/* #define FUZZ_DEBUG */
37 40
@@ -96,60 +99,66 @@ fuzz_ntop(u_int n)
96 } 99 }
97} 100}
98 101
99void 102static int
100fuzz_dump(struct fuzz *fuzz) 103fuzz_fmt(struct fuzz *fuzz, char *s, size_t n)
101{ 104{
102 u_char *p = fuzz_ptr(fuzz); 105 if (fuzz == NULL)
103 size_t i, j, len = fuzz_len(fuzz); 106 return -1;
104 107
105 switch (fuzz->strategy) { 108 switch (fuzz->strategy) {
106 case FUZZ_1_BIT_FLIP: 109 case FUZZ_1_BIT_FLIP:
107 fprintf(stderr, "%s case %zu of %zu (bit: %zu)\n", 110 snprintf(s, n, "%s case %zu of %zu (bit: %zu)\n",
108 fuzz_ntop(fuzz->strategy), 111 fuzz_ntop(fuzz->strategy),
109 fuzz->o1, fuzz->slen * 8, fuzz->o1); 112 fuzz->o1, fuzz->slen * 8, fuzz->o1);
110 break; 113 return 0;
111 case FUZZ_2_BIT_FLIP: 114 case FUZZ_2_BIT_FLIP:
112 fprintf(stderr, "%s case %llu of %llu (bits: %zu, %zu)\n", 115 snprintf(s, n, "%s case %llu of %llu (bits: %zu, %zu)\n",
113 fuzz_ntop(fuzz->strategy), 116 fuzz_ntop(fuzz->strategy),
114 (((fuzz_ullong)fuzz->o2) * fuzz->slen * 8) + fuzz->o1, 117 (((fuzz_ullong)fuzz->o2) * fuzz->slen * 8) + fuzz->o1,
115 ((fuzz_ullong)fuzz->slen * 8) * fuzz->slen * 8, 118 ((fuzz_ullong)fuzz->slen * 8) * fuzz->slen * 8,
116 fuzz->o1, fuzz->o2); 119 fuzz->o1, fuzz->o2);
117 break; 120 return 0;
118 case FUZZ_1_BYTE_FLIP: 121 case FUZZ_1_BYTE_FLIP:
119 fprintf(stderr, "%s case %zu of %zu (byte: %zu)\n", 122 snprintf(s, n, "%s case %zu of %zu (byte: %zu)\n",
120 fuzz_ntop(fuzz->strategy), 123 fuzz_ntop(fuzz->strategy),
121 fuzz->o1, fuzz->slen, fuzz->o1); 124 fuzz->o1, fuzz->slen, fuzz->o1);
122 break; 125 return 0;
123 case FUZZ_2_BYTE_FLIP: 126 case FUZZ_2_BYTE_FLIP:
124 fprintf(stderr, "%s case %llu of %llu (bytes: %zu, %zu)\n", 127 snprintf(s, n, "%s case %llu of %llu (bytes: %zu, %zu)\n",
125 fuzz_ntop(fuzz->strategy), 128 fuzz_ntop(fuzz->strategy),
126 (((fuzz_ullong)fuzz->o2) * fuzz->slen) + fuzz->o1, 129 (((fuzz_ullong)fuzz->o2) * fuzz->slen) + fuzz->o1,
127 ((fuzz_ullong)fuzz->slen) * fuzz->slen, 130 ((fuzz_ullong)fuzz->slen) * fuzz->slen,
128 fuzz->o1, fuzz->o2); 131 fuzz->o1, fuzz->o2);
129 break; 132 return 0;
130 case FUZZ_TRUNCATE_START: 133 case FUZZ_TRUNCATE_START:
131 fprintf(stderr, "%s case %zu of %zu (offset: %zu)\n", 134 snprintf(s, n, "%s case %zu of %zu (offset: %zu)\n",
132 fuzz_ntop(fuzz->strategy), 135 fuzz_ntop(fuzz->strategy),
133 fuzz->o1, fuzz->slen, fuzz->o1); 136 fuzz->o1, fuzz->slen, fuzz->o1);
134 break; 137 return 0;
135 case FUZZ_TRUNCATE_END: 138 case FUZZ_TRUNCATE_END:
136 fprintf(stderr, "%s case %zu of %zu (offset: %zu)\n", 139 snprintf(s, n, "%s case %zu of %zu (offset: %zu)\n",
137 fuzz_ntop(fuzz->strategy), 140 fuzz_ntop(fuzz->strategy),
138 fuzz->o1, fuzz->slen, fuzz->o1); 141 fuzz->o1, fuzz->slen, fuzz->o1);
139 break; 142 return 0;
140 case FUZZ_BASE64: 143 case FUZZ_BASE64:
141 assert(fuzz->o2 < sizeof(fuzz_b64chars) - 1); 144 assert(fuzz->o2 < sizeof(fuzz_b64chars) - 1);
142 fprintf(stderr, "%s case %llu of %llu (offset: %zu char: %c)\n", 145 snprintf(s, n, "%s case %llu of %llu (offset: %zu char: %c)\n",
143 fuzz_ntop(fuzz->strategy), 146 fuzz_ntop(fuzz->strategy),
144 (fuzz->o1 * (fuzz_ullong)64) + fuzz->o2, 147 (fuzz->o1 * (fuzz_ullong)64) + fuzz->o2,
145 fuzz->slen * (fuzz_ullong)64, fuzz->o1, 148 fuzz->slen * (fuzz_ullong)64, fuzz->o1,
146 fuzz_b64chars[fuzz->o2]); 149 fuzz_b64chars[fuzz->o2]);
147 break; 150 return 0;
148 default: 151 default:
152 return -1;
149 abort(); 153 abort();
150 } 154 }
155}
156
157static void
158dump(u_char *p, size_t len)
159{
160 size_t i, j;
151 161
152 fprintf(stderr, "fuzz context %p len = %zu\n", fuzz, len);
153 for (i = 0; i < len; i += 16) { 162 for (i = 0; i < len; i += 16) {
154 fprintf(stderr, "%.4zd: ", i); 163 fprintf(stderr, "%.4zd: ", i);
155 for (j = i; j < i + 16; j++) { 164 for (j = i; j < i + 16; j++) {
@@ -171,6 +180,39 @@ fuzz_dump(struct fuzz *fuzz)
171 } 180 }
172} 181}
173 182
183void
184fuzz_dump(struct fuzz *fuzz)
185{
186 char buf[256];
187
188 if (fuzz_fmt(fuzz, buf, sizeof(buf)) != 0) {
189 fprintf(stderr, "%s: fuzz invalid\n", __func__);
190 abort();
191 }
192 fputs(buf, stderr);
193 fprintf(stderr, "fuzz original %p len = %zu\n", fuzz->seed, fuzz->slen);
194 dump(fuzz->seed, fuzz->slen);
195 fprintf(stderr, "fuzz context %p len = %zu\n", fuzz, fuzz_len(fuzz));
196 dump(fuzz_ptr(fuzz), fuzz_len(fuzz));
197}
198
199#ifdef SIGINFO
200static struct fuzz *last_fuzz;
201
202static void
203siginfo(int unused __attribute__((__unused__)))
204{
205 char buf[256];
206
207 test_info(buf, sizeof(buf));
208 atomicio(vwrite, STDERR_FILENO, buf, strlen(buf));
209 if (last_fuzz != NULL) {
210 fuzz_fmt(last_fuzz, buf, sizeof(buf));
211 atomicio(vwrite, STDERR_FILENO, buf, strlen(buf));
212 }
213}
214#endif
215
174struct fuzz * 216struct fuzz *
175fuzz_begin(u_int strategies, const void *p, size_t l) 217fuzz_begin(u_int strategies, const void *p, size_t l)
176{ 218{
@@ -190,6 +232,12 @@ fuzz_begin(u_int strategies, const void *p, size_t l)
190 FUZZ_DBG(("begin, ret = %p", ret)); 232 FUZZ_DBG(("begin, ret = %p", ret));
191 233
192 fuzz_next(ret); 234 fuzz_next(ret);
235
236#ifdef SIGINFO
237 last_fuzz = ret;
238 signal(SIGINFO, siginfo);
239#endif
240
193 return ret; 241 return ret;
194} 242}
195 243
@@ -197,6 +245,10 @@ void
197fuzz_cleanup(struct fuzz *fuzz) 245fuzz_cleanup(struct fuzz *fuzz)
198{ 246{
199 FUZZ_DBG(("cleanup, fuzz = %p", fuzz)); 247 FUZZ_DBG(("cleanup, fuzz = %p", fuzz));
248#ifdef SIGINFO
249 last_fuzz = NULL;
250 signal(SIGINFO, SIG_DFL);
251#endif
200 assert(fuzz != NULL); 252 assert(fuzz != NULL);
201 assert(fuzz->seed != NULL); 253 assert(fuzz->seed != NULL);
202 assert(fuzz->fuzzed != NULL); 254 assert(fuzz->fuzzed != NULL);
@@ -326,6 +378,14 @@ fuzz_next(struct fuzz *fuzz)
326} 378}
327 379
328int 380int
381fuzz_matches_original(struct fuzz *fuzz)
382{
383 if (fuzz_len(fuzz) != fuzz->slen)
384 return 0;
385 return memcmp(fuzz_ptr(fuzz), fuzz->seed, fuzz->slen) == 0;
386}
387
388int
329fuzz_done(struct fuzz *fuzz) 389fuzz_done(struct fuzz *fuzz)
330{ 390{
331 FUZZ_DBG(("fuzz = %p, strategies = 0x%lx", fuzz, 391 FUZZ_DBG(("fuzz = %p, strategies = 0x%lx", fuzz,
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c
index d0bc67833..26ca26b5e 100644
--- a/regress/unittests/test_helper/test_helper.c
+++ b/regress/unittests/test_helper/test_helper.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_helper.c,v 1.2 2014/05/02 09:41:32 andre Exp $ */ 1/* $OpenBSD: test_helper.c,v 1.6 2015/03/03 20:42:49 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -21,6 +21,7 @@
21 21
22#include <sys/types.h> 22#include <sys/types.h>
23#include <sys/param.h> 23#include <sys/param.h>
24#include <sys/uio.h>
24 25
25#include <fcntl.h> 26#include <fcntl.h>
26#include <stdio.h> 27#include <stdio.h>
@@ -31,6 +32,7 @@
31#include <string.h> 32#include <string.h>
32#include <assert.h> 33#include <assert.h>
33#include <unistd.h> 34#include <unistd.h>
35#include <signal.h>
34 36
35#include <openssl/bn.h> 37#include <openssl/bn.h>
36 38
@@ -39,6 +41,7 @@
39#endif 41#endif
40 42
41#include "test_helper.h" 43#include "test_helper.h"
44#include "atomicio.h"
42 45
43#define TEST_CHECK_INT(r, pred) do { \ 46#define TEST_CHECK_INT(r, pred) do { \
44 switch (pred) { \ 47 switch (pred) { \
@@ -111,6 +114,7 @@ static u_int test_number = 0;
111static test_onerror_func_t *test_onerror = NULL; 114static test_onerror_func_t *test_onerror = NULL;
112static void *onerror_ctx = NULL; 115static void *onerror_ctx = NULL;
113static const char *data_dir = NULL; 116static const char *data_dir = NULL;
117static char subtest_info[512];
114 118
115int 119int
116main(int argc, char **argv) 120main(int argc, char **argv)
@@ -180,13 +184,36 @@ test_data_file(const char *name)
180} 184}
181 185
182void 186void
187test_info(char *s, size_t len)
188{
189 snprintf(s, len, "In test %u: \"%s\"%s%s\n", test_number,
190 active_test_name == NULL ? "<none>" : active_test_name,
191 *subtest_info != '\0' ? " - " : "", subtest_info);
192}
193
194#ifdef SIGINFO
195static void
196siginfo(int unused __attribute__((__unused__)))
197{
198 char buf[256];
199
200 test_info(buf, sizeof(buf));
201 atomicio(vwrite, STDERR_FILENO, buf, strlen(buf));
202}
203#endif
204
205void
183test_start(const char *n) 206test_start(const char *n)
184{ 207{
185 assert(active_test_name == NULL); 208 assert(active_test_name == NULL);
186 assert((active_test_name = strdup(n)) != NULL); 209 assert((active_test_name = strdup(n)) != NULL);
210 *subtest_info = '\0';
187 if (verbose_mode) 211 if (verbose_mode)
188 printf("test %u - \"%s\": ", test_number, active_test_name); 212 printf("test %u - \"%s\": ", test_number, active_test_name);
189 test_number++; 213 test_number++;
214#ifdef SIGINFO
215 signal(SIGINFO, siginfo);
216#endif
190} 217}
191 218
192void 219void
@@ -199,6 +226,7 @@ set_onerror_func(test_onerror_func_t *f, void *ctx)
199void 226void
200test_done(void) 227test_done(void)
201{ 228{
229 *subtest_info = '\0';
202 assert(active_test_name != NULL); 230 assert(active_test_name != NULL);
203 free(active_test_name); 231 free(active_test_name);
204 active_test_name = NULL; 232 active_test_name = NULL;
@@ -211,6 +239,16 @@ test_done(void)
211} 239}
212 240
213void 241void
242test_subtest_info(const char *fmt, ...)
243{
244 va_list ap;
245
246 va_start(ap, fmt);
247 vsnprintf(subtest_info, sizeof(subtest_info), fmt, ap);
248 va_end(ap);
249}
250
251void
214ssl_err_check(const char *file, int line) 252ssl_err_check(const char *file, int line)
215{ 253{
216 long openssl_error = ERR_get_error(); 254 long openssl_error = ERR_get_error();
@@ -256,8 +294,9 @@ static void
256test_header(const char *file, int line, const char *a1, const char *a2, 294test_header(const char *file, int line, const char *a1, const char *a2,
257 const char *name, enum test_predicate pred) 295 const char *name, enum test_predicate pred)
258{ 296{
259 fprintf(stderr, "\n%s:%d test #%u \"%s\"\n", 297 fprintf(stderr, "\n%s:%d test #%u \"%s\"%s%s\n",
260 file, line, test_number, active_test_name); 298 file, line, test_number, active_test_name,
299 *subtest_info != '\0' ? " - " : "", subtest_info);
261 fprintf(stderr, "ASSERT_%s_%s(%s%s%s) failed:\n", 300 fprintf(stderr, "ASSERT_%s_%s(%s%s%s) failed:\n",
262 name, pred_name(pred), a1, 301 name, pred_name(pred), a1,
263 a2 != NULL ? ", " : "", a2 != NULL ? a2 : ""); 302 a2 != NULL ? ", " : "", a2 != NULL ? a2 : "");
@@ -280,8 +319,13 @@ void
280assert_string(const char *file, int line, const char *a1, const char *a2, 319assert_string(const char *file, int line, const char *a1, const char *a2,
281 const char *aa1, const char *aa2, enum test_predicate pred) 320 const char *aa1, const char *aa2, enum test_predicate pred)
282{ 321{
283 int r = strcmp(aa1, aa2); 322 int r;
284 323
324 /* Verify pointers are not NULL */
325 assert_ptr(file, line, a1, "NULL", aa1, NULL, TEST_NE);
326 assert_ptr(file, line, a2, "NULL", aa2, NULL, TEST_NE);
327
328 r = strcmp(aa1, aa2);
285 TEST_CHECK_INT(r, pred); 329 TEST_CHECK_INT(r, pred);
286 test_header(file, line, a1, a2, "STRING", pred); 330 test_header(file, line, a1, a2, "STRING", pred);
287 fprintf(stderr, "%12s = %s (len %zu)\n", a1, aa1, strlen(aa1)); 331 fprintf(stderr, "%12s = %s (len %zu)\n", a1, aa1, strlen(aa1));
@@ -310,8 +354,15 @@ void
310assert_mem(const char *file, int line, const char *a1, const char *a2, 354assert_mem(const char *file, int line, const char *a1, const char *a2,
311 const void *aa1, const void *aa2, size_t l, enum test_predicate pred) 355 const void *aa1, const void *aa2, size_t l, enum test_predicate pred)
312{ 356{
313 int r = memcmp(aa1, aa2, l); 357 int r;
314 358
359 if (l == 0)
360 return;
361 /* If length is >0, then verify pointers are not NULL */
362 assert_ptr(file, line, a1, "NULL", aa1, NULL, TEST_NE);
363 assert_ptr(file, line, a2, "NULL", aa2, NULL, TEST_NE);
364
365 r = memcmp(aa1, aa2, l);
315 TEST_CHECK_INT(r, pred); 366 TEST_CHECK_INT(r, pred);
316 test_header(file, line, a1, a2, "STRING", pred); 367 test_header(file, line, a1, a2, "STRING", pred);
317 fprintf(stderr, "%12s = %s (len %zu)\n", a1, tohex(aa1, MIN(l, 256)), l); 368 fprintf(stderr, "%12s = %s (len %zu)\n", a1, tohex(aa1, MIN(l, 256)), l);
@@ -338,11 +389,15 @@ assert_mem_filled(const char *file, int line, const char *a1,
338 const void *aa1, u_char v, size_t l, enum test_predicate pred) 389 const void *aa1, u_char v, size_t l, enum test_predicate pred)
339{ 390{
340 size_t where = -1; 391 size_t where = -1;
341 int r = memvalcmp(aa1, v, l, &where); 392 int r;
342 char tmp[64]; 393 char tmp[64];
343 394
344 if (l == 0) 395 if (l == 0)
345 return; 396 return;
397 /* If length is >0, then verify the pointer is not NULL */
398 assert_ptr(file, line, a1, "NULL", aa1, NULL, TEST_NE);
399
400 r = memvalcmp(aa1, v, l, &where);
346 TEST_CHECK_INT(r, pred); 401 TEST_CHECK_INT(r, pred);
347 test_header(file, line, a1, NULL, "MEM_ZERO", pred); 402 test_header(file, line, a1, NULL, "MEM_ZERO", pred);
348 fprintf(stderr, "%20s = %s%s (len %zu)\n", a1, 403 fprintf(stderr, "%20s = %s%s (len %zu)\n", a1,
diff --git a/regress/unittests/test_helper/test_helper.h b/regress/unittests/test_helper/test_helper.h
index a398c615f..1d9c66986 100644
--- a/regress/unittests/test_helper/test_helper.h
+++ b/regress/unittests/test_helper/test_helper.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_helper.h,v 1.3 2014/05/02 09:41:32 andre Exp $ */ 1/* $OpenBSD: test_helper.h,v 1.6 2015/01/18 19:52:44 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -40,8 +40,11 @@ void tests(void);
40 40
41const char *test_data_file(const char *name); 41const char *test_data_file(const char *name);
42void test_start(const char *n); 42void test_start(const char *n);
43void test_info(char *s, size_t len);
43void set_onerror_func(test_onerror_func_t *f, void *ctx); 44void set_onerror_func(test_onerror_func_t *f, void *ctx);
44void test_done(void); 45void test_done(void);
46void test_subtest_info(const char *fmt, ...)
47 __attribute__((format(printf, 1, 2)));
45void ssl_err_check(const char *file, int line); 48void ssl_err_check(const char *file, int line);
46void assert_bignum(const char *file, int line, 49void assert_bignum(const char *file, int line,
47 const char *a1, const char *a2, 50 const char *a1, const char *a2,
@@ -280,6 +283,13 @@ void fuzz_cleanup(struct fuzz *fuzz);
280/* Prepare the next fuzz case in the series */ 283/* Prepare the next fuzz case in the series */
281void fuzz_next(struct fuzz *fuzz); 284void fuzz_next(struct fuzz *fuzz);
282 285
286/*
287 * Check whether this fuzz case is identical to the original
288 * This is slow, but useful if the caller needs to ensure that all tests
289 * generated change the input (e.g. when fuzzing signatures).
290 */
291int fuzz_matches_original(struct fuzz *fuzz);
292
283/* Determine whether the current fuzz sequence is exhausted (nonzero = yes) */ 293/* Determine whether the current fuzz sequence is exhausted (nonzero = yes) */
284int fuzz_done(struct fuzz *fuzz); 294int fuzz_done(struct fuzz *fuzz);
285 295
@@ -289,4 +299,5 @@ u_char *fuzz_ptr(struct fuzz *fuzz);
289 299
290/* Dump the current fuzz case to stderr */ 300/* Dump the current fuzz case to stderr */
291void fuzz_dump(struct fuzz *fuzz); 301void fuzz_dump(struct fuzz *fuzz);
302
292#endif /* _TEST_HELPER_H */ 303#endif /* _TEST_HELPER_H */
diff --git a/regress/valgrind-unit.sh b/regress/valgrind-unit.sh
new file mode 100755
index 000000000..433cb069a
--- /dev/null
+++ b/regress/valgrind-unit.sh
@@ -0,0 +1,20 @@
1#!/bin/sh
2
3UNIT_BINARY="$1"
4shift
5UNIT_ARGS="$@"
6
7test "x$OBJ" = "x" && OBJ=$PWD
8
9# This mostly replicates the logic in test-exec.sh for running the
10# regress tests under valgrind.
11VG_TEST=`basename $UNIT_BINARY`
12VG_LOG="$OBJ/valgrind-out/${VG_TEST}.%p"
13VG_OPTS="--track-origins=yes --leak-check=full --log-file=${VG_LOG}"
14VG_OPTS="$VG_OPTS --trace-children=yes"
15VG_PATH="valgrind"
16if [ "x$VALGRIND_PATH" != "x" ]; then
17 VG_PATH="$VALGRIND_PATH"
18fi
19
20exec $VG_PATH $VG_OPTS $UNIT_BINARY $UNIT_ARGS
diff --git a/regress/yes-head.sh b/regress/yes-head.sh
index a8e6bc800..1fc754211 100644
--- a/regress/yes-head.sh
+++ b/regress/yes-head.sh
@@ -1,9 +1,9 @@
1# $OpenBSD: yes-head.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ 1# $OpenBSD: yes-head.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="yes pipe head" 4tid="yes pipe head"
5 5
6for p in 1 2; do 6for p in ${SSH_PROTOCOLS}; do
7 lines=`${SSH} -$p -F $OBJ/ssh_proxy thishost 'sh -c "while true;do echo yes;done | _POSIX2_VERSION=199209 head -2000"' | (sleep 3 ; wc -l)` 7 lines=`${SSH} -$p -F $OBJ/ssh_proxy thishost 'sh -c "while true;do echo yes;done | _POSIX2_VERSION=199209 head -2000"' | (sleep 3 ; wc -l)`
8 if [ $? -ne 0 ]; then 8 if [ $? -ne 0 ]; then
9 fail "yes|head test failed" 9 fail "yes|head test failed"
diff --git a/rijndael.c b/rijndael.c
index cde90789e..b352a11e5 100644
--- a/rijndael.c
+++ b/rijndael.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rijndael.c,v 1.18 2014/04/29 15:42:07 markus Exp $ */ 1/* $OpenBSD: rijndael.c,v 1.19 2014/11/18 22:38:48 mikeb Exp $ */
2 2
3/** 3/**
4 * rijndael-alg-fst.c 4 * rijndael-alg-fst.c
@@ -40,13 +40,12 @@ Te0[x] = S [x].[02, 01, 01, 03];
40Te1[x] = S [x].[03, 02, 01, 01]; 40Te1[x] = S [x].[03, 02, 01, 01];
41Te2[x] = S [x].[01, 03, 02, 01]; 41Te2[x] = S [x].[01, 03, 02, 01];
42Te3[x] = S [x].[01, 01, 03, 02]; 42Te3[x] = S [x].[01, 01, 03, 02];
43Te4[x] = S [x].[01, 01, 01, 01];
44 43
45Td0[x] = Si[x].[0e, 09, 0d, 0b]; 44Td0[x] = Si[x].[0e, 09, 0d, 0b];
46Td1[x] = Si[x].[0b, 0e, 09, 0d]; 45Td1[x] = Si[x].[0b, 0e, 09, 0d];
47Td2[x] = Si[x].[0d, 0b, 0e, 09]; 46Td2[x] = Si[x].[0d, 0b, 0e, 09];
48Td3[x] = Si[x].[09, 0d, 0b, 0e]; 47Td3[x] = Si[x].[09, 0d, 0b, 0e];
49Td4[x] = Si[x].[01, 01, 01, 01]; 48Td4[x] = Si[x].[01];
50*/ 49*/
51 50
52static const u32 Te0[256] = { 51static const u32 Te0[256] = {
@@ -313,72 +312,7 @@ static const u32 Te3[256] = {
313 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, 312 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU,
314 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, 313 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU,
315}; 314};
316static const u32 Te4[256] = { 315#if 0
317 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU,
318 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U,
319 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU,
320 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U,
321 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU,
322 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U,
323 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU,
324 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U,
325 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U,
326 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU,
327 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U,
328 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U,
329 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U,
330 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU,
331 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U,
332 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U,
333 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU,
334 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U,
335 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U,
336 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U,
337 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU,
338 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU,
339 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U,
340 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU,
341 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU,
342 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U,
343 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU,
344 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U,
345 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU,
346 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U,
347 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U,
348 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U,
349 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU,
350 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U,
351 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU,
352 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U,
353 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU,
354 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U,
355 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U,
356 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU,
357 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU,
358 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU,
359 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U,
360 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U,
361 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU,
362 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U,
363 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU,
364 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U,
365 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU,
366 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U,
367 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU,
368 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU,
369 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U,
370 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU,
371 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U,
372 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU,
373 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U,
374 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U,
375 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U,
376 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU,
377 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU,
378 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U,
379 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU,
380 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U,
381};
382static const u32 Td0[256] = { 316static const u32 Td0[256] = {
383 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, 317 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U,
384 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, 318 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U,
@@ -643,72 +577,41 @@ static const u32 Td3[256] = {
643 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, 577 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U,
644 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, 578 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U,
645}; 579};
646static const u32 Td4[256] = { 580static const u8 Td4[256] = {
647 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, 581 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U,
648 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, 582 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU,
649 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, 583 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U,
650 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, 584 0x34U, 0x8eU, 0x43U, 0x44U, 0xc4U, 0xdeU, 0xe9U, 0xcbU,
651 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, 585 0x54U, 0x7bU, 0x94U, 0x32U, 0xa6U, 0xc2U, 0x23U, 0x3dU,
652 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, 586 0xeeU, 0x4cU, 0x95U, 0x0bU, 0x42U, 0xfaU, 0xc3U, 0x4eU,
653 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, 587 0x08U, 0x2eU, 0xa1U, 0x66U, 0x28U, 0xd9U, 0x24U, 0xb2U,
654 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, 588 0x76U, 0x5bU, 0xa2U, 0x49U, 0x6dU, 0x8bU, 0xd1U, 0x25U,
655 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, 589 0x72U, 0xf8U, 0xf6U, 0x64U, 0x86U, 0x68U, 0x98U, 0x16U,
656 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, 590 0xd4U, 0xa4U, 0x5cU, 0xccU, 0x5dU, 0x65U, 0xb6U, 0x92U,
657 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, 591 0x6cU, 0x70U, 0x48U, 0x50U, 0xfdU, 0xedU, 0xb9U, 0xdaU,
658 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, 592 0x5eU, 0x15U, 0x46U, 0x57U, 0xa7U, 0x8dU, 0x9dU, 0x84U,
659 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, 593 0x90U, 0xd8U, 0xabU, 0x00U, 0x8cU, 0xbcU, 0xd3U, 0x0aU,
660 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, 594 0xf7U, 0xe4U, 0x58U, 0x05U, 0xb8U, 0xb3U, 0x45U, 0x06U,
661 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, 595 0xd0U, 0x2cU, 0x1eU, 0x8fU, 0xcaU, 0x3fU, 0x0fU, 0x02U,
662 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, 596 0xc1U, 0xafU, 0xbdU, 0x03U, 0x01U, 0x13U, 0x8aU, 0x6bU,
663 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, 597 0x3aU, 0x91U, 0x11U, 0x41U, 0x4fU, 0x67U, 0xdcU, 0xeaU,
664 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, 598 0x97U, 0xf2U, 0xcfU, 0xceU, 0xf0U, 0xb4U, 0xe6U, 0x73U,
665 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, 599 0x96U, 0xacU, 0x74U, 0x22U, 0xe7U, 0xadU, 0x35U, 0x85U,
666 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, 600 0xe2U, 0xf9U, 0x37U, 0xe8U, 0x1cU, 0x75U, 0xdfU, 0x6eU,
667 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, 601 0x47U, 0xf1U, 0x1aU, 0x71U, 0x1dU, 0x29U, 0xc5U, 0x89U,
668 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, 602 0x6fU, 0xb7U, 0x62U, 0x0eU, 0xaaU, 0x18U, 0xbeU, 0x1bU,
669 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, 603 0xfcU, 0x56U, 0x3eU, 0x4bU, 0xc6U, 0xd2U, 0x79U, 0x20U,
670 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, 604 0x9aU, 0xdbU, 0xc0U, 0xfeU, 0x78U, 0xcdU, 0x5aU, 0xf4U,
671 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, 605 0x1fU, 0xddU, 0xa8U, 0x33U, 0x88U, 0x07U, 0xc7U, 0x31U,
672 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, 606 0xb1U, 0x12U, 0x10U, 0x59U, 0x27U, 0x80U, 0xecU, 0x5fU,
673 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, 607 0x60U, 0x51U, 0x7fU, 0xa9U, 0x19U, 0xb5U, 0x4aU, 0x0dU,
674 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, 608 0x2dU, 0xe5U, 0x7aU, 0x9fU, 0x93U, 0xc9U, 0x9cU, 0xefU,
675 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, 609 0xa0U, 0xe0U, 0x3bU, 0x4dU, 0xaeU, 0x2aU, 0xf5U, 0xb0U,
676 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, 610 0xc8U, 0xebU, 0xbbU, 0x3cU, 0x83U, 0x53U, 0x99U, 0x61U,
677 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, 611 0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U,
678 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, 612 0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU,
679 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U,
680 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU,
681 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU,
682 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U,
683 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U,
684 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U,
685 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U,
686 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU,
687 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U,
688 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U,
689 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU,
690 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU,
691 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU,
692 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U,
693 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU,
694 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U,
695 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U,
696 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U,
697 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U,
698 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU,
699 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U,
700 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU,
701 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU,
702 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU,
703 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU,
704 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U,
705 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU,
706 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U,
707 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU,
708 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U,
709 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U,
710 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU,
711}; 613};
614#endif
712static const u32 rcon[] = { 615static const u32 rcon[] = {
713 0x01000000, 0x02000000, 0x04000000, 0x08000000, 616 0x01000000, 0x02000000, 0x04000000, 0x08000000,
714 0x10000000, 0x20000000, 0x40000000, 0x80000000, 617 0x10000000, 0x20000000, 0x40000000, 0x80000000,
@@ -737,10 +640,10 @@ rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits)
737 for (;;) { 640 for (;;) {
738 temp = rk[3]; 641 temp = rk[3];
739 rk[4] = rk[0] ^ 642 rk[4] = rk[0] ^
740 (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ 643 (Te2[(temp >> 16) & 0xff] & 0xff000000) ^
741 (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ 644 (Te3[(temp >> 8) & 0xff] & 0x00ff0000) ^
742 (Te4[(temp ) & 0xff] & 0x0000ff00) ^ 645 (Te0[(temp ) & 0xff] & 0x0000ff00) ^
743 (Te4[(temp >> 24) ] & 0x000000ff) ^ 646 (Te1[(temp >> 24) ] & 0x000000ff) ^
744 rcon[i]; 647 rcon[i];
745 rk[5] = rk[1] ^ rk[4]; 648 rk[5] = rk[1] ^ rk[4];
746 rk[6] = rk[2] ^ rk[5]; 649 rk[6] = rk[2] ^ rk[5];
@@ -757,10 +660,10 @@ rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits)
757 for (;;) { 660 for (;;) {
758 temp = rk[ 5]; 661 temp = rk[ 5];
759 rk[ 6] = rk[ 0] ^ 662 rk[ 6] = rk[ 0] ^
760 (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ 663 (Te2[(temp >> 16) & 0xff] & 0xff000000) ^
761 (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ 664 (Te3[(temp >> 8) & 0xff] & 0x00ff0000) ^
762 (Te4[(temp ) & 0xff] & 0x0000ff00) ^ 665 (Te0[(temp ) & 0xff] & 0x0000ff00) ^
763 (Te4[(temp >> 24) ] & 0x000000ff) ^ 666 (Te1[(temp >> 24) ] & 0x000000ff) ^
764 rcon[i]; 667 rcon[i];
765 rk[ 7] = rk[ 1] ^ rk[ 6]; 668 rk[ 7] = rk[ 1] ^ rk[ 6];
766 rk[ 8] = rk[ 2] ^ rk[ 7]; 669 rk[ 8] = rk[ 2] ^ rk[ 7];
@@ -779,10 +682,10 @@ rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits)
779 for (;;) { 682 for (;;) {
780 temp = rk[ 7]; 683 temp = rk[ 7];
781 rk[ 8] = rk[ 0] ^ 684 rk[ 8] = rk[ 0] ^
782 (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ 685 (Te2[(temp >> 16) & 0xff] & 0xff000000) ^
783 (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ 686 (Te3[(temp >> 8) & 0xff] & 0x00ff0000) ^
784 (Te4[(temp ) & 0xff] & 0x0000ff00) ^ 687 (Te0[(temp ) & 0xff] & 0x0000ff00) ^
785 (Te4[(temp >> 24) ] & 0x000000ff) ^ 688 (Te1[(temp >> 24) ] & 0x000000ff) ^
786 rcon[i]; 689 rcon[i];
787 rk[ 9] = rk[ 1] ^ rk[ 8]; 690 rk[ 9] = rk[ 1] ^ rk[ 8];
788 rk[10] = rk[ 2] ^ rk[ 9]; 691 rk[10] = rk[ 2] ^ rk[ 9];
@@ -792,10 +695,10 @@ rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits)
792 } 695 }
793 temp = rk[11]; 696 temp = rk[11];
794 rk[12] = rk[ 4] ^ 697 rk[12] = rk[ 4] ^
795 (Te4[(temp >> 24) ] & 0xff000000) ^ 698 (Te2[(temp >> 24) ] & 0xff000000) ^
796 (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ 699 (Te3[(temp >> 16) & 0xff] & 0x00ff0000) ^
797 (Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ 700 (Te0[(temp >> 8) & 0xff] & 0x0000ff00) ^
798 (Te4[(temp ) & 0xff] & 0x000000ff); 701 (Te1[(temp ) & 0xff] & 0x000000ff);
799 rk[13] = rk[ 5] ^ rk[12]; 702 rk[13] = rk[ 5] ^ rk[12];
800 rk[14] = rk[ 6] ^ rk[13]; 703 rk[14] = rk[ 6] ^ rk[13];
801 rk[15] = rk[ 7] ^ rk[14]; 704 rk[15] = rk[ 7] ^ rk[14];
@@ -805,25 +708,20 @@ rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits)
805 return 0; 708 return 0;
806} 709}
807 710
711#if 0
808/** 712/**
809 * Expand the cipher key into the decryption key schedule. 713 * Expand the cipher key into the decryption key schedule.
810 * 714 *
811 * @return the number of rounds for the given cipher key size. 715 * @return the number of rounds for the given cipher key size.
812 */ 716 */
813int 717int
814rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits, 718rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits)
815 int have_encrypt)
816{ 719{
817 int Nr, i, j; 720 int Nr, i, j;
818 u32 temp; 721 u32 temp;
819 722
820 /* expand the cipher key: */ 723 /* expand the cipher key: */
821 if (have_encrypt > 0) { 724 Nr = rijndaelKeySetupEnc(rk, cipherKey, keyBits);
822 /* Already done */
823 Nr = have_encrypt;
824 } else {
825 Nr = rijndaelKeySetupEnc(rk, cipherKey, keyBits);
826 }
827 725
828 /* invert the order of the round keys: */ 726 /* invert the order of the round keys: */
829 for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) { 727 for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) {
@@ -836,28 +734,29 @@ rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits,
836 for (i = 1; i < Nr; i++) { 734 for (i = 1; i < Nr; i++) {
837 rk += 4; 735 rk += 4;
838 rk[0] = 736 rk[0] =
839 Td0[Te4[(rk[0] >> 24) ] & 0xff] ^ 737 Td0[Te1[(rk[0] >> 24) ] & 0xff] ^
840 Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^ 738 Td1[Te1[(rk[0] >> 16) & 0xff] & 0xff] ^
841 Td2[Te4[(rk[0] >> 8) & 0xff] & 0xff] ^ 739 Td2[Te1[(rk[0] >> 8) & 0xff] & 0xff] ^
842 Td3[Te4[(rk[0] ) & 0xff] & 0xff]; 740 Td3[Te1[(rk[0] ) & 0xff] & 0xff];
843 rk[1] = 741 rk[1] =
844 Td0[Te4[(rk[1] >> 24) ] & 0xff] ^ 742 Td0[Te1[(rk[1] >> 24) ] & 0xff] ^
845 Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^ 743 Td1[Te1[(rk[1] >> 16) & 0xff] & 0xff] ^
846 Td2[Te4[(rk[1] >> 8) & 0xff] & 0xff] ^ 744 Td2[Te1[(rk[1] >> 8) & 0xff] & 0xff] ^
847 Td3[Te4[(rk[1] ) & 0xff] & 0xff]; 745 Td3[Te1[(rk[1] ) & 0xff] & 0xff];
848 rk[2] = 746 rk[2] =
849 Td0[Te4[(rk[2] >> 24) ] & 0xff] ^ 747 Td0[Te1[(rk[2] >> 24) ] & 0xff] ^
850 Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^ 748 Td1[Te1[(rk[2] >> 16) & 0xff] & 0xff] ^
851 Td2[Te4[(rk[2] >> 8) & 0xff] & 0xff] ^ 749 Td2[Te1[(rk[2] >> 8) & 0xff] & 0xff] ^
852 Td3[Te4[(rk[2] ) & 0xff] & 0xff]; 750 Td3[Te1[(rk[2] ) & 0xff] & 0xff];
853 rk[3] = 751 rk[3] =
854 Td0[Te4[(rk[3] >> 24) ] & 0xff] ^ 752 Td0[Te1[(rk[3] >> 24) ] & 0xff] ^
855 Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^ 753 Td1[Te1[(rk[3] >> 16) & 0xff] & 0xff] ^
856 Td2[Te4[(rk[3] >> 8) & 0xff] & 0xff] ^ 754 Td2[Te1[(rk[3] >> 8) & 0xff] & 0xff] ^
857 Td3[Te4[(rk[3] ) & 0xff] & 0xff]; 755 Td3[Te1[(rk[3] ) & 0xff] & 0xff];
858 } 756 }
859 return Nr; 757 return Nr;
860} 758}
759#endif
861 760
862void 761void
863rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], 762rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16],
@@ -1014,35 +913,36 @@ rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16],
1014 * map cipher state to byte array block: 913 * map cipher state to byte array block:
1015 */ 914 */
1016 s0 = 915 s0 =
1017 (Te4[(t0 >> 24) ] & 0xff000000) ^ 916 (Te2[(t0 >> 24) ] & 0xff000000) ^
1018 (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ 917 (Te3[(t1 >> 16) & 0xff] & 0x00ff0000) ^
1019 (Te4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ 918 (Te0[(t2 >> 8) & 0xff] & 0x0000ff00) ^
1020 (Te4[(t3 ) & 0xff] & 0x000000ff) ^ 919 (Te1[(t3 ) & 0xff] & 0x000000ff) ^
1021 rk[0]; 920 rk[0];
1022 PUTU32(ct , s0); 921 PUTU32(ct , s0);
1023 s1 = 922 s1 =
1024 (Te4[(t1 >> 24) ] & 0xff000000) ^ 923 (Te2[(t1 >> 24) ] & 0xff000000) ^
1025 (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ 924 (Te3[(t2 >> 16) & 0xff] & 0x00ff0000) ^
1026 (Te4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ 925 (Te0[(t3 >> 8) & 0xff] & 0x0000ff00) ^
1027 (Te4[(t0 ) & 0xff] & 0x000000ff) ^ 926 (Te1[(t0 ) & 0xff] & 0x000000ff) ^
1028 rk[1]; 927 rk[1];
1029 PUTU32(ct + 4, s1); 928 PUTU32(ct + 4, s1);
1030 s2 = 929 s2 =
1031 (Te4[(t2 >> 24) ] & 0xff000000) ^ 930 (Te2[(t2 >> 24) ] & 0xff000000) ^
1032 (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ 931 (Te3[(t3 >> 16) & 0xff] & 0x00ff0000) ^
1033 (Te4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ 932 (Te0[(t0 >> 8) & 0xff] & 0x0000ff00) ^
1034 (Te4[(t1 ) & 0xff] & 0x000000ff) ^ 933 (Te1[(t1 ) & 0xff] & 0x000000ff) ^
1035 rk[2]; 934 rk[2];
1036 PUTU32(ct + 8, s2); 935 PUTU32(ct + 8, s2);
1037 s3 = 936 s3 =
1038 (Te4[(t3 >> 24) ] & 0xff000000) ^ 937 (Te2[(t3 >> 24) ] & 0xff000000) ^
1039 (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ 938 (Te3[(t0 >> 16) & 0xff] & 0x00ff0000) ^
1040 (Te4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ 939 (Te0[(t1 >> 8) & 0xff] & 0x0000ff00) ^
1041 (Te4[(t2 ) & 0xff] & 0x000000ff) ^ 940 (Te1[(t2 ) & 0xff] & 0x000000ff) ^
1042 rk[3]; 941 rk[3];
1043 PUTU32(ct + 12, s3); 942 PUTU32(ct + 12, s3);
1044} 943}
1045 944
945#if 0
1046static void 946static void
1047rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], 947rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16],
1048 u8 pt[16]) 948 u8 pt[16])
@@ -1198,57 +1098,32 @@ rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16],
1198 * map cipher state to byte array block: 1098 * map cipher state to byte array block:
1199 */ 1099 */
1200 s0 = 1100 s0 =
1201 (Td4[(t0 >> 24) ] & 0xff000000) ^ 1101 (Td4[(t0 >> 24) ] << 24) ^
1202 (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ 1102 (Td4[(t3 >> 16) & 0xff] << 16) ^
1203 (Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ 1103 (Td4[(t2 >> 8) & 0xff] << 8) ^
1204 (Td4[(t1 ) & 0xff] & 0x000000ff) ^ 1104 (Td4[(t1 ) & 0xff]) ^
1205 rk[0]; 1105 rk[0];
1206 PUTU32(pt , s0); 1106 PUTU32(pt , s0);
1207 s1 = 1107 s1 =
1208 (Td4[(t1 >> 24) ] & 0xff000000) ^ 1108 (Td4[(t1 >> 24) ] << 24) ^
1209 (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ 1109 (Td4[(t0 >> 16) & 0xff] << 16) ^
1210 (Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ 1110 (Td4[(t3 >> 8) & 0xff] << 8) ^
1211 (Td4[(t2 ) & 0xff] & 0x000000ff) ^ 1111 (Td4[(t2 ) & 0xff]) ^
1212 rk[1]; 1112 rk[1];
1213 PUTU32(pt + 4, s1); 1113 PUTU32(pt + 4, s1);
1214 s2 = 1114 s2 =
1215 (Td4[(t2 >> 24) ] & 0xff000000) ^ 1115 (Td4[(t2 >> 24) ] << 24) ^
1216 (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ 1116 (Td4[(t1 >> 16) & 0xff] << 16) ^
1217 (Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ 1117 (Td4[(t0 >> 8) & 0xff] << 8) ^
1218 (Td4[(t3 ) & 0xff] & 0x000000ff) ^ 1118 (Td4[(t3 ) & 0xff]) ^
1219 rk[2]; 1119 rk[2];
1220 PUTU32(pt + 8, s2); 1120 PUTU32(pt + 8, s2);
1221 s3 = 1121 s3 =
1222 (Td4[(t3 >> 24) ] & 0xff000000) ^ 1122 (Td4[(t3 >> 24) ] << 24) ^
1223 (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ 1123 (Td4[(t2 >> 16) & 0xff] << 16) ^
1224 (Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ 1124 (Td4[(t1 >> 8) & 0xff] << 8) ^
1225 (Td4[(t0 ) & 0xff] & 0x000000ff) ^ 1125 (Td4[(t0 ) & 0xff]) ^
1226 rk[3]; 1126 rk[3];
1227 PUTU32(pt + 12, s3); 1127 PUTU32(pt + 12, s3);
1228} 1128}
1229 1129#endif
1230void
1231rijndael_set_key(rijndael_ctx *ctx, u_char *key, int bits, int do_encrypt)
1232{
1233 ctx->Nr = rijndaelKeySetupEnc(ctx->ek, key, bits);
1234 if (do_encrypt) {
1235 ctx->decrypt = 0;
1236 memset(ctx->dk, 0, sizeof(ctx->dk));
1237 } else {
1238 ctx->decrypt = 1;
1239 memcpy(ctx->dk, ctx->ek, sizeof(ctx->dk));
1240 rijndaelKeySetupDec(ctx->dk, key, bits, ctx->Nr);
1241 }
1242}
1243
1244void
1245rijndael_decrypt(rijndael_ctx *ctx, u_char *src, u_char *dst)
1246{
1247 rijndaelDecrypt(ctx->dk, ctx->Nr, src, dst);
1248}
1249
1250void
1251rijndael_encrypt(rijndael_ctx *ctx, u_char *src, u_char *dst)
1252{
1253 rijndaelEncrypt(ctx->ek, ctx->Nr, src, dst);
1254}
diff --git a/roaming_client.c b/roaming_client.c
index 5e5c28b2b..cb1328574 100644
--- a/roaming_client.c
+++ b/roaming_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: roaming_client.c,v 1.8 2014/04/29 18:01:49 markus Exp $ */ 1/* $OpenBSD: roaming_client.c,v 1.9 2015/01/27 12:54:06 okan Exp $ */
2/* 2/*
3 * Copyright (c) 2004-2009 AppGate Network Security AB 3 * Copyright (c) 2004-2009 AppGate Network Security AB
4 * 4 *
@@ -21,9 +21,6 @@
21#include <sys/types.h> 21#include <sys/types.h>
22#include <sys/socket.h> 22#include <sys/socket.h>
23 23
24#ifdef HAVE_INTTYPES_H
25#include <inttypes.h>
26#endif
27#include <signal.h> 24#include <signal.h>
28#include <string.h> 25#include <string.h>
29#include <unistd.h> 26#include <unistd.h>
diff --git a/roaming_common.c b/roaming_common.c
index 787bef04a..ea064605c 100644
--- a/roaming_common.c
+++ b/roaming_common.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: roaming_common.c,v 1.12 2014/01/09 23:20:00 djm Exp $ */ 1/* $OpenBSD: roaming_common.c,v 1.13 2015/01/27 12:54:06 okan Exp $ */
2/* 2/*
3 * Copyright (c) 2004-2009 AppGate Network Security AB 3 * Copyright (c) 2004-2009 AppGate Network Security AB
4 * 4 *
@@ -22,9 +22,6 @@
22#include <sys/uio.h> 22#include <sys/uio.h>
23 23
24#include <errno.h> 24#include <errno.h>
25#ifdef HAVE_INTTYPES_H
26#include <inttypes.h>
27#endif
28#include <stdarg.h> 25#include <stdarg.h>
29#include <string.h> 26#include <string.h>
30#include <unistd.h> 27#include <unistd.h>
diff --git a/roaming_dummy.c b/roaming_dummy.c
index 45c4008e7..837de695d 100644
--- a/roaming_dummy.c
+++ b/roaming_dummy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: roaming_dummy.c,v 1.3 2009/06/21 09:04:03 dtucker Exp $ */ 1/* $OpenBSD: roaming_dummy.c,v 1.4 2015/01/19 19:52:16 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2004-2009 AppGate Network Security AB 3 * Copyright (c) 2004-2009 AppGate Network Security AB
4 * 4 *
@@ -35,6 +35,17 @@ get_recv_bytes(void)
35 return 0; 35 return 0;
36} 36}
37 37
38u_int64_t
39get_sent_bytes(void)
40{
41 return 0;
42}
43
44void
45roam_set_bytes(u_int64_t sent, u_int64_t recvd)
46{
47}
48
38ssize_t 49ssize_t
39roaming_write(int fd, const void *buf, size_t count, int *cont) 50roaming_write(int fd, const void *buf, size_t count, int *cont)
40{ 51{
diff --git a/sandbox-systrace.c b/sandbox-systrace.c
index aaa3d8f0a..f30e70575 100644
--- a/sandbox-systrace.c
+++ b/sandbox-systrace.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sandbox-systrace.c,v 1.13 2014/07/17 00:10:56 djm Exp $ */ 1/* $OpenBSD: sandbox-systrace.c,v 1.14 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -20,7 +20,6 @@
20#ifdef SANDBOX_SYSTRACE 20#ifdef SANDBOX_SYSTRACE
21 21
22#include <sys/types.h> 22#include <sys/types.h>
23#include <sys/param.h>
24#include <sys/ioctl.h> 23#include <sys/ioctl.h>
25#include <sys/syscall.h> 24#include <sys/syscall.h>
26#include <sys/socket.h> 25#include <sys/socket.h>
@@ -37,6 +36,7 @@
37#include <stdlib.h> 36#include <stdlib.h>
38#include <string.h> 37#include <string.h>
39#include <unistd.h> 38#include <unistd.h>
39#include <limits.h>
40 40
41#include "atomicio.h" 41#include "atomicio.h"
42#include "log.h" 42#include "log.h"
diff --git a/scard/.cvsignore b/scard/.cvsignore
new file mode 100644
index 000000000..5349d34ae
--- /dev/null
+++ b/scard/.cvsignore
@@ -0,0 +1,2 @@
1Makefile
2Ssh.bin
diff --git a/scp.0 b/scp.0
index 0495f2555..3f309fe03 100644
--- a/scp.0
+++ b/scp.0
@@ -1,7 +1,7 @@
1SCP(1) General Commands Manual SCP(1) 1SCP(1) General Commands Manual SCP(1)
2 2
3NAME 3NAME
4 scp - secure copy (remote file copy program) 4 scp M-bM-^@M-^S secure copy (remote file copy program)
5 5
6SYNOPSIS 6SYNOPSIS
7 scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] 7 scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
@@ -17,7 +17,7 @@ DESCRIPTION
17 File names may contain a user and host specification to indicate that the 17 File names may contain a user and host specification to indicate that the
18 file is to be copied to/from that host. Local file names can be made 18 file is to be copied to/from that host. Local file names can be made
19 explicit using absolute or relative pathnames to avoid scp treating file 19 explicit using absolute or relative pathnames to avoid scp treating file
20 names containing `:' as host specifiers. Copies between two remote hosts 20 names containing M-bM-^@M-^X:M-bM-^@M-^Y as host specifiers. Copies between two remote hosts
21 are also permitted. 21 are also permitted.
22 22
23 The options are as follows: 23 The options are as follows:
@@ -89,6 +89,7 @@ DESCRIPTION
89 HashKnownHosts 89 HashKnownHosts
90 Host 90 Host
91 HostbasedAuthentication 91 HostbasedAuthentication
92 HostbasedKeyTypes
92 HostKeyAlgorithms 93 HostKeyAlgorithms
93 HostKeyAlias 94 HostKeyAlias
94 HostName 95 HostName
@@ -117,6 +118,7 @@ DESCRIPTION
117 ServerAliveCountMax 118 ServerAliveCountMax
118 StrictHostKeyChecking 119 StrictHostKeyChecking
119 TCPKeepAlive 120 TCPKeepAlive
121 UpdateHostKeys
120 UsePrivilegedPort 122 UsePrivilegedPort
121 User 123 User
122 UserKnownHostsFile 124 UserKnownHostsFile
@@ -124,7 +126,7 @@ DESCRIPTION
124 126
125 -P port 127 -P port
126 Specifies the port to connect to on the remote host. Note that 128 Specifies the port to connect to on the remote host. Note that
127 this option is written with a capital `P', because -p is already 129 this option is written with a capital M-bM-^@M-^XPM-bM-^@M-^Y, because -p is already
128 reserved for preserving the times and modes of the file. 130 reserved for preserving the times and modes of the file.
129 131
130 -p Preserves modification times, access times, and modes from the 132 -p Preserves modification times, access times, and modes from the
@@ -145,7 +147,7 @@ DESCRIPTION
145 authentication, and configuration problems. 147 authentication, and configuration problems.
146 148
147EXIT STATUS 149EXIT STATUS
148 The scp utility exits 0 on success, and >0 if an error occurs. 150 The scp utility exitsM-BM- 0 on success, andM-BM- >0 if an error occurs.
149 151
150SEE ALSO 152SEE ALSO
151 sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), ssh_config(5), 153 sftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), ssh_config(5),
@@ -159,4 +161,4 @@ AUTHORS
159 Timo Rinne <tri@iki.fi> 161 Timo Rinne <tri@iki.fi>
160 Tatu Ylonen <ylo@cs.hut.fi> 162 Tatu Ylonen <ylo@cs.hut.fi>
161 163
162OpenBSD 5.6 March 19, 2014 OpenBSD 5.6 164OpenBSD 5.7 January 30, 2015 OpenBSD 5.7
diff --git a/scp.1 b/scp.1
index 1791b6189..0e84780e0 100644
--- a/scp.1
+++ b/scp.1
@@ -8,9 +8,9 @@
8.\" 8.\"
9.\" Created: Sun May 7 00:14:37 1995 ylo 9.\" Created: Sun May 7 00:14:37 1995 ylo
10.\" 10.\"
11.\" $OpenBSD: scp.1,v 1.62 2014/03/19 14:42:44 tedu Exp $ 11.\" $OpenBSD: scp.1,v 1.66 2015/01/30 11:43:14 djm Exp $
12.\" 12.\"
13.Dd $Mdocdate: March 19 2014 $ 13.Dd $Mdocdate: January 30 2015 $
14.Dt SCP 1 14.Dt SCP 1
15.Os 15.Os
16.Sh NAME 16.Sh NAME
@@ -30,14 +30,14 @@
30.Sm off 30.Sm off
31.Oo 31.Oo
32.Op Ar user No @ 32.Op Ar user No @
33.Ar host1 No : 33.Ar host1 :
34.Oc Ar file1 34.Oc Ar file1
35.Sm on 35.Sm on
36.Ar ... 36.Ar ...
37.Sm off 37.Sm off
38.Oo 38.Oo
39.Op Ar user No @ 39.Op Ar user No @
40.Ar host2 No : 40.Ar host2 :
41.Oc Ar file2 41.Oc Ar file2
42.Sm on 42.Sm on
43.Ek 43.Ek
@@ -150,6 +150,7 @@ For full details of the options listed below, and their possible values, see
150.It HashKnownHosts 150.It HashKnownHosts
151.It Host 151.It Host
152.It HostbasedAuthentication 152.It HostbasedAuthentication
153.It HostbasedKeyTypes
153.It HostKeyAlgorithms 154.It HostKeyAlgorithms
154.It HostKeyAlias 155.It HostKeyAlias
155.It HostName 156.It HostName
@@ -178,6 +179,7 @@ For full details of the options listed below, and their possible values, see
178.It ServerAliveCountMax 179.It ServerAliveCountMax
179.It StrictHostKeyChecking 180.It StrictHostKeyChecking
180.It TCPKeepAlive 181.It TCPKeepAlive
182.It UpdateHostKeys
181.It UsePrivilegedPort 183.It UsePrivilegedPort
182.It User 184.It User
183.It UserKnownHostsFile 185.It UserKnownHostsFile
diff --git a/scp.c b/scp.c
index 1ec3b7087..887b014b8 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: scp.c,v 1.180 2014/06/24 02:21:01 djm Exp $ */ 1/* $OpenBSD: scp.c,v 1.181 2015/01/16 06:40:12 deraadt Exp $ */
2/* 2/*
3 * scp - secure remote copy. This is basically patched BSD rcp which 3 * scp - secure remote copy. This is basically patched BSD rcp which
4 * uses ssh to do the data transfer (instead of using rcmd). 4 * uses ssh to do the data transfer (instead of using rcmd).
@@ -95,6 +95,7 @@
95#include <dirent.h> 95#include <dirent.h>
96#include <errno.h> 96#include <errno.h>
97#include <fcntl.h> 97#include <fcntl.h>
98#include <limits.h>
98#include <pwd.h> 99#include <pwd.h>
99#include <signal.h> 100#include <signal.h>
100#include <stdarg.h> 101#include <stdarg.h>
@@ -749,7 +750,7 @@ source(int argc, char **argv)
749 off_t i, statbytes; 750 off_t i, statbytes;
750 size_t amt, nr; 751 size_t amt, nr;
751 int fd = -1, haderr, indx; 752 int fd = -1, haderr, indx;
752 char *last, *name, buf[2048], encname[MAXPATHLEN]; 753 char *last, *name, buf[2048], encname[PATH_MAX];
753 int len; 754 int len;
754 755
755 for (indx = 0; indx < argc; ++indx) { 756 for (indx = 0; indx < argc; ++indx) {
@@ -858,7 +859,7 @@ rsource(char *name, struct stat *statp)
858{ 859{
859 DIR *dirp; 860 DIR *dirp;
860 struct dirent *dp; 861 struct dirent *dp;
861 char *last, *vect[1], path[MAXPATHLEN]; 862 char *last, *vect[1], path[PATH_MAX];
862 863
863 if (!(dirp = opendir(name))) { 864 if (!(dirp = opendir(name))) {
864 run_err("%s: %s", name, strerror(errno)); 865 run_err("%s: %s", name, strerror(errno));
diff --git a/servconf.c b/servconf.c
index b7f329447..318546290 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,5 +1,5 @@
1 1
2/* $OpenBSD: servconf.c,v 1.251 2014/07/15 15:54:14 millert Exp $ */ 2/* $OpenBSD: servconf.c,v 1.260 2015/02/02 01:57:44 deraadt Exp $ */
3/* 3/*
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * All rights reserved 5 * All rights reserved
@@ -28,6 +28,7 @@
28#include <string.h> 28#include <string.h>
29#include <signal.h> 29#include <signal.h>
30#include <unistd.h> 30#include <unistd.h>
31#include <limits.h>
31#include <stdarg.h> 32#include <stdarg.h>
32#include <errno.h> 33#include <errno.h>
33#ifdef HAVE_UTIL_H 34#ifdef HAVE_UTIL_H
@@ -54,6 +55,8 @@
54#include "packet.h" 55#include "packet.h"
55#include "hostfile.h" 56#include "hostfile.h"
56#include "auth.h" 57#include "auth.h"
58#include "myproposal.h"
59#include "digest.h"
57 60
58static void add_listen_addr(ServerOptions *, char *, int); 61static void add_listen_addr(ServerOptions *, char *, int);
59static void add_one_listen_addr(ServerOptions *, char *, int); 62static void add_one_listen_addr(ServerOptions *, char *, int);
@@ -102,8 +105,10 @@ initialize_server_options(ServerOptions *options)
102 options->rhosts_rsa_authentication = -1; 105 options->rhosts_rsa_authentication = -1;
103 options->hostbased_authentication = -1; 106 options->hostbased_authentication = -1;
104 options->hostbased_uses_name_from_packet_only = -1; 107 options->hostbased_uses_name_from_packet_only = -1;
108 options->hostbased_key_types = NULL;
105 options->rsa_authentication = -1; 109 options->rsa_authentication = -1;
106 options->pubkey_authentication = -1; 110 options->pubkey_authentication = -1;
111 options->pubkey_key_types = NULL;
107 options->kerberos_authentication = -1; 112 options->kerberos_authentication = -1;
108 options->kerberos_or_local_passwd = -1; 113 options->kerberos_or_local_passwd = -1;
109 options->kerberos_ticket_cleanup = -1; 114 options->kerberos_ticket_cleanup = -1;
@@ -157,11 +162,21 @@ initialize_server_options(ServerOptions *options)
157 options->ip_qos_interactive = -1; 162 options->ip_qos_interactive = -1;
158 options->ip_qos_bulk = -1; 163 options->ip_qos_bulk = -1;
159 options->version_addendum = NULL; 164 options->version_addendum = NULL;
165 options->fingerprint_hash = -1;
166}
167
168/* Returns 1 if a string option is unset or set to "none" or 0 otherwise. */
169static int
170option_clear_or_none(const char *o)
171{
172 return o == NULL || strcasecmp(o, "none") == 0;
160} 173}
161 174
162void 175void
163fill_default_server_options(ServerOptions *options) 176fill_default_server_options(ServerOptions *options)
164{ 177{
178 int i;
179
165 /* Portable-specific options */ 180 /* Portable-specific options */
166 if (options->use_pam == -1) 181 if (options->use_pam == -1)
167 options->use_pam = 0; 182 options->use_pam = 0;
@@ -193,7 +208,7 @@ fill_default_server_options(ServerOptions *options)
193 if (options->listen_addrs == NULL) 208 if (options->listen_addrs == NULL)
194 add_listen_addr(options, NULL, 0); 209 add_listen_addr(options, NULL, 0);
195 if (options->pid_file == NULL) 210 if (options->pid_file == NULL)
196 options->pid_file = _PATH_SSH_DAEMON_PID_FILE; 211 options->pid_file = xstrdup(_PATH_SSH_DAEMON_PID_FILE);
197 if (options->server_key_bits == -1) 212 if (options->server_key_bits == -1)
198 options->server_key_bits = 1024; 213 options->server_key_bits = 1024;
199 if (options->login_grace_time == -1) 214 if (options->login_grace_time == -1)
@@ -217,7 +232,7 @@ fill_default_server_options(ServerOptions *options)
217 if (options->x11_use_localhost == -1) 232 if (options->x11_use_localhost == -1)
218 options->x11_use_localhost = 1; 233 options->x11_use_localhost = 1;
219 if (options->xauth_location == NULL) 234 if (options->xauth_location == NULL)
220 options->xauth_location = _PATH_XAUTH; 235 options->xauth_location = xstrdup(_PATH_XAUTH);
221 if (options->permit_tty == -1) 236 if (options->permit_tty == -1)
222 options->permit_tty = 1; 237 options->permit_tty = 1;
223 if (options->permit_user_rc == -1) 238 if (options->permit_user_rc == -1)
@@ -236,10 +251,14 @@ fill_default_server_options(ServerOptions *options)
236 options->hostbased_authentication = 0; 251 options->hostbased_authentication = 0;
237 if (options->hostbased_uses_name_from_packet_only == -1) 252 if (options->hostbased_uses_name_from_packet_only == -1)
238 options->hostbased_uses_name_from_packet_only = 0; 253 options->hostbased_uses_name_from_packet_only = 0;
254 if (options->hostbased_key_types == NULL)
255 options->hostbased_key_types = xstrdup("*");
239 if (options->rsa_authentication == -1) 256 if (options->rsa_authentication == -1)
240 options->rsa_authentication = 1; 257 options->rsa_authentication = 1;
241 if (options->pubkey_authentication == -1) 258 if (options->pubkey_authentication == -1)
242 options->pubkey_authentication = 1; 259 options->pubkey_authentication = 1;
260 if (options->pubkey_key_types == NULL)
261 options->pubkey_key_types = xstrdup("*");
243 if (options->kerberos_authentication == -1) 262 if (options->kerberos_authentication == -1)
244 options->kerberos_authentication = 0; 263 options->kerberos_authentication = 0;
245 if (options->kerberos_or_local_passwd == -1) 264 if (options->kerberos_or_local_passwd == -1)
@@ -289,7 +308,7 @@ fill_default_server_options(ServerOptions *options)
289 if (options->max_sessions == -1) 308 if (options->max_sessions == -1)
290 options->max_sessions = DEFAULT_SESSIONS_MAX; 309 options->max_sessions = DEFAULT_SESSIONS_MAX;
291 if (options->use_dns == -1) 310 if (options->use_dns == -1)
292 options->use_dns = 1; 311 options->use_dns = 0;
293 if (options->client_alive_interval == -1) 312 if (options->client_alive_interval == -1)
294 options->client_alive_interval = 0; 313 options->client_alive_interval = 0;
295 if (options->client_alive_count_max == -1) 314 if (options->client_alive_count_max == -1)
@@ -312,10 +331,30 @@ fill_default_server_options(ServerOptions *options)
312 options->fwd_opts.streamlocal_bind_mask = 0177; 331 options->fwd_opts.streamlocal_bind_mask = 0177;
313 if (options->fwd_opts.streamlocal_bind_unlink == -1) 332 if (options->fwd_opts.streamlocal_bind_unlink == -1)
314 options->fwd_opts.streamlocal_bind_unlink = 0; 333 options->fwd_opts.streamlocal_bind_unlink = 0;
334 if (options->fingerprint_hash == -1)
335 options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
315 /* Turn privilege separation on by default */ 336 /* Turn privilege separation on by default */
316 if (use_privsep == -1) 337 if (use_privsep == -1)
317 use_privsep = PRIVSEP_NOSANDBOX; 338 use_privsep = PRIVSEP_NOSANDBOX;
318 339
340#define CLEAR_ON_NONE(v) \
341 do { \
342 if (option_clear_or_none(v)) { \
343 free(v); \
344 v = NULL; \
345 } \
346 } while(0)
347 CLEAR_ON_NONE(options->pid_file);
348 CLEAR_ON_NONE(options->xauth_location);
349 CLEAR_ON_NONE(options->banner);
350 CLEAR_ON_NONE(options->trusted_user_ca_keys);
351 CLEAR_ON_NONE(options->revoked_keys_file);
352 for (i = 0; i < options->num_host_key_files; i++)
353 CLEAR_ON_NONE(options->host_key_files[i]);
354 for (i = 0; i < options->num_host_cert_files; i++)
355 CLEAR_ON_NONE(options->host_cert_files[i]);
356#undef CLEAR_ON_NONE
357
319#ifndef HAVE_MMAP 358#ifndef HAVE_MMAP
320 if (use_privsep && options->compression == 1) { 359 if (use_privsep && options->compression == 1) {
321 error("This platform does not support both privilege " 360 error("This platform does not support both privilege "
@@ -333,8 +372,8 @@ typedef enum {
333 /* Portable-specific options */ 372 /* Portable-specific options */
334 sUsePAM, 373 sUsePAM,
335 /* Standard Options */ 374 /* Standard Options */
336 sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime, 375 sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime,
337 sPermitRootLogin, sLogFacility, sLogLevel, 376 sKeyRegenerationTime, sPermitRootLogin, sLogFacility, sLogLevel,
338 sRhostsRSAAuthentication, sRSAAuthentication, 377 sRhostsRSAAuthentication, sRSAAuthentication,
339 sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup, 378 sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
340 sKerberosGetAFSToken, 379 sKerberosGetAFSToken,
@@ -347,11 +386,11 @@ typedef enum {
347 sPermitUserEnvironment, sUseLogin, sAllowTcpForwarding, sCompression, 386 sPermitUserEnvironment, sUseLogin, sAllowTcpForwarding, sCompression,
348 sRekeyLimit, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups, 387 sRekeyLimit, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
349 sIgnoreUserKnownHosts, sCiphers, sMacs, sProtocol, sPidFile, 388 sIgnoreUserKnownHosts, sCiphers, sMacs, sProtocol, sPidFile,
350 sGatewayPorts, sPubkeyAuthentication, sXAuthLocation, sSubsystem, 389 sGatewayPorts, sPubkeyAuthentication, sPubkeyAcceptedKeyTypes,
351 sMaxStartups, sMaxAuthTries, sMaxSessions, 390 sXAuthLocation, sSubsystem, sMaxStartups, sMaxAuthTries, sMaxSessions,
352 sBanner, sUseDNS, sHostbasedAuthentication, 391 sBanner, sUseDNS, sHostbasedAuthentication,
353 sHostbasedUsesNameFromPacketOnly, sClientAliveInterval, 392 sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedKeyTypes,
354 sClientAliveCountMax, sAuthorizedKeysFile, 393 sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
355 sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel, 394 sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
356 sMatch, sPermitOpen, sForceCommand, sChrootDirectory, 395 sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
357 sUsePrivilegeSeparation, sAllowAgentForwarding, 396 sUsePrivilegeSeparation, sAllowAgentForwarding,
@@ -361,7 +400,7 @@ typedef enum {
361 sAuthorizedKeysCommand, sAuthorizedKeysCommandUser, 400 sAuthorizedKeysCommand, sAuthorizedKeysCommandUser,
362 sAuthenticationMethods, sHostKeyAgent, sPermitUserRC, 401 sAuthenticationMethods, sHostKeyAgent, sPermitUserRC,
363 sStreamLocalBindMask, sStreamLocalBindUnlink, 402 sStreamLocalBindMask, sStreamLocalBindUnlink,
364 sAllowStreamLocalForwarding, 403 sAllowStreamLocalForwarding, sFingerprintHash,
365 sDeprecated, sUnsupported 404 sDeprecated, sUnsupported
366} ServerOpCodes; 405} ServerOpCodes;
367 406
@@ -398,8 +437,10 @@ static struct {
398 { "rhostsrsaauthentication", sRhostsRSAAuthentication, SSHCFG_ALL }, 437 { "rhostsrsaauthentication", sRhostsRSAAuthentication, SSHCFG_ALL },
399 { "hostbasedauthentication", sHostbasedAuthentication, SSHCFG_ALL }, 438 { "hostbasedauthentication", sHostbasedAuthentication, SSHCFG_ALL },
400 { "hostbasedusesnamefrompacketonly", sHostbasedUsesNameFromPacketOnly, SSHCFG_ALL }, 439 { "hostbasedusesnamefrompacketonly", sHostbasedUsesNameFromPacketOnly, SSHCFG_ALL },
440 { "hostbasedacceptedkeytypes", sHostbasedAcceptedKeyTypes, SSHCFG_ALL },
401 { "rsaauthentication", sRSAAuthentication, SSHCFG_ALL }, 441 { "rsaauthentication", sRSAAuthentication, SSHCFG_ALL },
402 { "pubkeyauthentication", sPubkeyAuthentication, SSHCFG_ALL }, 442 { "pubkeyauthentication", sPubkeyAuthentication, SSHCFG_ALL },
443 { "pubkeyacceptedkeytypes", sPubkeyAcceptedKeyTypes, SSHCFG_ALL },
403 { "dsaauthentication", sPubkeyAuthentication, SSHCFG_GLOBAL }, /* alias */ 444 { "dsaauthentication", sPubkeyAuthentication, SSHCFG_GLOBAL }, /* alias */
404#ifdef KRB5 445#ifdef KRB5
405 { "kerberosauthentication", sKerberosAuthentication, SSHCFG_ALL }, 446 { "kerberosauthentication", sKerberosAuthentication, SSHCFG_ALL },
@@ -492,6 +533,7 @@ static struct {
492 { "streamlocalbindmask", sStreamLocalBindMask, SSHCFG_ALL }, 533 { "streamlocalbindmask", sStreamLocalBindMask, SSHCFG_ALL },
493 { "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL }, 534 { "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL },
494 { "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL }, 535 { "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL },
536 { "fingerprinthash", sFingerprintHash, SSHCFG_GLOBAL },
495 { NULL, sBadOption, 0 } 537 { NULL, sBadOption, 0 }
496}; 538};
497 539
@@ -530,8 +572,10 @@ parse_token(const char *cp, const char *filename,
530char * 572char *
531derelativise_path(const char *path) 573derelativise_path(const char *path)
532{ 574{
533 char *expanded, *ret, cwd[MAXPATHLEN]; 575 char *expanded, *ret, cwd[PATH_MAX];
534 576
577 if (strcasecmp(path, "none") == 0)
578 return xstrdup("none");
535 expanded = tilde_expand_filename(path, getuid()); 579 expanded = tilde_expand_filename(path, getuid());
536 if (*expanded == '/') 580 if (*expanded == '/')
537 return expanded; 581 return expanded;
@@ -1076,6 +1120,20 @@ process_server_config_line(ServerOptions *options, char *line,
1076 intptr = &options->hostbased_uses_name_from_packet_only; 1120 intptr = &options->hostbased_uses_name_from_packet_only;
1077 goto parse_flag; 1121 goto parse_flag;
1078 1122
1123 case sHostbasedAcceptedKeyTypes:
1124 charptr = &options->hostbased_key_types;
1125 parse_keytypes:
1126 arg = strdelim(&cp);
1127 if (!arg || *arg == '\0')
1128 fatal("%s line %d: Missing argument.",
1129 filename, linenum);
1130 if (!sshkey_names_valid2(arg, 1))
1131 fatal("%s line %d: Bad key types '%s'.",
1132 filename, linenum, arg ? arg : "<NONE>");
1133 if (*activep && *charptr == NULL)
1134 *charptr = xstrdup(arg);
1135 break;
1136
1079 case sRSAAuthentication: 1137 case sRSAAuthentication:
1080 intptr = &options->rsa_authentication; 1138 intptr = &options->rsa_authentication;
1081 goto parse_flag; 1139 goto parse_flag;
@@ -1084,6 +1142,10 @@ process_server_config_line(ServerOptions *options, char *line,
1084 intptr = &options->pubkey_authentication; 1142 intptr = &options->pubkey_authentication;
1085 goto parse_flag; 1143 goto parse_flag;
1086 1144
1145 case sPubkeyAcceptedKeyTypes:
1146 charptr = &options->pubkey_key_types;
1147 goto parse_keytypes;
1148
1087 case sKerberosAuthentication: 1149 case sKerberosAuthentication:
1088 intptr = &options->kerberos_authentication; 1150 intptr = &options->kerberos_authentication;
1089 goto parse_flag; 1151 goto parse_flag;
@@ -1611,6 +1673,9 @@ process_server_config_line(ServerOptions *options, char *line,
1611 return 0; 1673 return 0;
1612 1674
1613 case sAuthorizedKeysCommand: 1675 case sAuthorizedKeysCommand:
1676 if (cp == NULL)
1677 fatal("%.200s line %d: Missing argument.", filename,
1678 linenum);
1614 len = strspn(cp, WHITESPACE); 1679 len = strspn(cp, WHITESPACE);
1615 if (*activep && options->authorized_keys_command == NULL) { 1680 if (*activep && options->authorized_keys_command == NULL) {
1616 if (cp[len] != '/' && strcasecmp(cp + len, "none") != 0) 1681 if (cp[len] != '/' && strcasecmp(cp + len, "none") != 0)
@@ -1625,6 +1690,9 @@ process_server_config_line(ServerOptions *options, char *line,
1625 charptr = &options->authorized_keys_command_user; 1690 charptr = &options->authorized_keys_command_user;
1626 1691
1627 arg = strdelim(&cp); 1692 arg = strdelim(&cp);
1693 if (!arg || *arg == '\0')
1694 fatal("%s line %d: missing AuthorizedKeysCommandUser "
1695 "argument.", filename, linenum);
1628 if (*activep && *charptr == NULL) 1696 if (*activep && *charptr == NULL)
1629 *charptr = xstrdup(arg); 1697 *charptr = xstrdup(arg);
1630 break; 1698 break;
@@ -1663,6 +1731,18 @@ process_server_config_line(ServerOptions *options, char *line,
1663 intptr = &options->fwd_opts.streamlocal_bind_unlink; 1731 intptr = &options->fwd_opts.streamlocal_bind_unlink;
1664 goto parse_flag; 1732 goto parse_flag;
1665 1733
1734 case sFingerprintHash:
1735 arg = strdelim(&cp);
1736 if (!arg || *arg == '\0')
1737 fatal("%.200s line %d: Missing argument.",
1738 filename, linenum);
1739 if ((value = ssh_digest_alg_by_name(arg)) == -1)
1740 fatal("%.200s line %d: Invalid hash algorithm \"%s\".",
1741 filename, linenum, arg);
1742 if (*activep)
1743 options->fingerprint_hash = value;
1744 break;
1745
1666 case sDeprecated: 1746 case sDeprecated:
1667 logit("%s line %d: Deprecated option %s", 1747 logit("%s line %d: Deprecated option %s",
1668 filename, linenum, arg); 1748 filename, linenum, arg);
@@ -1905,6 +1985,8 @@ fmt_intarg(ServerOpCodes code, int val)
1905 return fmt_multistate_int(val, multistate_tcpfwd); 1985 return fmt_multistate_int(val, multistate_tcpfwd);
1906 case sAllowStreamLocalForwarding: 1986 case sAllowStreamLocalForwarding:
1907 return fmt_multistate_int(val, multistate_tcpfwd); 1987 return fmt_multistate_int(val, multistate_tcpfwd);
1988 case sFingerprintHash:
1989 return ssh_digest_alg_name(val);
1908 case sProtocol: 1990 case sProtocol:
1909 switch (val) { 1991 switch (val) {
1910 case SSH_PROTO_1: 1992 case SSH_PROTO_1:
@@ -1956,7 +2038,8 @@ dump_cfg_string(ServerOpCodes code, const char *val)
1956{ 2038{
1957 if (val == NULL) 2039 if (val == NULL)
1958 return; 2040 return;
1959 printf("%s %s\n", lookup_opcode_name(code), val); 2041 printf("%s %s\n", lookup_opcode_name(code),
2042 val == NULL ? "none" : val);
1960} 2043}
1961 2044
1962static void 2045static void
@@ -2066,13 +2149,13 @@ dump_config(ServerOptions *o)
2066 dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding); 2149 dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding);
2067 dump_cfg_fmtint(sAllowStreamLocalForwarding, o->allow_streamlocal_forwarding); 2150 dump_cfg_fmtint(sAllowStreamLocalForwarding, o->allow_streamlocal_forwarding);
2068 dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep); 2151 dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
2152 dump_cfg_fmtint(sFingerprintHash, o->fingerprint_hash);
2069 2153
2070 /* string arguments */ 2154 /* string arguments */
2071 dump_cfg_string(sPidFile, o->pid_file); 2155 dump_cfg_string(sPidFile, o->pid_file);
2072 dump_cfg_string(sXAuthLocation, o->xauth_location); 2156 dump_cfg_string(sXAuthLocation, o->xauth_location);
2073 dump_cfg_string(sCiphers, o->ciphers ? o->ciphers : 2157 dump_cfg_string(sCiphers, o->ciphers ? o->ciphers : KEX_SERVER_ENCRYPT);
2074 cipher_alg_list(',', 0)); 2158 dump_cfg_string(sMacs, o->macs ? o->macs : KEX_SERVER_MAC);
2075 dump_cfg_string(sMacs, o->macs ? o->macs : mac_alg_list(','));
2076 dump_cfg_string(sBanner, o->banner); 2159 dump_cfg_string(sBanner, o->banner);
2077 dump_cfg_string(sForceCommand, o->adm_forced_command); 2160 dump_cfg_string(sForceCommand, o->adm_forced_command);
2078 dump_cfg_string(sChrootDirectory, o->chroot_directory); 2161 dump_cfg_string(sChrootDirectory, o->chroot_directory);
@@ -2084,8 +2167,12 @@ dump_config(ServerOptions *o)
2084 dump_cfg_string(sAuthorizedKeysCommand, o->authorized_keys_command); 2167 dump_cfg_string(sAuthorizedKeysCommand, o->authorized_keys_command);
2085 dump_cfg_string(sAuthorizedKeysCommandUser, o->authorized_keys_command_user); 2168 dump_cfg_string(sAuthorizedKeysCommandUser, o->authorized_keys_command_user);
2086 dump_cfg_string(sHostKeyAgent, o->host_key_agent); 2169 dump_cfg_string(sHostKeyAgent, o->host_key_agent);
2087 dump_cfg_string(sKexAlgorithms, o->kex_algorithms ? o->kex_algorithms : 2170 dump_cfg_string(sKexAlgorithms,
2088 kex_alg_list(',')); 2171 o->kex_algorithms ? o->kex_algorithms : KEX_SERVER_KEX);
2172 dump_cfg_string(sHostbasedAcceptedKeyTypes, o->hostbased_key_types ?
2173 o->hostbased_key_types : KEX_DEFAULT_PK_ALG);
2174 dump_cfg_string(sPubkeyAcceptedKeyTypes, o->pubkey_key_types ?
2175 o->pubkey_key_types : KEX_DEFAULT_PK_ALG);
2089 2176
2090 /* string arguments requiring a lookup */ 2177 /* string arguments requiring a lookup */
2091 dump_cfg_string(sLogLevel, log_level_name(o->log_level)); 2178 dump_cfg_string(sLogLevel, log_level_name(o->log_level));
diff --git a/servconf.h b/servconf.h
index 766db3a3d..9922f0c8c 100644
--- a/servconf.h
+++ b/servconf.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: servconf.h,v 1.114 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: servconf.h,v 1.116 2015/01/13 07:39:19 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -99,8 +99,10 @@ typedef struct {
99 * authentication. */ 99 * authentication. */
100 int hostbased_authentication; /* If true, permit ssh2 hostbased auth */ 100 int hostbased_authentication; /* If true, permit ssh2 hostbased auth */
101 int hostbased_uses_name_from_packet_only; /* experimental */ 101 int hostbased_uses_name_from_packet_only; /* experimental */
102 char *hostbased_key_types; /* Key types allowed for hostbased */
102 int rsa_authentication; /* If true, permit RSA authentication. */ 103 int rsa_authentication; /* If true, permit RSA authentication. */
103 int pubkey_authentication; /* If true, permit ssh2 pubkey authentication. */ 104 int pubkey_authentication; /* If true, permit ssh2 pubkey authentication. */
105 char *pubkey_key_types; /* Key types allowed for public key */
104 int kerberos_authentication; /* If true, permit Kerberos 106 int kerberos_authentication; /* If true, permit Kerberos
105 * authentication. */ 107 * authentication. */
106 int kerberos_or_local_passwd; /* If true, permit kerberos 108 int kerberos_or_local_passwd; /* If true, permit kerberos
@@ -185,6 +187,8 @@ typedef struct {
185 187
186 u_int num_auth_methods; 188 u_int num_auth_methods;
187 char *auth_methods[MAX_AUTH_METHODS]; 189 char *auth_methods[MAX_AUTH_METHODS];
190
191 int fingerprint_hash;
188} ServerOptions; 192} ServerOptions;
189 193
190/* Information about the incoming connection as used by Match */ 194/* Information about the incoming connection as used by Match */
@@ -213,6 +217,8 @@ struct connection_info {
213 M_CP_STROPT(authorized_principals_file); \ 217 M_CP_STROPT(authorized_principals_file); \
214 M_CP_STROPT(authorized_keys_command); \ 218 M_CP_STROPT(authorized_keys_command); \
215 M_CP_STROPT(authorized_keys_command_user); \ 219 M_CP_STROPT(authorized_keys_command_user); \
220 M_CP_STROPT(hostbased_key_types); \
221 M_CP_STROPT(pubkey_key_types); \
216 M_CP_STRARRAYOPT(authorized_keys_files, num_authkeys_files); \ 222 M_CP_STRARRAYOPT(authorized_keys_files, num_authkeys_files); \
217 M_CP_STRARRAYOPT(allow_users, num_allow_users); \ 223 M_CP_STRARRAYOPT(allow_users, num_allow_users); \
218 M_CP_STRARRAYOPT(deny_users, num_deny_users); \ 224 M_CP_STRARRAYOPT(deny_users, num_deny_users); \
diff --git a/serverloop.c b/serverloop.c
index e92f9e27b..306ac36be 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: serverloop.c,v 1.172 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: serverloop.c,v 1.178 2015/02/20 22:17:21 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -37,8 +37,8 @@
37 37
38#include "includes.h" 38#include "includes.h"
39 39
40#include <sys/param.h> /* MIN MAX */
40#include <sys/types.h> 41#include <sys/types.h>
41#include <sys/param.h>
42#include <sys/wait.h> 42#include <sys/wait.h>
43#include <sys/socket.h> 43#include <sys/socket.h>
44#ifdef HAVE_SYS_TIME_H 44#ifdef HAVE_SYS_TIME_H
@@ -79,11 +79,11 @@
79#include "auth-options.h" 79#include "auth-options.h"
80#include "serverloop.h" 80#include "serverloop.h"
81#include "roaming.h" 81#include "roaming.h"
82#include "ssherr.h"
82 83
83extern ServerOptions options; 84extern ServerOptions options;
84 85
85/* XXX */ 86/* XXX */
86extern Kex *xxx_kex;
87extern Authctxt *the_authctxt; 87extern Authctxt *the_authctxt;
88extern int use_privsep; 88extern int use_privsep;
89 89
@@ -545,7 +545,7 @@ drain_output(void)
545static void 545static void
546process_buffered_input_packets(void) 546process_buffered_input_packets(void)
547{ 547{
548 dispatch_run(DISPATCH_NONBLOCK, NULL, compat20 ? xxx_kex : NULL); 548 dispatch_run(DISPATCH_NONBLOCK, NULL, active_state);
549} 549}
550 550
551/* 551/*
@@ -851,7 +851,7 @@ server_loop2(Authctxt *authctxt)
851 for (;;) { 851 for (;;) {
852 process_buffered_input_packets(); 852 process_buffered_input_packets();
853 853
854 rekeying = (xxx_kex != NULL && !xxx_kex->done); 854 rekeying = (active_state->kex != NULL && !active_state->kex->done);
855 855
856 if (!rekeying && packet_not_very_much_data_to_write()) 856 if (!rekeying && packet_not_very_much_data_to_write())
857 channel_output_poll(); 857 channel_output_poll();
@@ -874,8 +874,8 @@ server_loop2(Authctxt *authctxt)
874 channel_after_select(readset, writeset); 874 channel_after_select(readset, writeset);
875 if (packet_need_rekeying()) { 875 if (packet_need_rekeying()) {
876 debug("need rekeying"); 876 debug("need rekeying");
877 xxx_kex->done = 0; 877 active_state->kex->done = 0;
878 kex_send_kexinit(xxx_kex); 878 kex_send_kexinit(active_state);
879 } 879 }
880 } 880 }
881 process_input(readset); 881 process_input(readset);
@@ -895,7 +895,7 @@ server_loop2(Authctxt *authctxt)
895 session_destroy_all(NULL); 895 session_destroy_all(NULL);
896} 896}
897 897
898static void 898static int
899server_input_keep_alive(int type, u_int32_t seq, void *ctxt) 899server_input_keep_alive(int type, u_int32_t seq, void *ctxt)
900{ 900{
901 debug("Got %d/%u for keepalive", type, seq); 901 debug("Got %d/%u for keepalive", type, seq);
@@ -905,9 +905,10 @@ server_input_keep_alive(int type, u_int32_t seq, void *ctxt)
905 * the bogus CHANNEL_REQUEST we send for keepalives. 905 * the bogus CHANNEL_REQUEST we send for keepalives.
906 */ 906 */
907 packet_set_alive_timeouts(0); 907 packet_set_alive_timeouts(0);
908 return 0;
908} 909}
909 910
910static void 911static int
911server_input_stdin_data(int type, u_int32_t seq, void *ctxt) 912server_input_stdin_data(int type, u_int32_t seq, void *ctxt)
912{ 913{
913 char *data; 914 char *data;
@@ -916,15 +917,16 @@ server_input_stdin_data(int type, u_int32_t seq, void *ctxt)
916 /* Stdin data from the client. Append it to the buffer. */ 917 /* Stdin data from the client. Append it to the buffer. */
917 /* Ignore any data if the client has closed stdin. */ 918 /* Ignore any data if the client has closed stdin. */
918 if (fdin == -1) 919 if (fdin == -1)
919 return; 920 return 0;
920 data = packet_get_string(&data_len); 921 data = packet_get_string(&data_len);
921 packet_check_eom(); 922 packet_check_eom();
922 buffer_append(&stdin_buffer, data, data_len); 923 buffer_append(&stdin_buffer, data, data_len);
923 explicit_bzero(data, data_len); 924 explicit_bzero(data, data_len);
924 free(data); 925 free(data);
926 return 0;
925} 927}
926 928
927static void 929static int
928server_input_eof(int type, u_int32_t seq, void *ctxt) 930server_input_eof(int type, u_int32_t seq, void *ctxt)
929{ 931{
930 /* 932 /*
@@ -935,9 +937,10 @@ server_input_eof(int type, u_int32_t seq, void *ctxt)
935 debug("EOF received for stdin."); 937 debug("EOF received for stdin.");
936 packet_check_eom(); 938 packet_check_eom();
937 stdin_eof = 1; 939 stdin_eof = 1;
940 return 0;
938} 941}
939 942
940static void 943static int
941server_input_window_size(int type, u_int32_t seq, void *ctxt) 944server_input_window_size(int type, u_int32_t seq, void *ctxt)
942{ 945{
943 u_int row = packet_get_int(); 946 u_int row = packet_get_int();
@@ -949,6 +952,7 @@ server_input_window_size(int type, u_int32_t seq, void *ctxt)
949 packet_check_eom(); 952 packet_check_eom();
950 if (fdin != -1) 953 if (fdin != -1)
951 pty_change_window_size(fdin, row, col, xpixel, ypixel); 954 pty_change_window_size(fdin, row, col, xpixel, ypixel);
955 return 0;
952} 956}
953 957
954static Channel * 958static Channel *
@@ -1093,7 +1097,7 @@ server_request_session(void)
1093 return c; 1097 return c;
1094} 1098}
1095 1099
1096static void 1100static int
1097server_input_channel_open(int type, u_int32_t seq, void *ctxt) 1101server_input_channel_open(int type, u_int32_t seq, void *ctxt)
1098{ 1102{
1099 Channel *c = NULL; 1103 Channel *c = NULL;
@@ -1143,14 +1147,86 @@ server_input_channel_open(int type, u_int32_t seq, void *ctxt)
1143 packet_send(); 1147 packet_send();
1144 } 1148 }
1145 free(ctype); 1149 free(ctype);
1150 return 0;
1146} 1151}
1147 1152
1148static void 1153static int
1154server_input_hostkeys_prove(struct sshbuf **respp)
1155{
1156 struct ssh *ssh = active_state; /* XXX */
1157 struct sshbuf *resp = NULL;
1158 struct sshbuf *sigbuf = NULL;
1159 struct sshkey *key = NULL, *key_pub = NULL, *key_prv = NULL;
1160 int r, ndx, success = 0;
1161 const u_char *blob;
1162 u_char *sig = 0;
1163 size_t blen, slen;
1164
1165 if ((resp = sshbuf_new()) == NULL || (sigbuf = sshbuf_new()) == NULL)
1166 fatal("%s: sshbuf_new", __func__);
1167
1168 while (ssh_packet_remaining(ssh) > 0) {
1169 sshkey_free(key);
1170 key = NULL;
1171 if ((r = sshpkt_get_string_direct(ssh, &blob, &blen)) != 0 ||
1172 (r = sshkey_from_blob(blob, blen, &key)) != 0) {
1173 error("%s: couldn't parse key: %s",
1174 __func__, ssh_err(r));
1175 goto out;
1176 }
1177 /*
1178 * Better check that this is actually one of our hostkeys
1179 * before attempting to sign anything with it.
1180 */
1181 if ((ndx = ssh->kex->host_key_index(key, 1, ssh)) == -1) {
1182 error("%s: unknown host %s key",
1183 __func__, sshkey_type(key));
1184 goto out;
1185 }
1186 /*
1187 * XXX refactor: make kex->sign just use an index rather
1188 * than passing in public and private keys
1189 */
1190 if ((key_prv = get_hostkey_by_index(ndx)) == NULL &&
1191 (key_pub = get_hostkey_public_by_index(ndx, ssh)) == NULL) {
1192 error("%s: can't retrieve hostkey %d", __func__, ndx);
1193 goto out;
1194 }
1195 sshbuf_reset(sigbuf);
1196 free(sig);
1197 sig = NULL;
1198 if ((r = sshbuf_put_cstring(sigbuf,
1199 "hostkeys-prove-00@openssh.com")) != 0 ||
1200 (r = sshbuf_put_string(sigbuf,
1201 ssh->kex->session_id, ssh->kex->session_id_len)) != 0 ||
1202 (r = sshkey_puts(key, sigbuf)) != 0 ||
1203 (r = ssh->kex->sign(key_prv, key_pub, &sig, &slen,
1204 sshbuf_ptr(sigbuf), sshbuf_len(sigbuf), 0)) != 0 ||
1205 (r = sshbuf_put_string(resp, sig, slen)) != 0) {
1206 error("%s: couldn't prepare signature: %s",
1207 __func__, ssh_err(r));
1208 goto out;
1209 }
1210 }
1211 /* Success */
1212 *respp = resp;
1213 resp = NULL; /* don't free it */
1214 success = 1;
1215 out:
1216 free(sig);
1217 sshbuf_free(resp);
1218 sshbuf_free(sigbuf);
1219 sshkey_free(key);
1220 return success;
1221}
1222
1223static int
1149server_input_global_request(int type, u_int32_t seq, void *ctxt) 1224server_input_global_request(int type, u_int32_t seq, void *ctxt)
1150{ 1225{
1151 char *rtype; 1226 char *rtype;
1152 int want_reply; 1227 int want_reply;
1153 int success = 0, allocated_listen_port = 0; 1228 int r, success = 0, allocated_listen_port = 0;
1229 struct sshbuf *resp = NULL;
1154 1230
1155 rtype = packet_get_string(NULL); 1231 rtype = packet_get_string(NULL);
1156 want_reply = packet_get_char(); 1232 want_reply = packet_get_char();
@@ -1187,6 +1263,10 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt)
1187 &allocated_listen_port, &options.fwd_opts); 1263 &allocated_listen_port, &options.fwd_opts);
1188 } 1264 }
1189 free(fwd.listen_host); 1265 free(fwd.listen_host);
1266 if ((resp = sshbuf_new()) == NULL)
1267 fatal("%s: sshbuf_new", __func__);
1268 if ((r = sshbuf_put_u32(resp, allocated_listen_port)) != 0)
1269 fatal("%s: sshbuf_put_u32: %s", __func__, ssh_err(r));
1190 } else if (strcmp(rtype, "cancel-tcpip-forward") == 0) { 1270 } else if (strcmp(rtype, "cancel-tcpip-forward") == 0) {
1191 struct Forward fwd; 1271 struct Forward fwd;
1192 1272
@@ -1230,19 +1310,24 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt)
1230 } else if (strcmp(rtype, "no-more-sessions@openssh.com") == 0) { 1310 } else if (strcmp(rtype, "no-more-sessions@openssh.com") == 0) {
1231 no_more_sessions = 1; 1311 no_more_sessions = 1;
1232 success = 1; 1312 success = 1;
1313 } else if (strcmp(rtype, "hostkeys-prove-00@openssh.com") == 0) {
1314 success = server_input_hostkeys_prove(&resp);
1233 } 1315 }
1234 if (want_reply) { 1316 if (want_reply) {
1235 packet_start(success ? 1317 packet_start(success ?
1236 SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE); 1318 SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE);
1237 if (success && allocated_listen_port > 0) 1319 if (success && resp != NULL)
1238 packet_put_int(allocated_listen_port); 1320 ssh_packet_put_raw(active_state, sshbuf_ptr(resp),
1321 sshbuf_len(resp));
1239 packet_send(); 1322 packet_send();
1240 packet_write_wait(); 1323 packet_write_wait();
1241 } 1324 }
1242 free(rtype); 1325 free(rtype);
1326 sshbuf_free(resp);
1327 return 0;
1243} 1328}
1244 1329
1245static void 1330static int
1246server_input_channel_req(int type, u_int32_t seq, void *ctxt) 1331server_input_channel_req(int type, u_int32_t seq, void *ctxt)
1247{ 1332{
1248 Channel *c; 1333 Channel *c;
@@ -1272,6 +1357,7 @@ server_input_channel_req(int type, u_int32_t seq, void *ctxt)
1272 packet_send(); 1357 packet_send();
1273 } 1358 }
1274 free(rtype); 1359 free(rtype);
1360 return 0;
1275} 1361}
1276 1362
1277static void 1363static void
diff --git a/session.c b/session.c
index 3e96557b8..54bac36a8 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: session.c,v 1.274 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: session.c,v 1.277 2015/01/16 06:40:12 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved 4 * All rights reserved
@@ -60,6 +60,7 @@
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62#include <unistd.h> 62#include <unistd.h>
63#include <limits.h>
63 64
64#include "openbsd-compat/sys-queue.h" 65#include "openbsd-compat/sys-queue.h"
65#include "xmalloc.h" 66#include "xmalloc.h"
@@ -1437,7 +1438,7 @@ static void
1437safely_chroot(const char *path, uid_t uid) 1438safely_chroot(const char *path, uid_t uid)
1438{ 1439{
1439 const char *cp; 1440 const char *cp;
1440 char component[MAXPATHLEN]; 1441 char component[PATH_MAX];
1441 struct stat st; 1442 struct stat st;
1442 1443
1443 if (*path != '/') 1444 if (*path != '/')
@@ -1620,11 +1621,11 @@ launch_login(struct passwd *pw, const char *hostname)
1620static void 1621static void
1621child_close_fds(void) 1622child_close_fds(void)
1622{ 1623{
1623 extern AuthenticationConnection *auth_conn; 1624 extern int auth_sock;
1624 1625
1625 if (auth_conn) { 1626 if (auth_sock != -1) {
1626 ssh_close_authentication_connection(auth_conn); 1627 close(auth_sock);
1627 auth_conn = NULL; 1628 auth_sock = -1;
1628 } 1629 }
1629 1630
1630 if (packet_get_connection_in() == packet_get_connection_out()) 1631 if (packet_get_connection_in() == packet_get_connection_out())
@@ -2648,7 +2649,7 @@ session_setup_x11fwd(Session *s)
2648 debug("X11 forwarding disabled in server configuration file."); 2649 debug("X11 forwarding disabled in server configuration file.");
2649 return 0; 2650 return 0;
2650 } 2651 }
2651 if (!options.xauth_location || 2652 if (options.xauth_location == NULL ||
2652 (stat(options.xauth_location, &st) == -1)) { 2653 (stat(options.xauth_location, &st) == -1)) {
2653 packet_send_debug("No xauth program; cannot forward with spoofing."); 2654 packet_send_debug("No xauth program; cannot forward with spoofing.");
2654 return 0; 2655 return 0;
diff --git a/sftp-client.c b/sftp-client.c
index 990b58d14..80f4805cb 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.c,v 1.115 2014/04/21 14:36:16 logan Exp $ */ 1/* $OpenBSD: sftp-client.c,v 1.117 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -22,8 +22,8 @@
22 22
23#include "includes.h" 23#include "includes.h"
24 24
25#include <sys/param.h> /* MIN MAX */
25#include <sys/types.h> 26#include <sys/types.h>
26#include <sys/param.h>
27#ifdef HAVE_SYS_STATVFS_H 27#ifdef HAVE_SYS_STATVFS_H
28#include <sys/statvfs.h> 28#include <sys/statvfs.h>
29#endif 29#endif
@@ -47,7 +47,8 @@
47#include <unistd.h> 47#include <unistd.h>
48 48
49#include "xmalloc.h" 49#include "xmalloc.h"
50#include "buffer.h" 50#include "ssherr.h"
51#include "sshbuf.h"
51#include "log.h" 52#include "log.h"
52#include "atomicio.h" 53#include "atomicio.h"
53#include "progressmeter.h" 54#include "progressmeter.h"
@@ -83,8 +84,8 @@ struct sftp_conn {
83 struct bwlimit bwlimit_in, bwlimit_out; 84 struct bwlimit bwlimit_in, bwlimit_out;
84}; 85};
85 86
86static char * 87static u_char *
87get_handle(struct sftp_conn *conn, u_int expected_id, u_int *len, 88get_handle(struct sftp_conn *conn, u_int expected_id, size_t *len,
88 const char *errfmt, ...) __attribute__((format(printf, 4, 5))); 89 const char *errfmt, ...) __attribute__((format(printf, 4, 5)));
89 90
90/* ARGSUSED */ 91/* ARGSUSED */
@@ -98,36 +99,39 @@ sftpio(void *_bwlimit, size_t amount)
98} 99}
99 100
100static void 101static void
101send_msg(struct sftp_conn *conn, Buffer *m) 102send_msg(struct sftp_conn *conn, struct sshbuf *m)
102{ 103{
103 u_char mlen[4]; 104 u_char mlen[4];
104 struct iovec iov[2]; 105 struct iovec iov[2];
105 106
106 if (buffer_len(m) > SFTP_MAX_MSG_LENGTH) 107 if (sshbuf_len(m) > SFTP_MAX_MSG_LENGTH)
107 fatal("Outbound message too long %u", buffer_len(m)); 108 fatal("Outbound message too long %zu", sshbuf_len(m));
108 109
109 /* Send length first */ 110 /* Send length first */
110 put_u32(mlen, buffer_len(m)); 111 put_u32(mlen, sshbuf_len(m));
111 iov[0].iov_base = mlen; 112 iov[0].iov_base = mlen;
112 iov[0].iov_len = sizeof(mlen); 113 iov[0].iov_len = sizeof(mlen);
113 iov[1].iov_base = buffer_ptr(m); 114 iov[1].iov_base = (u_char *)sshbuf_ptr(m);
114 iov[1].iov_len = buffer_len(m); 115 iov[1].iov_len = sshbuf_len(m);
115 116
116 if (atomiciov6(writev, conn->fd_out, iov, 2, 117 if (atomiciov6(writev, conn->fd_out, iov, 2,
117 conn->limit_kbps > 0 ? sftpio : NULL, &conn->bwlimit_out) != 118 conn->limit_kbps > 0 ? sftpio : NULL, &conn->bwlimit_out) !=
118 buffer_len(m) + sizeof(mlen)) 119 sshbuf_len(m) + sizeof(mlen))
119 fatal("Couldn't send packet: %s", strerror(errno)); 120 fatal("Couldn't send packet: %s", strerror(errno));
120 121
121 buffer_clear(m); 122 sshbuf_reset(m);
122} 123}
123 124
124static void 125static void
125get_msg(struct sftp_conn *conn, Buffer *m) 126get_msg(struct sftp_conn *conn, struct sshbuf *m)
126{ 127{
127 u_int msg_len; 128 u_int msg_len;
129 u_char *p;
130 int r;
128 131
129 buffer_append_space(m, 4); 132 if ((r = sshbuf_reserve(m, 4, &p)) != 0)
130 if (atomicio6(read, conn->fd_in, buffer_ptr(m), 4, 133 fatal("%s: buffer error: %s", __func__, ssh_err(r));
134 if (atomicio6(read, conn->fd_in, p, 4,
131 conn->limit_kbps > 0 ? sftpio : NULL, &conn->bwlimit_in) != 4) { 135 conn->limit_kbps > 0 ? sftpio : NULL, &conn->bwlimit_in) != 4) {
132 if (errno == EPIPE) 136 if (errno == EPIPE)
133 fatal("Connection closed"); 137 fatal("Connection closed");
@@ -135,12 +139,14 @@ get_msg(struct sftp_conn *conn, Buffer *m)
135 fatal("Couldn't read packet: %s", strerror(errno)); 139 fatal("Couldn't read packet: %s", strerror(errno));
136 } 140 }
137 141
138 msg_len = buffer_get_int(m); 142 if ((r = sshbuf_get_u32(m, &msg_len)) != 0)
143 fatal("%s: buffer error: %s", __func__, ssh_err(r));
139 if (msg_len > SFTP_MAX_MSG_LENGTH) 144 if (msg_len > SFTP_MAX_MSG_LENGTH)
140 fatal("Received message too long %u", msg_len); 145 fatal("Received message too long %u", msg_len);
141 146
142 buffer_append_space(m, msg_len); 147 if ((r = sshbuf_reserve(m, msg_len, &p)) != 0)
143 if (atomicio6(read, conn->fd_in, buffer_ptr(m), msg_len, 148 fatal("%s: buffer error: %s", __func__, ssh_err(r));
149 if (atomicio6(read, conn->fd_in, p, msg_len,
144 conn->limit_kbps > 0 ? sftpio : NULL, &conn->bwlimit_in) 150 conn->limit_kbps > 0 ? sftpio : NULL, &conn->bwlimit_in)
145 != msg_len) { 151 != msg_len) {
146 if (errno == EPIPE) 152 if (errno == EPIPE)
@@ -151,46 +157,56 @@ get_msg(struct sftp_conn *conn, Buffer *m)
151} 157}
152 158
153static void 159static void
154send_string_request(struct sftp_conn *conn, u_int id, u_int code, char *s, 160send_string_request(struct sftp_conn *conn, u_int id, u_int code, const char *s,
155 u_int len) 161 u_int len)
156{ 162{
157 Buffer msg; 163 struct sshbuf *msg;
158 164 int r;
159 buffer_init(&msg); 165
160 buffer_put_char(&msg, code); 166 if ((msg = sshbuf_new()) == NULL)
161 buffer_put_int(&msg, id); 167 fatal("%s: sshbuf_new failed", __func__);
162 buffer_put_string(&msg, s, len); 168 if ((r = sshbuf_put_u8(msg, code)) != 0 ||
163 send_msg(conn, &msg); 169 (r = sshbuf_put_u32(msg, id)) != 0 ||
170 (r = sshbuf_put_string(msg, s, len)) != 0)
171 fatal("%s: buffer error: %s", __func__, ssh_err(r));
172 send_msg(conn, msg);
164 debug3("Sent message fd %d T:%u I:%u", conn->fd_out, code, id); 173 debug3("Sent message fd %d T:%u I:%u", conn->fd_out, code, id);
165 buffer_free(&msg); 174 sshbuf_free(msg);
166} 175}
167 176
168static void 177static void
169send_string_attrs_request(struct sftp_conn *conn, u_int id, u_int code, 178send_string_attrs_request(struct sftp_conn *conn, u_int id, u_int code,
170 char *s, u_int len, Attrib *a) 179 const void *s, u_int len, Attrib *a)
171{ 180{
172 Buffer msg; 181 struct sshbuf *msg;
173 182 int r;
174 buffer_init(&msg); 183
175 buffer_put_char(&msg, code); 184 if ((msg = sshbuf_new()) == NULL)
176 buffer_put_int(&msg, id); 185 fatal("%s: sshbuf_new failed", __func__);
177 buffer_put_string(&msg, s, len); 186 if ((r = sshbuf_put_u8(msg, code)) != 0 ||
178 encode_attrib(&msg, a); 187 (r = sshbuf_put_u32(msg, id)) != 0 ||
179 send_msg(conn, &msg); 188 (r = sshbuf_put_string(msg, s, len)) != 0 ||
189 (r = encode_attrib(msg, a)) != 0)
190 fatal("%s: buffer error: %s", __func__, ssh_err(r));
191 send_msg(conn, msg);
180 debug3("Sent message fd %d T:%u I:%u", conn->fd_out, code, id); 192 debug3("Sent message fd %d T:%u I:%u", conn->fd_out, code, id);
181 buffer_free(&msg); 193 sshbuf_free(msg);
182} 194}
183 195
184static u_int 196static u_int
185get_status(struct sftp_conn *conn, u_int expected_id) 197get_status(struct sftp_conn *conn, u_int expected_id)
186{ 198{
187 Buffer msg; 199 struct sshbuf *msg;
188 u_int type, id, status; 200 u_char type;
201 u_int id, status;
202 int r;
189 203
190 buffer_init(&msg); 204 if ((msg = sshbuf_new()) == NULL)
191 get_msg(conn, &msg); 205 fatal("%s: sshbuf_new failed", __func__);
192 type = buffer_get_char(&msg); 206 get_msg(conn, msg);
193 id = buffer_get_int(&msg); 207 if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
208 (r = sshbuf_get_u32(msg, &id)) != 0)
209 fatal("%s: buffer error: %s", __func__, ssh_err(r));
194 210
195 if (id != expected_id) 211 if (id != expected_id)
196 fatal("ID mismatch (%u != %u)", id, expected_id); 212 fatal("ID mismatch (%u != %u)", id, expected_id);
@@ -198,112 +214,136 @@ get_status(struct sftp_conn *conn, u_int expected_id)
198 fatal("Expected SSH2_FXP_STATUS(%u) packet, got %u", 214 fatal("Expected SSH2_FXP_STATUS(%u) packet, got %u",
199 SSH2_FXP_STATUS, type); 215 SSH2_FXP_STATUS, type);
200 216
201 status = buffer_get_int(&msg); 217 if ((r = sshbuf_get_u32(msg, &status)) != 0)
202 buffer_free(&msg); 218 fatal("%s: buffer error: %s", __func__, ssh_err(r));
219 sshbuf_free(msg);
203 220
204 debug3("SSH2_FXP_STATUS %u", status); 221 debug3("SSH2_FXP_STATUS %u", status);
205 222
206 return status; 223 return status;
207} 224}
208 225
209static char * 226static u_char *
210get_handle(struct sftp_conn *conn, u_int expected_id, u_int *len, 227get_handle(struct sftp_conn *conn, u_int expected_id, size_t *len,
211 const char *errfmt, ...) 228 const char *errfmt, ...)
212{ 229{
213 Buffer msg; 230 struct sshbuf *msg;
214 u_int type, id; 231 u_int id, status;
215 char *handle, errmsg[256]; 232 u_char type;
233 u_char *handle;
234 char errmsg[256];
216 va_list args; 235 va_list args;
217 int status; 236 int r;
218 237
219 va_start(args, errfmt); 238 va_start(args, errfmt);
220 if (errfmt != NULL) 239 if (errfmt != NULL)
221 vsnprintf(errmsg, sizeof(errmsg), errfmt, args); 240 vsnprintf(errmsg, sizeof(errmsg), errfmt, args);
222 va_end(args); 241 va_end(args);
223 242
224 buffer_init(&msg); 243 if ((msg = sshbuf_new()) == NULL)
225 get_msg(conn, &msg); 244 fatal("%s: sshbuf_new failed", __func__);
226 type = buffer_get_char(&msg); 245 get_msg(conn, msg);
227 id = buffer_get_int(&msg); 246 if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
247 (r = sshbuf_get_u32(msg, &id)) != 0)
248 fatal("%s: buffer error: %s", __func__, ssh_err(r));
228 249
229 if (id != expected_id) 250 if (id != expected_id)
230 fatal("%s: ID mismatch (%u != %u)", 251 fatal("%s: ID mismatch (%u != %u)",
231 errfmt == NULL ? __func__ : errmsg, id, expected_id); 252 errfmt == NULL ? __func__ : errmsg, id, expected_id);
232 if (type == SSH2_FXP_STATUS) { 253 if (type == SSH2_FXP_STATUS) {
233 status = buffer_get_int(&msg); 254 if ((r = sshbuf_get_u32(msg, &status)) != 0)
255 fatal("%s: buffer error: %s", __func__, ssh_err(r));
234 if (errfmt != NULL) 256 if (errfmt != NULL)
235 error("%s: %s", errmsg, fx2txt(status)); 257 error("%s: %s", errmsg, fx2txt(status));
236 buffer_free(&msg); 258 sshbuf_free(msg);
237 return(NULL); 259 return(NULL);
238 } else if (type != SSH2_FXP_HANDLE) 260 } else if (type != SSH2_FXP_HANDLE)
239 fatal("%s: Expected SSH2_FXP_HANDLE(%u) packet, got %u", 261 fatal("%s: Expected SSH2_FXP_HANDLE(%u) packet, got %u",
240 errfmt == NULL ? __func__ : errmsg, SSH2_FXP_HANDLE, type); 262 errfmt == NULL ? __func__ : errmsg, SSH2_FXP_HANDLE, type);
241 263
242 handle = buffer_get_string(&msg, len); 264 if ((r = sshbuf_get_string(msg, &handle, len)) != 0)
243 buffer_free(&msg); 265 fatal("%s: buffer error: %s", __func__, ssh_err(r));
266 sshbuf_free(msg);
244 267
245 return(handle); 268 return handle;
246} 269}
247 270
248static Attrib * 271static Attrib *
249get_decode_stat(struct sftp_conn *conn, u_int expected_id, int quiet) 272get_decode_stat(struct sftp_conn *conn, u_int expected_id, int quiet)
250{ 273{
251 Buffer msg; 274 struct sshbuf *msg;
252 u_int type, id; 275 u_int id;
253 Attrib *a; 276 u_char type;
277 int r;
278 static Attrib a;
254 279
255 buffer_init(&msg); 280 if ((msg = sshbuf_new()) == NULL)
256 get_msg(conn, &msg); 281 fatal("%s: sshbuf_new failed", __func__);
282 get_msg(conn, msg);
257 283
258 type = buffer_get_char(&msg); 284 if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
259 id = buffer_get_int(&msg); 285 (r = sshbuf_get_u32(msg, &id)) != 0)
286 fatal("%s: buffer error: %s", __func__, ssh_err(r));
260 287
261 debug3("Received stat reply T:%u I:%u", type, id); 288 debug3("Received stat reply T:%u I:%u", type, id);
262 if (id != expected_id) 289 if (id != expected_id)
263 fatal("ID mismatch (%u != %u)", id, expected_id); 290 fatal("ID mismatch (%u != %u)", id, expected_id);
264 if (type == SSH2_FXP_STATUS) { 291 if (type == SSH2_FXP_STATUS) {
265 int status = buffer_get_int(&msg); 292 u_int status;
266 293
294 if ((r = sshbuf_get_u32(msg, &status)) != 0)
295 fatal("%s: buffer error: %s", __func__, ssh_err(r));
267 if (quiet) 296 if (quiet)
268 debug("Couldn't stat remote file: %s", fx2txt(status)); 297 debug("Couldn't stat remote file: %s", fx2txt(status));
269 else 298 else
270 error("Couldn't stat remote file: %s", fx2txt(status)); 299 error("Couldn't stat remote file: %s", fx2txt(status));
271 buffer_free(&msg); 300 sshbuf_free(msg);
272 return(NULL); 301 return(NULL);
273 } else if (type != SSH2_FXP_ATTRS) { 302 } else if (type != SSH2_FXP_ATTRS) {
274 fatal("Expected SSH2_FXP_ATTRS(%u) packet, got %u", 303 fatal("Expected SSH2_FXP_ATTRS(%u) packet, got %u",
275 SSH2_FXP_ATTRS, type); 304 SSH2_FXP_ATTRS, type);
276 } 305 }
277 a = decode_attrib(&msg); 306 if ((r = decode_attrib(msg, &a)) != 0) {
278 buffer_free(&msg); 307 error("%s: couldn't decode attrib: %s", __func__, ssh_err(r));
308 sshbuf_free(msg);
309 return NULL;
310 }
311 sshbuf_free(msg);
279 312
280 return(a); 313 return &a;
281} 314}
282 315
283static int 316static int
284get_decode_statvfs(struct sftp_conn *conn, struct sftp_statvfs *st, 317get_decode_statvfs(struct sftp_conn *conn, struct sftp_statvfs *st,
285 u_int expected_id, int quiet) 318 u_int expected_id, int quiet)
286{ 319{
287 Buffer msg; 320 struct sshbuf *msg;
288 u_int type, id, flag; 321 u_char type;
322 u_int id;
323 u_int64_t flag;
324 int r;
289 325
290 buffer_init(&msg); 326 if ((msg = sshbuf_new()) == NULL)
291 get_msg(conn, &msg); 327 fatal("%s: sshbuf_new failed", __func__);
328 get_msg(conn, msg);
292 329
293 type = buffer_get_char(&msg); 330 if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
294 id = buffer_get_int(&msg); 331 (r = sshbuf_get_u32(msg, &id)) != 0)
332 fatal("%s: buffer error: %s", __func__, ssh_err(r));
295 333
296 debug3("Received statvfs reply T:%u I:%u", type, id); 334 debug3("Received statvfs reply T:%u I:%u", type, id);
297 if (id != expected_id) 335 if (id != expected_id)
298 fatal("ID mismatch (%u != %u)", id, expected_id); 336 fatal("ID mismatch (%u != %u)", id, expected_id);
299 if (type == SSH2_FXP_STATUS) { 337 if (type == SSH2_FXP_STATUS) {
300 int status = buffer_get_int(&msg); 338 u_int status;
301 339
340 if ((r = sshbuf_get_u32(msg, &status)) != 0)
341 fatal("%s: buffer error: %s", __func__, ssh_err(r));
302 if (quiet) 342 if (quiet)
303 debug("Couldn't statvfs: %s", fx2txt(status)); 343 debug("Couldn't statvfs: %s", fx2txt(status));
304 else 344 else
305 error("Couldn't statvfs: %s", fx2txt(status)); 345 error("Couldn't statvfs: %s", fx2txt(status));
306 buffer_free(&msg); 346 sshbuf_free(msg);
307 return -1; 347 return -1;
308 } else if (type != SSH2_FXP_EXTENDED_REPLY) { 348 } else if (type != SSH2_FXP_EXTENDED_REPLY) {
309 fatal("Expected SSH2_FXP_EXTENDED_REPLY(%u) packet, got %u", 349 fatal("Expected SSH2_FXP_EXTENDED_REPLY(%u) packet, got %u",
@@ -311,22 +351,23 @@ get_decode_statvfs(struct sftp_conn *conn, struct sftp_statvfs *st,
311 } 351 }
312 352
313 memset(st, 0, sizeof(*st)); 353 memset(st, 0, sizeof(*st));
314 st->f_bsize = buffer_get_int64(&msg); 354 if ((r = sshbuf_get_u64(msg, &st->f_bsize)) != 0 ||
315 st->f_frsize = buffer_get_int64(&msg); 355 (r = sshbuf_get_u64(msg, &st->f_frsize)) != 0 ||
316 st->f_blocks = buffer_get_int64(&msg); 356 (r = sshbuf_get_u64(msg, &st->f_blocks)) != 0 ||
317 st->f_bfree = buffer_get_int64(&msg); 357 (r = sshbuf_get_u64(msg, &st->f_bfree)) != 0 ||
318 st->f_bavail = buffer_get_int64(&msg); 358 (r = sshbuf_get_u64(msg, &st->f_bavail)) != 0 ||
319 st->f_files = buffer_get_int64(&msg); 359 (r = sshbuf_get_u64(msg, &st->f_files)) != 0 ||
320 st->f_ffree = buffer_get_int64(&msg); 360 (r = sshbuf_get_u64(msg, &st->f_ffree)) != 0 ||
321 st->f_favail = buffer_get_int64(&msg); 361 (r = sshbuf_get_u64(msg, &st->f_favail)) != 0 ||
322 st->f_fsid = buffer_get_int64(&msg); 362 (r = sshbuf_get_u64(msg, &st->f_fsid)) != 0 ||
323 flag = buffer_get_int64(&msg); 363 (r = sshbuf_get_u64(msg, &flag)) != 0 ||
324 st->f_namemax = buffer_get_int64(&msg); 364 (r = sshbuf_get_u64(msg, &st->f_namemax)) != 0)
365 fatal("%s: buffer error: %s", __func__, ssh_err(r));
325 366
326 st->f_flag = (flag & SSH2_FXE_STATVFS_ST_RDONLY) ? ST_RDONLY : 0; 367 st->f_flag = (flag & SSH2_FXE_STATVFS_ST_RDONLY) ? ST_RDONLY : 0;
327 st->f_flag |= (flag & SSH2_FXE_STATVFS_ST_NOSUID) ? ST_NOSUID : 0; 368 st->f_flag |= (flag & SSH2_FXE_STATVFS_ST_NOSUID) ? ST_NOSUID : 0;
328 369
329 buffer_free(&msg); 370 sshbuf_free(msg);
330 371
331 return 0; 372 return 0;
332} 373}
@@ -335,9 +376,10 @@ struct sftp_conn *
335do_init(int fd_in, int fd_out, u_int transfer_buflen, u_int num_requests, 376do_init(int fd_in, int fd_out, u_int transfer_buflen, u_int num_requests,
336 u_int64_t limit_kbps) 377 u_int64_t limit_kbps)
337{ 378{
338 u_int type; 379 u_char type;
339 Buffer msg; 380 struct sshbuf *msg;
340 struct sftp_conn *ret; 381 struct sftp_conn *ret;
382 int r;
341 383
342 ret = xcalloc(1, sizeof(*ret)); 384 ret = xcalloc(1, sizeof(*ret));
343 ret->msg_id = 1; 385 ret->msg_id = 1;
@@ -348,52 +390,61 @@ do_init(int fd_in, int fd_out, u_int transfer_buflen, u_int num_requests,
348 ret->exts = 0; 390 ret->exts = 0;
349 ret->limit_kbps = 0; 391 ret->limit_kbps = 0;
350 392
351 buffer_init(&msg); 393 if ((msg = sshbuf_new()) == NULL)
352 buffer_put_char(&msg, SSH2_FXP_INIT); 394 fatal("%s: sshbuf_new failed", __func__);
353 buffer_put_int(&msg, SSH2_FILEXFER_VERSION); 395 if ((r = sshbuf_put_u8(msg, SSH2_FXP_INIT)) != 0 ||
354 send_msg(ret, &msg); 396 (r = sshbuf_put_u32(msg, SSH2_FILEXFER_VERSION)) != 0)
397 fatal("%s: buffer error: %s", __func__, ssh_err(r));
398 send_msg(ret, msg);
355 399
356 buffer_clear(&msg); 400 sshbuf_reset(msg);
357 401
358 get_msg(ret, &msg); 402 get_msg(ret, msg);
359 403
360 /* Expecting a VERSION reply */ 404 /* Expecting a VERSION reply */
361 if ((type = buffer_get_char(&msg)) != SSH2_FXP_VERSION) { 405 if ((r = sshbuf_get_u8(msg, &type)) != 0)
406 fatal("%s: buffer error: %s", __func__, ssh_err(r));
407 if (type != SSH2_FXP_VERSION) {
362 error("Invalid packet back from SSH2_FXP_INIT (type %u)", 408 error("Invalid packet back from SSH2_FXP_INIT (type %u)",
363 type); 409 type);
364 buffer_free(&msg); 410 sshbuf_free(msg);
365 return(NULL); 411 return(NULL);
366 } 412 }
367 ret->version = buffer_get_int(&msg); 413 if ((r = sshbuf_get_u32(msg, &ret->version)) != 0)
414 fatal("%s: buffer error: %s", __func__, ssh_err(r));
368 415
369 debug2("Remote version: %u", ret->version); 416 debug2("Remote version: %u", ret->version);
370 417
371 /* Check for extensions */ 418 /* Check for extensions */
372 while (buffer_len(&msg) > 0) { 419 while (sshbuf_len(msg) > 0) {
373 char *name = buffer_get_string(&msg, NULL); 420 char *name;
374 char *value = buffer_get_string(&msg, NULL); 421 u_char *value;
422 size_t vlen;
375 int known = 0; 423 int known = 0;
376 424
425 if ((r = sshbuf_get_cstring(msg, &name, NULL)) != 0 ||
426 (r = sshbuf_get_string(msg, &value, &vlen)) != 0)
427 fatal("%s: buffer error: %s", __func__, ssh_err(r));
377 if (strcmp(name, "posix-rename@openssh.com") == 0 && 428 if (strcmp(name, "posix-rename@openssh.com") == 0 &&
378 strcmp(value, "1") == 0) { 429 strcmp((char *)value, "1") == 0) {
379 ret->exts |= SFTP_EXT_POSIX_RENAME; 430 ret->exts |= SFTP_EXT_POSIX_RENAME;
380 known = 1; 431 known = 1;
381 } else if (strcmp(name, "statvfs@openssh.com") == 0 && 432 } else if (strcmp(name, "statvfs@openssh.com") == 0 &&
382 strcmp(value, "2") == 0) { 433 strcmp((char *)value, "2") == 0) {
383 ret->exts |= SFTP_EXT_STATVFS; 434 ret->exts |= SFTP_EXT_STATVFS;
384 known = 1; 435 known = 1;
385 } else if (strcmp(name, "fstatvfs@openssh.com") == 0 && 436 } else if (strcmp(name, "fstatvfs@openssh.com") == 0 &&
386 strcmp(value, "2") == 0) { 437 strcmp((char *)value, "2") == 0) {
387 ret->exts |= SFTP_EXT_FSTATVFS; 438 ret->exts |= SFTP_EXT_FSTATVFS;
388 known = 1; 439 known = 1;
389 } else if (strcmp(name, "hardlink@openssh.com") == 0 && 440 } else if (strcmp(name, "hardlink@openssh.com") == 0 &&
390 strcmp(value, "1") == 0) { 441 strcmp((char *)value, "1") == 0) {
391 ret->exts |= SFTP_EXT_HARDLINK; 442 ret->exts |= SFTP_EXT_HARDLINK;
392 known = 1; 443 known = 1;
393 } else if (strcmp(name, "fsync@openssh.com") == 0 && 444 } else if (strcmp(name, "fsync@openssh.com") == 0 &&
394 strcmp(value, "1") == 0) { 445 strcmp((char *)value, "1") == 0) {
395 ret->exts |= SFTP_EXT_FSYNC; 446 ret->exts |= SFTP_EXT_FSYNC;
396 known = 1; 447 known = 1;
397 } 448 }
398 if (known) { 449 if (known) {
399 debug2("Server supports extension \"%s\" revision %s", 450 debug2("Server supports extension \"%s\" revision %s",
@@ -405,7 +456,7 @@ do_init(int fd_in, int fd_out, u_int transfer_buflen, u_int num_requests,
405 free(value); 456 free(value);
406 } 457 }
407 458
408 buffer_free(&msg); 459 sshbuf_free(msg);
409 460
410 /* Some filexfer v.0 servers don't support large packets */ 461 /* Some filexfer v.0 servers don't support large packets */
411 if (ret->version == 0) 462 if (ret->version == 0)
@@ -429,54 +480,62 @@ sftp_proto_version(struct sftp_conn *conn)
429} 480}
430 481
431int 482int
432do_close(struct sftp_conn *conn, char *handle, u_int handle_len) 483do_close(struct sftp_conn *conn, const u_char *handle, u_int handle_len)
433{ 484{
434 u_int id, status; 485 u_int id, status;
435 Buffer msg; 486 struct sshbuf *msg;
487 int r;
436 488
437 buffer_init(&msg); 489 if ((msg = sshbuf_new()) == NULL)
490 fatal("%s: sshbuf_new failed", __func__);
438 491
439 id = conn->msg_id++; 492 id = conn->msg_id++;
440 buffer_put_char(&msg, SSH2_FXP_CLOSE); 493 if ((r = sshbuf_put_u8(msg, SSH2_FXP_CLOSE)) != 0 ||
441 buffer_put_int(&msg, id); 494 (r = sshbuf_put_u32(msg, id)) != 0 ||
442 buffer_put_string(&msg, handle, handle_len); 495 (r = sshbuf_put_string(msg, handle, handle_len)) != 0)
443 send_msg(conn, &msg); 496 fatal("%s: buffer error: %s", __func__, ssh_err(r));
497 send_msg(conn, msg);
444 debug3("Sent message SSH2_FXP_CLOSE I:%u", id); 498 debug3("Sent message SSH2_FXP_CLOSE I:%u", id);
445 499
446 status = get_status(conn, id); 500 status = get_status(conn, id);
447 if (status != SSH2_FX_OK) 501 if (status != SSH2_FX_OK)
448 error("Couldn't close file: %s", fx2txt(status)); 502 error("Couldn't close file: %s", fx2txt(status));
449 503
450 buffer_free(&msg); 504 sshbuf_free(msg);
451 505
452 return status; 506 return status == SSH2_FX_OK ? 0 : -1;
453} 507}
454 508
455 509
456static int 510static int
457do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag, 511do_lsreaddir(struct sftp_conn *conn, const char *path, int print_flag,
458 SFTP_DIRENT ***dir) 512 SFTP_DIRENT ***dir)
459{ 513{
460 Buffer msg; 514 struct sshbuf *msg;
461 u_int count, type, id, handle_len, i, expected_id, ents = 0; 515 u_int count, id, i, expected_id, ents = 0;
516 size_t handle_len;
517 u_char type;
462 char *handle; 518 char *handle;
463 int status = SSH2_FX_FAILURE; 519 int status = SSH2_FX_FAILURE;
520 int r;
464 521
465 if (dir) 522 if (dir)
466 *dir = NULL; 523 *dir = NULL;
467 524
468 id = conn->msg_id++; 525 id = conn->msg_id++;
469 526
470 buffer_init(&msg); 527 if ((msg = sshbuf_new()) == NULL)
471 buffer_put_char(&msg, SSH2_FXP_OPENDIR); 528 fatal("%s: sshbuf_new failed", __func__);
472 buffer_put_int(&msg, id); 529 if ((r = sshbuf_put_u8(msg, SSH2_FXP_OPENDIR)) != 0 ||
473 buffer_put_cstring(&msg, path); 530 (r = sshbuf_put_u32(msg, id)) != 0 ||
474 send_msg(conn, &msg); 531 (r = sshbuf_put_cstring(msg, path)) != 0)
532 fatal("%s: buffer error: %s", __func__, ssh_err(r));
533 send_msg(conn, msg);
475 534
476 handle = get_handle(conn, id, &handle_len, 535 handle = get_handle(conn, id, &handle_len,
477 "remote readdir(\"%s\")", path); 536 "remote readdir(\"%s\")", path);
478 if (handle == NULL) { 537 if (handle == NULL) {
479 buffer_free(&msg); 538 sshbuf_free(msg);
480 return -1; 539 return -1;
481 } 540 }
482 541
@@ -491,18 +550,20 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
491 550
492 debug3("Sending SSH2_FXP_READDIR I:%u", id); 551 debug3("Sending SSH2_FXP_READDIR I:%u", id);
493 552
494 buffer_clear(&msg); 553 sshbuf_reset(msg);
495 buffer_put_char(&msg, SSH2_FXP_READDIR); 554 if ((r = sshbuf_put_u8(msg, SSH2_FXP_READDIR)) != 0 ||
496 buffer_put_int(&msg, id); 555 (r = sshbuf_put_u32(msg, id)) != 0 ||
497 buffer_put_string(&msg, handle, handle_len); 556 (r = sshbuf_put_string(msg, handle, handle_len)) != 0)
498 send_msg(conn, &msg); 557 fatal("%s: buffer error: %s", __func__, ssh_err(r));
558 send_msg(conn, msg);
499 559
500 buffer_clear(&msg); 560 sshbuf_reset(msg);
501 561
502 get_msg(conn, &msg); 562 get_msg(conn, msg);
503 563
504 type = buffer_get_char(&msg); 564 if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
505 id = buffer_get_int(&msg); 565 (r = sshbuf_get_u32(msg, &id)) != 0)
566 fatal("%s: buffer error: %s", __func__, ssh_err(r));
506 567
507 debug3("Received reply T:%u I:%u", type, id); 568 debug3("Received reply T:%u I:%u", type, id);
508 569
@@ -510,27 +571,43 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
510 fatal("ID mismatch (%u != %u)", id, expected_id); 571 fatal("ID mismatch (%u != %u)", id, expected_id);
511 572
512 if (type == SSH2_FXP_STATUS) { 573 if (type == SSH2_FXP_STATUS) {
513 status = buffer_get_int(&msg); 574 u_int rstatus;
514 debug3("Received SSH2_FXP_STATUS %d", status); 575
515 if (status == SSH2_FX_EOF) 576 if ((r = sshbuf_get_u32(msg, &rstatus)) != 0)
577 fatal("%s: buffer error: %s",
578 __func__, ssh_err(r));
579 debug3("Received SSH2_FXP_STATUS %d", rstatus);
580 if (rstatus == SSH2_FX_EOF)
516 break; 581 break;
517 error("Couldn't read directory: %s", fx2txt(status)); 582 error("Couldn't read directory: %s", fx2txt(rstatus));
518 goto out; 583 goto out;
519 } else if (type != SSH2_FXP_NAME) 584 } else if (type != SSH2_FXP_NAME)
520 fatal("Expected SSH2_FXP_NAME(%u) packet, got %u", 585 fatal("Expected SSH2_FXP_NAME(%u) packet, got %u",
521 SSH2_FXP_NAME, type); 586 SSH2_FXP_NAME, type);
522 587
523 count = buffer_get_int(&msg); 588 if ((r = sshbuf_get_u32(msg, &count)) != 0)
589 fatal("%s: buffer error: %s", __func__, ssh_err(r));
524 if (count == 0) 590 if (count == 0)
525 break; 591 break;
526 debug3("Received %d SSH2_FXP_NAME responses", count); 592 debug3("Received %d SSH2_FXP_NAME responses", count);
527 for (i = 0; i < count; i++) { 593 for (i = 0; i < count; i++) {
528 char *filename, *longname; 594 char *filename, *longname;
529 Attrib *a; 595 Attrib a;
530 596
531 filename = buffer_get_string(&msg, NULL); 597 if ((r = sshbuf_get_cstring(msg, &filename,
532 longname = buffer_get_string(&msg, NULL); 598 NULL)) != 0 ||
533 a = decode_attrib(&msg); 599 (r = sshbuf_get_cstring(msg, &longname,
600 NULL)) != 0)
601 fatal("%s: buffer error: %s",
602 __func__, ssh_err(r));
603 if ((r = decode_attrib(msg, &a)) != 0) {
604 error("%s: couldn't decode attrib: %s",
605 __func__, ssh_err(r));
606 free(filename);
607 free(longname);
608 sshbuf_free(msg);
609 return -1;
610 }
534 611
535 if (print_flag) 612 if (print_flag)
536 printf("%s\n", longname); 613 printf("%s\n", longname);
@@ -548,7 +625,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
548 (*dir)[ents] = xcalloc(1, sizeof(***dir)); 625 (*dir)[ents] = xcalloc(1, sizeof(***dir));
549 (*dir)[ents]->filename = xstrdup(filename); 626 (*dir)[ents]->filename = xstrdup(filename);
550 (*dir)[ents]->longname = xstrdup(longname); 627 (*dir)[ents]->longname = xstrdup(longname);
551 memcpy(&(*dir)[ents]->a, a, sizeof(*a)); 628 memcpy(&(*dir)[ents]->a, &a, sizeof(a));
552 (*dir)[++ents] = NULL; 629 (*dir)[++ents] = NULL;
553 } 630 }
554 free(filename); 631 free(filename);
@@ -558,7 +635,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
558 status = 0; 635 status = 0;
559 636
560 out: 637 out:
561 buffer_free(&msg); 638 sshbuf_free(msg);
562 do_close(conn, handle, handle_len); 639 do_close(conn, handle, handle_len);
563 free(handle); 640 free(handle);
564 641
@@ -577,7 +654,7 @@ do_lsreaddir(struct sftp_conn *conn, char *path, int print_flag,
577} 654}
578 655
579int 656int
580do_readdir(struct sftp_conn *conn, char *path, SFTP_DIRENT ***dir) 657do_readdir(struct sftp_conn *conn, const char *path, SFTP_DIRENT ***dir)
581{ 658{
582 return(do_lsreaddir(conn, path, 0, dir)); 659 return(do_lsreaddir(conn, path, 0, dir));
583} 660}
@@ -597,7 +674,7 @@ void free_sftp_dirents(SFTP_DIRENT **s)
597} 674}
598 675
599int 676int
600do_rm(struct sftp_conn *conn, char *path) 677do_rm(struct sftp_conn *conn, const char *path)
601{ 678{
602 u_int status, id; 679 u_int status, id;
603 680
@@ -608,11 +685,11 @@ do_rm(struct sftp_conn *conn, char *path)
608 status = get_status(conn, id); 685 status = get_status(conn, id);
609 if (status != SSH2_FX_OK) 686 if (status != SSH2_FX_OK)
610 error("Couldn't delete file: %s", fx2txt(status)); 687 error("Couldn't delete file: %s", fx2txt(status));
611 return(status); 688 return status == SSH2_FX_OK ? 0 : -1;
612} 689}
613 690
614int 691int
615do_mkdir(struct sftp_conn *conn, char *path, Attrib *a, int print_flag) 692do_mkdir(struct sftp_conn *conn, const char *path, Attrib *a, int print_flag)
616{ 693{
617 u_int status, id; 694 u_int status, id;
618 695
@@ -624,11 +701,11 @@ do_mkdir(struct sftp_conn *conn, char *path, Attrib *a, int print_flag)
624 if (status != SSH2_FX_OK && print_flag) 701 if (status != SSH2_FX_OK && print_flag)
625 error("Couldn't create directory: %s", fx2txt(status)); 702 error("Couldn't create directory: %s", fx2txt(status));
626 703
627 return(status); 704 return status == SSH2_FX_OK ? 0 : -1;
628} 705}
629 706
630int 707int
631do_rmdir(struct sftp_conn *conn, char *path) 708do_rmdir(struct sftp_conn *conn, const char *path)
632{ 709{
633 u_int status, id; 710 u_int status, id;
634 711
@@ -640,11 +717,11 @@ do_rmdir(struct sftp_conn *conn, char *path)
640 if (status != SSH2_FX_OK) 717 if (status != SSH2_FX_OK)
641 error("Couldn't remove directory: %s", fx2txt(status)); 718 error("Couldn't remove directory: %s", fx2txt(status));
642 719
643 return(status); 720 return status == SSH2_FX_OK ? 0 : -1;
644} 721}
645 722
646Attrib * 723Attrib *
647do_stat(struct sftp_conn *conn, char *path, int quiet) 724do_stat(struct sftp_conn *conn, const char *path, int quiet)
648{ 725{
649 u_int id; 726 u_int id;
650 727
@@ -658,7 +735,7 @@ do_stat(struct sftp_conn *conn, char *path, int quiet)
658} 735}
659 736
660Attrib * 737Attrib *
661do_lstat(struct sftp_conn *conn, char *path, int quiet) 738do_lstat(struct sftp_conn *conn, const char *path, int quiet)
662{ 739{
663 u_int id; 740 u_int id;
664 741
@@ -679,7 +756,8 @@ do_lstat(struct sftp_conn *conn, char *path, int quiet)
679 756
680#ifdef notyet 757#ifdef notyet
681Attrib * 758Attrib *
682do_fstat(struct sftp_conn *conn, char *handle, u_int handle_len, int quiet) 759do_fstat(struct sftp_conn *conn, const u_char *handle, u_int handle_len,
760 int quiet)
683{ 761{
684 u_int id; 762 u_int id;
685 763
@@ -692,7 +770,7 @@ do_fstat(struct sftp_conn *conn, char *handle, u_int handle_len, int quiet)
692#endif 770#endif
693 771
694int 772int
695do_setstat(struct sftp_conn *conn, char *path, Attrib *a) 773do_setstat(struct sftp_conn *conn, const char *path, Attrib *a)
696{ 774{
697 u_int status, id; 775 u_int status, id;
698 776
@@ -705,11 +783,11 @@ do_setstat(struct sftp_conn *conn, char *path, Attrib *a)
705 error("Couldn't setstat on \"%s\": %s", path, 783 error("Couldn't setstat on \"%s\": %s", path,
706 fx2txt(status)); 784 fx2txt(status));
707 785
708 return(status); 786 return status == SSH2_FX_OK ? 0 : -1;
709} 787}
710 788
711int 789int
712do_fsetstat(struct sftp_conn *conn, char *handle, u_int handle_len, 790do_fsetstat(struct sftp_conn *conn, const u_char *handle, u_int handle_len,
713 Attrib *a) 791 Attrib *a)
714{ 792{
715 u_int status, id; 793 u_int status, id;
@@ -722,181 +800,201 @@ do_fsetstat(struct sftp_conn *conn, char *handle, u_int handle_len,
722 if (status != SSH2_FX_OK) 800 if (status != SSH2_FX_OK)
723 error("Couldn't fsetstat: %s", fx2txt(status)); 801 error("Couldn't fsetstat: %s", fx2txt(status));
724 802
725 return(status); 803 return status == SSH2_FX_OK ? 0 : -1;
726} 804}
727 805
728char * 806char *
729do_realpath(struct sftp_conn *conn, char *path) 807do_realpath(struct sftp_conn *conn, const char *path)
730{ 808{
731 Buffer msg; 809 struct sshbuf *msg;
732 u_int type, expected_id, count, id; 810 u_int expected_id, count, id;
733 char *filename, *longname; 811 char *filename, *longname;
734 Attrib *a; 812 Attrib a;
813 u_char type;
814 int r;
735 815
736 expected_id = id = conn->msg_id++; 816 expected_id = id = conn->msg_id++;
737 send_string_request(conn, id, SSH2_FXP_REALPATH, path, 817 send_string_request(conn, id, SSH2_FXP_REALPATH, path,
738 strlen(path)); 818 strlen(path));
739 819
740 buffer_init(&msg); 820 if ((msg = sshbuf_new()) == NULL)
821 fatal("%s: sshbuf_new failed", __func__);
741 822
742 get_msg(conn, &msg); 823 get_msg(conn, msg);
743 type = buffer_get_char(&msg); 824 if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
744 id = buffer_get_int(&msg); 825 (r = sshbuf_get_u32(msg, &id)) != 0)
826 fatal("%s: buffer error: %s", __func__, ssh_err(r));
745 827
746 if (id != expected_id) 828 if (id != expected_id)
747 fatal("ID mismatch (%u != %u)", id, expected_id); 829 fatal("ID mismatch (%u != %u)", id, expected_id);
748 830
749 if (type == SSH2_FXP_STATUS) { 831 if (type == SSH2_FXP_STATUS) {
750 u_int status = buffer_get_int(&msg); 832 u_int status;
751 833
834 if ((r = sshbuf_get_u32(msg, &status)) != 0)
835 fatal("%s: buffer error: %s", __func__, ssh_err(r));
752 error("Couldn't canonicalize: %s", fx2txt(status)); 836 error("Couldn't canonicalize: %s", fx2txt(status));
753 buffer_free(&msg); 837 sshbuf_free(msg);
754 return NULL; 838 return NULL;
755 } else if (type != SSH2_FXP_NAME) 839 } else if (type != SSH2_FXP_NAME)
756 fatal("Expected SSH2_FXP_NAME(%u) packet, got %u", 840 fatal("Expected SSH2_FXP_NAME(%u) packet, got %u",
757 SSH2_FXP_NAME, type); 841 SSH2_FXP_NAME, type);
758 842
759 count = buffer_get_int(&msg); 843 if ((r = sshbuf_get_u32(msg, &count)) != 0)
844 fatal("%s: buffer error: %s", __func__, ssh_err(r));
760 if (count != 1) 845 if (count != 1)
761 fatal("Got multiple names (%d) from SSH_FXP_REALPATH", count); 846 fatal("Got multiple names (%d) from SSH_FXP_REALPATH", count);
762 847
763 filename = buffer_get_string(&msg, NULL); 848 if ((r = sshbuf_get_cstring(msg, &filename, NULL)) != 0 ||
764 longname = buffer_get_string(&msg, NULL); 849 (r = sshbuf_get_cstring(msg, &longname, NULL)) != 0 ||
765 a = decode_attrib(&msg); 850 (r = decode_attrib(msg, &a)) != 0)
851 fatal("%s: buffer error: %s", __func__, ssh_err(r));
766 852
767 debug3("SSH_FXP_REALPATH %s -> %s size %lu", path, filename, 853 debug3("SSH_FXP_REALPATH %s -> %s size %lu", path, filename,
768 (unsigned long)a->size); 854 (unsigned long)a.size);
769 855
770 free(longname); 856 free(longname);
771 857
772 buffer_free(&msg); 858 sshbuf_free(msg);
773 859
774 return(filename); 860 return(filename);
775} 861}
776 862
777int 863int
778do_rename(struct sftp_conn *conn, char *oldpath, char *newpath, 864do_rename(struct sftp_conn *conn, const char *oldpath, const char *newpath,
779 int force_legacy) 865 int force_legacy)
780{ 866{
781 Buffer msg; 867 struct sshbuf *msg;
782 u_int status, id; 868 u_int status, id;
783 int use_ext = (conn->exts & SFTP_EXT_POSIX_RENAME) && !force_legacy; 869 int r, use_ext = (conn->exts & SFTP_EXT_POSIX_RENAME) && !force_legacy;
784 870
785 buffer_init(&msg); 871 if ((msg = sshbuf_new()) == NULL)
872 fatal("%s: sshbuf_new failed", __func__);
786 873
787 /* Send rename request */ 874 /* Send rename request */
788 id = conn->msg_id++; 875 id = conn->msg_id++;
789 if (use_ext) { 876 if (use_ext) {
790 buffer_put_char(&msg, SSH2_FXP_EXTENDED); 877 if ((r = sshbuf_put_u8(msg, SSH2_FXP_EXTENDED)) != 0 ||
791 buffer_put_int(&msg, id); 878 (r = sshbuf_put_u32(msg, id)) != 0 ||
792 buffer_put_cstring(&msg, "posix-rename@openssh.com"); 879 (r = sshbuf_put_cstring(msg,
880 "posix-rename@openssh.com")) != 0)
881 fatal("%s: buffer error: %s", __func__, ssh_err(r));
793 } else { 882 } else {
794 buffer_put_char(&msg, SSH2_FXP_RENAME); 883 if ((r = sshbuf_put_u8(msg, SSH2_FXP_RENAME)) != 0 ||
795 buffer_put_int(&msg, id); 884 (r = sshbuf_put_u32(msg, id)) != 0)
885 fatal("%s: buffer error: %s", __func__, ssh_err(r));
796 } 886 }
797 buffer_put_cstring(&msg, oldpath); 887 if ((r = sshbuf_put_cstring(msg, oldpath)) != 0 ||
798 buffer_put_cstring(&msg, newpath); 888 (r = sshbuf_put_cstring(msg, newpath)) != 0)
799 send_msg(conn, &msg); 889 fatal("%s: buffer error: %s", __func__, ssh_err(r));
890 send_msg(conn, msg);
800 debug3("Sent message %s \"%s\" -> \"%s\"", 891 debug3("Sent message %s \"%s\" -> \"%s\"",
801 use_ext ? "posix-rename@openssh.com" : "SSH2_FXP_RENAME", 892 use_ext ? "posix-rename@openssh.com" :
802 oldpath, newpath); 893 "SSH2_FXP_RENAME", oldpath, newpath);
803 buffer_free(&msg); 894 sshbuf_free(msg);
804 895
805 status = get_status(conn, id); 896 status = get_status(conn, id);
806 if (status != SSH2_FX_OK) 897 if (status != SSH2_FX_OK)
807 error("Couldn't rename file \"%s\" to \"%s\": %s", oldpath, 898 error("Couldn't rename file \"%s\" to \"%s\": %s", oldpath,
808 newpath, fx2txt(status)); 899 newpath, fx2txt(status));
809 900
810 return(status); 901 return status == SSH2_FX_OK ? 0 : -1;
811} 902}
812 903
813int 904int
814do_hardlink(struct sftp_conn *conn, char *oldpath, char *newpath) 905do_hardlink(struct sftp_conn *conn, const char *oldpath, const char *newpath)
815{ 906{
816 Buffer msg; 907 struct sshbuf *msg;
817 u_int status, id; 908 u_int status, id;
909 int r;
818 910
819 if ((conn->exts & SFTP_EXT_HARDLINK) == 0) { 911 if ((conn->exts & SFTP_EXT_HARDLINK) == 0) {
820 error("Server does not support hardlink@openssh.com extension"); 912 error("Server does not support hardlink@openssh.com extension");
821 return -1; 913 return -1;
822 } 914 }
823 915
824 buffer_init(&msg); 916 if ((msg = sshbuf_new()) == NULL)
917 fatal("%s: sshbuf_new failed", __func__);
825 918
826 /* Send link request */ 919 /* Send link request */
827 id = conn->msg_id++; 920 id = conn->msg_id++;
828 buffer_put_char(&msg, SSH2_FXP_EXTENDED); 921 if ((r = sshbuf_put_u8(msg, SSH2_FXP_EXTENDED)) != 0 ||
829 buffer_put_int(&msg, id); 922 (r = sshbuf_put_u32(msg, id)) != 0 ||
830 buffer_put_cstring(&msg, "hardlink@openssh.com"); 923 (r = sshbuf_put_cstring(msg, "hardlink@openssh.com")) != 0 ||
831 buffer_put_cstring(&msg, oldpath); 924 (r = sshbuf_put_cstring(msg, oldpath)) != 0 ||
832 buffer_put_cstring(&msg, newpath); 925 (r = sshbuf_put_cstring(msg, newpath)) != 0)
833 send_msg(conn, &msg); 926 fatal("%s: buffer error: %s", __func__, ssh_err(r));
927 send_msg(conn, msg);
834 debug3("Sent message hardlink@openssh.com \"%s\" -> \"%s\"", 928 debug3("Sent message hardlink@openssh.com \"%s\" -> \"%s\"",
835 oldpath, newpath); 929 oldpath, newpath);
836 buffer_free(&msg); 930 sshbuf_free(msg);
837 931
838 status = get_status(conn, id); 932 status = get_status(conn, id);
839 if (status != SSH2_FX_OK) 933 if (status != SSH2_FX_OK)
840 error("Couldn't link file \"%s\" to \"%s\": %s", oldpath, 934 error("Couldn't link file \"%s\" to \"%s\": %s", oldpath,
841 newpath, fx2txt(status)); 935 newpath, fx2txt(status));
842 936
843 return(status); 937 return status == SSH2_FX_OK ? 0 : -1;
844} 938}
845 939
846int 940int
847do_symlink(struct sftp_conn *conn, char *oldpath, char *newpath) 941do_symlink(struct sftp_conn *conn, const char *oldpath, const char *newpath)
848{ 942{
849 Buffer msg; 943 struct sshbuf *msg;
850 u_int status, id; 944 u_int status, id;
945 int r;
851 946
852 if (conn->version < 3) { 947 if (conn->version < 3) {
853 error("This server does not support the symlink operation"); 948 error("This server does not support the symlink operation");
854 return(SSH2_FX_OP_UNSUPPORTED); 949 return(SSH2_FX_OP_UNSUPPORTED);
855 } 950 }
856 951
857 buffer_init(&msg); 952 if ((msg = sshbuf_new()) == NULL)
953 fatal("%s: sshbuf_new failed", __func__);
858 954
859 /* Send symlink request */ 955 /* Send symlink request */
860 id = conn->msg_id++; 956 id = conn->msg_id++;
861 buffer_put_char(&msg, SSH2_FXP_SYMLINK); 957 if ((r = sshbuf_put_u8(msg, SSH2_FXP_SYMLINK)) != 0 ||
862 buffer_put_int(&msg, id); 958 (r = sshbuf_put_u32(msg, id)) != 0 ||
863 buffer_put_cstring(&msg, oldpath); 959 (r = sshbuf_put_cstring(msg, oldpath)) != 0 ||
864 buffer_put_cstring(&msg, newpath); 960 (r = sshbuf_put_cstring(msg, newpath)) != 0)
865 send_msg(conn, &msg); 961 fatal("%s: buffer error: %s", __func__, ssh_err(r));
962 send_msg(conn, msg);
866 debug3("Sent message SSH2_FXP_SYMLINK \"%s\" -> \"%s\"", oldpath, 963 debug3("Sent message SSH2_FXP_SYMLINK \"%s\" -> \"%s\"", oldpath,
867 newpath); 964 newpath);
868 buffer_free(&msg); 965 sshbuf_free(msg);
869 966
870 status = get_status(conn, id); 967 status = get_status(conn, id);
871 if (status != SSH2_FX_OK) 968 if (status != SSH2_FX_OK)
872 error("Couldn't symlink file \"%s\" to \"%s\": %s", oldpath, 969 error("Couldn't symlink file \"%s\" to \"%s\": %s", oldpath,
873 newpath, fx2txt(status)); 970 newpath, fx2txt(status));
874 971
875 return(status); 972 return status == SSH2_FX_OK ? 0 : -1;
876} 973}
877 974
878int 975int
879do_fsync(struct sftp_conn *conn, char *handle, u_int handle_len) 976do_fsync(struct sftp_conn *conn, u_char *handle, u_int handle_len)
880{ 977{
881 Buffer msg; 978 struct sshbuf *msg;
882 u_int status, id; 979 u_int status, id;
980 int r;
883 981
884 /* Silently return if the extension is not supported */ 982 /* Silently return if the extension is not supported */
885 if ((conn->exts & SFTP_EXT_FSYNC) == 0) 983 if ((conn->exts & SFTP_EXT_FSYNC) == 0)
886 return -1; 984 return -1;
887 985
888 buffer_init(&msg);
889
890 /* Send fsync request */ 986 /* Send fsync request */
987 if ((msg = sshbuf_new()) == NULL)
988 fatal("%s: sshbuf_new failed", __func__);
891 id = conn->msg_id++; 989 id = conn->msg_id++;
892 990 if ((r = sshbuf_put_u8(msg, SSH2_FXP_EXTENDED)) != 0 ||
893 buffer_put_char(&msg, SSH2_FXP_EXTENDED); 991 (r = sshbuf_put_u32(msg, id)) != 0 ||
894 buffer_put_int(&msg, id); 992 (r = sshbuf_put_cstring(msg, "fsync@openssh.com")) != 0 ||
895 buffer_put_cstring(&msg, "fsync@openssh.com"); 993 (r = sshbuf_put_string(msg, handle, handle_len)) != 0)
896 buffer_put_string(&msg, handle, handle_len); 994 fatal("%s: buffer error: %s", __func__, ssh_err(r));
897 send_msg(conn, &msg); 995 send_msg(conn, msg);
898 debug3("Sent message fsync@openssh.com I:%u", id); 996 debug3("Sent message fsync@openssh.com I:%u", id);
899 buffer_free(&msg); 997 sshbuf_free(msg);
900 998
901 status = get_status(conn, id); 999 status = get_status(conn, id);
902 if (status != SSH2_FX_OK) 1000 if (status != SSH2_FX_OK)
@@ -907,50 +1005,58 @@ do_fsync(struct sftp_conn *conn, char *handle, u_int handle_len)
907 1005
908#ifdef notyet 1006#ifdef notyet
909char * 1007char *
910do_readlink(struct sftp_conn *conn, char *path) 1008do_readlink(struct sftp_conn *conn, const char *path)
911{ 1009{
912 Buffer msg; 1010 struct sshbuf *msg;
913 u_int type, expected_id, count, id; 1011 u_int expected_id, count, id;
914 char *filename, *longname; 1012 char *filename, *longname;
915 Attrib *a; 1013 Attrib a;
1014 u_char type;
1015 int r;
916 1016
917 expected_id = id = conn->msg_id++; 1017 expected_id = id = conn->msg_id++;
918 send_string_request(conn, id, SSH2_FXP_READLINK, path, strlen(path)); 1018 send_string_request(conn, id, SSH2_FXP_READLINK, path, strlen(path));
919 1019
920 buffer_init(&msg); 1020 if ((msg = sshbuf_new()) == NULL)
1021 fatal("%s: sshbuf_new failed", __func__);
921 1022
922 get_msg(conn, &msg); 1023 get_msg(conn, msg);
923 type = buffer_get_char(&msg); 1024 if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
924 id = buffer_get_int(&msg); 1025 (r = sshbuf_get_u32(msg, &id)) != 0)
1026 fatal("%s: buffer error: %s", __func__, ssh_err(r));
925 1027
926 if (id != expected_id) 1028 if (id != expected_id)
927 fatal("ID mismatch (%u != %u)", id, expected_id); 1029 fatal("ID mismatch (%u != %u)", id, expected_id);
928 1030
929 if (type == SSH2_FXP_STATUS) { 1031 if (type == SSH2_FXP_STATUS) {
930 u_int status = buffer_get_int(&msg); 1032 u_int status;
931 1033
1034 if ((r = sshbuf_get_u32(msg, &status)) != 0)
1035 fatal("%s: buffer error: %s", __func__, ssh_err(r));
932 error("Couldn't readlink: %s", fx2txt(status)); 1036 error("Couldn't readlink: %s", fx2txt(status));
933 buffer_free(&msg); 1037 sshbuf_free(msg);
934 return(NULL); 1038 return(NULL);
935 } else if (type != SSH2_FXP_NAME) 1039 } else if (type != SSH2_FXP_NAME)
936 fatal("Expected SSH2_FXP_NAME(%u) packet, got %u", 1040 fatal("Expected SSH2_FXP_NAME(%u) packet, got %u",
937 SSH2_FXP_NAME, type); 1041 SSH2_FXP_NAME, type);
938 1042
939 count = buffer_get_int(&msg); 1043 if ((r = sshbuf_get_u32(msg, &count)) != 0)
1044 fatal("%s: buffer error: %s", __func__, ssh_err(r));
940 if (count != 1) 1045 if (count != 1)
941 fatal("Got multiple names (%d) from SSH_FXP_READLINK", count); 1046 fatal("Got multiple names (%d) from SSH_FXP_READLINK", count);
942 1047
943 filename = buffer_get_string(&msg, NULL); 1048 if ((r = sshbuf_get_cstring(msg, &filename, NULL)) != 0 ||
944 longname = buffer_get_string(&msg, NULL); 1049 (r = sshbuf_get_cstring(msg, &longname, NULL)) != 0 ||
945 a = decode_attrib(&msg); 1050 (r = decode_attrib(msg, &a)) != 0)
1051 fatal("%s: buffer error: %s", __func__, ssh_err(r));
946 1052
947 debug3("SSH_FXP_READLINK %s -> %s", path, filename); 1053 debug3("SSH_FXP_READLINK %s -> %s", path, filename);
948 1054
949 free(longname); 1055 free(longname);
950 1056
951 buffer_free(&msg); 1057 sshbuf_free(msg);
952 1058
953 return(filename); 1059 return filename;
954} 1060}
955#endif 1061#endif
956 1062
@@ -958,8 +1064,9 @@ int
958do_statvfs(struct sftp_conn *conn, const char *path, struct sftp_statvfs *st, 1064do_statvfs(struct sftp_conn *conn, const char *path, struct sftp_statvfs *st,
959 int quiet) 1065 int quiet)
960{ 1066{
961 Buffer msg; 1067 struct sshbuf *msg;
962 u_int id; 1068 u_int id;
1069 int r;
963 1070
964 if ((conn->exts & SFTP_EXT_STATVFS) == 0) { 1071 if ((conn->exts & SFTP_EXT_STATVFS) == 0) {
965 error("Server does not support statvfs@openssh.com extension"); 1072 error("Server does not support statvfs@openssh.com extension");
@@ -968,24 +1075,26 @@ do_statvfs(struct sftp_conn *conn, const char *path, struct sftp_statvfs *st,
968 1075
969 id = conn->msg_id++; 1076 id = conn->msg_id++;
970 1077
971 buffer_init(&msg); 1078 if ((msg = sshbuf_new()) == NULL)
972 buffer_clear(&msg); 1079 fatal("%s: sshbuf_new failed", __func__);
973 buffer_put_char(&msg, SSH2_FXP_EXTENDED); 1080 sshbuf_reset(msg);
974 buffer_put_int(&msg, id); 1081 if ((r = sshbuf_put_u8(msg, SSH2_FXP_EXTENDED)) != 0 ||
975 buffer_put_cstring(&msg, "statvfs@openssh.com"); 1082 (r = sshbuf_put_u32(msg, id)) != 0 ||
976 buffer_put_cstring(&msg, path); 1083 (r = sshbuf_put_cstring(msg, "statvfs@openssh.com")) != 0 ||
977 send_msg(conn, &msg); 1084 (r = sshbuf_put_cstring(msg, path)) != 0)
978 buffer_free(&msg); 1085 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1086 send_msg(conn, msg);
1087 sshbuf_free(msg);
979 1088
980 return get_decode_statvfs(conn, st, id, quiet); 1089 return get_decode_statvfs(conn, st, id, quiet);
981} 1090}
982 1091
983#ifdef notyet 1092#ifdef notyet
984int 1093int
985do_fstatvfs(struct sftp_conn *conn, const char *handle, u_int handle_len, 1094do_fstatvfs(struct sftp_conn *conn, const u_char *handle, u_int handle_len,
986 struct sftp_statvfs *st, int quiet) 1095 struct sftp_statvfs *st, int quiet)
987{ 1096{
988 Buffer msg; 1097 struct sshbuf *msg;
989 u_int id; 1098 u_int id;
990 1099
991 if ((conn->exts & SFTP_EXT_FSTATVFS) == 0) { 1100 if ((conn->exts & SFTP_EXT_FSTATVFS) == 0) {
@@ -995,14 +1104,16 @@ do_fstatvfs(struct sftp_conn *conn, const char *handle, u_int handle_len,
995 1104
996 id = conn->msg_id++; 1105 id = conn->msg_id++;
997 1106
998 buffer_init(&msg); 1107 if ((msg = sshbuf_new()) == NULL)
999 buffer_clear(&msg); 1108 fatal("%s: sshbuf_new failed", __func__);
1000 buffer_put_char(&msg, SSH2_FXP_EXTENDED); 1109 sshbuf_reset(msg);
1001 buffer_put_int(&msg, id); 1110 if ((r = sshbuf_put_u8(msg, SSH2_FXP_EXTENDED)) != 0 ||
1002 buffer_put_cstring(&msg, "fstatvfs@openssh.com"); 1111 (r = sshbuf_put_u32(msg, id)) != 0 ||
1003 buffer_put_string(&msg, handle, handle_len); 1112 (r = sshbuf_put_cstring(msg, "fstatvfs@openssh.com")) != 0 ||
1004 send_msg(conn, &msg); 1113 (r = sshbuf_put_string(msg, handle, handle_len)) != 0)
1005 buffer_free(&msg); 1114 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1115 send_msg(conn, msg);
1116 sshbuf_free(msg);
1006 1117
1007 return get_decode_statvfs(conn, st, id, quiet); 1118 return get_decode_statvfs(conn, st, id, quiet);
1008} 1119}
@@ -1010,42 +1121,48 @@ do_fstatvfs(struct sftp_conn *conn, const char *handle, u_int handle_len,
1010 1121
1011static void 1122static void
1012send_read_request(struct sftp_conn *conn, u_int id, u_int64_t offset, 1123send_read_request(struct sftp_conn *conn, u_int id, u_int64_t offset,
1013 u_int len, char *handle, u_int handle_len) 1124 u_int len, const u_char *handle, u_int handle_len)
1014{ 1125{
1015 Buffer msg; 1126 struct sshbuf *msg;
1016 1127 int r;
1017 buffer_init(&msg); 1128
1018 buffer_clear(&msg); 1129 if ((msg = sshbuf_new()) == NULL)
1019 buffer_put_char(&msg, SSH2_FXP_READ); 1130 fatal("%s: sshbuf_new failed", __func__);
1020 buffer_put_int(&msg, id); 1131 sshbuf_reset(msg);
1021 buffer_put_string(&msg, handle, handle_len); 1132 if ((r = sshbuf_put_u8(msg, SSH2_FXP_READ)) != 0 ||
1022 buffer_put_int64(&msg, offset); 1133 (r = sshbuf_put_u32(msg, id)) != 0 ||
1023 buffer_put_int(&msg, len); 1134 (r = sshbuf_put_string(msg, handle, handle_len)) != 0 ||
1024 send_msg(conn, &msg); 1135 (r = sshbuf_put_u64(msg, offset)) != 0 ||
1025 buffer_free(&msg); 1136 (r = sshbuf_put_u32(msg, len)) != 0)
1137 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1138 send_msg(conn, msg);
1139 sshbuf_free(msg);
1026} 1140}
1027 1141
1028int 1142int
1029do_download(struct sftp_conn *conn, char *remote_path, char *local_path, 1143do_download(struct sftp_conn *conn, const char *remote_path,
1030 Attrib *a, int preserve_flag, int resume_flag, int fsync_flag) 1144 const char *local_path, Attrib *a, int preserve_flag, int resume_flag,
1145 int fsync_flag)
1031{ 1146{
1032 Attrib junk; 1147 Attrib junk;
1033 Buffer msg; 1148 struct sshbuf *msg;
1034 char *handle; 1149 u_char *handle;
1035 int local_fd = -1, status = 0, write_error; 1150 int local_fd = -1, write_error;
1036 int read_error, write_errno, reordered = 0; 1151 int read_error, write_errno, reordered = 0, r;
1037 u_int64_t offset = 0, size, highwater; 1152 u_int64_t offset = 0, size, highwater;
1038 u_int handle_len, mode, type, id, buflen, num_req, max_req; 1153 u_int mode, id, buflen, num_req, max_req, status = SSH2_FX_OK;
1039 off_t progress_counter; 1154 off_t progress_counter;
1155 size_t handle_len;
1040 struct stat st; 1156 struct stat st;
1041 struct request { 1157 struct request {
1042 u_int id; 1158 u_int id;
1043 u_int len; 1159 size_t len;
1044 u_int64_t offset; 1160 u_int64_t offset;
1045 TAILQ_ENTRY(request) tq; 1161 TAILQ_ENTRY(request) tq;
1046 }; 1162 };
1047 TAILQ_HEAD(reqhead, request) requests; 1163 TAILQ_HEAD(reqhead, request) requests;
1048 struct request *req; 1164 struct request *req;
1165 u_char type;
1049 1166
1050 TAILQ_INIT(&requests); 1167 TAILQ_INIT(&requests);
1051 1168
@@ -1070,23 +1187,26 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1070 size = 0; 1187 size = 0;
1071 1188
1072 buflen = conn->transfer_buflen; 1189 buflen = conn->transfer_buflen;
1073 buffer_init(&msg); 1190 if ((msg = sshbuf_new()) == NULL)
1191 fatal("%s: sshbuf_new failed", __func__);
1192
1193 attrib_clear(&junk); /* Send empty attributes */
1074 1194
1075 /* Send open request */ 1195 /* Send open request */
1076 id = conn->msg_id++; 1196 id = conn->msg_id++;
1077 buffer_put_char(&msg, SSH2_FXP_OPEN); 1197 if ((r = sshbuf_put_u8(msg, SSH2_FXP_OPEN)) != 0 ||
1078 buffer_put_int(&msg, id); 1198 (r = sshbuf_put_u32(msg, id)) != 0 ||
1079 buffer_put_cstring(&msg, remote_path); 1199 (r = sshbuf_put_cstring(msg, remote_path)) != 0 ||
1080 buffer_put_int(&msg, SSH2_FXF_READ); 1200 (r = sshbuf_put_u32(msg, SSH2_FXF_READ)) != 0 ||
1081 attrib_clear(&junk); /* Send empty attributes */ 1201 (r = encode_attrib(msg, &junk)) != 0)
1082 encode_attrib(&msg, &junk); 1202 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1083 send_msg(conn, &msg); 1203 send_msg(conn, msg);
1084 debug3("Sent message SSH2_FXP_OPEN I:%u P:%s", id, remote_path); 1204 debug3("Sent message SSH2_FXP_OPEN I:%u P:%s", id, remote_path);
1085 1205
1086 handle = get_handle(conn, id, &handle_len, 1206 handle = get_handle(conn, id, &handle_len,
1087 "remote open(\"%s\")", remote_path); 1207 "remote open(\"%s\")", remote_path);
1088 if (handle == NULL) { 1208 if (handle == NULL) {
1089 buffer_free(&msg); 1209 sshbuf_free(msg);
1090 return(-1); 1210 return(-1);
1091 } 1211 }
1092 1212
@@ -1113,7 +1233,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1113 "local file is larger than remote", local_path); 1233 "local file is larger than remote", local_path);
1114 fail: 1234 fail:
1115 do_close(conn, handle, handle_len); 1235 do_close(conn, handle, handle_len);
1116 buffer_free(&msg); 1236 sshbuf_free(msg);
1117 free(handle); 1237 free(handle);
1118 if (local_fd != -1) 1238 if (local_fd != -1)
1119 close(local_fd); 1239 close(local_fd);
@@ -1131,8 +1251,8 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1131 start_progress_meter(remote_path, size, &progress_counter); 1251 start_progress_meter(remote_path, size, &progress_counter);
1132 1252
1133 while (num_req > 0 || max_req > 0) { 1253 while (num_req > 0 || max_req > 0) {
1134 char *data; 1254 u_char *data;
1135 u_int len; 1255 size_t len;
1136 1256
1137 /* 1257 /*
1138 * Simulate EOF on interrupt: stop sending new requests and 1258 * Simulate EOF on interrupt: stop sending new requests and
@@ -1161,10 +1281,11 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1161 req->len, handle, handle_len); 1281 req->len, handle, handle_len);
1162 } 1282 }
1163 1283
1164 buffer_clear(&msg); 1284 sshbuf_reset(msg);
1165 get_msg(conn, &msg); 1285 get_msg(conn, msg);
1166 type = buffer_get_char(&msg); 1286 if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
1167 id = buffer_get_int(&msg); 1287 (r = sshbuf_get_u32(msg, &id)) != 0)
1288 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1168 debug3("Received reply T:%u I:%u R:%d", type, id, max_req); 1289 debug3("Received reply T:%u I:%u R:%d", type, id, max_req);
1169 1290
1170 /* Find the request in our queue */ 1291 /* Find the request in our queue */
@@ -1177,7 +1298,9 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1177 1298
1178 switch (type) { 1299 switch (type) {
1179 case SSH2_FXP_STATUS: 1300 case SSH2_FXP_STATUS:
1180 status = buffer_get_int(&msg); 1301 if ((r = sshbuf_get_u32(msg, &status)) != 0)
1302 fatal("%s: buffer error: %s",
1303 __func__, ssh_err(r));
1181 if (status != SSH2_FX_EOF) 1304 if (status != SSH2_FX_EOF)
1182 read_error = 1; 1305 read_error = 1;
1183 max_req = 0; 1306 max_req = 0;
@@ -1186,13 +1309,15 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1186 num_req--; 1309 num_req--;
1187 break; 1310 break;
1188 case SSH2_FXP_DATA: 1311 case SSH2_FXP_DATA:
1189 data = buffer_get_string(&msg, &len); 1312 if ((r = sshbuf_get_string(msg, &data, &len)) != 0)
1313 fatal("%s: buffer error: %s",
1314 __func__, ssh_err(r));
1190 debug3("Received data %llu -> %llu", 1315 debug3("Received data %llu -> %llu",
1191 (unsigned long long)req->offset, 1316 (unsigned long long)req->offset,
1192 (unsigned long long)req->offset + len - 1); 1317 (unsigned long long)req->offset + len - 1);
1193 if (len > req->len) 1318 if (len > req->len)
1194 fatal("Received more data than asked for " 1319 fatal("Received more data than asked for "
1195 "%u > %u", len, req->len); 1320 "%zu > %zu", len, req->len);
1196 if ((lseek(local_fd, req->offset, SEEK_SET) == -1 || 1321 if ((lseek(local_fd, req->offset, SEEK_SET) == -1 ||
1197 atomicio(vwrite, local_fd, data, len) != len) && 1322 atomicio(vwrite, local_fd, data, len) != len) &&
1198 !write_error) { 1323 !write_error) {
@@ -1269,12 +1394,13 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1269 } else if (write_error) { 1394 } else if (write_error) {
1270 error("Couldn't write to \"%s\": %s", local_path, 1395 error("Couldn't write to \"%s\": %s", local_path,
1271 strerror(write_errno)); 1396 strerror(write_errno));
1272 status = -1; 1397 status = SSH2_FX_FAILURE;
1273 do_close(conn, handle, handle_len); 1398 do_close(conn, handle, handle_len);
1274 } else { 1399 } else {
1275 status = do_close(conn, handle, handle_len); 1400 if (do_close(conn, handle, handle_len) != 0 || interrupted)
1276 if (interrupted || status != SSH2_FX_OK) 1401 status = SSH2_FX_FAILURE;
1277 status = -1; 1402 else
1403 status = SSH2_FX_OK;
1278 /* Override umask and utimes if asked */ 1404 /* Override umask and utimes if asked */
1279#ifdef HAVE_FCHMOD 1405#ifdef HAVE_FCHMOD
1280 if (preserve_flag && fchmod(local_fd, mode) == -1) 1406 if (preserve_flag && fchmod(local_fd, mode) == -1)
@@ -1301,16 +1427,16 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
1301 } 1427 }
1302 } 1428 }
1303 close(local_fd); 1429 close(local_fd);
1304 buffer_free(&msg); 1430 sshbuf_free(msg);
1305 free(handle); 1431 free(handle);
1306 1432
1307 return(status); 1433 return(status);
1308} 1434}
1309 1435
1310static int 1436static int
1311download_dir_internal(struct sftp_conn *conn, char *src, char *dst, int depth, 1437download_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
1312 Attrib *dirattrib, int preserve_flag, int print_flag, int resume_flag, 1438 int depth, Attrib *dirattrib, int preserve_flag, int print_flag,
1313 int fsync_flag) 1439 int resume_flag, int fsync_flag)
1314{ 1440{
1315 int i, ret = 0; 1441 int i, ret = 0;
1316 SFTP_DIRENT **dir_entries; 1442 SFTP_DIRENT **dir_entries;
@@ -1400,9 +1526,9 @@ download_dir_internal(struct sftp_conn *conn, char *src, char *dst, int depth,
1400} 1526}
1401 1527
1402int 1528int
1403download_dir(struct sftp_conn *conn, char *src, char *dst, 1529download_dir(struct sftp_conn *conn, const char *src, const char *dst,
1404 Attrib *dirattrib, int preserve_flag, int print_flag, 1530 Attrib *dirattrib, int preserve_flag, int print_flag, int resume_flag,
1405 int resume_flag, int fsync_flag) 1531 int fsync_flag)
1406{ 1532{
1407 char *src_canon; 1533 char *src_canon;
1408 int ret; 1534 int ret;
@@ -1419,15 +1545,16 @@ download_dir(struct sftp_conn *conn, char *src, char *dst,
1419} 1545}
1420 1546
1421int 1547int
1422do_upload(struct sftp_conn *conn, char *local_path, char *remote_path, 1548do_upload(struct sftp_conn *conn, const char *local_path,
1423 int preserve_flag, int resume, int fsync_flag) 1549 const char *remote_path, int preserve_flag, int resume, int fsync_flag)
1424{ 1550{
1425 int local_fd; 1551 int r, local_fd;
1426 int status = SSH2_FX_OK; 1552 u_int status = SSH2_FX_OK;
1427 u_int handle_len, id, type; 1553 u_int id;
1554 u_char type;
1428 off_t offset, progress_counter; 1555 off_t offset, progress_counter;
1429 char *handle, *data; 1556 u_char *handle, *data;
1430 Buffer msg; 1557 struct sshbuf *msg;
1431 struct stat sb; 1558 struct stat sb;
1432 Attrib a, *c = NULL; 1559 Attrib a, *c = NULL;
1433 u_int32_t startid; 1560 u_int32_t startid;
@@ -1440,6 +1567,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1440 }; 1567 };
1441 TAILQ_HEAD(ackhead, outstanding_ack) acks; 1568 TAILQ_HEAD(ackhead, outstanding_ack) acks;
1442 struct outstanding_ack *ack = NULL; 1569 struct outstanding_ack *ack = NULL;
1570 size_t handle_len;
1443 1571
1444 TAILQ_INIT(&acks); 1572 TAILQ_INIT(&acks);
1445 1573
@@ -1487,26 +1615,28 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1487 } 1615 }
1488 } 1616 }
1489 1617
1490 buffer_init(&msg); 1618 if ((msg = sshbuf_new()) == NULL)
1619 fatal("%s: sshbuf_new failed", __func__);
1491 1620
1492 /* Send open request */ 1621 /* Send open request */
1493 id = conn->msg_id++; 1622 id = conn->msg_id++;
1494 buffer_put_char(&msg, SSH2_FXP_OPEN); 1623 if ((r = sshbuf_put_u8(msg, SSH2_FXP_OPEN)) != 0 ||
1495 buffer_put_int(&msg, id); 1624 (r = sshbuf_put_u32(msg, id)) != 0 ||
1496 buffer_put_cstring(&msg, remote_path); 1625 (r = sshbuf_put_cstring(msg, remote_path)) != 0 ||
1497 buffer_put_int(&msg, SSH2_FXF_WRITE|SSH2_FXF_CREAT| 1626 (r = sshbuf_put_u32(msg, SSH2_FXF_WRITE|SSH2_FXF_CREAT|
1498 (resume ? SSH2_FXF_APPEND : SSH2_FXF_TRUNC)); 1627 (resume ? SSH2_FXF_APPEND : SSH2_FXF_TRUNC))) != 0 ||
1499 encode_attrib(&msg, &a); 1628 (r = encode_attrib(msg, &a)) != 0)
1500 send_msg(conn, &msg); 1629 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1630 send_msg(conn, msg);
1501 debug3("Sent message SSH2_FXP_OPEN I:%u P:%s", id, remote_path); 1631 debug3("Sent message SSH2_FXP_OPEN I:%u P:%s", id, remote_path);
1502 1632
1503 buffer_clear(&msg); 1633 sshbuf_reset(msg);
1504 1634
1505 handle = get_handle(conn, id, &handle_len, 1635 handle = get_handle(conn, id, &handle_len,
1506 "remote open(\"%s\")", remote_path); 1636 "remote open(\"%s\")", remote_path);
1507 if (handle == NULL) { 1637 if (handle == NULL) {
1508 close(local_fd); 1638 close(local_fd);
1509 buffer_free(&msg); 1639 sshbuf_free(msg);
1510 return -1; 1640 return -1;
1511 } 1641 }
1512 1642
@@ -1546,13 +1676,16 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1546 ack->len = len; 1676 ack->len = len;
1547 TAILQ_INSERT_TAIL(&acks, ack, tq); 1677 TAILQ_INSERT_TAIL(&acks, ack, tq);
1548 1678
1549 buffer_clear(&msg); 1679 sshbuf_reset(msg);
1550 buffer_put_char(&msg, SSH2_FXP_WRITE); 1680 if ((r = sshbuf_put_u8(msg, SSH2_FXP_WRITE)) != 0 ||
1551 buffer_put_int(&msg, ack->id); 1681 (r = sshbuf_put_u32(msg, ack->id)) != 0 ||
1552 buffer_put_string(&msg, handle, handle_len); 1682 (r = sshbuf_put_string(msg, handle,
1553 buffer_put_int64(&msg, offset); 1683 handle_len)) != 0 ||
1554 buffer_put_string(&msg, data, len); 1684 (r = sshbuf_put_u64(msg, offset)) != 0 ||
1555 send_msg(conn, &msg); 1685 (r = sshbuf_put_string(msg, data, len)) != 0)
1686 fatal("%s: buffer error: %s",
1687 __func__, ssh_err(r));
1688 send_msg(conn, msg);
1556 debug3("Sent message SSH2_FXP_WRITE I:%u O:%llu S:%u", 1689 debug3("Sent message SSH2_FXP_WRITE I:%u O:%llu S:%u",
1557 id, (unsigned long long)offset, len); 1690 id, (unsigned long long)offset, len);
1558 } else if (TAILQ_FIRST(&acks) == NULL) 1691 } else if (TAILQ_FIRST(&acks) == NULL)
@@ -1563,27 +1696,31 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1563 1696
1564 if (id == startid || len == 0 || 1697 if (id == startid || len == 0 ||
1565 id - ackid >= conn->num_requests) { 1698 id - ackid >= conn->num_requests) {
1566 u_int r_id; 1699 u_int rid;
1567 1700
1568 buffer_clear(&msg); 1701 sshbuf_reset(msg);
1569 get_msg(conn, &msg); 1702 get_msg(conn, msg);
1570 type = buffer_get_char(&msg); 1703 if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
1571 r_id = buffer_get_int(&msg); 1704 (r = sshbuf_get_u32(msg, &rid)) != 0)
1705 fatal("%s: buffer error: %s",
1706 __func__, ssh_err(r));
1572 1707
1573 if (type != SSH2_FXP_STATUS) 1708 if (type != SSH2_FXP_STATUS)
1574 fatal("Expected SSH2_FXP_STATUS(%d) packet, " 1709 fatal("Expected SSH2_FXP_STATUS(%d) packet, "
1575 "got %d", SSH2_FXP_STATUS, type); 1710 "got %d", SSH2_FXP_STATUS, type);
1576 1711
1577 status = buffer_get_int(&msg); 1712 if ((r = sshbuf_get_u32(msg, &status)) != 0)
1578 debug3("SSH2_FXP_STATUS %d", status); 1713 fatal("%s: buffer error: %s",
1714 __func__, ssh_err(r));
1715 debug3("SSH2_FXP_STATUS %u", status);
1579 1716
1580 /* Find the request in our queue */ 1717 /* Find the request in our queue */
1581 for (ack = TAILQ_FIRST(&acks); 1718 for (ack = TAILQ_FIRST(&acks);
1582 ack != NULL && ack->id != r_id; 1719 ack != NULL && ack->id != rid;
1583 ack = TAILQ_NEXT(ack, tq)) 1720 ack = TAILQ_NEXT(ack, tq))
1584 ; 1721 ;
1585 if (ack == NULL) 1722 if (ack == NULL)
1586 fatal("Can't find request for ID %u", r_id); 1723 fatal("Can't find request for ID %u", rid);
1587 TAILQ_REMOVE(&acks, ack, tq); 1724 TAILQ_REMOVE(&acks, ack, tq);
1588 debug3("In write loop, ack for %u %u bytes at %lld", 1725 debug3("In write loop, ack for %u %u bytes at %lld",
1589 ack->id, ack->len, (long long)ack->offset); 1726 ack->id, ack->len, (long long)ack->offset);
@@ -1595,7 +1732,7 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1595 if (offset < 0) 1732 if (offset < 0)
1596 fatal("%s: offset < 0", __func__); 1733 fatal("%s: offset < 0", __func__);
1597 } 1734 }
1598 buffer_free(&msg); 1735 sshbuf_free(msg);
1599 1736
1600 if (showprogress) 1737 if (showprogress)
1601 stop_progress_meter(); 1738 stop_progress_meter();
@@ -1604,13 +1741,13 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1604 if (status != SSH2_FX_OK) { 1741 if (status != SSH2_FX_OK) {
1605 error("Couldn't write to remote file \"%s\": %s", 1742 error("Couldn't write to remote file \"%s\": %s",
1606 remote_path, fx2txt(status)); 1743 remote_path, fx2txt(status));
1607 status = -1; 1744 status = SSH2_FX_FAILURE;
1608 } 1745 }
1609 1746
1610 if (close(local_fd) == -1) { 1747 if (close(local_fd) == -1) {
1611 error("Couldn't close local file \"%s\": %s", local_path, 1748 error("Couldn't close local file \"%s\": %s", local_path,
1612 strerror(errno)); 1749 strerror(errno));
1613 status = -1; 1750 status = SSH2_FX_FAILURE;
1614 } 1751 }
1615 1752
1616 /* Override umask and utimes if asked */ 1753 /* Override umask and utimes if asked */
@@ -1621,17 +1758,19 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1621 (void)do_fsync(conn, handle, handle_len); 1758 (void)do_fsync(conn, handle, handle_len);
1622 1759
1623 if (do_close(conn, handle, handle_len) != SSH2_FX_OK) 1760 if (do_close(conn, handle, handle_len) != SSH2_FX_OK)
1624 status = -1; 1761 status = SSH2_FX_FAILURE;
1762
1625 free(handle); 1763 free(handle);
1626 1764
1627 return status; 1765 return status == SSH2_FX_OK ? 0 : -1;
1628} 1766}
1629 1767
1630static int 1768static int
1631upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, int depth, 1769upload_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
1632 int preserve_flag, int print_flag, int resume, int fsync_flag) 1770 int depth, int preserve_flag, int print_flag, int resume, int fsync_flag)
1633{ 1771{
1634 int ret = 0, status; 1772 int ret = 0;
1773 u_int status;
1635 DIR *dirp; 1774 DIR *dirp;
1636 struct dirent *dp; 1775 struct dirent *dp;
1637 char *filename, *new_src, *new_dst; 1776 char *filename, *new_src, *new_dst;
@@ -1721,8 +1860,8 @@ upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, int depth,
1721} 1860}
1722 1861
1723int 1862int
1724upload_dir(struct sftp_conn *conn, char *src, char *dst, int preserve_flag, 1863upload_dir(struct sftp_conn *conn, const char *src, const char *dst,
1725 int print_flag, int resume, int fsync_flag) 1864 int preserve_flag, int print_flag, int resume, int fsync_flag)
1726{ 1865{
1727 char *dst_canon; 1866 char *dst_canon;
1728 int ret; 1867 int ret;
@@ -1740,7 +1879,7 @@ upload_dir(struct sftp_conn *conn, char *src, char *dst, int preserve_flag,
1740} 1879}
1741 1880
1742char * 1881char *
1743path_append(char *p1, char *p2) 1882path_append(const char *p1, const char *p2)
1744{ 1883{
1745 char *ret; 1884 char *ret;
1746 size_t len = strlen(p1) + strlen(p2) + 2; 1885 size_t len = strlen(p1) + strlen(p2) + 2;
diff --git a/sftp-client.h b/sftp-client.h
index 967840b9c..507d763ea 100644
--- a/sftp-client.h
+++ b/sftp-client.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.h,v 1.25 2014/04/21 14:36:16 logan Exp $ */ 1/* $OpenBSD: sftp-client.h,v 1.26 2015/01/14 13:54:13 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 4 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
@@ -56,79 +56,81 @@ struct sftp_conn *do_init(int, int, u_int, u_int, u_int64_t);
56u_int sftp_proto_version(struct sftp_conn *); 56u_int sftp_proto_version(struct sftp_conn *);
57 57
58/* Close file referred to by 'handle' */ 58/* Close file referred to by 'handle' */
59int do_close(struct sftp_conn *, char *, u_int); 59int do_close(struct sftp_conn *, const u_char *, u_int);
60 60
61/* Read contents of 'path' to NULL-terminated array 'dir' */ 61/* Read contents of 'path' to NULL-terminated array 'dir' */
62int do_readdir(struct sftp_conn *, char *, SFTP_DIRENT ***); 62int do_readdir(struct sftp_conn *, const char *, SFTP_DIRENT ***);
63 63
64/* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */ 64/* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */
65void free_sftp_dirents(SFTP_DIRENT **); 65void free_sftp_dirents(SFTP_DIRENT **);
66 66
67/* Delete file 'path' */ 67/* Delete file 'path' */
68int do_rm(struct sftp_conn *, char *); 68int do_rm(struct sftp_conn *, const char *);
69 69
70/* Create directory 'path' */ 70/* Create directory 'path' */
71int do_mkdir(struct sftp_conn *, char *, Attrib *, int); 71int do_mkdir(struct sftp_conn *, const char *, Attrib *, int);
72 72
73/* Remove directory 'path' */ 73/* Remove directory 'path' */
74int do_rmdir(struct sftp_conn *, char *); 74int do_rmdir(struct sftp_conn *, const char *);
75 75
76/* Get file attributes of 'path' (follows symlinks) */ 76/* Get file attributes of 'path' (follows symlinks) */
77Attrib *do_stat(struct sftp_conn *, char *, int); 77Attrib *do_stat(struct sftp_conn *, const char *, int);
78 78
79/* Get file attributes of 'path' (does not follow symlinks) */ 79/* Get file attributes of 'path' (does not follow symlinks) */
80Attrib *do_lstat(struct sftp_conn *, char *, int); 80Attrib *do_lstat(struct sftp_conn *, const char *, int);
81 81
82/* Set file attributes of 'path' */ 82/* Set file attributes of 'path' */
83int do_setstat(struct sftp_conn *, char *, Attrib *); 83int do_setstat(struct sftp_conn *, const char *, Attrib *);
84 84
85/* Set file attributes of open file 'handle' */ 85/* Set file attributes of open file 'handle' */
86int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *); 86int do_fsetstat(struct sftp_conn *, const u_char *, u_int, Attrib *);
87 87
88/* Canonicalise 'path' - caller must free result */ 88/* Canonicalise 'path' - caller must free result */
89char *do_realpath(struct sftp_conn *, char *); 89char *do_realpath(struct sftp_conn *, const char *);
90 90
91/* Get statistics for filesystem hosting file at "path" */ 91/* Get statistics for filesystem hosting file at "path" */
92int do_statvfs(struct sftp_conn *, const char *, struct sftp_statvfs *, int); 92int do_statvfs(struct sftp_conn *, const char *, struct sftp_statvfs *, int);
93 93
94/* Rename 'oldpath' to 'newpath' */ 94/* Rename 'oldpath' to 'newpath' */
95int do_rename(struct sftp_conn *, char *, char *m, int force_legacy); 95int do_rename(struct sftp_conn *, const char *, const char *, int force_legacy);
96 96
97/* Link 'oldpath' to 'newpath' */ 97/* Link 'oldpath' to 'newpath' */
98int do_hardlink(struct sftp_conn *, char *, char *); 98int do_hardlink(struct sftp_conn *, const char *, const char *);
99 99
100/* Rename 'oldpath' to 'newpath' */ 100/* Rename 'oldpath' to 'newpath' */
101int do_symlink(struct sftp_conn *, char *, char *); 101int do_symlink(struct sftp_conn *, const char *, const char *);
102 102
103/* Call fsync() on open file 'handle' */ 103/* Call fsync() on open file 'handle' */
104int do_fsync(struct sftp_conn *conn, char *, u_int); 104int do_fsync(struct sftp_conn *conn, u_char *, u_int);
105 105
106/* 106/*
107 * Download 'remote_path' to 'local_path'. Preserve permissions and times 107 * Download 'remote_path' to 'local_path'. Preserve permissions and times
108 * if 'pflag' is set 108 * if 'pflag' is set
109 */ 109 */
110int do_download(struct sftp_conn *, char *, char *, Attrib *, int, int, int); 110int do_download(struct sftp_conn *, const char *, const char *,
111 Attrib *, int, int, int);
111 112
112/* 113/*
113 * Recursively download 'remote_directory' to 'local_directory'. Preserve 114 * Recursively download 'remote_directory' to 'local_directory'. Preserve
114 * times if 'pflag' is set 115 * times if 'pflag' is set
115 */ 116 */
116int download_dir(struct sftp_conn *, char *, char *, Attrib *, int, 117int download_dir(struct sftp_conn *, const char *, const char *,
117 int, int, int); 118 Attrib *, int, int, int, int);
118 119
119/* 120/*
120 * Upload 'local_path' to 'remote_path'. Preserve permissions and times 121 * Upload 'local_path' to 'remote_path'. Preserve permissions and times
121 * if 'pflag' is set 122 * if 'pflag' is set
122 */ 123 */
123int do_upload(struct sftp_conn *, char *, char *, int, int, int); 124int do_upload(struct sftp_conn *, const char *, const char *, int, int, int);
124 125
125/* 126/*
126 * Recursively upload 'local_directory' to 'remote_directory'. Preserve 127 * Recursively upload 'local_directory' to 'remote_directory'. Preserve
127 * times if 'pflag' is set 128 * times if 'pflag' is set
128 */ 129 */
129int upload_dir(struct sftp_conn *, char *, char *, int, int, int, int); 130int upload_dir(struct sftp_conn *, const char *, const char *, int, int, int,
131 int);
130 132
131/* Concatenate paths, taking care of slashes. Caller must free result. */ 133/* Concatenate paths, taking care of slashes. Caller must free result. */
132char *path_append(char *, char *); 134char *path_append(const char *, const char *);
133 135
134#endif 136#endif
diff --git a/sftp-common.c b/sftp-common.c
index 70a929ccc..9dc1f9831 100644
--- a/sftp-common.c
+++ b/sftp-common.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-common.c,v 1.26 2014/01/09 03:26:00 guenther Exp $ */ 1/* $OpenBSD: sftp-common.c,v 1.28 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2001 Damien Miller. All rights reserved. 4 * Copyright (c) 2001 Damien Miller. All rights reserved.
@@ -26,9 +26,9 @@
26 26
27#include "includes.h" 27#include "includes.h"
28 28
29#include <sys/param.h> /* MAX */
29#include <sys/types.h> 30#include <sys/types.h>
30#include <sys/stat.h> 31#include <sys/stat.h>
31#include <sys/param.h>
32 32
33#include <grp.h> 33#include <grp.h>
34#include <pwd.h> 34#include <pwd.h>
@@ -42,7 +42,8 @@
42#endif 42#endif
43 43
44#include "xmalloc.h" 44#include "xmalloc.h"
45#include "buffer.h" 45#include "ssherr.h"
46#include "sshbuf.h"
46#include "log.h" 47#include "log.h"
47 48
48#include "sftp.h" 49#include "sftp.h"
@@ -100,59 +101,81 @@ attrib_to_stat(const Attrib *a, struct stat *st)
100} 101}
101 102
102/* Decode attributes in buffer */ 103/* Decode attributes in buffer */
103Attrib * 104int
104decode_attrib(Buffer *b) 105decode_attrib(struct sshbuf *b, Attrib *a)
105{ 106{
106 static Attrib a; 107 int r;
107 108
108 attrib_clear(&a); 109 attrib_clear(a);
109 a.flags = buffer_get_int(b); 110 if ((r = sshbuf_get_u32(b, &a->flags)) != 0)
110 if (a.flags & SSH2_FILEXFER_ATTR_SIZE) 111 return r;
111 a.size = buffer_get_int64(b); 112 if (a->flags & SSH2_FILEXFER_ATTR_SIZE) {
112 if (a.flags & SSH2_FILEXFER_ATTR_UIDGID) { 113 if ((r = sshbuf_get_u64(b, &a->size)) != 0)
113 a.uid = buffer_get_int(b); 114 return r;
114 a.gid = buffer_get_int(b); 115 }
115 } 116 if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) {
116 if (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) 117 if ((r = sshbuf_get_u32(b, &a->uid)) != 0 ||
117 a.perm = buffer_get_int(b); 118 (r = sshbuf_get_u32(b, &a->gid)) != 0)
118 if (a.flags & SSH2_FILEXFER_ATTR_ACMODTIME) { 119 return r;
119 a.atime = buffer_get_int(b); 120 }
120 a.mtime = buffer_get_int(b); 121 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
122 if ((r = sshbuf_get_u32(b, &a->perm)) != 0)
123 return r;
124 }
125 if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) {
126 if ((r = sshbuf_get_u32(b, &a->atime)) != 0 ||
127 (r = sshbuf_get_u32(b, &a->mtime)) != 0)
128 return r;
121 } 129 }
122 /* vendor-specific extensions */ 130 /* vendor-specific extensions */
123 if (a.flags & SSH2_FILEXFER_ATTR_EXTENDED) { 131 if (a->flags & SSH2_FILEXFER_ATTR_EXTENDED) {
124 char *type, *data; 132 char *type;
125 int i, count; 133 u_char *data;
134 size_t dlen;
135 u_int i, count;
126 136
127 count = buffer_get_int(b); 137 if ((r = sshbuf_get_u32(b, &count)) != 0)
138 fatal("%s: buffer error: %s", __func__, ssh_err(r));
128 for (i = 0; i < count; i++) { 139 for (i = 0; i < count; i++) {
129 type = buffer_get_string(b, NULL); 140 if ((r = sshbuf_get_cstring(b, &type, NULL)) != 0 ||
130 data = buffer_get_string(b, NULL); 141 (r = sshbuf_get_string(b, &data, &dlen)) != 0)
131 debug3("Got file attribute \"%s\"", type); 142 return r;
143 debug3("Got file attribute \"%.100s\" len %zu",
144 type, dlen);
132 free(type); 145 free(type);
133 free(data); 146 free(data);
134 } 147 }
135 } 148 }
136 return &a; 149 return 0;
137} 150}
138 151
139/* Encode attributes to buffer */ 152/* Encode attributes to buffer */
140void 153int
141encode_attrib(Buffer *b, const Attrib *a) 154encode_attrib(struct sshbuf *b, const Attrib *a)
142{ 155{
143 buffer_put_int(b, a->flags); 156 int r;
144 if (a->flags & SSH2_FILEXFER_ATTR_SIZE) 157
145 buffer_put_int64(b, a->size); 158 if ((r = sshbuf_put_u32(b, a->flags)) != 0)
159 return r;
160 if (a->flags & SSH2_FILEXFER_ATTR_SIZE) {
161 if ((r = sshbuf_put_u64(b, a->size)) != 0)
162 return r;
163 }
146 if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { 164 if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) {
147 buffer_put_int(b, a->uid); 165 if ((r = sshbuf_put_u32(b, a->uid)) != 0 ||
148 buffer_put_int(b, a->gid); 166 (r = sshbuf_put_u32(b, a->gid)) != 0)
167 return r;
168 }
169 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
170 if ((r = sshbuf_put_u32(b, a->perm)) != 0)
171 return r;
149 } 172 }
150 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS)
151 buffer_put_int(b, a->perm);
152 if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) { 173 if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) {
153 buffer_put_int(b, a->atime); 174 if ((r = sshbuf_put_u32(b, a->atime)) != 0 ||
154 buffer_put_int(b, a->mtime); 175 (r = sshbuf_put_u32(b, a->mtime)) != 0)
176 return r;
155 } 177 }
178 return 0;
156} 179}
157 180
158/* Convert from SSH2_FX_ status to text error message */ 181/* Convert from SSH2_FX_ status to text error message */
diff --git a/sftp-common.h b/sftp-common.h
index 9ed86c070..2e778a9ca 100644
--- a/sftp-common.h
+++ b/sftp-common.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-common.h,v 1.11 2010/01/13 01:40:16 djm Exp $ */ 1/* $OpenBSD: sftp-common.h,v 1.12 2015/01/14 13:54:13 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -28,6 +28,7 @@
28/* Maximum packet that we are willing to send/accept */ 28/* Maximum packet that we are willing to send/accept */
29#define SFTP_MAX_MSG_LENGTH (256 * 1024) 29#define SFTP_MAX_MSG_LENGTH (256 * 1024)
30 30
31struct sshbuf;
31typedef struct Attrib Attrib; 32typedef struct Attrib Attrib;
32 33
33/* File attributes */ 34/* File attributes */
@@ -44,8 +45,8 @@ struct Attrib {
44void attrib_clear(Attrib *); 45void attrib_clear(Attrib *);
45void stat_to_attrib(const struct stat *, Attrib *); 46void stat_to_attrib(const struct stat *, Attrib *);
46void attrib_to_stat(const Attrib *, struct stat *); 47void attrib_to_stat(const Attrib *, struct stat *);
47Attrib *decode_attrib(Buffer *); 48int decode_attrib(struct sshbuf *, Attrib *);
48void encode_attrib(Buffer *, const Attrib *); 49int encode_attrib(struct sshbuf *, const Attrib *);
49char *ls_file(const char *, const struct stat *, int, int); 50char *ls_file(const char *, const struct stat *, int, int);
50 51
51const char *fx2txt(int); 52const char *fx2txt(int);
diff --git a/sftp-glob.c b/sftp-glob.c
index d85aecc9a..43a1bebad 100644
--- a/sftp-glob.c
+++ b/sftp-glob.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-glob.c,v 1.26 2013/11/08 11:15:19 dtucker Exp $ */ 1/* $OpenBSD: sftp-glob.c,v 1.27 2015/01/14 13:54:13 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -25,10 +25,10 @@
25#include <dirent.h> 25#include <dirent.h>
26#include <stdlib.h> 26#include <stdlib.h>
27#include <string.h> 27#include <string.h>
28#include <stdlib.h>
28 29
29#include "xmalloc.h" 30#include "xmalloc.h"
30#include "sftp.h" 31#include "sftp.h"
31#include "buffer.h"
32#include "sftp-common.h" 32#include "sftp-common.h"
33#include "sftp-client.h" 33#include "sftp-client.h"
34 34
diff --git a/sftp-server.0 b/sftp-server.0
index d811e252d..77b6bb509 100644
--- a/sftp-server.0
+++ b/sftp-server.0
@@ -1,7 +1,7 @@
1SFTP-SERVER(8) System Manager's Manual SFTP-SERVER(8) 1SFTP-SERVER(8) System Manager's Manual SFTP-SERVER(8)
2 2
3NAME 3NAME
4 sftp-server - SFTP server subsystem 4 sftp-server M-bM-^@M-^S SFTP server subsystem
5 5
6SYNOPSIS 6SYNOPSIS
7 sftp-server [-ehR] [-d start_directory] [-f log_facility] [-l log_level] 7 sftp-server [-ehR] [-d start_directory] [-f log_facility] [-l log_level]
@@ -23,7 +23,7 @@ DESCRIPTION
23 -d start_directory 23 -d start_directory
24 specifies an alternate starting directory for users. The 24 specifies an alternate starting directory for users. The
25 pathname may contain the following tokens that are expanded at 25 pathname may contain the following tokens that are expanded at
26 runtime: %% is replaced by a literal '%', %h is replaced by the 26 runtime: %% is replaced by a literal '%', %d is replaced by the
27 home directory of the user being authenticated, and %u is 27 home directory of the user being authenticated, and %u is
28 replaced by the username of that user. The default is to use the 28 replaced by the username of that user. The default is to use the
29 user's home directory. This option is useful in conjunction with 29 user's home directory. This option is useful in conjunction with
@@ -65,8 +65,8 @@ DESCRIPTION
65 65
66 -Q protocol_feature 66 -Q protocol_feature
67 Query protocol features supported by sftp-server. At present the 67 Query protocol features supported by sftp-server. At present the
68 only feature that may be queried is ``requests'', which may be 68 only feature that may be queried is M-bM-^@M-^\requestsM-bM-^@M-^], which may be used
69 used for black or whitelisting (flags -P and -p respectively). 69 for black or whitelisting (flags -P and -p respectively).
70 70
71 -R Places this instance of sftp-server into a read-only mode. 71 -R Places this instance of sftp-server into a read-only mode.
72 Attempts to open files for writing, as well as other operations 72 Attempts to open files for writing, as well as other operations
@@ -93,4 +93,4 @@ HISTORY
93AUTHORS 93AUTHORS
94 Markus Friedl <markus@openbsd.org> 94 Markus Friedl <markus@openbsd.org>
95 95
96OpenBSD 5.6 July 28, 2014 OpenBSD 5.6 96OpenBSD 5.7 December 11, 2014 OpenBSD 5.7
diff --git a/sftp-server.8 b/sftp-server.8
index 75d8d8d53..c117398e8 100644
--- a/sftp-server.8
+++ b/sftp-server.8
@@ -1,4 +1,4 @@
1.\" $OpenBSD: sftp-server.8,v 1.26 2014/07/28 15:40:08 schwarze Exp $ 1.\" $OpenBSD: sftp-server.8,v 1.27 2014/12/11 04:16:14 djm Exp $
2.\" 2.\"
3.\" Copyright (c) 2000 Markus Friedl. All rights reserved. 3.\" Copyright (c) 2000 Markus Friedl. All rights reserved.
4.\" 4.\"
@@ -22,7 +22,7 @@
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\" 24.\"
25.Dd $Mdocdate: July 28 2014 $ 25.Dd $Mdocdate: December 11 2014 $
26.Dt SFTP-SERVER 8 26.Dt SFTP-SERVER 8
27.Os 27.Os
28.Sh NAME 28.Sh NAME
@@ -67,7 +67,7 @@ Valid options are:
67specifies an alternate starting directory for users. 67specifies an alternate starting directory for users.
68The pathname may contain the following tokens that are expanded at runtime: 68The pathname may contain the following tokens that are expanded at runtime:
69%% is replaced by a literal '%', 69%% is replaced by a literal '%',
70%h is replaced by the home directory of the user being authenticated, 70%d is replaced by the home directory of the user being authenticated,
71and %u is replaced by the username of that user. 71and %u is replaced by the username of that user.
72The default is to use the user's home directory. 72The default is to use the user's home directory.
73This option is useful in conjunction with the 73This option is useful in conjunction with the
diff --git a/sftp-server.c b/sftp-server.c
index 0177130cf..4f735cd93 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-server.c,v 1.103 2014/01/17 06:23:24 dtucker Exp $ */ 1/* $OpenBSD: sftp-server.c,v 1.105 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
4 * 4 *
@@ -17,8 +17,8 @@
17 17
18#include "includes.h" 18#include "includes.h"
19 19
20#include <sys/param.h> /* MIN */
20#include <sys/types.h> 21#include <sys/types.h>
21#include <sys/param.h>
22#include <sys/stat.h> 22#include <sys/stat.h>
23#ifdef HAVE_SYS_TIME_H 23#ifdef HAVE_SYS_TIME_H
24# include <sys/time.h> 24# include <sys/time.h>
@@ -46,7 +46,8 @@
46#include <stdarg.h> 46#include <stdarg.h>
47 47
48#include "xmalloc.h" 48#include "xmalloc.h"
49#include "buffer.h" 49#include "sshbuf.h"
50#include "ssherr.h"
50#include "log.h" 51#include "log.h"
51#include "misc.h" 52#include "misc.h"
52#include "match.h" 53#include "match.h"
@@ -55,11 +56,6 @@
55#include "sftp.h" 56#include "sftp.h"
56#include "sftp-common.h" 57#include "sftp-common.h"
57 58
58/* helper */
59#define get_int64() buffer_get_int64(&iqueue);
60#define get_int() buffer_get_int(&iqueue);
61#define get_string(lenp) buffer_get_string(&iqueue, lenp);
62
63/* Our verbosity */ 59/* Our verbosity */
64static LogLevel log_level = SYSLOG_LEVEL_ERROR; 60static LogLevel log_level = SYSLOG_LEVEL_ERROR;
65 61
@@ -68,8 +64,8 @@ static struct passwd *pw = NULL;
68static char *client_addr = NULL; 64static char *client_addr = NULL;
69 65
70/* input and output queue */ 66/* input and output queue */
71static Buffer iqueue; 67struct sshbuf *iqueue;
72static Buffer oqueue; 68struct sshbuf *oqueue;
73 69
74/* Version of client */ 70/* Version of client */
75static u_int version; 71static u_int version;
@@ -275,12 +271,6 @@ string_from_portable(int pflags)
275 return ret; 271 return ret;
276} 272}
277 273
278static Attrib *
279get_attrib(void)
280{
281 return decode_attrib(&iqueue);
282}
283
284/* handle handles */ 274/* handle handles */
285 275
286typedef struct Handle Handle; 276typedef struct Handle Handle;
@@ -344,7 +334,7 @@ handle_is_ok(int i, int type)
344} 334}
345 335
346static int 336static int
347handle_to_string(int handle, char **stringp, int *hlenp) 337handle_to_string(int handle, u_char **stringp, int *hlenp)
348{ 338{
349 if (stringp == NULL || hlenp == NULL) 339 if (stringp == NULL || hlenp == NULL)
350 return -1; 340 return -1;
@@ -355,7 +345,7 @@ handle_to_string(int handle, char **stringp, int *hlenp)
355} 345}
356 346
357static int 347static int
358handle_from_string(const char *handle, u_int hlen) 348handle_from_string(const u_char *handle, u_int hlen)
359{ 349{
360 int val; 350 int val;
361 351
@@ -477,29 +467,31 @@ handle_log_exit(void)
477} 467}
478 468
479static int 469static int
480get_handle(void) 470get_handle(struct sshbuf *queue, int *hp)
481{ 471{
482 char *handle; 472 u_char *handle;
483 int val = -1; 473 int r;
484 u_int hlen; 474 size_t hlen;
485 475
486 handle = get_string(&hlen); 476 *hp = -1;
477 if ((r = sshbuf_get_string(queue, &handle, &hlen)) != 0)
478 return r;
487 if (hlen < 256) 479 if (hlen < 256)
488 val = handle_from_string(handle, hlen); 480 *hp = handle_from_string(handle, hlen);
489 free(handle); 481 free(handle);
490 return val; 482 return 0;
491} 483}
492 484
493/* send replies */ 485/* send replies */
494 486
495static void 487static void
496send_msg(Buffer *m) 488send_msg(struct sshbuf *m)
497{ 489{
498 int mlen = buffer_len(m); 490 int r;
499 491
500 buffer_put_int(&oqueue, mlen); 492 if ((r = sshbuf_put_stringb(oqueue, m)) != 0)
501 buffer_append(&oqueue, buffer_ptr(m), mlen); 493 fatal("%s: buffer error: %s", __func__, ssh_err(r));
502 buffer_consume(m, mlen); 494 sshbuf_reset(m);
503} 495}
504 496
505static const char * 497static const char *
@@ -523,38 +515,46 @@ status_to_message(u_int32_t status)
523static void 515static void
524send_status(u_int32_t id, u_int32_t status) 516send_status(u_int32_t id, u_int32_t status)
525{ 517{
526 Buffer msg; 518 struct sshbuf *msg;
519 int r;
527 520
528 debug3("request %u: sent status %u", id, status); 521 debug3("request %u: sent status %u", id, status);
529 if (log_level > SYSLOG_LEVEL_VERBOSE || 522 if (log_level > SYSLOG_LEVEL_VERBOSE ||
530 (status != SSH2_FX_OK && status != SSH2_FX_EOF)) 523 (status != SSH2_FX_OK && status != SSH2_FX_EOF))
531 logit("sent status %s", status_to_message(status)); 524 logit("sent status %s", status_to_message(status));
532 buffer_init(&msg); 525 if ((msg = sshbuf_new()) == NULL)
533 buffer_put_char(&msg, SSH2_FXP_STATUS); 526 fatal("%s: sshbuf_new failed", __func__);
534 buffer_put_int(&msg, id); 527 if ((r = sshbuf_put_u8(msg, SSH2_FXP_STATUS)) != 0 ||
535 buffer_put_int(&msg, status); 528 (r = sshbuf_put_u32(msg, id)) != 0 ||
529 (r = sshbuf_put_u32(msg, status)) != 0)
530 fatal("%s: buffer error: %s", __func__, ssh_err(r));
536 if (version >= 3) { 531 if (version >= 3) {
537 buffer_put_cstring(&msg, status_to_message(status)); 532 if ((r = sshbuf_put_cstring(msg,
538 buffer_put_cstring(&msg, ""); 533 status_to_message(status))) != 0 ||
534 (r = sshbuf_put_cstring(msg, "")) != 0)
535 fatal("%s: buffer error: %s", __func__, ssh_err(r));
539 } 536 }
540 send_msg(&msg); 537 send_msg(msg);
541 buffer_free(&msg); 538 sshbuf_free(msg);
542} 539}
543static void 540static void
544send_data_or_handle(char type, u_int32_t id, const char *data, int dlen) 541send_data_or_handle(char type, u_int32_t id, const u_char *data, int dlen)
545{ 542{
546 Buffer msg; 543 struct sshbuf *msg;
547 544 int r;
548 buffer_init(&msg); 545
549 buffer_put_char(&msg, type); 546 if ((msg = sshbuf_new()) == NULL)
550 buffer_put_int(&msg, id); 547 fatal("%s: sshbuf_new failed", __func__);
551 buffer_put_string(&msg, data, dlen); 548 if ((r = sshbuf_put_u8(msg, type)) != 0 ||
552 send_msg(&msg); 549 (r = sshbuf_put_u32(msg, id)) != 0 ||
553 buffer_free(&msg); 550 (r = sshbuf_put_string(msg, data, dlen)) != 0)
551 fatal("%s: buffer error: %s", __func__, ssh_err(r));
552 send_msg(msg);
553 sshbuf_free(msg);
554} 554}
555 555
556static void 556static void
557send_data(u_int32_t id, const char *data, int dlen) 557send_data(u_int32_t id, const u_char *data, int dlen)
558{ 558{
559 debug("request %u: sent data len %d", id, dlen); 559 debug("request %u: sent data len %d", id, dlen);
560 send_data_or_handle(SSH2_FXP_DATA, id, data, dlen); 560 send_data_or_handle(SSH2_FXP_DATA, id, data, dlen);
@@ -563,7 +563,7 @@ send_data(u_int32_t id, const char *data, int dlen)
563static void 563static void
564send_handle(u_int32_t id, int handle) 564send_handle(u_int32_t id, int handle)
565{ 565{
566 char *string; 566 u_char *string;
567 int hlen; 567 int hlen;
568 568
569 handle_to_string(handle, &string, &hlen); 569 handle_to_string(handle, &string, &hlen);
@@ -575,62 +575,71 @@ send_handle(u_int32_t id, int handle)
575static void 575static void
576send_names(u_int32_t id, int count, const Stat *stats) 576send_names(u_int32_t id, int count, const Stat *stats)
577{ 577{
578 Buffer msg; 578 struct sshbuf *msg;
579 int i; 579 int i, r;
580 580
581 buffer_init(&msg); 581 if ((msg = sshbuf_new()) == NULL)
582 buffer_put_char(&msg, SSH2_FXP_NAME); 582 fatal("%s: sshbuf_new failed", __func__);
583 buffer_put_int(&msg, id); 583 if ((r = sshbuf_put_u8(msg, SSH2_FXP_NAME)) != 0 ||
584 buffer_put_int(&msg, count); 584 (r = sshbuf_put_u32(msg, id)) != 0 ||
585 (r = sshbuf_put_u32(msg, count)) != 0)
586 fatal("%s: buffer error: %s", __func__, ssh_err(r));
585 debug("request %u: sent names count %d", id, count); 587 debug("request %u: sent names count %d", id, count);
586 for (i = 0; i < count; i++) { 588 for (i = 0; i < count; i++) {
587 buffer_put_cstring(&msg, stats[i].name); 589 if ((r = sshbuf_put_cstring(msg, stats[i].name)) != 0 ||
588 buffer_put_cstring(&msg, stats[i].long_name); 590 (r = sshbuf_put_cstring(msg, stats[i].long_name)) != 0 ||
589 encode_attrib(&msg, &stats[i].attrib); 591 (r = encode_attrib(msg, &stats[i].attrib)) != 0)
592 fatal("%s: buffer error: %s", __func__, ssh_err(r));
590 } 593 }
591 send_msg(&msg); 594 send_msg(msg);
592 buffer_free(&msg); 595 sshbuf_free(msg);
593} 596}
594 597
595static void 598static void
596send_attrib(u_int32_t id, const Attrib *a) 599send_attrib(u_int32_t id, const Attrib *a)
597{ 600{
598 Buffer msg; 601 struct sshbuf *msg;
602 int r;
599 603
600 debug("request %u: sent attrib have 0x%x", id, a->flags); 604 debug("request %u: sent attrib have 0x%x", id, a->flags);
601 buffer_init(&msg); 605 if ((msg = sshbuf_new()) == NULL)
602 buffer_put_char(&msg, SSH2_FXP_ATTRS); 606 fatal("%s: sshbuf_new failed", __func__);
603 buffer_put_int(&msg, id); 607 if ((r = sshbuf_put_u8(msg, SSH2_FXP_ATTRS)) != 0 ||
604 encode_attrib(&msg, a); 608 (r = sshbuf_put_u32(msg, id)) != 0 ||
605 send_msg(&msg); 609 (r = encode_attrib(msg, a)) != 0)
606 buffer_free(&msg); 610 fatal("%s: buffer error: %s", __func__, ssh_err(r));
611 send_msg(msg);
612 sshbuf_free(msg);
607} 613}
608 614
609static void 615static void
610send_statvfs(u_int32_t id, struct statvfs *st) 616send_statvfs(u_int32_t id, struct statvfs *st)
611{ 617{
612 Buffer msg; 618 struct sshbuf *msg;
613 u_int64_t flag; 619 u_int64_t flag;
620 int r;
614 621
615 flag = (st->f_flag & ST_RDONLY) ? SSH2_FXE_STATVFS_ST_RDONLY : 0; 622 flag = (st->f_flag & ST_RDONLY) ? SSH2_FXE_STATVFS_ST_RDONLY : 0;
616 flag |= (st->f_flag & ST_NOSUID) ? SSH2_FXE_STATVFS_ST_NOSUID : 0; 623 flag |= (st->f_flag & ST_NOSUID) ? SSH2_FXE_STATVFS_ST_NOSUID : 0;
617 624
618 buffer_init(&msg); 625 if ((msg = sshbuf_new()) == NULL)
619 buffer_put_char(&msg, SSH2_FXP_EXTENDED_REPLY); 626 fatal("%s: sshbuf_new failed", __func__);
620 buffer_put_int(&msg, id); 627 if ((r = sshbuf_put_u8(msg, SSH2_FXP_EXTENDED_REPLY)) != 0 ||
621 buffer_put_int64(&msg, st->f_bsize); 628 (r = sshbuf_put_u32(msg, id)) != 0 ||
622 buffer_put_int64(&msg, st->f_frsize); 629 (r = sshbuf_put_u64(msg, st->f_bsize)) != 0 ||
623 buffer_put_int64(&msg, st->f_blocks); 630 (r = sshbuf_put_u64(msg, st->f_frsize)) != 0 ||
624 buffer_put_int64(&msg, st->f_bfree); 631 (r = sshbuf_put_u64(msg, st->f_blocks)) != 0 ||
625 buffer_put_int64(&msg, st->f_bavail); 632 (r = sshbuf_put_u64(msg, st->f_bfree)) != 0 ||
626 buffer_put_int64(&msg, st->f_files); 633 (r = sshbuf_put_u64(msg, st->f_bavail)) != 0 ||
627 buffer_put_int64(&msg, st->f_ffree); 634 (r = sshbuf_put_u64(msg, st->f_files)) != 0 ||
628 buffer_put_int64(&msg, st->f_favail); 635 (r = sshbuf_put_u64(msg, st->f_ffree)) != 0 ||
629 buffer_put_int64(&msg, FSID_TO_ULONG(st->f_fsid)); 636 (r = sshbuf_put_u64(msg, st->f_favail)) != 0 ||
630 buffer_put_int64(&msg, flag); 637 (r = sshbuf_put_u64(msg, FSID_TO_ULONG(st->f_fsid))) != 0 ||
631 buffer_put_int64(&msg, st->f_namemax); 638 (r = sshbuf_put_u64(msg, flag)) != 0 ||
632 send_msg(&msg); 639 (r = sshbuf_put_u64(msg, st->f_namemax)) != 0)
633 buffer_free(&msg); 640 fatal("%s: buffer error: %s", __func__, ssh_err(r));
641 send_msg(msg);
642 sshbuf_free(msg);
634} 643}
635 644
636/* parse incoming */ 645/* parse incoming */
@@ -638,53 +647,59 @@ send_statvfs(u_int32_t id, struct statvfs *st)
638static void 647static void
639process_init(void) 648process_init(void)
640{ 649{
641 Buffer msg; 650 struct sshbuf *msg;
651 int r;
642 652
643 version = get_int(); 653 if ((r = sshbuf_get_u32(iqueue, &version)) != 0)
654 fatal("%s: buffer error: %s", __func__, ssh_err(r));
644 verbose("received client version %u", version); 655 verbose("received client version %u", version);
645 buffer_init(&msg); 656 if ((msg = sshbuf_new()) == NULL)
646 buffer_put_char(&msg, SSH2_FXP_VERSION); 657 fatal("%s: sshbuf_new failed", __func__);
647 buffer_put_int(&msg, SSH2_FILEXFER_VERSION); 658 if ((r = sshbuf_put_u8(msg, SSH2_FXP_VERSION)) != 0 ||
648 /* POSIX rename extension */ 659 (r = sshbuf_put_u32(msg, SSH2_FILEXFER_VERSION)) != 0 ||
649 buffer_put_cstring(&msg, "posix-rename@openssh.com"); 660 /* POSIX rename extension */
650 buffer_put_cstring(&msg, "1"); /* version */ 661 (r = sshbuf_put_cstring(msg, "posix-rename@openssh.com")) != 0 ||
651 /* statvfs extension */ 662 (r = sshbuf_put_cstring(msg, "1")) != 0 || /* version */
652 buffer_put_cstring(&msg, "statvfs@openssh.com"); 663 /* statvfs extension */
653 buffer_put_cstring(&msg, "2"); /* version */ 664 (r = sshbuf_put_cstring(msg, "statvfs@openssh.com")) != 0 ||
654 /* fstatvfs extension */ 665 (r = sshbuf_put_cstring(msg, "2")) != 0 || /* version */
655 buffer_put_cstring(&msg, "fstatvfs@openssh.com"); 666 /* fstatvfs extension */
656 buffer_put_cstring(&msg, "2"); /* version */ 667 (r = sshbuf_put_cstring(msg, "fstatvfs@openssh.com")) != 0 ||
657 /* hardlink extension */ 668 (r = sshbuf_put_cstring(msg, "2")) != 0 || /* version */
658 buffer_put_cstring(&msg, "hardlink@openssh.com"); 669 /* hardlink extension */
659 buffer_put_cstring(&msg, "1"); /* version */ 670 (r = sshbuf_put_cstring(msg, "hardlink@openssh.com")) != 0 ||
660 /* fsync extension */ 671 (r = sshbuf_put_cstring(msg, "1")) != 0 || /* version */
661 buffer_put_cstring(&msg, "fsync@openssh.com"); 672 /* fsync extension */
662 buffer_put_cstring(&msg, "1"); /* version */ 673 (r = sshbuf_put_cstring(msg, "fsync@openssh.com")) != 0 ||
663 send_msg(&msg); 674 (r = sshbuf_put_cstring(msg, "1")) != 0) /* version */
664 buffer_free(&msg); 675 fatal("%s: buffer error: %s", __func__, ssh_err(r));
676 send_msg(msg);
677 sshbuf_free(msg);
665} 678}
666 679
667static void 680static void
668process_open(u_int32_t id) 681process_open(u_int32_t id)
669{ 682{
670 u_int32_t pflags; 683 u_int32_t pflags;
671 Attrib *a; 684 Attrib a;
672 char *name; 685 char *name;
673 int handle, fd, flags, mode, status = SSH2_FX_FAILURE; 686 int r, handle, fd, flags, mode, status = SSH2_FX_FAILURE;
687
688 if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0 ||
689 (r = sshbuf_get_u32(iqueue, &pflags)) != 0 || /* portable flags */
690 (r = decode_attrib(iqueue, &a)) != 0)
691 fatal("%s: buffer error: %s", __func__, ssh_err(r));
674 692
675 name = get_string(NULL);
676 pflags = get_int(); /* portable flags */
677 debug3("request %u: open flags %d", id, pflags); 693 debug3("request %u: open flags %d", id, pflags);
678 a = get_attrib();
679 flags = flags_from_portable(pflags); 694 flags = flags_from_portable(pflags);
680 mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a->perm : 0666; 695 mode = (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a.perm : 0666;
681 logit("open \"%s\" flags %s mode 0%o", 696 logit("open \"%s\" flags %s mode 0%o",
682 name, string_from_portable(pflags), mode); 697 name, string_from_portable(pflags), mode);
683 if (readonly && 698 if (readonly &&
684 ((flags & O_ACCMODE) == O_WRONLY || 699 ((flags & O_ACCMODE) == O_WRONLY ||
685 (flags & O_ACCMODE) == O_RDWR)) { 700 (flags & O_ACCMODE) == O_RDWR)) {
686 verbose("Refusing open request in read-only mode"); 701 verbose("Refusing open request in read-only mode");
687 status = SSH2_FX_PERMISSION_DENIED; 702 status = SSH2_FX_PERMISSION_DENIED;
688 } else { 703 } else {
689 fd = open(name, flags, mode); 704 fd = open(name, flags, mode);
690 if (fd < 0) { 705 if (fd < 0) {
@@ -707,9 +722,11 @@ process_open(u_int32_t id)
707static void 722static void
708process_close(u_int32_t id) 723process_close(u_int32_t id)
709{ 724{
710 int handle, ret, status = SSH2_FX_FAILURE; 725 int r, handle, ret, status = SSH2_FX_FAILURE;
726
727 if ((r = get_handle(iqueue, &handle)) != 0)
728 fatal("%s: buffer error: %s", __func__, ssh_err(r));
711 729
712 handle = get_handle();
713 debug3("request %u: close handle %u", id, handle); 730 debug3("request %u: close handle %u", id, handle);
714 handle_log_close(handle, NULL); 731 handle_log_close(handle, NULL);
715 ret = handle_close(handle); 732 ret = handle_close(handle);
@@ -720,14 +737,15 @@ process_close(u_int32_t id)
720static void 737static void
721process_read(u_int32_t id) 738process_read(u_int32_t id)
722{ 739{
723 char buf[64*1024]; 740 u_char buf[64*1024];
724 u_int32_t len; 741 u_int32_t len;
725 int handle, fd, ret, status = SSH2_FX_FAILURE; 742 int r, handle, fd, ret, status = SSH2_FX_FAILURE;
726 u_int64_t off; 743 u_int64_t off;
727 744
728 handle = get_handle(); 745 if ((r = get_handle(iqueue, &handle)) != 0 ||
729 off = get_int64(); 746 (r = sshbuf_get_u64(iqueue, &off)) != 0 ||
730 len = get_int(); 747 (r = sshbuf_get_u32(iqueue, &len)) != 0)
748 fatal("%s: buffer error: %s", __func__, ssh_err(r));
731 749
732 debug("request %u: read \"%s\" (handle %d) off %llu len %d", 750 debug("request %u: read \"%s\" (handle %d) off %llu len %d",
733 id, handle_to_name(handle), handle, (unsigned long long)off, len); 751 id, handle_to_name(handle), handle, (unsigned long long)off, len);
@@ -761,18 +779,19 @@ static void
761process_write(u_int32_t id) 779process_write(u_int32_t id)
762{ 780{
763 u_int64_t off; 781 u_int64_t off;
764 u_int len; 782 size_t len;
765 int handle, fd, ret, status; 783 int r, handle, fd, ret, status;
766 char *data; 784 u_char *data;
767 785
768 handle = get_handle(); 786 if ((r = get_handle(iqueue, &handle)) != 0 ||
769 off = get_int64(); 787 (r = sshbuf_get_u64(iqueue, &off)) != 0 ||
770 data = get_string(&len); 788 (r = sshbuf_get_string(iqueue, &data, &len)) != 0)
789 fatal("%s: buffer error: %s", __func__, ssh_err(r));
771 790
772 debug("request %u: write \"%s\" (handle %d) off %llu len %d", 791 debug("request %u: write \"%s\" (handle %d) off %llu len %zu",
773 id, handle_to_name(handle), handle, (unsigned long long)off, len); 792 id, handle_to_name(handle), handle, (unsigned long long)off, len);
774 fd = handle_to_fd(handle); 793 fd = handle_to_fd(handle);
775 794
776 if (fd < 0) 795 if (fd < 0)
777 status = SSH2_FX_FAILURE; 796 status = SSH2_FX_FAILURE;
778 else { 797 else {
@@ -805,13 +824,15 @@ process_do_stat(u_int32_t id, int do_lstat)
805 Attrib a; 824 Attrib a;
806 struct stat st; 825 struct stat st;
807 char *name; 826 char *name;
808 int ret, status = SSH2_FX_FAILURE; 827 int r, status = SSH2_FX_FAILURE;
828
829 if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0)
830 fatal("%s: buffer error: %s", __func__, ssh_err(r));
809 831
810 name = get_string(NULL);
811 debug3("request %u: %sstat", id, do_lstat ? "l" : ""); 832 debug3("request %u: %sstat", id, do_lstat ? "l" : "");
812 verbose("%sstat name \"%s\"", do_lstat ? "l" : "", name); 833 verbose("%sstat name \"%s\"", do_lstat ? "l" : "", name);
813 ret = do_lstat ? lstat(name, &st) : stat(name, &st); 834 r = do_lstat ? lstat(name, &st) : stat(name, &st);
814 if (ret < 0) { 835 if (r < 0) {
815 status = errno_to_portable(errno); 836 status = errno_to_portable(errno);
816 } else { 837 } else {
817 stat_to_attrib(&st, &a); 838 stat_to_attrib(&st, &a);
@@ -840,15 +861,16 @@ process_fstat(u_int32_t id)
840{ 861{
841 Attrib a; 862 Attrib a;
842 struct stat st; 863 struct stat st;
843 int fd, ret, handle, status = SSH2_FX_FAILURE; 864 int fd, r, handle, status = SSH2_FX_FAILURE;
844 865
845 handle = get_handle(); 866 if ((r = get_handle(iqueue, &handle)) != 0)
867 fatal("%s: buffer error: %s", __func__, ssh_err(r));
846 debug("request %u: fstat \"%s\" (handle %u)", 868 debug("request %u: fstat \"%s\" (handle %u)",
847 id, handle_to_name(handle), handle); 869 id, handle_to_name(handle), handle);
848 fd = handle_to_fd(handle); 870 fd = handle_to_fd(handle);
849 if (fd >= 0) { 871 if (fd >= 0) {
850 ret = fstat(fd, &st); 872 r = fstat(fd, &st);
851 if (ret < 0) { 873 if (r < 0) {
852 status = errno_to_portable(errno); 874 status = errno_to_portable(errno);
853 } else { 875 } else {
854 stat_to_attrib(&st, &a); 876 stat_to_attrib(&st, &a);
@@ -875,42 +897,44 @@ attrib_to_tv(const Attrib *a)
875static void 897static void
876process_setstat(u_int32_t id) 898process_setstat(u_int32_t id)
877{ 899{
878 Attrib *a; 900 Attrib a;
879 char *name; 901 char *name;
880 int status = SSH2_FX_OK, ret; 902 int r, status = SSH2_FX_OK;
903
904 if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0 ||
905 (r = decode_attrib(iqueue, &a)) != 0)
906 fatal("%s: buffer error: %s", __func__, ssh_err(r));
881 907
882 name = get_string(NULL);
883 a = get_attrib();
884 debug("request %u: setstat name \"%s\"", id, name); 908 debug("request %u: setstat name \"%s\"", id, name);
885 if (a->flags & SSH2_FILEXFER_ATTR_SIZE) { 909 if (a.flags & SSH2_FILEXFER_ATTR_SIZE) {
886 logit("set \"%s\" size %llu", 910 logit("set \"%s\" size %llu",
887 name, (unsigned long long)a->size); 911 name, (unsigned long long)a.size);
888 ret = truncate(name, a->size); 912 r = truncate(name, a.size);
889 if (ret == -1) 913 if (r == -1)
890 status = errno_to_portable(errno); 914 status = errno_to_portable(errno);
891 } 915 }
892 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { 916 if (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
893 logit("set \"%s\" mode %04o", name, a->perm); 917 logit("set \"%s\" mode %04o", name, a.perm);
894 ret = chmod(name, a->perm & 07777); 918 r = chmod(name, a.perm & 07777);
895 if (ret == -1) 919 if (r == -1)
896 status = errno_to_portable(errno); 920 status = errno_to_portable(errno);
897 } 921 }
898 if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) { 922 if (a.flags & SSH2_FILEXFER_ATTR_ACMODTIME) {
899 char buf[64]; 923 char buf[64];
900 time_t t = a->mtime; 924 time_t t = a.mtime;
901 925
902 strftime(buf, sizeof(buf), "%Y%m%d-%H:%M:%S", 926 strftime(buf, sizeof(buf), "%Y%m%d-%H:%M:%S",
903 localtime(&t)); 927 localtime(&t));
904 logit("set \"%s\" modtime %s", name, buf); 928 logit("set \"%s\" modtime %s", name, buf);
905 ret = utimes(name, attrib_to_tv(a)); 929 r = utimes(name, attrib_to_tv(&a));
906 if (ret == -1) 930 if (r == -1)
907 status = errno_to_portable(errno); 931 status = errno_to_portable(errno);
908 } 932 }
909 if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { 933 if (a.flags & SSH2_FILEXFER_ATTR_UIDGID) {
910 logit("set \"%s\" owner %lu group %lu", name, 934 logit("set \"%s\" owner %lu group %lu", name,
911 (u_long)a->uid, (u_long)a->gid); 935 (u_long)a.uid, (u_long)a.gid);
912 ret = chown(name, a->uid, a->gid); 936 r = chown(name, a.uid, a.gid);
913 if (ret == -1) 937 if (r == -1)
914 status = errno_to_portable(errno); 938 status = errno_to_portable(errno);
915 } 939 }
916 send_status(id, status); 940 send_status(id, status);
@@ -920,12 +944,14 @@ process_setstat(u_int32_t id)
920static void 944static void
921process_fsetstat(u_int32_t id) 945process_fsetstat(u_int32_t id)
922{ 946{
923 Attrib *a; 947 Attrib a;
924 int handle, fd, ret; 948 int handle, fd, r;
925 int status = SSH2_FX_OK; 949 int status = SSH2_FX_OK;
926 950
927 handle = get_handle(); 951 if ((r = get_handle(iqueue, &handle)) != 0 ||
928 a = get_attrib(); 952 (r = decode_attrib(iqueue, &a)) != 0)
953 fatal("%s: buffer error: %s", __func__, ssh_err(r));
954
929 debug("request %u: fsetstat handle %d", id, handle); 955 debug("request %u: fsetstat handle %d", id, handle);
930 fd = handle_to_fd(handle); 956 fd = handle_to_fd(handle);
931 if (fd < 0) 957 if (fd < 0)
@@ -933,47 +959,47 @@ process_fsetstat(u_int32_t id)
933 else { 959 else {
934 char *name = handle_to_name(handle); 960 char *name = handle_to_name(handle);
935 961
936 if (a->flags & SSH2_FILEXFER_ATTR_SIZE) { 962 if (a.flags & SSH2_FILEXFER_ATTR_SIZE) {
937 logit("set \"%s\" size %llu", 963 logit("set \"%s\" size %llu",
938 name, (unsigned long long)a->size); 964 name, (unsigned long long)a.size);
939 ret = ftruncate(fd, a->size); 965 r = ftruncate(fd, a.size);
940 if (ret == -1) 966 if (r == -1)
941 status = errno_to_portable(errno); 967 status = errno_to_portable(errno);
942 } 968 }
943 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { 969 if (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
944 logit("set \"%s\" mode %04o", name, a->perm); 970 logit("set \"%s\" mode %04o", name, a.perm);
945#ifdef HAVE_FCHMOD 971#ifdef HAVE_FCHMOD
946 ret = fchmod(fd, a->perm & 07777); 972 r = fchmod(fd, a.perm & 07777);
947#else 973#else
948 ret = chmod(name, a->perm & 07777); 974 r = chmod(name, a.perm & 07777);
949#endif 975#endif
950 if (ret == -1) 976 if (r == -1)
951 status = errno_to_portable(errno); 977 status = errno_to_portable(errno);
952 } 978 }
953 if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) { 979 if (a.flags & SSH2_FILEXFER_ATTR_ACMODTIME) {
954 char buf[64]; 980 char buf[64];
955 time_t t = a->mtime; 981 time_t t = a.mtime;
956 982
957 strftime(buf, sizeof(buf), "%Y%m%d-%H:%M:%S", 983 strftime(buf, sizeof(buf), "%Y%m%d-%H:%M:%S",
958 localtime(&t)); 984 localtime(&t));
959 logit("set \"%s\" modtime %s", name, buf); 985 logit("set \"%s\" modtime %s", name, buf);
960#ifdef HAVE_FUTIMES 986#ifdef HAVE_FUTIMES
961 ret = futimes(fd, attrib_to_tv(a)); 987 r = futimes(fd, attrib_to_tv(&a));
962#else 988#else
963 ret = utimes(name, attrib_to_tv(a)); 989 r = utimes(name, attrib_to_tv(&a));
964#endif 990#endif
965 if (ret == -1) 991 if (r == -1)
966 status = errno_to_portable(errno); 992 status = errno_to_portable(errno);
967 } 993 }
968 if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { 994 if (a.flags & SSH2_FILEXFER_ATTR_UIDGID) {
969 logit("set \"%s\" owner %lu group %lu", name, 995 logit("set \"%s\" owner %lu group %lu", name,
970 (u_long)a->uid, (u_long)a->gid); 996 (u_long)a.uid, (u_long)a.gid);
971#ifdef HAVE_FCHOWN 997#ifdef HAVE_FCHOWN
972 ret = fchown(fd, a->uid, a->gid); 998 r = fchown(fd, a.uid, a.gid);
973#else 999#else
974 ret = chown(name, a->uid, a->gid); 1000 r = chown(name, a.uid, a.gid);
975#endif 1001#endif
976 if (ret == -1) 1002 if (r == -1)
977 status = errno_to_portable(errno); 1003 status = errno_to_portable(errno);
978 } 1004 }
979 } 1005 }
@@ -985,9 +1011,11 @@ process_opendir(u_int32_t id)
985{ 1011{
986 DIR *dirp = NULL; 1012 DIR *dirp = NULL;
987 char *path; 1013 char *path;
988 int handle, status = SSH2_FX_FAILURE; 1014 int r, handle, status = SSH2_FX_FAILURE;
1015
1016 if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0)
1017 fatal("%s: buffer error: %s", __func__, ssh_err(r));
989 1018
990 path = get_string(NULL);
991 debug3("request %u: opendir", id); 1019 debug3("request %u: opendir", id);
992 logit("opendir \"%s\"", path); 1020 logit("opendir \"%s\"", path);
993 dirp = opendir(path); 1021 dirp = opendir(path);
@@ -1014,9 +1042,11 @@ process_readdir(u_int32_t id)
1014 DIR *dirp; 1042 DIR *dirp;
1015 struct dirent *dp; 1043 struct dirent *dp;
1016 char *path; 1044 char *path;
1017 int handle; 1045 int r, handle;
1046
1047 if ((r = get_handle(iqueue, &handle)) != 0)
1048 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1018 1049
1019 handle = get_handle();
1020 debug("request %u: readdir \"%s\" (handle %d)", id, 1050 debug("request %u: readdir \"%s\" (handle %d)", id,
1021 handle_to_name(handle), handle); 1051 handle_to_name(handle), handle);
1022 dirp = handle_to_dir(handle); 1052 dirp = handle_to_dir(handle);
@@ -1025,7 +1055,7 @@ process_readdir(u_int32_t id)
1025 send_status(id, SSH2_FX_FAILURE); 1055 send_status(id, SSH2_FX_FAILURE);
1026 } else { 1056 } else {
1027 struct stat st; 1057 struct stat st;
1028 char pathname[MAXPATHLEN]; 1058 char pathname[PATH_MAX];
1029 Stat *stats; 1059 Stat *stats;
1030 int nstats = 10, count = 0, i; 1060 int nstats = 10, count = 0, i;
1031 1061
@@ -1066,14 +1096,15 @@ static void
1066process_remove(u_int32_t id) 1096process_remove(u_int32_t id)
1067{ 1097{
1068 char *name; 1098 char *name;
1069 int status = SSH2_FX_FAILURE; 1099 int r, status = SSH2_FX_FAILURE;
1070 int ret; 1100
1101 if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0)
1102 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1071 1103
1072 name = get_string(NULL);
1073 debug3("request %u: remove", id); 1104 debug3("request %u: remove", id);
1074 logit("remove name \"%s\"", name); 1105 logit("remove name \"%s\"", name);
1075 ret = unlink(name); 1106 r = unlink(name);
1076 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; 1107 status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
1077 send_status(id, status); 1108 send_status(id, status);
1078 free(name); 1109 free(name);
1079} 1110}
@@ -1081,18 +1112,20 @@ process_remove(u_int32_t id)
1081static void 1112static void
1082process_mkdir(u_int32_t id) 1113process_mkdir(u_int32_t id)
1083{ 1114{
1084 Attrib *a; 1115 Attrib a;
1085 char *name; 1116 char *name;
1086 int ret, mode, status = SSH2_FX_FAILURE; 1117 int r, mode, status = SSH2_FX_FAILURE;
1118
1119 if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0 ||
1120 (r = decode_attrib(iqueue, &a)) != 0)
1121 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1087 1122
1088 name = get_string(NULL); 1123 mode = (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ?
1089 a = get_attrib(); 1124 a.perm & 07777 : 0777;
1090 mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ?
1091 a->perm & 07777 : 0777;
1092 debug3("request %u: mkdir", id); 1125 debug3("request %u: mkdir", id);
1093 logit("mkdir name \"%s\" mode 0%o", name, mode); 1126 logit("mkdir name \"%s\" mode 0%o", name, mode);
1094 ret = mkdir(name, mode); 1127 r = mkdir(name, mode);
1095 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; 1128 status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
1096 send_status(id, status); 1129 send_status(id, status);
1097 free(name); 1130 free(name);
1098} 1131}
@@ -1101,13 +1134,15 @@ static void
1101process_rmdir(u_int32_t id) 1134process_rmdir(u_int32_t id)
1102{ 1135{
1103 char *name; 1136 char *name;
1104 int ret, status; 1137 int r, status;
1138
1139 if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0)
1140 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1105 1141
1106 name = get_string(NULL);
1107 debug3("request %u: rmdir", id); 1142 debug3("request %u: rmdir", id);
1108 logit("rmdir name \"%s\"", name); 1143 logit("rmdir name \"%s\"", name);
1109 ret = rmdir(name); 1144 r = rmdir(name);
1110 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; 1145 status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
1111 send_status(id, status); 1146 send_status(id, status);
1112 free(name); 1147 free(name);
1113} 1148}
@@ -1115,10 +1150,13 @@ process_rmdir(u_int32_t id)
1115static void 1150static void
1116process_realpath(u_int32_t id) 1151process_realpath(u_int32_t id)
1117{ 1152{
1118 char resolvedname[MAXPATHLEN]; 1153 char resolvedname[PATH_MAX];
1119 char *path; 1154 char *path;
1155 int r;
1156
1157 if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0)
1158 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1120 1159
1121 path = get_string(NULL);
1122 if (path[0] == '\0') { 1160 if (path[0] == '\0') {
1123 free(path); 1161 free(path);
1124 path = xstrdup("."); 1162 path = xstrdup(".");
@@ -1140,11 +1178,13 @@ static void
1140process_rename(u_int32_t id) 1178process_rename(u_int32_t id)
1141{ 1179{
1142 char *oldpath, *newpath; 1180 char *oldpath, *newpath;
1143 int status; 1181 int r, status;
1144 struct stat sb; 1182 struct stat sb;
1145 1183
1146 oldpath = get_string(NULL); 1184 if ((r = sshbuf_get_cstring(iqueue, &oldpath, NULL)) != 0 ||
1147 newpath = get_string(NULL); 1185 (r = sshbuf_get_cstring(iqueue, &newpath, NULL)) != 0)
1186 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1187
1148 debug3("request %u: rename", id); 1188 debug3("request %u: rename", id);
1149 logit("rename old \"%s\" new \"%s\"", oldpath, newpath); 1189 logit("rename old \"%s\" new \"%s\"", oldpath, newpath);
1150 status = SSH2_FX_FAILURE; 1190 status = SSH2_FX_FAILURE;
@@ -1197,11 +1237,13 @@ process_rename(u_int32_t id)
1197static void 1237static void
1198process_readlink(u_int32_t id) 1238process_readlink(u_int32_t id)
1199{ 1239{
1200 int len; 1240 int r, len;
1201 char buf[MAXPATHLEN]; 1241 char buf[PATH_MAX];
1202 char *path; 1242 char *path;
1203 1243
1204 path = get_string(NULL); 1244 if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0)
1245 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1246
1205 debug3("request %u: readlink", id); 1247 debug3("request %u: readlink", id);
1206 verbose("readlink \"%s\"", path); 1248 verbose("readlink \"%s\"", path);
1207 if ((len = readlink(path, buf, sizeof(buf) - 1)) == -1) 1249 if ((len = readlink(path, buf, sizeof(buf) - 1)) == -1)
@@ -1221,15 +1263,17 @@ static void
1221process_symlink(u_int32_t id) 1263process_symlink(u_int32_t id)
1222{ 1264{
1223 char *oldpath, *newpath; 1265 char *oldpath, *newpath;
1224 int ret, status; 1266 int r, status;
1267
1268 if ((r = sshbuf_get_cstring(iqueue, &oldpath, NULL)) != 0 ||
1269 (r = sshbuf_get_cstring(iqueue, &newpath, NULL)) != 0)
1270 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1225 1271
1226 oldpath = get_string(NULL);
1227 newpath = get_string(NULL);
1228 debug3("request %u: symlink", id); 1272 debug3("request %u: symlink", id);
1229 logit("symlink old \"%s\" new \"%s\"", oldpath, newpath); 1273 logit("symlink old \"%s\" new \"%s\"", oldpath, newpath);
1230 /* this will fail if 'newpath' exists */ 1274 /* this will fail if 'newpath' exists */
1231 ret = symlink(oldpath, newpath); 1275 r = symlink(oldpath, newpath);
1232 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; 1276 status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
1233 send_status(id, status); 1277 send_status(id, status);
1234 free(oldpath); 1278 free(oldpath);
1235 free(newpath); 1279 free(newpath);
@@ -1239,14 +1283,16 @@ static void
1239process_extended_posix_rename(u_int32_t id) 1283process_extended_posix_rename(u_int32_t id)
1240{ 1284{
1241 char *oldpath, *newpath; 1285 char *oldpath, *newpath;
1242 int ret, status; 1286 int r, status;
1287
1288 if ((r = sshbuf_get_cstring(iqueue, &oldpath, NULL)) != 0 ||
1289 (r = sshbuf_get_cstring(iqueue, &newpath, NULL)) != 0)
1290 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1243 1291
1244 oldpath = get_string(NULL);
1245 newpath = get_string(NULL);
1246 debug3("request %u: posix-rename", id); 1292 debug3("request %u: posix-rename", id);
1247 logit("posix-rename old \"%s\" new \"%s\"", oldpath, newpath); 1293 logit("posix-rename old \"%s\" new \"%s\"", oldpath, newpath);
1248 ret = rename(oldpath, newpath); 1294 r = rename(oldpath, newpath);
1249 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; 1295 status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
1250 send_status(id, status); 1296 send_status(id, status);
1251 free(oldpath); 1297 free(oldpath);
1252 free(newpath); 1298 free(newpath);
@@ -1257,8 +1303,10 @@ process_extended_statvfs(u_int32_t id)
1257{ 1303{
1258 char *path; 1304 char *path;
1259 struct statvfs st; 1305 struct statvfs st;
1306 int r;
1260 1307
1261 path = get_string(NULL); 1308 if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0)
1309 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1262 debug3("request %u: statvfs", id); 1310 debug3("request %u: statvfs", id);
1263 logit("statvfs \"%s\"", path); 1311 logit("statvfs \"%s\"", path);
1264 1312
@@ -1272,10 +1320,11 @@ process_extended_statvfs(u_int32_t id)
1272static void 1320static void
1273process_extended_fstatvfs(u_int32_t id) 1321process_extended_fstatvfs(u_int32_t id)
1274{ 1322{
1275 int handle, fd; 1323 int r, handle, fd;
1276 struct statvfs st; 1324 struct statvfs st;
1277 1325
1278 handle = get_handle(); 1326 if ((r = get_handle(iqueue, &handle)) != 0)
1327 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1279 debug("request %u: fstatvfs \"%s\" (handle %u)", 1328 debug("request %u: fstatvfs \"%s\" (handle %u)",
1280 id, handle_to_name(handle), handle); 1329 id, handle_to_name(handle), handle);
1281 if ((fd = handle_to_fd(handle)) < 0) { 1330 if ((fd = handle_to_fd(handle)) < 0) {
@@ -1292,14 +1341,16 @@ static void
1292process_extended_hardlink(u_int32_t id) 1341process_extended_hardlink(u_int32_t id)
1293{ 1342{
1294 char *oldpath, *newpath; 1343 char *oldpath, *newpath;
1295 int ret, status; 1344 int r, status;
1345
1346 if ((r = sshbuf_get_cstring(iqueue, &oldpath, NULL)) != 0 ||
1347 (r = sshbuf_get_cstring(iqueue, &newpath, NULL)) != 0)
1348 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1296 1349
1297 oldpath = get_string(NULL);
1298 newpath = get_string(NULL);
1299 debug3("request %u: hardlink", id); 1350 debug3("request %u: hardlink", id);
1300 logit("hardlink old \"%s\" new \"%s\"", oldpath, newpath); 1351 logit("hardlink old \"%s\" new \"%s\"", oldpath, newpath);
1301 ret = link(oldpath, newpath); 1352 r = link(oldpath, newpath);
1302 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; 1353 status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
1303 send_status(id, status); 1354 send_status(id, status);
1304 free(oldpath); 1355 free(oldpath);
1305 free(newpath); 1356 free(newpath);
@@ -1308,16 +1359,17 @@ process_extended_hardlink(u_int32_t id)
1308static void 1359static void
1309process_extended_fsync(u_int32_t id) 1360process_extended_fsync(u_int32_t id)
1310{ 1361{
1311 int handle, fd, ret, status = SSH2_FX_OP_UNSUPPORTED; 1362 int handle, fd, r, status = SSH2_FX_OP_UNSUPPORTED;
1312 1363
1313 handle = get_handle(); 1364 if ((r = get_handle(iqueue, &handle)) != 0)
1365 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1314 debug3("request %u: fsync (handle %u)", id, handle); 1366 debug3("request %u: fsync (handle %u)", id, handle);
1315 verbose("fsync \"%s\"", handle_to_name(handle)); 1367 verbose("fsync \"%s\"", handle_to_name(handle));
1316 if ((fd = handle_to_fd(handle)) < 0) 1368 if ((fd = handle_to_fd(handle)) < 0)
1317 status = SSH2_FX_NO_SUCH_FILE; 1369 status = SSH2_FX_NO_SUCH_FILE;
1318 else if (handle_is_ok(handle, HANDLE_FILE)) { 1370 else if (handle_is_ok(handle, HANDLE_FILE)) {
1319 ret = fsync(fd); 1371 r = fsync(fd);
1320 status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; 1372 status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK;
1321 } 1373 }
1322 send_status(id, status); 1374 send_status(id, status);
1323} 1375}
@@ -1326,9 +1378,10 @@ static void
1326process_extended(u_int32_t id) 1378process_extended(u_int32_t id)
1327{ 1379{
1328 char *request; 1380 char *request;
1329 u_int i; 1381 int i, r;
1330 1382
1331 request = get_string(NULL); 1383 if ((r = sshbuf_get_cstring(iqueue, &request, NULL)) != 0)
1384 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1332 for (i = 0; extended_handlers[i].handler != NULL; i++) { 1385 for (i = 0; extended_handlers[i].handler != NULL; i++) {
1333 if (strcmp(request, extended_handlers[i].ext_name) == 0) { 1386 if (strcmp(request, extended_handlers[i].ext_name) == 0) {
1334 if (!request_permitted(&extended_handlers[i])) 1387 if (!request_permitted(&extended_handlers[i]))
@@ -1350,14 +1403,18 @@ process_extended(u_int32_t id)
1350static void 1403static void
1351process(void) 1404process(void)
1352{ 1405{
1353 u_int msg_len, buf_len, consumed, type, i; 1406 u_int msg_len;
1354 u_char *cp; 1407 u_int buf_len;
1408 u_int consumed;
1409 u_char type;
1410 const u_char *cp;
1411 int i, r;
1355 u_int32_t id; 1412 u_int32_t id;
1356 1413
1357 buf_len = buffer_len(&iqueue); 1414 buf_len = sshbuf_len(iqueue);
1358 if (buf_len < 5) 1415 if (buf_len < 5)
1359 return; /* Incomplete message. */ 1416 return; /* Incomplete message. */
1360 cp = buffer_ptr(&iqueue); 1417 cp = sshbuf_ptr(iqueue);
1361 msg_len = get_u32(cp); 1418 msg_len = get_u32(cp);
1362 if (msg_len > SFTP_MAX_MSG_LENGTH) { 1419 if (msg_len > SFTP_MAX_MSG_LENGTH) {
1363 error("bad message from %s local user %s", 1420 error("bad message from %s local user %s",
@@ -1366,9 +1423,11 @@ process(void)
1366 } 1423 }
1367 if (buf_len < msg_len + 4) 1424 if (buf_len < msg_len + 4)
1368 return; 1425 return;
1369 buffer_consume(&iqueue, 4); 1426 if ((r = sshbuf_consume(iqueue, 4)) != 0)
1427 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1370 buf_len -= 4; 1428 buf_len -= 4;
1371 type = buffer_get_char(&iqueue); 1429 if ((r = sshbuf_get_u8(iqueue, &type)) != 0)
1430 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1372 1431
1373 switch (type) { 1432 switch (type) {
1374 case SSH2_FXP_INIT: 1433 case SSH2_FXP_INIT:
@@ -1378,13 +1437,15 @@ process(void)
1378 case SSH2_FXP_EXTENDED: 1437 case SSH2_FXP_EXTENDED:
1379 if (!init_done) 1438 if (!init_done)
1380 fatal("Received extended request before init"); 1439 fatal("Received extended request before init");
1381 id = get_int(); 1440 if ((r = sshbuf_get_u32(iqueue, &id)) != 0)
1441 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1382 process_extended(id); 1442 process_extended(id);
1383 break; 1443 break;
1384 default: 1444 default:
1385 if (!init_done) 1445 if (!init_done)
1386 fatal("Received %u request before init", type); 1446 fatal("Received %u request before init", type);
1387 id = get_int(); 1447 if ((r = sshbuf_get_u32(iqueue, &id)) != 0)
1448 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1388 for (i = 0; handlers[i].handler != NULL; i++) { 1449 for (i = 0; handlers[i].handler != NULL; i++) {
1389 if (type == handlers[i].type) { 1450 if (type == handlers[i].type) {
1390 if (!request_permitted(&handlers[i])) { 1451 if (!request_permitted(&handlers[i])) {
@@ -1400,17 +1461,18 @@ process(void)
1400 error("Unknown message %u", type); 1461 error("Unknown message %u", type);
1401 } 1462 }
1402 /* discard the remaining bytes from the current packet */ 1463 /* discard the remaining bytes from the current packet */
1403 if (buf_len < buffer_len(&iqueue)) { 1464 if (buf_len < sshbuf_len(iqueue)) {
1404 error("iqueue grew unexpectedly"); 1465 error("iqueue grew unexpectedly");
1405 sftp_server_cleanup_exit(255); 1466 sftp_server_cleanup_exit(255);
1406 } 1467 }
1407 consumed = buf_len - buffer_len(&iqueue); 1468 consumed = buf_len - sshbuf_len(iqueue);
1408 if (msg_len < consumed) { 1469 if (msg_len < consumed) {
1409 error("msg_len %u < consumed %u", msg_len, consumed); 1470 error("msg_len %u < consumed %u", msg_len, consumed);
1410 sftp_server_cleanup_exit(255); 1471 sftp_server_cleanup_exit(255);
1411 } 1472 }
1412 if (msg_len > consumed) 1473 if (msg_len > consumed &&
1413 buffer_consume(&iqueue, msg_len - consumed); 1474 (r = sshbuf_consume(iqueue, msg_len - consumed)) != 0)
1475 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1414} 1476}
1415 1477
1416/* Cleanup handler that logs active handles upon normal exit */ 1478/* Cleanup handler that logs active handles upon normal exit */
@@ -1443,7 +1505,7 @@ int
1443sftp_server_main(int argc, char **argv, struct passwd *user_pw) 1505sftp_server_main(int argc, char **argv, struct passwd *user_pw)
1444{ 1506{
1445 fd_set *rset, *wset; 1507 fd_set *rset, *wset;
1446 int i, in, out, max, ch, skipargs = 0, log_stderr = 0; 1508 int i, r, in, out, max, ch, skipargs = 0, log_stderr = 0;
1447 ssize_t len, olen, set_size; 1509 ssize_t len, olen, set_size;
1448 SyslogFacility log_facility = SYSLOG_FACILITY_AUTH; 1510 SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
1449 char *cp, *homedir = NULL, buf[4*4096]; 1511 char *cp, *homedir = NULL, buf[4*4096];
@@ -1565,8 +1627,10 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
1565 if (out > max) 1627 if (out > max)
1566 max = out; 1628 max = out;
1567 1629
1568 buffer_init(&iqueue); 1630 if ((iqueue = sshbuf_new()) == NULL)
1569 buffer_init(&oqueue); 1631 fatal("%s: sshbuf_new failed", __func__);
1632 if ((oqueue = sshbuf_new()) == NULL)
1633 fatal("%s: sshbuf_new failed", __func__);
1570 1634
1571 set_size = howmany(max + 1, NFDBITS) * sizeof(fd_mask); 1635 set_size = howmany(max + 1, NFDBITS) * sizeof(fd_mask);
1572 rset = (fd_set *)xmalloc(set_size); 1636 rset = (fd_set *)xmalloc(set_size);
@@ -1588,11 +1652,15 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
1588 * the worst-case length packet it can generate, 1652 * the worst-case length packet it can generate,
1589 * otherwise apply backpressure by stopping reads. 1653 * otherwise apply backpressure by stopping reads.
1590 */ 1654 */
1591 if (buffer_check_alloc(&iqueue, sizeof(buf)) && 1655 if ((r = sshbuf_check_reserve(iqueue, sizeof(buf))) == 0 &&
1592 buffer_check_alloc(&oqueue, SFTP_MAX_MSG_LENGTH)) 1656 (r = sshbuf_check_reserve(oqueue,
1657 SFTP_MAX_MSG_LENGTH)) == 0)
1593 FD_SET(in, rset); 1658 FD_SET(in, rset);
1659 else if (r != SSH_ERR_NO_BUFFER_SPACE)
1660 fatal("%s: sshbuf_check_reserve failed: %s",
1661 __func__, ssh_err(r));
1594 1662
1595 olen = buffer_len(&oqueue); 1663 olen = sshbuf_len(oqueue);
1596 if (olen > 0) 1664 if (olen > 0)
1597 FD_SET(out, wset); 1665 FD_SET(out, wset);
1598 1666
@@ -1612,18 +1680,20 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
1612 } else if (len < 0) { 1680 } else if (len < 0) {
1613 error("read: %s", strerror(errno)); 1681 error("read: %s", strerror(errno));
1614 sftp_server_cleanup_exit(1); 1682 sftp_server_cleanup_exit(1);
1615 } else { 1683 } else if ((r = sshbuf_put(iqueue, buf, len)) != 0) {
1616 buffer_append(&iqueue, buf, len); 1684 fatal("%s: buffer error: %s",
1685 __func__, ssh_err(r));
1617 } 1686 }
1618 } 1687 }
1619 /* send oqueue to stdout */ 1688 /* send oqueue to stdout */
1620 if (FD_ISSET(out, wset)) { 1689 if (FD_ISSET(out, wset)) {
1621 len = write(out, buffer_ptr(&oqueue), olen); 1690 len = write(out, sshbuf_ptr(oqueue), olen);
1622 if (len < 0) { 1691 if (len < 0) {
1623 error("write: %s", strerror(errno)); 1692 error("write: %s", strerror(errno));
1624 sftp_server_cleanup_exit(1); 1693 sftp_server_cleanup_exit(1);
1625 } else { 1694 } else if ((r = sshbuf_consume(oqueue, len)) != 0) {
1626 buffer_consume(&oqueue, len); 1695 fatal("%s: buffer error: %s",
1696 __func__, ssh_err(r));
1627 } 1697 }
1628 } 1698 }
1629 1699
@@ -1632,7 +1702,11 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
1632 * into the output buffer, otherwise stop processing input 1702 * into the output buffer, otherwise stop processing input
1633 * and let the output queue drain. 1703 * and let the output queue drain.
1634 */ 1704 */
1635 if (buffer_check_alloc(&oqueue, SFTP_MAX_MSG_LENGTH)) 1705 r = sshbuf_check_reserve(oqueue, SFTP_MAX_MSG_LENGTH);
1706 if (r == 0)
1636 process(); 1707 process();
1708 else if (r != SSH_ERR_NO_BUFFER_SPACE)
1709 fatal("%s: sshbuf_check_reserve: %s",
1710 __func__, ssh_err(r));
1637 } 1711 }
1638} 1712}
diff --git a/sftp.0 b/sftp.0
index e37043455..24fd9916d 100644
--- a/sftp.0
+++ b/sftp.0
@@ -1,7 +1,7 @@
1SFTP(1) General Commands Manual SFTP(1) 1SFTP(1) General Commands Manual SFTP(1)
2 2
3NAME 3NAME
4 sftp - secure file transfer program 4 sftp M-bM-^@M-^S secure file transfer program
5 5
6SYNOPSIS 6SYNOPSIS
7 sftp [-1246aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher] 7 sftp [-1246aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
@@ -58,12 +58,12 @@ DESCRIPTION
58 Batch mode reads a series of commands from an input batchfile 58 Batch mode reads a series of commands from an input batchfile
59 instead of stdin. Since it lacks user interaction it should be 59 instead of stdin. Since it lacks user interaction it should be
60 used in conjunction with non-interactive authentication. A 60 used in conjunction with non-interactive authentication. A
61 batchfile of `-' may be used to indicate standard input. sftp 61 batchfile of M-bM-^@M-^X-M-bM-^@M-^Y may be used to indicate standard input. sftp
62 will abort if any of the following commands fail: get, put, 62 will abort if any of the following commands fail: get, put,
63 reget, reput, rename, ln, rm, mkdir, chdir, ls, lchdir, chmod, 63 reget, reput, rename, ln, rm, mkdir, chdir, ls, lchdir, chmod,
64 chown, chgrp, lpwd, df, symlink, and lmkdir. Termination on 64 chown, chgrp, lpwd, df, symlink, and lmkdir. Termination on
65 error can be suppressed on a command by command basis by 65 error can be suppressed on a command by command basis by
66 prefixing the command with a `-' character (for example, -rm 66 prefixing the command with a M-bM-^@M-^X-M-bM-^@M-^Y character (for example, -rm
67 /tmp/blah*). 67 /tmp/blah*).
68 68
69 -C Enables compression (via ssh's -C flag). 69 -C Enables compression (via ssh's -C flag).
@@ -125,6 +125,7 @@ DESCRIPTION
125 HashKnownHosts 125 HashKnownHosts
126 Host 126 Host
127 HostbasedAuthentication 127 HostbasedAuthentication
128 HostbasedKeyTypes
128 HostKeyAlgorithms 129 HostKeyAlgorithms
129 HostKeyAlias 130 HostKeyAlias
130 HostName 131 HostName
@@ -153,6 +154,7 @@ DESCRIPTION
153 ServerAliveCountMax 154 ServerAliveCountMax
154 StrictHostKeyChecking 155 StrictHostKeyChecking
155 TCPKeepAlive 156 TCPKeepAlive
157 UpdateHostKeys
156 UsePrivilegedPort 158 UsePrivilegedPort
157 User 159 User
158 UserKnownHostsFile 160 UserKnownHostsFile
@@ -193,7 +195,7 @@ INTERACTIVE COMMANDS
193 those of ftp(1). Commands are case insensitive. Pathnames that contain 195 those of ftp(1). Commands are case insensitive. Pathnames that contain
194 spaces must be enclosed in quotes. Any special characters contained 196 spaces must be enclosed in quotes. Any special characters contained
195 within pathnames that are recognized by glob(3) must be escaped with 197 within pathnames that are recognized by glob(3) must be escaped with
196 backslashes (`\'). 198 backslashes (M-bM-^@M-^X\M-bM-^@M-^Y).
197 199
198 bye Quit sftp. 200 bye Quit sftp.
199 201
@@ -220,7 +222,7 @@ INTERACTIVE COMMANDS
220 the capacity information will be displayed using "human-readable" 222 the capacity information will be displayed using "human-readable"
221 suffixes. The -i flag requests display of inode information in 223 suffixes. The -i flag requests display of inode information in
222 addition to capacity information. This command is only supported 224 addition to capacity information. This command is only supported
223 on servers that implement the ``statvfs@openssh.com'' extension. 225 on servers that implement the M-bM-^@M-^\statvfs@openssh.comM-bM-^@M-^] extension.
224 226
225 exit Quit sftp. 227 exit Quit sftp.
226 228
@@ -279,7 +281,7 @@ INTERACTIVE COMMANDS
279 281
280 -1 Produce single columnar output. 282 -1 Produce single columnar output.
281 283
282 -a List files beginning with a dot (`.'). 284 -a List files beginning with a dot (M-bM-^@M-^X.M-bM-^@M-^Y).
283 285
284 -f Do not sort the listing. The default sort order is 286 -f Do not sort the listing. The default sort order is
285 lexicographical. 287 lexicographical.
@@ -378,4 +380,4 @@ SEE ALSO
378 T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh- 380 T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh-
379 filexfer-00.txt, January 2001, work in progress material. 381 filexfer-00.txt, January 2001, work in progress material.
380 382
381OpenBSD 5.6 April 22, 2014 OpenBSD 5.6 383OpenBSD 5.7 January 30, 2015 OpenBSD 5.7
diff --git a/sftp.1 b/sftp.1
index 7eb9970ab..214f0118c 100644
--- a/sftp.1
+++ b/sftp.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: sftp.1,v 1.99 2014/04/22 14:16:30 jmc Exp $ 1.\" $OpenBSD: sftp.1,v 1.101 2015/01/30 11:43:14 djm Exp $
2.\" 2.\"
3.\" Copyright (c) 2001 Damien Miller. All rights reserved. 3.\" Copyright (c) 2001 Damien Miller. All rights reserved.
4.\" 4.\"
@@ -22,7 +22,7 @@
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\" 24.\"
25.Dd $Mdocdate: April 22 2014 $ 25.Dd $Mdocdate: January 30 2015 $
26.Dt SFTP 1 26.Dt SFTP 1
27.Os 27.Os
28.Sh NAME 28.Sh NAME
@@ -215,6 +215,7 @@ For full details of the options listed below, and their possible values, see
215.It HashKnownHosts 215.It HashKnownHosts
216.It Host 216.It Host
217.It HostbasedAuthentication 217.It HostbasedAuthentication
218.It HostbasedKeyTypes
218.It HostKeyAlgorithms 219.It HostKeyAlgorithms
219.It HostKeyAlias 220.It HostKeyAlias
220.It HostName 221.It HostName
@@ -243,6 +244,7 @@ For full details of the options listed below, and their possible values, see
243.It ServerAliveCountMax 244.It ServerAliveCountMax
244.It StrictHostKeyChecking 245.It StrictHostKeyChecking
245.It TCPKeepAlive 246.It TCPKeepAlive
247.It UpdateHostKeys
246.It UsePrivilegedPort 248.It UsePrivilegedPort
247.It User 249.It User
248.It UserKnownHostsFile 250.It UserKnownHostsFile
diff --git a/sftp.c b/sftp.c
index ff4d63d5c..cb9b967ed 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.164 2014/07/09 01:45:10 djm Exp $ */ 1/* $OpenBSD: sftp.c,v 1.170 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -17,6 +17,7 @@
17 17
18#include "includes.h" 18#include "includes.h"
19 19
20#include <sys/param.h> /* MIN MAX */
20#include <sys/types.h> 21#include <sys/types.h>
21#include <sys/ioctl.h> 22#include <sys/ioctl.h>
22#ifdef HAVE_SYS_STAT_H 23#ifdef HAVE_SYS_STAT_H
@@ -46,6 +47,7 @@
46#else 47#else
47typedef void EditLine; 48typedef void EditLine;
48#endif 49#endif
50#include <limits.h>
49#include <signal.h> 51#include <signal.h>
50#include <stdlib.h> 52#include <stdlib.h>
51#include <stdio.h> 53#include <stdio.h>
@@ -63,7 +65,8 @@ typedef void EditLine;
63#include "misc.h" 65#include "misc.h"
64 66
65#include "sftp.h" 67#include "sftp.h"
66#include "buffer.h" 68#include "ssherr.h"
69#include "sshbuf.h"
67#include "sftp-common.h" 70#include "sftp-common.h"
68#include "sftp-client.h" 71#include "sftp-client.h"
69 72
@@ -202,7 +205,7 @@ static const struct CMD cmds[] = {
202 { "quit", I_QUIT, NOARGS }, 205 { "quit", I_QUIT, NOARGS },
203 { "reget", I_REGET, REMOTE }, 206 { "reget", I_REGET, REMOTE },
204 { "rename", I_RENAME, REMOTE }, 207 { "rename", I_RENAME, REMOTE },
205 { "reput", I_REPUT, LOCAL }, 208 { "reput", I_REPUT, LOCAL },
206 { "rm", I_RM, REMOTE }, 209 { "rm", I_RM, REMOTE },
207 { "rmdir", I_RMDIR, REMOTE }, 210 { "rmdir", I_RMDIR, REMOTE },
208 { "symlink", I_SYMLINK, REMOTE }, 211 { "symlink", I_SYMLINK, REMOTE },
@@ -250,9 +253,9 @@ help(void)
250 "df [-hi] [path] Display statistics for current directory or\n" 253 "df [-hi] [path] Display statistics for current directory or\n"
251 " filesystem containing 'path'\n" 254 " filesystem containing 'path'\n"
252 "exit Quit sftp\n" 255 "exit Quit sftp\n"
253 "get [-Ppr] remote [local] Download file\n" 256 "get [-afPpRr] remote [local] Download file\n"
254 "reget remote [local] Resume download file\n" 257 "reget [-fPpRr] remote [local] Resume download file\n"
255 "reput [local] remote Resume upload file\n" 258 "reput [-fPpRr] [local] remote Resume upload file\n"
256 "help Display this help text\n" 259 "help Display this help text\n"
257 "lcd path Change local directory to 'path'\n" 260 "lcd path Change local directory to 'path'\n"
258 "lls [ls-options [path]] Display local directory listing\n" 261 "lls [ls-options [path]] Display local directory listing\n"
@@ -263,7 +266,7 @@ help(void)
263 "lumask umask Set local umask to 'umask'\n" 266 "lumask umask Set local umask to 'umask'\n"
264 "mkdir path Create remote directory\n" 267 "mkdir path Create remote directory\n"
265 "progress Toggle display of progress meter\n" 268 "progress Toggle display of progress meter\n"
266 "put [-Ppr] local [remote] Upload file\n" 269 "put [-afPpRr] local [remote] Upload file\n"
267 "pwd Display remote working directory\n" 270 "pwd Display remote working directory\n"
268 "quit Quit sftp\n" 271 "quit Quit sftp\n"
269 "rename oldpath newpath Rename remote file\n" 272 "rename oldpath newpath Rename remote file\n"
@@ -1400,7 +1403,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
1400 int cmdnum, i; 1403 int cmdnum, i;
1401 unsigned long n_arg = 0; 1404 unsigned long n_arg = 0;
1402 Attrib a, *aa; 1405 Attrib a, *aa;
1403 char path_buf[MAXPATHLEN]; 1406 char path_buf[PATH_MAX];
1404 int err = 0; 1407 int err = 0;
1405 glob_t g; 1408 glob_t g;
1406 1409
@@ -1519,6 +1522,9 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
1519 err = do_df(conn, path1, hflag, iflag); 1522 err = do_df(conn, path1, hflag, iflag);
1520 break; 1523 break;
1521 case I_LCHDIR: 1524 case I_LCHDIR:
1525 tmp = tilde_expand_filename(path1, getuid());
1526 free(path1);
1527 path1 = tmp;
1522 if (chdir(path1) == -1) { 1528 if (chdir(path1) == -1) {
1523 error("Couldn't change local directory to " 1529 error("Couldn't change local directory to "
1524 "\"%s\": %s", path1, strerror(errno)); 1530 "\"%s\": %s", path1, strerror(errno));
@@ -2081,8 +2087,8 @@ interactive_loop(struct sftp_conn *conn, char *file1, char *file2)
2081 free(dir); 2087 free(dir);
2082 } 2088 }
2083 2089
2084 setlinebuf(stdout); 2090 setvbuf(stdout, NULL, _IOLBF, 0);
2085 setlinebuf(infile); 2091 setvbuf(infile, NULL, _IOLBF, 0);
2086 2092
2087 interactive = !batchmode && isatty(STDIN_FILENO); 2093 interactive = !batchmode && isatty(STDIN_FILENO);
2088 err = 0; 2094 err = 0;
diff --git a/ssh-add.0 b/ssh-add.0
index f16165ae5..8ee39470a 100644
--- a/ssh-add.0
+++ b/ssh-add.0
@@ -1,10 +1,10 @@
1SSH-ADD(1) General Commands Manual SSH-ADD(1) 1SSH-ADD(1) General Commands Manual SSH-ADD(1)
2 2
3NAME 3NAME
4 ssh-add - adds private key identities to the authentication agent 4 ssh-add M-bM-^@M-^S adds private key identities to the authentication agent
5 5
6SYNOPSIS 6SYNOPSIS
7 ssh-add [-cDdkLlXx] [-t life] [file ...] 7 ssh-add [-cDdkLlXx] [-E fingerprint_hash] [-t life] [file ...]
8 ssh-add -s pkcs11 8 ssh-add -s pkcs11
9 ssh-add -e pkcs11 9 ssh-add -e pkcs11
10 10
@@ -43,6 +43,11 @@ DESCRIPTION
43 certificates to be removed from the agent. If no public key is 43 certificates to be removed from the agent. If no public key is
44 found at a given path, ssh-add will append .pub and retry. 44 found at a given path, ssh-add will append .pub and retry.
45 45
46 -E fingerprint_hash
47 Specifies the hash algorithm used when displaying key
48 fingerprints. Valid options are: M-bM-^@M-^\md5M-bM-^@M-^] and M-bM-^@M-^\sha256M-bM-^@M-^]. The
49 default is M-bM-^@M-^\sha256M-bM-^@M-^].
50
46 -e pkcs11 51 -e pkcs11
47 Remove keys provided by the PKCS#11 shared library pkcs11. 52 Remove keys provided by the PKCS#11 shared library pkcs11.
48 53
@@ -96,7 +101,7 @@ FILES
96 the user. 101 the user.
97 102
98 ~/.ssh/id_ed25519 103 ~/.ssh/id_ed25519
99 Contains the protocol version 2 ED25519 authentication identity 104 Contains the protocol version 2 Ed25519 authentication identity
100 of the user. 105 of the user.
101 106
102 ~/.ssh/id_rsa 107 ~/.ssh/id_rsa
@@ -120,4 +125,4 @@ AUTHORS
120 created OpenSSH. Markus Friedl contributed the support for SSH protocol 125 created OpenSSH. Markus Friedl contributed the support for SSH protocol
121 versions 1.5 and 2.0. 126 versions 1.5 and 2.0.
122 127
123OpenBSD 5.6 December 7, 2013 OpenBSD 5.6 128OpenBSD 5.7 December 21, 2014 OpenBSD 5.7
diff --git a/ssh-add.1 b/ssh-add.1
index 4812448fa..926456f0b 100644
--- a/ssh-add.1
+++ b/ssh-add.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-add.1,v 1.59 2013/12/07 11:58:46 naddy Exp $ 1.\" $OpenBSD: ssh-add.1,v 1.61 2014/12/21 22:27:56 djm Exp $
2.\" 2.\"
3.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 3.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -35,7 +35,7 @@
35.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 35.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37.\" 37.\"
38.Dd $Mdocdate: December 7 2013 $ 38.Dd $Mdocdate: December 21 2014 $
39.Dt SSH-ADD 1 39.Dt SSH-ADD 1
40.Os 40.Os
41.Sh NAME 41.Sh NAME
@@ -44,6 +44,7 @@
44.Sh SYNOPSIS 44.Sh SYNOPSIS
45.Nm ssh-add 45.Nm ssh-add
46.Op Fl cDdkLlXx 46.Op Fl cDdkLlXx
47.Op Fl E Ar fingerprint_hash
47.Op Fl t Ar life 48.Op Fl t Ar life
48.Op Ar 49.Op Ar
49.Nm ssh-add 50.Nm ssh-add
@@ -108,6 +109,14 @@ If no public key is found at a given path,
108will append 109will append
109.Pa .pub 110.Pa .pub
110and retry. 111and retry.
112.It Fl E Ar fingerprint_hash
113Specifies the hash algorithm used when displaying key fingerprints.
114Valid options are:
115.Dq md5
116and
117.Dq sha256 .
118The default is
119.Dq sha256 .
111.It Fl e Ar pkcs11 120.It Fl e Ar pkcs11
112Remove keys provided by the PKCS#11 shared library 121Remove keys provided by the PKCS#11 shared library
113.Ar pkcs11 . 122.Ar pkcs11 .
@@ -171,7 +180,7 @@ Contains the protocol version 2 DSA authentication identity of the user.
171.It Pa ~/.ssh/id_ecdsa 180.It Pa ~/.ssh/id_ecdsa
172Contains the protocol version 2 ECDSA authentication identity of the user. 181Contains the protocol version 2 ECDSA authentication identity of the user.
173.It Pa ~/.ssh/id_ed25519 182.It Pa ~/.ssh/id_ed25519
174Contains the protocol version 2 ED25519 authentication identity of the user. 183Contains the protocol version 2 Ed25519 authentication identity of the user.
175.It Pa ~/.ssh/id_rsa 184.It Pa ~/.ssh/id_rsa
176Contains the protocol version 2 RSA authentication identity of the user. 185Contains the protocol version 2 RSA authentication identity of the user.
177.El 186.El
diff --git a/ssh-add.c b/ssh-add.c
index 78a3359ad..98d46d3e5 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-add.c,v 1.113 2014/07/09 14:15:56 benno Exp $ */ 1/* $OpenBSD: ssh-add.c,v 1.120 2015/02/21 21:46:57 halex Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -39,11 +39,11 @@
39 39
40#include <sys/types.h> 40#include <sys/types.h>
41#include <sys/stat.h> 41#include <sys/stat.h>
42#include <sys/param.h>
43 42
44#include <openssl/evp.h> 43#include <openssl/evp.h>
45#include "openbsd-compat/openssl-compat.h" 44#include "openbsd-compat/openssl-compat.h"
46 45
46#include <errno.h>
47#include <fcntl.h> 47#include <fcntl.h>
48#include <pwd.h> 48#include <pwd.h>
49#include <stdarg.h> 49#include <stdarg.h>
@@ -51,34 +51,40 @@
51#include <stdlib.h> 51#include <stdlib.h>
52#include <string.h> 52#include <string.h>
53#include <unistd.h> 53#include <unistd.h>
54#include <limits.h>
54 55
55#include "xmalloc.h" 56#include "xmalloc.h"
56#include "ssh.h" 57#include "ssh.h"
57#include "rsa.h" 58#include "rsa.h"
58#include "log.h" 59#include "log.h"
59#include "key.h" 60#include "sshkey.h"
60#include "buffer.h" 61#include "sshbuf.h"
61#include "authfd.h" 62#include "authfd.h"
62#include "authfile.h" 63#include "authfile.h"
63#include "pathnames.h" 64#include "pathnames.h"
64#include "misc.h" 65#include "misc.h"
65#include "ssherr.h" 66#include "ssherr.h"
67#include "digest.h"
66 68
67/* argv0 */ 69/* argv0 */
68extern char *__progname; 70extern char *__progname;
69 71
70/* Default files to add */ 72/* Default files to add */
71static char *default_files[] = { 73static char *default_files[] = {
74#ifdef WITH_OPENSSL
72 _PATH_SSH_CLIENT_ID_RSA, 75 _PATH_SSH_CLIENT_ID_RSA,
73 _PATH_SSH_CLIENT_ID_DSA, 76 _PATH_SSH_CLIENT_ID_DSA,
74#ifdef OPENSSL_HAS_ECC 77#ifdef OPENSSL_HAS_ECC
75 _PATH_SSH_CLIENT_ID_ECDSA, 78 _PATH_SSH_CLIENT_ID_ECDSA,
76#endif 79#endif
80#endif /* WITH_OPENSSL */
77 _PATH_SSH_CLIENT_ID_ED25519, 81 _PATH_SSH_CLIENT_ID_ED25519,
78 _PATH_SSH_CLIENT_IDENTITY, 82 _PATH_SSH_CLIENT_IDENTITY,
79 NULL 83 NULL
80}; 84};
81 85
86static int fingerprint_hash = SSH_FP_HASH_DEFAULT;
87
82/* Default lifetime (0 == forever) */ 88/* Default lifetime (0 == forever) */
83static int lifetime = 0; 89static int lifetime = 0;
84 90
@@ -98,22 +104,22 @@ clear_pass(void)
98} 104}
99 105
100static int 106static int
101delete_file(AuthenticationConnection *ac, const char *filename, int key_only) 107delete_file(int agent_fd, const char *filename, int key_only)
102{ 108{
103 Key *public = NULL, *cert = NULL; 109 struct sshkey *public, *cert = NULL;
104 char *certpath = NULL, *comment = NULL; 110 char *certpath = NULL, *comment = NULL;
105 int ret = -1; 111 int r, ret = -1;
106 112
107 public = key_load_public(filename, &comment); 113 if ((r = sshkey_load_public(filename, &public, &comment)) != 0) {
108 if (public == NULL) { 114 printf("Bad key file %s: %s\n", filename, ssh_err(r));
109 printf("Bad key file %s\n", filename);
110 return -1; 115 return -1;
111 } 116 }
112 if (ssh_remove_identity(ac, public)) { 117 if ((r = ssh_remove_identity(agent_fd, public)) == 0) {
113 fprintf(stderr, "Identity removed: %s (%s)\n", filename, comment); 118 fprintf(stderr, "Identity removed: %s (%s)\n", filename, comment);
114 ret = 0; 119 ret = 0;
115 } else 120 } else
116 fprintf(stderr, "Could not remove identity: %s\n", filename); 121 fprintf(stderr, "Could not remove identity \"%s\": %s\n",
122 filename, ssh_err(r));
117 123
118 if (key_only) 124 if (key_only)
119 goto out; 125 goto out;
@@ -122,24 +128,30 @@ delete_file(AuthenticationConnection *ac, const char *filename, int key_only)
122 free(comment); 128 free(comment);
123 comment = NULL; 129 comment = NULL;
124 xasprintf(&certpath, "%s-cert.pub", filename); 130 xasprintf(&certpath, "%s-cert.pub", filename);
125 if ((cert = key_load_public(certpath, &comment)) == NULL) 131 if ((r = sshkey_load_public(certpath, &cert, &comment)) != 0) {
132 if (r != SSH_ERR_SYSTEM_ERROR || errno != ENOENT)
133 error("Failed to load certificate \"%s\": %s",
134 certpath, ssh_err(r));
126 goto out; 135 goto out;
127 if (!key_equal_public(cert, public)) 136 }
137
138 if (!sshkey_equal_public(cert, public))
128 fatal("Certificate %s does not match private key %s", 139 fatal("Certificate %s does not match private key %s",
129 certpath, filename); 140 certpath, filename);
130 141
131 if (ssh_remove_identity(ac, cert)) { 142 if ((r = ssh_remove_identity(agent_fd, cert)) == 0) {
132 fprintf(stderr, "Identity removed: %s (%s)\n", certpath, 143 fprintf(stderr, "Identity removed: %s (%s)\n", certpath,
133 comment); 144 comment);
134 ret = 0; 145 ret = 0;
135 } else 146 } else
136 fprintf(stderr, "Could not remove identity: %s\n", certpath); 147 fprintf(stderr, "Could not remove identity \"%s\": %s\n",
148 certpath, ssh_err(r));
137 149
138 out: 150 out:
139 if (cert != NULL) 151 if (cert != NULL)
140 key_free(cert); 152 sshkey_free(cert);
141 if (public != NULL) 153 if (public != NULL)
142 key_free(public); 154 sshkey_free(public);
143 free(certpath); 155 free(certpath);
144 free(comment); 156 free(comment);
145 157
@@ -148,14 +160,15 @@ delete_file(AuthenticationConnection *ac, const char *filename, int key_only)
148 160
149/* Send a request to remove all identities. */ 161/* Send a request to remove all identities. */
150static int 162static int
151delete_all(AuthenticationConnection *ac) 163delete_all(int agent_fd)
152{ 164{
153 int ret = -1; 165 int ret = -1;
154 166
155 if (ssh_remove_all_identities(ac, 1)) 167 if (ssh_remove_all_identities(agent_fd, 1) == 0)
156 ret = 0; 168 ret = 0;
157 /* ignore error-code for ssh2 */ 169 /* ignore error-code for ssh2 */
158 ssh_remove_all_identities(ac, 2); 170 /* XXX revisit */
171 ssh_remove_all_identities(agent_fd, 2);
159 172
160 if (ret == 0) 173 if (ret == 0)
161 fprintf(stderr, "All identities removed.\n"); 174 fprintf(stderr, "All identities removed.\n");
@@ -166,13 +179,13 @@ delete_all(AuthenticationConnection *ac)
166} 179}
167 180
168static int 181static int
169add_file(AuthenticationConnection *ac, const char *filename, int key_only) 182add_file(int agent_fd, const char *filename, int key_only)
170{ 183{
171 Key *private, *cert; 184 struct sshkey *private, *cert;
172 char *comment = NULL; 185 char *comment = NULL;
173 char msg[1024], *certpath = NULL; 186 char msg[1024], *certpath = NULL;
174 int r, fd, perms_ok, ret = -1; 187 int r, fd, ret = -1;
175 Buffer keyblob; 188 struct sshbuf *keyblob;
176 189
177 if (strcmp(filename, "-") == 0) { 190 if (strcmp(filename, "-") == 0) {
178 fd = STDIN_FILENO; 191 fd = STDIN_FILENO;
@@ -187,62 +200,73 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only)
187 * will occur multiple times, so check perms first and bail if wrong. 200 * will occur multiple times, so check perms first and bail if wrong.
188 */ 201 */
189 if (fd != STDIN_FILENO) { 202 if (fd != STDIN_FILENO) {
190 perms_ok = key_perm_ok(fd, filename); 203 if (sshkey_perm_ok(fd, filename) != 0) {
191 if (!perms_ok) {
192 close(fd); 204 close(fd);
193 return -1; 205 return -1;
194 } 206 }
195 } 207 }
196 buffer_init(&keyblob); 208 if ((keyblob = sshbuf_new()) == NULL)
197 if (!key_load_file(fd, filename, &keyblob)) { 209 fatal("%s: sshbuf_new failed", __func__);
198 buffer_free(&keyblob); 210 if ((r = sshkey_load_file(fd, keyblob)) != 0) {
211 fprintf(stderr, "Error loading key \"%s\": %s\n",
212 filename, ssh_err(r));
213 sshbuf_free(keyblob);
199 close(fd); 214 close(fd);
200 return -1; 215 return -1;
201 } 216 }
202 close(fd); 217 close(fd);
203 218
204 /* At first, try empty passphrase */ 219 /* At first, try empty passphrase */
205 if ((r = sshkey_parse_private_fileblob(&keyblob, "", filename, 220 if ((r = sshkey_parse_private_fileblob(keyblob, "", filename,
206 &private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) 221 &private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
207 fatal("Cannot parse %s: %s", filename, ssh_err(r)); 222 fprintf(stderr, "Error loading key \"%s\": %s\n",
223 filename, ssh_err(r));
224 goto fail_load;
225 }
208 /* try last */ 226 /* try last */
209 if (private == NULL && pass != NULL) { 227 if (private == NULL && pass != NULL) {
210 if ((r = sshkey_parse_private_fileblob(&keyblob, pass, filename, 228 if ((r = sshkey_parse_private_fileblob(keyblob, pass, filename,
211 &private, &comment)) != 0 && 229 &private, &comment)) != 0 &&
212 r != SSH_ERR_KEY_WRONG_PASSPHRASE) 230 r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
213 fatal("Cannot parse %s: %s", filename, ssh_err(r)); 231 fprintf(stderr, "Error loading key \"%s\": %s\n",
232 filename, ssh_err(r));
233 goto fail_load;
234 }
214 } 235 }
215 if (comment == NULL) 236 if (comment == NULL)
216 comment = xstrdup(filename); 237 comment = xstrdup(filename);
217 if (private == NULL) { 238 if (private == NULL) {
218 /* clear passphrase since it did not work */ 239 /* clear passphrase since it did not work */
219 clear_pass(); 240 clear_pass();
220 snprintf(msg, sizeof msg, "Enter passphrase for %.200s: ", 241 snprintf(msg, sizeof msg, "Enter passphrase for %.200s%s: ",
221 comment); 242 comment, confirm ? " (will confirm each use)" : "");
222 for (;;) { 243 for (;;) {
223 pass = read_passphrase(msg, RP_ALLOW_STDIN); 244 pass = read_passphrase(msg, RP_ALLOW_STDIN);
224 if (strcmp(pass, "") == 0) { 245 if (strcmp(pass, "") == 0)
246 goto fail_load;
247 if ((r = sshkey_parse_private_fileblob(keyblob, pass,
248 filename, &private, NULL)) == 0)
249 break;
250 else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
251 fprintf(stderr,
252 "Error loading key \"%s\": %s\n",
253 filename, ssh_err(r));
254 fail_load:
225 clear_pass(); 255 clear_pass();
226 free(comment); 256 free(comment);
227 buffer_free(&keyblob); 257 sshbuf_free(keyblob);
228 return -1; 258 return -1;
229 } 259 }
230 if ((r = sshkey_parse_private_fileblob(&keyblob,
231 pass, filename, &private, NULL)) != 0 &&
232 r != SSH_ERR_KEY_WRONG_PASSPHRASE)
233 fatal("Cannot parse %s: %s",
234 filename, ssh_err(r));
235 if (private != NULL)
236 break;
237 clear_pass(); 260 clear_pass();
238 snprintf(msg, sizeof msg, 261 snprintf(msg, sizeof msg,
239 "Bad passphrase, try again for %.200s: ", comment); 262 "Bad passphrase, try again for %.200s%s: ", comment,
263 confirm ? " (will confirm each use)" : "");
240 } 264 }
241 } 265 }
242 buffer_free(&keyblob); 266 sshbuf_free(keyblob);
243 267
244 if (ssh_add_identity_constrained(ac, private, comment, lifetime, 268 if ((r = ssh_add_identity_constrained(agent_fd, private, comment,
245 confirm)) { 269 lifetime, confirm)) == 0) {
246 fprintf(stderr, "Identity added: %s (%s)\n", filename, comment); 270 fprintf(stderr, "Identity added: %s (%s)\n", filename, comment);
247 ret = 0; 271 ret = 0;
248 if (lifetime != 0) 272 if (lifetime != 0)
@@ -252,7 +276,8 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only)
252 fprintf(stderr, 276 fprintf(stderr,
253 "The user must confirm each use of the key\n"); 277 "The user must confirm each use of the key\n");
254 } else { 278 } else {
255 fprintf(stderr, "Could not add identity: %s\n", filename); 279 fprintf(stderr, "Could not add identity \"%s\": %s\n",
280 filename, ssh_err(r));
256 } 281 }
257 282
258 /* Skip trying to load the cert if requested */ 283 /* Skip trying to load the cert if requested */
@@ -261,29 +286,39 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only)
261 286
262 /* Now try to add the certificate flavour too */ 287 /* Now try to add the certificate flavour too */
263 xasprintf(&certpath, "%s-cert.pub", filename); 288 xasprintf(&certpath, "%s-cert.pub", filename);
264 if ((cert = key_load_public(certpath, NULL)) == NULL) 289 if ((r = sshkey_load_public(certpath, &cert, NULL)) != 0) {
290 if (r != SSH_ERR_SYSTEM_ERROR || errno != ENOENT)
291 error("Failed to load certificate \"%s\": %s",
292 certpath, ssh_err(r));
265 goto out; 293 goto out;
294 }
266 295
267 if (!key_equal_public(cert, private)) { 296 if (!sshkey_equal_public(cert, private)) {
268 error("Certificate %s does not match private key %s", 297 error("Certificate %s does not match private key %s",
269 certpath, filename); 298 certpath, filename);
270 key_free(cert); 299 sshkey_free(cert);
271 goto out; 300 goto out;
272 } 301 }
273 302
274 /* Graft with private bits */ 303 /* Graft with private bits */
275 if (key_to_certified(private, key_cert_is_legacy(cert)) != 0) { 304 if ((r = sshkey_to_certified(private,
276 error("%s: key_to_certified failed", __func__); 305 sshkey_cert_is_legacy(cert))) != 0) {
277 key_free(cert); 306 error("%s: sshkey_to_certified: %s", __func__, ssh_err(r));
307 sshkey_free(cert);
278 goto out; 308 goto out;
279 } 309 }
280 key_cert_copy(cert, private); 310 if ((r = sshkey_cert_copy(cert, private)) != 0) {
281 key_free(cert); 311 error("%s: key_cert_copy: %s", __func__, ssh_err(r));
312 sshkey_free(cert);
313 goto out;
314 }
315 sshkey_free(cert);
282 316
283 if (!ssh_add_identity_constrained(ac, private, comment, 317 if ((r = ssh_add_identity_constrained(agent_fd, private, comment,
284 lifetime, confirm)) { 318 lifetime, confirm)) != 0) {
285 error("Certificate %s (%s) add failed", certpath, 319 error("Certificate %s (%s) add failed: %s", certpath,
286 private->cert->key_id); 320 private->cert->key_id, ssh_err(r));
321 goto out;
287 } 322 }
288 fprintf(stderr, "Certificate added: %s (%s)\n", certpath, 323 fprintf(stderr, "Certificate added: %s (%s)\n", certpath,
289 private->cert->key_id); 324 private->cert->key_id);
@@ -292,19 +327,18 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only)
292 if (confirm != 0) 327 if (confirm != 0)
293 fprintf(stderr, "The user must confirm each use of the key\n"); 328 fprintf(stderr, "The user must confirm each use of the key\n");
294 out: 329 out:
295 if (certpath != NULL) 330 free(certpath);
296 free(certpath);
297 free(comment); 331 free(comment);
298 key_free(private); 332 sshkey_free(private);
299 333
300 return ret; 334 return ret;
301} 335}
302 336
303static int 337static int
304update_card(AuthenticationConnection *ac, int add, const char *id) 338update_card(int agent_fd, int add, const char *id)
305{ 339{
306 char *pin = NULL; 340 char *pin = NULL;
307 int ret = -1; 341 int r, ret = -1;
308 342
309 if (add) { 343 if (add) {
310 if ((pin = read_passphrase("Enter passphrase for PKCS#11: ", 344 if ((pin = read_passphrase("Enter passphrase for PKCS#11: ",
@@ -312,14 +346,14 @@ update_card(AuthenticationConnection *ac, int add, const char *id)
312 return -1; 346 return -1;
313 } 347 }
314 348
315 if (ssh_update_card(ac, add, id, pin == NULL ? "" : pin, 349 if ((r = ssh_update_card(agent_fd, add, id, pin == NULL ? "" : pin,
316 lifetime, confirm)) { 350 lifetime, confirm)) == 0) {
317 fprintf(stderr, "Card %s: %s\n", 351 fprintf(stderr, "Card %s: %s\n",
318 add ? "added" : "removed", id); 352 add ? "added" : "removed", id);
319 ret = 0; 353 ret = 0;
320 } else { 354 } else {
321 fprintf(stderr, "Could not %s card: %s\n", 355 fprintf(stderr, "Could not %s card \"%s\": %s\n",
322 add ? "add" : "remove", id); 356 add ? "add" : "remove", id, ssh_err(r));
323 ret = -1; 357 ret = -1;
324 } 358 }
325 free(pin); 359 free(pin);
@@ -327,32 +361,43 @@ update_card(AuthenticationConnection *ac, int add, const char *id)
327} 361}
328 362
329static int 363static int
330list_identities(AuthenticationConnection *ac, int do_fp) 364list_identities(int agent_fd, int do_fp)
331{ 365{
332 Key *key; 366 char *fp;
333 char *comment, *fp; 367 int version, r, had_identities = 0;
334 int had_identities = 0; 368 struct ssh_identitylist *idlist;
335 int version; 369 size_t i;
336 370
337 for (version = 1; version <= 2; version++) { 371 for (version = 1; version <= 2; version++) {
338 for (key = ssh_get_first_identity(ac, &comment, version); 372 if ((r = ssh_fetch_identitylist(agent_fd, version,
339 key != NULL; 373 &idlist)) != 0) {
340 key = ssh_get_next_identity(ac, &comment, version)) { 374 if (r != SSH_ERR_AGENT_NO_IDENTITIES)
375 fprintf(stderr, "error fetching identities for "
376 "protocol %d: %s\n", version, ssh_err(r));
377 continue;
378 }
379 for (i = 0; i < idlist->nkeys; i++) {
341 had_identities = 1; 380 had_identities = 1;
342 if (do_fp) { 381 if (do_fp) {
343 fp = key_fingerprint(key, SSH_FP_MD5, 382 fp = sshkey_fingerprint(idlist->keys[i],
344 SSH_FP_HEX); 383 fingerprint_hash, SSH_FP_DEFAULT);
345 printf("%d %s %s (%s)\n", 384 printf("%d %s %s (%s)\n",
346 key_size(key), fp, comment, key_type(key)); 385 sshkey_size(idlist->keys[i]),
386 fp == NULL ? "(null)" : fp,
387 idlist->comments[i],
388 sshkey_type(idlist->keys[i]));
347 free(fp); 389 free(fp);
348 } else { 390 } else {
349 if (!key_write(key, stdout)) 391 if ((r = sshkey_write(idlist->keys[i],
350 fprintf(stderr, "key_write failed"); 392 stdout)) != 0) {
351 fprintf(stdout, " %s\n", comment); 393 fprintf(stderr, "sshkey_write: %s\n",
394 ssh_err(r));
395 continue;
396 }
397 fprintf(stdout, " %s\n", idlist->comments[i]);
352 } 398 }
353 key_free(key);
354 free(comment);
355 } 399 }
400 ssh_free_identitylist(idlist);
356 } 401 }
357 if (!had_identities) { 402 if (!had_identities) {
358 printf("The agent has no identities.\n"); 403 printf("The agent has no identities.\n");
@@ -362,10 +407,10 @@ list_identities(AuthenticationConnection *ac, int do_fp)
362} 407}
363 408
364static int 409static int
365lock_agent(AuthenticationConnection *ac, int lock) 410lock_agent(int agent_fd, int lock)
366{ 411{
367 char prompt[100], *p1, *p2; 412 char prompt[100], *p1, *p2;
368 int passok = 1, ret = -1; 413 int r, passok = 1, ret = -1;
369 414
370 strlcpy(prompt, "Enter lock password: ", sizeof(prompt)); 415 strlcpy(prompt, "Enter lock password: ", sizeof(prompt));
371 p1 = read_passphrase(prompt, RP_ALLOW_STDIN); 416 p1 = read_passphrase(prompt, RP_ALLOW_STDIN);
@@ -379,24 +424,28 @@ lock_agent(AuthenticationConnection *ac, int lock)
379 explicit_bzero(p2, strlen(p2)); 424 explicit_bzero(p2, strlen(p2));
380 free(p2); 425 free(p2);
381 } 426 }
382 if (passok && ssh_lock_agent(ac, lock, p1)) { 427 if (passok) {
383 fprintf(stderr, "Agent %slocked.\n", lock ? "" : "un"); 428 if ((r = ssh_lock_agent(agent_fd, lock, p1)) == 0) {
384 ret = 0; 429 fprintf(stderr, "Agent %slocked.\n", lock ? "" : "un");
385 } else 430 ret = 0;
386 fprintf(stderr, "Failed to %slock agent.\n", lock ? "" : "un"); 431 } else {
432 fprintf(stderr, "Failed to %slock agent: %s\n",
433 lock ? "" : "un", ssh_err(r));
434 }
435 }
387 explicit_bzero(p1, strlen(p1)); 436 explicit_bzero(p1, strlen(p1));
388 free(p1); 437 free(p1);
389 return (ret); 438 return (ret);
390} 439}
391 440
392static int 441static int
393do_file(AuthenticationConnection *ac, int deleting, int key_only, char *file) 442do_file(int agent_fd, int deleting, int key_only, char *file)
394{ 443{
395 if (deleting) { 444 if (deleting) {
396 if (delete_file(ac, file, key_only) == -1) 445 if (delete_file(agent_fd, file, key_only) == -1)
397 return -1; 446 return -1;
398 } else { 447 } else {
399 if (add_file(ac, file, key_only) == -1) 448 if (add_file(agent_fd, file, key_only) == -1)
400 return -1; 449 return -1;
401 } 450 }
402 return 0; 451 return 0;
@@ -408,6 +457,7 @@ usage(void)
408 fprintf(stderr, "usage: %s [options] [file ...]\n", __progname); 457 fprintf(stderr, "usage: %s [options] [file ...]\n", __progname);
409 fprintf(stderr, "Options:\n"); 458 fprintf(stderr, "Options:\n");
410 fprintf(stderr, " -l List fingerprints of all identities.\n"); 459 fprintf(stderr, " -l List fingerprints of all identities.\n");
460 fprintf(stderr, " -E hash Specify hash algorithm used for fingerprints.\n");
411 fprintf(stderr, " -L List public key parameters of all identities.\n"); 461 fprintf(stderr, " -L List public key parameters of all identities.\n");
412 fprintf(stderr, " -k Load only keys and not certificates.\n"); 462 fprintf(stderr, " -k Load only keys and not certificates.\n");
413 fprintf(stderr, " -c Require confirmation to sign using identities\n"); 463 fprintf(stderr, " -c Require confirmation to sign using identities\n");
@@ -425,9 +475,10 @@ main(int argc, char **argv)
425{ 475{
426 extern char *optarg; 476 extern char *optarg;
427 extern int optind; 477 extern int optind;
428 AuthenticationConnection *ac = NULL; 478 int agent_fd;
429 char *pkcs11provider = NULL; 479 char *pkcs11provider = NULL;
430 int i, ch, deleting = 0, ret = 0, key_only = 0; 480 int r, i, ch, deleting = 0, ret = 0, key_only = 0;
481 int xflag = 0, lflag = 0, Dflag = 0;
431 482
432 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ 483 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
433 sanitise_stdfd(); 484 sanitise_stdfd();
@@ -435,32 +486,47 @@ main(int argc, char **argv)
435 __progname = ssh_get_progname(argv[0]); 486 __progname = ssh_get_progname(argv[0]);
436 seed_rng(); 487 seed_rng();
437 488
489#ifdef WITH_OPENSSL
438 OpenSSL_add_all_algorithms(); 490 OpenSSL_add_all_algorithms();
491#endif
439 492
440 setlinebuf(stdout); 493 setvbuf(stdout, NULL, _IOLBF, 0);
441 494
442 /* At first, get a connection to the authentication agent. */ 495 /* First, get a connection to the authentication agent. */
443 ac = ssh_get_authentication_connection(); 496 switch (r = ssh_get_authentication_socket(&agent_fd)) {
444 if (ac == NULL) { 497 case 0:
445 fprintf(stderr, 498 break;
446 "Could not open a connection to your authentication agent.\n"); 499 case SSH_ERR_AGENT_NOT_PRESENT:
500 fprintf(stderr, "Could not open a connection to your "
501 "authentication agent.\n");
502 exit(2);
503 default:
504 fprintf(stderr, "Error connecting to agent: %s\n", ssh_err(r));
447 exit(2); 505 exit(2);
448 } 506 }
449 while ((ch = getopt(argc, argv, "klLcdDxXe:s:t:")) != -1) { 507
508 while ((ch = getopt(argc, argv, "klLcdDxXE:e:s:t:")) != -1) {
450 switch (ch) { 509 switch (ch) {
510 case 'E':
511 fingerprint_hash = ssh_digest_alg_by_name(optarg);
512 if (fingerprint_hash == -1)
513 fatal("Invalid hash algorithm \"%s\"", optarg);
514 break;
451 case 'k': 515 case 'k':
452 key_only = 1; 516 key_only = 1;
453 break; 517 break;
454 case 'l': 518 case 'l':
455 case 'L': 519 case 'L':
456 if (list_identities(ac, ch == 'l' ? 1 : 0) == -1) 520 if (lflag != 0)
457 ret = 1; 521 fatal("-%c flag already specified", lflag);
458 goto done; 522 lflag = ch;
523 break;
459 case 'x': 524 case 'x':
460 case 'X': 525 case 'X':
461 if (lock_agent(ac, ch == 'x' ? 1 : 0) == -1) 526 if (xflag != 0)
462 ret = 1; 527 fatal("-%c flag already specified", xflag);
463 goto done; 528 xflag = ch;
529 break;
464 case 'c': 530 case 'c':
465 confirm = 1; 531 confirm = 1;
466 break; 532 break;
@@ -468,9 +534,8 @@ main(int argc, char **argv)
468 deleting = 1; 534 deleting = 1;
469 break; 535 break;
470 case 'D': 536 case 'D':
471 if (delete_all(ac) == -1) 537 Dflag = 1;
472 ret = 1; 538 break;
473 goto done;
474 case 's': 539 case 's':
475 pkcs11provider = optarg; 540 pkcs11provider = optarg;
476 break; 541 break;
@@ -491,15 +556,32 @@ main(int argc, char **argv)
491 goto done; 556 goto done;
492 } 557 }
493 } 558 }
559
560 if ((xflag != 0) + (lflag != 0) + (Dflag != 0) > 1)
561 fatal("Invalid combination of actions");
562 else if (xflag) {
563 if (lock_agent(agent_fd, xflag == 'x' ? 1 : 0) == -1)
564 ret = 1;
565 goto done;
566 } else if (lflag) {
567 if (list_identities(agent_fd, lflag == 'l' ? 1 : 0) == -1)
568 ret = 1;
569 goto done;
570 } else if (Dflag) {
571 if (delete_all(agent_fd) == -1)
572 ret = 1;
573 goto done;
574 }
575
494 argc -= optind; 576 argc -= optind;
495 argv += optind; 577 argv += optind;
496 if (pkcs11provider != NULL) { 578 if (pkcs11provider != NULL) {
497 if (update_card(ac, !deleting, pkcs11provider) == -1) 579 if (update_card(agent_fd, !deleting, pkcs11provider) == -1)
498 ret = 1; 580 ret = 1;
499 goto done; 581 goto done;
500 } 582 }
501 if (argc == 0) { 583 if (argc == 0) {
502 char buf[MAXPATHLEN]; 584 char buf[PATH_MAX];
503 struct passwd *pw; 585 struct passwd *pw;
504 struct stat st; 586 struct stat st;
505 int count = 0; 587 int count = 0;
@@ -516,7 +598,7 @@ main(int argc, char **argv)
516 default_files[i]); 598 default_files[i]);
517 if (stat(buf, &st) < 0) 599 if (stat(buf, &st) < 0)
518 continue; 600 continue;
519 if (do_file(ac, deleting, key_only, buf) == -1) 601 if (do_file(agent_fd, deleting, key_only, buf) == -1)
520 ret = 1; 602 ret = 1;
521 else 603 else
522 count++; 604 count++;
@@ -525,13 +607,14 @@ main(int argc, char **argv)
525 ret = 1; 607 ret = 1;
526 } else { 608 } else {
527 for (i = 0; i < argc; i++) { 609 for (i = 0; i < argc; i++) {
528 if (do_file(ac, deleting, key_only, argv[i]) == -1) 610 if (do_file(agent_fd, deleting, key_only,
611 argv[i]) == -1)
529 ret = 1; 612 ret = 1;
530 } 613 }
531 } 614 }
532 clear_pass(); 615 clear_pass();
533 616
534done: 617done:
535 ssh_close_authentication_connection(ac); 618 ssh_close_authentication_socket(agent_fd);
536 return ret; 619 return ret;
537} 620}
diff --git a/ssh-agent.0 b/ssh-agent.0
index cac40e048..30f4eb3bc 100644
--- a/ssh-agent.0
+++ b/ssh-agent.0
@@ -1,15 +1,16 @@
1SSH-AGENT(1) General Commands Manual SSH-AGENT(1) 1SSH-AGENT(1) General Commands Manual SSH-AGENT(1)
2 2
3NAME 3NAME
4 ssh-agent - authentication agent 4 ssh-agent M-bM-^@M-^S authentication agent
5 5
6SYNOPSIS 6SYNOPSIS
7 ssh-agent [-c | -s] [-d] [-a bind_address] [-t life] [command [arg ...]] 7 ssh-agent [-c | -s] [-d] [-a bind_address] [-E fingerprint_hash]
8 [-t life] [command [arg ...]]
8 ssh-agent [-c | -s] -k 9 ssh-agent [-c | -s] -k
9 10
10DESCRIPTION 11DESCRIPTION
11 ssh-agent is a program to hold private keys used for public key 12 ssh-agent is a program to hold private keys used for public key
12 authentication (RSA, DSA, ECDSA, ED25519). ssh-agent is usually started 13 authentication (RSA, DSA, ECDSA, Ed25519). ssh-agent is usually started
13 in the beginning of an X-session or a login session, and all other 14 in the beginning of an X-session or a login session, and all other
14 windows or programs are started as clients to the ssh-agent program. 15 windows or programs are started as clients to the ssh-agent program.
15 Through use of environment variables the agent can be located and 16 Through use of environment variables the agent can be located and
@@ -34,6 +35,11 @@ DESCRIPTION
34 -d Debug mode. When this option is specified ssh-agent will not 35 -d Debug mode. When this option is specified ssh-agent will not
35 fork. 36 fork.
36 37
38 -E fingerprint_hash
39 Specifies the hash algorithm used when displaying key
40 fingerprints. Valid options are: M-bM-^@M-^\md5M-bM-^@M-^] and M-bM-^@M-^\sha256M-bM-^@M-^]. The
41 default is M-bM-^@M-^\sha256M-bM-^@M-^].
42
37 -k Kill the current agent (given by the SSH_AGENT_PID environment 43 -k Kill the current agent (given by the SSH_AGENT_PID environment
38 variable). 44 variable).
39 45
@@ -100,4 +106,4 @@ AUTHORS
100 created OpenSSH. Markus Friedl contributed the support for SSH protocol 106 created OpenSSH. Markus Friedl contributed the support for SSH protocol
101 versions 1.5 and 2.0. 107 versions 1.5 and 2.0.
102 108
103OpenBSD 5.6 April 16, 2014 OpenBSD 5.6 109OpenBSD 5.7 December 21, 2014 OpenBSD 5.7
diff --git a/ssh-agent.1 b/ssh-agent.1
index a1e634fe0..6759afec3 100644
--- a/ssh-agent.1
+++ b/ssh-agent.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-agent.1,v 1.55 2014/04/16 23:28:12 djm Exp $ 1.\" $OpenBSD: ssh-agent.1,v 1.57 2014/12/21 22:27:56 djm Exp $
2.\" 2.\"
3.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 3.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -34,7 +34,7 @@
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.Dd $Mdocdate: April 16 2014 $ 37.Dd $Mdocdate: December 21 2014 $
38.Dt SSH-AGENT 1 38.Dt SSH-AGENT 1
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -45,6 +45,7 @@
45.Op Fl c | s 45.Op Fl c | s
46.Op Fl d 46.Op Fl d
47.Op Fl a Ar bind_address 47.Op Fl a Ar bind_address
48.Op Fl E Ar fingerprint_hash
48.Op Fl t Ar life 49.Op Fl t Ar life
49.Op Ar command Op Ar arg ... 50.Op Ar command Op Ar arg ...
50.Nm ssh-agent 51.Nm ssh-agent
@@ -53,7 +54,7 @@
53.Sh DESCRIPTION 54.Sh DESCRIPTION
54.Nm 55.Nm
55is a program to hold private keys used for public key authentication 56is a program to hold private keys used for public key authentication
56(RSA, DSA, ECDSA, ED25519). 57(RSA, DSA, ECDSA, Ed25519).
57.Nm 58.Nm
58is usually started in the beginning of an X-session or a login session, and 59is usually started in the beginning of an X-session or a login session, and
59all other windows or programs are started as clients to the ssh-agent 60all other windows or programs are started as clients to the ssh-agent
@@ -96,6 +97,14 @@ Debug mode.
96When this option is specified 97When this option is specified
97.Nm 98.Nm
98will not fork. 99will not fork.
100.It Fl E Ar fingerprint_hash
101Specifies the hash algorithm used when displaying key fingerprints.
102Valid options are:
103.Dq md5
104and
105.Dq sha256 .
106The default is
107.Dq sha256 .
99.It Fl k 108.It Fl k
100Kill the current agent (given by the 109Kill the current agent (given by the
101.Ev SSH_AGENT_PID 110.Ev SSH_AGENT_PID
diff --git a/ssh-agent.c b/ssh-agent.c
index 25f10c549..aeda656ac 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-agent.c,v 1.190 2014/07/25 21:22:03 dtucker Exp $ */ 1/* $OpenBSD: ssh-agent.c,v 1.199 2015/03/04 21:12:59 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -36,6 +36,7 @@
36 36
37#include "includes.h" 37#include "includes.h"
38 38
39#include <sys/param.h> /* MIN MAX */
39#include <sys/types.h> 40#include <sys/types.h>
40#include <sys/param.h> 41#include <sys/param.h>
41#include <sys/resource.h> 42#include <sys/resource.h>
@@ -56,6 +57,7 @@
56 57
57#include <errno.h> 58#include <errno.h>
58#include <fcntl.h> 59#include <fcntl.h>
60#include <limits.h>
59#ifdef HAVE_PATHS_H 61#ifdef HAVE_PATHS_H
60# include <paths.h> 62# include <paths.h>
61#endif 63#endif
@@ -67,16 +69,20 @@
67#include <string.h> 69#include <string.h>
68#include <unistd.h> 70#include <unistd.h>
69 71
72#include "key.h" /* XXX for typedef */
73#include "buffer.h" /* XXX for typedef */
74
70#include "xmalloc.h" 75#include "xmalloc.h"
71#include "ssh.h" 76#include "ssh.h"
72#include "rsa.h" 77#include "rsa.h"
73#include "buffer.h" 78#include "sshbuf.h"
74#include "key.h" 79#include "sshkey.h"
75#include "authfd.h" 80#include "authfd.h"
76#include "compat.h" 81#include "compat.h"
77#include "log.h" 82#include "log.h"
78#include "misc.h" 83#include "misc.h"
79#include "digest.h" 84#include "digest.h"
85#include "ssherr.h"
80 86
81#ifdef ENABLE_PKCS11 87#ifdef ENABLE_PKCS11
82#include "ssh-pkcs11.h" 88#include "ssh-pkcs11.h"
@@ -95,9 +101,9 @@ typedef enum {
95typedef struct { 101typedef struct {
96 int fd; 102 int fd;
97 sock_type type; 103 sock_type type;
98 Buffer input; 104 struct sshbuf *input;
99 Buffer output; 105 struct sshbuf *output;
100 Buffer request; 106 struct sshbuf *request;
101} SocketEntry; 107} SocketEntry;
102 108
103u_int sockets_alloc = 0; 109u_int sockets_alloc = 0;
@@ -105,7 +111,7 @@ SocketEntry *sockets = NULL;
105 111
106typedef struct identity { 112typedef struct identity {
107 TAILQ_ENTRY(identity) next; 113 TAILQ_ENTRY(identity) next;
108 Key *key; 114 struct sshkey *key;
109 char *comment; 115 char *comment;
110 char *provider; 116 char *provider;
111 time_t death; 117 time_t death;
@@ -130,8 +136,8 @@ time_t parent_alive_interval = 0;
130pid_t cleanup_pid = 0; 136pid_t cleanup_pid = 0;
131 137
132/* pathname and directory for AUTH_SOCKET */ 138/* pathname and directory for AUTH_SOCKET */
133char socket_name[MAXPATHLEN]; 139char socket_name[PATH_MAX];
134char socket_dir[MAXPATHLEN]; 140char socket_dir[PATH_MAX];
135 141
136/* locking */ 142/* locking */
137int locked = 0; 143int locked = 0;
@@ -142,15 +148,17 @@ extern char *__progname;
142/* Default lifetime in seconds (0 == forever) */ 148/* Default lifetime in seconds (0 == forever) */
143static long lifetime = 0; 149static long lifetime = 0;
144 150
151static int fingerprint_hash = SSH_FP_HASH_DEFAULT;
152
145static void 153static void
146close_socket(SocketEntry *e) 154close_socket(SocketEntry *e)
147{ 155{
148 close(e->fd); 156 close(e->fd);
149 e->fd = -1; 157 e->fd = -1;
150 e->type = AUTH_UNUSED; 158 e->type = AUTH_UNUSED;
151 buffer_free(&e->input); 159 sshbuf_free(e->input);
152 buffer_free(&e->output); 160 sshbuf_free(e->output);
153 buffer_free(&e->request); 161 sshbuf_free(e->request);
154} 162}
155 163
156static void 164static void
@@ -176,7 +184,7 @@ idtab_lookup(int version)
176static void 184static void
177free_identity(Identity *id) 185free_identity(Identity *id)
178{ 186{
179 key_free(id->key); 187 sshkey_free(id->key);
180 free(id->provider); 188 free(id->provider);
181 free(id->comment); 189 free(id->comment);
182 free(id); 190 free(id);
@@ -184,13 +192,13 @@ free_identity(Identity *id)
184 192
185/* return matching private key for given public key */ 193/* return matching private key for given public key */
186static Identity * 194static Identity *
187lookup_identity(Key *key, int version) 195lookup_identity(struct sshkey *key, int version)
188{ 196{
189 Identity *id; 197 Identity *id;
190 198
191 Idtab *tab = idtab_lookup(version); 199 Idtab *tab = idtab_lookup(version);
192 TAILQ_FOREACH(id, &tab->idlist, next) { 200 TAILQ_FOREACH(id, &tab->idlist, next) {
193 if (key_equal(key, id->key)) 201 if (sshkey_equal(key, id->key))
194 return (id); 202 return (id);
195 } 203 }
196 return (NULL); 204 return (NULL);
@@ -203,8 +211,9 @@ confirm_key(Identity *id)
203 char *p; 211 char *p;
204 int ret = -1; 212 int ret = -1;
205 213
206 p = key_fingerprint(id->key, SSH_FP_MD5, SSH_FP_HEX); 214 p = sshkey_fingerprint(id->key, fingerprint_hash, SSH_FP_DEFAULT);
207 if (ask_permission("Allow use of key %s?\nKey fingerprint %s.", 215 if (p != NULL &&
216 ask_permission("Allow use of key %s?\nKey fingerprint %s.",
208 id->comment, p)) 217 id->comment, p))
209 ret = 0; 218 ret = 0;
210 free(p); 219 free(p);
@@ -212,37 +221,65 @@ confirm_key(Identity *id)
212 return (ret); 221 return (ret);
213} 222}
214 223
224static void
225send_status(SocketEntry *e, int success)
226{
227 int r;
228
229 if ((r = sshbuf_put_u32(e->output, 1)) != 0 ||
230 (r = sshbuf_put_u8(e->output, success ?
231 SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE)) != 0)
232 fatal("%s: buffer error: %s", __func__, ssh_err(r));
233}
234
215/* send list of supported public keys to 'client' */ 235/* send list of supported public keys to 'client' */
216static void 236static void
217process_request_identities(SocketEntry *e, int version) 237process_request_identities(SocketEntry *e, int version)
218{ 238{
219 Idtab *tab = idtab_lookup(version); 239 Idtab *tab = idtab_lookup(version);
220 Identity *id; 240 Identity *id;
221 Buffer msg; 241 struct sshbuf *msg;
222 242 int r;
223 buffer_init(&msg); 243
224 buffer_put_char(&msg, (version == 1) ? 244 if ((msg = sshbuf_new()) == NULL)
225 SSH_AGENT_RSA_IDENTITIES_ANSWER : SSH2_AGENT_IDENTITIES_ANSWER); 245 fatal("%s: sshbuf_new failed", __func__);
226 buffer_put_int(&msg, tab->nentries); 246 if ((r = sshbuf_put_u8(msg, (version == 1) ?
247 SSH_AGENT_RSA_IDENTITIES_ANSWER :
248 SSH2_AGENT_IDENTITIES_ANSWER)) != 0 ||
249 (r = sshbuf_put_u32(msg, tab->nentries)) != 0)
250 fatal("%s: buffer error: %s", __func__, ssh_err(r));
227 TAILQ_FOREACH(id, &tab->idlist, next) { 251 TAILQ_FOREACH(id, &tab->idlist, next) {
228 if (id->key->type == KEY_RSA1) { 252 if (id->key->type == KEY_RSA1) {
229#ifdef WITH_SSH1 253#ifdef WITH_SSH1
230 buffer_put_int(&msg, BN_num_bits(id->key->rsa->n)); 254 if ((r = sshbuf_put_u32(msg,
231 buffer_put_bignum(&msg, id->key->rsa->e); 255 BN_num_bits(id->key->rsa->n))) != 0 ||
232 buffer_put_bignum(&msg, id->key->rsa->n); 256 (r = sshbuf_put_bignum1(msg,
257 id->key->rsa->e)) != 0 ||
258 (r = sshbuf_put_bignum1(msg,
259 id->key->rsa->n)) != 0)
260 fatal("%s: buffer error: %s",
261 __func__, ssh_err(r));
233#endif 262#endif
234 } else { 263 } else {
235 u_char *blob; 264 u_char *blob;
236 u_int blen; 265 size_t blen;
237 key_to_blob(id->key, &blob, &blen); 266
238 buffer_put_string(&msg, blob, blen); 267 if ((r = sshkey_to_blob(id->key, &blob, &blen)) != 0) {
268 error("%s: sshkey_to_blob: %s", __func__,
269 ssh_err(r));
270 continue;
271 }
272 if ((r = sshbuf_put_string(msg, blob, blen)) != 0)
273 fatal("%s: buffer error: %s",
274 __func__, ssh_err(r));
239 free(blob); 275 free(blob);
240 } 276 }
241 buffer_put_cstring(&msg, id->comment); 277 if ((r = sshbuf_put_cstring(msg, id->comment)) != 0)
278 fatal("%s: buffer error: %s", __func__, ssh_err(r));
242 } 279 }
243 buffer_put_int(&e->output, buffer_len(&msg)); 280 if ((r = sshbuf_put_stringb(e->output, msg)) != 0)
244 buffer_append(&e->output, buffer_ptr(&msg), buffer_len(&msg)); 281 fatal("%s: buffer error: %s", __func__, ssh_err(r));
245 buffer_free(&msg); 282 sshbuf_free(msg);
246} 283}
247 284
248#ifdef WITH_SSH1 285#ifdef WITH_SSH1
@@ -254,40 +291,48 @@ process_authentication_challenge1(SocketEntry *e)
254 u_int response_type; 291 u_int response_type;
255 BIGNUM *challenge; 292 BIGNUM *challenge;
256 Identity *id; 293 Identity *id;
257 int i, len; 294 int r, len;
258 Buffer msg; 295 struct sshbuf *msg;
259 struct ssh_digest_ctx *md; 296 struct ssh_digest_ctx *md;
260 Key *key; 297 struct sshkey *key;
261 298
262 buffer_init(&msg); 299 if ((msg = sshbuf_new()) == NULL)
263 key = key_new(KEY_RSA1); 300 fatal("%s: sshbuf_new failed", __func__);
301 if ((key = sshkey_new(KEY_RSA1)) == NULL)
302 fatal("%s: sshkey_new failed", __func__);
264 if ((challenge = BN_new()) == NULL) 303 if ((challenge = BN_new()) == NULL)
265 fatal("process_authentication_challenge1: BN_new failed"); 304 fatal("%s: BN_new failed", __func__);
266 305
267 (void) buffer_get_int(&e->request); /* ignored */ 306 if ((r = sshbuf_get_u32(e->request, NULL)) != 0 || /* ignored */
268 buffer_get_bignum(&e->request, key->rsa->e); 307 (r = sshbuf_get_bignum1(e->request, key->rsa->e)) != 0 ||
269 buffer_get_bignum(&e->request, key->rsa->n); 308 (r = sshbuf_get_bignum1(e->request, key->rsa->n)) != 0 ||
270 buffer_get_bignum(&e->request, challenge); 309 (r = sshbuf_get_bignum1(e->request, challenge)))
310 fatal("%s: buffer error: %s", __func__, ssh_err(r));
271 311
272 /* Only protocol 1.1 is supported */ 312 /* Only protocol 1.1 is supported */
273 if (buffer_len(&e->request) == 0) 313 if (sshbuf_len(e->request) == 0)
274 goto failure; 314 goto failure;
275 buffer_get(&e->request, session_id, 16); 315 if ((r = sshbuf_get(e->request, session_id, sizeof(session_id))) != 0 ||
276 response_type = buffer_get_int(&e->request); 316 (r = sshbuf_get_u32(e->request, &response_type)) != 0)
317 fatal("%s: buffer error: %s", __func__, ssh_err(r));
277 if (response_type != 1) 318 if (response_type != 1)
278 goto failure; 319 goto failure;
279 320
280 id = lookup_identity(key, 1); 321 id = lookup_identity(key, 1);
281 if (id != NULL && (!id->confirm || confirm_key(id) == 0)) { 322 if (id != NULL && (!id->confirm || confirm_key(id) == 0)) {
282 Key *private = id->key; 323 struct sshkey *private = id->key;
283 /* Decrypt the challenge using the private key. */ 324 /* Decrypt the challenge using the private key. */
284 if (rsa_private_decrypt(challenge, challenge, private->rsa) != 0) 325 if ((r = rsa_private_decrypt(challenge, challenge,
285 goto failure; 326 private->rsa) != 0)) {
327 fatal("%s: rsa_public_encrypt: %s", __func__,
328 ssh_err(r));
329 goto failure; /* XXX ? */
330 }
286 331
287 /* The response is MD5 of decrypted challenge plus session id. */ 332 /* The response is MD5 of decrypted challenge plus session id */
288 len = BN_num_bytes(challenge); 333 len = BN_num_bytes(challenge);
289 if (len <= 0 || len > 32) { 334 if (len <= 0 || len > 32) {
290 logit("process_authentication_challenge: bad challenge length %d", len); 335 logit("%s: bad challenge length %d", __func__, len);
291 goto failure; 336 goto failure;
292 } 337 }
293 memset(buf, 0, 32); 338 memset(buf, 0, 32);
@@ -300,21 +345,22 @@ process_authentication_challenge1(SocketEntry *e)
300 ssh_digest_free(md); 345 ssh_digest_free(md);
301 346
302 /* Send the response. */ 347 /* Send the response. */
303 buffer_put_char(&msg, SSH_AGENT_RSA_RESPONSE); 348 if ((r = sshbuf_put_u8(msg, SSH_AGENT_RSA_RESPONSE)) != 0 ||
304 for (i = 0; i < 16; i++) 349 (r = sshbuf_put(msg, mdbuf, sizeof(mdbuf))) != 0)
305 buffer_put_char(&msg, mdbuf[i]); 350 fatal("%s: buffer error: %s", __func__, ssh_err(r));
306 goto send; 351 goto send;
307 } 352 }
308 353
309failure: 354 failure:
310 /* Unknown identity or protocol error. Send failure. */ 355 /* Unknown identity or protocol error. Send failure. */
311 buffer_put_char(&msg, SSH_AGENT_FAILURE); 356 if ((r = sshbuf_put_u8(msg, SSH_AGENT_FAILURE)) != 0)
312send: 357 fatal("%s: buffer error: %s", __func__, ssh_err(r));
313 buffer_put_int(&e->output, buffer_len(&msg)); 358 send:
314 buffer_append(&e->output, buffer_ptr(&msg), buffer_len(&msg)); 359 if ((r = sshbuf_put_stringb(e->output, msg)) != 0)
315 key_free(key); 360 fatal("%s: buffer error: %s", __func__, ssh_err(r));
361 sshkey_free(key);
316 BN_clear_free(challenge); 362 BN_clear_free(challenge);
317 buffer_free(&msg); 363 sshbuf_free(msg);
318} 364}
319#endif 365#endif
320 366
@@ -323,54 +369,65 @@ static void
323process_sign_request2(SocketEntry *e) 369process_sign_request2(SocketEntry *e)
324{ 370{
325 u_char *blob, *data, *signature = NULL; 371 u_char *blob, *data, *signature = NULL;
326 u_int blen, dlen, slen = 0; 372 size_t blen, dlen, slen = 0;
327 extern int datafellows; 373 u_int compat = 0, flags;
328 int odatafellows; 374 int r, ok = -1;
329 int ok = -1, flags; 375 struct sshbuf *msg;
330 Buffer msg; 376 struct sshkey *key;
331 Key *key; 377 struct identity *id;
332 378
333 datafellows = 0; 379 if ((msg = sshbuf_new()) == NULL)
334 380 fatal("%s: sshbuf_new failed", __func__);
335 blob = buffer_get_string(&e->request, &blen); 381 if ((r = sshbuf_get_string(e->request, &blob, &blen)) != 0 ||
336 data = buffer_get_string(&e->request, &dlen); 382 (r = sshbuf_get_string(e->request, &data, &dlen)) != 0 ||
337 383 (r = sshbuf_get_u32(e->request, &flags)) != 0)
338 flags = buffer_get_int(&e->request); 384 fatal("%s: buffer error: %s", __func__, ssh_err(r));
339 odatafellows = datafellows;
340 if (flags & SSH_AGENT_OLD_SIGNATURE) 385 if (flags & SSH_AGENT_OLD_SIGNATURE)
341 datafellows = SSH_BUG_SIGBLOB; 386 compat = SSH_BUG_SIGBLOB;
342 387 if ((r = sshkey_from_blob(blob, blen, &key)) != 0) {
343 key = key_from_blob(blob, blen); 388 error("%s: cannot parse key blob: %s", __func__, ssh_err(ok));
344 if (key != NULL) { 389 goto send;
345 Identity *id = lookup_identity(key, 2);
346 if (id != NULL && (!id->confirm || confirm_key(id) == 0))
347 ok = key_sign(id->key, &signature, &slen, data, dlen);
348 key_free(key);
349 } 390 }
350 buffer_init(&msg); 391 if ((id = lookup_identity(key, 2)) == NULL) {
351 if (ok == 0) { 392 verbose("%s: %s key not found", __func__, sshkey_type(key));
352 buffer_put_char(&msg, SSH2_AGENT_SIGN_RESPONSE); 393 goto send;
353 buffer_put_string(&msg, signature, slen);
354 } else {
355 buffer_put_char(&msg, SSH_AGENT_FAILURE);
356 } 394 }
357 buffer_put_int(&e->output, buffer_len(&msg)); 395 if (id->confirm && confirm_key(id) != 0) {
358 buffer_append(&e->output, buffer_ptr(&msg), 396 verbose("%s: user refused key", __func__);
359 buffer_len(&msg)); 397 goto send;
360 buffer_free(&msg); 398 }
399 if ((r = sshkey_sign(id->key, &signature, &slen,
400 data, dlen, compat)) != 0) {
401 error("%s: sshkey_sign: %s", __func__, ssh_err(ok));
402 goto send;
403 }
404 /* Success */
405 ok = 0;
406 send:
407 sshkey_free(key);
408 if (ok == 0) {
409 if ((r = sshbuf_put_u8(msg, SSH2_AGENT_SIGN_RESPONSE)) != 0 ||
410 (r = sshbuf_put_string(msg, signature, slen)) != 0)
411 fatal("%s: buffer error: %s", __func__, ssh_err(r));
412 } else if ((r = sshbuf_put_u8(msg, SSH_AGENT_FAILURE)) != 0)
413 fatal("%s: buffer error: %s", __func__, ssh_err(r));
414
415 if ((r = sshbuf_put_stringb(e->output, msg)) != 0)
416 fatal("%s: buffer error: %s", __func__, ssh_err(r));
417
418 sshbuf_free(msg);
361 free(data); 419 free(data);
362 free(blob); 420 free(blob);
363 free(signature); 421 free(signature);
364 datafellows = odatafellows;
365} 422}
366 423
367/* shared */ 424/* shared */
368static void 425static void
369process_remove_identity(SocketEntry *e, int version) 426process_remove_identity(SocketEntry *e, int version)
370{ 427{
371 u_int blen; 428 size_t blen;
372 int success = 0; 429 int r, success = 0;
373 Key *key = NULL; 430 struct sshkey *key = NULL;
374 u_char *blob; 431 u_char *blob;
375#ifdef WITH_SSH1 432#ifdef WITH_SSH1
376 u_int bits; 433 u_int bits;
@@ -379,19 +436,27 @@ process_remove_identity(SocketEntry *e, int version)
379 switch (version) { 436 switch (version) {
380#ifdef WITH_SSH1 437#ifdef WITH_SSH1
381 case 1: 438 case 1:
382 key = key_new(KEY_RSA1); 439 if ((key = sshkey_new(KEY_RSA1)) == NULL) {
383 bits = buffer_get_int(&e->request); 440 error("%s: sshkey_new failed", __func__);
384 buffer_get_bignum(&e->request, key->rsa->e); 441 return;
385 buffer_get_bignum(&e->request, key->rsa->n); 442 }
386 443 if ((r = sshbuf_get_u32(e->request, &bits)) != 0 ||
387 if (bits != key_size(key)) 444 (r = sshbuf_get_bignum1(e->request, key->rsa->e)) != 0 ||
388 logit("Warning: identity keysize mismatch: actual %u, announced %u", 445 (r = sshbuf_get_bignum1(e->request, key->rsa->n)) != 0)
389 key_size(key), bits); 446 fatal("%s: buffer error: %s", __func__, ssh_err(r));
447
448 if (bits != sshkey_size(key))
449 logit("Warning: identity keysize mismatch: "
450 "actual %u, announced %u",
451 sshkey_size(key), bits);
390 break; 452 break;
391#endif /* WITH_SSH1 */ 453#endif /* WITH_SSH1 */
392 case 2: 454 case 2:
393 blob = buffer_get_string(&e->request, &blen); 455 if ((r = sshbuf_get_string(e->request, &blob, &blen)) != 0)
394 key = key_from_blob(blob, blen); 456 fatal("%s: buffer error: %s", __func__, ssh_err(r));
457 if ((r = sshkey_from_blob(blob, blen, &key)) != 0)
458 error("%s: sshkey_from_blob failed: %s",
459 __func__, ssh_err(r));
395 free(blob); 460 free(blob);
396 break; 461 break;
397 } 462 }
@@ -415,11 +480,9 @@ process_remove_identity(SocketEntry *e, int version)
415 tab->nentries--; 480 tab->nentries--;
416 success = 1; 481 success = 1;
417 } 482 }
418 key_free(key); 483 sshkey_free(key);
419 } 484 }
420 buffer_put_int(&e->output, 1); 485 send_status(e, success);
421 buffer_put_char(&e->output,
422 success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE);
423} 486}
424 487
425static void 488static void
@@ -439,8 +502,7 @@ process_remove_all_identities(SocketEntry *e, int version)
439 tab->nentries = 0; 502 tab->nentries = 0;
440 503
441 /* Send success. */ 504 /* Send success. */
442 buffer_put_int(&e->output, 1); 505 send_status(e, 1);
443 buffer_put_char(&e->output, SSH_AGENT_SUCCESS);
444} 506}
445 507
446/* removes expired keys and returns number of seconds until the next expiry */ 508/* removes expired keys and returns number of seconds until the next expiry */
@@ -474,71 +536,106 @@ reaper(void)
474 return (deadline - now); 536 return (deadline - now);
475} 537}
476 538
539/*
540 * XXX this and the corresponding serialisation function probably belongs
541 * in key.c
542 */
543#ifdef WITH_SSH1
544static int
545agent_decode_rsa1(struct sshbuf *m, struct sshkey **kp)
546{
547 struct sshkey *k = NULL;
548 int r = SSH_ERR_INTERNAL_ERROR;
549
550 *kp = NULL;
551 if ((k = sshkey_new_private(KEY_RSA1)) == NULL)
552 return SSH_ERR_ALLOC_FAIL;
553
554 if ((r = sshbuf_get_u32(m, NULL)) != 0 || /* ignored */
555 (r = sshbuf_get_bignum1(m, k->rsa->n)) != 0 ||
556 (r = sshbuf_get_bignum1(m, k->rsa->e)) != 0 ||
557 (r = sshbuf_get_bignum1(m, k->rsa->d)) != 0 ||
558 (r = sshbuf_get_bignum1(m, k->rsa->iqmp)) != 0 ||
559 /* SSH1 and SSL have p and q swapped */
560 (r = sshbuf_get_bignum1(m, k->rsa->q)) != 0 || /* p */
561 (r = sshbuf_get_bignum1(m, k->rsa->p)) != 0) /* q */
562 goto out;
563
564 /* Generate additional parameters */
565 if ((r = rsa_generate_additional_parameters(k->rsa)) != 0)
566 goto out;
567 /* enable blinding */
568 if (RSA_blinding_on(k->rsa, NULL) != 1) {
569 r = SSH_ERR_LIBCRYPTO_ERROR;
570 goto out;
571 }
572
573 r = 0; /* success */
574 out:
575 if (r == 0)
576 *kp = k;
577 else
578 sshkey_free(k);
579 return r;
580}
581#endif /* WITH_SSH1 */
582
477static void 583static void
478process_add_identity(SocketEntry *e, int version) 584process_add_identity(SocketEntry *e, int version)
479{ 585{
480 Idtab *tab = idtab_lookup(version); 586 Idtab *tab = idtab_lookup(version);
481 Identity *id; 587 Identity *id;
482 int type, success = 0, confirm = 0; 588 int success = 0, confirm = 0;
483 char *comment; 589 u_int seconds;
590 char *comment = NULL;
484 time_t death = 0; 591 time_t death = 0;
485 Key *k = NULL; 592 struct sshkey *k = NULL;
593 u_char ctype;
594 int r = SSH_ERR_INTERNAL_ERROR;
486 595
487 switch (version) { 596 switch (version) {
488#ifdef WITH_SSH1 597#ifdef WITH_SSH1
489 case 1: 598 case 1:
490 k = key_new_private(KEY_RSA1); 599 r = agent_decode_rsa1(e->request, &k);
491 (void) buffer_get_int(&e->request); /* ignored */
492 buffer_get_bignum(&e->request, k->rsa->n);
493 buffer_get_bignum(&e->request, k->rsa->e);
494 buffer_get_bignum(&e->request, k->rsa->d);
495 buffer_get_bignum(&e->request, k->rsa->iqmp);
496
497 /* SSH and SSL have p and q swapped */
498 buffer_get_bignum(&e->request, k->rsa->q); /* p */
499 buffer_get_bignum(&e->request, k->rsa->p); /* q */
500
501 /* Generate additional parameters */
502 if (rsa_generate_additional_parameters(k->rsa) != 0)
503 fatal("%s: rsa_generate_additional_parameters "
504 "error", __func__);
505
506 /* enable blinding */
507 if (RSA_blinding_on(k->rsa, NULL) != 1) {
508 error("process_add_identity: RSA_blinding_on failed");
509 key_free(k);
510 goto send;
511 }
512 break; 600 break;
513#endif /* WITH_SSH1 */ 601#endif /* WITH_SSH1 */
514 case 2: 602 case 2:
515 k = key_private_deserialize(&e->request); 603 r = sshkey_private_deserialize(e->request, &k);
516 if (k == NULL) {
517 buffer_clear(&e->request);
518 goto send;
519 }
520 break; 604 break;
521 } 605 }
522 if (k == NULL) 606 if (r != 0 || k == NULL ||
523 goto send; 607 (r = sshbuf_get_cstring(e->request, &comment, NULL)) != 0) {
524 comment = buffer_get_string(&e->request, NULL); 608 error("%s: decode private key: %s", __func__, ssh_err(r));
609 goto err;
610 }
525 611
526 while (buffer_len(&e->request)) { 612 while (sshbuf_len(e->request)) {
527 switch ((type = buffer_get_char(&e->request))) { 613 if ((r = sshbuf_get_u8(e->request, &ctype)) != 0) {
614 error("%s: buffer error: %s", __func__, ssh_err(r));
615 goto err;
616 }
617 switch (ctype) {
528 case SSH_AGENT_CONSTRAIN_LIFETIME: 618 case SSH_AGENT_CONSTRAIN_LIFETIME:
529 death = monotime() + buffer_get_int(&e->request); 619 if ((r = sshbuf_get_u32(e->request, &seconds)) != 0) {
620 error("%s: bad lifetime constraint: %s",
621 __func__, ssh_err(r));
622 goto err;
623 }
624 death = monotime() + seconds;
530 break; 625 break;
531 case SSH_AGENT_CONSTRAIN_CONFIRM: 626 case SSH_AGENT_CONSTRAIN_CONFIRM:
532 confirm = 1; 627 confirm = 1;
533 break; 628 break;
534 default: 629 default:
535 error("process_add_identity: " 630 error("%s: Unknown constraint %d", __func__, ctype);
536 "Unknown constraint type %d", type); 631 err:
632 sshbuf_reset(e->request);
537 free(comment); 633 free(comment);
538 key_free(k); 634 sshkey_free(k);
539 goto send; 635 goto send;
540 } 636 }
541 } 637 }
638
542 success = 1; 639 success = 1;
543 if (lifetime && !death) 640 if (lifetime && !death)
544 death = monotime() + lifetime; 641 death = monotime() + lifetime;
@@ -549,26 +646,25 @@ process_add_identity(SocketEntry *e, int version)
549 /* Increment the number of identities. */ 646 /* Increment the number of identities. */
550 tab->nentries++; 647 tab->nentries++;
551 } else { 648 } else {
552 key_free(k); 649 sshkey_free(k);
553 free(id->comment); 650 free(id->comment);
554 } 651 }
555 id->comment = comment; 652 id->comment = comment;
556 id->death = death; 653 id->death = death;
557 id->confirm = confirm; 654 id->confirm = confirm;
558send: 655send:
559 buffer_put_int(&e->output, 1); 656 send_status(e, success);
560 buffer_put_char(&e->output,
561 success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE);
562} 657}
563 658
564/* XXX todo: encrypt sensitive data with passphrase */ 659/* XXX todo: encrypt sensitive data with passphrase */
565static void 660static void
566process_lock_agent(SocketEntry *e, int lock) 661process_lock_agent(SocketEntry *e, int lock)
567{ 662{
568 int success = 0; 663 int r, success = 0;
569 char *passwd; 664 char *passwd;
570 665
571 passwd = buffer_get_string(&e->request, NULL); 666 if ((r = sshbuf_get_cstring(e->request, &passwd, NULL)) != 0)
667 fatal("%s: buffer error: %s", __func__, ssh_err(r));
572 if (locked && !lock && strcmp(passwd, lock_passwd) == 0) { 668 if (locked && !lock && strcmp(passwd, lock_passwd) == 0) {
573 locked = 0; 669 locked = 0;
574 explicit_bzero(lock_passwd, strlen(lock_passwd)); 670 explicit_bzero(lock_passwd, strlen(lock_passwd));
@@ -582,25 +678,25 @@ process_lock_agent(SocketEntry *e, int lock)
582 } 678 }
583 explicit_bzero(passwd, strlen(passwd)); 679 explicit_bzero(passwd, strlen(passwd));
584 free(passwd); 680 free(passwd);
585 681 send_status(e, success);
586 buffer_put_int(&e->output, 1);
587 buffer_put_char(&e->output,
588 success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE);
589} 682}
590 683
591static void 684static void
592no_identities(SocketEntry *e, u_int type) 685no_identities(SocketEntry *e, u_int type)
593{ 686{
594 Buffer msg; 687 struct sshbuf *msg;
688 int r;
595 689
596 buffer_init(&msg); 690 if ((msg = sshbuf_new()) == NULL)
597 buffer_put_char(&msg, 691 fatal("%s: sshbuf_new failed", __func__);
692 if ((r = sshbuf_put_u8(msg,
598 (type == SSH_AGENTC_REQUEST_RSA_IDENTITIES) ? 693 (type == SSH_AGENTC_REQUEST_RSA_IDENTITIES) ?
599 SSH_AGENT_RSA_IDENTITIES_ANSWER : SSH2_AGENT_IDENTITIES_ANSWER); 694 SSH_AGENT_RSA_IDENTITIES_ANSWER :
600 buffer_put_int(&msg, 0); 695 SSH2_AGENT_IDENTITIES_ANSWER)) != 0 ||
601 buffer_put_int(&e->output, buffer_len(&msg)); 696 (r = sshbuf_put_u32(msg, 0)) != 0 ||
602 buffer_append(&e->output, buffer_ptr(&msg), buffer_len(&msg)); 697 (r = sshbuf_put_stringb(e->output, msg)) != 0)
603 buffer_free(&msg); 698 fatal("%s: buffer error: %s", __func__, ssh_err(r));
699 sshbuf_free(msg);
604} 700}
605 701
606#ifdef ENABLE_PKCS11 702#ifdef ENABLE_PKCS11
@@ -608,19 +704,27 @@ static void
608process_add_smartcard_key(SocketEntry *e) 704process_add_smartcard_key(SocketEntry *e)
609{ 705{
610 char *provider = NULL, *pin; 706 char *provider = NULL, *pin;
611 int i, type, version, count = 0, success = 0, confirm = 0; 707 int r, i, version, count = 0, success = 0, confirm = 0;
708 u_int seconds;
612 time_t death = 0; 709 time_t death = 0;
613 Key **keys = NULL, *k; 710 u_char type;
711 struct sshkey **keys = NULL, *k;
614 Identity *id; 712 Identity *id;
615 Idtab *tab; 713 Idtab *tab;
616 714
617 provider = buffer_get_string(&e->request, NULL); 715 if ((r = sshbuf_get_cstring(e->request, &provider, NULL)) != 0 ||
618 pin = buffer_get_string(&e->request, NULL); 716 (r = sshbuf_get_cstring(e->request, &pin, NULL)) != 0)
717 fatal("%s: buffer error: %s", __func__, ssh_err(r));
619 718
620 while (buffer_len(&e->request)) { 719 while (sshbuf_len(e->request)) {
621 switch ((type = buffer_get_char(&e->request))) { 720 if ((r = sshbuf_get_u8(e->request, &type)) != 0)
721 fatal("%s: buffer error: %s", __func__, ssh_err(r));
722 switch (type) {
622 case SSH_AGENT_CONSTRAIN_LIFETIME: 723 case SSH_AGENT_CONSTRAIN_LIFETIME:
623 death = monotime() + buffer_get_int(&e->request); 724 if ((r = sshbuf_get_u32(e->request, &seconds)) != 0)
725 fatal("%s: buffer error: %s",
726 __func__, ssh_err(r));
727 death = monotime() + seconds;
624 break; 728 break;
625 case SSH_AGENT_CONSTRAIN_CONFIRM: 729 case SSH_AGENT_CONSTRAIN_CONFIRM:
626 confirm = 1; 730 confirm = 1;
@@ -650,7 +754,7 @@ process_add_smartcard_key(SocketEntry *e)
650 tab->nentries++; 754 tab->nentries++;
651 success = 1; 755 success = 1;
652 } else { 756 } else {
653 key_free(k); 757 sshkey_free(k);
654 } 758 }
655 keys[i] = NULL; 759 keys[i] = NULL;
656 } 760 }
@@ -658,21 +762,20 @@ send:
658 free(pin); 762 free(pin);
659 free(provider); 763 free(provider);
660 free(keys); 764 free(keys);
661 buffer_put_int(&e->output, 1); 765 send_status(e, success);
662 buffer_put_char(&e->output,
663 success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE);
664} 766}
665 767
666static void 768static void
667process_remove_smartcard_key(SocketEntry *e) 769process_remove_smartcard_key(SocketEntry *e)
668{ 770{
669 char *provider = NULL, *pin = NULL; 771 char *provider = NULL, *pin = NULL;
670 int version, success = 0; 772 int r, version, success = 0;
671 Identity *id, *nxt; 773 Identity *id, *nxt;
672 Idtab *tab; 774 Idtab *tab;
673 775
674 provider = buffer_get_string(&e->request, NULL); 776 if ((r = sshbuf_get_cstring(e->request, &provider, NULL)) != 0 ||
675 pin = buffer_get_string(&e->request, NULL); 777 (r = sshbuf_get_cstring(e->request, &pin, NULL)) != 0)
778 fatal("%s: buffer error: %s", __func__, ssh_err(r));
676 free(pin); 779 free(pin);
677 780
678 for (version = 1; version < 3; version++) { 781 for (version = 1; version < 3; version++) {
@@ -695,9 +798,7 @@ process_remove_smartcard_key(SocketEntry *e)
695 error("process_remove_smartcard_key:" 798 error("process_remove_smartcard_key:"
696 " pkcs11_del_provider failed"); 799 " pkcs11_del_provider failed");
697 free(provider); 800 free(provider);
698 buffer_put_int(&e->output, 1); 801 send_status(e, success);
699 buffer_put_char(&e->output,
700 success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE);
701} 802}
702#endif /* ENABLE_PKCS11 */ 803#endif /* ENABLE_PKCS11 */
703 804
@@ -706,30 +807,31 @@ process_remove_smartcard_key(SocketEntry *e)
706static void 807static void
707process_message(SocketEntry *e) 808process_message(SocketEntry *e)
708{ 809{
709 u_int msg_len, type; 810 u_int msg_len;
710 u_char *cp; 811 u_char type;
812 const u_char *cp;
813 int r;
711 814
712 if (buffer_len(&e->input) < 5) 815 if (sshbuf_len(e->input) < 5)
713 return; /* Incomplete message. */ 816 return; /* Incomplete message. */
714 cp = buffer_ptr(&e->input); 817 cp = sshbuf_ptr(e->input);
715 msg_len = get_u32(cp); 818 msg_len = PEEK_U32(cp);
716 if (msg_len > 256 * 1024) { 819 if (msg_len > 256 * 1024) {
717 close_socket(e); 820 close_socket(e);
718 return; 821 return;
719 } 822 }
720 if (buffer_len(&e->input) < msg_len + 4) 823 if (sshbuf_len(e->input) < msg_len + 4)
721 return; 824 return;
722 825
723 /* move the current input to e->request */ 826 /* move the current input to e->request */
724 buffer_consume(&e->input, 4); 827 sshbuf_reset(e->request);
725 buffer_clear(&e->request); 828 if ((r = sshbuf_get_stringb(e->input, e->request)) != 0 ||
726 buffer_append(&e->request, buffer_ptr(&e->input), msg_len); 829 (r = sshbuf_get_u8(e->request, &type)) != 0)
727 buffer_consume(&e->input, msg_len); 830 fatal("%s: buffer error: %s", __func__, ssh_err(r));
728 type = buffer_get_char(&e->request);
729 831
730 /* check wheter agent is locked */ 832 /* check wheter agent is locked */
731 if (locked && type != SSH_AGENTC_UNLOCK) { 833 if (locked && type != SSH_AGENTC_UNLOCK) {
732 buffer_clear(&e->request); 834 sshbuf_reset(e->request);
733 switch (type) { 835 switch (type) {
734 case SSH_AGENTC_REQUEST_RSA_IDENTITIES: 836 case SSH_AGENTC_REQUEST_RSA_IDENTITIES:
735 case SSH2_AGENTC_REQUEST_IDENTITIES: 837 case SSH2_AGENTC_REQUEST_IDENTITIES:
@@ -738,8 +840,7 @@ process_message(SocketEntry *e)
738 break; 840 break;
739 default: 841 default:
740 /* send a fail message for all other request types */ 842 /* send a fail message for all other request types */
741 buffer_put_int(&e->output, 1); 843 send_status(e, 0);
742 buffer_put_char(&e->output, SSH_AGENT_FAILURE);
743 } 844 }
744 return; 845 return;
745 } 846 }
@@ -765,10 +866,10 @@ process_message(SocketEntry *e)
765 case SSH_AGENTC_REMOVE_RSA_IDENTITY: 866 case SSH_AGENTC_REMOVE_RSA_IDENTITY:
766 process_remove_identity(e, 1); 867 process_remove_identity(e, 1);
767 break; 868 break;
869#endif
768 case SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES: 870 case SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES:
769 process_remove_all_identities(e, 1); 871 process_remove_all_identities(e, 1); /* safe for !WITH_SSH1 */
770 break; 872 break;
771#endif
772 /* ssh2 */ 873 /* ssh2 */
773 case SSH2_AGENTC_SIGN_REQUEST: 874 case SSH2_AGENTC_SIGN_REQUEST:
774 process_sign_request2(e); 875 process_sign_request2(e);
@@ -798,9 +899,8 @@ process_message(SocketEntry *e)
798 default: 899 default:
799 /* Unknown message. Respond with failure. */ 900 /* Unknown message. Respond with failure. */
800 error("Unknown message %d", type); 901 error("Unknown message %d", type);
801 buffer_clear(&e->request); 902 sshbuf_reset(e->request);
802 buffer_put_int(&e->output, 1); 903 send_status(e, 0);
803 buffer_put_char(&e->output, SSH_AGENT_FAILURE);
804 break; 904 break;
805 } 905 }
806} 906}
@@ -818,9 +918,12 @@ new_socket(sock_type type, int fd)
818 for (i = 0; i < sockets_alloc; i++) 918 for (i = 0; i < sockets_alloc; i++)
819 if (sockets[i].type == AUTH_UNUSED) { 919 if (sockets[i].type == AUTH_UNUSED) {
820 sockets[i].fd = fd; 920 sockets[i].fd = fd;
821 buffer_init(&sockets[i].input); 921 if ((sockets[i].input = sshbuf_new()) == NULL)
822 buffer_init(&sockets[i].output); 922 fatal("%s: sshbuf_new failed", __func__);
823 buffer_init(&sockets[i].request); 923 if ((sockets[i].output = sshbuf_new()) == NULL)
924 fatal("%s: sshbuf_new failed", __func__);
925 if ((sockets[i].request = sshbuf_new()) == NULL)
926 fatal("%s: sshbuf_new failed", __func__);
824 sockets[i].type = type; 927 sockets[i].type = type;
825 return; 928 return;
826 } 929 }
@@ -831,9 +934,12 @@ new_socket(sock_type type, int fd)
831 sockets[i].type = AUTH_UNUSED; 934 sockets[i].type = AUTH_UNUSED;
832 sockets_alloc = new_alloc; 935 sockets_alloc = new_alloc;
833 sockets[old_alloc].fd = fd; 936 sockets[old_alloc].fd = fd;
834 buffer_init(&sockets[old_alloc].input); 937 if ((sockets[old_alloc].input = sshbuf_new()) == NULL)
835 buffer_init(&sockets[old_alloc].output); 938 fatal("%s: sshbuf_new failed", __func__);
836 buffer_init(&sockets[old_alloc].request); 939 if ((sockets[old_alloc].output = sshbuf_new()) == NULL)
940 fatal("%s: sshbuf_new failed", __func__);
941 if ((sockets[old_alloc].request = sshbuf_new()) == NULL)
942 fatal("%s: sshbuf_new failed", __func__);
837 sockets[old_alloc].type = type; 943 sockets[old_alloc].type = type;
838} 944}
839 945
@@ -879,7 +985,7 @@ prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, u_int *nallocp,
879 case AUTH_SOCKET: 985 case AUTH_SOCKET:
880 case AUTH_CONNECTION: 986 case AUTH_CONNECTION:
881 FD_SET(sockets[i].fd, *fdrp); 987 FD_SET(sockets[i].fd, *fdrp);
882 if (buffer_len(&sockets[i].output) > 0) 988 if (sshbuf_len(sockets[i].output) > 0)
883 FD_SET(sockets[i].fd, *fdwp); 989 FD_SET(sockets[i].fd, *fdwp);
884 break; 990 break;
885 default: 991 default:
@@ -906,7 +1012,7 @@ after_select(fd_set *readset, fd_set *writeset)
906 struct sockaddr_un sunaddr; 1012 struct sockaddr_un sunaddr;
907 socklen_t slen; 1013 socklen_t slen;
908 char buf[1024]; 1014 char buf[1024];
909 int len, sock; 1015 int len, sock, r;
910 u_int i, orig_alloc; 1016 u_int i, orig_alloc;
911 uid_t euid; 1017 uid_t euid;
912 gid_t egid; 1018 gid_t egid;
@@ -942,11 +1048,11 @@ after_select(fd_set *readset, fd_set *writeset)
942 } 1048 }
943 break; 1049 break;
944 case AUTH_CONNECTION: 1050 case AUTH_CONNECTION:
945 if (buffer_len(&sockets[i].output) > 0 && 1051 if (sshbuf_len(sockets[i].output) > 0 &&
946 FD_ISSET(sockets[i].fd, writeset)) { 1052 FD_ISSET(sockets[i].fd, writeset)) {
947 len = write(sockets[i].fd, 1053 len = write(sockets[i].fd,
948 buffer_ptr(&sockets[i].output), 1054 sshbuf_ptr(sockets[i].output),
949 buffer_len(&sockets[i].output)); 1055 sshbuf_len(sockets[i].output));
950 if (len == -1 && (errno == EAGAIN || 1056 if (len == -1 && (errno == EAGAIN ||
951 errno == EWOULDBLOCK || 1057 errno == EWOULDBLOCK ||
952 errno == EINTR)) 1058 errno == EINTR))
@@ -955,7 +1061,10 @@ after_select(fd_set *readset, fd_set *writeset)
955 close_socket(&sockets[i]); 1061 close_socket(&sockets[i]);
956 break; 1062 break;
957 } 1063 }
958 buffer_consume(&sockets[i].output, len); 1064 if ((r = sshbuf_consume(sockets[i].output,
1065 len)) != 0)
1066 fatal("%s: buffer error: %s",
1067 __func__, ssh_err(r));
959 } 1068 }
960 if (FD_ISSET(sockets[i].fd, readset)) { 1069 if (FD_ISSET(sockets[i].fd, readset)) {
961 len = read(sockets[i].fd, buf, sizeof(buf)); 1070 len = read(sockets[i].fd, buf, sizeof(buf));
@@ -967,7 +1076,10 @@ after_select(fd_set *readset, fd_set *writeset)
967 close_socket(&sockets[i]); 1076 close_socket(&sockets[i]);
968 break; 1077 break;
969 } 1078 }
970 buffer_append(&sockets[i].input, buf, len); 1079 if ((r = sshbuf_put(sockets[i].input,
1080 buf, len)) != 0)
1081 fatal("%s: buffer error: %s",
1082 __func__, ssh_err(r));
971 explicit_bzero(buf, sizeof(buf)); 1083 explicit_bzero(buf, sizeof(buf));
972 process_message(&sockets[i]); 1084 process_message(&sockets[i]);
973 } 1085 }
@@ -1025,8 +1137,8 @@ static void
1025usage(void) 1137usage(void)
1026{ 1138{
1027 fprintf(stderr, 1139 fprintf(stderr,
1028 "usage: ssh-agent [-c | -s] [-d] [-a bind_address] [-t life]\n" 1140 "usage: ssh-agent [-c | -s] [-d] [-a bind_address] [-E fingerprint_hash]\n"
1029 " [command [arg ...]]\n" 1141 " [-t life] [command [arg ...]]\n"
1030 " ssh-agent [-c | -s] -k\n"); 1142 " ssh-agent [-c | -s] -k\n");
1031 exit(1); 1143 exit(1);
1032} 1144}
@@ -1069,8 +1181,13 @@ main(int ac, char **av)
1069 __progname = ssh_get_progname(av[0]); 1181 __progname = ssh_get_progname(av[0]);
1070 seed_rng(); 1182 seed_rng();
1071 1183
1072 while ((ch = getopt(ac, av, "cdksa:t:")) != -1) { 1184 while ((ch = getopt(ac, av, "cdksE:a:t:")) != -1) {
1073 switch (ch) { 1185 switch (ch) {
1186 case 'E':
1187 fingerprint_hash = ssh_digest_alg_by_name(optarg);
1188 if (fingerprint_hash == -1)
1189 fatal("Invalid hash algorithm \"%s\"", optarg);
1190 break;
1074 case 'c': 1191 case 'c':
1075 if (s_flag) 1192 if (s_flag)
1076 usage(); 1193 usage();
diff --git a/ssh-dss.c b/ssh-dss.c
index 9643d90d8..8ed19d849 100644
--- a/ssh-dss.c
+++ b/ssh-dss.c
@@ -25,6 +25,8 @@
25 25
26#include "includes.h" 26#include "includes.h"
27 27
28#ifdef WITH_OPENSSL
29
28#include <sys/types.h> 30#include <sys/types.h>
29 31
30#include <openssl/bn.h> 32#include <openssl/bn.h>
@@ -217,3 +219,4 @@ ssh_dss_verify(const struct sshkey *key,
217 } 219 }
218 return ret; 220 return ret;
219} 221}
222#endif /* WITH_OPENSSL */
diff --git a/ssh-ecdsa.c b/ssh-ecdsa.c
index 1119db045..2c76f8b43 100644
--- a/ssh-ecdsa.c
+++ b/ssh-ecdsa.c
@@ -26,7 +26,7 @@
26 26
27#include "includes.h" 27#include "includes.h"
28 28
29#ifdef OPENSSL_HAS_ECC 29#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC)
30 30
31#include <sys/types.h> 31#include <sys/types.h>
32 32
@@ -189,4 +189,4 @@ ssh_ecdsa_verify(const struct sshkey *key,
189 return ret; 189 return ret;
190} 190}
191 191
192#endif /* OPENSSL_HAS_ECC */ 192#endif /* WITH_OPENSSL && OPENSSL_HAS_ECC */
diff --git a/ssh-ed25519.c b/ssh-ed25519.c
index cb87d4790..b159ff5ee 100644
--- a/ssh-ed25519.c
+++ b/ssh-ed25519.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-ed25519.c,v 1.4 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: ssh-ed25519.c,v 1.6 2015/01/15 21:38:50 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2013 Markus Friedl <markus@openbsd.org> 3 * Copyright (c) 2013 Markus Friedl <markus@openbsd.org>
4 * 4 *
@@ -25,9 +25,8 @@
25#include <string.h> 25#include <string.h>
26#include <stdarg.h> 26#include <stdarg.h>
27 27
28#include "xmalloc.h"
29#include "log.h" 28#include "log.h"
30#include "buffer.h" 29#include "sshbuf.h"
31#define SSHKEY_INTERNAL 30#define SSHKEY_INTERNAL
32#include "sshkey.h" 31#include "sshkey.h"
33#include "ssherr.h" 32#include "ssherr.h"
@@ -128,11 +127,13 @@ ssh_ed25519_verify(const struct sshkey *key,
128 r = SSH_ERR_INVALID_FORMAT; 127 r = SSH_ERR_INVALID_FORMAT;
129 goto out; 128 goto out;
130 } 129 }
131 if (datalen >= SIZE_MAX - len) 130 if (datalen >= SIZE_MAX - len) {
132 return SSH_ERR_INVALID_ARGUMENT; 131 r = SSH_ERR_INVALID_ARGUMENT;
132 goto out;
133 }
133 smlen = len + datalen; 134 smlen = len + datalen;
134 mlen = smlen; 135 mlen = smlen;
135 if ((sm = malloc(smlen)) == NULL || (m = xmalloc(mlen)) == NULL) { 136 if ((sm = malloc(smlen)) == NULL || (m = malloc(mlen)) == NULL) {
136 r = SSH_ERR_ALLOC_FAIL; 137 r = SSH_ERR_ALLOC_FAIL;
137 goto out; 138 goto out;
138 } 139 }
@@ -163,4 +164,3 @@ ssh_ed25519_verify(const struct sshkey *key,
163 free(ktype); 164 free(ktype);
164 return r; 165 return r;
165} 166}
166
diff --git a/ssh-keygen.0 b/ssh-keygen.0
index 648f3017f..784ad032f 100644
--- a/ssh-keygen.0
+++ b/ssh-keygen.0
@@ -1,7 +1,7 @@
1SSH-KEYGEN(1) General Commands Manual SSH-KEYGEN(1) 1SSH-KEYGEN(1) General Commands Manual SSH-KEYGEN(1)
2 2
3NAME 3NAME
4 ssh-keygen - authentication key generation, management and conversion 4 ssh-keygen M-bM-^@M-^S authentication key generation, management and conversion
5 5
6SYNOPSIS 6SYNOPSIS
7 ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1] 7 ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
@@ -11,7 +11,7 @@ SYNOPSIS
11 ssh-keygen -e [-m key_format] [-f input_keyfile] 11 ssh-keygen -e [-m key_format] [-f input_keyfile]
12 ssh-keygen -y [-f input_keyfile] 12 ssh-keygen -y [-f input_keyfile]
13 ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile] 13 ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
14 ssh-keygen -l [-f input_keyfile] 14 ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
15 ssh-keygen -B [-f input_keyfile] 15 ssh-keygen -B [-f input_keyfile]
16 ssh-keygen -D pkcs11 16 ssh-keygen -D pkcs11
17 ssh-keygen -F hostname [-f known_hosts_file] [-l] 17 ssh-keygen -F hostname [-f known_hosts_file] [-l]
@@ -32,7 +32,7 @@ SYNOPSIS
32DESCRIPTION 32DESCRIPTION
33 ssh-keygen generates, manages and converts authentication keys for 33 ssh-keygen generates, manages and converts authentication keys for
34 ssh(1). ssh-keygen can create RSA keys for use by SSH protocol version 1 34 ssh(1). ssh-keygen can create RSA keys for use by SSH protocol version 1
35 and DSA, ECDSA, ED25519 or RSA keys for use by SSH protocol version 2. 35 and DSA, ECDSA, Ed25519 or RSA keys for use by SSH protocol version 2.
36 The type of key to be generated is specified with the -t option. If 36 The type of key to be generated is specified with the -t option. If
37 invoked without any arguments, ssh-keygen will generate an RSA key for 37 invoked without any arguments, ssh-keygen will generate an RSA key for
38 use in SSH protocol 2 connections. 38 use in SSH protocol 2 connections.
@@ -52,7 +52,7 @@ DESCRIPTION
52 52
53 Normally this program generates the key and asks for a file in which to 53 Normally this program generates the key and asks for a file in which to
54 store the private key. The public key is stored in a file with the same 54 store the private key. The public key is stored in a file with the same
55 name but ``.pub'' appended. The program also asks for a passphrase. The 55 name but M-bM-^@M-^\.pubM-bM-^@M-^] appended. The program also asks for a passphrase. The
56 passphrase may be empty to indicate no passphrase (host keys must have an 56 passphrase may be empty to indicate no passphrase (host keys must have an
57 empty passphrase), or it may be a string of arbitrary length. A 57 empty passphrase), or it may be a string of arbitrary length. A
58 passphrase is similar to a password, except it can be a phrase with a 58 passphrase is similar to a password, except it can be a phrase with a
@@ -71,7 +71,7 @@ DESCRIPTION
71 For RSA1 keys, there is also a comment field in the key file that is only 71 For RSA1 keys, there is also a comment field in the key file that is only
72 for convenience to the user to help identify the key. The comment can 72 for convenience to the user to help identify the key. The comment can
73 tell what the key is for, or whatever is useful. The comment is 73 tell what the key is for, or whatever is useful. The comment is
74 initialized to ``user@host'' when the key is created, but can be changed 74 initialized to M-bM-^@M-^\user@hostM-bM-^@M-^] when the key is created, but can be changed
75 using the -c option. 75 using the -c option.
76 76
77 After a key is generated, instructions below detail where the keys should 77 After a key is generated, instructions below detail where the keys should
@@ -107,7 +107,7 @@ DESCRIPTION
107 the -b flag determines the key length by selecting from one of 107 the -b flag determines the key length by selecting from one of
108 three elliptic curve sizes: 256, 384 or 521 bits. Attempting to 108 three elliptic curve sizes: 256, 384 or 521 bits. Attempting to
109 use bit lengths other than these three values for ECDSA keys will 109 use bit lengths other than these three values for ECDSA keys will
110 fail. ED25519 keys have a fixed length and the -b flag will be 110 fail. Ed25519 keys have a fixed length and the -b flag will be
111 ignored. 111 ignored.
112 112
113 -C comment 113 -C comment
@@ -124,9 +124,14 @@ DESCRIPTION
124 indicates that a CA key resides in a PKCS#11 token (see the 124 indicates that a CA key resides in a PKCS#11 token (see the
125 CERTIFICATES section for details). 125 CERTIFICATES section for details).
126 126
127 -E fingerprint_hash
128 Specifies the hash algorithm used when displaying key
129 fingerprints. Valid options are: M-bM-^@M-^\md5M-bM-^@M-^] and M-bM-^@M-^\sha256M-bM-^@M-^]. The
130 default is M-bM-^@M-^\sha256M-bM-^@M-^].
131
127 -e This option will read a private or public OpenSSH key file and 132 -e This option will read a private or public OpenSSH key file and
128 print to stdout the key in one of the formats specified by the -m 133 print to stdout the key in one of the formats specified by the -m
129 option. The default export format is ``RFC4716''. This option 134 option. The default export format is M-bM-^@M-^\RFC4716M-bM-^@M-^]. This option
130 allows exporting OpenSSH keys for use by other programs, 135 allows exporting OpenSSH keys for use by other programs,
131 including several commercial SSH implementations. 136 including several commercial SSH implementations.
132 137
@@ -166,7 +171,7 @@ DESCRIPTION
166 in the format specified by the -m option and print an OpenSSH 171 in the format specified by the -m option and print an OpenSSH
167 compatible private (or public) key to stdout. This option allows 172 compatible private (or public) key to stdout. This option allows
168 importing keys from other software, including several commercial 173 importing keys from other software, including several commercial
169 SSH implementations. The default import format is ``RFC4716''. 174 SSH implementations. The default import format is M-bM-^@M-^\RFC4716M-bM-^@M-^].
170 175
171 -J num_lines 176 -J num_lines
172 Exit after screening the specified number of lines while 177 Exit after screening the specified number of lines while
@@ -203,10 +208,10 @@ DESCRIPTION
203 208
204 -m key_format 209 -m key_format
205 Specify a key format for the -i (import) or -e (export) 210 Specify a key format for the -i (import) or -e (export)
206 conversion options. The supported key formats are: ``RFC4716'' 211 conversion options. The supported key formats are: M-bM-^@M-^\RFC4716M-bM-^@M-^]
207 (RFC 4716/SSH2 public or private key), ``PKCS8'' (PEM PKCS8 212 (RFC 4716/SSH2 public or private key), M-bM-^@M-^\PKCS8M-bM-^@M-^] (PEM PKCS8 public
208 public key) or ``PEM'' (PEM public key). The default conversion 213 key) or M-bM-^@M-^\PEMM-bM-^@M-^] (PEM public key). The default conversion format is
209 format is ``RFC4716''. 214 M-bM-^@M-^\RFC4716M-bM-^@M-^].
210 215
211 -N new_passphrase 216 -N new_passphrase
212 Provides the new passphrase. 217 Provides the new passphrase.
@@ -315,8 +320,8 @@ DESCRIPTION
315 320
316 -t dsa | ecdsa | ed25519 | rsa | rsa1 321 -t dsa | ecdsa | ed25519 | rsa | rsa1
317 Specifies the type of key to create. The possible values are 322 Specifies the type of key to create. The possible values are
318 ``rsa1'' for protocol version 1 and ``dsa'', ``ecdsa'', 323 M-bM-^@M-^\rsa1M-bM-^@M-^] for protocol version 1 and M-bM-^@M-^\dsaM-bM-^@M-^], M-bM-^@M-^\ecdsaM-bM-^@M-^], M-bM-^@M-^\ed25519M-bM-^@M-^], or
319 ``ed25519'', or ``rsa'' for protocol version 2. 324 M-bM-^@M-^\rsaM-bM-^@M-^] for protocol version 2.
320 325
321 -u Update a KRL. When specified with -k, keys listed via the 326 -u Update a KRL. When specified with -k, keys listed via the
322 command line are added to the existing KRL rather than a new KRL 327 command line are added to the existing KRL rather than a new KRL
@@ -335,12 +340,11 @@ DESCRIPTION
335 as a YYYYMMDD date, a YYYYMMDDHHMMSS time or a relative time 340 as a YYYYMMDD date, a YYYYMMDDHHMMSS time or a relative time
336 starting with a plus character. 341 starting with a plus character.
337 342
338 For example: ``+52w1d'' (valid from now to 52 weeks and one day 343 For example: M-bM-^@M-^\+52w1dM-bM-^@M-^] (valid from now to 52 weeks and one day
339 from now), ``-4w:+4w'' (valid from four weeks ago to four weeks 344 from now), M-bM-^@M-^\-4w:+4wM-bM-^@M-^] (valid from four weeks ago to four weeks
340 from now), ``20100101123000:20110101123000'' (valid from 12:30 345 from now), M-bM-^@M-^\20100101123000:20110101123000M-bM-^@M-^] (valid from 12:30 PM,
341 PM, January 1st, 2010 to 12:30 PM, January 1st, 2011), 346 January 1st, 2010 to 12:30 PM, January 1st, 2011), M-bM-^@M-^\-1d:20110101M-bM-^@M-^]
342 ``-1d:20110101'' (valid from yesterday to midnight, January 1st, 347 (valid from yesterday to midnight, January 1st, 2011).
343 2011).
344 348
345 -v Verbose mode. Causes ssh-keygen to print debugging messages 349 -v Verbose mode. Causes ssh-keygen to print debugging messages
346 about its progress. This is helpful for debugging moduli 350 about its progress. This is helpful for debugging moduli
@@ -524,7 +528,7 @@ FILES
524 ~/.ssh/id_ecdsa 528 ~/.ssh/id_ecdsa
525 ~/.ssh/id_ed25519 529 ~/.ssh/id_ed25519
526 ~/.ssh/id_rsa 530 ~/.ssh/id_rsa
527 Contains the protocol version 2 DSA, ECDSA, ED25519 or RSA 531 Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA
528 authentication identity of the user. This file should not be 532 authentication identity of the user. This file should not be
529 readable by anyone but the user. It is possible to specify a 533 readable by anyone but the user. It is possible to specify a
530 passphrase when generating the key; that passphrase will be used 534 passphrase when generating the key; that passphrase will be used
@@ -537,7 +541,7 @@ FILES
537 ~/.ssh/id_ecdsa.pub 541 ~/.ssh/id_ecdsa.pub
538 ~/.ssh/id_ed25519.pub 542 ~/.ssh/id_ed25519.pub
539 ~/.ssh/id_rsa.pub 543 ~/.ssh/id_rsa.pub
540 Contains the protocol version 2 DSA, ECDSA, ED25519 or RSA public 544 Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA public
541 key for authentication. The contents of this file should be 545 key for authentication. The contents of this file should be
542 added to ~/.ssh/authorized_keys on all machines where the user 546 added to ~/.ssh/authorized_keys on all machines where the user
543 wishes to log in using public key authentication. There is no 547 wishes to log in using public key authentication. There is no
@@ -559,4 +563,4 @@ AUTHORS
559 created OpenSSH. Markus Friedl contributed the support for SSH protocol 563 created OpenSSH. Markus Friedl contributed the support for SSH protocol
560 versions 1.5 and 2.0. 564 versions 1.5 and 2.0.
561 565
562OpenBSD 5.6 March 31, 2014 OpenBSD 5.6 566OpenBSD 5.7 February 24, 2015 OpenBSD 5.7
diff --git a/ssh-keygen.1 b/ssh-keygen.1
index 723a0162e..9b93666c9 100644
--- a/ssh-keygen.1
+++ b/ssh-keygen.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-keygen.1,v 1.122 2014/03/31 13:39:34 jmc Exp $ 1.\" $OpenBSD: ssh-keygen.1,v 1.125 2015/02/24 15:24:05 naddy Exp $
2.\" 2.\"
3.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 3.\" Author: Tatu Ylonen <ylo@cs.hut.fi>
4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -35,7 +35,7 @@
35.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 35.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37.\" 37.\"
38.Dd $Mdocdate: March 31 2014 $ 38.Dd $Mdocdate: February 24 2015 $
39.Dt SSH-KEYGEN 1 39.Dt SSH-KEYGEN 1
40.Os 40.Os
41.Sh NAME 41.Sh NAME
@@ -73,6 +73,8 @@
73.Op Fl f Ar keyfile 73.Op Fl f Ar keyfile
74.Nm ssh-keygen 74.Nm ssh-keygen
75.Fl l 75.Fl l
76.Op Fl v
77.Op Fl E Ar fingerprint_hash
76.Op Fl f Ar input_keyfile 78.Op Fl f Ar input_keyfile
77.Nm ssh-keygen 79.Nm ssh-keygen
78.Fl B 80.Fl B
@@ -140,7 +142,7 @@ generates, manages and converts authentication keys for
140.Xr ssh 1 . 142.Xr ssh 1 .
141.Nm 143.Nm
142can create RSA keys for use by SSH protocol version 1 and 144can create RSA keys for use by SSH protocol version 1 and
143DSA, ECDSA, ED25519 or RSA keys for use by SSH protocol version 2. 145DSA, ECDSA, Ed25519 or RSA keys for use by SSH protocol version 2.
144The type of key to be generated is specified with the 146The type of key to be generated is specified with the
145.Fl t 147.Fl t
146option. 148option.
@@ -251,7 +253,7 @@ flag determines the key length by selecting from one of three elliptic
251curve sizes: 256, 384 or 521 bits. 253curve sizes: 256, 384 or 521 bits.
252Attempting to use bit lengths other than these three values for ECDSA keys 254Attempting to use bit lengths other than these three values for ECDSA keys
253will fail. 255will fail.
254ED25519 keys have a fixed length and the 256Ed25519 keys have a fixed length and the
255.Fl b 257.Fl b
256flag will be ignored. 258flag will be ignored.
257.It Fl C Ar comment 259.It Fl C Ar comment
@@ -269,6 +271,14 @@ When used in combination with
269this option indicates that a CA key resides in a PKCS#11 token (see the 271this option indicates that a CA key resides in a PKCS#11 token (see the
270.Sx CERTIFICATES 272.Sx CERTIFICATES
271section for details). 273section for details).
274.It Fl E Ar fingerprint_hash
275Specifies the hash algorithm used when displaying key fingerprints.
276Valid options are:
277.Dq md5
278and
279.Dq sha256 .
280The default is
281.Dq sha256 .
272.It Fl e 282.It Fl e
273This option will read a private or public OpenSSH key file and 283This option will read a private or public OpenSSH key file and
274print to stdout the key in one of the formats specified by the 284print to stdout the key in one of the formats specified by the
@@ -803,7 +813,7 @@ There is no need to keep the contents of this file secret.
803.It Pa ~/.ssh/id_ecdsa 813.It Pa ~/.ssh/id_ecdsa
804.It Pa ~/.ssh/id_ed25519 814.It Pa ~/.ssh/id_ed25519
805.It Pa ~/.ssh/id_rsa 815.It Pa ~/.ssh/id_rsa
806Contains the protocol version 2 DSA, ECDSA, ED25519 or RSA 816Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA
807authentication identity of the user. 817authentication identity of the user.
808This file should not be readable by anyone but the user. 818This file should not be readable by anyone but the user.
809It is possible to 819It is possible to
@@ -819,7 +829,7 @@ will read this file when a login attempt is made.
819.It Pa ~/.ssh/id_ecdsa.pub 829.It Pa ~/.ssh/id_ecdsa.pub
820.It Pa ~/.ssh/id_ed25519.pub 830.It Pa ~/.ssh/id_ed25519.pub
821.It Pa ~/.ssh/id_rsa.pub 831.It Pa ~/.ssh/id_rsa.pub
822Contains the protocol version 2 DSA, ECDSA, ED25519 or RSA 832Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA
823public key for authentication. 833public key for authentication.
824The contents of this file should be added to 834The contents of this file should be added to
825.Pa ~/.ssh/authorized_keys 835.Pa ~/.ssh/authorized_keys
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 23058ee99..a3c2362a2 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keygen.c,v 1.249 2014/07/03 03:47:27 djm Exp $ */ 1/* $OpenBSD: ssh-keygen.c,v 1.266 2015/02/26 20:45:47 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -17,11 +17,12 @@
17#include <sys/types.h> 17#include <sys/types.h>
18#include <sys/socket.h> 18#include <sys/socket.h>
19#include <sys/stat.h> 19#include <sys/stat.h>
20#include <sys/param.h>
21 20
21#ifdef WITH_OPENSSL
22#include <openssl/evp.h> 22#include <openssl/evp.h>
23#include <openssl/pem.h> 23#include <openssl/pem.h>
24#include "openbsd-compat/openssl-compat.h" 24#include "openbsd-compat/openssl-compat.h"
25#endif
25 26
26#include <errno.h> 27#include <errno.h>
27#include <fcntl.h> 28#include <fcntl.h>
@@ -35,13 +36,14 @@
35#include <stdlib.h> 36#include <stdlib.h>
36#include <string.h> 37#include <string.h>
37#include <unistd.h> 38#include <unistd.h>
39#include <limits.h>
38 40
39#include "xmalloc.h" 41#include "xmalloc.h"
40#include "key.h" 42#include "sshkey.h"
41#include "rsa.h" 43#include "rsa.h"
42#include "authfile.h" 44#include "authfile.h"
43#include "uuencode.h" 45#include "uuencode.h"
44#include "buffer.h" 46#include "sshbuf.h"
45#include "pathnames.h" 47#include "pathnames.h"
46#include "log.h" 48#include "log.h"
47#include "misc.h" 49#include "misc.h"
@@ -50,9 +52,11 @@
50#include "dns.h" 52#include "dns.h"
51#include "ssh.h" 53#include "ssh.h"
52#include "ssh2.h" 54#include "ssh2.h"
55#include "ssherr.h"
53#include "ssh-pkcs11.h" 56#include "ssh-pkcs11.h"
54#include "atomicio.h" 57#include "atomicio.h"
55#include "krl.h" 58#include "krl.h"
59#include "digest.h"
56 60
57/* Number of bits in the RSA/DSA key. This value can be set on the command line. */ 61/* Number of bits in the RSA/DSA key. This value can be set on the command line. */
58#define DEFAULT_BITS 2048 62#define DEFAULT_BITS 2048
@@ -90,6 +94,9 @@ int show_cert = 0;
90int print_fingerprint = 0; 94int print_fingerprint = 0;
91int print_bubblebabble = 0; 95int print_bubblebabble = 0;
92 96
97/* Hash algorithm to use for fingerprints. */
98int fingerprint_hash = SSH_FP_HASH_DEFAULT;
99
93/* The identity file name, given on the command line or entered by the user. */ 100/* The identity file name, given on the command line or entered by the user. */
94char identity_file[1024]; 101char identity_file[1024];
95int have_identity = 0; 102int have_identity = 0;
@@ -173,34 +180,43 @@ int prime_test(FILE *, FILE *, u_int32_t, u_int32_t, char *, unsigned long,
173 unsigned long); 180 unsigned long);
174 181
175static void 182static void
176type_bits_valid(int type, u_int32_t *bitsp) 183type_bits_valid(int type, const char *name, u_int32_t *bitsp)
177{ 184{
185#ifdef WITH_OPENSSL
178 u_int maxbits; 186 u_int maxbits;
187 int nid;
188#endif
179 189
180 if (type == KEY_UNSPEC) { 190 if (type == KEY_UNSPEC) {
181 fprintf(stderr, "unknown key type %s\n", key_type_name); 191 fprintf(stderr, "unknown key type %s\n", key_type_name);
182 exit(1); 192 exit(1);
183 } 193 }
184 if (*bitsp == 0) { 194 if (*bitsp == 0) {
195#ifdef WITH_OPENSSL
185 if (type == KEY_DSA) 196 if (type == KEY_DSA)
186 *bitsp = DEFAULT_BITS_DSA; 197 *bitsp = DEFAULT_BITS_DSA;
187 else if (type == KEY_ECDSA) 198 else if (type == KEY_ECDSA) {
188 *bitsp = DEFAULT_BITS_ECDSA; 199 if (name != NULL &&
189 else 200 (nid = sshkey_ecdsa_nid_from_name(name)) > 0)
201 *bitsp = sshkey_curve_nid_to_bits(nid);
202 if (*bitsp == 0)
203 *bitsp = DEFAULT_BITS_ECDSA;
204 } else
205#endif
190 *bitsp = DEFAULT_BITS; 206 *bitsp = DEFAULT_BITS;
191 } 207 }
208#ifdef WITH_OPENSSL
192 maxbits = (type == KEY_DSA) ? 209 maxbits = (type == KEY_DSA) ?
193 OPENSSL_DSA_MAX_MODULUS_BITS : OPENSSL_RSA_MAX_MODULUS_BITS; 210 OPENSSL_DSA_MAX_MODULUS_BITS : OPENSSL_RSA_MAX_MODULUS_BITS;
194 if (*bitsp > maxbits) { 211 if (*bitsp > maxbits) {
195 fprintf(stderr, "key bits exceeds maximum %d\n", maxbits); 212 fprintf(stderr, "key bits exceeds maximum %d\n", maxbits);
196 exit(1); 213 exit(1);
197 } 214 }
198#ifdef WITH_OPENSSL
199 if (type == KEY_DSA && *bitsp != 1024) 215 if (type == KEY_DSA && *bitsp != 1024)
200 fatal("DSA keys must be 1024 bits"); 216 fatal("DSA keys must be 1024 bits");
201 else if (type != KEY_ECDSA && type != KEY_ED25519 && *bitsp < 768) 217 else if (type != KEY_ECDSA && type != KEY_ED25519 && *bitsp < 768)
202 fatal("Key must at least be 768 bits"); 218 fatal("Key must at least be 768 bits");
203 else if (type == KEY_ECDSA && key_ecdsa_bits_to_nid(*bitsp) == -1) 219 else if (type == KEY_ECDSA && sshkey_ecdsa_bits_to_nid(*bitsp) == -1)
204 fatal("Invalid ECDSA key length - valid lengths are " 220 fatal("Invalid ECDSA key length - valid lengths are "
205 "256, 384 or 521 bits"); 221 "256, 384 or 521 bits");
206#endif 222#endif
@@ -215,7 +231,7 @@ ask_filename(struct passwd *pw, const char *prompt)
215 if (key_type_name == NULL) 231 if (key_type_name == NULL)
216 name = _PATH_SSH_CLIENT_ID_RSA; 232 name = _PATH_SSH_CLIENT_ID_RSA;
217 else { 233 else {
218 switch (key_type_from_name(key_type_name)) { 234 switch (sshkey_type_from_name(key_type_name)) {
219 case KEY_RSA1: 235 case KEY_RSA1:
220 name = _PATH_SSH_CLIENT_IDENTITY; 236 name = _PATH_SSH_CLIENT_IDENTITY;
221 break; 237 break;
@@ -255,23 +271,26 @@ ask_filename(struct passwd *pw, const char *prompt)
255 have_identity = 1; 271 have_identity = 1;
256} 272}
257 273
258static Key * 274static struct sshkey *
259load_identity(char *filename) 275load_identity(char *filename)
260{ 276{
261 char *pass; 277 char *pass;
262 Key *prv; 278 struct sshkey *prv;
279 int r;
263 280
264 prv = key_load_private(filename, "", NULL); 281 if ((r = sshkey_load_private(filename, "", &prv, NULL)) == 0)
265 if (prv == NULL) { 282 return prv;
266 if (identity_passphrase) 283 if (r != SSH_ERR_KEY_WRONG_PASSPHRASE)
267 pass = xstrdup(identity_passphrase); 284 fatal("Load key \"%s\": %s", filename, ssh_err(r));
268 else 285 if (identity_passphrase)
269 pass = read_passphrase("Enter passphrase: ", 286 pass = xstrdup(identity_passphrase);
270 RP_ALLOW_STDIN); 287 else
271 prv = key_load_private(filename, pass, NULL); 288 pass = read_passphrase("Enter passphrase: ", RP_ALLOW_STDIN);
272 explicit_bzero(pass, strlen(pass)); 289 r = sshkey_load_private(filename, pass, &prv, NULL);
273 free(pass); 290 explicit_bzero(pass, strlen(pass));
274 } 291 free(pass);
292 if (r != 0)
293 fatal("Load key \"%s\": %s", filename, ssh_err(r));
275 return prv; 294 return prv;
276} 295}
277 296
@@ -282,39 +301,40 @@ load_identity(char *filename)
282 301
283#ifdef WITH_OPENSSL 302#ifdef WITH_OPENSSL
284static void 303static void
285do_convert_to_ssh2(struct passwd *pw, Key *k) 304do_convert_to_ssh2(struct passwd *pw, struct sshkey *k)
286{ 305{
287 u_int len; 306 size_t len;
288 u_char *blob; 307 u_char *blob;
289 char comment[61]; 308 char comment[61];
309 int r;
290 310
291 if (k->type == KEY_RSA1) { 311 if (k->type == KEY_RSA1) {
292 fprintf(stderr, "version 1 keys are not supported\n"); 312 fprintf(stderr, "version 1 keys are not supported\n");
293 exit(1); 313 exit(1);
294 } 314 }
295 if (key_to_blob(k, &blob, &len) <= 0) { 315 if ((r = sshkey_to_blob(k, &blob, &len)) != 0) {
296 fprintf(stderr, "key_to_blob failed\n"); 316 fprintf(stderr, "key_to_blob failed: %s\n", ssh_err(r));
297 exit(1); 317 exit(1);
298 } 318 }
299 /* Comment + surrounds must fit into 72 chars (RFC 4716 sec 3.3) */ 319 /* Comment + surrounds must fit into 72 chars (RFC 4716 sec 3.3) */
300 snprintf(comment, sizeof(comment), 320 snprintf(comment, sizeof(comment),
301 "%u-bit %s, converted by %s@%s from OpenSSH", 321 "%u-bit %s, converted by %s@%s from OpenSSH",
302 key_size(k), key_type(k), 322 sshkey_size(k), sshkey_type(k),
303 pw->pw_name, hostname); 323 pw->pw_name, hostname);
304 324
305 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN); 325 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN);
306 fprintf(stdout, "Comment: \"%s\"\n", comment); 326 fprintf(stdout, "Comment: \"%s\"\n", comment);
307 dump_base64(stdout, blob, len); 327 dump_base64(stdout, blob, len);
308 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_END); 328 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_END);
309 key_free(k); 329 sshkey_free(k);
310 free(blob); 330 free(blob);
311 exit(0); 331 exit(0);
312} 332}
313 333
314static void 334static void
315do_convert_to_pkcs8(Key *k) 335do_convert_to_pkcs8(struct sshkey *k)
316{ 336{
317 switch (key_type_plain(k->type)) { 337 switch (sshkey_type_plain(k->type)) {
318 case KEY_RSA1: 338 case KEY_RSA1:
319 case KEY_RSA: 339 case KEY_RSA:
320 if (!PEM_write_RSA_PUBKEY(stdout, k->rsa)) 340 if (!PEM_write_RSA_PUBKEY(stdout, k->rsa))
@@ -331,15 +351,15 @@ do_convert_to_pkcs8(Key *k)
331 break; 351 break;
332#endif 352#endif
333 default: 353 default:
334 fatal("%s: unsupported key type %s", __func__, key_type(k)); 354 fatal("%s: unsupported key type %s", __func__, sshkey_type(k));
335 } 355 }
336 exit(0); 356 exit(0);
337} 357}
338 358
339static void 359static void
340do_convert_to_pem(Key *k) 360do_convert_to_pem(struct sshkey *k)
341{ 361{
342 switch (key_type_plain(k->type)) { 362 switch (sshkey_type_plain(k->type)) {
343 case KEY_RSA1: 363 case KEY_RSA1:
344 case KEY_RSA: 364 case KEY_RSA:
345 if (!PEM_write_RSAPublicKey(stdout, k->rsa)) 365 if (!PEM_write_RSAPublicKey(stdout, k->rsa))
@@ -353,7 +373,7 @@ do_convert_to_pem(Key *k)
353#endif 373#endif
354 /* XXX ECDSA? */ 374 /* XXX ECDSA? */
355 default: 375 default:
356 fatal("%s: unsupported key type %s", __func__, key_type(k)); 376 fatal("%s: unsupported key type %s", __func__, sshkey_type(k));
357 } 377 }
358 exit(0); 378 exit(0);
359} 379}
@@ -361,20 +381,16 @@ do_convert_to_pem(Key *k)
361static void 381static void
362do_convert_to(struct passwd *pw) 382do_convert_to(struct passwd *pw)
363{ 383{
364 Key *k; 384 struct sshkey *k;
365 struct stat st; 385 struct stat st;
386 int r;
366 387
367 if (!have_identity) 388 if (!have_identity)
368 ask_filename(pw, "Enter file in which the key is"); 389 ask_filename(pw, "Enter file in which the key is");
369 if (stat(identity_file, &st) < 0) 390 if (stat(identity_file, &st) < 0)
370 fatal("%s: %s: %s", __progname, identity_file, strerror(errno)); 391 fatal("%s: %s: %s", __progname, identity_file, strerror(errno));
371 if ((k = key_load_public(identity_file, NULL)) == NULL) { 392 if ((r = sshkey_load_public(identity_file, &k, NULL)) != 0)
372 if ((k = load_identity(identity_file)) == NULL) { 393 k = load_identity(identity_file);
373 fprintf(stderr, "load failed\n");
374 exit(1);
375 }
376 }
377
378 switch (convert_format) { 394 switch (convert_format) {
379 case FMT_RFC4716: 395 case FMT_RFC4716:
380 do_convert_to_ssh2(pw, k); 396 do_convert_to_ssh2(pw, k);
@@ -391,51 +407,63 @@ do_convert_to(struct passwd *pw)
391 exit(0); 407 exit(0);
392} 408}
393 409
410/*
411 * This is almost exactly the bignum1 encoding, but with 32 bit for length
412 * instead of 16.
413 */
394static void 414static void
395buffer_get_bignum_bits(Buffer *b, BIGNUM *value) 415buffer_get_bignum_bits(struct sshbuf *b, BIGNUM *value)
396{ 416{
397 u_int bignum_bits = buffer_get_int(b); 417 u_int bytes, bignum_bits;
398 u_int bytes = (bignum_bits + 7) / 8; 418 int r;
399 419
400 if (buffer_len(b) < bytes) 420 if ((r = sshbuf_get_u32(b, &bignum_bits)) != 0)
401 fatal("buffer_get_bignum_bits: input buffer too small: " 421 fatal("%s: buffer error: %s", __func__, ssh_err(r));
402 "need %d have %d", bytes, buffer_len(b)); 422 bytes = (bignum_bits + 7) / 8;
403 if (BN_bin2bn(buffer_ptr(b), bytes, value) == NULL) 423 if (sshbuf_len(b) < bytes)
404 fatal("buffer_get_bignum_bits: BN_bin2bn failed"); 424 fatal("%s: input buffer too small: need %d have %zu",
405 buffer_consume(b, bytes); 425 __func__, bytes, sshbuf_len(b));
426 if (BN_bin2bn(sshbuf_ptr(b), bytes, value) == NULL)
427 fatal("%s: BN_bin2bn failed", __func__);
428 if ((r = sshbuf_consume(b, bytes)) != 0)
429 fatal("%s: buffer error: %s", __func__, ssh_err(r));
406} 430}
407 431
408static Key * 432static struct sshkey *
409do_convert_private_ssh2_from_blob(u_char *blob, u_int blen) 433do_convert_private_ssh2_from_blob(u_char *blob, u_int blen)
410{ 434{
411 Buffer b; 435 struct sshbuf *b;
412 Key *key = NULL; 436 struct sshkey *key = NULL;
413 char *type, *cipher; 437 char *type, *cipher;
414 u_char *sig = NULL, data[] = "abcde12345"; 438 u_char e1, e2, e3, *sig = NULL, data[] = "abcde12345";
415 int magic, rlen, ktype, i1, i2, i3, i4; 439 int r, rlen, ktype;
416 u_int slen; 440 u_int magic, i1, i2, i3, i4;
441 size_t slen;
417 u_long e; 442 u_long e;
418 443
419 buffer_init(&b); 444 if ((b = sshbuf_from(blob, blen)) == NULL)
420 buffer_append(&b, blob, blen); 445 fatal("%s: sshbuf_from failed", __func__);
446 if ((r = sshbuf_get_u32(b, &magic)) != 0)
447 fatal("%s: buffer error: %s", __func__, ssh_err(r));
421 448
422 magic = buffer_get_int(&b);
423 if (magic != SSH_COM_PRIVATE_KEY_MAGIC) { 449 if (magic != SSH_COM_PRIVATE_KEY_MAGIC) {
424 error("bad magic 0x%x != 0x%x", magic, SSH_COM_PRIVATE_KEY_MAGIC); 450 error("bad magic 0x%x != 0x%x", magic,
425 buffer_free(&b); 451 SSH_COM_PRIVATE_KEY_MAGIC);
452 sshbuf_free(b);
426 return NULL; 453 return NULL;
427 } 454 }
428 i1 = buffer_get_int(&b); 455 if ((r = sshbuf_get_u32(b, &i1)) != 0 ||
429 type = buffer_get_string(&b, NULL); 456 (r = sshbuf_get_cstring(b, &type, NULL)) != 0 ||
430 cipher = buffer_get_string(&b, NULL); 457 (r = sshbuf_get_cstring(b, &cipher, NULL)) != 0 ||
431 i2 = buffer_get_int(&b); 458 (r = sshbuf_get_u32(b, &i2)) != 0 ||
432 i3 = buffer_get_int(&b); 459 (r = sshbuf_get_u32(b, &i3)) != 0 ||
433 i4 = buffer_get_int(&b); 460 (r = sshbuf_get_u32(b, &i4)) != 0)
461 fatal("%s: buffer error: %s", __func__, ssh_err(r));
434 debug("ignore (%d %d %d %d)", i1, i2, i3, i4); 462 debug("ignore (%d %d %d %d)", i1, i2, i3, i4);
435 if (strcmp(cipher, "none") != 0) { 463 if (strcmp(cipher, "none") != 0) {
436 error("unsupported cipher %s", cipher); 464 error("unsupported cipher %s", cipher);
437 free(cipher); 465 free(cipher);
438 buffer_free(&b); 466 sshbuf_free(b);
439 free(type); 467 free(type);
440 return NULL; 468 return NULL;
441 } 469 }
@@ -446,56 +474,64 @@ do_convert_private_ssh2_from_blob(u_char *blob, u_int blen)
446 } else if (strstr(type, "rsa")) { 474 } else if (strstr(type, "rsa")) {
447 ktype = KEY_RSA; 475 ktype = KEY_RSA;
448 } else { 476 } else {
449 buffer_free(&b); 477 sshbuf_free(b);
450 free(type); 478 free(type);
451 return NULL; 479 return NULL;
452 } 480 }
453 key = key_new_private(ktype); 481 if ((key = sshkey_new_private(ktype)) == NULL)
482 fatal("key_new_private failed");
454 free(type); 483 free(type);
455 484
456 switch (key->type) { 485 switch (key->type) {
457 case KEY_DSA: 486 case KEY_DSA:
458 buffer_get_bignum_bits(&b, key->dsa->p); 487 buffer_get_bignum_bits(b, key->dsa->p);
459 buffer_get_bignum_bits(&b, key->dsa->g); 488 buffer_get_bignum_bits(b, key->dsa->g);
460 buffer_get_bignum_bits(&b, key->dsa->q); 489 buffer_get_bignum_bits(b, key->dsa->q);
461 buffer_get_bignum_bits(&b, key->dsa->pub_key); 490 buffer_get_bignum_bits(b, key->dsa->pub_key);
462 buffer_get_bignum_bits(&b, key->dsa->priv_key); 491 buffer_get_bignum_bits(b, key->dsa->priv_key);
463 break; 492 break;
464 case KEY_RSA: 493 case KEY_RSA:
465 e = buffer_get_char(&b); 494 if ((r = sshbuf_get_u8(b, &e1)) != 0 ||
495 (e1 < 30 && (r = sshbuf_get_u8(b, &e2)) != 0) ||
496 (e1 < 30 && (r = sshbuf_get_u8(b, &e3)) != 0))
497 fatal("%s: buffer error: %s", __func__, ssh_err(r));
498 e = e1;
466 debug("e %lx", e); 499 debug("e %lx", e);
467 if (e < 30) { 500 if (e < 30) {
468 e <<= 8; 501 e <<= 8;
469 e += buffer_get_char(&b); 502 e += e2;
470 debug("e %lx", e); 503 debug("e %lx", e);
471 e <<= 8; 504 e <<= 8;
472 e += buffer_get_char(&b); 505 e += e3;
473 debug("e %lx", e); 506 debug("e %lx", e);
474 } 507 }
475 if (!BN_set_word(key->rsa->e, e)) { 508 if (!BN_set_word(key->rsa->e, e)) {
476 buffer_free(&b); 509 sshbuf_free(b);
477 key_free(key); 510 sshkey_free(key);
478 return NULL; 511 return NULL;
479 } 512 }
480 buffer_get_bignum_bits(&b, key->rsa->d); 513 buffer_get_bignum_bits(b, key->rsa->d);
481 buffer_get_bignum_bits(&b, key->rsa->n); 514 buffer_get_bignum_bits(b, key->rsa->n);
482 buffer_get_bignum_bits(&b, key->rsa->iqmp); 515 buffer_get_bignum_bits(b, key->rsa->iqmp);
483 buffer_get_bignum_bits(&b, key->rsa->q); 516 buffer_get_bignum_bits(b, key->rsa->q);
484 buffer_get_bignum_bits(&b, key->rsa->p); 517 buffer_get_bignum_bits(b, key->rsa->p);
485 if (rsa_generate_additional_parameters(key->rsa) != 0) 518 if ((r = rsa_generate_additional_parameters(key->rsa)) != 0)
486 fatal("%s: rsa_generate_additional_parameters " 519 fatal("generate RSA parameters failed: %s", ssh_err(r));
487 "error", __func__);
488 break; 520 break;
489 } 521 }
490 rlen = buffer_len(&b); 522 rlen = sshbuf_len(b);
491 if (rlen != 0) 523 if (rlen != 0)
492 error("do_convert_private_ssh2_from_blob: " 524 error("do_convert_private_ssh2_from_blob: "
493 "remaining bytes in key blob %d", rlen); 525 "remaining bytes in key blob %d", rlen);
494 buffer_free(&b); 526 sshbuf_free(b);
495 527
496 /* try the key */ 528 /* try the key */
497 key_sign(key, &sig, &slen, data, sizeof(data)); 529 if (sshkey_sign(key, &sig, &slen, data, sizeof(data), 0) != 0 ||
498 key_verify(key, sig, slen, data, sizeof(data)); 530 sshkey_verify(key, sig, slen, data, sizeof(data), 0) != 0) {
531 sshkey_free(key);
532 free(sig);
533 return NULL;
534 }
499 free(sig); 535 free(sig);
500 return key; 536 return key;
501} 537}
@@ -531,14 +567,13 @@ get_line(FILE *fp, char *line, size_t len)
531} 567}
532 568
533static void 569static void
534do_convert_from_ssh2(struct passwd *pw, Key **k, int *private) 570do_convert_from_ssh2(struct passwd *pw, struct sshkey **k, int *private)
535{ 571{
536 int blen; 572 int r, blen, escaped = 0;
537 u_int len; 573 u_int len;
538 char line[1024]; 574 char line[1024];
539 u_char blob[8096]; 575 u_char blob[8096];
540 char encoded[8096]; 576 char encoded[8096];
541 int escaped = 0;
542 FILE *fp; 577 FILE *fp;
543 578
544 if ((fp = fopen(identity_file, "r")) == NULL) 579 if ((fp = fopen(identity_file, "r")) == NULL)
@@ -575,18 +610,17 @@ do_convert_from_ssh2(struct passwd *pw, Key **k, int *private)
575 fprintf(stderr, "uudecode failed.\n"); 610 fprintf(stderr, "uudecode failed.\n");
576 exit(1); 611 exit(1);
577 } 612 }
578 *k = *private ? 613 if (*private)
579 do_convert_private_ssh2_from_blob(blob, blen) : 614 *k = do_convert_private_ssh2_from_blob(blob, blen);
580 key_from_blob(blob, blen); 615 else if ((r = sshkey_from_blob(blob, blen, k)) != 0) {
581 if (*k == NULL) { 616 fprintf(stderr, "decode blob failed: %s\n", ssh_err(r));
582 fprintf(stderr, "decode blob failed.\n");
583 exit(1); 617 exit(1);
584 } 618 }
585 fclose(fp); 619 fclose(fp);
586} 620}
587 621
588static void 622static void
589do_convert_from_pkcs8(Key **k, int *private) 623do_convert_from_pkcs8(struct sshkey **k, int *private)
590{ 624{
591 EVP_PKEY *pubkey; 625 EVP_PKEY *pubkey;
592 FILE *fp; 626 FILE *fp;
@@ -600,21 +634,24 @@ do_convert_from_pkcs8(Key **k, int *private)
600 fclose(fp); 634 fclose(fp);
601 switch (EVP_PKEY_type(pubkey->type)) { 635 switch (EVP_PKEY_type(pubkey->type)) {
602 case EVP_PKEY_RSA: 636 case EVP_PKEY_RSA:
603 *k = key_new(KEY_UNSPEC); 637 if ((*k = sshkey_new(KEY_UNSPEC)) == NULL)
638 fatal("sshkey_new failed");
604 (*k)->type = KEY_RSA; 639 (*k)->type = KEY_RSA;
605 (*k)->rsa = EVP_PKEY_get1_RSA(pubkey); 640 (*k)->rsa = EVP_PKEY_get1_RSA(pubkey);
606 break; 641 break;
607 case EVP_PKEY_DSA: 642 case EVP_PKEY_DSA:
608 *k = key_new(KEY_UNSPEC); 643 if ((*k = sshkey_new(KEY_UNSPEC)) == NULL)
644 fatal("sshkey_new failed");
609 (*k)->type = KEY_DSA; 645 (*k)->type = KEY_DSA;
610 (*k)->dsa = EVP_PKEY_get1_DSA(pubkey); 646 (*k)->dsa = EVP_PKEY_get1_DSA(pubkey);
611 break; 647 break;
612#ifdef OPENSSL_HAS_ECC 648#ifdef OPENSSL_HAS_ECC
613 case EVP_PKEY_EC: 649 case EVP_PKEY_EC:
614 *k = key_new(KEY_UNSPEC); 650 if ((*k = sshkey_new(KEY_UNSPEC)) == NULL)
651 fatal("sshkey_new failed");
615 (*k)->type = KEY_ECDSA; 652 (*k)->type = KEY_ECDSA;
616 (*k)->ecdsa = EVP_PKEY_get1_EC_KEY(pubkey); 653 (*k)->ecdsa = EVP_PKEY_get1_EC_KEY(pubkey);
617 (*k)->ecdsa_nid = key_ecdsa_key_to_nid((*k)->ecdsa); 654 (*k)->ecdsa_nid = sshkey_ecdsa_key_to_nid((*k)->ecdsa);
618 break; 655 break;
619#endif 656#endif
620 default: 657 default:
@@ -626,7 +663,7 @@ do_convert_from_pkcs8(Key **k, int *private)
626} 663}
627 664
628static void 665static void
629do_convert_from_pem(Key **k, int *private) 666do_convert_from_pem(struct sshkey **k, int *private)
630{ 667{
631 FILE *fp; 668 FILE *fp;
632 RSA *rsa; 669 RSA *rsa;
@@ -637,7 +674,8 @@ do_convert_from_pem(Key **k, int *private)
637 if ((fp = fopen(identity_file, "r")) == NULL) 674 if ((fp = fopen(identity_file, "r")) == NULL)
638 fatal("%s: %s: %s", __progname, identity_file, strerror(errno)); 675 fatal("%s: %s: %s", __progname, identity_file, strerror(errno));
639 if ((rsa = PEM_read_RSAPublicKey(fp, NULL, NULL, NULL)) != NULL) { 676 if ((rsa = PEM_read_RSAPublicKey(fp, NULL, NULL, NULL)) != NULL) {
640 *k = key_new(KEY_UNSPEC); 677 if ((*k = sshkey_new(KEY_UNSPEC)) == NULL)
678 fatal("sshkey_new failed");
641 (*k)->type = KEY_RSA; 679 (*k)->type = KEY_RSA;
642 (*k)->rsa = rsa; 680 (*k)->rsa = rsa;
643 fclose(fp); 681 fclose(fp);
@@ -646,7 +684,8 @@ do_convert_from_pem(Key **k, int *private)
646#if notyet /* OpenSSH 0.9.8 lacks this function */ 684#if notyet /* OpenSSH 0.9.8 lacks this function */
647 rewind(fp); 685 rewind(fp);
648 if ((dsa = PEM_read_DSAPublicKey(fp, NULL, NULL, NULL)) != NULL) { 686 if ((dsa = PEM_read_DSAPublicKey(fp, NULL, NULL, NULL)) != NULL) {
649 *k = key_new(KEY_UNSPEC); 687 if ((*k = sshkey_new(KEY_UNSPEC)) == NULL)
688 fatal("sshkey_new failed");
650 (*k)->type = KEY_DSA; 689 (*k)->type = KEY_DSA;
651 (*k)->dsa = dsa; 690 (*k)->dsa = dsa;
652 fclose(fp); 691 fclose(fp);
@@ -660,8 +699,8 @@ do_convert_from_pem(Key **k, int *private)
660static void 699static void
661do_convert_from(struct passwd *pw) 700do_convert_from(struct passwd *pw)
662{ 701{
663 Key *k = NULL; 702 struct sshkey *k = NULL;
664 int private = 0, ok = 0; 703 int r, private = 0, ok = 0;
665 struct stat st; 704 struct stat st;
666 705
667 if (!have_identity) 706 if (!have_identity)
@@ -683,11 +722,12 @@ do_convert_from(struct passwd *pw)
683 fatal("%s: unknown key format %d", __func__, convert_format); 722 fatal("%s: unknown key format %d", __func__, convert_format);
684 } 723 }
685 724
686 if (!private) 725 if (!private) {
687 ok = key_write(k, stdout); 726 if ((r = sshkey_write(k, stdout)) == 0)
727 ok = 1;
688 if (ok) 728 if (ok)
689 fprintf(stdout, "\n"); 729 fprintf(stdout, "\n");
690 else { 730 } else {
691 switch (k->type) { 731 switch (k->type) {
692 case KEY_DSA: 732 case KEY_DSA:
693 ok = PEM_write_DSAPrivateKey(stdout, k->dsa, NULL, 733 ok = PEM_write_DSAPrivateKey(stdout, k->dsa, NULL,
@@ -705,7 +745,7 @@ do_convert_from(struct passwd *pw)
705 break; 745 break;
706 default: 746 default:
707 fatal("%s: unsupported key type %s", __func__, 747 fatal("%s: unsupported key type %s", __func__,
708 key_type(k)); 748 sshkey_type(k));
709 } 749 }
710 } 750 }
711 751
@@ -713,7 +753,7 @@ do_convert_from(struct passwd *pw)
713 fprintf(stderr, "key write failed\n"); 753 fprintf(stderr, "key write failed\n");
714 exit(1); 754 exit(1);
715 } 755 }
716 key_free(k); 756 sshkey_free(k);
717 exit(0); 757 exit(0);
718} 758}
719#endif 759#endif
@@ -721,8 +761,9 @@ do_convert_from(struct passwd *pw)
721static void 761static void
722do_print_public(struct passwd *pw) 762do_print_public(struct passwd *pw)
723{ 763{
724 Key *prv; 764 struct sshkey *prv;
725 struct stat st; 765 struct stat st;
766 int r;
726 767
727 if (!have_identity) 768 if (!have_identity)
728 ask_filename(pw, "Enter file in which the key is"); 769 ask_filename(pw, "Enter file in which the key is");
@@ -731,13 +772,9 @@ do_print_public(struct passwd *pw)
731 exit(1); 772 exit(1);
732 } 773 }
733 prv = load_identity(identity_file); 774 prv = load_identity(identity_file);
734 if (prv == NULL) { 775 if ((r = sshkey_write(prv, stdout)) != 0)
735 fprintf(stderr, "load failed\n"); 776 fprintf(stderr, "key_write failed: %s", ssh_err(r));
736 exit(1); 777 sshkey_free(prv);
737 }
738 if (!key_write(prv, stdout))
739 fprintf(stderr, "key_write failed");
740 key_free(prv);
741 fprintf(stdout, "\n"); 778 fprintf(stdout, "\n");
742 exit(0); 779 exit(0);
743} 780}
@@ -746,14 +783,14 @@ static void
746do_download(struct passwd *pw) 783do_download(struct passwd *pw)
747{ 784{
748#ifdef ENABLE_PKCS11 785#ifdef ENABLE_PKCS11
749 Key **keys = NULL; 786 struct sshkey **keys = NULL;
750 int i, nkeys; 787 int i, nkeys;
751 enum fp_rep rep; 788 enum sshkey_fp_rep rep;
752 enum fp_type fptype; 789 int fptype;
753 char *fp, *ra; 790 char *fp, *ra;
754 791
755 fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5; 792 fptype = print_bubblebabble ? SSH_DIGEST_SHA1 : fingerprint_hash;
756 rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX; 793 rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_DEFAULT;
757 794
758 pkcs11_init(0); 795 pkcs11_init(0);
759 nkeys = pkcs11_add_provider(pkcs11provider, NULL, &keys); 796 nkeys = pkcs11_add_provider(pkcs11provider, NULL, &keys);
@@ -761,20 +798,22 @@ do_download(struct passwd *pw)
761 fatal("cannot read public key from pkcs11"); 798 fatal("cannot read public key from pkcs11");
762 for (i = 0; i < nkeys; i++) { 799 for (i = 0; i < nkeys; i++) {
763 if (print_fingerprint) { 800 if (print_fingerprint) {
764 fp = key_fingerprint(keys[i], fptype, rep); 801 fp = sshkey_fingerprint(keys[i], fptype, rep);
765 ra = key_fingerprint(keys[i], SSH_FP_MD5, 802 ra = sshkey_fingerprint(keys[i], fingerprint_hash,
766 SSH_FP_RANDOMART); 803 SSH_FP_RANDOMART);
767 printf("%u %s %s (PKCS11 key)\n", key_size(keys[i]), 804 if (fp == NULL || ra == NULL)
768 fp, key_type(keys[i])); 805 fatal("%s: sshkey_fingerprint fail", __func__);
806 printf("%u %s %s (PKCS11 key)\n", sshkey_size(keys[i]),
807 fp, sshkey_type(keys[i]));
769 if (log_level >= SYSLOG_LEVEL_VERBOSE) 808 if (log_level >= SYSLOG_LEVEL_VERBOSE)
770 printf("%s\n", ra); 809 printf("%s\n", ra);
771 free(ra); 810 free(ra);
772 free(fp); 811 free(fp);
773 } else { 812 } else {
774 key_write(keys[i], stdout); 813 (void) sshkey_write(keys[i], stdout); /* XXX check */
775 fprintf(stdout, "\n"); 814 fprintf(stdout, "\n");
776 } 815 }
777 key_free(keys[i]); 816 sshkey_free(keys[i]);
778 } 817 }
779 free(keys); 818 free(keys);
780 pkcs11_terminate(); 819 pkcs11_terminate();
@@ -788,31 +827,35 @@ static void
788do_fingerprint(struct passwd *pw) 827do_fingerprint(struct passwd *pw)
789{ 828{
790 FILE *f; 829 FILE *f;
791 Key *public; 830 struct sshkey *public;
792 char *comment = NULL, *cp, *ep, line[16*1024], *fp, *ra; 831 char *comment = NULL, *cp, *ep, line[16*1024], *fp, *ra;
793 int i, skip = 0, num = 0, invalid = 1; 832 int r, i, skip = 0, num = 0, invalid = 1;
794 enum fp_rep rep; 833 enum sshkey_fp_rep rep;
795 enum fp_type fptype; 834 int fptype;
796 struct stat st; 835 struct stat st;
797 836
798 fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5; 837 fptype = print_bubblebabble ? SSH_DIGEST_SHA1 : fingerprint_hash;
799 rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX; 838 rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_DEFAULT;
800
801 if (!have_identity) 839 if (!have_identity)
802 ask_filename(pw, "Enter file in which the key is"); 840 ask_filename(pw, "Enter file in which the key is");
803 if (stat(identity_file, &st) < 0) { 841 if (stat(identity_file, &st) < 0) {
804 perror(identity_file); 842 perror(identity_file);
805 exit(1); 843 exit(1);
806 } 844 }
807 public = key_load_public(identity_file, &comment); 845 if ((r = sshkey_load_public(identity_file, &public, &comment)) != 0)
808 if (public != NULL) { 846 debug2("Error loading public key \"%s\": %s",
809 fp = key_fingerprint(public, fptype, rep); 847 identity_file, ssh_err(r));
810 ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART); 848 else {
811 printf("%u %s %s (%s)\n", key_size(public), fp, comment, 849 fp = sshkey_fingerprint(public, fptype, rep);
812 key_type(public)); 850 ra = sshkey_fingerprint(public, fingerprint_hash,
851 SSH_FP_RANDOMART);
852 if (fp == NULL || ra == NULL)
853 fatal("%s: sshkey_fingerprint fail", __func__);
854 printf("%u %s %s (%s)\n", sshkey_size(public), fp, comment,
855 sshkey_type(public));
813 if (log_level >= SYSLOG_LEVEL_VERBOSE) 856 if (log_level >= SYSLOG_LEVEL_VERBOSE)
814 printf("%s\n", ra); 857 printf("%s\n", ra);
815 key_free(public); 858 sshkey_free(public);
816 free(comment); 859 free(comment);
817 free(ra); 860 free(ra);
818 free(fp); 861 free(fp);
@@ -861,26 +904,31 @@ do_fingerprint(struct passwd *pw)
861 *cp++ = '\0'; 904 *cp++ = '\0';
862 } 905 }
863 ep = cp; 906 ep = cp;
864 public = key_new(KEY_RSA1); 907 if ((public = sshkey_new(KEY_RSA1)) == NULL)
865 if (key_read(public, &cp) != 1) { 908 fatal("sshkey_new failed");
909 if ((r = sshkey_read(public, &cp)) != 0) {
866 cp = ep; 910 cp = ep;
867 key_free(public); 911 sshkey_free(public);
868 public = key_new(KEY_UNSPEC); 912 if ((public = sshkey_new(KEY_UNSPEC)) == NULL)
869 if (key_read(public, &cp) != 1) { 913 fatal("sshkey_new failed");
870 key_free(public); 914 if ((r = sshkey_read(public, &cp)) != 0) {
915 sshkey_free(public);
871 continue; 916 continue;
872 } 917 }
873 } 918 }
874 comment = *cp ? cp : comment; 919 comment = *cp ? cp : comment;
875 fp = key_fingerprint(public, fptype, rep); 920 fp = sshkey_fingerprint(public, fptype, rep);
876 ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART); 921 ra = sshkey_fingerprint(public, fingerprint_hash,
877 printf("%u %s %s (%s)\n", key_size(public), fp, 922 SSH_FP_RANDOMART);
878 comment ? comment : "no comment", key_type(public)); 923 if (fp == NULL || ra == NULL)
924 fatal("%s: sshkey_fingerprint fail", __func__);
925 printf("%u %s %s (%s)\n", sshkey_size(public), fp,
926 comment ? comment : "no comment", sshkey_type(public));
879 if (log_level >= SYSLOG_LEVEL_VERBOSE) 927 if (log_level >= SYSLOG_LEVEL_VERBOSE)
880 printf("%s\n", ra); 928 printf("%s\n", ra);
881 free(ra); 929 free(ra);
882 free(fp); 930 free(fp);
883 key_free(public); 931 sshkey_free(public);
884 invalid = 0; 932 invalid = 0;
885 } 933 }
886 fclose(f); 934 fclose(f);
@@ -912,9 +960,9 @@ do_gen_all_hostkeys(struct passwd *pw)
912 960
913 int first = 0; 961 int first = 0;
914 struct stat st; 962 struct stat st;
915 Key *private, *public; 963 struct sshkey *private, *public;
916 char comment[1024]; 964 char comment[1024];
917 int i, type, fd; 965 int i, type, fd, r;
918 FILE *f; 966 FILE *f;
919 967
920 for (i = 0; key_types[i].key_type; i++) { 968 for (i = 0; key_types[i].key_type; i++) {
@@ -933,98 +981,175 @@ do_gen_all_hostkeys(struct passwd *pw)
933 } 981 }
934 printf("%s ", key_types[i].key_type_display); 982 printf("%s ", key_types[i].key_type_display);
935 fflush(stdout); 983 fflush(stdout);
936 type = key_type_from_name(key_types[i].key_type); 984 type = sshkey_type_from_name(key_types[i].key_type);
937 strlcpy(identity_file, key_types[i].path, sizeof(identity_file)); 985 strlcpy(identity_file, key_types[i].path, sizeof(identity_file));
938 bits = 0; 986 bits = 0;
939 type_bits_valid(type, &bits); 987 type_bits_valid(type, NULL, &bits);
940 private = key_generate(type, bits); 988 if ((r = sshkey_generate(type, bits, &private)) != 0) {
941 if (private == NULL) { 989 fprintf(stderr, "key_generate failed: %s\n",
942 fprintf(stderr, "key_generate failed\n"); 990 ssh_err(r));
943 first = 0; 991 first = 0;
944 continue; 992 continue;
945 } 993 }
946 public = key_from_private(private); 994 if ((r = sshkey_from_private(private, &public)) != 0)
995 fatal("sshkey_from_private failed: %s", ssh_err(r));
947 snprintf(comment, sizeof comment, "%s@%s", pw->pw_name, 996 snprintf(comment, sizeof comment, "%s@%s", pw->pw_name,
948 hostname); 997 hostname);
949 if (!key_save_private(private, identity_file, "", comment, 998 if ((r = sshkey_save_private(private, identity_file, "",
950 use_new_format, new_format_cipher, rounds)) { 999 comment, use_new_format, new_format_cipher, rounds)) != 0) {
951 printf("Saving the key failed: %s.\n", identity_file); 1000 printf("Saving key \"%s\" failed: %s\n", identity_file,
952 key_free(private); 1001 ssh_err(r));
953 key_free(public); 1002 sshkey_free(private);
1003 sshkey_free(public);
954 first = 0; 1004 first = 0;
955 continue; 1005 continue;
956 } 1006 }
957 key_free(private); 1007 sshkey_free(private);
958 strlcat(identity_file, ".pub", sizeof(identity_file)); 1008 strlcat(identity_file, ".pub", sizeof(identity_file));
959 fd = open(identity_file, O_WRONLY | O_CREAT | O_TRUNC, 0644); 1009 fd = open(identity_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
960 if (fd == -1) { 1010 if (fd == -1) {
961 printf("Could not save your public key in %s\n", 1011 printf("Could not save your public key in %s\n",
962 identity_file); 1012 identity_file);
963 key_free(public); 1013 sshkey_free(public);
964 first = 0; 1014 first = 0;
965 continue; 1015 continue;
966 } 1016 }
967 f = fdopen(fd, "w"); 1017 f = fdopen(fd, "w");
968 if (f == NULL) { 1018 if (f == NULL) {
969 printf("fdopen %s failed\n", identity_file); 1019 printf("fdopen %s failed\n", identity_file);
970 key_free(public); 1020 close(fd);
1021 sshkey_free(public);
971 first = 0; 1022 first = 0;
972 continue; 1023 continue;
973 } 1024 }
974 if (!key_write(public, f)) { 1025 if ((r = sshkey_write(public, f)) != 0) {
975 fprintf(stderr, "write key failed\n"); 1026 fprintf(stderr, "write key failed: %s\n", ssh_err(r));
976 key_free(public); 1027 fclose(f);
1028 sshkey_free(public);
977 first = 0; 1029 first = 0;
978 continue; 1030 continue;
979 } 1031 }
980 fprintf(f, " %s\n", comment); 1032 fprintf(f, " %s\n", comment);
981 fclose(f); 1033 fclose(f);
982 key_free(public); 1034 sshkey_free(public);
983 1035
984 } 1036 }
985 if (first != 0) 1037 if (first != 0)
986 printf("\n"); 1038 printf("\n");
987} 1039}
988 1040
989static void 1041struct known_hosts_ctx {
990printhost(FILE *f, const char *name, Key *public, int ca, int revoked, int hash) 1042 const char *host; /* Hostname searched for in find/delete case */
1043 FILE *out; /* Output file, stdout for find_hosts case */
1044 int has_unhashed; /* When hashing, original had unhashed hosts */
1045 int found_key; /* For find/delete, host was found */
1046 int invalid; /* File contained invalid items; don't delete */
1047};
1048
1049static int
1050known_hosts_hash(struct hostkey_foreach_line *l, void *_ctx)
991{ 1051{
992 if (print_fingerprint) { 1052 struct known_hosts_ctx *ctx = (struct known_hosts_ctx *)_ctx;
993 enum fp_rep rep; 1053 char *hashed, *cp, *hosts, *ohosts;
994 enum fp_type fptype; 1054 int has_wild = l->hosts && strcspn(l->hosts, "*?!") != strlen(l->hosts);
995 char *fp, *ra; 1055
996 1056 switch (l->status) {
997 fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5; 1057 case HKF_STATUS_OK:
998 rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX; 1058 case HKF_STATUS_MATCHED:
999 fp = key_fingerprint(public, fptype, rep); 1059 /*
1000 ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART); 1060 * Don't hash hosts already already hashed, with wildcard
1001 printf("%u %s %s (%s)\n", key_size(public), fp, name, 1061 * characters or a CA/revocation marker.
1002 key_type(public)); 1062 */
1003 if (log_level >= SYSLOG_LEVEL_VERBOSE) 1063 if ((l->match & HKF_MATCH_HOST_HASHED) != 0 ||
1004 printf("%s\n", ra); 1064 has_wild || l->marker != MRK_NONE) {
1005 free(ra); 1065 fprintf(ctx->out, "%s\n", l->line);
1006 free(fp); 1066 if (has_wild && !find_host) {
1007 } else { 1067 fprintf(stderr, "%s:%ld: ignoring host name "
1008 if (hash && (name = host_hash(name, NULL, 0)) == NULL) 1068 "with wildcard: %.64s\n", l->path,
1009 fatal("hash_host failed"); 1069 l->linenum, l->hosts);
1010 fprintf(f, "%s%s%s ", ca ? CA_MARKER " " : "", 1070 }
1011 revoked ? REVOKE_MARKER " " : "" , name); 1071 return 0;
1012 if (!key_write(public, f)) 1072 }
1013 fatal("key_write failed"); 1073 /*
1014 fprintf(f, "\n"); 1074 * Split any comma-separated hostnames from the host list,
1075 * hash and store separately.
1076 */
1077 ohosts = hosts = xstrdup(l->hosts);
1078 while ((cp = strsep(&hosts, ",")) != NULL && *cp != '\0') {
1079 if ((hashed = host_hash(cp, NULL, 0)) == NULL)
1080 fatal("hash_host failed");
1081 fprintf(ctx->out, "%s %s\n", hashed, l->rawkey);
1082 ctx->has_unhashed = 1;
1083 }
1084 free(ohosts);
1085 return 0;
1086 case HKF_STATUS_INVALID:
1087 /* Retain invalid lines, but mark file as invalid. */
1088 ctx->invalid = 1;
1089 fprintf(stderr, "%s:%ld: invalid line\n", l->path, l->linenum);
1090 /* FALLTHROUGH */
1091 default:
1092 fprintf(ctx->out, "%s\n", l->line);
1093 return 0;
1015 } 1094 }
1095 /* NOTREACHED */
1096 return -1;
1097}
1098
1099static int
1100known_hosts_find_delete(struct hostkey_foreach_line *l, void *_ctx)
1101{
1102 struct known_hosts_ctx *ctx = (struct known_hosts_ctx *)_ctx;
1103
1104 if (l->status == HKF_STATUS_MATCHED) {
1105 if (delete_host) {
1106 if (l->marker != MRK_NONE) {
1107 /* Don't remove CA and revocation lines */
1108 fprintf(ctx->out, "%s\n", l->line);
1109 } else {
1110 /*
1111 * Hostname matches and has no CA/revoke
1112 * marker, delete it by *not* writing the
1113 * line to ctx->out.
1114 */
1115 ctx->found_key = 1;
1116 if (!quiet)
1117 printf("# Host %s found: line %ld\n",
1118 ctx->host, l->linenum);
1119 }
1120 return 0;
1121 } else if (find_host) {
1122 ctx->found_key = 1;
1123 if (!quiet) {
1124 printf("# Host %s found: line %ld %s\n",
1125 ctx->host,
1126 l->linenum, l->marker == MRK_CA ? "CA" :
1127 (l->marker == MRK_REVOKE ? "REVOKED" : ""));
1128 }
1129 if (hash_hosts)
1130 known_hosts_hash(l, ctx);
1131 else
1132 fprintf(ctx->out, "%s\n", l->line);
1133 return 0;
1134 }
1135 } else if (delete_host) {
1136 /* Retain non-matching hosts when deleting */
1137 if (l->status == HKF_STATUS_INVALID) {
1138 ctx->invalid = 1;
1139 fprintf(stderr, "%s:%ld: invalid line\n",
1140 l->path, l->linenum);
1141 }
1142 fprintf(ctx->out, "%s\n", l->line);
1143 }
1144 return 0;
1016} 1145}
1017 1146
1018static void 1147static void
1019do_known_hosts(struct passwd *pw, const char *name) 1148do_known_hosts(struct passwd *pw, const char *name)
1020{ 1149{
1021 FILE *in, *out = stdout; 1150 char *cp, tmp[PATH_MAX], old[PATH_MAX];
1022 Key *pub; 1151 int r, fd, oerrno, inplace = 0;
1023 char *cp, *cp2, *kp, *kp2; 1152 struct known_hosts_ctx ctx;
1024 char line[16*1024], tmp[MAXPATHLEN], old[MAXPATHLEN];
1025 int c, skip = 0, inplace = 0, num = 0, invalid = 0, has_unhashed = 0;
1026 int ca, revoked;
1027 int found_key = 0;
1028 1153
1029 if (!have_identity) { 1154 if (!have_identity) {
1030 cp = tilde_expand_filename(_PATH_SSH_USER_HOSTFILE, pw->pw_uid); 1155 cp = tilde_expand_filename(_PATH_SSH_USER_HOSTFILE, pw->pw_uid);
@@ -1034,10 +1159,11 @@ do_known_hosts(struct passwd *pw, const char *name)
1034 free(cp); 1159 free(cp);
1035 have_identity = 1; 1160 have_identity = 1;
1036 } 1161 }
1037 if ((in = fopen(identity_file, "r")) == NULL)
1038 fatal("%s: %s: %s", __progname, identity_file, strerror(errno));
1039 1162
1040 /* XXX this code is a mess; refactor -djm */ 1163 memset(&ctx, 0, sizeof(ctx));
1164 ctx.out = stdout;
1165 ctx.host = name;
1166
1041 /* 1167 /*
1042 * Find hosts goes to stdout, hash and deletions happen in-place 1168 * Find hosts goes to stdout, hash and deletions happen in-place
1043 * A corner case is ssh-keygen -HF foo, which should go to stdout 1169 * A corner case is ssh-keygen -HF foo, which should go to stdout
@@ -1049,182 +1175,39 @@ do_known_hosts(struct passwd *pw, const char *name)
1049 strlcat(old, ".old", sizeof(old)) >= sizeof(old)) 1175 strlcat(old, ".old", sizeof(old)) >= sizeof(old))
1050 fatal("known_hosts path too long"); 1176 fatal("known_hosts path too long");
1051 umask(077); 1177 umask(077);
1052 if ((c = mkstemp(tmp)) == -1) 1178 if ((fd = mkstemp(tmp)) == -1)
1053 fatal("mkstemp: %s", strerror(errno)); 1179 fatal("mkstemp: %s", strerror(errno));
1054 if ((out = fdopen(c, "w")) == NULL) { 1180 if ((ctx.out = fdopen(fd, "w")) == NULL) {
1055 c = errno; 1181 oerrno = errno;
1056 unlink(tmp); 1182 unlink(tmp);
1057 fatal("fdopen: %s", strerror(c)); 1183 fatal("fdopen: %s", strerror(oerrno));
1058 } 1184 }
1059 inplace = 1; 1185 inplace = 1;
1060 } 1186 }
1061 1187
1062 while (fgets(line, sizeof(line), in)) { 1188 /* XXX support identity_file == "-" for stdin */
1063 if ((cp = strchr(line, '\n')) == NULL) { 1189 if ((r = hostkeys_foreach(identity_file,
1064 error("line %d too long: %.40s...", num + 1, line); 1190 hash_hosts ? known_hosts_hash : known_hosts_find_delete, &ctx,
1065 skip = 1; 1191 name, NULL, find_host ? HKF_WANT_MATCH : 0)) != 0)
1066 invalid = 1; 1192 fatal("%s: hostkeys_foreach failed: %s", __func__, ssh_err(r));
1067 continue;
1068 }
1069 num++;
1070 if (skip) {
1071 skip = 0;
1072 continue;
1073 }
1074 *cp = '\0';
1075 1193
1076 /* Skip leading whitespace, empty and comment lines. */ 1194 if (inplace)
1077 for (cp = line; *cp == ' ' || *cp == '\t'; cp++) 1195 fclose(ctx.out);
1078 ;
1079 if (!*cp || *cp == '\n' || *cp == '#') {
1080 if (inplace)
1081 fprintf(out, "%s\n", cp);
1082 continue;
1083 }
1084 /* Check whether this is a CA key or revocation marker */
1085 if (strncasecmp(cp, CA_MARKER, sizeof(CA_MARKER) - 1) == 0 &&
1086 (cp[sizeof(CA_MARKER) - 1] == ' ' ||
1087 cp[sizeof(CA_MARKER) - 1] == '\t')) {
1088 ca = 1;
1089 cp += sizeof(CA_MARKER);
1090 } else
1091 ca = 0;
1092 if (strncasecmp(cp, REVOKE_MARKER,
1093 sizeof(REVOKE_MARKER) - 1) == 0 &&
1094 (cp[sizeof(REVOKE_MARKER) - 1] == ' ' ||
1095 cp[sizeof(REVOKE_MARKER) - 1] == '\t')) {
1096 revoked = 1;
1097 cp += sizeof(REVOKE_MARKER);
1098 } else
1099 revoked = 0;
1100 1196
1101 /* Find the end of the host name portion. */ 1197 if (ctx.invalid) {
1102 for (kp = cp; *kp && *kp != ' ' && *kp != '\t'; kp++)
1103 ;
1104
1105 if (*kp == '\0' || *(kp + 1) == '\0') {
1106 error("line %d missing key: %.40s...",
1107 num, line);
1108 invalid = 1;
1109 continue;
1110 }
1111 *kp++ = '\0';
1112 kp2 = kp;
1113
1114 pub = key_new(KEY_RSA1);
1115 if (key_read(pub, &kp) != 1) {
1116 kp = kp2;
1117 key_free(pub);
1118 pub = key_new(KEY_UNSPEC);
1119 if (key_read(pub, &kp) != 1) {
1120 error("line %d invalid key: %.40s...",
1121 num, line);
1122 key_free(pub);
1123 invalid = 1;
1124 continue;
1125 }
1126 }
1127
1128 if (*cp == HASH_DELIM) {
1129 if (find_host || delete_host) {
1130 cp2 = host_hash(name, cp, strlen(cp));
1131 if (cp2 == NULL) {
1132 error("line %d: invalid hashed "
1133 "name: %.64s...", num, line);
1134 invalid = 1;
1135 continue;
1136 }
1137 c = (strcmp(cp2, cp) == 0);
1138 if (find_host && c) {
1139 if (!quiet)
1140 printf("# Host %s found: "
1141 "line %d type %s%s\n", name,
1142 num, key_type(pub),
1143 ca ? " (CA key)" :
1144 revoked? " (revoked)" : "");
1145 printhost(out, cp, pub, ca, revoked, 0);
1146 found_key = 1;
1147 }
1148 if (delete_host) {
1149 if (!c || ca || revoked) {
1150 printhost(out, cp, pub,
1151 ca, revoked, 0);
1152 } else {
1153 printf("# Host %s found: "
1154 "line %d type %s\n", name,
1155 num, key_type(pub));
1156 }
1157 }
1158 } else if (hash_hosts)
1159 printhost(out, cp, pub, ca, revoked, 0);
1160 } else {
1161 if (find_host || delete_host) {
1162 c = (match_hostname(name, cp,
1163 strlen(cp)) == 1);
1164 if (find_host && c) {
1165 if (!quiet)
1166 printf("# Host %s found: "
1167 "line %d type %s%s\n", name,
1168 num, key_type(pub),
1169 ca ? " (CA key)" : "");
1170 printhost(out, name, pub, ca, revoked,
1171 hash_hosts && !(ca || revoked));
1172 found_key = 1;
1173 }
1174 if (delete_host) {
1175 if (!c || ca || revoked) {
1176 printhost(out, cp, pub,
1177 ca, revoked, 0);
1178 } else {
1179 printf("# Host %s found: "
1180 "line %d type %s\n", name,
1181 num, key_type(pub));
1182 }
1183 }
1184 } else if (hash_hosts && (ca || revoked)) {
1185 /* Don't hash CA and revoked keys' hostnames */
1186 printhost(out, cp, pub, ca, revoked, 0);
1187 has_unhashed = 1;
1188 } else if (hash_hosts) {
1189 /* Hash each hostname separately */
1190 for (cp2 = strsep(&cp, ",");
1191 cp2 != NULL && *cp2 != '\0';
1192 cp2 = strsep(&cp, ",")) {
1193 if (strcspn(cp2, "*?!") !=
1194 strlen(cp2)) {
1195 fprintf(stderr, "Warning: "
1196 "ignoring host name with "
1197 "metacharacters: %.64s\n",
1198 cp2);
1199 printhost(out, cp2, pub, ca,
1200 revoked, 0);
1201 has_unhashed = 1;
1202 } else {
1203 printhost(out, cp2, pub, ca,
1204 revoked, 1);
1205 }
1206 }
1207 }
1208 }
1209 key_free(pub);
1210 }
1211 fclose(in);
1212
1213 if (invalid) {
1214 fprintf(stderr, "%s is not a valid known_hosts file.\n", 1198 fprintf(stderr, "%s is not a valid known_hosts file.\n",
1215 identity_file); 1199 identity_file);
1216 if (inplace) { 1200 if (inplace) {
1217 fprintf(stderr, "Not replacing existing known_hosts " 1201 fprintf(stderr, "Not replacing existing known_hosts "
1218 "file because of errors\n"); 1202 "file because of errors\n");
1219 fclose(out);
1220 unlink(tmp); 1203 unlink(tmp);
1221 } 1204 }
1222 exit(1); 1205 exit(1);
1223 } 1206 } else if (delete_host && !ctx.found_key) {
1224 1207 fprintf(stderr, "Host %s not found in %s\n",
1225 if (inplace) { 1208 name, identity_file);
1226 fclose(out); 1209 unlink(tmp);
1227 1210 } else if (inplace) {
1228 /* Backup existing file */ 1211 /* Backup existing file */
1229 if (unlink(old) == -1 && errno != ENOENT) 1212 if (unlink(old) == -1 && errno != ENOENT)
1230 fatal("unlink %.100s: %s", old, strerror(errno)); 1213 fatal("unlink %.100s: %s", old, strerror(errno));
@@ -1242,7 +1225,7 @@ do_known_hosts(struct passwd *pw, const char *name)
1242 1225
1243 fprintf(stderr, "%s updated.\n", identity_file); 1226 fprintf(stderr, "%s updated.\n", identity_file);
1244 fprintf(stderr, "Original contents retained as %s\n", old); 1227 fprintf(stderr, "Original contents retained as %s\n", old);
1245 if (has_unhashed) { 1228 if (ctx.has_unhashed) {
1246 fprintf(stderr, "WARNING: %s contains unhashed " 1229 fprintf(stderr, "WARNING: %s contains unhashed "
1247 "entries\n", old); 1230 "entries\n", old);
1248 fprintf(stderr, "Delete this file to ensure privacy " 1231 fprintf(stderr, "Delete this file to ensure privacy "
@@ -1250,7 +1233,7 @@ do_known_hosts(struct passwd *pw, const char *name)
1250 } 1233 }
1251 } 1234 }
1252 1235
1253 exit (find_host && !found_key); 1236 exit (find_host && !ctx.found_key);
1254} 1237}
1255 1238
1256/* 1239/*
@@ -1263,7 +1246,8 @@ do_change_passphrase(struct passwd *pw)
1263 char *comment; 1246 char *comment;
1264 char *old_passphrase, *passphrase1, *passphrase2; 1247 char *old_passphrase, *passphrase1, *passphrase2;
1265 struct stat st; 1248 struct stat st;
1266 Key *private; 1249 struct sshkey *private;
1250 int r;
1267 1251
1268 if (!have_identity) 1252 if (!have_identity)
1269 ask_filename(pw, "Enter file in which the key is"); 1253 ask_filename(pw, "Enter file in which the key is");
@@ -1272,24 +1256,28 @@ do_change_passphrase(struct passwd *pw)
1272 exit(1); 1256 exit(1);
1273 } 1257 }
1274 /* Try to load the file with empty passphrase. */ 1258 /* Try to load the file with empty passphrase. */
1275 private = key_load_private(identity_file, "", &comment); 1259 r = sshkey_load_private(identity_file, "", &private, &comment);
1276 if (private == NULL) { 1260 if (r == SSH_ERR_KEY_WRONG_PASSPHRASE) {
1277 if (identity_passphrase) 1261 if (identity_passphrase)
1278 old_passphrase = xstrdup(identity_passphrase); 1262 old_passphrase = xstrdup(identity_passphrase);
1279 else 1263 else
1280 old_passphrase = 1264 old_passphrase =
1281 read_passphrase("Enter old passphrase: ", 1265 read_passphrase("Enter old passphrase: ",
1282 RP_ALLOW_STDIN); 1266 RP_ALLOW_STDIN);
1283 private = key_load_private(identity_file, old_passphrase, 1267 r = sshkey_load_private(identity_file, old_passphrase,
1284 &comment); 1268 &private, &comment);
1285 explicit_bzero(old_passphrase, strlen(old_passphrase)); 1269 explicit_bzero(old_passphrase, strlen(old_passphrase));
1286 free(old_passphrase); 1270 free(old_passphrase);
1287 if (private == NULL) { 1271 if (r != 0)
1288 printf("Bad passphrase.\n"); 1272 goto badkey;
1289 exit(1); 1273 } else if (r != 0) {
1290 } 1274 badkey:
1275 fprintf(stderr, "Failed to load key \"%s\": %s\n",
1276 identity_file, ssh_err(r));
1277 exit(1);
1291 } 1278 }
1292 printf("Key has comment '%s'\n", comment); 1279 if (comment)
1280 printf("Key has comment '%s'\n", comment);
1293 1281
1294 /* Ask the new passphrase (twice). */ 1282 /* Ask the new passphrase (twice). */
1295 if (identity_new_passphrase) { 1283 if (identity_new_passphrase) {
@@ -1317,19 +1305,20 @@ do_change_passphrase(struct passwd *pw)
1317 } 1305 }
1318 1306
1319 /* Save the file using the new passphrase. */ 1307 /* Save the file using the new passphrase. */
1320 if (!key_save_private(private, identity_file, passphrase1, comment, 1308 if ((r = sshkey_save_private(private, identity_file, passphrase1,
1321 use_new_format, new_format_cipher, rounds)) { 1309 comment, use_new_format, new_format_cipher, rounds)) != 0) {
1322 printf("Saving the key failed: %s.\n", identity_file); 1310 printf("Saving key \"%s\" failed: %s.\n",
1311 identity_file, ssh_err(r));
1323 explicit_bzero(passphrase1, strlen(passphrase1)); 1312 explicit_bzero(passphrase1, strlen(passphrase1));
1324 free(passphrase1); 1313 free(passphrase1);
1325 key_free(private); 1314 sshkey_free(private);
1326 free(comment); 1315 free(comment);
1327 exit(1); 1316 exit(1);
1328 } 1317 }
1329 /* Destroy the passphrase and the copy of the key in memory. */ 1318 /* Destroy the passphrase and the copy of the key in memory. */
1330 explicit_bzero(passphrase1, strlen(passphrase1)); 1319 explicit_bzero(passphrase1, strlen(passphrase1));
1331 free(passphrase1); 1320 free(passphrase1);
1332 key_free(private); /* Destroys contents */ 1321 sshkey_free(private); /* Destroys contents */
1333 free(comment); 1322 free(comment);
1334 1323
1335 printf("Your identification has been saved with the new passphrase.\n"); 1324 printf("Your identification has been saved with the new passphrase.\n");
@@ -1342,9 +1331,10 @@ do_change_passphrase(struct passwd *pw)
1342static int 1331static int
1343do_print_resource_record(struct passwd *pw, char *fname, char *hname) 1332do_print_resource_record(struct passwd *pw, char *fname, char *hname)
1344{ 1333{
1345 Key *public; 1334 struct sshkey *public;
1346 char *comment = NULL; 1335 char *comment = NULL;
1347 struct stat st; 1336 struct stat st;
1337 int r;
1348 1338
1349 if (fname == NULL) 1339 if (fname == NULL)
1350 fatal("%s: no filename", __func__); 1340 fatal("%s: no filename", __func__);
@@ -1354,18 +1344,15 @@ do_print_resource_record(struct passwd *pw, char *fname, char *hname)
1354 perror(fname); 1344 perror(fname);
1355 exit(1); 1345 exit(1);
1356 } 1346 }
1357 public = key_load_public(fname, &comment); 1347 if ((r = sshkey_load_public(fname, &public, &comment)) != 0) {
1358 if (public != NULL) { 1348 printf("Failed to read v2 public key from \"%s\": %s.\n",
1359 export_dns_rr(hname, public, stdout, print_generic); 1349 fname, ssh_err(r));
1360 key_free(public); 1350 exit(1);
1361 free(comment);
1362 return 1;
1363 } 1351 }
1364 if (comment) 1352 export_dns_rr(hname, public, stdout, print_generic);
1365 free(comment); 1353 sshkey_free(public);
1366 1354 free(comment);
1367 printf("failed to read v2 public key from %s.\n", fname); 1355 return 1;
1368 exit(1);
1369} 1356}
1370 1357
1371/* 1358/*
@@ -1375,11 +1362,11 @@ static void
1375do_change_comment(struct passwd *pw) 1362do_change_comment(struct passwd *pw)
1376{ 1363{
1377 char new_comment[1024], *comment, *passphrase; 1364 char new_comment[1024], *comment, *passphrase;
1378 Key *private; 1365 struct sshkey *private;
1379 Key *public; 1366 struct sshkey *public;
1380 struct stat st; 1367 struct stat st;
1381 FILE *f; 1368 FILE *f;
1382 int fd; 1369 int r, fd;
1383 1370
1384 if (!have_identity) 1371 if (!have_identity)
1385 ask_filename(pw, "Enter file in which the key is"); 1372 ask_filename(pw, "Enter file in which the key is");
@@ -1387,8 +1374,14 @@ do_change_comment(struct passwd *pw)
1387 perror(identity_file); 1374 perror(identity_file);
1388 exit(1); 1375 exit(1);
1389 } 1376 }
1390 private = key_load_private(identity_file, "", &comment); 1377 if ((r = sshkey_load_private(identity_file, "",
1391 if (private == NULL) { 1378 &private, &comment)) == 0)
1379 passphrase = xstrdup("");
1380 else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
1381 printf("Cannot load private key \"%s\": %s.\n",
1382 identity_file, ssh_err(r));
1383 exit(1);
1384 } else {
1392 if (identity_passphrase) 1385 if (identity_passphrase)
1393 passphrase = xstrdup(identity_passphrase); 1386 passphrase = xstrdup(identity_passphrase);
1394 else if (identity_new_passphrase) 1387 else if (identity_new_passphrase)
@@ -1397,19 +1390,18 @@ do_change_comment(struct passwd *pw)
1397 passphrase = read_passphrase("Enter passphrase: ", 1390 passphrase = read_passphrase("Enter passphrase: ",
1398 RP_ALLOW_STDIN); 1391 RP_ALLOW_STDIN);
1399 /* Try to load using the passphrase. */ 1392 /* Try to load using the passphrase. */
1400 private = key_load_private(identity_file, passphrase, &comment); 1393 if ((r = sshkey_load_private(identity_file, passphrase,
1401 if (private == NULL) { 1394 &private, &comment)) != 0) {
1402 explicit_bzero(passphrase, strlen(passphrase)); 1395 explicit_bzero(passphrase, strlen(passphrase));
1403 free(passphrase); 1396 free(passphrase);
1404 printf("Bad passphrase.\n"); 1397 printf("Cannot load private key \"%s\": %s.\n",
1398 identity_file, ssh_err(r));
1405 exit(1); 1399 exit(1);
1406 } 1400 }
1407 } else {
1408 passphrase = xstrdup("");
1409 } 1401 }
1410 if (private->type != KEY_RSA1) { 1402 if (private->type != KEY_RSA1) {
1411 fprintf(stderr, "Comments are only supported for RSA1 keys.\n"); 1403 fprintf(stderr, "Comments are only supported for RSA1 keys.\n");
1412 key_free(private); 1404 sshkey_free(private);
1413 exit(1); 1405 exit(1);
1414 } 1406 }
1415 printf("Key now has comment '%s'\n", comment); 1407 printf("Key now has comment '%s'\n", comment);
@@ -1421,26 +1413,28 @@ do_change_comment(struct passwd *pw)
1421 fflush(stdout); 1413 fflush(stdout);
1422 if (!fgets(new_comment, sizeof(new_comment), stdin)) { 1414 if (!fgets(new_comment, sizeof(new_comment), stdin)) {
1423 explicit_bzero(passphrase, strlen(passphrase)); 1415 explicit_bzero(passphrase, strlen(passphrase));
1424 key_free(private); 1416 sshkey_free(private);
1425 exit(1); 1417 exit(1);
1426 } 1418 }
1427 new_comment[strcspn(new_comment, "\n")] = '\0'; 1419 new_comment[strcspn(new_comment, "\n")] = '\0';
1428 } 1420 }
1429 1421
1430 /* Save the file using the new passphrase. */ 1422 /* Save the file using the new passphrase. */
1431 if (!key_save_private(private, identity_file, passphrase, new_comment, 1423 if ((r = sshkey_save_private(private, identity_file, passphrase,
1432 use_new_format, new_format_cipher, rounds)) { 1424 new_comment, use_new_format, new_format_cipher, rounds)) != 0) {
1433 printf("Saving the key failed: %s.\n", identity_file); 1425 printf("Saving key \"%s\" failed: %s\n",
1426 identity_file, ssh_err(r));
1434 explicit_bzero(passphrase, strlen(passphrase)); 1427 explicit_bzero(passphrase, strlen(passphrase));
1435 free(passphrase); 1428 free(passphrase);
1436 key_free(private); 1429 sshkey_free(private);
1437 free(comment); 1430 free(comment);
1438 exit(1); 1431 exit(1);
1439 } 1432 }
1440 explicit_bzero(passphrase, strlen(passphrase)); 1433 explicit_bzero(passphrase, strlen(passphrase));
1441 free(passphrase); 1434 free(passphrase);
1442 public = key_from_private(private); 1435 if ((r = sshkey_from_private(private, &public)) != 0)
1443 key_free(private); 1436 fatal("key_from_private failed: %s", ssh_err(r));
1437 sshkey_free(private);
1444 1438
1445 strlcat(identity_file, ".pub", sizeof(identity_file)); 1439 strlcat(identity_file, ".pub", sizeof(identity_file));
1446 fd = open(identity_file, O_WRONLY | O_CREAT | O_TRUNC, 0644); 1440 fd = open(identity_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
@@ -1453,9 +1447,9 @@ do_change_comment(struct passwd *pw)
1453 printf("fdopen %s failed\n", identity_file); 1447 printf("fdopen %s failed\n", identity_file);
1454 exit(1); 1448 exit(1);
1455 } 1449 }
1456 if (!key_write(public, f)) 1450 if ((r = sshkey_write(public, f)) != 0)
1457 fprintf(stderr, "write key failed\n"); 1451 fprintf(stderr, "write key failed: %s\n", ssh_err(r));
1458 key_free(public); 1452 sshkey_free(public);
1459 fprintf(f, " %s\n", new_comment); 1453 fprintf(f, " %s\n", new_comment);
1460 fclose(f); 1454 fclose(f);
1461 1455
@@ -1504,34 +1498,39 @@ fmt_validity(u_int64_t valid_from, u_int64_t valid_to)
1504} 1498}
1505 1499
1506static void 1500static void
1507add_flag_option(Buffer *c, const char *name) 1501add_flag_option(struct sshbuf *c, const char *name)
1508{ 1502{
1503 int r;
1504
1509 debug3("%s: %s", __func__, name); 1505 debug3("%s: %s", __func__, name);
1510 buffer_put_cstring(c, name); 1506 if ((r = sshbuf_put_cstring(c, name)) != 0 ||
1511 buffer_put_string(c, NULL, 0); 1507 (r = sshbuf_put_string(c, NULL, 0)) != 0)
1508 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1512} 1509}
1513 1510
1514static void 1511static void
1515add_string_option(Buffer *c, const char *name, const char *value) 1512add_string_option(struct sshbuf *c, const char *name, const char *value)
1516{ 1513{
1517 Buffer b; 1514 struct sshbuf *b;
1515 int r;
1518 1516
1519 debug3("%s: %s=%s", __func__, name, value); 1517 debug3("%s: %s=%s", __func__, name, value);
1520 buffer_init(&b); 1518 if ((b = sshbuf_new()) == NULL)
1521 buffer_put_cstring(&b, value); 1519 fatal("%s: sshbuf_new failed", __func__);
1522 1520 if ((r = sshbuf_put_cstring(b, value)) != 0 ||
1523 buffer_put_cstring(c, name); 1521 (r = sshbuf_put_cstring(c, name)) != 0 ||
1524 buffer_put_string(c, buffer_ptr(&b), buffer_len(&b)); 1522 (r = sshbuf_put_stringb(c, b)) != 0)
1525 1523 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1526 buffer_free(&b); 1524
1525 sshbuf_free(b);
1527} 1526}
1528 1527
1529#define OPTIONS_CRITICAL 1 1528#define OPTIONS_CRITICAL 1
1530#define OPTIONS_EXTENSIONS 2 1529#define OPTIONS_EXTENSIONS 2
1531static void 1530static void
1532prepare_options_buf(Buffer *c, int which) 1531prepare_options_buf(struct sshbuf *c, int which)
1533{ 1532{
1534 buffer_clear(c); 1533 sshbuf_reset(c);
1535 if ((which & OPTIONS_CRITICAL) != 0 && 1534 if ((which & OPTIONS_CRITICAL) != 0 &&
1536 certflags_command != NULL) 1535 certflags_command != NULL)
1537 add_string_option(c, "force-command", certflags_command); 1536 add_string_option(c, "force-command", certflags_command);
@@ -1555,29 +1554,30 @@ prepare_options_buf(Buffer *c, int which)
1555 add_string_option(c, "source-address", certflags_src_addr); 1554 add_string_option(c, "source-address", certflags_src_addr);
1556} 1555}
1557 1556
1558static Key * 1557static struct sshkey *
1559load_pkcs11_key(char *path) 1558load_pkcs11_key(char *path)
1560{ 1559{
1561#ifdef ENABLE_PKCS11 1560#ifdef ENABLE_PKCS11
1562 Key **keys = NULL, *public, *private = NULL; 1561 struct sshkey **keys = NULL, *public, *private = NULL;
1563 int i, nkeys; 1562 int r, i, nkeys;
1564 1563
1565 if ((public = key_load_public(path, NULL)) == NULL) 1564 if ((r = sshkey_load_public(path, &public, NULL)) != 0)
1566 fatal("Couldn't load CA public key \"%s\"", path); 1565 fatal("Couldn't load CA public key \"%s\": %s",
1566 path, ssh_err(r));
1567 1567
1568 nkeys = pkcs11_add_provider(pkcs11provider, identity_passphrase, &keys); 1568 nkeys = pkcs11_add_provider(pkcs11provider, identity_passphrase, &keys);
1569 debug3("%s: %d keys", __func__, nkeys); 1569 debug3("%s: %d keys", __func__, nkeys);
1570 if (nkeys <= 0) 1570 if (nkeys <= 0)
1571 fatal("cannot read public key from pkcs11"); 1571 fatal("cannot read public key from pkcs11");
1572 for (i = 0; i < nkeys; i++) { 1572 for (i = 0; i < nkeys; i++) {
1573 if (key_equal_public(public, keys[i])) { 1573 if (sshkey_equal_public(public, keys[i])) {
1574 private = keys[i]; 1574 private = keys[i];
1575 continue; 1575 continue;
1576 } 1576 }
1577 key_free(keys[i]); 1577 sshkey_free(keys[i]);
1578 } 1578 }
1579 free(keys); 1579 free(keys);
1580 key_free(public); 1580 sshkey_free(public);
1581 return private; 1581 return private;
1582#else 1582#else
1583 fatal("no pkcs11 support"); 1583 fatal("no pkcs11 support");
@@ -1587,15 +1587,15 @@ load_pkcs11_key(char *path)
1587static void 1587static void
1588do_ca_sign(struct passwd *pw, int argc, char **argv) 1588do_ca_sign(struct passwd *pw, int argc, char **argv)
1589{ 1589{
1590 int i, fd; 1590 int r, i, fd;
1591 u_int n; 1591 u_int n;
1592 Key *ca, *public; 1592 struct sshkey *ca, *public;
1593 char *otmp, *tmp, *cp, *out, *comment, **plist = NULL; 1593 char *otmp, *tmp, *cp, *out, *comment, **plist = NULL;
1594 FILE *f; 1594 FILE *f;
1595 int v00 = 0; /* legacy keys */ 1595 int v00 = 0; /* legacy keys */
1596 1596
1597 if (key_type_name != NULL) { 1597 if (key_type_name != NULL) {
1598 switch (key_type_from_name(key_type_name)) { 1598 switch (sshkey_type_from_name(key_type_name)) {
1599 case KEY_RSA_CERT_V00: 1599 case KEY_RSA_CERT_V00:
1600 case KEY_DSA_CERT_V00: 1600 case KEY_DSA_CERT_V00:
1601 v00 = 1; 1601 v00 = 1;
@@ -1620,8 +1620,8 @@ do_ca_sign(struct passwd *pw, int argc, char **argv)
1620 if (pkcs11provider != NULL) { 1620 if (pkcs11provider != NULL) {
1621 if ((ca = load_pkcs11_key(tmp)) == NULL) 1621 if ((ca = load_pkcs11_key(tmp)) == NULL)
1622 fatal("No PKCS#11 key matching %s found", ca_key_path); 1622 fatal("No PKCS#11 key matching %s found", ca_key_path);
1623 } else if ((ca = load_identity(tmp)) == NULL) 1623 } else
1624 fatal("Couldn't load CA key \"%s\"", tmp); 1624 ca = load_identity(tmp);
1625 free(tmp); 1625 free(tmp);
1626 1626
1627 for (i = 0; i < argc; i++) { 1627 for (i = 0; i < argc; i++) {
@@ -1639,16 +1639,18 @@ do_ca_sign(struct passwd *pw, int argc, char **argv)
1639 } 1639 }
1640 1640
1641 tmp = tilde_expand_filename(argv[i], pw->pw_uid); 1641 tmp = tilde_expand_filename(argv[i], pw->pw_uid);
1642 if ((public = key_load_public(tmp, &comment)) == NULL) 1642 if ((r = sshkey_load_public(tmp, &public, &comment)) != 0)
1643 fatal("%s: unable to open \"%s\"", __func__, tmp); 1643 fatal("%s: unable to open \"%s\": %s",
1644 __func__, tmp, ssh_err(r));
1644 if (public->type != KEY_RSA && public->type != KEY_DSA && 1645 if (public->type != KEY_RSA && public->type != KEY_DSA &&
1645 public->type != KEY_ECDSA && public->type != KEY_ED25519) 1646 public->type != KEY_ECDSA && public->type != KEY_ED25519)
1646 fatal("%s: key \"%s\" type %s cannot be certified", 1647 fatal("%s: key \"%s\" type %s cannot be certified",
1647 __func__, tmp, key_type(public)); 1648 __func__, tmp, sshkey_type(public));
1648 1649
1649 /* Prepare certificate to sign */ 1650 /* Prepare certificate to sign */
1650 if (key_to_certified(public, v00) != 0) 1651 if ((r = sshkey_to_certified(public, v00)) != 0)
1651 fatal("Could not upgrade key %s to certificate", tmp); 1652 fatal("Could not upgrade key %s to certificate: %s",
1653 tmp, ssh_err(r));
1652 public->cert->type = cert_key_type; 1654 public->cert->type = cert_key_type;
1653 public->cert->serial = (u_int64_t)cert_serial; 1655 public->cert->serial = (u_int64_t)cert_serial;
1654 public->cert->key_id = xstrdup(cert_key_id); 1656 public->cert->key_id = xstrdup(cert_key_id);
@@ -1665,9 +1667,11 @@ do_ca_sign(struct passwd *pw, int argc, char **argv)
1665 prepare_options_buf(public->cert->extensions, 1667 prepare_options_buf(public->cert->extensions,
1666 OPTIONS_EXTENSIONS); 1668 OPTIONS_EXTENSIONS);
1667 } 1669 }
1668 public->cert->signature_key = key_from_private(ca); 1670 if ((r = sshkey_from_private(ca,
1671 &public->cert->signature_key)) != 0)
1672 fatal("key_from_private (ca key): %s", ssh_err(r));
1669 1673
1670 if (key_certify(public, ca) != 0) 1674 if (sshkey_certify(public, ca) != 0)
1671 fatal("Couldn't not certify key %s", tmp); 1675 fatal("Couldn't not certify key %s", tmp);
1672 1676
1673 if ((cp = strrchr(tmp, '.')) != NULL && strcmp(cp, ".pub") == 0) 1677 if ((cp = strrchr(tmp, '.')) != NULL && strcmp(cp, ".pub") == 0)
@@ -1680,14 +1684,15 @@ do_ca_sign(struct passwd *pw, int argc, char **argv)
1680 strerror(errno)); 1684 strerror(errno));
1681 if ((f = fdopen(fd, "w")) == NULL) 1685 if ((f = fdopen(fd, "w")) == NULL)
1682 fatal("%s: fdopen: %s", __func__, strerror(errno)); 1686 fatal("%s: fdopen: %s", __func__, strerror(errno));
1683 if (!key_write(public, f)) 1687 if ((r = sshkey_write(public, f)) != 0)
1684 fatal("Could not write certified key to %s", out); 1688 fatal("Could not write certified key to %s: %s",
1689 out, ssh_err(r));
1685 fprintf(f, " %s\n", comment); 1690 fprintf(f, " %s\n", comment);
1686 fclose(f); 1691 fclose(f);
1687 1692
1688 if (!quiet) { 1693 if (!quiet) {
1689 logit("Signed %s key %s: id \"%s\" serial %llu%s%s " 1694 logit("Signed %s key %s: id \"%s\" serial %llu%s%s "
1690 "valid %s", key_cert_type(public), 1695 "valid %s", sshkey_cert_type(public),
1691 out, public->cert->key_id, 1696 out, public->cert->key_id,
1692 (unsigned long long)public->cert->serial, 1697 (unsigned long long)public->cert->serial,
1693 cert_principals != NULL ? " for " : "", 1698 cert_principals != NULL ? " for " : "",
@@ -1695,7 +1700,7 @@ do_ca_sign(struct passwd *pw, int argc, char **argv)
1695 fmt_validity(cert_valid_from, cert_valid_to)); 1700 fmt_validity(cert_valid_from, cert_valid_to));
1696 } 1701 }
1697 1702
1698 key_free(public); 1703 sshkey_free(public);
1699 free(out); 1704 free(out);
1700 } 1705 }
1701#ifdef ENABLE_PKCS11 1706#ifdef ENABLE_PKCS11
@@ -1846,21 +1851,20 @@ add_cert_option(char *opt)
1846} 1851}
1847 1852
1848static void 1853static void
1849show_options(const Buffer *optbuf, int v00, int in_critical) 1854show_options(struct sshbuf *optbuf, int v00, int in_critical)
1850{ 1855{
1851 char *name, *arg; 1856 char *name, *arg;
1852 const u_char *data; 1857 struct sshbuf *options, *option = NULL;
1853 u_int dlen; 1858 int r;
1854 Buffer options, option; 1859
1855 1860 if ((options = sshbuf_fromb(optbuf)) == NULL)
1856 buffer_init(&options); 1861 fatal("%s: sshbuf_fromb failed", __func__);
1857 buffer_append(&options, buffer_ptr(optbuf), buffer_len(optbuf)); 1862 while (sshbuf_len(options) != 0) {
1858 1863 sshbuf_free(option);
1859 buffer_init(&option); 1864 option = NULL;
1860 while (buffer_len(&options) != 0) { 1865 if ((r = sshbuf_get_cstring(options, &name, NULL)) != 0 ||
1861 name = buffer_get_string(&options, NULL); 1866 (r = sshbuf_froms(options, &option)) != 0)
1862 data = buffer_get_string_ptr(&options, &dlen); 1867 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1863 buffer_append(&option, data, dlen);
1864 printf(" %s", name); 1868 printf(" %s", name);
1865 if ((v00 || !in_critical) && 1869 if ((v00 || !in_critical) &&
1866 (strcmp(name, "permit-X11-forwarding") == 0 || 1870 (strcmp(name, "permit-X11-forwarding") == 0 ||
@@ -1872,50 +1876,56 @@ show_options(const Buffer *optbuf, int v00, int in_critical)
1872 else if ((v00 || in_critical) && 1876 else if ((v00 || in_critical) &&
1873 (strcmp(name, "force-command") == 0 || 1877 (strcmp(name, "force-command") == 0 ||
1874 strcmp(name, "source-address") == 0)) { 1878 strcmp(name, "source-address") == 0)) {
1875 arg = buffer_get_cstring(&option, NULL); 1879 if ((r = sshbuf_get_cstring(option, &arg, NULL)) != 0)
1880 fatal("%s: buffer error: %s",
1881 __func__, ssh_err(r));
1876 printf(" %s\n", arg); 1882 printf(" %s\n", arg);
1877 free(arg); 1883 free(arg);
1878 } else { 1884 } else {
1879 printf(" UNKNOWN OPTION (len %u)\n", 1885 printf(" UNKNOWN OPTION (len %zu)\n",
1880 buffer_len(&option)); 1886 sshbuf_len(option));
1881 buffer_clear(&option); 1887 sshbuf_reset(option);
1882 } 1888 }
1883 free(name); 1889 free(name);
1884 if (buffer_len(&option) != 0) 1890 if (sshbuf_len(option) != 0)
1885 fatal("Option corrupt: extra data at end"); 1891 fatal("Option corrupt: extra data at end");
1886 } 1892 }
1887 buffer_free(&option); 1893 sshbuf_free(option);
1888 buffer_free(&options); 1894 sshbuf_free(options);
1889} 1895}
1890 1896
1891static void 1897static void
1892do_show_cert(struct passwd *pw) 1898do_show_cert(struct passwd *pw)
1893{ 1899{
1894 Key *key; 1900 struct sshkey *key;
1895 struct stat st; 1901 struct stat st;
1896 char *key_fp, *ca_fp; 1902 char *key_fp, *ca_fp;
1897 u_int i, v00; 1903 u_int i, v00;
1904 int r;
1898 1905
1899 if (!have_identity) 1906 if (!have_identity)
1900 ask_filename(pw, "Enter file in which the key is"); 1907 ask_filename(pw, "Enter file in which the key is");
1901 if (stat(identity_file, &st) < 0) 1908 if (stat(identity_file, &st) < 0)
1902 fatal("%s: %s: %s", __progname, identity_file, strerror(errno)); 1909 fatal("%s: %s: %s", __progname, identity_file, strerror(errno));
1903 if ((key = key_load_public(identity_file, NULL)) == NULL) 1910 if ((r = sshkey_load_public(identity_file, &key, NULL)) != 0)
1904 fatal("%s is not a public key", identity_file); 1911 fatal("Cannot load public key \"%s\": %s",
1905 if (!key_is_cert(key)) 1912 identity_file, ssh_err(r));
1913 if (!sshkey_is_cert(key))
1906 fatal("%s is not a certificate", identity_file); 1914 fatal("%s is not a certificate", identity_file);
1907 v00 = key->type == KEY_RSA_CERT_V00 || key->type == KEY_DSA_CERT_V00; 1915 v00 = key->type == KEY_RSA_CERT_V00 || key->type == KEY_DSA_CERT_V00;
1908 1916
1909 key_fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); 1917 key_fp = sshkey_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT);
1910 ca_fp = key_fingerprint(key->cert->signature_key, 1918 ca_fp = sshkey_fingerprint(key->cert->signature_key,
1911 SSH_FP_MD5, SSH_FP_HEX); 1919 fingerprint_hash, SSH_FP_DEFAULT);
1920 if (key_fp == NULL || ca_fp == NULL)
1921 fatal("%s: sshkey_fingerprint fail", __func__);
1912 1922
1913 printf("%s:\n", identity_file); 1923 printf("%s:\n", identity_file);
1914 printf(" Type: %s %s certificate\n", key_ssh_name(key), 1924 printf(" Type: %s %s certificate\n", sshkey_ssh_name(key),
1915 key_cert_type(key)); 1925 sshkey_cert_type(key));
1916 printf(" Public key: %s %s\n", key_type(key), key_fp); 1926 printf(" Public key: %s %s\n", sshkey_type(key), key_fp);
1917 printf(" Signing CA: %s %s\n", 1927 printf(" Signing CA: %s %s\n",
1918 key_type(key->cert->signature_key), ca_fp); 1928 sshkey_type(key->cert->signature_key), ca_fp);
1919 printf(" Key ID: \"%s\"\n", key->cert->key_id); 1929 printf(" Key ID: \"%s\"\n", key->cert->key_id);
1920 if (!v00) { 1930 if (!v00) {
1921 printf(" Serial: %llu\n", 1931 printf(" Serial: %llu\n",
@@ -1933,7 +1943,7 @@ do_show_cert(struct passwd *pw)
1933 printf("\n"); 1943 printf("\n");
1934 } 1944 }
1935 printf(" Critical Options: "); 1945 printf(" Critical Options: ");
1936 if (buffer_len(key->cert->critical) == 0) 1946 if (sshbuf_len(key->cert->critical) == 0)
1937 printf("(none)\n"); 1947 printf("(none)\n");
1938 else { 1948 else {
1939 printf("\n"); 1949 printf("\n");
@@ -1941,7 +1951,7 @@ do_show_cert(struct passwd *pw)
1941 } 1951 }
1942 if (!v00) { 1952 if (!v00) {
1943 printf(" Extensions: "); 1953 printf(" Extensions: ");
1944 if (buffer_len(key->cert->extensions) == 0) 1954 if (sshbuf_len(key->cert->extensions) == 0)
1945 printf("(none)\n"); 1955 printf("(none)\n");
1946 else { 1956 else {
1947 printf("\n"); 1957 printf("\n");
@@ -1951,31 +1961,31 @@ do_show_cert(struct passwd *pw)
1951 exit(0); 1961 exit(0);
1952} 1962}
1953 1963
1954#ifdef WITH_OPENSSL
1955static void 1964static void
1956load_krl(const char *path, struct ssh_krl **krlp) 1965load_krl(const char *path, struct ssh_krl **krlp)
1957{ 1966{
1958 Buffer krlbuf; 1967 struct sshbuf *krlbuf;
1959 int fd; 1968 int r, fd;
1960 1969
1961 buffer_init(&krlbuf); 1970 if ((krlbuf = sshbuf_new()) == NULL)
1971 fatal("sshbuf_new failed");
1962 if ((fd = open(path, O_RDONLY)) == -1) 1972 if ((fd = open(path, O_RDONLY)) == -1)
1963 fatal("open %s: %s", path, strerror(errno)); 1973 fatal("open %s: %s", path, strerror(errno));
1964 if (!key_load_file(fd, path, &krlbuf)) 1974 if ((r = sshkey_load_file(fd, krlbuf)) != 0)
1965 fatal("Unable to load KRL"); 1975 fatal("Unable to load KRL: %s", ssh_err(r));
1966 close(fd); 1976 close(fd);
1967 /* XXX check sigs */ 1977 /* XXX check sigs */
1968 if (ssh_krl_from_blob(&krlbuf, krlp, NULL, 0) != 0 || 1978 if ((r = ssh_krl_from_blob(krlbuf, krlp, NULL, 0)) != 0 ||
1969 *krlp == NULL) 1979 *krlp == NULL)
1970 fatal("Invalid KRL file"); 1980 fatal("Invalid KRL file: %s", ssh_err(r));
1971 buffer_free(&krlbuf); 1981 sshbuf_free(krlbuf);
1972} 1982}
1973 1983
1974static void 1984static void
1975update_krl_from_file(struct passwd *pw, const char *file, const Key *ca, 1985update_krl_from_file(struct passwd *pw, const char *file, int wild_ca,
1976 struct ssh_krl *krl) 1986 const struct sshkey *ca, struct ssh_krl *krl)
1977{ 1987{
1978 Key *key = NULL; 1988 struct sshkey *key = NULL;
1979 u_long lnum = 0; 1989 u_long lnum = 0;
1980 char *path, *cp, *ep, line[SSH_MAX_PUBKEY_BYTES]; 1990 char *path, *cp, *ep, line[SSH_MAX_PUBKEY_BYTES];
1981 unsigned long long serial, serial2; 1991 unsigned long long serial, serial2;
@@ -2014,7 +2024,7 @@ update_krl_from_file(struct passwd *pw, const char *file, const Key *ca,
2014 if (*cp == '\0') 2024 if (*cp == '\0')
2015 continue; 2025 continue;
2016 if (strncasecmp(cp, "serial:", 7) == 0) { 2026 if (strncasecmp(cp, "serial:", 7) == 0) {
2017 if (ca == NULL) { 2027 if (ca == NULL && !wild_ca) {
2018 fatal("revoking certificates by serial number " 2028 fatal("revoking certificates by serial number "
2019 "requires specification of a CA key"); 2029 "requires specification of a CA key");
2020 } 2030 }
@@ -2051,7 +2061,7 @@ update_krl_from_file(struct passwd *pw, const char *file, const Key *ca,
2051 __func__); 2061 __func__);
2052 } 2062 }
2053 } else if (strncasecmp(cp, "id:", 3) == 0) { 2063 } else if (strncasecmp(cp, "id:", 3) == 0) {
2054 if (ca == NULL) { 2064 if (ca == NULL && !wild_ca) {
2055 fatal("revoking certificates by key ID " 2065 fatal("revoking certificates by key ID "
2056 "requires specification of a CA key"); 2066 "requires specification of a CA key");
2057 } 2067 }
@@ -2074,10 +2084,11 @@ update_krl_from_file(struct passwd *pw, const char *file, const Key *ca,
2074 * Parsing will fail if it isn't. 2084 * Parsing will fail if it isn't.
2075 */ 2085 */
2076 } 2086 }
2077 if ((key = key_new(KEY_UNSPEC)) == NULL) 2087 if ((key = sshkey_new(KEY_UNSPEC)) == NULL)
2078 fatal("key_new"); 2088 fatal("key_new");
2079 if (key_read(key, &cp) != 1) 2089 if ((r = sshkey_read(key, &cp)) != 0)
2080 fatal("%s:%lu: invalid key", path, lnum); 2090 fatal("%s:%lu: invalid key: %s",
2091 path, lnum, ssh_err(r));
2081 if (was_explicit_key) 2092 if (was_explicit_key)
2082 r = ssh_krl_revoke_key_explicit(krl, key); 2093 r = ssh_krl_revoke_key_explicit(krl, key);
2083 else if (was_sha1) 2094 else if (was_sha1)
@@ -2085,8 +2096,9 @@ update_krl_from_file(struct passwd *pw, const char *file, const Key *ca,
2085 else 2096 else
2086 r = ssh_krl_revoke_key(krl, key); 2097 r = ssh_krl_revoke_key(krl, key);
2087 if (r != 0) 2098 if (r != 0)
2088 fatal("%s: revoke key failed", __func__); 2099 fatal("%s: revoke key failed: %s",
2089 key_free(key); 2100 __func__, ssh_err(r));
2101 sshkey_free(key);
2090 } 2102 }
2091 } 2103 }
2092 if (strcmp(path, "-") != 0) 2104 if (strcmp(path, "-") != 0)
@@ -2099,10 +2111,10 @@ do_gen_krl(struct passwd *pw, int updating, int argc, char **argv)
2099{ 2111{
2100 struct ssh_krl *krl; 2112 struct ssh_krl *krl;
2101 struct stat sb; 2113 struct stat sb;
2102 Key *ca = NULL; 2114 struct sshkey *ca = NULL;
2103 int fd, i; 2115 int fd, i, r, wild_ca = 0;
2104 char *tmp; 2116 char *tmp;
2105 Buffer kbuf; 2117 struct sshbuf *kbuf;
2106 2118
2107 if (*identity_file == '\0') 2119 if (*identity_file == '\0')
2108 fatal("KRL generation requires an output file"); 2120 fatal("KRL generation requires an output file");
@@ -2114,10 +2126,15 @@ do_gen_krl(struct passwd *pw, int updating, int argc, char **argv)
2114 fatal("KRL \"%s\" does not exist", identity_file); 2126 fatal("KRL \"%s\" does not exist", identity_file);
2115 } 2127 }
2116 if (ca_key_path != NULL) { 2128 if (ca_key_path != NULL) {
2117 tmp = tilde_expand_filename(ca_key_path, pw->pw_uid); 2129 if (strcasecmp(ca_key_path, "none") == 0)
2118 if ((ca = key_load_public(tmp, NULL)) == NULL) 2130 wild_ca = 1;
2119 fatal("Cannot load CA public key %s", tmp); 2131 else {
2120 free(tmp); 2132 tmp = tilde_expand_filename(ca_key_path, pw->pw_uid);
2133 if ((r = sshkey_load_public(tmp, &ca, NULL)) != 0)
2134 fatal("Cannot load CA public key %s: %s",
2135 tmp, ssh_err(r));
2136 free(tmp);
2137 }
2121 } 2138 }
2122 2139
2123 if (updating) 2140 if (updating)
@@ -2131,21 +2148,22 @@ do_gen_krl(struct passwd *pw, int updating, int argc, char **argv)
2131 ssh_krl_set_comment(krl, identity_comment); 2148 ssh_krl_set_comment(krl, identity_comment);
2132 2149
2133 for (i = 0; i < argc; i++) 2150 for (i = 0; i < argc; i++)
2134 update_krl_from_file(pw, argv[i], ca, krl); 2151 update_krl_from_file(pw, argv[i], wild_ca, ca, krl);
2135 2152
2136 buffer_init(&kbuf); 2153 if ((kbuf = sshbuf_new()) == NULL)
2137 if (ssh_krl_to_blob(krl, &kbuf, NULL, 0) != 0) 2154 fatal("sshbuf_new failed");
2155 if (ssh_krl_to_blob(krl, kbuf, NULL, 0) != 0)
2138 fatal("Couldn't generate KRL"); 2156 fatal("Couldn't generate KRL");
2139 if ((fd = open(identity_file, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) 2157 if ((fd = open(identity_file, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1)
2140 fatal("open %s: %s", identity_file, strerror(errno)); 2158 fatal("open %s: %s", identity_file, strerror(errno));
2141 if (atomicio(vwrite, fd, buffer_ptr(&kbuf), buffer_len(&kbuf)) != 2159 if (atomicio(vwrite, fd, (void *)sshbuf_ptr(kbuf), sshbuf_len(kbuf)) !=
2142 buffer_len(&kbuf)) 2160 sshbuf_len(kbuf))
2143 fatal("write %s: %s", identity_file, strerror(errno)); 2161 fatal("write %s: %s", identity_file, strerror(errno));
2144 close(fd); 2162 close(fd);
2145 buffer_free(&kbuf); 2163 sshbuf_free(kbuf);
2146 ssh_krl_free(krl); 2164 ssh_krl_free(krl);
2147 if (ca != NULL) 2165 if (ca != NULL)
2148 key_free(ca); 2166 sshkey_free(ca);
2149} 2167}
2150 2168
2151static void 2169static void
@@ -2154,27 +2172,27 @@ do_check_krl(struct passwd *pw, int argc, char **argv)
2154 int i, r, ret = 0; 2172 int i, r, ret = 0;
2155 char *comment; 2173 char *comment;
2156 struct ssh_krl *krl; 2174 struct ssh_krl *krl;
2157 Key *k; 2175 struct sshkey *k;
2158 2176
2159 if (*identity_file == '\0') 2177 if (*identity_file == '\0')
2160 fatal("KRL checking requires an input file"); 2178 fatal("KRL checking requires an input file");
2161 load_krl(identity_file, &krl); 2179 load_krl(identity_file, &krl);
2162 for (i = 0; i < argc; i++) { 2180 for (i = 0; i < argc; i++) {
2163 if ((k = key_load_public(argv[i], &comment)) == NULL) 2181 if ((r = sshkey_load_public(argv[i], &k, &comment)) != 0)
2164 fatal("Cannot load public key %s", argv[i]); 2182 fatal("Cannot load public key %s: %s",
2183 argv[i], ssh_err(r));
2165 r = ssh_krl_check_key(krl, k); 2184 r = ssh_krl_check_key(krl, k);
2166 printf("%s%s%s%s: %s\n", argv[i], 2185 printf("%s%s%s%s: %s\n", argv[i],
2167 *comment ? " (" : "", comment, *comment ? ")" : "", 2186 *comment ? " (" : "", comment, *comment ? ")" : "",
2168 r == 0 ? "ok" : "REVOKED"); 2187 r == 0 ? "ok" : "REVOKED");
2169 if (r != 0) 2188 if (r != 0)
2170 ret = 1; 2189 ret = 1;
2171 key_free(k); 2190 sshkey_free(k);
2172 free(comment); 2191 free(comment);
2173 } 2192 }
2174 ssh_krl_free(krl); 2193 ssh_krl_free(krl);
2175 exit(ret); 2194 exit(ret);
2176} 2195}
2177#endif
2178 2196
2179static void 2197static void
2180usage(void) 2198usage(void)
@@ -2187,7 +2205,7 @@ usage(void)
2187 " ssh-keygen -e [-m key_format] [-f input_keyfile]\n" 2205 " ssh-keygen -e [-m key_format] [-f input_keyfile]\n"
2188 " ssh-keygen -y [-f input_keyfile]\n" 2206 " ssh-keygen -y [-f input_keyfile]\n"
2189 " ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]\n" 2207 " ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]\n"
2190 " ssh-keygen -l [-f input_keyfile]\n" 2208 " ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]\n"
2191 " ssh-keygen -B [-f input_keyfile]\n"); 2209 " ssh-keygen -B [-f input_keyfile]\n");
2192#ifdef ENABLE_PKCS11 2210#ifdef ENABLE_PKCS11
2193 fprintf(stderr, 2211 fprintf(stderr,
@@ -2217,13 +2235,13 @@ usage(void)
2217int 2235int
2218main(int argc, char **argv) 2236main(int argc, char **argv)
2219{ 2237{
2220 char dotsshdir[MAXPATHLEN], comment[1024], *passphrase1, *passphrase2; 2238 char dotsshdir[PATH_MAX], comment[1024], *passphrase1, *passphrase2;
2221 char *checkpoint = NULL; 2239 char *checkpoint = NULL;
2222 char out_file[MAXPATHLEN], *ep, *rr_hostname = NULL; 2240 char out_file[PATH_MAX], *rr_hostname = NULL, *ep, *fp, *ra;
2223 Key *private, *public; 2241 struct sshkey *private, *public;
2224 struct passwd *pw; 2242 struct passwd *pw;
2225 struct stat st; 2243 struct stat st;
2226 int opt, type, fd; 2244 int r, opt, type, fd;
2227 u_int32_t memory = 0, generator_wanted = 0; 2245 u_int32_t memory = 0, generator_wanted = 0;
2228 int do_gen_candidates = 0, do_screen_candidates = 0; 2246 int do_gen_candidates = 0, do_screen_candidates = 0;
2229 int gen_all_hostkeys = 0, gen_krl = 0, update_krl = 0, check_krl = 0; 2247 int gen_all_hostkeys = 0, gen_krl = 0, update_krl = 0, check_krl = 0;
@@ -2240,7 +2258,9 @@ main(int argc, char **argv)
2240 2258
2241 __progname = ssh_get_progname(argv[0]); 2259 __progname = ssh_get_progname(argv[0]);
2242 2260
2261#ifdef WITH_OPENSSL
2243 OpenSSL_add_all_algorithms(); 2262 OpenSSL_add_all_algorithms();
2263#endif
2244 log_init(argv[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1); 2264 log_init(argv[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1);
2245 2265
2246 seed_rng(); 2266 seed_rng();
@@ -2256,9 +2276,10 @@ main(int argc, char **argv)
2256 exit(1); 2276 exit(1);
2257 } 2277 }
2258 2278
2259 /* Remaining characters: EUYdw */ 2279 /* Remaining characters: UYdw */
2260 while ((opt = getopt(argc, argv, "ABHLQXceghiklopquvxy" 2280 while ((opt = getopt(argc, argv, "ABHLQXceghiklopquvxy"
2261 "C:D:F:G:I:J:K:M:N:O:P:R:S:T:V:W:Z:a:b:f:g:j:m:n:r:s:t:z:")) != -1) { 2281 "C:D:E:F:G:I:J:K:M:N:O:P:R:S:T:V:W:Z:"
2282 "a:b:f:g:j:m:n:r:s:t:z:")) != -1) {
2262 switch (opt) { 2283 switch (opt) {
2263 case 'A': 2284 case 'A':
2264 gen_all_hostkeys = 1; 2285 gen_all_hostkeys = 1;
@@ -2269,6 +2290,11 @@ main(int argc, char **argv)
2269 fatal("Bits has bad value %s (%s)", 2290 fatal("Bits has bad value %s (%s)",
2270 optarg, errstr); 2291 optarg, errstr);
2271 break; 2292 break;
2293 case 'E':
2294 fingerprint_hash = ssh_digest_alg_by_name(optarg);
2295 if (fingerprint_hash == -1)
2296 fatal("Invalid hash algorithm \"%s\"", optarg);
2297 break;
2272 case 'F': 2298 case 'F':
2273 find_host = 1; 2299 find_host = 1;
2274 rr_hostname = optarg; 2300 rr_hostname = optarg;
@@ -2412,6 +2438,7 @@ main(int argc, char **argv)
2412 fatal("Invalid number: %s (%s)", 2438 fatal("Invalid number: %s (%s)",
2413 optarg, errstr); 2439 optarg, errstr);
2414 break; 2440 break;
2441#ifdef WITH_OPENSSL
2415 case 'M': 2442 case 'M':
2416 memory = (u_int32_t)strtonum(optarg, 1, UINT_MAX, &errstr); 2443 memory = (u_int32_t)strtonum(optarg, 1, UINT_MAX, &errstr);
2417 if (errstr) 2444 if (errstr)
@@ -2430,7 +2457,7 @@ main(int argc, char **argv)
2430 fatal("Output filename too long"); 2457 fatal("Output filename too long");
2431 break; 2458 break;
2432 case 'K': 2459 case 'K':
2433 if (strlen(optarg) >= MAXPATHLEN) 2460 if (strlen(optarg) >= PATH_MAX)
2434 fatal("Checkpoint filename too long"); 2461 fatal("Checkpoint filename too long");
2435 checkpoint = xstrdup(optarg); 2462 checkpoint = xstrdup(optarg);
2436 break; 2463 break;
@@ -2439,6 +2466,7 @@ main(int argc, char **argv)
2439 if (BN_hex2bn(&start, optarg) == 0) 2466 if (BN_hex2bn(&start, optarg) == 0)
2440 fatal("Invalid start point."); 2467 fatal("Invalid start point.");
2441 break; 2468 break;
2469#endif /* WITH_OPENSSL */
2442 case 'V': 2470 case 'V':
2443 parse_cert_times(optarg); 2471 parse_cert_times(optarg);
2444 break; 2472 break;
@@ -2478,7 +2506,6 @@ main(int argc, char **argv)
2478 printf("Cannot use -l with -H or -R.\n"); 2506 printf("Cannot use -l with -H or -R.\n");
2479 usage(); 2507 usage();
2480 } 2508 }
2481#ifdef WITH_OPENSSL
2482 if (gen_krl) { 2509 if (gen_krl) {
2483 do_gen_krl(pw, update_krl, argc, argv); 2510 do_gen_krl(pw, update_krl, argc, argv);
2484 return (0); 2511 return (0);
@@ -2487,7 +2514,6 @@ main(int argc, char **argv)
2487 do_check_krl(pw, argc, argv); 2514 do_check_krl(pw, argc, argv);
2488 return (0); 2515 return (0);
2489 } 2516 }
2490#endif
2491 if (ca_key_path != NULL) { 2517 if (ca_key_path != NULL) {
2492 if (cert_key_id == NULL) 2518 if (cert_key_id == NULL)
2493 fatal("Must specify key id (-I) when certifying"); 2519 fatal("Must specify key id (-I) when certifying");
@@ -2588,17 +2614,20 @@ main(int argc, char **argv)
2588 if (key_type_name == NULL) 2614 if (key_type_name == NULL)
2589 key_type_name = "rsa"; 2615 key_type_name = "rsa";
2590 2616
2591 type = key_type_from_name(key_type_name); 2617 type = sshkey_type_from_name(key_type_name);
2592 type_bits_valid(type, &bits); 2618 type_bits_valid(type, key_type_name, &bits);
2593 2619
2594 if (!quiet) 2620 if (!quiet)
2595 printf("Generating public/private %s key pair.\n", key_type_name); 2621 printf("Generating public/private %s key pair.\n",
2596 private = key_generate(type, bits); 2622 key_type_name);
2597 if (private == NULL) { 2623 if ((r = sshkey_generate(type, bits, &private)) != 0) {
2598 fprintf(stderr, "key_generate failed\n"); 2624 fprintf(stderr, "key_generate failed\n");
2599 exit(1); 2625 exit(1);
2600 } 2626 }
2601 public = key_from_private(private); 2627 if ((r = sshkey_from_private(private, &public)) != 0) {
2628 fprintf(stderr, "key_from_private failed: %s\n", ssh_err(r));
2629 exit(1);
2630 }
2602 2631
2603 if (!have_identity) 2632 if (!have_identity)
2604 ask_filename(pw, "Enter file in which to save the key"); 2633 ask_filename(pw, "Enter file in which to save the key");
@@ -2666,9 +2695,10 @@ passphrase_again:
2666 } 2695 }
2667 2696
2668 /* Save the key with the given passphrase and comment. */ 2697 /* Save the key with the given passphrase and comment. */
2669 if (!key_save_private(private, identity_file, passphrase1, comment, 2698 if ((r = sshkey_save_private(private, identity_file, passphrase1,
2670 use_new_format, new_format_cipher, rounds)) { 2699 comment, use_new_format, new_format_cipher, rounds)) != 0) {
2671 printf("Saving the key failed: %s.\n", identity_file); 2700 printf("Saving key \"%s\" failed: %s\n",
2701 identity_file, ssh_err(r));
2672 explicit_bzero(passphrase1, strlen(passphrase1)); 2702 explicit_bzero(passphrase1, strlen(passphrase1));
2673 free(passphrase1); 2703 free(passphrase1);
2674 exit(1); 2704 exit(1);
@@ -2678,7 +2708,7 @@ passphrase_again:
2678 free(passphrase1); 2708 free(passphrase1);
2679 2709
2680 /* Clear the private key and the random number generator. */ 2710 /* Clear the private key and the random number generator. */
2681 key_free(private); 2711 sshkey_free(private);
2682 2712
2683 if (!quiet) 2713 if (!quiet)
2684 printf("Your identification has been saved in %s.\n", identity_file); 2714 printf("Your identification has been saved in %s.\n", identity_file);
@@ -2694,15 +2724,18 @@ passphrase_again:
2694 printf("fdopen %s failed\n", identity_file); 2724 printf("fdopen %s failed\n", identity_file);
2695 exit(1); 2725 exit(1);
2696 } 2726 }
2697 if (!key_write(public, f)) 2727 if ((r = sshkey_write(public, f)) != 0)
2698 fprintf(stderr, "write key failed\n"); 2728 fprintf(stderr, "write key failed: %s\n", ssh_err(r));
2699 fprintf(f, " %s\n", comment); 2729 fprintf(f, " %s\n", comment);
2700 fclose(f); 2730 fclose(f);
2701 2731
2702 if (!quiet) { 2732 if (!quiet) {
2703 char *fp = key_fingerprint(public, SSH_FP_MD5, SSH_FP_HEX); 2733 fp = sshkey_fingerprint(public, fingerprint_hash,
2704 char *ra = key_fingerprint(public, SSH_FP_MD5, 2734 SSH_FP_DEFAULT);
2735 ra = sshkey_fingerprint(public, fingerprint_hash,
2705 SSH_FP_RANDOMART); 2736 SSH_FP_RANDOMART);
2737 if (fp == NULL || ra == NULL)
2738 fatal("sshkey_fingerprint failed");
2706 printf("Your public key has been saved in %s.\n", 2739 printf("Your public key has been saved in %s.\n",
2707 identity_file); 2740 identity_file);
2708 printf("The key fingerprint is:\n"); 2741 printf("The key fingerprint is:\n");
@@ -2713,6 +2746,6 @@ passphrase_again:
2713 free(fp); 2746 free(fp);
2714 } 2747 }
2715 2748
2716 key_free(public); 2749 sshkey_free(public);
2717 exit(0); 2750 exit(0);
2718} 2751}
diff --git a/ssh-keyscan.0 b/ssh-keyscan.0
index 853bd5152..fe7aa8559 100644
--- a/ssh-keyscan.0
+++ b/ssh-keyscan.0
@@ -1,7 +1,7 @@
1SSH-KEYSCAN(1) General Commands Manual SSH-KEYSCAN(1) 1SSH-KEYSCAN(1) General Commands Manual SSH-KEYSCAN(1)
2 2
3NAME 3NAME
4 ssh-keyscan - gather ssh public keys 4 ssh-keyscan M-bM-^@M-^S gather ssh public keys
5 5
6SYNOPSIS 6SYNOPSIS
7 ssh-keyscan [-46Hv] [-f file] [-p port] [-T timeout] [-t type] 7 ssh-keyscan [-46Hv] [-f file] [-p port] [-T timeout] [-t type]
@@ -27,10 +27,9 @@ DESCRIPTION
27 -6 Forces ssh-keyscan to use IPv6 addresses only. 27 -6 Forces ssh-keyscan to use IPv6 addresses only.
28 28
29 -f file 29 -f file
30 Read hosts or ``addrlist namelist'' pairs from file, one per 30 Read hosts or M-bM-^@M-^\addrlist namelistM-bM-^@M-^] pairs from file, one per line.
31 line. If - is supplied instead of a filename, ssh-keyscan will 31 If - is supplied instead of a filename, ssh-keyscan will read
32 read hosts or ``addrlist namelist'' pairs from the standard 32 hosts or M-bM-^@M-^\addrlist namelistM-bM-^@M-^] pairs from the standard input.
33 input.
34 33
35 -H Hash all hostnames and addresses in the output. Hashed names may 34 -H Hash all hostnames and addresses in the output. Hashed names may
36 be used normally by ssh and sshd, but they do not reveal 35 be used normally by ssh and sshd, but they do not reveal
@@ -48,11 +47,10 @@ DESCRIPTION
48 47
49 -t type 48 -t type
50 Specifies the type of the key to fetch from the scanned hosts. 49 Specifies the type of the key to fetch from the scanned hosts.
51 The possible values are ``rsa1'' for protocol version 1 and 50 The possible values are M-bM-^@M-^\rsa1M-bM-^@M-^] for protocol version 1 and M-bM-^@M-^\dsaM-bM-^@M-^],
52 ``dsa'', ``ecdsa'', ``ed25519'', or ``rsa'' for protocol version 51 M-bM-^@M-^\ecdsaM-bM-^@M-^], M-bM-^@M-^\ed25519M-bM-^@M-^], or M-bM-^@M-^\rsaM-bM-^@M-^] for protocol version 2. Multiple
53 2. Multiple values may be specified by separating them with 52 values may be specified by separating them with commas. The
54 commas. The default is to fetch ``rsa'', ``ecdsa'', and 53 default is to fetch M-bM-^@M-^\rsaM-bM-^@M-^], M-bM-^@M-^\ecdsaM-bM-^@M-^], and M-bM-^@M-^\ed25519M-bM-^@M-^] keys.
55 ``ed25519'' keys.
56 54
57 -v Verbose mode. Causes ssh-keyscan to print debugging messages 55 -v Verbose mode. Causes ssh-keyscan to print debugging messages
58 about its progress. 56 about its progress.
@@ -74,12 +72,12 @@ FILES
74 72
75 host-or-namelist bits exponent modulus 73 host-or-namelist bits exponent modulus
76 74
77 Output format for RSA, DSA, ECDSA, and ED25519 keys: 75 Output format for RSA, DSA, ECDSA, and Ed25519 keys:
78 76
79 host-or-namelist keytype base64-encoded-key 77 host-or-namelist keytype base64-encoded-key
80 78
81 Where keytype is either ``ecdsa-sha2-nistp256'', ``ecdsa-sha2-nistp384'', 79 Where keytype is either M-bM-^@M-^\ecdsa-sha2-nistp256M-bM-^@M-^], M-bM-^@M-^\ecdsa-sha2-nistp384M-bM-^@M-^],
82 ``ecdsa-sha2-nistp521'', ``ssh-ed25519'', ``ssh-dss'' or ``ssh-rsa''. 80 M-bM-^@M-^\ecdsa-sha2-nistp521M-bM-^@M-^], M-bM-^@M-^\ssh-ed25519M-bM-^@M-^], M-bM-^@M-^\ssh-dssM-bM-^@M-^] or M-bM-^@M-^\ssh-rsaM-bM-^@M-^].
83 81
84 /etc/ssh/ssh_known_hosts 82 /etc/ssh/ssh_known_hosts
85 83
@@ -108,4 +106,4 @@ BUGS
108 This is because it opens a connection to the ssh port, reads the public 106 This is because it opens a connection to the ssh port, reads the public
109 key, and drops the connection as soon as it gets the key. 107 key, and drops the connection as soon as it gets the key.
110 108
111OpenBSD 5.6 March 12, 2014 OpenBSD 5.6 109OpenBSD 5.7 August 30, 2014 OpenBSD 5.7
diff --git a/ssh-keyscan.1 b/ssh-keyscan.1
index 5c32ea9c7..6bbc480cd 100644
--- a/ssh-keyscan.1
+++ b/ssh-keyscan.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-keyscan.1,v 1.35 2014/03/12 13:06:59 naddy Exp $ 1.\" $OpenBSD: ssh-keyscan.1,v 1.36 2014/08/30 15:33:50 sobrado Exp $
2.\" 2.\"
3.\" Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. 3.\" Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
4.\" 4.\"
@@ -6,7 +6,7 @@
6.\" permitted provided that due credit is given to the author and the 6.\" permitted provided that due credit is given to the author and the
7.\" OpenBSD project by leaving this copyright notice intact. 7.\" OpenBSD project by leaving this copyright notice intact.
8.\" 8.\"
9.Dd $Mdocdate: March 12 2014 $ 9.Dd $Mdocdate: August 30 2014 $
10.Dt SSH-KEYSCAN 1 10.Dt SSH-KEYSCAN 1
11.Os 11.Os
12.Sh NAME 12.Sh NAME
@@ -130,7 +130,7 @@ Output format for RSA1 keys:
130host-or-namelist bits exponent modulus 130host-or-namelist bits exponent modulus
131.Ed 131.Ed
132.Pp 132.Pp
133Output format for RSA, DSA, ECDSA, and ED25519 keys: 133Output format for RSA, DSA, ECDSA, and Ed25519 keys:
134.Bd -literal 134.Bd -literal
135host-or-namelist keytype base64-encoded-key 135host-or-namelist keytype base64-encoded-key
136.Ed 136.Ed
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 3fabfba14..c5fb3b524 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keyscan.c,v 1.92 2014/04/29 18:01:49 markus Exp $ */ 1/* $OpenBSD: ssh-keyscan.c,v 1.99 2015/01/30 10:44:49 djm Exp $ */
2/* 2/*
3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. 3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
4 * 4 *
@@ -9,6 +9,7 @@
9 9
10#include "includes.h" 10#include "includes.h"
11 11
12#include <sys/types.h>
12#include "openbsd-compat/sys-queue.h" 13#include "openbsd-compat/sys-queue.h"
13#include <sys/resource.h> 14#include <sys/resource.h>
14#ifdef HAVE_SYS_TIME_H 15#ifdef HAVE_SYS_TIME_H
@@ -22,7 +23,6 @@
22 23
23#include <netdb.h> 24#include <netdb.h>
24#include <errno.h> 25#include <errno.h>
25#include <setjmp.h>
26#include <stdarg.h> 26#include <stdarg.h>
27#include <stdio.h> 27#include <stdio.h>
28#include <stdlib.h> 28#include <stdlib.h>
@@ -33,8 +33,8 @@
33#include "xmalloc.h" 33#include "xmalloc.h"
34#include "ssh.h" 34#include "ssh.h"
35#include "ssh1.h" 35#include "ssh1.h"
36#include "buffer.h" 36#include "sshbuf.h"
37#include "key.h" 37#include "sshkey.h"
38#include "cipher.h" 38#include "cipher.h"
39#include "kex.h" 39#include "kex.h"
40#include "compat.h" 40#include "compat.h"
@@ -45,6 +45,8 @@
45#include "atomicio.h" 45#include "atomicio.h"
46#include "misc.h" 46#include "misc.h"
47#include "hostfile.h" 47#include "hostfile.h"
48#include "ssherr.h"
49#include "ssh_api.h"
48 50
49/* Flag indicating whether IPv4 or IPv6. This can be set on the command line. 51/* Flag indicating whether IPv4 or IPv6. This can be set on the command line.
50 Default value is AF_UNSPEC means both IPv4 and IPv6. */ 52 Default value is AF_UNSPEC means both IPv4 and IPv6. */
@@ -74,9 +76,8 @@ extern char *__progname;
74fd_set *read_wait; 76fd_set *read_wait;
75size_t read_wait_nfdset; 77size_t read_wait_nfdset;
76int ncon; 78int ncon;
77int nonfatal_fatal = 0; 79
78jmp_buf kexjmp; 80struct ssh *active_state = NULL; /* XXX needed for linking */
79Key *kexjmp_key;
80 81
81/* 82/*
82 * Keep a connection structure for each file descriptor. The state 83 * Keep a connection structure for each file descriptor. The state
@@ -93,12 +94,13 @@ typedef struct Connection {
93 int c_len; /* Total bytes which must be read. */ 94 int c_len; /* Total bytes which must be read. */
94 int c_off; /* Length of data read so far. */ 95 int c_off; /* Length of data read so far. */
95 int c_keytype; /* Only one of KT_RSA1, KT_DSA, or KT_RSA */ 96 int c_keytype; /* Only one of KT_RSA1, KT_DSA, or KT_RSA */
97 int c_done; /* SSH2 done */
96 char *c_namebase; /* Address to free for c_name and c_namelist */ 98 char *c_namebase; /* Address to free for c_name and c_namelist */
97 char *c_name; /* Hostname of connection for errors */ 99 char *c_name; /* Hostname of connection for errors */
98 char *c_namelist; /* Pointer to other possible addresses */ 100 char *c_namelist; /* Pointer to other possible addresses */
99 char *c_output_name; /* Hostname of connection for output */ 101 char *c_output_name; /* Hostname of connection for output */
100 char *c_data; /* Data read from this fd */ 102 char *c_data; /* Data read from this fd */
101 Kex *c_kex; /* The key-exchange struct for ssh2 */ 103 struct ssh *c_ssh; /* SSH-connection */
102 struct timeval c_tv; /* Time at which connection gets aborted */ 104 struct timeval c_tv; /* Time at which connection gets aborted */
103 TAILQ_ENTRY(Connection) c_link; /* List of connections in timeout order. */ 105 TAILQ_ENTRY(Connection) c_link; /* List of connections in timeout order. */
104} con; 106} con;
@@ -106,6 +108,8 @@ typedef struct Connection {
106TAILQ_HEAD(conlist, Connection) tq; /* Timeout Queue */ 108TAILQ_HEAD(conlist, Connection) tq; /* Timeout Queue */
107con *fdcon; 109con *fdcon;
108 110
111static void keyprint(con *c, struct sshkey *key);
112
109static int 113static int
110fdlim_get(int hard) 114fdlim_get(int hard)
111{ 115{
@@ -183,46 +187,61 @@ strnnsep(char **stringp, char *delim)
183} 187}
184 188
185#ifdef WITH_SSH1 189#ifdef WITH_SSH1
186static Key * 190static struct sshkey *
187keygrab_ssh1(con *c) 191keygrab_ssh1(con *c)
188{ 192{
189 static Key *rsa; 193 static struct sshkey *rsa;
190 static Buffer msg; 194 static struct sshbuf *msg;
195 int r;
196 u_char type;
191 197
192 if (rsa == NULL) { 198 if (rsa == NULL) {
193 buffer_init(&msg); 199 if ((rsa = sshkey_new(KEY_RSA1)) == NULL) {
194 rsa = key_new(KEY_RSA1); 200 error("%s: sshkey_new failed", __func__);
201 return NULL;
202 }
203 if ((msg = sshbuf_new()) == NULL)
204 fatal("%s: sshbuf_new failed", __func__);
195 } 205 }
196 buffer_append(&msg, c->c_data, c->c_plen); 206 if ((r = sshbuf_put(msg, c->c_data, c->c_plen)) != 0 ||
197 buffer_consume(&msg, 8 - (c->c_plen & 7)); /* padding */ 207 (r = sshbuf_consume(msg, 8 - (c->c_plen & 7))) != 0 || /* padding */
198 if (buffer_get_char(&msg) != (int) SSH_SMSG_PUBLIC_KEY) { 208 (r = sshbuf_get_u8(msg, &type)) != 0)
209 goto buf_err;
210 if (type != (int) SSH_SMSG_PUBLIC_KEY) {
199 error("%s: invalid packet type", c->c_name); 211 error("%s: invalid packet type", c->c_name);
200 buffer_clear(&msg); 212 sshbuf_reset(msg);
213 return NULL;
214 }
215 if ((r = sshbuf_consume(msg, 8)) != 0 || /* cookie */
216 /* server key */
217 (r = sshbuf_get_u32(msg, NULL)) != 0 ||
218 (r = sshbuf_get_bignum1(msg, NULL)) != 0 ||
219 (r = sshbuf_get_bignum1(msg, NULL)) != 0 ||
220 /* host key */
221 (r = sshbuf_get_u32(msg, NULL)) != 0 ||
222 (r = sshbuf_get_bignum1(msg, rsa->rsa->e)) != 0 ||
223 (r = sshbuf_get_bignum1(msg, rsa->rsa->n)) != 0) {
224 buf_err:
225 error("%s: buffer error: %s", __func__, ssh_err(r));
226 sshbuf_reset(msg);
201 return NULL; 227 return NULL;
202 } 228 }
203 buffer_consume(&msg, 8); /* cookie */
204
205 /* server key */
206 (void) buffer_get_int(&msg);
207 buffer_get_bignum(&msg, rsa->rsa->e);
208 buffer_get_bignum(&msg, rsa->rsa->n);
209
210 /* host key */
211 (void) buffer_get_int(&msg);
212 buffer_get_bignum(&msg, rsa->rsa->e);
213 buffer_get_bignum(&msg, rsa->rsa->n);
214 229
215 buffer_clear(&msg); 230 sshbuf_reset(msg);
216 231
217 return (rsa); 232 return (rsa);
218} 233}
219#endif 234#endif
220 235
221static int 236static int
222hostjump(Key *hostkey) 237key_print_wrapper(struct sshkey *hostkey, struct ssh *ssh)
223{ 238{
224 kexjmp_key = hostkey; 239 con *c;
225 longjmp(kexjmp, 1); 240
241 if ((c = ssh_get_app_data(ssh)) != NULL)
242 keyprint(c, hostkey);
243 /* always abort key exchange */
244 return -1;
226} 245}
227 246
228static int 247static int
@@ -241,46 +260,43 @@ ssh2_capable(int remote_major, int remote_minor)
241 return 0; 260 return 0;
242} 261}
243 262
244static Key * 263static void
245keygrab_ssh2(con *c) 264keygrab_ssh2(con *c)
246{ 265{
247 char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT }; 266 char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT };
248 int j; 267 int r;
249 268
250 packet_set_connection(c->c_fd, c->c_fd);
251 enable_compat20(); 269 enable_compat20();
252 myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = 270 myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] =
253 c->c_keytype == KT_DSA ? "ssh-dss" : 271 c->c_keytype == KT_DSA ? "ssh-dss" :
254 (c->c_keytype == KT_RSA ? "ssh-rsa" : 272 (c->c_keytype == KT_RSA ? "ssh-rsa" :
255 (c->c_keytype == KT_ED25519 ? "ssh-ed25519" : 273 (c->c_keytype == KT_ED25519 ? "ssh-ed25519" :
256 "ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521")); 274 "ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521"));
257 c->c_kex = kex_setup(myproposal); 275 if ((r = kex_setup(c->c_ssh, myproposal)) != 0) {
258#ifdef WITH_OPENSSL 276 free(c->c_ssh);
259 c->c_kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; 277 fprintf(stderr, "kex_setup: %s\n", ssh_err(r));
260 c->c_kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client;
261 c->c_kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;
262 c->c_kex->kex[KEX_DH_GEX_SHA256] = kexgex_client;
263 c->c_kex->kex[KEX_ECDH_SHA2] = kexecdh_client;
264#endif
265 c->c_kex->kex[KEX_C25519_SHA256] = kexc25519_client;
266 c->c_kex->verify_host_key = hostjump;
267
268 if (!(j = setjmp(kexjmp))) {
269 nonfatal_fatal = 1;
270 dispatch_run(DISPATCH_BLOCK, &c->c_kex->done, c->c_kex);
271 fprintf(stderr, "Impossible! dispatch_run() returned!\n");
272 exit(1); 278 exit(1);
273 } 279 }
274 nonfatal_fatal = 0; 280#ifdef WITH_OPENSSL
275 free(c->c_kex); 281 c->c_ssh->kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client;
276 c->c_kex = NULL; 282 c->c_ssh->kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client;
277 packet_close(); 283 c->c_ssh->kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;
278 284 c->c_ssh->kex->kex[KEX_DH_GEX_SHA256] = kexgex_client;
279 return j < 0? NULL : kexjmp_key; 285# ifdef OPENSSL_HAS_ECC
286 c->c_ssh->kex->kex[KEX_ECDH_SHA2] = kexecdh_client;
287# endif
288#endif
289 c->c_ssh->kex->kex[KEX_C25519_SHA256] = kexc25519_client;
290 ssh_set_verify_host_key_callback(c->c_ssh, key_print_wrapper);
291 /*
292 * do the key-exchange until an error occurs or until
293 * the key_print_wrapper() callback sets c_done.
294 */
295 ssh_dispatch_run(c->c_ssh, DISPATCH_BLOCK, &c->c_done, c->c_ssh);
280} 296}
281 297
282static void 298static void
283keyprint(con *c, Key *key) 299keyprint(con *c, struct sshkey *key)
284{ 300{
285 char *host = c->c_output_name ? c->c_output_name : c->c_name; 301 char *host = c->c_output_name ? c->c_output_name : c->c_name;
286 302
@@ -290,7 +306,7 @@ keyprint(con *c, Key *key)
290 fatal("host_hash failed"); 306 fatal("host_hash failed");
291 307
292 fprintf(stdout, "%s ", host); 308 fprintf(stdout, "%s ", host);
293 key_write(key, stdout); 309 sshkey_write(key, stdout);
294 fputs("\n", stdout); 310 fputs("\n", stdout);
295} 311}
296 312
@@ -305,8 +321,10 @@ tcpconnect(char *host)
305 memset(&hints, 0, sizeof(hints)); 321 memset(&hints, 0, sizeof(hints));
306 hints.ai_family = IPv4or6; 322 hints.ai_family = IPv4or6;
307 hints.ai_socktype = SOCK_STREAM; 323 hints.ai_socktype = SOCK_STREAM;
308 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) 324 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) {
309 fatal("getaddrinfo %s: %s", host, ssh_gai_strerror(gaierr)); 325 error("getaddrinfo %s: %s", host, ssh_gai_strerror(gaierr));
326 return -1;
327 }
310 for (ai = aitop; ai; ai = ai->ai_next) { 328 for (ai = aitop; ai; ai = ai->ai_next) {
311 s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); 329 s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
312 if (s < 0) { 330 if (s < 0) {
@@ -378,6 +396,11 @@ confree(int s)
378 free(fdcon[s].c_data); 396 free(fdcon[s].c_data);
379 fdcon[s].c_status = CS_UNUSED; 397 fdcon[s].c_status = CS_UNUSED;
380 fdcon[s].c_keytype = 0; 398 fdcon[s].c_keytype = 0;
399 if (fdcon[s].c_ssh) {
400 ssh_packet_close(fdcon[s].c_ssh);
401 free(fdcon[s].c_ssh);
402 fdcon[s].c_ssh = NULL;
403 }
381 TAILQ_REMOVE(&tq, &fdcon[s], c_link); 404 TAILQ_REMOVE(&tq, &fdcon[s], c_link);
382 FD_CLR(s, read_wait); 405 FD_CLR(s, read_wait);
383 ncon--; 406 ncon--;
@@ -445,11 +468,15 @@ congreet(int s)
445 return; 468 return;
446 } 469 }
447 *cp = '\0'; 470 *cp = '\0';
471 if ((c->c_ssh = ssh_packet_set_connection(NULL, s, s)) == NULL)
472 fatal("ssh_packet_set_connection failed");
473 ssh_packet_set_timeout(c->c_ssh, timeout, 1);
474 ssh_set_app_data(c->c_ssh, c); /* back link */
448 if (sscanf(buf, "SSH-%d.%d-%[^\n]\n", 475 if (sscanf(buf, "SSH-%d.%d-%[^\n]\n",
449 &remote_major, &remote_minor, remote_version) == 3) 476 &remote_major, &remote_minor, remote_version) == 3)
450 compat_datafellows(remote_version); 477 c->c_ssh->compat = compat_datafellows(remote_version);
451 else 478 else
452 datafellows = 0; 479 c->c_ssh->compat = 0;
453 if (c->c_keytype != KT_RSA1) { 480 if (c->c_keytype != KT_RSA1) {
454 if (!ssh2_capable(remote_major, remote_minor)) { 481 if (!ssh2_capable(remote_major, remote_minor)) {
455 debug("%s doesn't support ssh2", c->c_name); 482 debug("%s doesn't support ssh2", c->c_name);
@@ -476,7 +503,7 @@ congreet(int s)
476 return; 503 return;
477 } 504 }
478 if (c->c_keytype != KT_RSA1) { 505 if (c->c_keytype != KT_RSA1) {
479 keyprint(c, keygrab_ssh2(c)); 506 keygrab_ssh2(c);
480 confree(s); 507 confree(s);
481 return; 508 return;
482 } 509 }
@@ -602,10 +629,7 @@ fatal(const char *fmt,...)
602 va_start(args, fmt); 629 va_start(args, fmt);
603 do_log(SYSLOG_LEVEL_FATAL, fmt, args); 630 do_log(SYSLOG_LEVEL_FATAL, fmt, args);
604 va_end(args); 631 va_end(args);
605 if (nonfatal_fatal) 632 exit(255);
606 longjmp(kexjmp, -1);
607 else
608 exit(255);
609} 633}
610 634
611static void 635static void
@@ -678,7 +702,7 @@ main(int argc, char **argv)
678 get_keytypes = 0; 702 get_keytypes = 0;
679 tname = strtok(optarg, ","); 703 tname = strtok(optarg, ",");
680 while (tname) { 704 while (tname) {
681 int type = key_type_from_name(tname); 705 int type = sshkey_type_from_name(tname);
682 switch (type) { 706 switch (type) {
683 case KEY_RSA1: 707 case KEY_RSA1:
684 get_keytypes |= KT_RSA1; 708 get_keytypes |= KT_RSA1;
diff --git a/ssh-keysign.0 b/ssh-keysign.0
index c34125b72..b06107617 100644
--- a/ssh-keysign.0
+++ b/ssh-keysign.0
@@ -1,7 +1,7 @@
1SSH-KEYSIGN(8) System Manager's Manual SSH-KEYSIGN(8) 1SSH-KEYSIGN(8) System Manager's Manual SSH-KEYSIGN(8)
2 2
3NAME 3NAME
4 ssh-keysign - ssh helper program for host-based authentication 4 ssh-keysign M-bM-^@M-^S ssh helper program for host-based authentication
5 5
6SYNOPSIS 6SYNOPSIS
7 ssh-keysign 7 ssh-keysign
@@ -13,7 +13,7 @@ DESCRIPTION
13 13
14 ssh-keysign is disabled by default and can only be enabled in the global 14 ssh-keysign is disabled by default and can only be enabled in the global
15 client configuration file /etc/ssh/ssh_config by setting EnableSSHKeysign 15 client configuration file /etc/ssh/ssh_config by setting EnableSSHKeysign
16 to ``yes''. 16 to M-bM-^@M-^\yesM-bM-^@M-^].
17 17
18 ssh-keysign is not intended to be invoked by the user, but from ssh(1). 18 ssh-keysign is not intended to be invoked by the user, but from ssh(1).
19 See ssh(1) and sshd(8) for more information about host-based 19 See ssh(1) and sshd(8) for more information about host-based
@@ -50,4 +50,4 @@ HISTORY
50AUTHORS 50AUTHORS
51 Markus Friedl <markus@openbsd.org> 51 Markus Friedl <markus@openbsd.org>
52 52
53OpenBSD 5.6 December 7, 2013 OpenBSD 5.6 53OpenBSD 5.7 December 7, 2013 OpenBSD 5.7
diff --git a/ssh-keysign.c b/ssh-keysign.c
index d95bb7d9d..bcf897a05 100644
--- a/ssh-keysign.c
+++ b/ssh-keysign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keysign.c,v 1.42 2014/04/29 18:01:49 markus Exp $ */ 1/* $OpenBSD: ssh-keysign.c,v 1.47 2015/01/28 22:36:00 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2002 Markus Friedl. All rights reserved. 3 * Copyright (c) 2002 Markus Friedl. All rights reserved.
4 * 4 *
@@ -35,23 +35,29 @@
35#include <string.h> 35#include <string.h>
36#include <unistd.h> 36#include <unistd.h>
37 37
38#ifdef WITH_OPENSSL
38#include <openssl/evp.h> 39#include <openssl/evp.h>
39#include <openssl/rand.h> 40#include <openssl/rand.h>
40#include <openssl/rsa.h> 41#include <openssl/rsa.h>
42#endif
41 43
42#include "xmalloc.h" 44#include "xmalloc.h"
43#include "log.h" 45#include "log.h"
44#include "key.h" 46#include "sshkey.h"
45#include "ssh.h" 47#include "ssh.h"
46#include "ssh2.h" 48#include "ssh2.h"
47#include "misc.h" 49#include "misc.h"
48#include "buffer.h" 50#include "sshbuf.h"
49#include "authfile.h" 51#include "authfile.h"
50#include "msg.h" 52#include "msg.h"
51#include "canohost.h" 53#include "canohost.h"
52#include "pathnames.h" 54#include "pathnames.h"
53#include "readconf.h" 55#include "readconf.h"
54#include "uidswap.h" 56#include "uidswap.h"
57#include "sshkey.h"
58#include "ssherr.h"
59
60struct ssh *active_state = NULL; /* XXX needed for linking */
55 61
56/* XXX readconf.c needs these */ 62/* XXX readconf.c needs these */
57uid_t original_real_uid; 63uid_t original_real_uid;
@@ -59,62 +65,73 @@ uid_t original_real_uid;
59extern char *__progname; 65extern char *__progname;
60 66
61static int 67static int
62valid_request(struct passwd *pw, char *host, Key **ret, u_char *data, 68valid_request(struct passwd *pw, char *host, struct sshkey **ret,
63 u_int datalen) 69 u_char *data, size_t datalen)
64{ 70{
65 Buffer b; 71 struct sshbuf *b;
66 Key *key = NULL; 72 struct sshkey *key = NULL;
67 u_char *pkblob; 73 u_char type, *pkblob;
68 u_int blen, len; 74 char *p;
69 char *pkalg, *p; 75 size_t blen, len;
70 int pktype, fail; 76 char *pkalg, *luser;
71 77 int r, pktype, fail;
78
79 if (ret != NULL)
80 *ret = NULL;
72 fail = 0; 81 fail = 0;
73 82
74 buffer_init(&b); 83 if ((b = sshbuf_from(data, datalen)) == NULL)
75 buffer_append(&b, data, datalen); 84 fatal("%s: sshbuf_from failed", __func__);
76 85
77 /* session id, currently limited to SHA1 (20 bytes) or SHA256 (32) */ 86 /* session id, currently limited to SHA1 (20 bytes) or SHA256 (32) */
78 p = buffer_get_string(&b, &len); 87 if ((r = sshbuf_get_string(b, NULL, &len)) != 0)
88 fatal("%s: buffer error: %s", __func__, ssh_err(r));
79 if (len != 20 && len != 32) 89 if (len != 20 && len != 32)
80 fail++; 90 fail++;
81 free(p);
82 91
83 if (buffer_get_char(&b) != SSH2_MSG_USERAUTH_REQUEST) 92 if ((r = sshbuf_get_u8(b, &type)) != 0)
93 fatal("%s: buffer error: %s", __func__, ssh_err(r));
94 if (type != SSH2_MSG_USERAUTH_REQUEST)
84 fail++; 95 fail++;
85 96
86 /* server user */ 97 /* server user */
87 buffer_skip_string(&b); 98 if ((r = sshbuf_skip_string(b)) != 0)
99 fatal("%s: buffer error: %s", __func__, ssh_err(r));
88 100
89 /* service */ 101 /* service */
90 p = buffer_get_string(&b, NULL); 102 if ((r = sshbuf_get_cstring(b, &p, NULL)) != 0)
103 fatal("%s: buffer error: %s", __func__, ssh_err(r));
91 if (strcmp("ssh-connection", p) != 0) 104 if (strcmp("ssh-connection", p) != 0)
92 fail++; 105 fail++;
93 free(p); 106 free(p);
94 107
95 /* method */ 108 /* method */
96 p = buffer_get_string(&b, NULL); 109 if ((r = sshbuf_get_cstring(b, &p, NULL)) != 0)
110 fatal("%s: buffer error: %s", __func__, ssh_err(r));
97 if (strcmp("hostbased", p) != 0) 111 if (strcmp("hostbased", p) != 0)
98 fail++; 112 fail++;
99 free(p); 113 free(p);
100 114
101 /* pubkey */ 115 /* pubkey */
102 pkalg = buffer_get_string(&b, NULL); 116 if ((r = sshbuf_get_cstring(b, &pkalg, NULL)) != 0 ||
103 pkblob = buffer_get_string(&b, &blen); 117 (r = sshbuf_get_string(b, &pkblob, &blen)) != 0)
118 fatal("%s: buffer error: %s", __func__, ssh_err(r));
104 119
105 pktype = key_type_from_name(pkalg); 120 pktype = sshkey_type_from_name(pkalg);
106 if (pktype == KEY_UNSPEC) 121 if (pktype == KEY_UNSPEC)
107 fail++; 122 fail++;
108 else if ((key = key_from_blob(pkblob, blen)) == NULL) 123 else if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) {
124 error("%s: bad key blob: %s", __func__, ssh_err(r));
109 fail++; 125 fail++;
110 else if (key->type != pktype) 126 } else if (key->type != pktype)
111 fail++; 127 fail++;
112 free(pkalg); 128 free(pkalg);
113 free(pkblob); 129 free(pkblob);
114 130
115 /* client host name, handle trailing dot */ 131 /* client host name, handle trailing dot */
116 p = buffer_get_string(&b, &len); 132 if ((r = sshbuf_get_cstring(b, &p, &len)) != 0)
117 debug2("valid_request: check expect chost %s got %s", host, p); 133 fatal("%s: buffer error: %s", __func__, ssh_err(r));
134 debug2("%s: check expect chost %s got %s", __func__, host, p);
118 if (strlen(host) != len - 1) 135 if (strlen(host) != len - 1)
119 fail++; 136 fail++;
120 else if (p[len - 1] != '.') 137 else if (p[len - 1] != '.')
@@ -124,21 +141,22 @@ valid_request(struct passwd *pw, char *host, Key **ret, u_char *data,
124 free(p); 141 free(p);
125 142
126 /* local user */ 143 /* local user */
127 p = buffer_get_string(&b, NULL); 144 if ((r = sshbuf_get_cstring(b, &luser, NULL)) != 0)
145 fatal("%s: buffer error: %s", __func__, ssh_err(r));
128 146
129 if (strcmp(pw->pw_name, p) != 0) 147 if (strcmp(pw->pw_name, luser) != 0)
130 fail++; 148 fail++;
131 free(p); 149 free(luser);
132 150
133 /* end of message */ 151 /* end of message */
134 if (buffer_len(&b) != 0) 152 if (sshbuf_len(b) != 0)
135 fail++; 153 fail++;
136 buffer_free(&b); 154 sshbuf_free(b);
137 155
138 debug3("valid_request: fail %d", fail); 156 debug3("%s: fail %d", __func__, fail);
139 157
140 if (fail && key != NULL) 158 if (fail && key != NULL)
141 key_free(key); 159 sshkey_free(key);
142 else 160 else
143 *ret = key; 161 *ret = key;
144 162
@@ -148,16 +166,18 @@ valid_request(struct passwd *pw, char *host, Key **ret, u_char *data,
148int 166int
149main(int argc, char **argv) 167main(int argc, char **argv)
150{ 168{
151 Buffer b; 169 struct sshbuf *b;
152 Options options; 170 Options options;
153#define NUM_KEYTYPES 4 171#define NUM_KEYTYPES 4
154 Key *keys[NUM_KEYTYPES], *key = NULL; 172 struct sshkey *keys[NUM_KEYTYPES], *key = NULL;
155 struct passwd *pw; 173 struct passwd *pw;
156 int key_fd[NUM_KEYTYPES], i, found, version = 2, fd; 174 int r, key_fd[NUM_KEYTYPES], i, found, version = 2, fd;
157 u_char *signature, *data; 175 u_char *signature, *data, rver;
158 char *host, *fp; 176 char *host, *fp;
159 u_int slen, dlen; 177 size_t slen, dlen;
178#ifdef WITH_OPENSSL
160 u_int32_t rnd[256]; 179 u_int32_t rnd[256];
180#endif
161 181
162 /* Ensure that stdin and stdout are connected */ 182 /* Ensure that stdin and stdout are connected */
163 if ((fd = open(_PATH_DEVNULL, O_RDWR)) < 2) 183 if ((fd = open(_PATH_DEVNULL, O_RDWR)) < 2)
@@ -187,7 +207,7 @@ main(int argc, char **argv)
187 207
188 /* verify that ssh-keysign is enabled by the admin */ 208 /* verify that ssh-keysign is enabled by the admin */
189 initialize_options(&options); 209 initialize_options(&options);
190 (void)read_config_file(_PATH_HOST_CONFIG_FILE, pw, "", &options, 0); 210 (void)read_config_file(_PATH_HOST_CONFIG_FILE, pw, "", "", &options, 0);
191 fill_default_options(&options); 211 fill_default_options(&options);
192 if (options.enable_ssh_keysign != 1) 212 if (options.enable_ssh_keysign != 1)
193 fatal("ssh-keysign not enabled in %s", 213 fatal("ssh-keysign not enabled in %s",
@@ -200,39 +220,47 @@ main(int argc, char **argv)
200 if (found == 0) 220 if (found == 0)
201 fatal("could not open any host key"); 221 fatal("could not open any host key");
202 222
223#ifdef WITH_OPENSSL
203 OpenSSL_add_all_algorithms(); 224 OpenSSL_add_all_algorithms();
204 arc4random_buf(rnd, sizeof(rnd)); 225 arc4random_buf(rnd, sizeof(rnd));
205 RAND_seed(rnd, sizeof(rnd)); 226 RAND_seed(rnd, sizeof(rnd));
227#endif
206 228
207 found = 0; 229 found = 0;
208 for (i = 0; i < NUM_KEYTYPES; i++) { 230 for (i = 0; i < NUM_KEYTYPES; i++) {
209 keys[i] = NULL; 231 keys[i] = NULL;
210 if (key_fd[i] == -1) 232 if (key_fd[i] == -1)
211 continue; 233 continue;
212#ifdef WITH_OPENSSL 234 r = sshkey_load_private_type_fd(key_fd[i], KEY_UNSPEC,
213/* XXX wrong api */ 235 NULL, &key, NULL);
214 keys[i] = key_load_private_pem(key_fd[i], KEY_UNSPEC,
215 NULL, NULL);
216#endif
217 close(key_fd[i]); 236 close(key_fd[i]);
218 if (keys[i] != NULL) 237 if (r != 0)
238 debug("parse key %d: %s", i, ssh_err(r));
239 else if (key != NULL) {
240 keys[i] = key;
219 found = 1; 241 found = 1;
242 }
220 } 243 }
221 if (!found) 244 if (!found)
222 fatal("no hostkey found"); 245 fatal("no hostkey found");
223 246
224 buffer_init(&b); 247 if ((b = sshbuf_new()) == NULL)
225 if (ssh_msg_recv(STDIN_FILENO, &b) < 0) 248 fatal("%s: sshbuf_new failed", __func__);
249 if (ssh_msg_recv(STDIN_FILENO, b) < 0)
226 fatal("ssh_msg_recv failed"); 250 fatal("ssh_msg_recv failed");
227 if (buffer_get_char(&b) != version) 251 if ((r = sshbuf_get_u8(b, &rver)) != 0)
228 fatal("bad version"); 252 fatal("%s: buffer error: %s", __func__, ssh_err(r));
229 fd = buffer_get_int(&b); 253 if (rver != version)
230 if ((fd == STDIN_FILENO) || (fd == STDOUT_FILENO)) 254 fatal("bad version: received %d, expected %d", rver, version);
255 if ((r = sshbuf_get_u32(b, (u_int *)&fd)) != 0)
256 fatal("%s: buffer error: %s", __func__, ssh_err(r));
257 if (fd < 0 || fd == STDIN_FILENO || fd == STDOUT_FILENO)
231 fatal("bad fd"); 258 fatal("bad fd");
232 if ((host = get_local_name(fd)) == NULL) 259 if ((host = get_local_name(fd)) == NULL)
233 fatal("cannot get local name for fd"); 260 fatal("cannot get local name for fd");
234 261
235 data = buffer_get_string(&b, &dlen); 262 if ((r = sshbuf_get_string(b, &data, &dlen)) != 0)
263 fatal("%s: buffer error: %s", __func__, ssh_err(r));
236 if (valid_request(pw, host, &key, data, dlen) < 0) 264 if (valid_request(pw, host, &key, data, dlen) < 0)
237 fatal("not a valid request"); 265 fatal("not a valid request");
238 free(host); 266 free(host);
@@ -240,25 +268,28 @@ main(int argc, char **argv)
240 found = 0; 268 found = 0;
241 for (i = 0; i < NUM_KEYTYPES; i++) { 269 for (i = 0; i < NUM_KEYTYPES; i++) {
242 if (keys[i] != NULL && 270 if (keys[i] != NULL &&
243 key_equal_public(key, keys[i])) { 271 sshkey_equal_public(key, keys[i])) {
244 found = 1; 272 found = 1;
245 break; 273 break;
246 } 274 }
247 } 275 }
248 if (!found) { 276 if (!found) {
249 fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); 277 if ((fp = sshkey_fingerprint(key, options.fingerprint_hash,
278 SSH_FP_DEFAULT)) == NULL)
279 fatal("%s: sshkey_fingerprint failed", __func__);
250 fatal("no matching hostkey found for key %s %s", 280 fatal("no matching hostkey found for key %s %s",
251 key_type(key), fp); 281 sshkey_type(key), fp ? fp : "");
252 } 282 }
253 283
254 if (key_sign(keys[i], &signature, &slen, data, dlen) != 0) 284 if ((r = sshkey_sign(keys[i], &signature, &slen, data, dlen, 0)) != 0)
255 fatal("key_sign failed"); 285 fatal("sshkey_sign failed: %s", ssh_err(r));
256 free(data); 286 free(data);
257 287
258 /* send reply */ 288 /* send reply */
259 buffer_clear(&b); 289 sshbuf_reset(b);
260 buffer_put_string(&b, signature, slen); 290 if ((r = sshbuf_put_string(b, signature, slen)) != 0)
261 if (ssh_msg_send(STDOUT_FILENO, version, &b) == -1) 291 fatal("%s: buffer error: %s", __func__, ssh_err(r));
292 if (ssh_msg_send(STDOUT_FILENO, version, b) == -1)
262 fatal("ssh_msg_send failed"); 293 fatal("ssh_msg_send failed");
263 294
264 return (0); 295 return (0);
diff --git a/ssh-pkcs11-helper.0 b/ssh-pkcs11-helper.0
index 279ec5486..a4d6dd4c0 100644
--- a/ssh-pkcs11-helper.0
+++ b/ssh-pkcs11-helper.0
@@ -1,7 +1,7 @@
1SSH-PKCS11-HELPER(8) System Manager's Manual SSH-PKCS11-HELPER(8) 1SSH-PKCS11-HELPER(8) System Manager's Manual SSH-PKCS11-HELPER(8)
2 2
3NAME 3NAME
4 ssh-pkcs11-helper - ssh-agent helper program for PKCS#11 support 4 ssh-pkcs11-helper M-bM-^@M-^S ssh-agent helper program for PKCS#11 support
5 5
6SYNOPSIS 6SYNOPSIS
7 ssh-pkcs11-helper 7 ssh-pkcs11-helper
@@ -22,4 +22,4 @@ HISTORY
22AUTHORS 22AUTHORS
23 Markus Friedl <markus@openbsd.org> 23 Markus Friedl <markus@openbsd.org>
24 24
25OpenBSD 5.6 July 16, 2013 OpenBSD 5.6 25OpenBSD 5.7 July 16, 2013 OpenBSD 5.7
diff --git a/ssh-pkcs11-helper.c b/ssh-pkcs11-helper.c
index 0b1d8e4cc..ceabc8ba7 100644
--- a/ssh-pkcs11-helper.c
+++ b/ssh-pkcs11-helper.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-pkcs11-helper.c,v 1.8 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: ssh-pkcs11-helper.c,v 1.10 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2010 Markus Friedl. All rights reserved. 3 * Copyright (c) 2010 Markus Friedl. All rights reserved.
4 * 4 *
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c
index c96be3bd2..c3a112fa1 100644
--- a/ssh-pkcs11.c
+++ b/ssh-pkcs11.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-pkcs11.c,v 1.14 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: ssh-pkcs11.c,v 1.17 2015/02/03 08:07:20 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2010 Markus Friedl. All rights reserved. 3 * Copyright (c) 2010 Markus Friedl. All rights reserved.
4 * 4 *
@@ -38,7 +38,7 @@
38 38
39#include "log.h" 39#include "log.h"
40#include "misc.h" 40#include "misc.h"
41#include "key.h" 41#include "sshkey.h"
42#include "ssh-pkcs11.h" 42#include "ssh-pkcs11.h"
43#include "xmalloc.h" 43#include "xmalloc.h"
44 44
@@ -263,8 +263,9 @@ pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa,
263 pin = read_passphrase(prompt, RP_ALLOW_EOF); 263 pin = read_passphrase(prompt, RP_ALLOW_EOF);
264 if (pin == NULL) 264 if (pin == NULL)
265 return (-1); /* bail out */ 265 return (-1); /* bail out */
266 if ((rv = f->C_Login(si->session, CKU_USER, 266 rv = f->C_Login(si->session, CKU_USER,
267 (u_char *)pin, strlen(pin))) != CKR_OK) { 267 (u_char *)pin, strlen(pin));
268 if (rv != CKR_OK && rv != CKR_USER_ALREADY_LOGGED_IN) {
268 free(pin); 269 free(pin);
269 error("C_Login failed: %lu", rv); 270 error("C_Login failed: %lu", rv);
270 return (-1); 271 return (-1);
@@ -366,8 +367,9 @@ pkcs11_open_session(struct pkcs11_provider *p, CK_ULONG slotidx, char *pin)
366 return (-1); 367 return (-1);
367 } 368 }
368 if (login_required && pin) { 369 if (login_required && pin) {
369 if ((rv = f->C_Login(session, CKU_USER, 370 rv = f->C_Login(session, CKU_USER,
370 (u_char *)pin, strlen(pin))) != CKR_OK) { 371 (u_char *)pin, strlen(pin));
372 if (rv != CKR_OK && rv != CKR_USER_ALREADY_LOGGED_IN) {
371 error("C_Login failed: %lu", rv); 373 error("C_Login failed: %lu", rv);
372 if ((rv = f->C_CloseSession(session)) != CKR_OK) 374 if ((rv = f->C_CloseSession(session)) != CKR_OK)
373 error("C_CloseSession failed: %lu", rv); 375 error("C_CloseSession failed: %lu", rv);
@@ -385,12 +387,12 @@ pkcs11_open_session(struct pkcs11_provider *p, CK_ULONG slotidx, char *pin)
385 * keysp points to an (possibly empty) array with *nkeys keys. 387 * keysp points to an (possibly empty) array with *nkeys keys.
386 */ 388 */
387static int pkcs11_fetch_keys_filter(struct pkcs11_provider *, CK_ULONG, 389static int pkcs11_fetch_keys_filter(struct pkcs11_provider *, CK_ULONG,
388 CK_ATTRIBUTE [], CK_ATTRIBUTE [3], Key ***, int *) 390 CK_ATTRIBUTE [], CK_ATTRIBUTE [3], struct sshkey ***, int *)
389 __attribute__((__bounded__(__minbytes__,4, 3 * sizeof(CK_ATTRIBUTE)))); 391 __attribute__((__bounded__(__minbytes__,4, 3 * sizeof(CK_ATTRIBUTE))));
390 392
391static int 393static int
392pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx, 394pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx,
393 Key ***keysp, int *nkeys) 395 struct sshkey ***keysp, int *nkeys)
394{ 396{
395 CK_OBJECT_CLASS pubkey_class = CKO_PUBLIC_KEY; 397 CK_OBJECT_CLASS pubkey_class = CKO_PUBLIC_KEY;
396 CK_OBJECT_CLASS cert_class = CKO_CERTIFICATE; 398 CK_OBJECT_CLASS cert_class = CKO_CERTIFICATE;
@@ -422,12 +424,12 @@ pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx,
422} 424}
423 425
424static int 426static int
425pkcs11_key_included(Key ***keysp, int *nkeys, Key *key) 427pkcs11_key_included(struct sshkey ***keysp, int *nkeys, struct sshkey *key)
426{ 428{
427 int i; 429 int i;
428 430
429 for (i = 0; i < *nkeys; i++) 431 for (i = 0; i < *nkeys; i++)
430 if (key_equal(key, (*keysp)[i])) 432 if (sshkey_equal(key, (*keysp)[i]))
431 return (1); 433 return (1);
432 return (0); 434 return (0);
433} 435}
@@ -435,9 +437,9 @@ pkcs11_key_included(Key ***keysp, int *nkeys, Key *key)
435static int 437static int
436pkcs11_fetch_keys_filter(struct pkcs11_provider *p, CK_ULONG slotidx, 438pkcs11_fetch_keys_filter(struct pkcs11_provider *p, CK_ULONG slotidx,
437 CK_ATTRIBUTE filter[], CK_ATTRIBUTE attribs[3], 439 CK_ATTRIBUTE filter[], CK_ATTRIBUTE attribs[3],
438 Key ***keysp, int *nkeys) 440 struct sshkey ***keysp, int *nkeys)
439{ 441{
440 Key *key; 442 struct sshkey *key;
441 RSA *rsa; 443 RSA *rsa;
442 X509 *x509; 444 X509 *x509;
443 EVP_PKEY *evp; 445 EVP_PKEY *evp;
@@ -517,16 +519,16 @@ pkcs11_fetch_keys_filter(struct pkcs11_provider *p, CK_ULONG slotidx,
517 } 519 }
518 if (rsa && rsa->n && rsa->e && 520 if (rsa && rsa->n && rsa->e &&
519 pkcs11_rsa_wrap(p, slotidx, &attribs[0], rsa) == 0) { 521 pkcs11_rsa_wrap(p, slotidx, &attribs[0], rsa) == 0) {
520 key = key_new(KEY_UNSPEC); 522 key = sshkey_new(KEY_UNSPEC);
521 key->rsa = rsa; 523 key->rsa = rsa;
522 key->type = KEY_RSA; 524 key->type = KEY_RSA;
523 key->flags |= SSHKEY_FLAG_EXT; 525 key->flags |= SSHKEY_FLAG_EXT;
524 if (pkcs11_key_included(keysp, nkeys, key)) { 526 if (pkcs11_key_included(keysp, nkeys, key)) {
525 key_free(key); 527 sshkey_free(key);
526 } else { 528 } else {
527 /* expand key array and add key */ 529 /* expand key array and add key */
528 *keysp = xrealloc(*keysp, *nkeys + 1, 530 *keysp = xrealloc(*keysp, *nkeys + 1,
529 sizeof(Key *)); 531 sizeof(struct sshkey *));
530 (*keysp)[*nkeys] = key; 532 (*keysp)[*nkeys] = key;
531 *nkeys = *nkeys + 1; 533 *nkeys = *nkeys + 1;
532 debug("have %d keys", *nkeys); 534 debug("have %d keys", *nkeys);
@@ -544,7 +546,7 @@ pkcs11_fetch_keys_filter(struct pkcs11_provider *p, CK_ULONG slotidx,
544 546
545/* register a new provider, fails if provider already exists */ 547/* register a new provider, fails if provider already exists */
546int 548int
547pkcs11_add_provider(char *provider_id, char *pin, Key ***keyp) 549pkcs11_add_provider(char *provider_id, char *pin, struct sshkey ***keyp)
548{ 550{
549 int nkeys, need_finalize = 0; 551 int nkeys, need_finalize = 0;
550 struct pkcs11_provider *p = NULL; 552 struct pkcs11_provider *p = NULL;
diff --git a/ssh-pkcs11.h b/ssh-pkcs11.h
index 4d2efda13..0ced74f29 100644
--- a/ssh-pkcs11.h
+++ b/ssh-pkcs11.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-pkcs11.h,v 1.3 2014/04/29 18:01:49 markus Exp $ */ 1/* $OpenBSD: ssh-pkcs11.h,v 1.4 2015/01/15 09:40:00 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2010 Markus Friedl. All rights reserved. 3 * Copyright (c) 2010 Markus Friedl. All rights reserved.
4 * 4 *
@@ -16,7 +16,7 @@
16 */ 16 */
17int pkcs11_init(int); 17int pkcs11_init(int);
18void pkcs11_terminate(void); 18void pkcs11_terminate(void);
19int pkcs11_add_provider(char *, char *, Key ***); 19int pkcs11_add_provider(char *, char *, struct sshkey ***);
20int pkcs11_del_provider(char *); 20int pkcs11_del_provider(char *);
21 21
22#if !defined(WITH_OPENSSL) && defined(ENABLE_PKCS11) 22#if !defined(WITH_OPENSSL) && defined(ENABLE_PKCS11)
diff --git a/ssh-rsa.c b/ssh-rsa.c
index fec1953b4..aef798da6 100644
--- a/ssh-rsa.c
+++ b/ssh-rsa.c
@@ -17,6 +17,8 @@
17 17
18#include "includes.h" 18#include "includes.h"
19 19
20#ifdef WITH_OPENSSL
21
20#include <sys/types.h> 22#include <sys/types.h>
21 23
22#include <openssl/evp.h> 24#include <openssl/evp.h>
@@ -263,3 +265,4 @@ done:
263 } 265 }
264 return ret; 266 return ret;
265} 267}
268#endif /* WITH_OPENSSL */
diff --git a/ssh.0 b/ssh.0
index 70ea37733..5e5f3b5e9 100644
--- a/ssh.0
+++ b/ssh.0
@@ -1,15 +1,15 @@
1SSH(1) General Commands Manual SSH(1) 1SSH(1) General Commands Manual SSH(1)
2 2
3NAME 3NAME
4 ssh - OpenSSH SSH client (remote login program) 4 ssh M-bM-^@M-^S OpenSSH SSH client (remote login program)
5 5
6SYNOPSIS 6SYNOPSIS
7 ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec] 7 ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
8 [-D [bind_address:]port] [-E log_file] [-e escape_char] 8 [-D [bind_address:]port] [-E log_file] [-e escape_char]
9 [-F configfile] [-I pkcs11] [-i identity_file] 9 [-F configfile] [-I pkcs11] [-i identity_file]
10 [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec] 10 [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
11 [-O ctl_cmd] [-o option] [-p port] 11 [-O ctl_cmd] [-o option] [-p port]
12 [-Q cipher | cipher-auth | mac | kex | key] 12 [-Q cipher | cipher-auth | mac | kex | key | protocol-version]
13 [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port] 13 [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
14 [-w local_tun[:remote_tun]] [user@]hostname [command] 14 [-w local_tun[:remote_tun]] [user@]hostname [command]
15 15
@@ -61,7 +61,7 @@ DESCRIPTION
61 -C Requests compression of all data (including stdin, stdout, 61 -C Requests compression of all data (including stdin, stdout,
62 stderr, and data for forwarded X11, TCP and UNIX-domain 62 stderr, and data for forwarded X11, TCP and UNIX-domain
63 connections). The compression algorithm is the same used by 63 connections). The compression algorithm is the same used by
64 gzip(1), and the ``level'' can be controlled by the 64 gzip(1), and the M-bM-^@M-^\levelM-bM-^@M-^] can be controlled by the
65 CompressionLevel option for protocol version 1. Compression is 65 CompressionLevel option for protocol version 1. Compression is
66 desirable on modem lines and other slow connections, but will 66 desirable on modem lines and other slow connections, but will
67 only slow down things on fast networks. The default value can be 67 only slow down things on fast networks. The default value can be
@@ -72,13 +72,13 @@ DESCRIPTION
72 Selects the cipher specification for encrypting the session. 72 Selects the cipher specification for encrypting the session.
73 73
74 Protocol version 1 allows specification of a single cipher. The 74 Protocol version 1 allows specification of a single cipher. The
75 supported values are ``3des'', ``blowfish'', and ``des''. For 75 supported values are M-bM-^@M-^\3desM-bM-^@M-^], M-bM-^@M-^\blowfishM-bM-^@M-^], and M-bM-^@M-^\desM-bM-^@M-^]. For protocol
76 protocol version 2, cipher_spec is a comma-separated list of 76 version 2, cipher_spec is a comma-separated list of ciphers
77 ciphers listed in order of preference. See the Ciphers keyword 77 listed in order of preference. See the Ciphers keyword in
78 in ssh_config(5) for more information. 78 ssh_config(5) for more information.
79 79
80 -D [bind_address:]port 80 -D [bind_address:]port
81 Specifies a local ``dynamic'' application-level port forwarding. 81 Specifies a local M-bM-^@M-^\dynamicM-bM-^@M-^] application-level port forwarding.
82 This works by allocating a socket to listen to port on the local 82 This works by allocating a socket to listen to port on the local
83 side, optionally bound to the specified bind_address. Whenever a 83 side, optionally bound to the specified bind_address. Whenever a
84 connection is made to this port, the connection is forwarded over 84 connection is made to this port, the connection is forwarded over
@@ -94,20 +94,20 @@ DESCRIPTION
94 ports. By default, the local port is bound in accordance with 94 ports. By default, the local port is bound in accordance with
95 the GatewayPorts setting. However, an explicit bind_address may 95 the GatewayPorts setting. However, an explicit bind_address may
96 be used to bind the connection to a specific address. The 96 be used to bind the connection to a specific address. The
97 bind_address of ``localhost'' indicates that the listening port 97 bind_address of M-bM-^@M-^\localhostM-bM-^@M-^] indicates that the listening port be
98 be bound for local use only, while an empty address or `*' 98 bound for local use only, while an empty address or M-bM-^@M-^X*M-bM-^@M-^Y indicates
99 indicates that the port should be available from all interfaces. 99 that the port should be available from all interfaces.
100 100
101 -E log_file 101 -E log_file
102 Append debug logs to log_file instead of standard error. 102 Append debug logs to log_file instead of standard error.
103 103
104 -e escape_char 104 -e escape_char
105 Sets the escape character for sessions with a pty (default: `~'). 105 Sets the escape character for sessions with a pty (default: M-bM-^@M-^X~M-bM-^@M-^Y).
106 The escape character is only recognized at the beginning of a 106 The escape character is only recognized at the beginning of a
107 line. The escape character followed by a dot (`.') closes the 107 line. The escape character followed by a dot (M-bM-^@M-^X.M-bM-^@M-^Y) closes the
108 connection; followed by control-Z suspends the connection; and 108 connection; followed by control-Z suspends the connection; and
109 followed by itself sends the escape character once. Setting the 109 followed by itself sends the escape character once. Setting the
110 character to ``none'' disables any escapes and makes the session 110 character to M-bM-^@M-^\noneM-bM-^@M-^] disables any escapes and makes the session
111 fully transparent. 111 fully transparent.
112 112
113 -F configfile 113 -F configfile
@@ -122,10 +122,13 @@ DESCRIPTION
122 implies -n. The recommended way to start X11 programs at a 122 implies -n. The recommended way to start X11 programs at a
123 remote site is with something like ssh -f host xterm. 123 remote site is with something like ssh -f host xterm.
124 124
125 If the ExitOnForwardFailure configuration option is set to 125 If the ExitOnForwardFailure configuration option is set to M-bM-^@M-^\yesM-bM-^@M-^],
126 ``yes'', then a client started with -f will wait for all remote 126 then a client started with -f will wait for all remote port
127 port forwards to be successfully established before placing 127 forwards to be successfully established before placing itself in
128 itself in the background. 128 the background.
129
130 -G Causes ssh to print its configuration after evaluating Host and
131 Match blocks and exit.
129 132
130 -g Allows remote hosts to connect to local forwarded ports. If used 133 -g Allows remote hosts to connect to local forwarded ports. If used
131 on a multiplexed connection, then this option must be specified 134 on a multiplexed connection, then this option must be specified
@@ -166,17 +169,17 @@ DESCRIPTION
166 port is bound in accordance with the GatewayPorts setting. 169 port is bound in accordance with the GatewayPorts setting.
167 However, an explicit bind_address may be used to bind the 170 However, an explicit bind_address may be used to bind the
168 connection to a specific address. The bind_address of 171 connection to a specific address. The bind_address of
169 ``localhost'' indicates that the listening port be bound for 172 M-bM-^@M-^\localhostM-bM-^@M-^] indicates that the listening port be bound for local
170 local use only, while an empty address or `*' indicates that the 173 use only, while an empty address or M-bM-^@M-^X*M-bM-^@M-^Y indicates that the port
171 port should be available from all interfaces. 174 should be available from all interfaces.
172 175
173 -l login_name 176 -l login_name
174 Specifies the user to log in as on the remote machine. This also 177 Specifies the user to log in as on the remote machine. This also
175 may be specified on a per-host basis in the configuration file. 178 may be specified on a per-host basis in the configuration file.
176 179
177 -M Places the ssh client into ``master'' mode for connection 180 -M Places the ssh client into M-bM-^@M-^\masterM-bM-^@M-^] mode for connection sharing.
178 sharing. Multiple -M options places ssh into ``master'' mode 181 Multiple -M options places ssh into M-bM-^@M-^\masterM-bM-^@M-^] mode with
179 with confirmation required before slave connections are accepted. 182 confirmation required before slave connections are accepted.
180 Refer to the description of ControlMaster in ssh_config(5) for 183 Refer to the description of ControlMaster in ssh_config(5) for
181 details. 184 details.
182 185
@@ -201,10 +204,10 @@ DESCRIPTION
201 -O ctl_cmd 204 -O ctl_cmd
202 Control an active connection multiplexing master process. When 205 Control an active connection multiplexing master process. When
203 the -O option is specified, the ctl_cmd argument is interpreted 206 the -O option is specified, the ctl_cmd argument is interpreted
204 and passed to the master process. Valid commands are: ``check'' 207 and passed to the master process. Valid commands are: M-bM-^@M-^\checkM-bM-^@M-^]
205 (check that the master process is running), ``forward'' (request 208 (check that the master process is running), M-bM-^@M-^\forwardM-bM-^@M-^] (request
206 forwardings without command execution), ``cancel'' (cancel 209 forwardings without command execution), M-bM-^@M-^\cancelM-bM-^@M-^] (cancel
207 forwardings), ``exit'' (request the master to exit), and ``stop'' 210 forwardings), M-bM-^@M-^\exitM-bM-^@M-^] (request the master to exit), and M-bM-^@M-^\stopM-bM-^@M-^]
208 (request the master to stop accepting further multiplexing 211 (request the master to stop accepting further multiplexing
209 requests). 212 requests).
210 213
@@ -238,6 +241,7 @@ DESCRIPTION
238 DynamicForward 241 DynamicForward
239 EscapeChar 242 EscapeChar
240 ExitOnForwardFailure 243 ExitOnForwardFailure
244 FingerprintHash
241 ForwardAgent 245 ForwardAgent
242 ForwardX11 246 ForwardX11
243 ForwardX11Timeout 247 ForwardX11Timeout
@@ -249,6 +253,7 @@ DESCRIPTION
249 HashKnownHosts 253 HashKnownHosts
250 Host 254 Host
251 HostbasedAuthentication 255 HostbasedAuthentication
256 HostbasedKeyTypes
252 HostKeyAlgorithms 257 HostKeyAlgorithms
253 HostKeyAlias 258 HostKeyAlias
254 HostName 259 HostName
@@ -288,6 +293,7 @@ DESCRIPTION
288 TCPKeepAlive 293 TCPKeepAlive
289 Tunnel 294 Tunnel
290 TunnelDevice 295 TunnelDevice
296 UpdateHostKeys
291 UsePrivilegedPort 297 UsePrivilegedPort
292 User 298 User
293 UserKnownHostsFile 299 UserKnownHostsFile
@@ -299,12 +305,13 @@ DESCRIPTION
299 Port to connect to on the remote host. This can be specified on 305 Port to connect to on the remote host. This can be specified on
300 a per-host basis in the configuration file. 306 a per-host basis in the configuration file.
301 307
302 -Q cipher | cipher-auth | mac | kex | key 308 -Q cipher | cipher-auth | mac | kex | key | protocol-version
303 Queries ssh for the algorithms supported for the specified 309 Queries ssh for the algorithms supported for the specified
304 version 2. The available features are: cipher (supported 310 version 2. The available features are: cipher (supported
305 symmetric ciphers), cipher-auth (supported symmetric ciphers that 311 symmetric ciphers), cipher-auth (supported symmetric ciphers that
306 support authenticated encryption), mac (supported message 312 support authenticated encryption), mac (supported message
307 integrity codes), kex (key exchange algorithms), key (key types). 313 integrity codes), kex (key exchange algorithms), key (key types)
314 and protocol-version (supported SSH protocol versions).
308 315
309 -q Quiet mode. Causes most warning and diagnostic messages to be 316 -q Quiet mode. Causes most warning and diagnostic messages to be
310 suppressed. 317 suppressed.
@@ -325,19 +332,19 @@ DESCRIPTION
325 By default, the listening socket on the server will be bound to 332 By default, the listening socket on the server will be bound to
326 the loopback interface only. This may be overridden by 333 the loopback interface only. This may be overridden by
327 specifying a bind_address. An empty bind_address, or the address 334 specifying a bind_address. An empty bind_address, or the address
328 `*', indicates that the remote socket should listen on all 335 M-bM-^@M-^X*M-bM-^@M-^Y, indicates that the remote socket should listen on all
329 interfaces. Specifying a remote bind_address will only succeed 336 interfaces. Specifying a remote bind_address will only succeed
330 if the server's GatewayPorts option is enabled (see 337 if the server's GatewayPorts option is enabled (see
331 sshd_config(5)). 338 sshd_config(5)).
332 339
333 If the port argument is `0', the listen port will be dynamically 340 If the port argument is M-bM-^@M-^X0M-bM-^@M-^Y, the listen port will be dynamically
334 allocated on the server and reported to the client at run time. 341 allocated on the server and reported to the client at run time.
335 When used together with -O forward the allocated port will be 342 When used together with -O forward the allocated port will be
336 printed to the standard output. 343 printed to the standard output.
337 344
338 -S ctl_path 345 -S ctl_path
339 Specifies the location of a control socket for connection 346 Specifies the location of a control socket for connection
340 sharing, or the string ``none'' to disable connection sharing. 347 sharing, or the string M-bM-^@M-^\noneM-bM-^@M-^] to disable connection sharing.
341 Refer to the description of ControlPath and ControlMaster in 348 Refer to the description of ControlPath and ControlMaster in
342 ssh_config(5) for details. 349 ssh_config(5) for details.
343 350
@@ -373,11 +380,11 @@ DESCRIPTION
373 (remote_tun). 380 (remote_tun).
374 381
375 The devices may be specified by numerical ID or the keyword 382 The devices may be specified by numerical ID or the keyword
376 ``any'', which uses the next available tunnel device. If 383 M-bM-^@M-^\anyM-bM-^@M-^], which uses the next available tunnel device. If
377 remote_tun is not specified, it defaults to ``any''. See also 384 remote_tun is not specified, it defaults to M-bM-^@M-^\anyM-bM-^@M-^]. See also the
378 the Tunnel and TunnelDevice directives in ssh_config(5). If the 385 Tunnel and TunnelDevice directives in ssh_config(5). If the
379 Tunnel directive is unset, it is set to the default tunnel mode, 386 Tunnel directive is unset, it is set to the default tunnel mode,
380 which is ``point-to-point''. 387 which is M-bM-^@M-^\point-to-pointM-bM-^@M-^].
381 388
382 -X Enables X11 forwarding. This can also be specified on a per-host 389 -X Enables X11 forwarding. This can also be specified on a per-host
383 basis in a configuration file. 390 basis in a configuration file.
@@ -444,7 +451,7 @@ AUTHENTICATION
444 creates a public/private key pair for authentication purposes. The 451 creates a public/private key pair for authentication purposes. The
445 server knows the public key, and only the user knows the private key. 452 server knows the public key, and only the user knows the private key.
446 ssh implements public key authentication protocol automatically, using 453 ssh implements public key authentication protocol automatically, using
447 one of the DSA, ECDSA, ED25519 or RSA algorithms. Protocol 1 is 454 one of the DSA, ECDSA, Ed25519 or RSA algorithms. Protocol 1 is
448 restricted to using only RSA keys, but protocol 2 may use any. The 455 restricted to using only RSA keys, but protocol 2 may use any. The
449 HISTORY section of ssl(8) contains a brief discussion of the DSA and RSA 456 HISTORY section of ssl(8) contains a brief discussion of the DSA and RSA
450 algorithms. 457 algorithms.
@@ -458,10 +465,10 @@ AUTHENTICATION
458 The user creates his/her key pair by running ssh-keygen(1). This stores 465 The user creates his/her key pair by running ssh-keygen(1). This stores
459 the private key in ~/.ssh/identity (protocol 1), ~/.ssh/id_dsa (protocol 466 the private key in ~/.ssh/identity (protocol 1), ~/.ssh/id_dsa (protocol
460 2 DSA), ~/.ssh/id_ecdsa (protocol 2 ECDSA), ~/.ssh/id_ed25519 (protocol 2 467 2 DSA), ~/.ssh/id_ecdsa (protocol 2 ECDSA), ~/.ssh/id_ed25519 (protocol 2
461 ED25519), or ~/.ssh/id_rsa (protocol 2 RSA) and stores the public key in 468 Ed25519), or ~/.ssh/id_rsa (protocol 2 RSA) and stores the public key in
462 ~/.ssh/identity.pub (protocol 1), ~/.ssh/id_dsa.pub (protocol 2 DSA), 469 ~/.ssh/identity.pub (protocol 1), ~/.ssh/id_dsa.pub (protocol 2 DSA),
463 ~/.ssh/id_ecdsa.pub (protocol 2 ECDSA), ~/.ssh/id_ed25519.pub (protocol 2 470 ~/.ssh/id_ecdsa.pub (protocol 2 ECDSA), ~/.ssh/id_ed25519.pub (protocol 2
464 ED25519), or ~/.ssh/id_rsa.pub (protocol 2 RSA) in the user's home 471 Ed25519), or ~/.ssh/id_rsa.pub (protocol 2 RSA) in the user's home
465 directory. The user should then copy the public key to 472 directory. The user should then copy the public key to
466 ~/.ssh/authorized_keys in his/her home directory on the remote machine. 473 ~/.ssh/authorized_keys in his/her home directory on the remote machine.
467 The authorized_keys file corresponds to the conventional ~/.rhosts file, 474 The authorized_keys file corresponds to the conventional ~/.rhosts file,
@@ -512,8 +519,8 @@ AUTHENTICATION
512 519
513 If no pseudo-tty has been allocated, the session is transparent and can 520 If no pseudo-tty has been allocated, the session is transparent and can
514 be used to reliably transfer binary data. On most systems, setting the 521 be used to reliably transfer binary data. On most systems, setting the
515 escape character to ``none'' will also make the session transparent even 522 escape character to M-bM-^@M-^\noneM-bM-^@M-^] will also make the session transparent even if
516 if a tty is used. 523 a tty is used.
517 524
518 The session terminates when the command or shell on the remote machine 525 The session terminates when the command or shell on the remote machine
519 exits and all X11 and TCP connections have been closed. 526 exits and all X11 and TCP connections have been closed.
@@ -528,7 +535,7 @@ ESCAPE CHARACTERS
528 character can be changed in configuration files using the EscapeChar 535 character can be changed in configuration files using the EscapeChar
529 configuration directive or on the command line by the -e option. 536 configuration directive or on the command line by the -e option.
530 537
531 The supported escapes (assuming the default `~') are: 538 The supported escapes (assuming the default M-bM-^@M-^X~M-bM-^@M-^Y) are:
532 539
533 ~. Disconnect. 540 ~. Disconnect.
534 541
@@ -577,26 +584,26 @@ TCP FORWARDING
577 same local port, and ssh will encrypt and forward the connection. 584 same local port, and ssh will encrypt and forward the connection.
578 585
579 The following example tunnels an IRC session from client machine 586 The following example tunnels an IRC session from client machine
580 ``127.0.0.1'' (localhost) to remote server ``server.example.com'': 587 M-bM-^@M-^\127.0.0.1M-bM-^@M-^] (localhost) to remote server M-bM-^@M-^\server.example.comM-bM-^@M-^]:
581 588
582 $ ssh -f -L 1234:localhost:6667 server.example.com sleep 10 589 $ ssh -f -L 1234:localhost:6667 server.example.com sleep 10
583 $ irc -c '#users' -p 1234 pinky 127.0.0.1 590 $ irc -c '#users' -p 1234 pinky 127.0.0.1
584 591
585 This tunnels a connection to IRC server ``server.example.com'', joining 592 This tunnels a connection to IRC server M-bM-^@M-^\server.example.comM-bM-^@M-^], joining
586 channel ``#users'', nickname ``pinky'', using port 1234. It doesn't 593 channel M-bM-^@M-^\#usersM-bM-^@M-^], nickname M-bM-^@M-^\pinkyM-bM-^@M-^], using port 1234. It doesn't matter
587 matter which port is used, as long as it's greater than 1023 (remember, 594 which port is used, as long as it's greater than 1023 (remember, only
588 only root can open sockets on privileged ports) and doesn't conflict with 595 root can open sockets on privileged ports) and doesn't conflict with any
589 any ports already in use. The connection is forwarded to port 6667 on 596 ports already in use. The connection is forwarded to port 6667 on the
590 the remote server, since that's the standard port for IRC services. 597 remote server, since that's the standard port for IRC services.
591 598
592 The -f option backgrounds ssh and the remote command ``sleep 10'' is 599 The -f option backgrounds ssh and the remote command M-bM-^@M-^\sleep 10M-bM-^@M-^] is
593 specified to allow an amount of time (10 seconds, in the example) to 600 specified to allow an amount of time (10 seconds, in the example) to
594 start the service which is to be tunnelled. If no connections are made 601 start the service which is to be tunnelled. If no connections are made
595 within the time specified, ssh will exit. 602 within the time specified, ssh will exit.
596 603
597X11 FORWARDING 604X11 FORWARDING
598 If the ForwardX11 variable is set to ``yes'' (or see the description of 605 If the ForwardX11 variable is set to M-bM-^@M-^\yesM-bM-^@M-^] (or see the description of the
599 the -X, -x, and -Y options above) and the user is using X11 (the DISPLAY 606 -X, -x, and -Y options above) and the user is using X11 (the DISPLAY
600 environment variable is set), the connection to the X11 display is 607 environment variable is set), the connection to the X11 display is
601 automatically forwarded to the remote side in such a way that any X11 608 automatically forwarded to the remote side in such a way that any X11
602 programs started from the shell (or command) will go through the 609 programs started from the shell (or command) will go through the
@@ -607,7 +614,7 @@ X11 FORWARDING
607 614
608 The DISPLAY value set by ssh will point to the server machine, but with a 615 The DISPLAY value set by ssh will point to the server machine, but with a
609 display number greater than zero. This is normal, and happens because 616 display number greater than zero. This is normal, and happens because
610 ssh creates a ``proxy'' X server on the server machine for forwarding the 617 ssh creates a M-bM-^@M-^\proxyM-bM-^@M-^] X server on the server machine for forwarding the
611 connections over the encrypted channel. 618 connections over the encrypted channel.
612 619
613 ssh will also automatically set up Xauthority data on the server machine. 620 ssh will also automatically set up Xauthority data on the server machine.
@@ -617,7 +624,7 @@ X11 FORWARDING
617 is opened. The real authentication cookie is never sent to the server 624 is opened. The real authentication cookie is never sent to the server
618 machine (and no cookies are sent in the plain). 625 machine (and no cookies are sent in the plain).
619 626
620 If the ForwardAgent variable is set to ``yes'' (or see the description of 627 If the ForwardAgent variable is set to M-bM-^@M-^\yesM-bM-^@M-^] (or see the description of
621 the -A and -a options above) and the user is using an authentication 628 the -A and -a options above) and the user is using an authentication
622 agent, the connection to the agent is automatically forwarded to the 629 agent, the connection to the agent is automatically forwarded to the
623 remote side. 630 remote side.
@@ -632,15 +639,15 @@ VERIFYING HOST KEYS
632 639
633 If the fingerprint is already known, it can be matched and the key can be 640 If the fingerprint is already known, it can be matched and the key can be
634 accepted or rejected. Because of the difficulty of comparing host keys 641 accepted or rejected. Because of the difficulty of comparing host keys
635 just by looking at hex strings, there is also support to compare host 642 just by looking at fingerprint strings, there is also support to compare
636 keys visually, using random art. By setting the VisualHostKey option to 643 host keys visually, using random art. By setting the VisualHostKey
637 ``yes'', a small ASCII graphic gets displayed on every login to a server, 644 option to M-bM-^@M-^\yesM-bM-^@M-^], a small ASCII graphic gets displayed on every login to a
638 no matter if the session itself is interactive or not. By learning the 645 server, no matter if the session itself is interactive or not. By
639 pattern a known server produces, a user can easily find out that the host 646 learning the pattern a known server produces, a user can easily find out
640 key has changed when a completely different pattern is displayed. 647 that the host key has changed when a completely different pattern is
641 Because these patterns are not unambiguous however, a pattern that looks 648 displayed. Because these patterns are not unambiguous however, a pattern
642 similar to the pattern remembered only gives a good probability that the 649 that looks similar to the pattern remembered only gives a good
643 host key is the same, not guaranteed proof. 650 probability that the host key is the same, not guaranteed proof.
644 651
645 To get a listing of the fingerprints along with their random art for all 652 To get a listing of the fingerprints along with their random art for all
646 known hosts, the following command line can be used: 653 known hosts, the following command line can be used:
@@ -653,8 +660,8 @@ VERIFYING HOST KEYS
653 able to match the fingerprint with that of the key presented. 660 able to match the fingerprint with that of the key presented.
654 661
655 In this example, we are connecting a client to a server, 662 In this example, we are connecting a client to a server,
656 ``host.example.com''. The SSHFP resource records should first be added 663 M-bM-^@M-^\host.example.comM-bM-^@M-^]. The SSHFP resource records should first be added to
657 to the zonefile for host.example.com: 664 the zonefile for host.example.com:
658 665
659 $ ssh-keygen -r host.example.com. 666 $ ssh-keygen -r host.example.com.
660 667
@@ -697,9 +704,9 @@ SSH-BASED VIRTUAL PRIVATE NETWORKS
697 704
698 Client access may be more finely tuned via the /root/.ssh/authorized_keys 705 Client access may be more finely tuned via the /root/.ssh/authorized_keys
699 file (see below) and the PermitRootLogin server option. The following 706 file (see below) and the PermitRootLogin server option. The following
700 entry would permit connections on tun(4) device 1 from user ``jane'' and 707 entry would permit connections on tun(4) device 1 from user M-bM-^@M-^\janeM-bM-^@M-^] and on
701 on tun device 2 from user ``john'', if PermitRootLogin is set to 708 tun device 2 from user M-bM-^@M-^\johnM-bM-^@M-^], if PermitRootLogin is set to
702 ``forced-commands-only'': 709 M-bM-^@M-^\forced-commands-onlyM-bM-^@M-^]:
703 710
704 tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane 711 tunnel="1",command="sh /etc/netstart tun1" ssh-rsa ... jane
705 tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john 712 tunnel="2",command="sh /etc/netstart tun2" ssh-rsa ... john
@@ -714,14 +721,14 @@ ENVIRONMENT
714 721
715 DISPLAY The DISPLAY variable indicates the location of the 722 DISPLAY The DISPLAY variable indicates the location of the
716 X11 server. It is automatically set by ssh to 723 X11 server. It is automatically set by ssh to
717 point to a value of the form ``hostname:n'', where 724 point to a value of the form M-bM-^@M-^\hostname:nM-bM-^@M-^], where
718 ``hostname'' indicates the host where the shell 725 M-bM-^@M-^\hostnameM-bM-^@M-^] indicates the host where the shell runs,
719 runs, and `n' is an integer >= 1. ssh uses this 726 and M-bM-^@M-^XnM-bM-^@M-^Y is an integer M-bM-^IM-% 1. ssh uses this special
720 special value to forward X11 connections over the 727 value to forward X11 connections over the secure
721 secure channel. The user should normally not set 728 channel. The user should normally not set DISPLAY
722 DISPLAY explicitly, as that will render the X11 729 explicitly, as that will render the X11 connection
723 connection insecure (and will require the user to 730 insecure (and will require the user to manually
724 manually copy any required authorization cookies). 731 copy any required authorization cookies).
725 732
726 HOME Set to the path of the user's home directory. 733 HOME Set to the path of the user's home directory.
727 734
@@ -770,7 +777,7 @@ ENVIRONMENT
770 USER Set to the name of the user logging in. 777 USER Set to the name of the user logging in.
771 778
772 Additionally, ssh reads ~/.ssh/environment, and adds lines of the format 779 Additionally, ssh reads ~/.ssh/environment, and adds lines of the format
773 ``VARNAME=value'' to the environment if the file exists and users are 780 M-bM-^@M-^\VARNAME=valueM-bM-^@M-^] to the environment if the file exists and users are
774 allowed to change their environment. For more information, see the 781 allowed to change their environment. For more information, see the
775 PermitUserEnvironment option in sshd_config(5). 782 PermitUserEnvironment option in sshd_config(5).
776 783
@@ -797,7 +804,7 @@ FILES
797 for the user, and not accessible by others. 804 for the user, and not accessible by others.
798 805
799 ~/.ssh/authorized_keys 806 ~/.ssh/authorized_keys
800 Lists the public keys (DSA, ECDSA, ED25519, RSA) that can be used 807 Lists the public keys (DSA, ECDSA, Ed25519, RSA) that can be used
801 for logging in as this user. The format of this file is 808 for logging in as this user. The format of this file is
802 described in the sshd(8) manual page. This file is not highly 809 described in the sshd(8) manual page. This file is not highly
803 sensitive, but the recommended permissions are read/write for the 810 sensitive, but the recommended permissions are read/write for the
@@ -941,4 +948,4 @@ AUTHORS
941 created OpenSSH. Markus Friedl contributed the support for SSH protocol 948 created OpenSSH. Markus Friedl contributed the support for SSH protocol
942 versions 1.5 and 2.0. 949 versions 1.5 and 2.0.
943 950
944OpenBSD 5.6 July 24, 2014 OpenBSD 5.6 951OpenBSD 5.7 March 3, 2015 OpenBSD 5.7
diff --git a/ssh.1 b/ssh.1
index fa5cfb2c2..da64b7198 100644
--- a/ssh.1
+++ b/ssh.1
@@ -33,8 +33,8 @@
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\" 35.\"
36.\" $OpenBSD: ssh.1,v 1.348 2014/07/24 22:57:10 millert Exp $ 36.\" $OpenBSD: ssh.1,v 1.356 2015/03/03 06:48:58 djm Exp $
37.Dd $Mdocdate: July 24 2014 $ 37.Dd $Mdocdate: March 3 2015 $
38.Dt SSH 1 38.Dt SSH 1
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -43,7 +43,7 @@
43.Sh SYNOPSIS 43.Sh SYNOPSIS
44.Nm ssh 44.Nm ssh
45.Bk -words 45.Bk -words
46.Op Fl 1246AaCfgKkMNnqsTtVvXxYy 46.Op Fl 1246AaCfGgKkMNnqsTtVvXxYy
47.Op Fl b Ar bind_address 47.Op Fl b Ar bind_address
48.Op Fl c Ar cipher_spec 48.Op Fl c Ar cipher_spec
49.Op Fl D Oo Ar bind_address : Oc Ns Ar port 49.Op Fl D Oo Ar bind_address : Oc Ns Ar port
@@ -58,7 +58,7 @@
58.Op Fl O Ar ctl_cmd 58.Op Fl O Ar ctl_cmd
59.Op Fl o Ar option 59.Op Fl o Ar option
60.Op Fl p Ar port 60.Op Fl p Ar port
61.Op Fl Q Cm cipher | cipher-auth | mac | kex | key 61.Op Fl Q Cm cipher | cipher-auth | mac | kex | key | protocol-version
62.Op Fl R Oo Ar bind_address : Oc Ns Ar port : Ns Ar host : Ns Ar hostport 62.Op Fl R Oo Ar bind_address : Oc Ns Ar port : Ns Ar host : Ns Ar hostport
63.Op Fl S Ar ctl_path 63.Op Fl S Ar ctl_path
64.Op Fl W Ar host : Ns Ar port 64.Op Fl W Ar host : Ns Ar port
@@ -251,6 +251,14 @@ then a client started with
251.Fl f 251.Fl f
252will wait for all remote port forwards to be successfully established 252will wait for all remote port forwards to be successfully established
253before placing itself in the background. 253before placing itself in the background.
254.It Fl G
255Causes
256.Nm
257to print its configuration after evaluating
258.Cm Host
259and
260.Cm Match
261blocks and exit.
254.It Fl g 262.It Fl g
255Allows remote hosts to connect to local forwarded ports. 263Allows remote hosts to connect to local forwarded ports.
256If used on a multiplexed connection, then this option must be specified 264If used on a multiplexed connection, then this option must be specified
@@ -425,6 +433,7 @@ For full details of the options listed below, and their possible values, see
425.It DynamicForward 433.It DynamicForward
426.It EscapeChar 434.It EscapeChar
427.It ExitOnForwardFailure 435.It ExitOnForwardFailure
436.It FingerprintHash
428.It ForwardAgent 437.It ForwardAgent
429.It ForwardX11 438.It ForwardX11
430.It ForwardX11Timeout 439.It ForwardX11Timeout
@@ -436,6 +445,7 @@ For full details of the options listed below, and their possible values, see
436.It HashKnownHosts 445.It HashKnownHosts
437.It Host 446.It Host
438.It HostbasedAuthentication 447.It HostbasedAuthentication
448.It HostbasedKeyTypes
439.It HostKeyAlgorithms 449.It HostKeyAlgorithms
440.It HostKeyAlias 450.It HostKeyAlias
441.It HostName 451.It HostName
@@ -475,6 +485,7 @@ For full details of the options listed below, and their possible values, see
475.It TCPKeepAlive 485.It TCPKeepAlive
476.It Tunnel 486.It Tunnel
477.It TunnelDevice 487.It TunnelDevice
488.It UpdateHostKeys
478.It UsePrivilegedPort 489.It UsePrivilegedPort
479.It User 490.It User
480.It UserKnownHostsFile 491.It UserKnownHostsFile
@@ -486,7 +497,7 @@ For full details of the options listed below, and their possible values, see
486Port to connect to on the remote host. 497Port to connect to on the remote host.
487This can be specified on a 498This can be specified on a
488per-host basis in the configuration file. 499per-host basis in the configuration file.
489.It Fl Q Cm cipher | cipher-auth | mac | kex | key 500.It Fl Q Cm cipher | cipher-auth | mac | kex | key | protocol-version
490Queries 501Queries
491.Nm 502.Nm
492for the algorithms supported for the specified version 2. 503for the algorithms supported for the specified version 2.
@@ -500,7 +511,9 @@ The available features are:
500.Ar kex 511.Ar kex
501(key exchange algorithms), 512(key exchange algorithms),
502.Ar key 513.Ar key
503(key types). 514(key types) and
515.Ar protocol-version
516(supported SSH protocol versions).
504.It Fl q 517.It Fl q
505Quiet mode. 518Quiet mode.
506Causes most warning and diagnostic messages to be suppressed. 519Causes most warning and diagnostic messages to be suppressed.
@@ -748,7 +761,7 @@ key pair for authentication purposes.
748The server knows the public key, and only the user knows the private key. 761The server knows the public key, and only the user knows the private key.
749.Nm 762.Nm
750implements public key authentication protocol automatically, 763implements public key authentication protocol automatically,
751using one of the DSA, ECDSA, ED25519 or RSA algorithms. 764using one of the DSA, ECDSA, Ed25519 or RSA algorithms.
752Protocol 1 is restricted to using only RSA keys, 765Protocol 1 is restricted to using only RSA keys,
753but protocol 2 may use any. 766but protocol 2 may use any.
754The HISTORY section of 767The HISTORY section of
@@ -776,7 +789,7 @@ This stores the private key in
776.Pa ~/.ssh/id_ecdsa 789.Pa ~/.ssh/id_ecdsa
777(protocol 2 ECDSA), 790(protocol 2 ECDSA),
778.Pa ~/.ssh/id_ed25519 791.Pa ~/.ssh/id_ed25519
779(protocol 2 ED25519), 792(protocol 2 Ed25519),
780or 793or
781.Pa ~/.ssh/id_rsa 794.Pa ~/.ssh/id_rsa
782(protocol 2 RSA) 795(protocol 2 RSA)
@@ -788,7 +801,7 @@ and stores the public key in
788.Pa ~/.ssh/id_ecdsa.pub 801.Pa ~/.ssh/id_ecdsa.pub
789(protocol 2 ECDSA), 802(protocol 2 ECDSA),
790.Pa ~/.ssh/id_ed25519.pub 803.Pa ~/.ssh/id_ed25519.pub
791(protocol 2 ED25519), 804(protocol 2 Ed25519),
792or 805or
793.Pa ~/.ssh/id_rsa.pub 806.Pa ~/.ssh/id_rsa.pub
794(protocol 2 RSA) 807(protocol 2 RSA)
@@ -1083,7 +1096,7 @@ Fingerprints can be determined using
1083If the fingerprint is already known, it can be matched 1096If the fingerprint is already known, it can be matched
1084and the key can be accepted or rejected. 1097and the key can be accepted or rejected.
1085Because of the difficulty of comparing host keys 1098Because of the difficulty of comparing host keys
1086just by looking at hex strings, 1099just by looking at fingerprint strings,
1087there is also support to compare host keys visually, 1100there is also support to compare host keys visually,
1088using 1101using
1089.Em random art . 1102.Em random art .
@@ -1328,7 +1341,7 @@ secret, but the recommended permissions are read/write/execute for the user,
1328and not accessible by others. 1341and not accessible by others.
1329.Pp 1342.Pp
1330.It Pa ~/.ssh/authorized_keys 1343.It Pa ~/.ssh/authorized_keys
1331Lists the public keys (DSA, ECDSA, ED25519, RSA) 1344Lists the public keys (DSA, ECDSA, Ed25519, RSA)
1332that can be used for logging in as this user. 1345that can be used for logging in as this user.
1333The format of this file is described in the 1346The format of this file is described in the
1334.Xr sshd 8 1347.Xr sshd 8
diff --git a/ssh.c b/ssh.c
index 26e9681b7..0ad82f029 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.407 2014/07/17 07:22:19 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.416 2015/03/03 06:48:58 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -48,7 +48,6 @@
48#endif 48#endif
49#include <sys/resource.h> 49#include <sys/resource.h>
50#include <sys/ioctl.h> 50#include <sys/ioctl.h>
51#include <sys/param.h>
52#include <sys/socket.h> 51#include <sys/socket.h>
53#include <sys/wait.h> 52#include <sys/wait.h>
54 53
@@ -67,6 +66,7 @@
67#include <stdlib.h> 66#include <stdlib.h>
68#include <string.h> 67#include <string.h>
69#include <unistd.h> 68#include <unistd.h>
69#include <limits.h>
70 70
71#include <netinet/in.h> 71#include <netinet/in.h>
72#include <arpa/inet.h> 72#include <arpa/inet.h>
@@ -107,6 +107,7 @@
107#include "uidswap.h" 107#include "uidswap.h"
108#include "roaming.h" 108#include "roaming.h"
109#include "version.h" 109#include "version.h"
110#include "ssherr.h"
110 111
111#ifdef ENABLE_PKCS11 112#ifdef ENABLE_PKCS11
112#include "ssh-pkcs11.h" 113#include "ssh-pkcs11.h"
@@ -199,7 +200,7 @@ static void
199usage(void) 200usage(void)
200{ 201{
201 fprintf(stderr, 202 fprintf(stderr,
202"usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n" 203"usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]\n"
203" [-D [bind_address:]port] [-E log_file] [-e escape_char]\n" 204" [-D [bind_address:]port] [-E log_file] [-e escape_char]\n"
204" [-F configfile] [-I pkcs11] [-i identity_file]\n" 205" [-F configfile] [-I pkcs11] [-i identity_file]\n"
205" [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]\n" 206" [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]\n"
@@ -276,6 +277,60 @@ resolve_host(const char *name, int port, int logerr, char *cname, size_t clen)
276} 277}
277 278
278/* 279/*
280 * Attempt to resolve a numeric host address / port to a single address.
281 * Returns a canonical address string.
282 * Returns NULL on failure.
283 * NB. this function must operate with a options having undefined members.
284 */
285static struct addrinfo *
286resolve_addr(const char *name, int port, char *caddr, size_t clen)
287{
288 char addr[NI_MAXHOST], strport[NI_MAXSERV];
289 struct addrinfo hints, *res;
290 int gaierr;
291
292 if (port <= 0)
293 port = default_ssh_port();
294 snprintf(strport, sizeof strport, "%u", port);
295 memset(&hints, 0, sizeof(hints));
296 hints.ai_family = options.address_family == -1 ?
297 AF_UNSPEC : options.address_family;
298 hints.ai_socktype = SOCK_STREAM;
299 hints.ai_flags = AI_NUMERICHOST|AI_NUMERICSERV;
300 if ((gaierr = getaddrinfo(name, strport, &hints, &res)) != 0) {
301 debug2("%s: could not resolve name %.100s as address: %s",
302 __func__, name, ssh_gai_strerror(gaierr));
303 return NULL;
304 }
305 if (res == NULL) {
306 debug("%s: getaddrinfo %.100s returned no addresses",
307 __func__, name);
308 return NULL;
309 }
310 if (res->ai_next != NULL) {
311 debug("%s: getaddrinfo %.100s returned multiple addresses",
312 __func__, name);
313 goto fail;
314 }
315 if ((gaierr = getnameinfo(res->ai_addr, res->ai_addrlen,
316 addr, sizeof(addr), NULL, 0, NI_NUMERICHOST)) != 0) {
317 debug("%s: Could not format address for name %.100s: %s",
318 __func__, name, ssh_gai_strerror(gaierr));
319 goto fail;
320 }
321 if (strlcpy(caddr, addr, clen) >= clen) {
322 error("%s: host \"%s\" addr \"%s\" too long (max %lu)",
323 __func__, name, addr, (u_long)clen);
324 if (clen > 0)
325 *caddr = '\0';
326 fail:
327 freeaddrinfo(res);
328 return NULL;
329 }
330 return res;
331}
332
333/*
279 * Check whether the cname is a permitted replacement for the hostname 334 * Check whether the cname is a permitted replacement for the hostname
280 * and perform the replacement if it is. 335 * and perform the replacement if it is.
281 * NB. this function must operate with a options having undefined members. 336 * NB. this function must operate with a options having undefined members.
@@ -325,7 +380,7 @@ static struct addrinfo *
325resolve_canonicalize(char **hostp, int port) 380resolve_canonicalize(char **hostp, int port)
326{ 381{
327 int i, ndots; 382 int i, ndots;
328 char *cp, *fullhost, cname_target[NI_MAXHOST]; 383 char *cp, *fullhost, newname[NI_MAXHOST];
329 struct addrinfo *addrs; 384 struct addrinfo *addrs;
330 385
331 if (options.canonicalize_hostname == SSH_CANONICALISE_NO) 386 if (options.canonicalize_hostname == SSH_CANONICALISE_NO)
@@ -339,6 +394,19 @@ resolve_canonicalize(char **hostp, int port)
339 options.canonicalize_hostname != SSH_CANONICALISE_ALWAYS) 394 options.canonicalize_hostname != SSH_CANONICALISE_ALWAYS)
340 return NULL; 395 return NULL;
341 396
397 /* Try numeric hostnames first */
398 if ((addrs = resolve_addr(*hostp, port,
399 newname, sizeof(newname))) != NULL) {
400 debug2("%s: hostname %.100s is address", __func__, *hostp);
401 if (strcasecmp(*hostp, newname) != 0) {
402 debug2("%s: canonicalised address \"%s\" => \"%s\"",
403 __func__, *hostp, newname);
404 free(*hostp);
405 *hostp = xstrdup(newname);
406 }
407 return addrs;
408 }
409
342 /* Don't apply canonicalization to sufficiently-qualified hostnames */ 410 /* Don't apply canonicalization to sufficiently-qualified hostnames */
343 ndots = 0; 411 ndots = 0;
344 for (cp = *hostp; *cp != '\0'; cp++) { 412 for (cp = *hostp; *cp != '\0'; cp++) {
@@ -352,20 +420,20 @@ resolve_canonicalize(char **hostp, int port)
352 } 420 }
353 /* Attempt each supplied suffix */ 421 /* Attempt each supplied suffix */
354 for (i = 0; i < options.num_canonical_domains; i++) { 422 for (i = 0; i < options.num_canonical_domains; i++) {
355 *cname_target = '\0'; 423 *newname = '\0';
356 xasprintf(&fullhost, "%s.%s.", *hostp, 424 xasprintf(&fullhost, "%s.%s.", *hostp,
357 options.canonical_domains[i]); 425 options.canonical_domains[i]);
358 debug3("%s: attempting \"%s\" => \"%s\"", __func__, 426 debug3("%s: attempting \"%s\" => \"%s\"", __func__,
359 *hostp, fullhost); 427 *hostp, fullhost);
360 if ((addrs = resolve_host(fullhost, port, 0, 428 if ((addrs = resolve_host(fullhost, port, 0,
361 cname_target, sizeof(cname_target))) == NULL) { 429 newname, sizeof(newname))) == NULL) {
362 free(fullhost); 430 free(fullhost);
363 continue; 431 continue;
364 } 432 }
365 /* Remove trailing '.' */ 433 /* Remove trailing '.' */
366 fullhost[strlen(fullhost) - 1] = '\0'; 434 fullhost[strlen(fullhost) - 1] = '\0';
367 /* Follow CNAME if requested */ 435 /* Follow CNAME if requested */
368 if (!check_follow_cname(&fullhost, cname_target)) { 436 if (!check_follow_cname(&fullhost, newname)) {
369 debug("Canonicalized hostname \"%s\" => \"%s\"", 437 debug("Canonicalized hostname \"%s\" => \"%s\"",
370 *hostp, fullhost); 438 *hostp, fullhost);
371 } 439 }
@@ -384,27 +452,49 @@ resolve_canonicalize(char **hostp, int port)
384 * file if the user specifies a config file on the command line. 452 * file if the user specifies a config file on the command line.
385 */ 453 */
386static void 454static void
387process_config_files(struct passwd *pw) 455process_config_files(const char *host_arg, struct passwd *pw, int post_canon)
388{ 456{
389 char buf[MAXPATHLEN]; 457 char buf[PATH_MAX];
390 int r; 458 int r;
391 459
392 if (config != NULL) { 460 if (config != NULL) {
393 if (strcasecmp(config, "none") != 0 && 461 if (strcasecmp(config, "none") != 0 &&
394 !read_config_file(config, pw, host, &options, 462 !read_config_file(config, pw, host, host_arg, &options,
395 SSHCONF_USERCONF)) 463 SSHCONF_USERCONF | (post_canon ? SSHCONF_POSTCANON : 0)))
396 fatal("Can't open user config file %.100s: " 464 fatal("Can't open user config file %.100s: "
397 "%.100s", config, strerror(errno)); 465 "%.100s", config, strerror(errno));
398 } else { 466 } else {
399 r = snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, 467 r = snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir,
400 _PATH_SSH_USER_CONFFILE); 468 _PATH_SSH_USER_CONFFILE);
401 if (r > 0 && (size_t)r < sizeof(buf)) 469 if (r > 0 && (size_t)r < sizeof(buf))
402 (void)read_config_file(buf, pw, host, &options, 470 (void)read_config_file(buf, pw, host, host_arg,
403 SSHCONF_CHECKPERM|SSHCONF_USERCONF); 471 &options, SSHCONF_CHECKPERM | SSHCONF_USERCONF |
472 (post_canon ? SSHCONF_POSTCANON : 0));
404 473
405 /* Read systemwide configuration file after user config. */ 474 /* Read systemwide configuration file after user config. */
406 (void)read_config_file(_PATH_HOST_CONFIG_FILE, pw, host, 475 (void)read_config_file(_PATH_HOST_CONFIG_FILE, pw,
407 &options, 0); 476 host, host_arg, &options,
477 post_canon ? SSHCONF_POSTCANON : 0);
478 }
479}
480
481/* Rewrite the port number in an addrinfo list of addresses */
482static void
483set_addrinfo_port(struct addrinfo *addrs, int port)
484{
485 struct addrinfo *addr;
486
487 for (addr = addrs; addr != NULL; addr = addr->ai_next) {
488 switch (addr->ai_family) {
489 case AF_INET:
490 ((struct sockaddr_in *)addr->ai_addr)->
491 sin_port = htons(port);
492 break;
493 case AF_INET6:
494 ((struct sockaddr_in6 *)addr->ai_addr)->
495 sin6_port = htons(port);
496 break;
497 }
408 } 498 }
409} 499}
410 500
@@ -414,8 +504,8 @@ process_config_files(struct passwd *pw)
414int 504int
415main(int ac, char **av) 505main(int ac, char **av)
416{ 506{
417 int i, r, opt, exit_status, use_syslog; 507 int i, r, opt, exit_status, use_syslog, config_test = 0;
418 char *p, *cp, *line, *argv0, buf[MAXPATHLEN], *host_arg, *logfile; 508 char *p, *cp, *line, *argv0, buf[PATH_MAX], *host_arg, *logfile;
419 char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; 509 char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV];
420 char cname[NI_MAXHOST]; 510 char cname[NI_MAXHOST];
421 struct stat st; 511 struct stat st;
@@ -507,7 +597,7 @@ main(int ac, char **av)
507 597
508 again: 598 again:
509 while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx" 599 while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx"
510 "ACD:E:F:I:KL:MNO:PQ:R:S:TVw:W:XYy")) != -1) { 600 "ACD:E:F:GI:KL:MNO:PQ:R:S:TVw:W:XYy")) != -1) {
511 switch (opt) { 601 switch (opt) {
512 case '1': 602 case '1':
513 options.protocol = SSH_PROTO_1; 603 options.protocol = SSH_PROTO_1;
@@ -540,6 +630,9 @@ main(int ac, char **av)
540 case 'E': 630 case 'E':
541 logfile = xstrdup(optarg); 631 logfile = xstrdup(optarg);
542 break; 632 break;
633 case 'G':
634 config_test = 1;
635 break;
543 case 'Y': 636 case 'Y':
544 options.forward_x11 = 1; 637 options.forward_x11 = 1;
545 options.forward_x11_trusted = 1; 638 options.forward_x11_trusted = 1;
@@ -585,6 +678,13 @@ main(int ac, char **av)
585 cp = key_alg_list(1, 0); 678 cp = key_alg_list(1, 0);
586 else if (strcmp(optarg, "key-plain") == 0) 679 else if (strcmp(optarg, "key-plain") == 0)
587 cp = key_alg_list(0, 1); 680 cp = key_alg_list(0, 1);
681 else if (strcmp(optarg, "protocol-version") == 0) {
682#ifdef WITH_SSH1
683 cp = xstrdup("1\n2");
684#else
685 cp = xstrdup("2");
686#endif
687 }
588 if (cp == NULL) 688 if (cp == NULL)
589 fatal("Unsupported query \"%s\"", optarg); 689 fatal("Unsupported query \"%s\"", optarg);
590 printf("%s\n", cp); 690 printf("%s\n", cp);
@@ -788,9 +888,9 @@ main(int ac, char **av)
788 break; 888 break;
789 case 'o': 889 case 'o':
790 line = xstrdup(optarg); 890 line = xstrdup(optarg);
791 if (process_config_line(&options, pw, host ? host : "", 891 if (process_config_line(&options, pw,
792 line, "command-line", 0, NULL, SSHCONF_USERCONF) 892 host ? host : "", host ? host : "", line,
793 != 0) 893 "command-line", 0, NULL, SSHCONF_USERCONF) != 0)
794 exit(255); 894 exit(255);
795 free(line); 895 free(line);
796 break; 896 break;
@@ -899,7 +999,7 @@ main(int ac, char **av)
899 ); 999 );
900 1000
901 /* Parse the configuration files */ 1001 /* Parse the configuration files */
902 process_config_files(pw); 1002 process_config_files(host_arg, pw, 0);
903 1003
904 /* Hostname canonicalisation needs a few options filled. */ 1004 /* Hostname canonicalisation needs a few options filled. */
905 fill_default_options_for_canonicalization(&options); 1005 fill_default_options_for_canonicalization(&options);
@@ -911,6 +1011,8 @@ main(int ac, char **av)
911 "h", host, (char *)NULL); 1011 "h", host, (char *)NULL);
912 free(host); 1012 free(host);
913 host = cp; 1013 host = cp;
1014 free(options.hostname);
1015 options.hostname = xstrdup(host);
914 } 1016 }
915 1017
916 /* If canonicalization requested then try to apply it */ 1018 /* If canonicalization requested then try to apply it */
@@ -945,12 +1047,22 @@ main(int ac, char **av)
945 } 1047 }
946 1048
947 /* 1049 /*
948 * If the target hostname has changed as a result of canonicalisation 1050 * If canonicalisation is enabled then re-parse the configuration
949 * then re-parse the configuration files as new stanzas may match. 1051 * files as new stanzas may match.
950 */ 1052 */
951 if (strcasecmp(host_arg, host) != 0) { 1053 if (options.canonicalize_hostname != 0) {
952 debug("Hostname has changed; re-reading configuration"); 1054 debug("Re-reading configuration after hostname "
953 process_config_files(pw); 1055 "canonicalisation");
1056 free(options.hostname);
1057 options.hostname = xstrdup(host);
1058 process_config_files(host_arg, pw, 1);
1059 /*
1060 * Address resolution happens early with canonicalisation
1061 * enabled and the port number may have changed since, so
1062 * reset it in address list
1063 */
1064 if (addrs != NULL && options.port > 0)
1065 set_addrinfo_port(addrs, options.port);
954 } 1066 }
955 1067
956 /* Fill configuration defaults. */ 1068 /* Fill configuration defaults. */
@@ -967,6 +1079,12 @@ main(int ac, char **av)
967 strcmp(options.proxy_command, "-") == 0 && 1079 strcmp(options.proxy_command, "-") == 0 &&
968 options.proxy_use_fdpass) 1080 options.proxy_use_fdpass)
969 fatal("ProxyCommand=- and ProxyUseFDPass are incompatible"); 1081 fatal("ProxyCommand=- and ProxyUseFDPass are incompatible");
1082 if (options.control_persist &&
1083 options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK) {
1084 debug("UpdateHostKeys=ask is incompatible with ControlPersist; "
1085 "disabling");
1086 options.update_hostkeys = 0;
1087 }
970#ifndef HAVE_CYGWIN 1088#ifndef HAVE_CYGWIN
971 if (original_effective_uid != 0) 1089 if (original_effective_uid != 0)
972 options.use_privileged_port = 0; 1090 options.use_privileged_port = 0;
@@ -1052,6 +1170,11 @@ main(int ac, char **av)
1052 } 1170 }
1053 free(conn_hash_hex); 1171 free(conn_hash_hex);
1054 1172
1173 if (config_test) {
1174 dump_client_config(&options, host);
1175 exit(0);
1176 }
1177
1055 if (muxclient_command != 0 && options.control_path == NULL) 1178 if (muxclient_command != 0 && options.control_path == NULL)
1056 fatal("No ControlPath specified for \"-O\" command"); 1179 fatal("No ControlPath specified for \"-O\" command");
1057 if (options.control_path != NULL) 1180 if (options.control_path != NULL)
@@ -1107,26 +1230,26 @@ main(int ac, char **av)
1107 PRIV_START; 1230 PRIV_START;
1108 sensitive_data.keys[0] = key_load_private_type(KEY_RSA1, 1231 sensitive_data.keys[0] = key_load_private_type(KEY_RSA1,
1109 _PATH_HOST_KEY_FILE, "", NULL, NULL); 1232 _PATH_HOST_KEY_FILE, "", NULL, NULL);
1110 sensitive_data.keys[1] = key_load_private_cert(KEY_DSA,
1111 _PATH_HOST_DSA_KEY_FILE, "", NULL);
1112#ifdef OPENSSL_HAS_ECC 1233#ifdef OPENSSL_HAS_ECC
1113 sensitive_data.keys[2] = key_load_private_cert(KEY_ECDSA, 1234 sensitive_data.keys[1] = key_load_private_cert(KEY_ECDSA,
1114 _PATH_HOST_ECDSA_KEY_FILE, "", NULL); 1235 _PATH_HOST_ECDSA_KEY_FILE, "", NULL);
1115#endif 1236#endif
1237 sensitive_data.keys[2] = key_load_private_cert(KEY_ED25519,
1238 _PATH_HOST_ED25519_KEY_FILE, "", NULL);
1116 sensitive_data.keys[3] = key_load_private_cert(KEY_RSA, 1239 sensitive_data.keys[3] = key_load_private_cert(KEY_RSA,
1117 _PATH_HOST_RSA_KEY_FILE, "", NULL); 1240 _PATH_HOST_RSA_KEY_FILE, "", NULL);
1118 sensitive_data.keys[4] = key_load_private_cert(KEY_ED25519, 1241 sensitive_data.keys[4] = key_load_private_cert(KEY_DSA,
1119 _PATH_HOST_ED25519_KEY_FILE, "", NULL); 1242 _PATH_HOST_DSA_KEY_FILE, "", NULL);
1120 sensitive_data.keys[5] = key_load_private_type(KEY_DSA,
1121 _PATH_HOST_DSA_KEY_FILE, "", NULL, NULL);
1122#ifdef OPENSSL_HAS_ECC 1243#ifdef OPENSSL_HAS_ECC
1123 sensitive_data.keys[6] = key_load_private_type(KEY_ECDSA, 1244 sensitive_data.keys[5] = key_load_private_type(KEY_ECDSA,
1124 _PATH_HOST_ECDSA_KEY_FILE, "", NULL, NULL); 1245 _PATH_HOST_ECDSA_KEY_FILE, "", NULL, NULL);
1125#endif 1246#endif
1247 sensitive_data.keys[6] = key_load_private_type(KEY_ED25519,
1248 _PATH_HOST_ED25519_KEY_FILE, "", NULL, NULL);
1126 sensitive_data.keys[7] = key_load_private_type(KEY_RSA, 1249 sensitive_data.keys[7] = key_load_private_type(KEY_RSA,
1127 _PATH_HOST_RSA_KEY_FILE, "", NULL, NULL); 1250 _PATH_HOST_RSA_KEY_FILE, "", NULL, NULL);
1128 sensitive_data.keys[8] = key_load_private_type(KEY_ED25519, 1251 sensitive_data.keys[8] = key_load_private_type(KEY_DSA,
1129 _PATH_HOST_ED25519_KEY_FILE, "", NULL, NULL); 1252 _PATH_HOST_DSA_KEY_FILE, "", NULL, NULL);
1130 PRIV_END; 1253 PRIV_END;
1131 1254
1132 if (options.hostbased_authentication == 1 && 1255 if (options.hostbased_authentication == 1 &&
@@ -1135,26 +1258,26 @@ main(int ac, char **av)
1135 sensitive_data.keys[6] == NULL && 1258 sensitive_data.keys[6] == NULL &&
1136 sensitive_data.keys[7] == NULL && 1259 sensitive_data.keys[7] == NULL &&
1137 sensitive_data.keys[8] == NULL) { 1260 sensitive_data.keys[8] == NULL) {
1138 sensitive_data.keys[1] = key_load_cert(
1139 _PATH_HOST_DSA_KEY_FILE);
1140#ifdef OPENSSL_HAS_ECC 1261#ifdef OPENSSL_HAS_ECC
1141 sensitive_data.keys[2] = key_load_cert( 1262 sensitive_data.keys[1] = key_load_cert(
1142 _PATH_HOST_ECDSA_KEY_FILE); 1263 _PATH_HOST_ECDSA_KEY_FILE);
1143#endif 1264#endif
1265 sensitive_data.keys[2] = key_load_cert(
1266 _PATH_HOST_ED25519_KEY_FILE);
1144 sensitive_data.keys[3] = key_load_cert( 1267 sensitive_data.keys[3] = key_load_cert(
1145 _PATH_HOST_RSA_KEY_FILE); 1268 _PATH_HOST_RSA_KEY_FILE);
1146 sensitive_data.keys[4] = key_load_cert( 1269 sensitive_data.keys[4] = key_load_cert(
1147 _PATH_HOST_ED25519_KEY_FILE); 1270 _PATH_HOST_DSA_KEY_FILE);
1148 sensitive_data.keys[5] = key_load_public(
1149 _PATH_HOST_DSA_KEY_FILE, NULL);
1150#ifdef OPENSSL_HAS_ECC 1271#ifdef OPENSSL_HAS_ECC
1151 sensitive_data.keys[6] = key_load_public( 1272 sensitive_data.keys[5] = key_load_public(
1152 _PATH_HOST_ECDSA_KEY_FILE, NULL); 1273 _PATH_HOST_ECDSA_KEY_FILE, NULL);
1153#endif 1274#endif
1275 sensitive_data.keys[6] = key_load_public(
1276 _PATH_HOST_ED25519_KEY_FILE, NULL);
1154 sensitive_data.keys[7] = key_load_public( 1277 sensitive_data.keys[7] = key_load_public(
1155 _PATH_HOST_RSA_KEY_FILE, NULL); 1278 _PATH_HOST_RSA_KEY_FILE, NULL);
1156 sensitive_data.keys[8] = key_load_public( 1279 sensitive_data.keys[8] = key_load_public(
1157 _PATH_HOST_ED25519_KEY_FILE, NULL); 1280 _PATH_HOST_DSA_KEY_FILE, NULL);
1158 sensitive_data.external_keysign = 1; 1281 sensitive_data.external_keysign = 1;
1159 } 1282 }
1160 } 1283 }
@@ -1460,10 +1583,16 @@ ssh_init_forwarding(void)
1460static void 1583static void
1461check_agent_present(void) 1584check_agent_present(void)
1462{ 1585{
1586 int r;
1587
1463 if (options.forward_agent) { 1588 if (options.forward_agent) {
1464 /* Clear agent forwarding if we don't have an agent. */ 1589 /* Clear agent forwarding if we don't have an agent. */
1465 if (!ssh_agent_present()) 1590 if ((r = ssh_get_authentication_socket(NULL)) != 0) {
1466 options.forward_agent = 0; 1591 options.forward_agent = 0;
1592 if (r != SSH_ERR_AGENT_NOT_PRESENT)
1593 debug("ssh_get_authentication_socket: %s",
1594 ssh_err(r));
1595 }
1467 } 1596 }
1468} 1597}
1469 1598
diff --git a/ssh_api.c b/ssh_api.c
new file mode 100644
index 000000000..6c712584f
--- /dev/null
+++ b/ssh_api.c
@@ -0,0 +1,537 @@
1/* $OpenBSD: ssh_api.c,v 1.4 2015/02/16 22:13:32 djm Exp $ */
2/*
3 * Copyright (c) 2012 Markus Friedl. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include "includes.h"
19
20#include "ssh1.h" /* For SSH_MSG_NONE */
21#include "ssh_api.h"
22#include "compat.h"
23#include "log.h"
24#include "authfile.h"
25#include "sshkey.h"
26#include "misc.h"
27#include "ssh1.h"
28#include "ssh2.h"
29#include "version.h"
30#include "myproposal.h"
31#include "ssherr.h"
32#include "sshbuf.h"
33
34#include <string.h>
35
36int _ssh_exchange_banner(struct ssh *);
37int _ssh_send_banner(struct ssh *, char **);
38int _ssh_read_banner(struct ssh *, char **);
39int _ssh_order_hostkeyalgs(struct ssh *);
40int _ssh_verify_host_key(struct sshkey *, struct ssh *);
41struct sshkey *_ssh_host_public_key(int, int, struct ssh *);
42struct sshkey *_ssh_host_private_key(int, int, struct ssh *);
43int _ssh_host_key_sign(struct sshkey *, struct sshkey *, u_char **,
44 size_t *, const u_char *, size_t, u_int);
45
46/*
47 * stubs for the server side implementation of kex.
48 * disable privsep so our stubs will never be called.
49 */
50int use_privsep = 0;
51int mm_sshkey_sign(struct sshkey *, u_char **, u_int *,
52 u_char *, u_int, u_int);
53DH *mm_choose_dh(int, int, int);
54
55/* Define these two variables here so that they are part of the library */
56u_char *session_id2 = NULL;
57u_int session_id2_len = 0;
58
59int
60mm_sshkey_sign(struct sshkey *key, u_char **sigp, u_int *lenp,
61 u_char *data, u_int datalen, u_int compat)
62{
63 return (-1);
64}
65
66DH *
67mm_choose_dh(int min, int nbits, int max)
68{
69 return (NULL);
70}
71
72/* API */
73
74int
75ssh_init(struct ssh **sshp, int is_server, struct kex_params *kex_params)
76{
77 char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT };
78 struct ssh *ssh;
79 char **proposal;
80 static int called;
81 int r;
82
83 if (!called) {
84#ifdef WITH_OPENSSL
85 OpenSSL_add_all_algorithms();
86#endif /* WITH_OPENSSL */
87 called = 1;
88 }
89
90 if ((ssh = ssh_packet_set_connection(NULL, -1, -1)) == NULL)
91 return SSH_ERR_ALLOC_FAIL;
92 if (is_server)
93 ssh_packet_set_server(ssh);
94
95 /* Initialize key exchange */
96 proposal = kex_params ? kex_params->proposal : myproposal;
97 if ((r = kex_new(ssh, proposal, &ssh->kex)) != 0) {
98 ssh_free(ssh);
99 return r;
100 }
101 ssh->kex->server = is_server;
102 if (is_server) {
103#ifdef WITH_OPENSSL
104 ssh->kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
105 ssh->kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
106 ssh->kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
107 ssh->kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
108# ifdef OPENSSL_HAS_ECC
109 ssh->kex->kex[KEX_ECDH_SHA2] = kexecdh_server;
110# endif
111#endif /* WITH_OPENSSL */
112 ssh->kex->kex[KEX_C25519_SHA256] = kexc25519_server;
113 ssh->kex->load_host_public_key=&_ssh_host_public_key;
114 ssh->kex->load_host_private_key=&_ssh_host_private_key;
115 ssh->kex->sign=&_ssh_host_key_sign;
116 } else {
117#ifdef WITH_OPENSSL
118 ssh->kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client;
119 ssh->kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client;
120 ssh->kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;
121 ssh->kex->kex[KEX_DH_GEX_SHA256] = kexgex_client;
122# ifdef OPENSSL_HAS_ECC
123 ssh->kex->kex[KEX_ECDH_SHA2] = kexecdh_client;
124# endif
125#endif /* WITH_OPENSSL */
126 ssh->kex->kex[KEX_C25519_SHA256] = kexc25519_client;
127 ssh->kex->verify_host_key =&_ssh_verify_host_key;
128 }
129 *sshp = ssh;
130 return 0;
131}
132
133void
134ssh_free(struct ssh *ssh)
135{
136 struct key_entry *k;
137
138 ssh_packet_close(ssh);
139 /*
140 * we've only created the public keys variants in case we
141 * are a acting as a server.
142 */
143 while ((k = TAILQ_FIRST(&ssh->public_keys)) != NULL) {
144 TAILQ_REMOVE(&ssh->public_keys, k, next);
145 if (ssh->kex && ssh->kex->server)
146 sshkey_free(k->key);
147 free(k);
148 }
149 while ((k = TAILQ_FIRST(&ssh->private_keys)) != NULL) {
150 TAILQ_REMOVE(&ssh->private_keys, k, next);
151 free(k);
152 }
153 if (ssh->kex)
154 kex_free(ssh->kex);
155 free(ssh);
156}
157
158void
159ssh_set_app_data(struct ssh *ssh, void *app_data)
160{
161 ssh->app_data = app_data;
162}
163
164void *
165ssh_get_app_data(struct ssh *ssh)
166{
167 return ssh->app_data;
168}
169
170/* Returns < 0 on error, 0 otherwise */
171int
172ssh_add_hostkey(struct ssh *ssh, struct sshkey *key)
173{
174 struct sshkey *pubkey = NULL;
175 struct key_entry *k = NULL, *k_prv = NULL;
176 int r;
177
178 if (ssh->kex->server) {
179 if ((r = sshkey_from_private(key, &pubkey)) != 0)
180 return r;
181 if ((k = malloc(sizeof(*k))) == NULL ||
182 (k_prv = malloc(sizeof(*k_prv))) == NULL) {
183 free(k);
184 sshkey_free(pubkey);
185 return SSH_ERR_ALLOC_FAIL;
186 }
187 k_prv->key = key;
188 TAILQ_INSERT_TAIL(&ssh->private_keys, k_prv, next);
189
190 /* add the public key, too */
191 k->key = pubkey;
192 TAILQ_INSERT_TAIL(&ssh->public_keys, k, next);
193 r = 0;
194 } else {
195 if ((k = malloc(sizeof(*k))) == NULL)
196 return SSH_ERR_ALLOC_FAIL;
197 k->key = key;
198 TAILQ_INSERT_TAIL(&ssh->public_keys, k, next);
199 r = 0;
200 }
201
202 return r;
203}
204
205int
206ssh_set_verify_host_key_callback(struct ssh *ssh,
207 int (*cb)(struct sshkey *, struct ssh *))
208{
209 if (cb == NULL || ssh->kex == NULL)
210 return SSH_ERR_INVALID_ARGUMENT;
211
212 ssh->kex->verify_host_key = cb;
213
214 return 0;
215}
216
217int
218ssh_input_append(struct ssh *ssh, const u_char *data, size_t len)
219{
220 return sshbuf_put(ssh_packet_get_input(ssh), data, len);
221}
222
223int
224ssh_packet_next(struct ssh *ssh, u_char *typep)
225{
226 int r;
227 u_int32_t seqnr;
228 u_char type;
229
230 /*
231 * Try to read a packet. Return SSH_MSG_NONE if no packet or not
232 * enough data.
233 */
234 *typep = SSH_MSG_NONE;
235 if (ssh->kex->client_version_string == NULL ||
236 ssh->kex->server_version_string == NULL)
237 return _ssh_exchange_banner(ssh);
238 /*
239 * If we enough data and a dispatch function then
240 * call the function and get the next packet.
241 * Otherwise return the packet type to the caller so it
242 * can decide how to go on.
243 *
244 * We will only call the dispatch function for:
245 * 20-29 Algorithm negotiation
246 * 30-49 Key exchange method specific (numbers can be reused for
247 * different authentication methods)
248 */
249 for (;;) {
250 if ((r = ssh_packet_read_poll2(ssh, &type, &seqnr)) != 0)
251 return r;
252 if (type > 0 && type < DISPATCH_MAX &&
253 type >= SSH2_MSG_KEXINIT && type <= SSH2_MSG_TRANSPORT_MAX &&
254 ssh->dispatch[type] != NULL) {
255 if ((r = (*ssh->dispatch[type])(type, seqnr, ssh)) != 0)
256 return r;
257 } else {
258 *typep = type;
259 return 0;
260 }
261 }
262}
263
264const u_char *
265ssh_packet_payload(struct ssh *ssh, size_t *lenp)
266{
267 return sshpkt_ptr(ssh, lenp);
268}
269
270int
271ssh_packet_put(struct ssh *ssh, int type, const u_char *data, size_t len)
272{
273 int r;
274
275 if ((r = sshpkt_start(ssh, type)) != 0 ||
276 (r = sshpkt_put(ssh, data, len)) != 0 ||
277 (r = sshpkt_send(ssh)) != 0)
278 return r;
279 return 0;
280}
281
282const u_char *
283ssh_output_ptr(struct ssh *ssh, size_t *len)
284{
285 struct sshbuf *output = ssh_packet_get_output(ssh);
286
287 *len = sshbuf_len(output);
288 return sshbuf_ptr(output);
289}
290
291int
292ssh_output_consume(struct ssh *ssh, size_t len)
293{
294 return sshbuf_consume(ssh_packet_get_output(ssh), len);
295}
296
297int
298ssh_output_space(struct ssh *ssh, size_t len)
299{
300 return (0 == sshbuf_check_reserve(ssh_packet_get_output(ssh), len));
301}
302
303int
304ssh_input_space(struct ssh *ssh, size_t len)
305{
306 return (0 == sshbuf_check_reserve(ssh_packet_get_input(ssh), len));
307}
308
309/* Read other side's version identification. */
310int
311_ssh_read_banner(struct ssh *ssh, char **bannerp)
312{
313 struct sshbuf *input;
314 const char *s;
315 char buf[256], remote_version[256]; /* must be same size! */
316 const char *mismatch = "Protocol mismatch.\r\n";
317 int r, remote_major, remote_minor;
318 size_t i, n, j, len;
319
320 *bannerp = NULL;
321 input = ssh_packet_get_input(ssh);
322 len = sshbuf_len(input);
323 s = (const char *)sshbuf_ptr(input);
324 for (j = n = 0;;) {
325 for (i = 0; i < sizeof(buf) - 1; i++) {
326 if (j >= len)
327 return (0);
328 buf[i] = s[j++];
329 if (buf[i] == '\r') {
330 buf[i] = '\n';
331 buf[i + 1] = 0;
332 continue; /**XXX wait for \n */
333 }
334 if (buf[i] == '\n') {
335 buf[i + 1] = 0;
336 break;
337 }
338 }
339 buf[sizeof(buf) - 1] = 0;
340 if (strncmp(buf, "SSH-", 4) == 0)
341 break;
342 debug("ssh_exchange_identification: %s", buf);
343 if (ssh->kex->server || ++n > 65536) {
344 if ((r = sshbuf_put(ssh_packet_get_output(ssh),
345 mismatch, strlen(mismatch))) != 0)
346 return r;
347 return SSH_ERR_NO_PROTOCOL_VERSION;
348 }
349 }
350 if ((r = sshbuf_consume(input, j)) != 0)
351 return r;
352
353 /*
354 * Check that the versions match. In future this might accept
355 * several versions and set appropriate flags to handle them.
356 */
357 if (sscanf(buf, "SSH-%d.%d-%[^\n]\n",
358 &remote_major, &remote_minor, remote_version) != 3)
359 return SSH_ERR_INVALID_FORMAT;
360 debug("Remote protocol version %d.%d, remote software version %.100s",
361 remote_major, remote_minor, remote_version);
362
363 ssh->compat = compat_datafellows(remote_version);
364 if (remote_major == 1 && remote_minor == 99) {
365 remote_major = 2;
366 remote_minor = 0;
367 }
368 if (remote_major != 2)
369 return SSH_ERR_PROTOCOL_MISMATCH;
370 enable_compat20();
371 chop(buf);
372 debug("Remote version string %.100s", buf);
373 if ((*bannerp = strdup(buf)) == NULL)
374 return SSH_ERR_ALLOC_FAIL;
375 return 0;
376}
377
378/* Send our own protocol version identification. */
379int
380_ssh_send_banner(struct ssh *ssh, char **bannerp)
381{
382 char buf[256];
383 int r;
384
385 snprintf(buf, sizeof buf, "SSH-2.0-%.100s\r\n", SSH_VERSION);
386 if ((r = sshbuf_put(ssh_packet_get_output(ssh), buf, strlen(buf))) != 0)
387 return r;
388 chop(buf);
389 debug("Local version string %.100s", buf);
390 if ((*bannerp = strdup(buf)) == NULL)
391 return SSH_ERR_ALLOC_FAIL;
392 return 0;
393}
394
395int
396_ssh_exchange_banner(struct ssh *ssh)
397{
398 struct kex *kex = ssh->kex;
399 int r;
400
401 /*
402 * if _ssh_read_banner() cannot parse a full version string
403 * it will return NULL and we end up calling it again.
404 */
405
406 r = 0;
407 if (kex->server) {
408 if (kex->server_version_string == NULL)
409 r = _ssh_send_banner(ssh, &kex->server_version_string);
410 if (r == 0 &&
411 kex->server_version_string != NULL &&
412 kex->client_version_string == NULL)
413 r = _ssh_read_banner(ssh, &kex->client_version_string);
414 } else {
415 if (kex->server_version_string == NULL)
416 r = _ssh_read_banner(ssh, &kex->server_version_string);
417 if (r == 0 &&
418 kex->server_version_string != NULL &&
419 kex->client_version_string == NULL)
420 r = _ssh_send_banner(ssh, &kex->client_version_string);
421 }
422 if (r != 0)
423 return r;
424 /* start initial kex as soon as we have exchanged the banners */
425 if (kex->server_version_string != NULL &&
426 kex->client_version_string != NULL) {
427 if ((r = _ssh_order_hostkeyalgs(ssh)) != 0 ||
428 (r = kex_send_kexinit(ssh)) != 0)
429 return r;
430 }
431 return 0;
432}
433
434struct sshkey *
435_ssh_host_public_key(int type, int nid, struct ssh *ssh)
436{
437 struct key_entry *k;
438
439 debug3("%s: need %d", __func__, type);
440 TAILQ_FOREACH(k, &ssh->public_keys, next) {
441 debug3("%s: check %s", __func__, sshkey_type(k->key));
442 if (k->key->type == type &&
443 (type != KEY_ECDSA || k->key->ecdsa_nid == nid))
444 return (k->key);
445 }
446 return (NULL);
447}
448
449struct sshkey *
450_ssh_host_private_key(int type, int nid, struct ssh *ssh)
451{
452 struct key_entry *k;
453
454 debug3("%s: need %d", __func__, type);
455 TAILQ_FOREACH(k, &ssh->private_keys, next) {
456 debug3("%s: check %s", __func__, sshkey_type(k->key));
457 if (k->key->type == type &&
458 (type != KEY_ECDSA || k->key->ecdsa_nid == nid))
459 return (k->key);
460 }
461 return (NULL);
462}
463
464int
465_ssh_verify_host_key(struct sshkey *hostkey, struct ssh *ssh)
466{
467 struct key_entry *k;
468
469 debug3("%s: need %s", __func__, sshkey_type(hostkey));
470 TAILQ_FOREACH(k, &ssh->public_keys, next) {
471 debug3("%s: check %s", __func__, sshkey_type(k->key));
472 if (sshkey_equal_public(hostkey, k->key))
473 return (0); /* ok */
474 }
475 return (-1); /* failed */
476}
477
478/* offer hostkey algorithms in kexinit depending on registered keys */
479int
480_ssh_order_hostkeyalgs(struct ssh *ssh)
481{
482 struct key_entry *k;
483 char *orig, *avail, *oavail = NULL, *alg, *replace = NULL;
484 char **proposal;
485 size_t maxlen;
486 int ktype, r;
487
488 /* XXX we de-serialize ssh->kex->my, modify it, and change it */
489 if ((r = kex_buf2prop(ssh->kex->my, NULL, &proposal)) != 0)
490 return r;
491 orig = proposal[PROPOSAL_SERVER_HOST_KEY_ALGS];
492 if ((oavail = avail = strdup(orig)) == NULL) {
493 r = SSH_ERR_ALLOC_FAIL;
494 goto out;
495 }
496 maxlen = strlen(avail) + 1;
497 if ((replace = calloc(1, maxlen)) == NULL) {
498 r = SSH_ERR_ALLOC_FAIL;
499 goto out;
500 }
501 *replace = '\0';
502 while ((alg = strsep(&avail, ",")) && *alg != '\0') {
503 if ((ktype = sshkey_type_from_name(alg)) == KEY_UNSPEC)
504 continue;
505 TAILQ_FOREACH(k, &ssh->public_keys, next) {
506 if (k->key->type == ktype ||
507 (sshkey_is_cert(k->key) && k->key->type ==
508 sshkey_type_plain(ktype))) {
509 if (*replace != '\0')
510 strlcat(replace, ",", maxlen);
511 strlcat(replace, alg, maxlen);
512 break;
513 }
514 }
515 }
516 if (*replace != '\0') {
517 debug2("%s: orig/%d %s", __func__, ssh->kex->server, orig);
518 debug2("%s: replace/%d %s", __func__, ssh->kex->server, replace);
519 free(orig);
520 proposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = replace;
521 replace = NULL; /* owned by proposal */
522 r = kex_prop2buf(ssh->kex->my, proposal);
523 }
524 out:
525 free(oavail);
526 free(replace);
527 kex_prop_free(proposal);
528 return r;
529}
530
531int
532_ssh_host_key_sign(struct sshkey *privkey, struct sshkey *pubkey,
533 u_char **signature, size_t *slen,
534 const u_char *data, size_t dlen, u_int compat)
535{
536 return sshkey_sign(privkey, signature, slen, data, dlen, compat);
537}
diff --git a/ssh_api.h b/ssh_api.h
new file mode 100644
index 000000000..642acd5b2
--- /dev/null
+++ b/ssh_api.h
@@ -0,0 +1,137 @@
1/* $OpenBSD: ssh_api.h,v 1.1 2015/01/19 20:30:23 markus Exp $ */
2/*
3 * Copyright (c) 2012 Markus Friedl. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef API_H
19#define API_H
20
21#include <sys/types.h>
22#include <signal.h>
23
24#include "openbsd-compat/sys-queue.h"
25
26#include "cipher.h"
27#include "sshkey.h"
28#include "kex.h"
29#include "ssh.h"
30#include "ssh2.h"
31#include "packet.h"
32
33struct kex_params {
34 char *proposal[PROPOSAL_MAX];
35};
36
37/* public SSH API functions */
38
39/*
40 * ssh_init() create a ssh connection object with given (optional)
41 * key exchange parameters.
42 */
43int ssh_init(struct ssh **, int is_server, struct kex_params *kex_params);
44
45/*
46 * release ssh connection state.
47 */
48void ssh_free(struct ssh *);
49
50/*
51 * attach application specific data to the connection state
52 */
53void ssh_set_app_data(struct ssh *, void *);
54void *ssh_get_app_data(struct ssh *);
55
56/*
57 * ssh_add_hostkey() registers a private/public hostkey for an ssh
58 * connection.
59 * ssh_add_hostkey() needs to be called before a key exchange is
60 * initiated with ssh_packet_next().
61 * private hostkeys are required if we need to act as a server.
62 * public hostkeys are used to verify the servers hostkey.
63 */
64int ssh_add_hostkey(struct ssh *ssh, struct sshkey *key);
65
66/*
67 * ssh_set_verify_host_key_callback() registers a callback function
68 * which should be called instead of the default verification. The
69 * function given must return 0 if the hostkey is ok, -1 if the
70 * verification has failed.
71 */
72int ssh_set_verify_host_key_callback(struct ssh *ssh,
73 int (*cb)(struct sshkey *, struct ssh *));
74
75/*
76 * ssh_packet_next() advances to the next input packet and returns
77 * the packet type in typep.
78 * ssh_packet_next() works by processing an input byte-stream,
79 * decrypting the received data and hiding the key-exchange from
80 * the caller.
81 * ssh_packet_next() sets typep if there is no new packet available.
82 * in this case the caller must fill the input byte-stream by passing
83 * the data received over network to ssh_input_append().
84 * additinally, the caller needs to send the resulting output
85 * byte-stream back over the network. otherwise the key exchange
86 * would not proceed. the output byte-stream is accessed through
87 * ssh_output_ptr().
88 */
89int ssh_packet_next(struct ssh *ssh, u_char *typep);
90
91/*
92 * ssh_packet_payload() returns a pointer to the raw payload data of
93 * the current input packet and the length of this payload.
94 * the payload is accessible until ssh_packet_next() is called again.
95 */
96const u_char *ssh_packet_payload(struct ssh *ssh, size_t *lenp);
97
98/*
99 * ssh_packet_put() creates an encrypted packet with the given type
100 * and payload.
101 * the encrypted packet is appended to the output byte-stream.
102 */
103int ssh_packet_put(struct ssh *ssh, int type, const u_char *data,
104 size_t len);
105
106/*
107 * ssh_input_space() checks if 'len' bytes can be appended to the
108 * input byte-stream.
109 */
110int ssh_input_space(struct ssh *ssh, size_t len);
111
112/*
113 * ssh_input_append() appends data to the input byte-stream.
114 */
115int ssh_input_append(struct ssh *ssh, const u_char *data, size_t len);
116
117/*
118 * ssh_output_space() checks if 'len' bytes can be appended to the
119 * output byte-stream. XXX
120 */
121int ssh_output_space(struct ssh *ssh, size_t len);
122
123/*
124 * ssh_output_ptr() retrieves both a pointer and the length of the
125 * current output byte-stream. the bytes need to be sent over the
126 * network. the number of bytes that have been successfully sent can
127 * be removed from the output byte-stream with ssh_output_consume().
128 */
129const u_char *ssh_output_ptr(struct ssh *ssh, size_t *len);
130
131/*
132 * ssh_output_consume() removes the given number of bytes from
133 * the output byte-stream.
134 */
135int ssh_output_consume(struct ssh *ssh, size_t len);
136
137#endif
diff --git a/ssh_config.0 b/ssh_config.0
index c40ce5f08..3bdd75237 100644
--- a/ssh_config.0
+++ b/ssh_config.0
@@ -1,7 +1,7 @@
1SSH_CONFIG(5) File Formats Manual SSH_CONFIG(5) 1SSH_CONFIG(5) File Formats Manual SSH_CONFIG(5)
2 2
3NAME 3NAME
4 ssh_config - OpenSSH SSH client configuration files 4 ssh_config M-bM-^@M-^S OpenSSH SSH client configuration files
5 5
6SYNOPSIS 6SYNOPSIS
7 ~/.ssh/config 7 ~/.ssh/config
@@ -16,10 +16,11 @@ DESCRIPTION
16 3. system-wide configuration file (/etc/ssh/ssh_config) 16 3. system-wide configuration file (/etc/ssh/ssh_config)
17 17
18 For each parameter, the first obtained value will be used. The 18 For each parameter, the first obtained value will be used. The
19 configuration files contain sections separated by ``Host'' 19 configuration files contain sections separated by M-bM-^@M-^\HostM-bM-^@M-^] specifications,
20 specifications, and that section is only applied for hosts that match one 20 and that section is only applied for hosts that match one of the patterns
21 of the patterns given in the specification. The matched host name is the 21 given in the specification. The matched host name is usually the one
22 one given on the command line. 22 given on the command line (see the CanonicalizeHostname option for
23 exceptions.)
23 24
24 Since the first obtained value for each parameter is used, more host- 25 Since the first obtained value for each parameter is used, more host-
25 specific declarations should be given near the beginning of the file, and 26 specific declarations should be given near the beginning of the file, and
@@ -27,9 +28,9 @@ DESCRIPTION
27 28
28 The configuration file has the following format: 29 The configuration file has the following format:
29 30
30 Empty lines and lines starting with `#' are comments. Otherwise a line 31 Empty lines and lines starting with M-bM-^@M-^X#M-bM-^@M-^Y are comments. Otherwise a line
31 is of the format ``keyword arguments''. Configuration options may be 32 is of the format M-bM-^@M-^\keyword argumentsM-bM-^@M-^]. Configuration options may be
32 separated by whitespace or optional whitespace and exactly one `='; the 33 separated by whitespace or optional whitespace and exactly one M-bM-^@M-^X=M-bM-^@M-^Y; the
33 latter format is useful to avoid the need to quote whitespace when 34 latter format is useful to avoid the need to quote whitespace when
34 specifying configuration options using the ssh, scp, and sftp -o option. 35 specifying configuration options using the ssh, scp, and sftp -o option.
35 Arguments may optionally be enclosed in double quotes (") in order to 36 Arguments may optionally be enclosed in double quotes (") in order to
@@ -41,14 +42,14 @@ DESCRIPTION
41 Host Restricts the following declarations (up to the next Host or 42 Host Restricts the following declarations (up to the next Host or
42 Match keyword) to be only for those hosts that match one of the 43 Match keyword) to be only for those hosts that match one of the
43 patterns given after the keyword. If more than one pattern is 44 patterns given after the keyword. If more than one pattern is
44 provided, they should be separated by whitespace. A single `*' 45 provided, they should be separated by whitespace. A single M-bM-^@M-^X*M-bM-^@M-^Y
45 as a pattern can be used to provide global defaults for all 46 as a pattern can be used to provide global defaults for all
46 hosts. The host is the hostname argument given on the command 47 hosts. The host is usually the hostname argument given on the
47 line (i.e. the name is not converted to a canonicalized host name 48 command line (see the CanonicalizeHostname option for
48 before matching). 49 exceptions.)
49 50
50 A pattern entry may be negated by prefixing it with an 51 A pattern entry may be negated by prefixing it with an
51 exclamation mark (`!'). If a negated entry is matched, then the 52 exclamation mark (M-bM-^@M-^X!M-bM-^@M-^Y). If a negated entry is matched, then the
52 Host entry is ignored, regardless of whether any other patterns 53 Host entry is ignored, regardless of whether any other patterns
53 on the line match. Negated matches are therefore useful to 54 on the line match. Negated matches are therefore useful to
54 provide exceptions for wildcard matches. 55 provide exceptions for wildcard matches.
@@ -58,50 +59,57 @@ DESCRIPTION
58 Match Restricts the following declarations (up to the next Host or 59 Match Restricts the following declarations (up to the next Host or
59 Match keyword) to be used only when the conditions following the 60 Match keyword) to be used only when the conditions following the
60 Match keyword are satisfied. Match conditions are specified 61 Match keyword are satisfied. Match conditions are specified
61 using one or more keyword/criteria pairs or the single token all 62 using one or more critera or the single token all which always
62 which matches all criteria. The available keywords are: exec, 63 matches. The available criteria keywords are: canonical, exec,
63 host, originalhost, user, and localuser. 64 host, originalhost, user, and localuser. The all criteria must
64 65 appear alone or immediately after canonical. Other criteria may
65 The exec keyword executes the specified command under the user's 66 be combined arbitrarily. All criteria but all and canonical
66 shell. If the command returns a zero exit status then the 67 require an argument. Criteria may be negated by prepending an
67 condition is considered true. Commands containing whitespace 68 exclamation mark (M-bM-^@M-^X!M-bM-^@M-^Y).
68 characters must be quoted. The following character sequences in 69
69 the command will be expanded prior to execution: `%L' will be 70 The canonical keywork matches only when the configuration file is
70 substituted by the first component of the local host name, `%l' 71 being re-parsed after hostname canonicalization (see the
71 will be substituted by the local host name (including any domain 72 CanonicalizeHostname option.) This may be useful to specify
72 name), `%h' will be substituted by the target host name, `%n' 73 conditions that work with canonical host names only. The exec
73 will be substituted by the original target host name specified on 74 keyword executes the specified command under the user's shell.
74 the command-line, `%p' the destination port, `%r' by the remote 75 If the command returns a zero exit status then the condition is
75 login username, and `%u' by the username of the user running 76 considered true. Commands containing whitespace characters must
76 ssh(1). 77 be quoted. The following character sequences in the command will
78 be expanded prior to execution: M-bM-^@M-^X%LM-bM-^@M-^Y will be substituted by the
79 first component of the local host name, M-bM-^@M-^X%lM-bM-^@M-^Y will be substituted
80 by the local host name (including any domain name), M-bM-^@M-^X%hM-bM-^@M-^Y will be
81 substituted by the target host name, M-bM-^@M-^X%nM-bM-^@M-^Y will be substituted by
82 the original target host name specified on the command-line, M-bM-^@M-^X%pM-bM-^@M-^Y
83 the destination port, M-bM-^@M-^X%rM-bM-^@M-^Y by the remote login username, and M-bM-^@M-^X%uM-bM-^@M-^Y
84 by the username of the user running ssh(1).
77 85
78 The other keywords' criteria must be single entries or comma- 86 The other keywords' criteria must be single entries or comma-
79 separated lists and may use the wildcard and negation operators 87 separated lists and may use the wildcard and negation operators
80 described in the PATTERNS section. The criteria for the host 88 described in the PATTERNS section. The criteria for the host
81 keyword are matched against the target hostname, after any 89 keyword are matched against the target hostname, after any
82 substitution by the Hostname option. The originalhost keyword 90 substitution by the Hostname or CanonicalizeHostname options.
83 matches against the hostname as it was specified on the command- 91 The originalhost keyword matches against the hostname as it was
84 line. The user keyword matches against the target username on 92 specified on the command-line. The user keyword matches against
85 the remote host. The localuser keyword matches against the name 93 the target username on the remote host. The localuser keyword
86 of the local user running ssh(1) (this keyword may be useful in 94 matches against the name of the local user running ssh(1) (this
87 system-wide ssh_config files). 95 keyword may be useful in system-wide ssh_config files).
88 96
89 AddressFamily 97 AddressFamily
90 Specifies which address family to use when connecting. Valid 98 Specifies which address family to use when connecting. Valid
91 arguments are ``any'', ``inet'' (use IPv4 only), or ``inet6'' 99 arguments are M-bM-^@M-^\anyM-bM-^@M-^], M-bM-^@M-^\inetM-bM-^@M-^] (use IPv4 only), or M-bM-^@M-^\inet6M-bM-^@M-^] (use IPv6
92 (use IPv6 only). 100 only).
93 101
94 BatchMode 102 BatchMode
95 If set to ``yes'', passphrase/password querying will be disabled. 103 If set to M-bM-^@M-^\yesM-bM-^@M-^], passphrase/password querying will be disabled.
96 This option is useful in scripts and other batch jobs where no 104 This option is useful in scripts and other batch jobs where no
97 user is present to supply the password. The argument must be 105 user is present to supply the password. The argument must be
98 ``yes'' or ``no''. The default is ``no''. 106 M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\noM-bM-^@M-^].
99 107
100 BindAddress 108 BindAddress
101 Use the specified address on the local machine as the source 109 Use the specified address on the local machine as the source
102 address of the connection. Only useful on systems with more than 110 address of the connection. Only useful on systems with more than
103 one address. Note that this option does not work if 111 one address. Note that this option does not work if
104 UsePrivilegedPort is set to ``yes''. 112 UsePrivilegedPort is set to M-bM-^@M-^\yesM-bM-^@M-^].
105 113
106 CanonicalDomains 114 CanonicalDomains
107 When CanonicalizeHostname is enabled, this option specifies the 115 When CanonicalizeHostname is enabled, this option specifies the
@@ -110,33 +118,31 @@ DESCRIPTION
110 118
111 CanonicalizeFallbackLocal 119 CanonicalizeFallbackLocal
112 Specifies whether to fail with an error when hostname 120 Specifies whether to fail with an error when hostname
113 canonicalization fails. The default, ``yes'', will attempt to 121 canonicalization fails. The default, M-bM-^@M-^\yesM-bM-^@M-^], will attempt to look
114 look up the unqualified hostname using the system resolver's 122 up the unqualified hostname using the system resolver's search
115 search rules. A value of ``no'' will cause ssh(1) to fail 123 rules. A value of M-bM-^@M-^\noM-bM-^@M-^] will cause ssh(1) to fail instantly if
116 instantly if CanonicalizeHostname is enabled and the target 124 CanonicalizeHostname is enabled and the target hostname cannot be
117 hostname cannot be found in any of the domains specified by 125 found in any of the domains specified by CanonicalDomains.
118 CanonicalDomains.
119 126
120 CanonicalizeHostname 127 CanonicalizeHostname
121 Controls whether explicit hostname canonicalization is performed. 128 Controls whether explicit hostname canonicalization is performed.
122 The default, ``no'', is not to perform any name rewriting and let 129 The default, M-bM-^@M-^\noM-bM-^@M-^], is not to perform any name rewriting and let
123 the system resolver handle all hostname lookups. If set to 130 the system resolver handle all hostname lookups. If set to M-bM-^@M-^\yesM-bM-^@M-^]
124 ``yes'' then, for connections that do not use a ProxyCommand, 131 then, for connections that do not use a ProxyCommand, ssh(1) will
125 ssh(1) will attempt to canonicalize the hostname specified on the 132 attempt to canonicalize the hostname specified on the command
126 command line using the CanonicalDomains suffixes and 133 line using the CanonicalDomains suffixes and
127 CanonicalizePermittedCNAMEs rules. If CanonicalizeHostname is 134 CanonicalizePermittedCNAMEs rules. If CanonicalizeHostname is
128 set to ``always'', then canonicalization is applied to proxied 135 set to M-bM-^@M-^\alwaysM-bM-^@M-^], then canonicalization is applied to proxied
129 connections too. 136 connections too.
130 137
131 If this option is enabled and canonicalisation results in the 138 If this option is enabled, then the configuration files are
132 target hostname changing, then the configuration files are
133 processed again using the new target name to pick up any new 139 processed again using the new target name to pick up any new
134 configuration in matching Host stanzas. 140 configuration in matching Host and Match stanzas.
135 141
136 CanonicalizeMaxDots 142 CanonicalizeMaxDots
137 Specifies the maximum number of dot characters in a hostname 143 Specifies the maximum number of dot characters in a hostname
138 before canonicalization is disabled. The default, ``1'', allows 144 before canonicalization is disabled. The default, M-bM-^@M-^\1M-bM-^@M-^], allows a
139 a single dot (i.e. hostname.subdomain). 145 single dot (i.e. hostname.subdomain).
140 146
141 CanonicalizePermittedCNAMEs 147 CanonicalizePermittedCNAMEs
142 Specifies rules to determine whether CNAMEs should be followed 148 Specifies rules to determine whether CNAMEs should be followed
@@ -146,30 +152,29 @@ DESCRIPTION
146 CNAMEs in canonicalization, and target_domain_list is a pattern- 152 CNAMEs in canonicalization, and target_domain_list is a pattern-
147 list of domains that they may resolve to. 153 list of domains that they may resolve to.
148 154
149 For example, ``*.a.example.com:*.b.example.com,*.c.example.com'' 155 For example, M-bM-^@M-^\*.a.example.com:*.b.example.com,*.c.example.comM-bM-^@M-^]
150 will allow hostnames matching ``*.a.example.com'' to be 156 will allow hostnames matching M-bM-^@M-^\*.a.example.comM-bM-^@M-^] to be
151 canonicalized to names in the ``*.b.example.com'' or 157 canonicalized to names in the M-bM-^@M-^\*.b.example.comM-bM-^@M-^] or
152 ``*.c.example.com'' domains. 158 M-bM-^@M-^\*.c.example.comM-bM-^@M-^] domains.
153 159
154 ChallengeResponseAuthentication 160 ChallengeResponseAuthentication
155 Specifies whether to use challenge-response authentication. The 161 Specifies whether to use challenge-response authentication. The
156 argument to this keyword must be ``yes'' or ``no''. The default 162 argument to this keyword must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is
157 is ``yes''. 163 M-bM-^@M-^\yesM-bM-^@M-^].
158 164
159 CheckHostIP 165 CheckHostIP
160 If this flag is set to ``yes'', ssh(1) will additionally check 166 If this flag is set to M-bM-^@M-^\yesM-bM-^@M-^], ssh(1) will additionally check the
161 the host IP address in the known_hosts file. This allows ssh to 167 host IP address in the known_hosts file. This allows ssh to
162 detect if a host key changed due to DNS spoofing. If the option 168 detect if a host key changed due to DNS spoofing. If the option
163 is set to ``no'', the check will not be executed. The default is 169 is set to M-bM-^@M-^\noM-bM-^@M-^], the check will not be executed. The default is
164 ``yes''. 170 M-bM-^@M-^\yesM-bM-^@M-^].
165 171
166 Cipher Specifies the cipher to use for encrypting the session in 172 Cipher Specifies the cipher to use for encrypting the session in
167 protocol version 1. Currently, ``blowfish'', ``3des'', and 173 protocol version 1. Currently, M-bM-^@M-^\blowfishM-bM-^@M-^], M-bM-^@M-^\3desM-bM-^@M-^], and M-bM-^@M-^\desM-bM-^@M-^] are
168 ``des'' are supported. des is only supported in the ssh(1) 174 supported. des is only supported in the ssh(1) client for
169 client for interoperability with legacy protocol 1 175 interoperability with legacy protocol 1 implementations that do
170 implementations that do not support the 3des cipher. Its use is 176 not support the 3des cipher. Its use is strongly discouraged due
171 strongly discouraged due to cryptographic weaknesses. The 177 to cryptographic weaknesses. The default is M-bM-^@M-^\3desM-bM-^@M-^].
172 default is ``3des''.
173 178
174 Ciphers 179 Ciphers
175 Specifies the ciphers allowed for protocol version 2 in order of 180 Specifies the ciphers allowed for protocol version 2 in order of
@@ -202,7 +207,7 @@ DESCRIPTION
202 aes192-cbc,aes256-cbc,arcfour 207 aes192-cbc,aes256-cbc,arcfour
203 208
204 The list of available ciphers may also be obtained using the -Q 209 The list of available ciphers may also be obtained using the -Q
205 option of ssh(1). 210 option of ssh(1) with an argument of M-bM-^@M-^\cipherM-bM-^@M-^].
206 211
207 ClearAllForwardings 212 ClearAllForwardings
208 Specifies that all local, remote, and dynamic port forwardings 213 Specifies that all local, remote, and dynamic port forwardings
@@ -210,12 +215,12 @@ DESCRIPTION
210 cleared. This option is primarily useful when used from the 215 cleared. This option is primarily useful when used from the
211 ssh(1) command line to clear port forwardings set in 216 ssh(1) command line to clear port forwardings set in
212 configuration files, and is automatically set by scp(1) and 217 configuration files, and is automatically set by scp(1) and
213 sftp(1). The argument must be ``yes'' or ``no''. The default is 218 sftp(1). The argument must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is
214 ``no''. 219 M-bM-^@M-^\noM-bM-^@M-^].
215 220
216 Compression 221 Compression
217 Specifies whether to use compression. The argument must be 222 Specifies whether to use compression. The argument must be M-bM-^@M-^\yesM-bM-^@M-^]
218 ``yes'' or ``no''. The default is ``no''. 223 or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\noM-bM-^@M-^].
219 224
220 CompressionLevel 225 CompressionLevel
221 Specifies the compression level to use if compression is enabled. 226 Specifies the compression level to use if compression is enabled.
@@ -237,16 +242,16 @@ DESCRIPTION
237 242
238 ControlMaster 243 ControlMaster
239 Enables the sharing of multiple sessions over a single network 244 Enables the sharing of multiple sessions over a single network
240 connection. When set to ``yes'', ssh(1) will listen for 245 connection. When set to M-bM-^@M-^\yesM-bM-^@M-^], ssh(1) will listen for
241 connections on a control socket specified using the ControlPath 246 connections on a control socket specified using the ControlPath
242 argument. Additional sessions can connect to this socket using 247 argument. Additional sessions can connect to this socket using
243 the same ControlPath with ControlMaster set to ``no'' (the 248 the same ControlPath with ControlMaster set to M-bM-^@M-^\noM-bM-^@M-^] (the
244 default). These sessions will try to reuse the master instance's 249 default). These sessions will try to reuse the master instance's
245 network connection rather than initiating new ones, but will fall 250 network connection rather than initiating new ones, but will fall
246 back to connecting normally if the control socket does not exist, 251 back to connecting normally if the control socket does not exist,
247 or is not listening. 252 or is not listening.
248 253
249 Setting this to ``ask'' will cause ssh to listen for control 254 Setting this to M-bM-^@M-^\askM-bM-^@M-^] will cause ssh to listen for control
250 connections, but require confirmation using the SSH_ASKPASS 255 connections, but require confirmation using the SSH_ASKPASS
251 program before they are accepted (see ssh-add(1) for details). 256 program before they are accepted (see ssh-add(1) for details).
252 If the ControlPath cannot be opened, ssh will continue without 257 If the ControlPath cannot be opened, ssh will continue without
@@ -259,40 +264,41 @@ DESCRIPTION
259 264
260 Two additional options allow for opportunistic multiplexing: try 265 Two additional options allow for opportunistic multiplexing: try
261 to use a master connection but fall back to creating a new one if 266 to use a master connection but fall back to creating a new one if
262 one does not already exist. These options are: ``auto'' and 267 one does not already exist. These options are: M-bM-^@M-^\autoM-bM-^@M-^] and
263 ``autoask''. The latter requires confirmation like the ``ask'' 268 M-bM-^@M-^\autoaskM-bM-^@M-^]. The latter requires confirmation like the M-bM-^@M-^\askM-bM-^@M-^]
264 option. 269 option.
265 270
266 ControlPath 271 ControlPath
267 Specify the path to the control socket used for connection 272 Specify the path to the control socket used for connection
268 sharing as described in the ControlMaster section above or the 273 sharing as described in the ControlMaster section above or the
269 string ``none'' to disable connection sharing. In the path, `%L' 274 string M-bM-^@M-^\noneM-bM-^@M-^] to disable connection sharing. In the path, M-bM-^@M-^X%LM-bM-^@M-^Y
270 will be substituted by the first component of the local host 275 will be substituted by the first component of the local host
271 name, `%l' will be substituted by the local host name (including 276 name, M-bM-^@M-^X%lM-bM-^@M-^Y will be substituted by the local host name (including
272 any domain name), `%h' will be substituted by the target host 277 any domain name), M-bM-^@M-^X%hM-bM-^@M-^Y will be substituted by the target host
273 name, `%n' will be substituted by the original target host name 278 name, M-bM-^@M-^X%nM-bM-^@M-^Y will be substituted by the original target host name
274 specified on the command line, `%p' the destination port, `%r' by 279 specified on the command line, M-bM-^@M-^X%pM-bM-^@M-^Y the destination port, M-bM-^@M-^X%rM-bM-^@M-^Y by
275 the remote login username, `%u' by the username of the user 280 the remote login username, M-bM-^@M-^X%uM-bM-^@M-^Y by the username of the user
276 running ssh(1), and `%C' by a hash of the concatenation: 281 running ssh(1), and M-bM-^@M-^X%CM-bM-^@M-^Y by a hash of the concatenation:
277 %l%h%p%r. It is recommended that any ControlPath used for 282 %l%h%p%r. It is recommended that any ControlPath used for
278 opportunistic connection sharing include at least %h, %p, and %r 283 opportunistic connection sharing include at least %h, %p, and %r
279 (or alternatively %C). This ensures that shared connections are 284 (or alternatively %C) and be placed in a directory that is not
280 uniquely identified. 285 writable by other users. This ensures that shared connections
286 are uniquely identified.
281 287
282 ControlPersist 288 ControlPersist
283 When used in conjunction with ControlMaster, specifies that the 289 When used in conjunction with ControlMaster, specifies that the
284 master connection should remain open in the background (waiting 290 master connection should remain open in the background (waiting
285 for future client connections) after the initial client 291 for future client connections) after the initial client
286 connection has been closed. If set to ``no'', then the master 292 connection has been closed. If set to M-bM-^@M-^\noM-bM-^@M-^], then the master
287 connection will not be placed into the background, and will close 293 connection will not be placed into the background, and will close
288 as soon as the initial client connection is closed. If set to 294 as soon as the initial client connection is closed. If set to
289 ``yes'', then the master connection will remain in the background 295 M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\0M-bM-^@M-^], then the master connection will remain in the
290 indefinitely (until killed or closed via a mechanism such as the 296 background indefinitely (until killed or closed via a mechanism
291 ssh(1) ``-O exit'' option). If set to a time in seconds, or a 297 such as the ssh(1) M-bM-^@M-^\-O exitM-bM-^@M-^] option). If set to a time in
292 time in any of the formats documented in sshd_config(5), then the 298 seconds, or a time in any of the formats documented in
293 backgrounded master connection will automatically terminate after 299 sshd_config(5), then the backgrounded master connection will
294 it has remained idle (with no client connections) for the 300 automatically terminate after it has remained idle (with no
295 specified time. 301 client connections) for the specified time.
296 302
297 DynamicForward 303 DynamicForward
298 Specifies that a TCP port on the local machine be forwarded over 304 Specifies that a TCP port on the local machine be forwarded over
@@ -304,9 +310,9 @@ DESCRIPTION
304 the local port is bound in accordance with the GatewayPorts 310 the local port is bound in accordance with the GatewayPorts
305 setting. However, an explicit bind_address may be used to bind 311 setting. However, an explicit bind_address may be used to bind
306 the connection to a specific address. The bind_address of 312 the connection to a specific address. The bind_address of
307 ``localhost'' indicates that the listening port be bound for 313 M-bM-^@M-^\localhostM-bM-^@M-^] indicates that the listening port be bound for local
308 local use only, while an empty address or `*' indicates that the 314 use only, while an empty address or M-bM-^@M-^X*M-bM-^@M-^Y indicates that the port
309 port should be available from all interfaces. 315 should be available from all interfaces.
310 316
311 Currently the SOCKS4 and SOCKS5 protocols are supported, and 317 Currently the SOCKS4 and SOCKS5 protocols are supported, and
312 ssh(1) will act as a SOCKS server. Multiple forwardings may be 318 ssh(1) will act as a SOCKS server. Multiple forwardings may be
@@ -314,30 +320,35 @@ DESCRIPTION
314 line. Only the superuser can forward privileged ports. 320 line. Only the superuser can forward privileged ports.
315 321
316 EnableSSHKeysign 322 EnableSSHKeysign
317 Setting this option to ``yes'' in the global client configuration 323 Setting this option to M-bM-^@M-^\yesM-bM-^@M-^] in the global client configuration
318 file /etc/ssh/ssh_config enables the use of the helper program 324 file /etc/ssh/ssh_config enables the use of the helper program
319 ssh-keysign(8) during HostbasedAuthentication. The argument must 325 ssh-keysign(8) during HostbasedAuthentication. The argument must
320 be ``yes'' or ``no''. The default is ``no''. This option should 326 be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\noM-bM-^@M-^]. This option should be
321 be placed in the non-hostspecific section. See ssh-keysign(8) 327 placed in the non-hostspecific section. See ssh-keysign(8) for
322 for more information. 328 more information.
323 329
324 EscapeChar 330 EscapeChar
325 Sets the escape character (default: `~'). The escape character 331 Sets the escape character (default: M-bM-^@M-^X~M-bM-^@M-^Y). The escape character
326 can also be set on the command line. The argument should be a 332 can also be set on the command line. The argument should be a
327 single character, `^' followed by a letter, or ``none'' to 333 single character, M-bM-^@M-^X^M-bM-^@M-^Y followed by a letter, or M-bM-^@M-^\noneM-bM-^@M-^] to disable
328 disable the escape character entirely (making the connection 334 the escape character entirely (making the connection transparent
329 transparent for binary data). 335 for binary data).
330 336
331 ExitOnForwardFailure 337 ExitOnForwardFailure
332 Specifies whether ssh(1) should terminate the connection if it 338 Specifies whether ssh(1) should terminate the connection if it
333 cannot set up all requested dynamic, tunnel, local, and remote 339 cannot set up all requested dynamic, tunnel, local, and remote
334 port forwardings. The argument must be ``yes'' or ``no''. The 340 port forwardings. The argument must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The
335 default is ``no''. 341 default is M-bM-^@M-^\noM-bM-^@M-^].
342
343 FingerprintHash
344 Specifies the hash algorithm used when displaying key
345 fingerprints. Valid options are: M-bM-^@M-^\md5M-bM-^@M-^] and M-bM-^@M-^\sha256M-bM-^@M-^]. The
346 default is M-bM-^@M-^\sha256M-bM-^@M-^].
336 347
337 ForwardAgent 348 ForwardAgent
338 Specifies whether the connection to the authentication agent (if 349 Specifies whether the connection to the authentication agent (if
339 any) will be forwarded to the remote machine. The argument must 350 any) will be forwarded to the remote machine. The argument must
340 be ``yes'' or ``no''. The default is ``no''. 351 be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\noM-bM-^@M-^].
341 352
342 Agent forwarding should be enabled with caution. Users with the 353 Agent forwarding should be enabled with caution. Users with the
343 ability to bypass file permissions on the remote host (for the 354 ability to bypass file permissions on the remote host (for the
@@ -350,7 +361,7 @@ DESCRIPTION
350 ForwardX11 361 ForwardX11
351 Specifies whether X11 connections will be automatically 362 Specifies whether X11 connections will be automatically
352 redirected over the secure channel and DISPLAY set. The argument 363 redirected over the secure channel and DISPLAY set. The argument
353 must be ``yes'' or ``no''. The default is ``no''. 364 must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\noM-bM-^@M-^].
354 365
355 X11 forwarding should be enabled with caution. Users with the 366 X11 forwarding should be enabled with caution. Users with the
356 ability to bypass file permissions on the remote host (for the 367 ability to bypass file permissions on the remote host (for the
@@ -367,17 +378,17 @@ DESCRIPTION
367 minutes has elapsed. 378 minutes has elapsed.
368 379
369 ForwardX11Trusted 380 ForwardX11Trusted
370 If this option is set to ``yes'', remote X11 clients will have 381 If this option is set to M-bM-^@M-^\yesM-bM-^@M-^], remote X11 clients will have full
371 full access to the original X11 display. 382 access to the original X11 display.
372 383
373 If this option is set to ``no'', remote X11 clients will be 384 If this option is set to M-bM-^@M-^\noM-bM-^@M-^], remote X11 clients will be
374 considered untrusted and prevented from stealing or tampering 385 considered untrusted and prevented from stealing or tampering
375 with data belonging to trusted X11 clients. Furthermore, the 386 with data belonging to trusted X11 clients. Furthermore, the
376 xauth(1) token used for the session will be set to expire after 387 xauth(1) token used for the session will be set to expire after
377 20 minutes. Remote clients will be refused access after this 388 20 minutes. Remote clients will be refused access after this
378 time. 389 time.
379 390
380 The default is ``no''. 391 The default is M-bM-^@M-^\noM-bM-^@M-^].
381 392
382 See the X11 SECURITY extension specification for full details on 393 See the X11 SECURITY extension specification for full details on
383 the restrictions imposed on untrusted clients. 394 the restrictions imposed on untrusted clients.
@@ -389,8 +400,8 @@ DESCRIPTION
389 connecting to forwarded ports. GatewayPorts can be used to 400 connecting to forwarded ports. GatewayPorts can be used to
390 specify that ssh should bind local port forwardings to the 401 specify that ssh should bind local port forwardings to the
391 wildcard address, thus allowing remote hosts to connect to 402 wildcard address, thus allowing remote hosts to connect to
392 forwarded ports. The argument must be ``yes'' or ``no''. The 403 forwarded ports. The argument must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The
393 default is ``no''. 404 default is M-bM-^@M-^\noM-bM-^@M-^].
394 405
395 GlobalKnownHostsFile 406 GlobalKnownHostsFile
396 Specifies one or more files to use for the global host key 407 Specifies one or more files to use for the global host key
@@ -399,28 +410,33 @@ DESCRIPTION
399 410
400 GSSAPIAuthentication 411 GSSAPIAuthentication
401 Specifies whether user authentication based on GSSAPI is allowed. 412 Specifies whether user authentication based on GSSAPI is allowed.
402 The default is ``no''. Note that this option applies to protocol 413 The default is M-bM-^@M-^\noM-bM-^@M-^]. Note that this option applies to protocol
403 version 2 only. 414 version 2 only.
404 415
405 GSSAPIDelegateCredentials 416 GSSAPIDelegateCredentials
406 Forward (delegate) credentials to the server. The default is 417 Forward (delegate) credentials to the server. The default is
407 ``no''. Note that this option applies to protocol version 2 418 M-bM-^@M-^\noM-bM-^@M-^]. Note that this option applies to protocol version 2 only.
408 only.
409 419
410 HashKnownHosts 420 HashKnownHosts
411 Indicates that ssh(1) should hash host names and addresses when 421 Indicates that ssh(1) should hash host names and addresses when
412 they are added to ~/.ssh/known_hosts. These hashed names may be 422 they are added to ~/.ssh/known_hosts. These hashed names may be
413 used normally by ssh(1) and sshd(8), but they do not reveal 423 used normally by ssh(1) and sshd(8), but they do not reveal
414 identifying information should the file's contents be disclosed. 424 identifying information should the file's contents be disclosed.
415 The default is ``no''. Note that existing names and addresses in 425 The default is M-bM-^@M-^\noM-bM-^@M-^]. Note that existing names and addresses in
416 known hosts files will not be converted automatically, but may be 426 known hosts files will not be converted automatically, but may be
417 manually hashed using ssh-keygen(1). 427 manually hashed using ssh-keygen(1).
418 428
419 HostbasedAuthentication 429 HostbasedAuthentication
420 Specifies whether to try rhosts based authentication with public 430 Specifies whether to try rhosts based authentication with public
421 key authentication. The argument must be ``yes'' or ``no''. The 431 key authentication. The argument must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The
422 default is ``no''. This option applies to protocol version 2 432 default is M-bM-^@M-^\noM-bM-^@M-^]. This option applies to protocol version 2 only
423 only and is similar to RhostsRSAAuthentication. 433 and is similar to RhostsRSAAuthentication.
434
435 HostbasedKeyTypes
436 Specifies the key types that will be used for hostbased
437 authentication as a comma-separated pattern list. The default
438 M-bM-^@M-^\*M-bM-^@M-^] will allow all key types. The -Q option of ssh(1) may be
439 used to list supported key types.
424 440
425 HostKeyAlgorithms 441 HostKeyAlgorithms
426 Specifies the protocol version 2 host key algorithms that the 442 Specifies the protocol version 2 host key algorithms that the
@@ -439,6 +455,9 @@ DESCRIPTION
439 If hostkeys are known for the destination host then this default 455 If hostkeys are known for the destination host then this default
440 is modified to prefer their algorithms. 456 is modified to prefer their algorithms.
441 457
458 The list of available key types may also be obtained using the -Q
459 option of ssh(1) with an argument of M-bM-^@M-^\keyM-bM-^@M-^].
460
442 HostKeyAlias 461 HostKeyAlias
443 Specifies an alias that should be used instead of the real host 462 Specifies an alias that should be used instead of the real host
444 name when looking up or saving the host key in the host key 463 name when looking up or saving the host key in the host key
@@ -448,10 +467,10 @@ DESCRIPTION
448 HostName 467 HostName
449 Specifies the real host name to log into. This can be used to 468 Specifies the real host name to log into. This can be used to
450 specify nicknames or abbreviations for hosts. If the hostname 469 specify nicknames or abbreviations for hosts. If the hostname
451 contains the character sequence `%h', then this will be replaced 470 contains the character sequence M-bM-^@M-^X%hM-bM-^@M-^Y, then this will be replaced
452 with the host name specified on the command line (this is useful 471 with the host name specified on the command line (this is useful
453 for manipulating unqualified names). The character sequence `%%' 472 for manipulating unqualified names). The character sequence M-bM-^@M-^X%%M-bM-^@M-^Y
454 will be replaced by a single `%' character, which may be used 473 will be replaced by a single M-bM-^@M-^X%M-bM-^@M-^Y character, which may be used
455 when specifying IPv6 link-local addresses. 474 when specifying IPv6 link-local addresses.
456 475
457 The default is the name given on the command line. Numeric IP 476 The default is the name given on the command line. Numeric IP
@@ -462,12 +481,12 @@ DESCRIPTION
462 Specifies that ssh(1) should only use the authentication identity 481 Specifies that ssh(1) should only use the authentication identity
463 files configured in the ssh_config files, even if ssh-agent(1) or 482 files configured in the ssh_config files, even if ssh-agent(1) or
464 a PKCS11Provider offers more identities. The argument to this 483 a PKCS11Provider offers more identities. The argument to this
465 keyword must be ``yes'' or ``no''. This option is intended for 484 keyword must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. This option is intended for
466 situations where ssh-agent offers many different identities. The 485 situations where ssh-agent offers many different identities. The
467 default is ``no''. 486 default is M-bM-^@M-^\noM-bM-^@M-^].
468 487
469 IdentityFile 488 IdentityFile
470 Specifies a file from which the user's DSA, ECDSA, ED25519 or RSA 489 Specifies a file from which the user's DSA, ECDSA, Ed25519 or RSA
471 authentication identity is read. The default is ~/.ssh/identity 490 authentication identity is read. The default is ~/.ssh/identity
472 for protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, 491 for protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa,
473 ~/.ssh/id_ed25519 and ~/.ssh/id_rsa for protocol version 2. 492 ~/.ssh/id_ed25519 and ~/.ssh/id_rsa for protocol version 2.
@@ -478,9 +497,9 @@ DESCRIPTION
478 specified IdentityFile. 497 specified IdentityFile.
479 498
480 The file name may use the tilde syntax to refer to a user's home 499 The file name may use the tilde syntax to refer to a user's home
481 directory or one of the following escape characters: `%d' (local 500 directory or one of the following escape characters: M-bM-^@M-^X%dM-bM-^@M-^Y (local
482 user's home directory), `%u' (local user name), `%l' (local host 501 user's home directory), M-bM-^@M-^X%uM-bM-^@M-^Y (local user name), M-bM-^@M-^X%lM-bM-^@M-^Y (local host
483 name), `%h' (remote host name) or `%r' (remote user name). 502 name), M-bM-^@M-^X%hM-bM-^@M-^Y (remote host name) or M-bM-^@M-^X%rM-bM-^@M-^Y (remote user name).
484 503
485 It is possible to have multiple identity files specified in 504 It is possible to have multiple identity files specified in
486 configuration files; all these identities will be tried in 505 configuration files; all these identities will be tried in
@@ -501,30 +520,30 @@ DESCRIPTION
501 to unknown options that appear before it. 520 to unknown options that appear before it.
502 521
503 IPQoS Specifies the IPv4 type-of-service or DSCP class for connections. 522 IPQoS Specifies the IPv4 type-of-service or DSCP class for connections.
504 Accepted values are ``af11'', ``af12'', ``af13'', ``af21'', 523 Accepted values are M-bM-^@M-^\af11M-bM-^@M-^], M-bM-^@M-^\af12M-bM-^@M-^], M-bM-^@M-^\af13M-bM-^@M-^], M-bM-^@M-^\af21M-bM-^@M-^], M-bM-^@M-^\af22M-bM-^@M-^],
505 ``af22'', ``af23'', ``af31'', ``af32'', ``af33'', ``af41'', 524 M-bM-^@M-^\af23M-bM-^@M-^], M-bM-^@M-^\af31M-bM-^@M-^], M-bM-^@M-^\af32M-bM-^@M-^], M-bM-^@M-^\af33M-bM-^@M-^], M-bM-^@M-^\af41M-bM-^@M-^], M-bM-^@M-^\af42M-bM-^@M-^], M-bM-^@M-^\af43M-bM-^@M-^], M-bM-^@M-^\cs0M-bM-^@M-^],
506 ``af42'', ``af43'', ``cs0'', ``cs1'', ``cs2'', ``cs3'', ``cs4'', 525 M-bM-^@M-^\cs1M-bM-^@M-^], M-bM-^@M-^\cs2M-bM-^@M-^], M-bM-^@M-^\cs3M-bM-^@M-^], M-bM-^@M-^\cs4M-bM-^@M-^], M-bM-^@M-^\cs5M-bM-^@M-^], M-bM-^@M-^\cs6M-bM-^@M-^], M-bM-^@M-^\cs7M-bM-^@M-^], M-bM-^@M-^\efM-bM-^@M-^],
507 ``cs5'', ``cs6'', ``cs7'', ``ef'', ``lowdelay'', ``throughput'', 526 M-bM-^@M-^\lowdelayM-bM-^@M-^], M-bM-^@M-^\throughputM-bM-^@M-^], M-bM-^@M-^\reliabilityM-bM-^@M-^], or a numeric value.
508 ``reliability'', or a numeric value. This option may take one or 527 This option may take one or two arguments, separated by
509 two arguments, separated by whitespace. If one argument is 528 whitespace. If one argument is specified, it is used as the
510 specified, it is used as the packet class unconditionally. If 529 packet class unconditionally. If two values are specified, the
511 two values are specified, the first is automatically selected for 530 first is automatically selected for interactive sessions and the
512 interactive sessions and the second for non-interactive sessions. 531 second for non-interactive sessions. The default is M-bM-^@M-^\lowdelayM-bM-^@M-^]
513 The default is ``lowdelay'' for interactive sessions and 532 for interactive sessions and M-bM-^@M-^\throughputM-bM-^@M-^] for non-interactive
514 ``throughput'' for non-interactive sessions. 533 sessions.
515 534
516 KbdInteractiveAuthentication 535 KbdInteractiveAuthentication
517 Specifies whether to use keyboard-interactive authentication. 536 Specifies whether to use keyboard-interactive authentication.
518 The argument to this keyword must be ``yes'' or ``no''. The 537 The argument to this keyword must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default
519 default is ``yes''. 538 is M-bM-^@M-^\yesM-bM-^@M-^].
520 539
521 KbdInteractiveDevices 540 KbdInteractiveDevices
522 Specifies the list of methods to use in keyboard-interactive 541 Specifies the list of methods to use in keyboard-interactive
523 authentication. Multiple method names must be comma-separated. 542 authentication. Multiple method names must be comma-separated.
524 The default is to use the server specified list. The methods 543 The default is to use the server specified list. The methods
525 available vary depending on what the server supports. For an 544 available vary depending on what the server supports. For an
526 OpenSSH server, it may be zero or more of: ``bsdauth'', ``pam'', 545 OpenSSH server, it may be zero or more of: M-bM-^@M-^\bsdauthM-bM-^@M-^], M-bM-^@M-^\pamM-bM-^@M-^], and
527 and ``skey''. 546 M-bM-^@M-^\skeyM-bM-^@M-^].
528 547
529 KexAlgorithms 548 KexAlgorithms
530 Specifies the available KEX (Key Exchange) algorithms. Multiple 549 Specifies the available KEX (Key Exchange) algorithms. Multiple
@@ -537,15 +556,18 @@ DESCRIPTION
537 diffie-hellman-group-exchange-sha1, 556 diffie-hellman-group-exchange-sha1,
538 diffie-hellman-group1-sha1 557 diffie-hellman-group1-sha1
539 558
559 The list of available key exchange algorithms may also be
560 obtained using the -Q option of ssh(1) with an argument of M-bM-^@M-^\kexM-bM-^@M-^].
561
540 LocalCommand 562 LocalCommand
541 Specifies a command to execute on the local machine after 563 Specifies a command to execute on the local machine after
542 successfully connecting to the server. The command string 564 successfully connecting to the server. The command string
543 extends to the end of the line, and is executed with the user's 565 extends to the end of the line, and is executed with the user's
544 shell. The following escape character substitutions will be 566 shell. The following escape character substitutions will be
545 performed: `%d' (local user's home directory), `%h' (remote host 567 performed: M-bM-^@M-^X%dM-bM-^@M-^Y (local user's home directory), M-bM-^@M-^X%hM-bM-^@M-^Y (remote host
546 name), `%l' (local host name), `%n' (host name as provided on the 568 name), M-bM-^@M-^X%lM-bM-^@M-^Y (local host name), M-bM-^@M-^X%nM-bM-^@M-^Y (host name as provided on the
547 command line), `%p' (remote port), `%r' (remote user name) or 569 command line), M-bM-^@M-^X%pM-bM-^@M-^Y (remote port), M-bM-^@M-^X%rM-bM-^@M-^Y (remote user name) or
548 `%u' (local user name) or `%C' by a hash of the concatenation: 570 M-bM-^@M-^X%uM-bM-^@M-^Y (local user name) or M-bM-^@M-^X%CM-bM-^@M-^Y by a hash of the concatenation:
549 %l%h%p%r. 571 %l%h%p%r.
550 572
551 The command is run synchronously and does not have access to the 573 The command is run synchronously and does not have access to the
@@ -566,9 +588,9 @@ DESCRIPTION
566 privileged ports. By default, the local port is bound in 588 privileged ports. By default, the local port is bound in
567 accordance with the GatewayPorts setting. However, an explicit 589 accordance with the GatewayPorts setting. However, an explicit
568 bind_address may be used to bind the connection to a specific 590 bind_address may be used to bind the connection to a specific
569 address. The bind_address of ``localhost'' indicates that the 591 address. The bind_address of M-bM-^@M-^\localhostM-bM-^@M-^] indicates that the
570 listening port be bound for local use only, while an empty 592 listening port be bound for local use only, while an empty
571 address or `*' indicates that the port should be available from 593 address or M-bM-^@M-^X*M-bM-^@M-^Y indicates that the port should be available from
572 all interfaces. 594 all interfaces.
573 595
574 LogLevel 596 LogLevel
@@ -581,7 +603,7 @@ DESCRIPTION
581 MACs Specifies the MAC (message authentication code) algorithms in 603 MACs Specifies the MAC (message authentication code) algorithms in
582 order of preference. The MAC algorithm is used in protocol 604 order of preference. The MAC algorithm is used in protocol
583 version 2 for data integrity protection. Multiple algorithms 605 version 2 for data integrity protection. Multiple algorithms
584 must be comma-separated. The algorithms that contain ``-etm'' 606 must be comma-separated. The algorithms that contain M-bM-^@M-^\-etmM-bM-^@M-^]
585 calculate the MAC after encryption (encrypt-then-mac). These are 607 calculate the MAC after encryption (encrypt-then-mac). These are
586 considered safer and their use recommended. The default is: 608 considered safer and their use recommended. The default is:
587 609
@@ -595,14 +617,17 @@ DESCRIPTION
595 hmac-md5,hmac-sha1,hmac-ripemd160, 617 hmac-md5,hmac-sha1,hmac-ripemd160,
596 hmac-sha1-96,hmac-md5-96 618 hmac-sha1-96,hmac-md5-96
597 619
620 The list of available MAC algorithms may also be obtained using
621 the -Q option of ssh(1) with an argument of M-bM-^@M-^\macM-bM-^@M-^].
622
598 NoHostAuthenticationForLocalhost 623 NoHostAuthenticationForLocalhost
599 This option can be used if the home directory is shared across 624 This option can be used if the home directory is shared across
600 machines. In this case localhost will refer to a different 625 machines. In this case localhost will refer to a different
601 machine on each of the machines and the user will get many 626 machine on each of the machines and the user will get many
602 warnings about changed host keys. However, this option disables 627 warnings about changed host keys. However, this option disables
603 host authentication for localhost. The argument to this keyword 628 host authentication for localhost. The argument to this keyword
604 must be ``yes'' or ``no''. The default is to check the host key 629 must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is to check the host key for
605 for localhost. 630 localhost.
606 631
607 NumberOfPasswordPrompts 632 NumberOfPasswordPrompts
608 Specifies the number of password prompts before giving up. The 633 Specifies the number of password prompts before giving up. The
@@ -610,13 +635,12 @@ DESCRIPTION
610 635
611 PasswordAuthentication 636 PasswordAuthentication
612 Specifies whether to use password authentication. The argument 637 Specifies whether to use password authentication. The argument
613 to this keyword must be ``yes'' or ``no''. The default is 638 to this keyword must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\yesM-bM-^@M-^].
614 ``yes''.
615 639
616 PermitLocalCommand 640 PermitLocalCommand
617 Allow local command execution via the LocalCommand option or 641 Allow local command execution via the LocalCommand option or
618 using the !command escape sequence in ssh(1). The argument must 642 using the !command escape sequence in ssh(1). The argument must
619 be ``yes'' or ``no''. The default is ``no''. 643 be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\noM-bM-^@M-^].
620 644
621 PKCS11Provider 645 PKCS11Provider
622 Specifies which PKCS#11 provider to use. The argument to this 646 Specifies which PKCS#11 provider to use. The argument to this
@@ -638,26 +662,26 @@ DESCRIPTION
638 662
639 Protocol 663 Protocol
640 Specifies the protocol versions ssh(1) should support in order of 664 Specifies the protocol versions ssh(1) should support in order of
641 preference. The possible values are `1' and `2'. Multiple 665 preference. The possible values are M-bM-^@M-^X1M-bM-^@M-^Y and M-bM-^@M-^X2M-bM-^@M-^Y. Multiple
642 versions must be comma-separated. When this option is set to 666 versions must be comma-separated. When this option is set to
643 ``2,1'' ssh will try version 2 and fall back to version 1 if 667 M-bM-^@M-^\2,1M-bM-^@M-^] ssh will try version 2 and fall back to version 1 if
644 version 2 is not available. The default is `2'. 668 version 2 is not available. The default is M-bM-^@M-^X2M-bM-^@M-^Y.
645 669
646 ProxyCommand 670 ProxyCommand
647 Specifies the command to use to connect to the server. The 671 Specifies the command to use to connect to the server. The
648 command string extends to the end of the line, and is executed 672 command string extends to the end of the line, and is executed
649 using the user's shell `exec' directive to avoid a lingering 673 using the user's shell M-bM-^@M-^XexecM-bM-^@M-^Y directive to avoid a lingering
650 shell process. 674 shell process.
651 675
652 In the command string, any occurrence of `%h' will be substituted 676 In the command string, any occurrence of M-bM-^@M-^X%hM-bM-^@M-^Y will be substituted
653 by the host name to connect, `%p' by the port, and `%r' by the 677 by the host name to connect, M-bM-^@M-^X%pM-bM-^@M-^Y by the port, and M-bM-^@M-^X%rM-bM-^@M-^Y by the
654 remote user name. The command can be basically anything, and 678 remote user name. The command can be basically anything, and
655 should read from its standard input and write to its standard 679 should read from its standard input and write to its standard
656 output. It should eventually connect an sshd(8) server running 680 output. It should eventually connect an sshd(8) server running
657 on some machine, or execute sshd -i somewhere. Host key 681 on some machine, or execute sshd -i somewhere. Host key
658 management will be done using the HostName of the host being 682 management will be done using the HostName of the host being
659 connected (defaulting to the name typed by the user). Setting 683 connected (defaulting to the name typed by the user). Setting
660 the command to ``none'' disables this option entirely. Note that 684 the command to M-bM-^@M-^\noneM-bM-^@M-^] disables this option entirely. Note that
661 CheckHostIP is not available for connects with a proxy command. 685 CheckHostIP is not available for connects with a proxy command.
662 686
663 This directive is useful in conjunction with nc(1) and its proxy 687 This directive is useful in conjunction with nc(1) and its proxy
@@ -669,27 +693,27 @@ DESCRIPTION
669 ProxyUseFdpass 693 ProxyUseFdpass
670 Specifies that ProxyCommand will pass a connected file descriptor 694 Specifies that ProxyCommand will pass a connected file descriptor
671 back to ssh(1) instead of continuing to execute and pass data. 695 back to ssh(1) instead of continuing to execute and pass data.
672 The default is ``no''. 696 The default is M-bM-^@M-^\noM-bM-^@M-^].
673 697
674 PubkeyAuthentication 698 PubkeyAuthentication
675 Specifies whether to try public key authentication. The argument 699 Specifies whether to try public key authentication. The argument
676 to this keyword must be ``yes'' or ``no''. The default is 700 to this keyword must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\yesM-bM-^@M-^].
677 ``yes''. This option applies to protocol version 2 only. 701 This option applies to protocol version 2 only.
678 702
679 RekeyLimit 703 RekeyLimit
680 Specifies the maximum amount of data that may be transmitted 704 Specifies the maximum amount of data that may be transmitted
681 before the session key is renegotiated, optionally followed a 705 before the session key is renegotiated, optionally followed a
682 maximum amount of time that may pass before the session key is 706 maximum amount of time that may pass before the session key is
683 renegotiated. The first argument is specified in bytes and may 707 renegotiated. The first argument is specified in bytes and may
684 have a suffix of `K', `M', or `G' to indicate Kilobytes, 708 have a suffix of M-bM-^@M-^XKM-bM-^@M-^Y, M-bM-^@M-^XMM-bM-^@M-^Y, or M-bM-^@M-^XGM-bM-^@M-^Y to indicate Kilobytes,
685 Megabytes, or Gigabytes, respectively. The default is between 709 Megabytes, or Gigabytes, respectively. The default is between
686 `1G' and `4G', depending on the cipher. The optional second 710 M-bM-^@M-^X1GM-bM-^@M-^Y and M-bM-^@M-^X4GM-bM-^@M-^Y, depending on the cipher. The optional second
687 value is specified in seconds and may use any of the units 711 value is specified in seconds and may use any of the units
688 documented in the TIME FORMATS section of sshd_config(5). The 712 documented in the TIME FORMATS section of sshd_config(5). The
689 default value for RekeyLimit is ``default none'', which means 713 default value for RekeyLimit is M-bM-^@M-^\default noneM-bM-^@M-^], which means that
690 that rekeying is performed after the cipher's default amount of 714 rekeying is performed after the cipher's default amount of data
691 data has been sent or received and no time based rekeying is 715 has been sent or received and no time based rekeying is done.
692 done. This option applies to protocol version 2 only. 716 This option applies to protocol version 2 only.
693 717
694 RemoteForward 718 RemoteForward
695 Specifies that a TCP port on the remote machine be forwarded over 719 Specifies that a TCP port on the remote machine be forwarded over
@@ -701,11 +725,11 @@ DESCRIPTION
701 given on the command line. Privileged ports can be forwarded 725 given on the command line. Privileged ports can be forwarded
702 only when logging in as root on the remote machine. 726 only when logging in as root on the remote machine.
703 727
704 If the port argument is `0', the listen port will be dynamically 728 If the port argument is M-bM-^@M-^X0M-bM-^@M-^Y, the listen port will be dynamically
705 allocated on the server and reported to the client at run time. 729 allocated on the server and reported to the client at run time.
706 730
707 If the bind_address is not specified, the default is to only bind 731 If the bind_address is not specified, the default is to only bind
708 to loopback addresses. If the bind_address is `*' or an empty 732 to loopback addresses. If the bind_address is M-bM-^@M-^X*M-bM-^@M-^Y or an empty
709 string, then the forwarding is requested to listen on all 733 string, then the forwarding is requested to listen on all
710 interfaces. Specifying a remote bind_address will only succeed 734 interfaces. Specifying a remote bind_address will only succeed
711 if the server's GatewayPorts option is enabled (see 735 if the server's GatewayPorts option is enabled (see
@@ -713,24 +737,32 @@ DESCRIPTION
713 737
714 RequestTTY 738 RequestTTY
715 Specifies whether to request a pseudo-tty for the session. The 739 Specifies whether to request a pseudo-tty for the session. The
716 argument may be one of: ``no'' (never request a TTY), ``yes'' 740 argument may be one of: M-bM-^@M-^\noM-bM-^@M-^] (never request a TTY), M-bM-^@M-^\yesM-bM-^@M-^] (always
717 (always request a TTY when standard input is a TTY), ``force'' 741 request a TTY when standard input is a TTY), M-bM-^@M-^\forceM-bM-^@M-^] (always
718 (always request a TTY) or ``auto'' (request a TTY when opening a 742 request a TTY) or M-bM-^@M-^\autoM-bM-^@M-^] (request a TTY when opening a login
719 login session). This option mirrors the -t and -T flags for 743 session). This option mirrors the -t and -T flags for ssh(1).
720 ssh(1). 744
745 RevokedHostKeys
746 Specifies revoked host public keys. Keys listed in this file
747 will be refused for host authentication. Note that if this file
748 does not exist or is not readable, then host authentication will
749 be refused for all hosts. Keys may be specified as a text file,
750 listing one public key per line, or as an OpenSSH Key Revocation
751 List (KRL) as generated by ssh-keygen(1). For more information
752 on KRLs, see the KEY REVOCATION LISTS section in ssh-keygen(1).
721 753
722 RhostsRSAAuthentication 754 RhostsRSAAuthentication
723 Specifies whether to try rhosts based authentication with RSA 755 Specifies whether to try rhosts based authentication with RSA
724 host authentication. The argument must be ``yes'' or ``no''. 756 host authentication. The argument must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The
725 The default is ``no''. This option applies to protocol version 1 757 default is M-bM-^@M-^\noM-bM-^@M-^]. This option applies to protocol version 1 only
726 only and requires ssh(1) to be setuid root. 758 and requires ssh(1) to be setuid root.
727 759
728 RSAAuthentication 760 RSAAuthentication
729 Specifies whether to try RSA authentication. The argument to 761 Specifies whether to try RSA authentication. The argument to
730 this keyword must be ``yes'' or ``no''. RSA authentication will 762 this keyword must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. RSA authentication will only
731 only be attempted if the identity file exists, or an 763 be attempted if the identity file exists, or an authentication
732 authentication agent is running. The default is ``yes''. Note 764 agent is running. The default is M-bM-^@M-^\yesM-bM-^@M-^]. Note that this option
733 that this option applies to protocol version 1 only. 765 applies to protocol version 1 only.
734 766
735 SendEnv 767 SendEnv
736 Specifies what variables from the local environ(7) should be sent 768 Specifies what variables from the local environ(7) should be sent
@@ -790,24 +822,24 @@ DESCRIPTION
790 domain socket file. This option is only used for port forwarding 822 domain socket file. This option is only used for port forwarding
791 to a Unix-domain socket file. 823 to a Unix-domain socket file.
792 824
793 The argument must be ``yes'' or ``no''. The default is ``no''. 825 The argument must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\noM-bM-^@M-^].
794 826
795 StrictHostKeyChecking 827 StrictHostKeyChecking
796 If this flag is set to ``yes'', ssh(1) will never automatically 828 If this flag is set to M-bM-^@M-^\yesM-bM-^@M-^], ssh(1) will never automatically add
797 add host keys to the ~/.ssh/known_hosts file, and refuses to 829 host keys to the ~/.ssh/known_hosts file, and refuses to connect
798 connect to hosts whose host key has changed. This provides 830 to hosts whose host key has changed. This provides maximum
799 maximum protection against trojan horse attacks, though it can be 831 protection against trojan horse attacks, though it can be
800 annoying when the /etc/ssh/ssh_known_hosts file is poorly 832 annoying when the /etc/ssh/ssh_known_hosts file is poorly
801 maintained or when connections to new hosts are frequently made. 833 maintained or when connections to new hosts are frequently made.
802 This option forces the user to manually add all new hosts. If 834 This option forces the user to manually add all new hosts. If
803 this flag is set to ``no'', ssh will automatically add new host 835 this flag is set to M-bM-^@M-^\noM-bM-^@M-^], ssh will automatically add new host
804 keys to the user known hosts files. If this flag is set to 836 keys to the user known hosts files. If this flag is set to
805 ``ask'', new host keys will be added to the user known host files 837 M-bM-^@M-^\askM-bM-^@M-^], new host keys will be added to the user known host files
806 only after the user has confirmed that is what they really want 838 only after the user has confirmed that is what they really want
807 to do, and ssh will refuse to connect to hosts whose host key has 839 to do, and ssh will refuse to connect to hosts whose host key has
808 changed. The host keys of known hosts will be verified 840 changed. The host keys of known hosts will be verified
809 automatically in all cases. The argument must be ``yes'', 841 automatically in all cases. The argument must be M-bM-^@M-^\yesM-bM-^@M-^], M-bM-^@M-^\noM-bM-^@M-^], or
810 ``no'', or ``ask''. The default is ``ask''. 842 M-bM-^@M-^\askM-bM-^@M-^]. The default is M-bM-^@M-^\askM-bM-^@M-^].
811 843
812 TCPKeepAlive 844 TCPKeepAlive
813 Specifies whether the system should send TCP keepalive messages 845 Specifies whether the system should send TCP keepalive messages
@@ -816,34 +848,53 @@ DESCRIPTION
816 this means that connections will die if the route is down 848 this means that connections will die if the route is down
817 temporarily, and some people find it annoying. 849 temporarily, and some people find it annoying.
818 850
819 The default is ``yes'' (to send TCP keepalive messages), and the 851 The default is M-bM-^@M-^\yesM-bM-^@M-^] (to send TCP keepalive messages), and the
820 client will notice if the network goes down or the remote host 852 client will notice if the network goes down or the remote host
821 dies. This is important in scripts, and many users want it too. 853 dies. This is important in scripts, and many users want it too.
822 854
823 To disable TCP keepalive messages, the value should be set to 855 To disable TCP keepalive messages, the value should be set to
824 ``no''. 856 M-bM-^@M-^\noM-bM-^@M-^].
825 857
826 Tunnel Request tun(4) device forwarding between the client and the 858 Tunnel Request tun(4) device forwarding between the client and the
827 server. The argument must be ``yes'', ``point-to-point'' (layer 859 server. The argument must be M-bM-^@M-^\yesM-bM-^@M-^], M-bM-^@M-^\point-to-pointM-bM-^@M-^] (layer 3),
828 3), ``ethernet'' (layer 2), or ``no''. Specifying ``yes'' 860 M-bM-^@M-^\ethernetM-bM-^@M-^] (layer 2), or M-bM-^@M-^\noM-bM-^@M-^]. Specifying M-bM-^@M-^\yesM-bM-^@M-^] requests the
829 requests the default tunnel mode, which is ``point-to-point''. 861 default tunnel mode, which is M-bM-^@M-^\point-to-pointM-bM-^@M-^]. The default is
830 The default is ``no''. 862 M-bM-^@M-^\noM-bM-^@M-^].
831 863
832 TunnelDevice 864 TunnelDevice
833 Specifies the tun(4) devices to open on the client (local_tun) 865 Specifies the tun(4) devices to open on the client (local_tun)
834 and the server (remote_tun). 866 and the server (remote_tun).
835 867
836 The argument must be local_tun[:remote_tun]. The devices may be 868 The argument must be local_tun[:remote_tun]. The devices may be
837 specified by numerical ID or the keyword ``any'', which uses the 869 specified by numerical ID or the keyword M-bM-^@M-^\anyM-bM-^@M-^], which uses the
838 next available tunnel device. If remote_tun is not specified, it 870 next available tunnel device. If remote_tun is not specified, it
839 defaults to ``any''. The default is ``any:any''. 871 defaults to M-bM-^@M-^\anyM-bM-^@M-^]. The default is M-bM-^@M-^\any:anyM-bM-^@M-^].
872
873 UpdateHostKeys
874 Specifies whether ssh(1) should accept notifications of
875 additional hostkeys from the server sent after authentication has
876 completed and add them to UserKnownHostsFile. The argument must
877 be M-bM-^@M-^\yesM-bM-^@M-^], M-bM-^@M-^\noM-bM-^@M-^] (the default) or M-bM-^@M-^\askM-bM-^@M-^]. Enabling this option
878 allows learning alternate hostkeys for a server and supports
879 graceful key rotation by allowing a server to send replacement
880 public keys before old ones are removed. Additional hostkeys are
881 only accepted if the key used to authenticate the host was
882 already trusted or explicity accepted by the user. If
883 UpdateHostKeys is set to M-bM-^@M-^\askM-bM-^@M-^], then the user is asked to confirm
884 the modifications to the known_hosts file. Confirmation is
885 currently incompatible with ControlPersist, and will be disabled
886 if it is enabled.
887
888 Presently, only sshd(8) from OpenSSH 6.8 and greater support the
889 M-bM-^@M-^\hostkeys@openssh.comM-bM-^@M-^] protocol extension used to inform the
890 client of all the server's hostkeys.
840 891
841 UsePrivilegedPort 892 UsePrivilegedPort
842 Specifies whether to use a privileged port for outgoing 893 Specifies whether to use a privileged port for outgoing
843 connections. The argument must be ``yes'' or ``no''. The 894 connections. The argument must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is
844 default is ``no''. If set to ``yes'', ssh(1) must be setuid 895 M-bM-^@M-^\noM-bM-^@M-^]. If set to M-bM-^@M-^\yesM-bM-^@M-^], ssh(1) must be setuid root. Note that
845 root. Note that this option must be set to ``yes'' for 896 this option must be set to M-bM-^@M-^\yesM-bM-^@M-^] for RhostsRSAAuthentication with
846 RhostsRSAAuthentication with older servers. 897 older servers.
847 898
848 User Specifies the user to log in as. This can be useful when a 899 User Specifies the user to log in as. This can be useful when a
849 different user name is used on different machines. This saves 900 different user name is used on different machines. This saves
@@ -857,35 +908,35 @@ DESCRIPTION
857 908
858 VerifyHostKeyDNS 909 VerifyHostKeyDNS
859 Specifies whether to verify the remote key using DNS and SSHFP 910 Specifies whether to verify the remote key using DNS and SSHFP
860 resource records. If this option is set to ``yes'', the client 911 resource records. If this option is set to M-bM-^@M-^\yesM-bM-^@M-^], the client
861 will implicitly trust keys that match a secure fingerprint from 912 will implicitly trust keys that match a secure fingerprint from
862 DNS. Insecure fingerprints will be handled as if this option was 913 DNS. Insecure fingerprints will be handled as if this option was
863 set to ``ask''. If this option is set to ``ask'', information on 914 set to M-bM-^@M-^\askM-bM-^@M-^]. If this option is set to M-bM-^@M-^\askM-bM-^@M-^], information on
864 fingerprint match will be displayed, but the user will still need 915 fingerprint match will be displayed, but the user will still need
865 to confirm new host keys according to the StrictHostKeyChecking 916 to confirm new host keys according to the StrictHostKeyChecking
866 option. The argument must be ``yes'', ``no'', or ``ask''. The 917 option. The argument must be M-bM-^@M-^\yesM-bM-^@M-^], M-bM-^@M-^\noM-bM-^@M-^], or M-bM-^@M-^\askM-bM-^@M-^]. The default
867 default is ``no''. Note that this option applies to protocol 918 is M-bM-^@M-^\noM-bM-^@M-^]. Note that this option applies to protocol version 2
868 version 2 only. 919 only.
869 920
870 See also VERIFYING HOST KEYS in ssh(1). 921 See also VERIFYING HOST KEYS in ssh(1).
871 922
872 VisualHostKey 923 VisualHostKey
873 If this flag is set to ``yes'', an ASCII art representation of 924 If this flag is set to M-bM-^@M-^\yesM-bM-^@M-^], an ASCII art representation of the
874 the remote host key fingerprint is printed in addition to the hex 925 remote host key fingerprint is printed in addition to the
875 fingerprint string at login and for unknown host keys. If this 926 fingerprint string at login and for unknown host keys. If this
876 flag is set to ``no'', no fingerprint strings are printed at 927 flag is set to M-bM-^@M-^\noM-bM-^@M-^], no fingerprint strings are printed at login
877 login and only the hex fingerprint string will be printed for 928 and only the fingerprint string will be printed for unknown host
878 unknown host keys. The default is ``no''. 929 keys. The default is M-bM-^@M-^\noM-bM-^@M-^].
879 930
880 XAuthLocation 931 XAuthLocation
881 Specifies the full pathname of the xauth(1) program. The default 932 Specifies the full pathname of the xauth(1) program. The default
882 is /usr/X11R6/bin/xauth. 933 is /usr/X11R6/bin/xauth.
883 934
884PATTERNS 935PATTERNS
885 A pattern consists of zero or more non-whitespace characters, `*' (a 936 A pattern consists of zero or more non-whitespace characters, M-bM-^@M-^X*M-bM-^@M-^Y (a
886 wildcard that matches zero or more characters), or `?' (a wildcard that 937 wildcard that matches zero or more characters), or M-bM-^@M-^X?M-bM-^@M-^Y (a wildcard that
887 matches exactly one character). For example, to specify a set of 938 matches exactly one character). For example, to specify a set of
888 declarations for any host in the ``.co.uk'' set of domains, the following 939 declarations for any host in the M-bM-^@M-^\.co.ukM-bM-^@M-^] set of domains, the following
889 pattern could be used: 940 pattern could be used:
890 941
891 Host *.co.uk 942 Host *.co.uk
@@ -897,8 +948,8 @@ PATTERNS
897 948
898 A pattern-list is a comma-separated list of patterns. Patterns within 949 A pattern-list is a comma-separated list of patterns. Patterns within
899 pattern-lists may be negated by preceding them with an exclamation mark 950 pattern-lists may be negated by preceding them with an exclamation mark
900 (`!'). For example, to allow a key to be used from anywhere within an 951 (M-bM-^@M-^X!M-bM-^@M-^Y). For example, to allow a key to be used from anywhere within an
901 organization except from the ``dialup'' pool, the following entry (in 952 organization except from the M-bM-^@M-^\dialupM-bM-^@M-^] pool, the following entry (in
902 authorized_keys) could be used: 953 authorized_keys) could be used:
903 954
904 from="!*.dialup.example.com,*.example.com" 955 from="!*.dialup.example.com,*.example.com"
@@ -927,4 +978,4 @@ AUTHORS
927 created OpenSSH. Markus Friedl contributed the support for SSH protocol 978 created OpenSSH. Markus Friedl contributed the support for SSH protocol
928 versions 1.5 and 2.0. 979 versions 1.5 and 2.0.
929 980
930OpenBSD 5.6 July 15, 2014 OpenBSD 5.6 981OpenBSD 5.7 February 20, 2015 OpenBSD 5.7
diff --git a/ssh_config.5 b/ssh_config.5
index f9ede7a31..140d0ba98 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -33,8 +33,8 @@
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\" 35.\"
36.\" $OpenBSD: ssh_config.5,v 1.191 2014/07/15 15:54:14 millert Exp $ 36.\" $OpenBSD: ssh_config.5,v 1.205 2015/02/20 22:17:21 djm Exp $
37.Dd $Mdocdate: July 15 2014 $ 37.Dd $Mdocdate: February 20 2015 $
38.Dt SSH_CONFIG 5 38.Dt SSH_CONFIG 5
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -65,7 +65,10 @@ The configuration files contain sections separated by
65.Dq Host 65.Dq Host
66specifications, and that section is only applied for hosts that 66specifications, and that section is only applied for hosts that
67match one of the patterns given in the specification. 67match one of the patterns given in the specification.
68The matched host name is the one given on the command line. 68The matched host name is usually the one given on the command line
69(see the
70.Cm CanonicalizeHostname
71option for exceptions.)
69.Pp 72.Pp
70Since the first obtained value for each parameter is used, more 73Since the first obtained value for each parameter is used, more
71host-specific declarations should be given near the beginning of the 74host-specific declarations should be given near the beginning of the
@@ -109,10 +112,12 @@ A single
109.Ql * 112.Ql *
110as a pattern can be used to provide global 113as a pattern can be used to provide global
111defaults for all hosts. 114defaults for all hosts.
112The host is the 115The host is usually the
113.Ar hostname 116.Ar hostname
114argument given on the command line (i.e. the name is not converted to 117argument given on the command line
115a canonicalized host name before matching). 118(see the
119.Cm CanonicalizeHostname
120option for exceptions.)
116.Pp 121.Pp
117A pattern entry may be negated by prefixing it with an exclamation mark 122A pattern entry may be negated by prefixing it with an exclamation mark
118.Pq Sq !\& . 123.Pq Sq !\& .
@@ -134,19 +139,40 @@ or
134keyword) to be used only when the conditions following the 139keyword) to be used only when the conditions following the
135.Cm Match 140.Cm Match
136keyword are satisfied. 141keyword are satisfied.
137Match conditions are specified using one or more keyword/criteria pairs 142Match conditions are specified using one or more critera
138or the single token 143or the single token
139.Cm all 144.Cm all
140which matches all criteria. 145which always matches.
141The available keywords are: 146The available criteria keywords are:
147.Cm canonical ,
142.Cm exec , 148.Cm exec ,
143.Cm host , 149.Cm host ,
144.Cm originalhost , 150.Cm originalhost ,
145.Cm user , 151.Cm user ,
146and 152and
147.Cm localuser . 153.Cm localuser .
154The
155.Cm all
156criteria must appear alone or immediately after
157.Cm canonical .
158Other criteria may be combined arbitrarily.
159All criteria but
160.Cm all
161and
162.Cm canonical
163require an argument.
164Criteria may be negated by prepending an exclamation mark
165.Pq Sq !\& .
148.Pp 166.Pp
149The 167The
168.Cm canonical
169keywork matches only when the configuration file is being re-parsed
170after hostname canonicalization (see the
171.Cm CanonicalizeHostname
172option.)
173This may be useful to specify conditions that work with canonical host
174names only.
175The
150.Cm exec 176.Cm exec
151keyword executes the specified command under the user's shell. 177keyword executes the specified command under the user's shell.
152If the command returns a zero exit status then the condition is considered true. 178If the command returns a zero exit status then the condition is considered true.
@@ -179,7 +205,9 @@ The criteria for the
179keyword are matched against the target hostname, after any substitution 205keyword are matched against the target hostname, after any substitution
180by the 206by the
181.Cm Hostname 207.Cm Hostname
182option. 208or
209.Cm CanonicalizeHostname
210options.
183The 211The
184.Cm originalhost 212.Cm originalhost
185keyword matches against the hostname as it was specified on the command-line. 213keyword matches against the hostname as it was specified on the command-line.
@@ -264,10 +292,11 @@ is set to
264.Dq always , 292.Dq always ,
265then canonicalization is applied to proxied connections too. 293then canonicalization is applied to proxied connections too.
266.Pp 294.Pp
267If this option is enabled and canonicalisation results in the target hostname 295If this option is enabled, then the configuration files are processed
268changing, then the configuration files are processed again using the new 296again using the new target name to pick up any new configuration in matching
269target name to pick up any new configuration in matching
270.Cm Host 297.Cm Host
298and
299.Cm Match
271stanzas. 300stanzas.
272.It Cm CanonicalizeMaxDots 301.It Cm CanonicalizeMaxDots
273Specifies the maximum number of dot characters in a hostname before 302Specifies the maximum number of dot characters in a hostname before
@@ -388,7 +417,9 @@ aes192-cbc,aes256-cbc,arcfour
388The list of available ciphers may also be obtained using the 417The list of available ciphers may also be obtained using the
389.Fl Q 418.Fl Q
390option of 419option of
391.Xr ssh 1 . 420.Xr ssh 1
421with an argument of
422.Dq cipher .
392.It Cm ClearAllForwardings 423.It Cm ClearAllForwardings
393Specifies that all local, remote, and dynamic port forwardings 424Specifies that all local, remote, and dynamic port forwardings
394specified in the configuration files or on the command line be 425specified in the configuration files or on the command line be
@@ -508,7 +539,8 @@ by a hash of the concatenation: %l%h%p%r.
508It is recommended that any 539It is recommended that any
509.Cm ControlPath 540.Cm ControlPath
510used for opportunistic connection sharing include 541used for opportunistic connection sharing include
511at least %h, %p, and %r (or alternatively %C). 542at least %h, %p, and %r (or alternatively %C) and be placed in a directory
543that is not writable by other users.
512This ensures that shared connections are uniquely identified. 544This ensures that shared connections are uniquely identified.
513.It Cm ControlPersist 545.It Cm ControlPersist
514When used in conjunction with 546When used in conjunction with
@@ -521,7 +553,9 @@ If set to
521then the master connection will not be placed into the background, 553then the master connection will not be placed into the background,
522and will close as soon as the initial client connection is closed. 554and will close as soon as the initial client connection is closed.
523If set to 555If set to
524.Dq yes , 556.Dq yes
557or
558.Dq 0 ,
525then the master connection will remain in the background indefinitely 559then the master connection will remain in the background indefinitely
526(until killed or closed via a mechanism such as the 560(until killed or closed via a mechanism such as the
527.Xr ssh 1 561.Xr ssh 1
@@ -606,6 +640,14 @@ or
606.Dq no . 640.Dq no .
607The default is 641The default is
608.Dq no . 642.Dq no .
643.It Cm FingerprintHash
644Specifies the hash algorithm used when displaying key fingerprints.
645Valid options are:
646.Dq md5
647and
648.Dq sha256 .
649The default is
650.Dq sha256 .
609.It Cm ForwardAgent 651.It Cm ForwardAgent
610Specifies whether the connection to the authentication agent (if any) 652Specifies whether the connection to the authentication agent (if any)
611will be forwarded to the remote machine. 653will be forwarded to the remote machine.
@@ -735,6 +777,17 @@ The default is
735This option applies to protocol version 2 only and 777This option applies to protocol version 2 only and
736is similar to 778is similar to
737.Cm RhostsRSAAuthentication . 779.Cm RhostsRSAAuthentication .
780.It Cm HostbasedKeyTypes
781Specifies the key types that will be used for hostbased authentication
782as a comma-separated pattern list.
783The default
784.Dq *
785will allow all key types.
786The
787.Fl Q
788option of
789.Xr ssh 1
790may be used to list supported key types.
738.It Cm HostKeyAlgorithms 791.It Cm HostKeyAlgorithms
739Specifies the protocol version 2 host key algorithms 792Specifies the protocol version 2 host key algorithms
740that the client wants to use in order of preference. 793that the client wants to use in order of preference.
@@ -752,6 +805,13 @@ ssh-ed25519,ssh-rsa,ssh-dss
752.Pp 805.Pp
753If hostkeys are known for the destination host then this default is modified 806If hostkeys are known for the destination host then this default is modified
754to prefer their algorithms. 807to prefer their algorithms.
808.Pp
809The list of available key types may also be obtained using the
810.Fl Q
811option of
812.Xr ssh 1
813with an argument of
814.Dq key .
755.It Cm HostKeyAlias 815.It Cm HostKeyAlias
756Specifies an alias that should be used instead of the 816Specifies an alias that should be used instead of the
757real host name when looking up or saving the host key 817real host name when looking up or saving the host key
@@ -795,7 +855,7 @@ offers many different identities.
795The default is 855The default is
796.Dq no . 856.Dq no .
797.It Cm IdentityFile 857.It Cm IdentityFile
798Specifies a file from which the user's DSA, ECDSA, ED25519 or RSA authentication 858Specifies a file from which the user's DSA, ECDSA, Ed25519 or RSA authentication
799identity is read. 859identity is read.
800The default is 860The default is
801.Pa ~/.ssh/identity 861.Pa ~/.ssh/identity
@@ -922,6 +982,13 @@ diffie-hellman-group14-sha1,
922diffie-hellman-group-exchange-sha1, 982diffie-hellman-group-exchange-sha1,
923diffie-hellman-group1-sha1 983diffie-hellman-group1-sha1
924.Ed 984.Ed
985.Pp
986The list of available key exchange algorithms may also be obtained using the
987.Fl Q
988option of
989.Xr ssh 1
990with an argument of
991.Dq kex .
925.It Cm LocalCommand 992.It Cm LocalCommand
926Specifies a command to execute on the local machine after successfully 993Specifies a command to execute on the local machine after successfully
927connecting to the server. 994connecting to the server.
@@ -1011,6 +1078,13 @@ hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,
1011hmac-md5,hmac-sha1,hmac-ripemd160, 1078hmac-md5,hmac-sha1,hmac-ripemd160,
1012hmac-sha1-96,hmac-md5-96 1079hmac-sha1-96,hmac-md5-96
1013.Ed 1080.Ed
1081.Pp
1082The list of available MAC algorithms may also be obtained using the
1083.Fl Q
1084option of
1085.Xr ssh 1
1086with an argument of
1087.Dq mac .
1014.It Cm NoHostAuthenticationForLocalhost 1088.It Cm NoHostAuthenticationForLocalhost
1015This option can be used if the home directory is shared across machines. 1089This option can be used if the home directory is shared across machines.
1016In this case localhost will refer to a different machine on each of 1090In this case localhost will refer to a different machine on each of
@@ -1221,6 +1295,16 @@ and
1221.Fl T 1295.Fl T
1222flags for 1296flags for
1223.Xr ssh 1 . 1297.Xr ssh 1 .
1298.It Cm RevokedHostKeys
1299Specifies revoked host public keys.
1300Keys listed in this file will be refused for host authentication.
1301Note that if this file does not exist or is not readable,
1302then host authentication will be refused for all hosts.
1303Keys may be specified as a text file, listing one public key per line, or as
1304an OpenSSH Key Revocation List (KRL) as generated by
1305.Xr ssh-keygen 1 .
1306For more information on KRLs, see the KEY REVOCATION LISTS section in
1307.Xr ssh-keygen 1 .
1224.It Cm RhostsRSAAuthentication 1308.It Cm RhostsRSAAuthentication
1225Specifies whether to try rhosts based authentication with RSA host 1309Specifies whether to try rhosts based authentication with RSA host
1226authentication. 1310authentication.
@@ -1419,6 +1503,36 @@ is not specified, it defaults to
1419.Dq any . 1503.Dq any .
1420The default is 1504The default is
1421.Dq any:any . 1505.Dq any:any .
1506.It Cm UpdateHostKeys
1507Specifies whether
1508.Xr ssh 1
1509should accept notifications of additional hostkeys from the server sent
1510after authentication has completed and add them to
1511.Cm UserKnownHostsFile .
1512The argument must be
1513.Dq yes ,
1514.Dq no
1515(the default) or
1516.Dq ask .
1517Enabling this option allows learning alternate hostkeys for a server
1518and supports graceful key rotation by allowing a server to send replacement
1519public keys before old ones are removed.
1520Additional hostkeys are only accepted if the key used to authenticate the
1521host was already trusted or explicity accepted by the user.
1522If
1523.Cm UpdateHostKeys
1524is set to
1525.Dq ask ,
1526then the user is asked to confirm the modifications to the known_hosts file.
1527Confirmation is currently incompatible with
1528.Cm ControlPersist ,
1529and will be disabled if it is enabled.
1530.Pp
1531Presently, only
1532.Xr sshd 8
1533from OpenSSH 6.8 and greater support the
1534.Dq hostkeys@openssh.com
1535protocol extension used to inform the client of all the server's hostkeys.
1422.It Cm UsePrivilegedPort 1536.It Cm UsePrivilegedPort
1423Specifies whether to use a privileged port for outgoing connections. 1537Specifies whether to use a privileged port for outgoing connections.
1424The argument must be 1538The argument must be
@@ -1477,12 +1591,12 @@ See also VERIFYING HOST KEYS in
1477If this flag is set to 1591If this flag is set to
1478.Dq yes , 1592.Dq yes ,
1479an ASCII art representation of the remote host key fingerprint is 1593an ASCII art representation of the remote host key fingerprint is
1480printed in addition to the hex fingerprint string at login and 1594printed in addition to the fingerprint string at login and
1481for unknown host keys. 1595for unknown host keys.
1482If this flag is set to 1596If this flag is set to
1483.Dq no , 1597.Dq no ,
1484no fingerprint strings are printed at login and 1598no fingerprint strings are printed at login and
1485only the hex fingerprint string will be printed for unknown host keys. 1599only the fingerprint string will be printed for unknown host keys.
1486The default is 1600The default is
1487.Dq no . 1601.Dq no .
1488.It Cm XAuthLocation 1602.It Cm XAuthLocation
diff --git a/sshbuf-getput-basic.c b/sshbuf-getput-basic.c
index b7d0758c2..8ff8a0a28 100644
--- a/sshbuf-getput-basic.c
+++ b/sshbuf-getput-basic.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf-getput-basic.c,v 1.1 2014/04/30 05:29:56 djm Exp $ */ 1/* $OpenBSD: sshbuf-getput-basic.c,v 1.4 2015/01/14 15:02:39 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -34,7 +34,7 @@ sshbuf_get(struct sshbuf *buf, void *v, size_t len)
34 34
35 if ((r = sshbuf_consume(buf, len)) < 0) 35 if ((r = sshbuf_consume(buf, len)) < 0)
36 return r; 36 return r;
37 if (v != NULL) 37 if (v != NULL && len != 0)
38 memcpy(v, p, len); 38 memcpy(v, p, len);
39 return 0; 39 return 0;
40} 40}
@@ -109,7 +109,8 @@ sshbuf_get_string(struct sshbuf *buf, u_char **valp, size_t *lenp)
109 SSHBUF_DBG(("SSH_ERR_ALLOC_FAIL")); 109 SSHBUF_DBG(("SSH_ERR_ALLOC_FAIL"));
110 return SSH_ERR_ALLOC_FAIL; 110 return SSH_ERR_ALLOC_FAIL;
111 } 111 }
112 memcpy(*valp, val, len); 112 if (len != 0)
113 memcpy(*valp, val, len);
113 (*valp)[len] = '\0'; 114 (*valp)[len] = '\0';
114 } 115 }
115 if (lenp != NULL) 116 if (lenp != NULL)
@@ -200,7 +201,8 @@ sshbuf_get_cstring(struct sshbuf *buf, char **valp, size_t *lenp)
200 SSHBUF_DBG(("SSH_ERR_ALLOC_FAIL")); 201 SSHBUF_DBG(("SSH_ERR_ALLOC_FAIL"));
201 return SSH_ERR_ALLOC_FAIL; 202 return SSH_ERR_ALLOC_FAIL;
202 } 203 }
203 memcpy(*valp, p, len); 204 if (len != 0)
205 memcpy(*valp, p, len);
204 (*valp)[len] = '\0'; 206 (*valp)[len] = '\0';
205 } 207 }
206 if (lenp != NULL) 208 if (lenp != NULL)
@@ -236,7 +238,8 @@ sshbuf_put(struct sshbuf *buf, const void *v, size_t len)
236 238
237 if ((r = sshbuf_reserve(buf, len, &p)) < 0) 239 if ((r = sshbuf_reserve(buf, len, &p)) < 0)
238 return r; 240 return r;
239 memcpy(p, v, len); 241 if (len != 0)
242 memcpy(p, v, len);
240 return 0; 243 return 0;
241} 244}
242 245
@@ -352,14 +355,15 @@ sshbuf_put_string(struct sshbuf *buf, const void *v, size_t len)
352 if ((r = sshbuf_reserve(buf, len + 4, &d)) < 0) 355 if ((r = sshbuf_reserve(buf, len + 4, &d)) < 0)
353 return r; 356 return r;
354 POKE_U32(d, len); 357 POKE_U32(d, len);
355 memcpy(d + 4, v, len); 358 if (len != 0)
359 memcpy(d + 4, v, len);
356 return 0; 360 return 0;
357} 361}
358 362
359int 363int
360sshbuf_put_cstring(struct sshbuf *buf, const char *v) 364sshbuf_put_cstring(struct sshbuf *buf, const char *v)
361{ 365{
362 return sshbuf_put_string(buf, (u_char *)v, strlen(v)); 366 return sshbuf_put_string(buf, (u_char *)v, v == NULL ? 0 : strlen(v));
363} 367}
364 368
365int 369int
@@ -416,6 +420,43 @@ sshbuf_put_bignum2_bytes(struct sshbuf *buf, const void *v, size_t len)
416 POKE_U32(d, len + prepend); 420 POKE_U32(d, len + prepend);
417 if (prepend) 421 if (prepend)
418 d[4] = 0; 422 d[4] = 0;
419 memcpy(d + 4 + prepend, s, len); 423 if (len != 0)
424 memcpy(d + 4 + prepend, s, len);
425 return 0;
426}
427
428int
429sshbuf_get_bignum2_bytes_direct(struct sshbuf *buf,
430 const u_char **valp, size_t *lenp)
431{
432 const u_char *d;
433 size_t len, olen;
434 int r;
435
436 if ((r = sshbuf_peek_string_direct(buf, &d, &olen)) < 0)
437 return r;
438 len = olen;
439 /* Refuse negative (MSB set) bignums */
440 if ((len != 0 && (*d & 0x80) != 0))
441 return SSH_ERR_BIGNUM_IS_NEGATIVE;
442 /* Refuse overlong bignums, allow prepended \0 to avoid MSB set */
443 if (len > SSHBUF_MAX_BIGNUM + 1 ||
444 (len == SSHBUF_MAX_BIGNUM + 1 && *d != 0))
445 return SSH_ERR_BIGNUM_TOO_LARGE;
446 /* Trim leading zeros */
447 while (len > 0 && *d == 0x00) {
448 d++;
449 len--;
450 }
451 if (valp != 0)
452 *valp = d;
453 if (lenp != NULL)
454 *lenp = len;
455 if (sshbuf_consume(buf, olen + 4) != 0) {
456 /* Shouldn't happen */
457 SSHBUF_DBG(("SSH_ERR_INTERNAL_ERROR"));
458 SSHBUF_ABORT();
459 return SSH_ERR_INTERNAL_ERROR;
460 }
420 return 0; 461 return 0;
421} 462}
diff --git a/sshbuf-getput-crypto.c b/sshbuf-getput-crypto.c
index 74351d3e5..e2e093c00 100644
--- a/sshbuf-getput-crypto.c
+++ b/sshbuf-getput-crypto.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf-getput-crypto.c,v 1.2 2014/06/18 15:42:09 naddy Exp $ */ 1/* $OpenBSD: sshbuf-getput-crypto.c,v 1.4 2015/01/14 15:02:39 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -38,24 +38,10 @@ sshbuf_get_bignum2(struct sshbuf *buf, BIGNUM *v)
38 size_t len; 38 size_t len;
39 int r; 39 int r;
40 40
41 if ((r = sshbuf_peek_string_direct(buf, &d, &len)) < 0) 41 if ((r = sshbuf_get_bignum2_bytes_direct(buf, &d, &len)) != 0)
42 return r; 42 return r;
43 /* Refuse negative (MSB set) bignums */
44 if ((len != 0 && (*d & 0x80) != 0))
45 return SSH_ERR_BIGNUM_IS_NEGATIVE;
46 /* Refuse overlong bignums, allow prepended \0 to avoid MSB set */
47 if (len > SSHBUF_MAX_BIGNUM + 1 ||
48 (len == SSHBUF_MAX_BIGNUM + 1 && *d != 0))
49 return SSH_ERR_BIGNUM_TOO_LARGE;
50 if (v != NULL && BN_bin2bn(d, len, v) == NULL) 43 if (v != NULL && BN_bin2bn(d, len, v) == NULL)
51 return SSH_ERR_ALLOC_FAIL; 44 return SSH_ERR_ALLOC_FAIL;
52 /* Consume the string */
53 if (sshbuf_get_string_direct(buf, NULL, NULL) != 0) {
54 /* Shouldn't happen */
55 SSHBUF_DBG(("SSH_ERR_INTERNAL_ERROR"));
56 SSHBUF_ABORT();
57 return SSH_ERR_INTERNAL_ERROR;
58 }
59 return 0; 45 return 0;
60} 46}
61 47
@@ -195,7 +181,8 @@ sshbuf_put_bignum1(struct sshbuf *buf, const BIGNUM *v)
195 return r; 181 return r;
196 } 182 }
197 POKE_U16(dp, len_bits); 183 POKE_U16(dp, len_bits);
198 memcpy(dp + 2, d, len_bytes); 184 if (len_bytes != 0)
185 memcpy(dp + 2, d, len_bytes);
199 bzero(d, sizeof(d)); 186 bzero(d, sizeof(d));
200 return 0; 187 return 0;
201} 188}
diff --git a/sshbuf-misc.c b/sshbuf-misc.c
index bfeffe674..f1c2d03c9 100644
--- a/sshbuf-misc.c
+++ b/sshbuf-misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf-misc.c,v 1.2 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: sshbuf-misc.c,v 1.3 2015/02/05 12:59:57 millert Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -22,6 +22,9 @@
22#include <netinet/in.h> 22#include <netinet/in.h>
23#include <errno.h> 23#include <errno.h>
24#include <stdlib.h> 24#include <stdlib.h>
25#ifdef HAVE_STDINT_H
26#include <stdint.h>
27#endif
25#include <stdio.h> 28#include <stdio.h>
26#include <limits.h> 29#include <limits.h>
27#include <string.h> 30#include <string.h>
diff --git a/sshbuf.c b/sshbuf.c
index 78f5340a1..dbe0c9192 100644
--- a/sshbuf.c
+++ b/sshbuf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf.c,v 1.2 2014/06/25 14:16:09 deraadt Exp $ */ 1/* $OpenBSD: sshbuf.c,v 1.3 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -18,8 +18,8 @@
18#define SSHBUF_INTERNAL 18#define SSHBUF_INTERNAL
19#include "includes.h" 19#include "includes.h"
20 20
21#include <sys/param.h> /* roundup */
21#include <sys/types.h> 22#include <sys/types.h>
22#include <sys/param.h>
23#include <signal.h> 23#include <signal.h>
24#include <stdlib.h> 24#include <stdlib.h>
25#include <stdio.h> 25#include <stdio.h>
diff --git a/sshbuf.h b/sshbuf.h
index 3602bc53f..eb0d92e10 100644
--- a/sshbuf.h
+++ b/sshbuf.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf.h,v 1.3 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: sshbuf.h,v 1.4 2015/01/14 15:02:39 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -209,6 +209,8 @@ int sshbuf_peek_string_direct(const struct sshbuf *buf, const u_char **valp,
209 * curve points. 209 * curve points.
210 */ 210 */
211int sshbuf_put_bignum2_bytes(struct sshbuf *buf, const void *v, size_t len); 211int sshbuf_put_bignum2_bytes(struct sshbuf *buf, const void *v, size_t len);
212int sshbuf_get_bignum2_bytes_direct(struct sshbuf *buf,
213 const u_char **valp, size_t *lenp);
212#ifdef WITH_OPENSSL 214#ifdef WITH_OPENSSL
213int sshbuf_get_bignum2(struct sshbuf *buf, BIGNUM *v); 215int sshbuf_get_bignum2(struct sshbuf *buf, BIGNUM *v);
214int sshbuf_get_bignum1(struct sshbuf *buf, BIGNUM *v); 216int sshbuf_get_bignum1(struct sshbuf *buf, BIGNUM *v);
diff --git a/sshconnect.c b/sshconnect.c
index ac09eae67..9e515066d 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.251 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.259 2015/01/28 22:36:00 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -15,6 +15,7 @@
15 15
16#include "includes.h" 16#include "includes.h"
17 17
18#include <sys/param.h> /* roundup */
18#include <sys/types.h> 19#include <sys/types.h>
19#include <sys/wait.h> 20#include <sys/wait.h>
20#include <sys/stat.h> 21#include <sys/stat.h>
@@ -62,6 +63,8 @@
62#include "monitor_fdpass.h" 63#include "monitor_fdpass.h"
63#include "ssh2.h" 64#include "ssh2.h"
64#include "version.h" 65#include "version.h"
66#include "authfile.h"
67#include "ssherr.h"
65 68
66char *client_version_string = NULL; 69char *client_version_string = NULL;
67char *server_version_string = NULL; 70char *server_version_string = NULL;
@@ -625,7 +628,7 @@ ssh_exchange_identification(int timeout_ms)
625 debug("Remote protocol version %d.%d, remote software version %.100s", 628 debug("Remote protocol version %d.%d, remote software version %.100s",
626 remote_major, remote_minor, remote_version); 629 remote_major, remote_minor, remote_version);
627 630
628 compat_datafellows(remote_version); 631 active_state->compat = compat_datafellows(remote_version);
629 mismatch = 0; 632 mismatch = 0;
630 633
631 switch (remote_major) { 634 switch (remote_major) {
@@ -767,7 +770,7 @@ get_hostfile_hostname_ipaddr(char *hostname, struct sockaddr *hostaddr,
767 if (options.proxy_command == NULL) { 770 if (options.proxy_command == NULL) {
768 if (getnameinfo(hostaddr, addrlen, 771 if (getnameinfo(hostaddr, addrlen,
769 ntop, sizeof(ntop), NULL, 0, NI_NUMERICHOST) != 0) 772 ntop, sizeof(ntop), NULL, 0, NI_NUMERICHOST) != 0)
770 fatal("check_host_key: getnameinfo failed"); 773 fatal("%s: getnameinfo failed", __func__);
771 *hostfile_ipaddr = put_host_port(ntop, port); 774 *hostfile_ipaddr = put_host_port(ntop, port);
772 } else { 775 } else {
773 *hostfile_ipaddr = xstrdup("<no hostip for proxy " 776 *hostfile_ipaddr = xstrdup("<no hostip for proxy "
@@ -815,6 +818,7 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
815 int len, cancelled_forwarding = 0; 818 int len, cancelled_forwarding = 0;
816 int local = sockaddr_is_local(hostaddr); 819 int local = sockaddr_is_local(hostaddr);
817 int r, want_cert = key_is_cert(host_key), host_ip_differ = 0; 820 int r, want_cert = key_is_cert(host_key), host_ip_differ = 0;
821 int hostkey_trusted = 0; /* Known or explicitly accepted by user */
818 struct hostkeys *host_hostkeys, *ip_hostkeys; 822 struct hostkeys *host_hostkeys, *ip_hostkeys;
819 u_int i; 823 u_int i;
820 824
@@ -915,13 +919,17 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
915 "key for IP address '%.128s' to the list " 919 "key for IP address '%.128s' to the list "
916 "of known hosts.", type, ip); 920 "of known hosts.", type, ip);
917 } else if (options.visual_host_key) { 921 } else if (options.visual_host_key) {
918 fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); 922 fp = sshkey_fingerprint(host_key,
919 ra = key_fingerprint(host_key, SSH_FP_MD5, 923 options.fingerprint_hash, SSH_FP_DEFAULT);
920 SSH_FP_RANDOMART); 924 ra = sshkey_fingerprint(host_key,
925 options.fingerprint_hash, SSH_FP_RANDOMART);
926 if (fp == NULL || ra == NULL)
927 fatal("%s: sshkey_fingerprint fail", __func__);
921 logit("Host key fingerprint is %s\n%s\n", fp, ra); 928 logit("Host key fingerprint is %s\n%s\n", fp, ra);
922 free(ra); 929 free(ra);
923 free(fp); 930 free(fp);
924 } 931 }
932 hostkey_trusted = 1;
925 break; 933 break;
926 case HOST_NEW: 934 case HOST_NEW:
927 if (options.host_key_alias == NULL && port != 0 && 935 if (options.host_key_alias == NULL && port != 0 &&
@@ -956,9 +964,12 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
956 else 964 else
957 snprintf(msg1, sizeof(msg1), "."); 965 snprintf(msg1, sizeof(msg1), ".");
958 /* The default */ 966 /* The default */
959 fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); 967 fp = sshkey_fingerprint(host_key,
960 ra = key_fingerprint(host_key, SSH_FP_MD5, 968 options.fingerprint_hash, SSH_FP_DEFAULT);
961 SSH_FP_RANDOMART); 969 ra = sshkey_fingerprint(host_key,
970 options.fingerprint_hash, SSH_FP_RANDOMART);
971 if (fp == NULL || ra == NULL)
972 fatal("%s: sshkey_fingerprint fail", __func__);
962 msg2[0] = '\0'; 973 msg2[0] = '\0';
963 if (options.verify_host_key_dns) { 974 if (options.verify_host_key_dns) {
964 if (matching_host_key_dns) 975 if (matching_host_key_dns)
@@ -984,6 +995,7 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
984 free(fp); 995 free(fp);
985 if (!confirm(msg)) 996 if (!confirm(msg))
986 goto fail; 997 goto fail;
998 hostkey_trusted = 1; /* user explicitly confirmed */
987 } 999 }
988 /* 1000 /*
989 * If not in strict mode, add the key automatically to the 1001 * If not in strict mode, add the key automatically to the
@@ -1182,6 +1194,12 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
1182 } 1194 }
1183 } 1195 }
1184 1196
1197 if (!hostkey_trusted && options.update_hostkeys) {
1198 debug("%s: hostkey not known or explicitly trusted: "
1199 "disabling UpdateHostkeys", __func__);
1200 options.update_hostkeys = 0;
1201 }
1202
1185 free(ip); 1203 free(ip);
1186 free(host); 1204 free(host);
1187 if (host_hostkeys != NULL) 1205 if (host_hostkeys != NULL)
@@ -1219,16 +1237,45 @@ int
1219verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key) 1237verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key)
1220{ 1238{
1221 int r = -1, flags = 0; 1239 int r = -1, flags = 0;
1222 char *fp; 1240 char *fp = NULL;
1223 Key *plain = NULL; 1241 struct sshkey *plain = NULL;
1242
1243 if ((fp = sshkey_fingerprint(host_key,
1244 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL) {
1245 error("%s: fingerprint host key: %s", __func__, ssh_err(r));
1246 r = -1;
1247 goto out;
1248 }
1224 1249
1225 fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); 1250 debug("Server host key: %s %s",
1226 debug("Server host key: %s %s", key_type(host_key), fp); 1251 compat20 ? sshkey_ssh_name(host_key) : sshkey_type(host_key), fp);
1227 free(fp);
1228 1252
1229 if (key_equal(previous_host_key, host_key)) { 1253 if (sshkey_equal(previous_host_key, host_key)) {
1230 debug("%s: server host key matches cached key", __func__); 1254 debug2("%s: server host key %s %s matches cached key",
1231 return 0; 1255 __func__, sshkey_type(host_key), fp);
1256 r = 0;
1257 goto out;
1258 }
1259
1260 /* Check in RevokedHostKeys file if specified */
1261 if (options.revoked_host_keys != NULL) {
1262 r = sshkey_check_revoked(host_key, options.revoked_host_keys);
1263 switch (r) {
1264 case 0:
1265 break; /* not revoked */
1266 case SSH_ERR_KEY_REVOKED:
1267 error("Host key %s %s revoked by file %s",
1268 sshkey_type(host_key), fp,
1269 options.revoked_host_keys);
1270 r = -1;
1271 goto out;
1272 default:
1273 error("Error checking host key %s %s in "
1274 "revoked keys file %s: %s", sshkey_type(host_key),
1275 fp, options.revoked_host_keys, ssh_err(r));
1276 r = -1;
1277 goto out;
1278 }
1232 } 1279 }
1233 1280
1234 if (options.verify_host_key_dns) { 1281 if (options.verify_host_key_dns) {
@@ -1236,17 +1283,17 @@ verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key)
1236 * XXX certs are not yet supported for DNS, so downgrade 1283 * XXX certs are not yet supported for DNS, so downgrade
1237 * them and try the plain key. 1284 * them and try the plain key.
1238 */ 1285 */
1239 plain = key_from_private(host_key); 1286 if ((r = sshkey_from_private(host_key, &plain)) != 0)
1240 if (key_is_cert(plain)) 1287 goto out;
1241 key_drop_cert(plain); 1288 if (sshkey_is_cert(plain))
1289 sshkey_drop_cert(plain);
1242 if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { 1290 if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) {
1243 if (flags & DNS_VERIFY_FOUND) { 1291 if (flags & DNS_VERIFY_FOUND) {
1244 if (options.verify_host_key_dns == 1 && 1292 if (options.verify_host_key_dns == 1 &&
1245 flags & DNS_VERIFY_MATCH && 1293 flags & DNS_VERIFY_MATCH &&
1246 flags & DNS_VERIFY_SECURE) { 1294 flags & DNS_VERIFY_SECURE) {
1247 key_free(plain);
1248 r = 0; 1295 r = 0;
1249 goto done; 1296 goto out;
1250 } 1297 }
1251 if (flags & DNS_VERIFY_MATCH) { 1298 if (flags & DNS_VERIFY_MATCH) {
1252 matching_host_key_dns = 1; 1299 matching_host_key_dns = 1;
@@ -1258,14 +1305,14 @@ verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key)
1258 } 1305 }
1259 } 1306 }
1260 } 1307 }
1261 key_free(plain);
1262 } 1308 }
1263
1264 r = check_host_key(host, hostaddr, options.port, host_key, RDRW, 1309 r = check_host_key(host, hostaddr, options.port, host_key, RDRW,
1265 options.user_hostfiles, options.num_user_hostfiles, 1310 options.user_hostfiles, options.num_user_hostfiles,
1266 options.system_hostfiles, options.num_system_hostfiles); 1311 options.system_hostfiles, options.num_system_hostfiles);
1267 1312
1268done: 1313out:
1314 sshkey_free(plain);
1315 free(fp);
1269 if (r == 0 && host_key != NULL) { 1316 if (r == 0 && host_key != NULL) {
1270 key_free(previous_host_key); 1317 key_free(previous_host_key);
1271 previous_host_key = key_from_private(host_key); 1318 previous_host_key = key_from_private(host_key);
@@ -1356,8 +1403,12 @@ show_other_keys(struct hostkeys *hostkeys, Key *key)
1356 continue; 1403 continue;
1357 if (!lookup_key_in_hostkeys_by_type(hostkeys, type[i], &found)) 1404 if (!lookup_key_in_hostkeys_by_type(hostkeys, type[i], &found))
1358 continue; 1405 continue;
1359 fp = key_fingerprint(found->key, SSH_FP_MD5, SSH_FP_HEX); 1406 fp = sshkey_fingerprint(found->key,
1360 ra = key_fingerprint(found->key, SSH_FP_MD5, SSH_FP_RANDOMART); 1407 options.fingerprint_hash, SSH_FP_DEFAULT);
1408 ra = sshkey_fingerprint(found->key,
1409 options.fingerprint_hash, SSH_FP_RANDOMART);
1410 if (fp == NULL || ra == NULL)
1411 fatal("%s: sshkey_fingerprint fail", __func__);
1361 logit("WARNING: %s key found for host %s\n" 1412 logit("WARNING: %s key found for host %s\n"
1362 "in %s:%lu\n" 1413 "in %s:%lu\n"
1363 "%s key fingerprint %s.", 1414 "%s key fingerprint %s.",
@@ -1378,7 +1429,10 @@ warn_changed_key(Key *host_key)
1378{ 1429{
1379 char *fp; 1430 char *fp;
1380 1431
1381 fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); 1432 fp = sshkey_fingerprint(host_key, options.fingerprint_hash,
1433 SSH_FP_DEFAULT);
1434 if (fp == NULL)
1435 fatal("%s: sshkey_fingerprint fail", __func__);
1382 1436
1383 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); 1437 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
1384 error("@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @"); 1438 error("@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @");
diff --git a/sshconnect1.c b/sshconnect1.c
index dd12a3af2..016abbce5 100644
--- a/sshconnect1.c
+++ b/sshconnect1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect1.c,v 1.76 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: sshconnect1.c,v 1.77 2015/01/14 20:05:27 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -15,11 +15,14 @@
15 15
16#include "includes.h" 16#include "includes.h"
17 17
18#ifdef WITH_SSH1
19
18#include <sys/types.h> 20#include <sys/types.h>
19#include <sys/socket.h> 21#include <sys/socket.h>
20 22
21#include <openssl/bn.h> 23#include <openssl/bn.h>
22 24
25#include <errno.h>
23#include <stdarg.h> 26#include <stdarg.h>
24#include <stdio.h> 27#include <stdio.h>
25#include <stdlib.h> 28#include <stdlib.h>
@@ -47,6 +50,7 @@
47#include "hostfile.h" 50#include "hostfile.h"
48#include "auth.h" 51#include "auth.h"
49#include "digest.h" 52#include "digest.h"
53#include "ssherr.h"
50 54
51/* Session id for the current session. */ 55/* Session id for the current session. */
52u_char session_id[16]; 56u_char session_id[16];
@@ -62,33 +66,38 @@ extern char *__progname;
62static int 66static int
63try_agent_authentication(void) 67try_agent_authentication(void)
64{ 68{
65 int type; 69 int r, type, agent_fd, ret = 0;
66 char *comment;
67 AuthenticationConnection *auth;
68 u_char response[16]; 70 u_char response[16];
69 u_int i; 71 size_t i;
70 Key *key;
71 BIGNUM *challenge; 72 BIGNUM *challenge;
73 struct ssh_identitylist *idlist = NULL;
72 74
73 /* Get connection to the agent. */ 75 /* Get connection to the agent. */
74 auth = ssh_get_authentication_connection(); 76 if ((r = ssh_get_authentication_socket(&agent_fd)) != 0) {
75 if (!auth) 77 if (r != SSH_ERR_AGENT_NOT_PRESENT)
78 debug("%s: ssh_get_authentication_socket: %s",
79 __func__, ssh_err(r));
76 return 0; 80 return 0;
81 }
77 82
78 if ((challenge = BN_new()) == NULL) 83 if ((challenge = BN_new()) == NULL)
79 fatal("try_agent_authentication: BN_new failed"); 84 fatal("try_agent_authentication: BN_new failed");
80 /* Loop through identities served by the agent. */
81 for (key = ssh_get_first_identity(auth, &comment, 1);
82 key != NULL;
83 key = ssh_get_next_identity(auth, &comment, 1)) {
84 85
86 /* Loop through identities served by the agent. */
87 if ((r = ssh_fetch_identitylist(agent_fd, 1, &idlist)) != 0) {
88 if (r != SSH_ERR_AGENT_NO_IDENTITIES)
89 debug("%s: ssh_fetch_identitylist: %s",
90 __func__, ssh_err(r));
91 goto out;
92 }
93 for (i = 0; i < idlist->nkeys; i++) {
85 /* Try this identity. */ 94 /* Try this identity. */
86 debug("Trying RSA authentication via agent with '%.100s'", comment); 95 debug("Trying RSA authentication via agent with '%.100s'",
87 free(comment); 96 idlist->comments[i]);
88 97
89 /* Tell the server that we are willing to authenticate using this key. */ 98 /* Tell the server that we are willing to authenticate using this key. */
90 packet_start(SSH_CMSG_AUTH_RSA); 99 packet_start(SSH_CMSG_AUTH_RSA);
91 packet_put_bignum(key->rsa->n); 100 packet_put_bignum(idlist->keys[i]->rsa->n);
92 packet_send(); 101 packet_send();
93 packet_write_wait(); 102 packet_write_wait();
94 103
@@ -99,7 +108,6 @@ try_agent_authentication(void)
99 does not support RSA authentication. */ 108 does not support RSA authentication. */
100 if (type == SSH_SMSG_FAILURE) { 109 if (type == SSH_SMSG_FAILURE) {
101 debug("Server refused our key."); 110 debug("Server refused our key.");
102 key_free(key);
103 continue; 111 continue;
104 } 112 }
105 /* Otherwise it should have sent a challenge. */ 113 /* Otherwise it should have sent a challenge. */
@@ -113,16 +121,17 @@ try_agent_authentication(void)
113 debug("Received RSA challenge from server."); 121 debug("Received RSA challenge from server.");
114 122
115 /* Ask the agent to decrypt the challenge. */ 123 /* Ask the agent to decrypt the challenge. */
116 if (!ssh_decrypt_challenge(auth, key, challenge, session_id, 1, response)) { 124 if ((r = ssh_decrypt_challenge(agent_fd, idlist->keys[i],
125 challenge, session_id, response)) != 0) {
117 /* 126 /*
118 * The agent failed to authenticate this identifier 127 * The agent failed to authenticate this identifier
119 * although it advertised it supports this. Just 128 * although it advertised it supports this. Just
120 * return a wrong value. 129 * return a wrong value.
121 */ 130 */
122 logit("Authentication agent failed to decrypt challenge."); 131 logit("Authentication agent failed to decrypt "
132 "challenge: %s", ssh_err(r));
123 explicit_bzero(response, sizeof(response)); 133 explicit_bzero(response, sizeof(response));
124 } 134 }
125 key_free(key);
126 debug("Sending response to RSA challenge."); 135 debug("Sending response to RSA challenge.");
127 136
128 /* Send the decrypted challenge back to the server. */ 137 /* Send the decrypted challenge back to the server. */
@@ -135,22 +144,25 @@ try_agent_authentication(void)
135 /* Wait for response from the server. */ 144 /* Wait for response from the server. */
136 type = packet_read(); 145 type = packet_read();
137 146
138 /* The server returns success if it accepted the authentication. */ 147 /*
148 * The server returns success if it accepted the
149 * authentication.
150 */
139 if (type == SSH_SMSG_SUCCESS) { 151 if (type == SSH_SMSG_SUCCESS) {
140 ssh_close_authentication_connection(auth);
141 BN_clear_free(challenge);
142 debug("RSA authentication accepted by server."); 152 debug("RSA authentication accepted by server.");
143 return 1; 153 ret = 1;
144 } 154 break;
145 /* Otherwise it should return failure. */ 155 } else if (type != SSH_SMSG_FAILURE)
146 if (type != SSH_SMSG_FAILURE) 156 packet_disconnect("Protocol error waiting RSA auth "
147 packet_disconnect("Protocol error waiting RSA auth response: %d", 157 "response: %d", type);
148 type);
149 } 158 }
150 ssh_close_authentication_connection(auth); 159 if (ret != 1)
160 debug("RSA authentication using agent refused.");
161 out:
162 ssh_free_identitylist(idlist);
163 ssh_close_authentication_socket(agent_fd);
151 BN_clear_free(challenge); 164 BN_clear_free(challenge);
152 debug("RSA authentication using agent refused."); 165 return ret;
153 return 0;
154} 166}
155 167
156/* 168/*
@@ -755,3 +767,5 @@ ssh_userauth1(const char *local_user, const char *server_user, char *host,
755 success: 767 success:
756 return; /* need statement after label */ 768 return; /* need statement after label */
757} 769}
770
771#endif /* WITH_SSH1 */
diff --git a/sshconnect2.c b/sshconnect2.c
index 68f7f4fdd..ba56f6433 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect2.c,v 1.210 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: sshconnect2.c,v 1.223 2015/01/30 11:43:14 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Damien Miller. All rights reserved. 4 * Copyright (c) 2008 Damien Miller. All rights reserved.
@@ -70,6 +70,7 @@
70#include "pathnames.h" 70#include "pathnames.h"
71#include "uidswap.h" 71#include "uidswap.h"
72#include "hostfile.h" 72#include "hostfile.h"
73#include "ssherr.h"
73 74
74#ifdef GSSAPI 75#ifdef GSSAPI
75#include "ssh-gss.h" 76#include "ssh-gss.h"
@@ -90,10 +91,8 @@ u_int session_id2_len = 0;
90char *xxx_host; 91char *xxx_host;
91struct sockaddr *xxx_hostaddr; 92struct sockaddr *xxx_hostaddr;
92 93
93Kex *xxx_kex = NULL;
94
95static int 94static int
96verify_host_key_callback(Key *hostkey) 95verify_host_key_callback(Key *hostkey, struct ssh *ssh)
97{ 96{
98 if (verify_host_key(xxx_host, xxx_hostaddr, hostkey) == -1) 97 if (verify_host_key(xxx_host, xxx_hostaddr, hostkey) == -1)
99 fatal("Host key verification failed."); 98 fatal("Host key verification failed.");
@@ -131,16 +130,17 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port)
131 } while (0) 130 } while (0)
132 131
133 while ((alg = strsep(&avail, ",")) && *alg != '\0') { 132 while ((alg = strsep(&avail, ",")) && *alg != '\0') {
134 if ((ktype = key_type_from_name(alg)) == KEY_UNSPEC) 133 if ((ktype = sshkey_type_from_name(alg)) == KEY_UNSPEC)
135 fatal("%s: unknown alg %s", __func__, alg); 134 fatal("%s: unknown alg %s", __func__, alg);
136 if (lookup_key_in_hostkeys_by_type(hostkeys, 135 if (lookup_key_in_hostkeys_by_type(hostkeys,
137 key_type_plain(ktype), NULL)) 136 sshkey_type_plain(ktype), NULL))
138 ALG_APPEND(first, alg); 137 ALG_APPEND(first, alg);
139 else 138 else
140 ALG_APPEND(last, alg); 139 ALG_APPEND(last, alg);
141 } 140 }
142#undef ALG_APPEND 141#undef ALG_APPEND
143 xasprintf(&ret, "%s%s%s", first, *first == '\0' ? "" : ",", last); 142 xasprintf(&ret, "%s%s%s", first,
143 (*first == '\0' || *last == '\0') ? "" : ",", last);
144 if (*first != '\0') 144 if (*first != '\0')
145 debug3("%s: prefer hostkeyalgs: %s", __func__, first); 145 debug3("%s: prefer hostkeyalgs: %s", __func__, first);
146 146
@@ -157,7 +157,8 @@ void
157ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) 157ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
158{ 158{
159 char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT }; 159 char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT };
160 Kex *kex; 160 struct kex *kex;
161 int r;
161 162
162 xxx_host = host; 163 xxx_host = host;
163 xxx_hostaddr = hostaddr; 164 xxx_hostaddr = hostaddr;
@@ -204,22 +205,24 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
204 (time_t)options.rekey_interval); 205 (time_t)options.rekey_interval);
205 206
206 /* start key exchange */ 207 /* start key exchange */
207 kex = kex_setup(myproposal); 208 if ((r = kex_setup(active_state, myproposal)) != 0)
209 fatal("kex_setup: %s", ssh_err(r));
210 kex = active_state->kex;
208#ifdef WITH_OPENSSL 211#ifdef WITH_OPENSSL
209 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; 212 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client;
210 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; 213 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client;
211 kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; 214 kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;
212 kex->kex[KEX_DH_GEX_SHA256] = kexgex_client; 215 kex->kex[KEX_DH_GEX_SHA256] = kexgex_client;
216# ifdef OPENSSL_HAS_ECC
213 kex->kex[KEX_ECDH_SHA2] = kexecdh_client; 217 kex->kex[KEX_ECDH_SHA2] = kexecdh_client;
218# endif
214#endif 219#endif
215 kex->kex[KEX_C25519_SHA256] = kexc25519_client; 220 kex->kex[KEX_C25519_SHA256] = kexc25519_client;
216 kex->client_version_string=client_version_string; 221 kex->client_version_string=client_version_string;
217 kex->server_version_string=server_version_string; 222 kex->server_version_string=server_version_string;
218 kex->verify_host_key=&verify_host_key_callback; 223 kex->verify_host_key=&verify_host_key_callback;
219 224
220 xxx_kex = kex; 225 dispatch_run(DISPATCH_BLOCK, &kex->done, active_state);
221
222 dispatch_run(DISPATCH_BLOCK, &kex->done, kex);
223 226
224 if (options.use_roaming && !kex->roaming) { 227 if (options.use_roaming && !kex->roaming) {
225 debug("Roaming not allowed by server"); 228 debug("Roaming not allowed by server");
@@ -242,15 +245,15 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
242 * Authenticate user 245 * Authenticate user
243 */ 246 */
244 247
245typedef struct Authctxt Authctxt; 248typedef struct cauthctxt Authctxt;
246typedef struct Authmethod Authmethod; 249typedef struct cauthmethod Authmethod;
247typedef struct identity Identity; 250typedef struct identity Identity;
248typedef struct idlist Idlist; 251typedef struct idlist Idlist;
249 252
250struct identity { 253struct identity {
251 TAILQ_ENTRY(identity) next; 254 TAILQ_ENTRY(identity) next;
252 AuthenticationConnection *ac; /* set if agent supports key */ 255 int agent_fd; /* >=0 if agent supports key */
253 Key *key; /* public/private key */ 256 struct sshkey *key; /* public/private key */
254 char *filename; /* comment for agent-only keys */ 257 char *filename; /* comment for agent-only keys */
255 int tried; 258 int tried;
256 int isprivate; /* key points to the private key */ 259 int isprivate; /* key points to the private key */
@@ -258,25 +261,29 @@ struct identity {
258}; 261};
259TAILQ_HEAD(idlist, identity); 262TAILQ_HEAD(idlist, identity);
260 263
261struct Authctxt { 264struct cauthctxt {
262 const char *server_user; 265 const char *server_user;
263 const char *local_user; 266 const char *local_user;
264 const char *host; 267 const char *host;
265 const char *service; 268 const char *service;
266 Authmethod *method; 269 struct cauthmethod *method;
267 sig_atomic_t success; 270 sig_atomic_t success;
268 char *authlist; 271 char *authlist;
272 int attempt;
269 /* pubkey */ 273 /* pubkey */
270 Idlist keys; 274 struct idlist keys;
271 AuthenticationConnection *agent; 275 int agent_fd;
272 /* hostbased */ 276 /* hostbased */
273 Sensitive *sensitive; 277 Sensitive *sensitive;
278 char *oktypes, *ktypes;
279 const char *active_ktype;
274 /* kbd-interactive */ 280 /* kbd-interactive */
275 int info_req_seen; 281 int info_req_seen;
276 /* generic */ 282 /* generic */
277 void *methoddata; 283 void *methoddata;
278}; 284};
279struct Authmethod { 285
286struct cauthmethod {
280 char *name; /* string to compare against server's list */ 287 char *name; /* string to compare against server's list */
281 int (*userauth)(Authctxt *authctxt); 288 int (*userauth)(Authctxt *authctxt);
282 void (*cleanup)(Authctxt *authctxt); 289 void (*cleanup)(Authctxt *authctxt);
@@ -284,14 +291,14 @@ struct Authmethod {
284 int *batch_flag; /* flag in option struct that disables method */ 291 int *batch_flag; /* flag in option struct that disables method */
285}; 292};
286 293
287void input_userauth_success(int, u_int32_t, void *); 294int input_userauth_success(int, u_int32_t, void *);
288void input_userauth_success_unexpected(int, u_int32_t, void *); 295int input_userauth_success_unexpected(int, u_int32_t, void *);
289void input_userauth_failure(int, u_int32_t, void *); 296int input_userauth_failure(int, u_int32_t, void *);
290void input_userauth_banner(int, u_int32_t, void *); 297int input_userauth_banner(int, u_int32_t, void *);
291void input_userauth_error(int, u_int32_t, void *); 298int input_userauth_error(int, u_int32_t, void *);
292void input_userauth_info_req(int, u_int32_t, void *); 299int input_userauth_info_req(int, u_int32_t, void *);
293void input_userauth_pk_ok(int, u_int32_t, void *); 300int input_userauth_pk_ok(int, u_int32_t, void *);
294void input_userauth_passwd_changereq(int, u_int32_t, void *); 301int input_userauth_passwd_changereq(int, u_int32_t, void *);
295 302
296int userauth_none(Authctxt *); 303int userauth_none(Authctxt *);
297int userauth_pubkey(Authctxt *); 304int userauth_pubkey(Authctxt *);
@@ -301,11 +308,11 @@ int userauth_hostbased(Authctxt *);
301 308
302#ifdef GSSAPI 309#ifdef GSSAPI
303int userauth_gssapi(Authctxt *authctxt); 310int userauth_gssapi(Authctxt *authctxt);
304void input_gssapi_response(int type, u_int32_t, void *); 311int input_gssapi_response(int type, u_int32_t, void *);
305void input_gssapi_token(int type, u_int32_t, void *); 312int input_gssapi_token(int type, u_int32_t, void *);
306void input_gssapi_hash(int type, u_int32_t, void *); 313int input_gssapi_hash(int type, u_int32_t, void *);
307void input_gssapi_error(int, u_int32_t, void *); 314int input_gssapi_error(int, u_int32_t, void *);
308void input_gssapi_errtok(int, u_int32_t, void *); 315int input_gssapi_errtok(int, u_int32_t, void *);
309#endif 316#endif
310 317
311void userauth(Authctxt *, char *); 318void userauth(Authctxt *, char *);
@@ -398,7 +405,9 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host,
398 authctxt.authlist = NULL; 405 authctxt.authlist = NULL;
399 authctxt.methoddata = NULL; 406 authctxt.methoddata = NULL;
400 authctxt.sensitive = sensitive; 407 authctxt.sensitive = sensitive;
408 authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL;
401 authctxt.info_req_seen = 0; 409 authctxt.info_req_seen = 0;
410 authctxt.agent_fd = -1;
402 if (authctxt.method == NULL) 411 if (authctxt.method == NULL)
403 fatal("ssh_userauth2: internal error: cannot send userauth none request"); 412 fatal("ssh_userauth2: internal error: cannot send userauth none request");
404 413
@@ -453,15 +462,16 @@ userauth(Authctxt *authctxt, char *authlist)
453} 462}
454 463
455/* ARGSUSED */ 464/* ARGSUSED */
456void 465int
457input_userauth_error(int type, u_int32_t seq, void *ctxt) 466input_userauth_error(int type, u_int32_t seq, void *ctxt)
458{ 467{
459 fatal("input_userauth_error: bad message during authentication: " 468 fatal("input_userauth_error: bad message during authentication: "
460 "type %d", type); 469 "type %d", type);
470 return 0;
461} 471}
462 472
463/* ARGSUSED */ 473/* ARGSUSED */
464void 474int
465input_userauth_banner(int type, u_int32_t seq, void *ctxt) 475input_userauth_banner(int type, u_int32_t seq, void *ctxt)
466{ 476{
467 char *msg, *raw, *lang; 477 char *msg, *raw, *lang;
@@ -480,10 +490,11 @@ input_userauth_banner(int type, u_int32_t seq, void *ctxt)
480 } 490 }
481 free(raw); 491 free(raw);
482 free(lang); 492 free(lang);
493 return 0;
483} 494}
484 495
485/* ARGSUSED */ 496/* ARGSUSED */
486void 497int
487input_userauth_success(int type, u_int32_t seq, void *ctxt) 498input_userauth_success(int type, u_int32_t seq, void *ctxt)
488{ 499{
489 Authctxt *authctxt = ctxt; 500 Authctxt *authctxt = ctxt;
@@ -497,9 +508,10 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt)
497 free(authctxt->methoddata); 508 free(authctxt->methoddata);
498 authctxt->methoddata = NULL; 509 authctxt->methoddata = NULL;
499 authctxt->success = 1; /* break out */ 510 authctxt->success = 1; /* break out */
511 return 0;
500} 512}
501 513
502void 514int
503input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) 515input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt)
504{ 516{
505 Authctxt *authctxt = ctxt; 517 Authctxt *authctxt = ctxt;
@@ -509,10 +521,11 @@ input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt)
509 521
510 fatal("Unexpected authentication success during %s.", 522 fatal("Unexpected authentication success during %s.",
511 authctxt->method->name); 523 authctxt->method->name);
524 return 0;
512} 525}
513 526
514/* ARGSUSED */ 527/* ARGSUSED */
515void 528int
516input_userauth_failure(int type, u_int32_t seq, void *ctxt) 529input_userauth_failure(int type, u_int32_t seq, void *ctxt)
517{ 530{
518 Authctxt *authctxt = ctxt; 531 Authctxt *authctxt = ctxt;
@@ -535,10 +548,11 @@ input_userauth_failure(int type, u_int32_t seq, void *ctxt)
535 debug("Authentications that can continue: %s", authlist); 548 debug("Authentications that can continue: %s", authlist);
536 549
537 userauth(authctxt, authlist); 550 userauth(authctxt, authlist);
551 return 0;
538} 552}
539 553
540/* ARGSUSED */ 554/* ARGSUSED */
541void 555int
542input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) 556input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
543{ 557{
544 Authctxt *authctxt = ctxt; 558 Authctxt *authctxt = ctxt;
@@ -582,7 +596,9 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
582 key->type, pktype); 596 key->type, pktype);
583 goto done; 597 goto done;
584 } 598 }
585 fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); 599 if ((fp = sshkey_fingerprint(key, options.fingerprint_hash,
600 SSH_FP_DEFAULT)) == NULL)
601 goto done;
586 debug2("input_userauth_pk_ok: fp %s", fp); 602 debug2("input_userauth_pk_ok: fp %s", fp);
587 free(fp); 603 free(fp);
588 604
@@ -606,6 +622,7 @@ done:
606 /* try another method if we did not send a packet */ 622 /* try another method if we did not send a packet */
607 if (sent == 0) 623 if (sent == 0)
608 userauth(authctxt, NULL); 624 userauth(authctxt, NULL);
625 return 0;
609} 626}
610 627
611#ifdef GSSAPI 628#ifdef GSSAPI
@@ -721,7 +738,7 @@ process_gssapi_token(void *ctxt, gss_buffer_t recv_tok)
721} 738}
722 739
723/* ARGSUSED */ 740/* ARGSUSED */
724void 741int
725input_gssapi_response(int type, u_int32_t plen, void *ctxt) 742input_gssapi_response(int type, u_int32_t plen, void *ctxt)
726{ 743{
727 Authctxt *authctxt = ctxt; 744 Authctxt *authctxt = ctxt;
@@ -742,7 +759,7 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt)
742 free(oidv); 759 free(oidv);
743 debug("Badly encoded mechanism OID received"); 760 debug("Badly encoded mechanism OID received");
744 userauth(authctxt, NULL); 761 userauth(authctxt, NULL);
745 return; 762 return 0;
746 } 763 }
747 764
748 if (!ssh_gssapi_check_oid(gssctxt, oidv + 2, oidlen - 2)) 765 if (!ssh_gssapi_check_oid(gssctxt, oidv + 2, oidlen - 2))
@@ -756,12 +773,13 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt)
756 /* Start again with next method on list */ 773 /* Start again with next method on list */
757 debug("Trying to start again"); 774 debug("Trying to start again");
758 userauth(authctxt, NULL); 775 userauth(authctxt, NULL);
759 return; 776 return 0;
760 } 777 }
778 return 0;
761} 779}
762 780
763/* ARGSUSED */ 781/* ARGSUSED */
764void 782int
765input_gssapi_token(int type, u_int32_t plen, void *ctxt) 783input_gssapi_token(int type, u_int32_t plen, void *ctxt)
766{ 784{
767 Authctxt *authctxt = ctxt; 785 Authctxt *authctxt = ctxt;
@@ -784,12 +802,13 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt)
784 if (GSS_ERROR(status)) { 802 if (GSS_ERROR(status)) {
785 /* Start again with the next method in the list */ 803 /* Start again with the next method in the list */
786 userauth(authctxt, NULL); 804 userauth(authctxt, NULL);
787 return; 805 return 0;
788 } 806 }
807 return 0;
789} 808}
790 809
791/* ARGSUSED */ 810/* ARGSUSED */
792void 811int
793input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) 812input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
794{ 813{
795 Authctxt *authctxt = ctxt; 814 Authctxt *authctxt = ctxt;
@@ -816,10 +835,11 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
816 gss_release_buffer(&ms, &send_tok); 835 gss_release_buffer(&ms, &send_tok);
817 836
818 /* Server will be returning a failed packet after this one */ 837 /* Server will be returning a failed packet after this one */
838 return 0;
819} 839}
820 840
821/* ARGSUSED */ 841/* ARGSUSED */
822void 842int
823input_gssapi_error(int type, u_int32_t plen, void *ctxt) 843input_gssapi_error(int type, u_int32_t plen, void *ctxt)
824{ 844{
825 char *msg; 845 char *msg;
@@ -835,6 +855,7 @@ input_gssapi_error(int type, u_int32_t plen, void *ctxt)
835 debug("Server GSSAPI Error:\n%s", msg); 855 debug("Server GSSAPI Error:\n%s", msg);
836 free(msg); 856 free(msg);
837 free(lang); 857 free(lang);
858 return 0;
838} 859}
839#endif /* GSSAPI */ 860#endif /* GSSAPI */
840 861
@@ -889,7 +910,7 @@ userauth_passwd(Authctxt *authctxt)
889 * parse PASSWD_CHANGEREQ, prompt user and send SSH2_MSG_USERAUTH_REQUEST 910 * parse PASSWD_CHANGEREQ, prompt user and send SSH2_MSG_USERAUTH_REQUEST
890 */ 911 */
891/* ARGSUSED */ 912/* ARGSUSED */
892void 913int
893input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) 914input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt)
894{ 915{
895 Authctxt *authctxt = ctxt; 916 Authctxt *authctxt = ctxt;
@@ -930,7 +951,7 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt)
930 password = read_passphrase(prompt, RP_ALLOW_EOF); 951 password = read_passphrase(prompt, RP_ALLOW_EOF);
931 if (password == NULL) { 952 if (password == NULL) {
932 /* bail out */ 953 /* bail out */
933 return; 954 return 0;
934 } 955 }
935 snprintf(prompt, sizeof(prompt), 956 snprintf(prompt, sizeof(prompt),
936 "Retype %.30s@%.128s's new password: ", 957 "Retype %.30s@%.128s's new password: ",
@@ -953,30 +974,33 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt)
953 974
954 dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, 975 dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ,
955 &input_userauth_passwd_changereq); 976 &input_userauth_passwd_changereq);
977 return 0;
956} 978}
957 979
958static int 980static int
959identity_sign(Identity *id, u_char **sigp, u_int *lenp, 981identity_sign(struct identity *id, u_char **sigp, size_t *lenp,
960 u_char *data, u_int datalen) 982 const u_char *data, size_t datalen, u_int compat)
961{ 983{
962 Key *prv; 984 Key *prv;
963 int ret; 985 int ret;
964 986
965 /* the agent supports this key */ 987 /* the agent supports this key */
966 if (id->ac) 988 if (id->agent_fd)
967 return (ssh_agent_sign(id->ac, id->key, sigp, lenp, 989 return ssh_agent_sign(id->agent_fd, id->key, sigp, lenp,
968 data, datalen)); 990 data, datalen, compat);
991
969 /* 992 /*
970 * we have already loaded the private key or 993 * we have already loaded the private key or
971 * the private key is stored in external hardware 994 * the private key is stored in external hardware
972 */ 995 */
973 if (id->isprivate || (id->key->flags & SSHKEY_FLAG_EXT)) 996 if (id->isprivate || (id->key->flags & SSHKEY_FLAG_EXT))
974 return (key_sign(id->key, sigp, lenp, data, datalen)); 997 return (sshkey_sign(id->key, sigp, lenp, data, datalen,
998 compat));
975 /* load the private key from the file */ 999 /* load the private key from the file */
976 if ((prv = load_identity_file(id->filename, id->userprovided)) == NULL) 1000 if ((prv = load_identity_file(id->filename, id->userprovided)) == NULL)
977 return (-1); 1001 return (-1); /* XXX return decent error code */
978 ret = key_sign(prv, sigp, lenp, data, datalen); 1002 ret = sshkey_sign(prv, sigp, lenp, data, datalen, compat);
979 key_free(prv); 1003 sshkey_free(prv);
980 return (ret); 1004 return (ret);
981} 1005}
982 1006
@@ -985,13 +1009,16 @@ sign_and_send_pubkey(Authctxt *authctxt, Identity *id)
985{ 1009{
986 Buffer b; 1010 Buffer b;
987 u_char *blob, *signature; 1011 u_char *blob, *signature;
988 u_int bloblen, slen; 1012 u_int bloblen;
1013 size_t slen;
989 u_int skip = 0; 1014 u_int skip = 0;
990 int ret = -1; 1015 int ret = -1;
991 int have_sig = 1; 1016 int have_sig = 1;
992 char *fp; 1017 char *fp;
993 1018
994 fp = key_fingerprint(id->key, SSH_FP_MD5, SSH_FP_HEX); 1019 if ((fp = sshkey_fingerprint(id->key, options.fingerprint_hash,
1020 SSH_FP_DEFAULT)) == NULL)
1021 return 0;
995 debug3("sign_and_send_pubkey: %s %s", key_type(id->key), fp); 1022 debug3("sign_and_send_pubkey: %s %s", key_type(id->key), fp);
996 free(fp); 1023 free(fp);
997 1024
@@ -1026,8 +1053,8 @@ sign_and_send_pubkey(Authctxt *authctxt, Identity *id)
1026 1053
1027 /* generate signature */ 1054 /* generate signature */
1028 ret = identity_sign(id, &signature, &slen, 1055 ret = identity_sign(id, &signature, &slen,
1029 buffer_ptr(&b), buffer_len(&b)); 1056 buffer_ptr(&b), buffer_len(&b), datafellows);
1030 if (ret == -1) { 1057 if (ret != 0) {
1031 free(blob); 1058 free(blob);
1032 buffer_free(&b); 1059 buffer_free(&b);
1033 return 0; 1060 return 0;
@@ -1102,7 +1129,7 @@ load_identity_file(char *filename, int userprovided)
1102{ 1129{
1103 Key *private; 1130 Key *private;
1104 char prompt[300], *passphrase; 1131 char prompt[300], *passphrase;
1105 int perm_ok = 0, quit, i; 1132 int r, perm_ok = 0, quit = 0, i;
1106 struct stat st; 1133 struct stat st;
1107 1134
1108 if (stat(filename, &st) < 0) { 1135 if (stat(filename, &st) < 0) {
@@ -1110,33 +1137,50 @@ load_identity_file(char *filename, int userprovided)
1110 filename, strerror(errno)); 1137 filename, strerror(errno));
1111 return NULL; 1138 return NULL;
1112 } 1139 }
1113 private = key_load_private_type(KEY_UNSPEC, filename, "", NULL, &perm_ok); 1140 snprintf(prompt, sizeof prompt,
1114 if (!perm_ok) { 1141 "Enter passphrase for key '%.100s': ", filename);
1115 if (private != NULL) 1142 for (i = 0; i <= options.number_of_password_prompts; i++) {
1116 key_free(private); 1143 if (i == 0)
1117 return NULL; 1144 passphrase = "";
1118 } 1145 else {
1119 if (private == NULL) {
1120 if (options.batch_mode)
1121 return NULL;
1122 snprintf(prompt, sizeof prompt,
1123 "Enter passphrase for key '%.100s': ", filename);
1124 for (i = 0; i < options.number_of_password_prompts; i++) {
1125 passphrase = read_passphrase(prompt, 0); 1146 passphrase = read_passphrase(prompt, 0);
1126 if (strcmp(passphrase, "") != 0) { 1147 if (*passphrase == '\0') {
1127 private = key_load_private_type(KEY_UNSPEC,
1128 filename, passphrase, NULL, NULL);
1129 quit = 0;
1130 } else {
1131 debug2("no passphrase given, try next key"); 1148 debug2("no passphrase given, try next key");
1149 free(passphrase);
1150 break;
1151 }
1152 }
1153 switch ((r = sshkey_load_private_type(KEY_UNSPEC, filename,
1154 passphrase, &private, NULL, &perm_ok))) {
1155 case 0:
1156 break;
1157 case SSH_ERR_KEY_WRONG_PASSPHRASE:
1158 if (options.batch_mode) {
1159 quit = 1;
1160 break;
1161 }
1162 if (i != 0)
1163 debug2("bad passphrase given, try again...");
1164 break;
1165 case SSH_ERR_SYSTEM_ERROR:
1166 if (errno == ENOENT) {
1167 debug2("Load key \"%s\": %s",
1168 filename, ssh_err(r));
1132 quit = 1; 1169 quit = 1;
1170 break;
1133 } 1171 }
1172 /* FALLTHROUGH */
1173 default:
1174 error("Load key \"%s\": %s", filename, ssh_err(r));
1175 quit = 1;
1176 break;
1177 }
1178 if (i > 0) {
1134 explicit_bzero(passphrase, strlen(passphrase)); 1179 explicit_bzero(passphrase, strlen(passphrase));
1135 free(passphrase); 1180 free(passphrase);
1136 if (private != NULL || quit)
1137 break;
1138 debug2("bad passphrase given, try again...");
1139 } 1181 }
1182 if (private != NULL || quit)
1183 break;
1140 } 1184 }
1141 return private; 1185 return private;
1142} 1186}
@@ -1150,12 +1194,12 @@ load_identity_file(char *filename, int userprovided)
1150static void 1194static void
1151pubkey_prepare(Authctxt *authctxt) 1195pubkey_prepare(Authctxt *authctxt)
1152{ 1196{
1153 Identity *id, *id2, *tmp; 1197 struct identity *id, *id2, *tmp;
1154 Idlist agent, files, *preferred; 1198 struct idlist agent, files, *preferred;
1155 Key *key; 1199 struct sshkey *key;
1156 AuthenticationConnection *ac; 1200 int agent_fd, i, r, found;
1157 char *comment; 1201 size_t j;
1158 int i, found; 1202 struct ssh_identitylist *idlist;
1159 1203
1160 TAILQ_INIT(&agent); /* keys from the agent */ 1204 TAILQ_INIT(&agent); /* keys from the agent */
1161 TAILQ_INIT(&files); /* keys from the config file */ 1205 TAILQ_INIT(&files); /* keys from the config file */
@@ -1185,7 +1229,7 @@ pubkey_prepare(Authctxt *authctxt)
1185 if (id2->key == NULL || 1229 if (id2->key == NULL ||
1186 (id2->key->flags & SSHKEY_FLAG_EXT) == 0) 1230 (id2->key->flags & SSHKEY_FLAG_EXT) == 0)
1187 continue; 1231 continue;
1188 if (key_equal(id->key, id2->key)) { 1232 if (sshkey_equal(id->key, id2->key)) {
1189 TAILQ_REMOVE(&files, id, next); 1233 TAILQ_REMOVE(&files, id, next);
1190 TAILQ_INSERT_TAIL(preferred, id, next); 1234 TAILQ_INSERT_TAIL(preferred, id, next);
1191 found = 1; 1235 found = 1;
@@ -1200,37 +1244,48 @@ pubkey_prepare(Authctxt *authctxt)
1200 } 1244 }
1201 } 1245 }
1202 /* list of keys supported by the agent */ 1246 /* list of keys supported by the agent */
1203 if ((ac = ssh_get_authentication_connection())) { 1247 if ((r = ssh_get_authentication_socket(&agent_fd)) != 0) {
1204 for (key = ssh_get_first_identity(ac, &comment, 2); 1248 if (r != SSH_ERR_AGENT_NOT_PRESENT)
1205 key != NULL; 1249 debug("%s: ssh_get_authentication_socket: %s",
1206 key = ssh_get_next_identity(ac, &comment, 2)) { 1250 __func__, ssh_err(r));
1251 } else if ((r = ssh_fetch_identitylist(agent_fd, 2, &idlist)) != 0) {
1252 if (r != SSH_ERR_AGENT_NO_IDENTITIES)
1253 debug("%s: ssh_fetch_identitylist: %s",
1254 __func__, ssh_err(r));
1255 } else {
1256 for (j = 0; j < idlist->nkeys; j++) {
1207 found = 0; 1257 found = 0;
1208 TAILQ_FOREACH(id, &files, next) { 1258 TAILQ_FOREACH(id, &files, next) {
1209 /* agent keys from the config file are preferred */ 1259 /*
1210 if (key_equal(key, id->key)) { 1260 * agent keys from the config file are
1211 key_free(key); 1261 * preferred
1212 free(comment); 1262 */
1263 if (sshkey_equal(idlist->keys[j], id->key)) {
1213 TAILQ_REMOVE(&files, id, next); 1264 TAILQ_REMOVE(&files, id, next);
1214 TAILQ_INSERT_TAIL(preferred, id, next); 1265 TAILQ_INSERT_TAIL(preferred, id, next);
1215 id->ac = ac; 1266 id->agent_fd = agent_fd;
1216 found = 1; 1267 found = 1;
1217 break; 1268 break;
1218 } 1269 }
1219 } 1270 }
1220 if (!found && !options.identities_only) { 1271 if (!found && !options.identities_only) {
1221 id = xcalloc(1, sizeof(*id)); 1272 id = xcalloc(1, sizeof(*id));
1222 id->key = key; 1273 /* XXX "steals" key/comment from idlist */
1223 id->filename = comment; 1274 id->key = idlist->keys[j];
1224 id->ac = ac; 1275 id->filename = idlist->comments[j];
1276 idlist->keys[j] = NULL;
1277 idlist->comments[j] = NULL;
1278 id->agent_fd = agent_fd;
1225 TAILQ_INSERT_TAIL(&agent, id, next); 1279 TAILQ_INSERT_TAIL(&agent, id, next);
1226 } 1280 }
1227 } 1281 }
1282 ssh_free_identitylist(idlist);
1228 /* append remaining agent keys */ 1283 /* append remaining agent keys */
1229 for (id = TAILQ_FIRST(&agent); id; id = TAILQ_FIRST(&agent)) { 1284 for (id = TAILQ_FIRST(&agent); id; id = TAILQ_FIRST(&agent)) {
1230 TAILQ_REMOVE(&agent, id, next); 1285 TAILQ_REMOVE(&agent, id, next);
1231 TAILQ_INSERT_TAIL(preferred, id, next); 1286 TAILQ_INSERT_TAIL(preferred, id, next);
1232 } 1287 }
1233 authctxt->agent = ac; 1288 authctxt->agent_fd = agent_fd;
1234 } 1289 }
1235 /* append remaining keys from the config file */ 1290 /* append remaining keys from the config file */
1236 for (id = TAILQ_FIRST(&files); id; id = TAILQ_FIRST(&files)) { 1291 for (id = TAILQ_FIRST(&files); id; id = TAILQ_FIRST(&files)) {
@@ -1248,13 +1303,13 @@ pubkey_cleanup(Authctxt *authctxt)
1248{ 1303{
1249 Identity *id; 1304 Identity *id;
1250 1305
1251 if (authctxt->agent != NULL) 1306 if (authctxt->agent_fd != -1)
1252 ssh_close_authentication_connection(authctxt->agent); 1307 ssh_close_authentication_socket(authctxt->agent_fd);
1253 for (id = TAILQ_FIRST(&authctxt->keys); id; 1308 for (id = TAILQ_FIRST(&authctxt->keys); id;
1254 id = TAILQ_FIRST(&authctxt->keys)) { 1309 id = TAILQ_FIRST(&authctxt->keys)) {
1255 TAILQ_REMOVE(&authctxt->keys, id, next); 1310 TAILQ_REMOVE(&authctxt->keys, id, next);
1256 if (id->key) 1311 if (id->key)
1257 key_free(id->key); 1312 sshkey_free(id->key);
1258 free(id->filename); 1313 free(id->filename);
1259 free(id); 1314 free(id);
1260 } 1315 }
@@ -1346,7 +1401,7 @@ userauth_kbdint(Authctxt *authctxt)
1346/* 1401/*
1347 * parse INFO_REQUEST, prompt user and send INFO_RESPONSE 1402 * parse INFO_REQUEST, prompt user and send INFO_RESPONSE
1348 */ 1403 */
1349void 1404int
1350input_userauth_info_req(int type, u_int32_t seq, void *ctxt) 1405input_userauth_info_req(int type, u_int32_t seq, void *ctxt)
1351{ 1406{
1352 Authctxt *authctxt = ctxt; 1407 Authctxt *authctxt = ctxt;
@@ -1398,81 +1453,120 @@ input_userauth_info_req(int type, u_int32_t seq, void *ctxt)
1398 1453
1399 packet_add_padding(64); 1454 packet_add_padding(64);
1400 packet_send(); 1455 packet_send();
1456 return 0;
1401} 1457}
1402 1458
1403static int 1459static int
1404ssh_keysign(Key *key, u_char **sigp, u_int *lenp, 1460ssh_keysign(struct sshkey *key, u_char **sigp, size_t *lenp,
1405 u_char *data, u_int datalen) 1461 const u_char *data, size_t datalen)
1406{ 1462{
1407 Buffer b; 1463 struct sshbuf *b;
1408 struct stat st; 1464 struct stat st;
1409 pid_t pid; 1465 pid_t pid;
1410 int to[2], from[2], status, version = 2; 1466 int i, r, to[2], from[2], status, sock = packet_get_connection_in();
1467 u_char rversion = 0, version = 2;
1468 void (*osigchld)(int);
1411 1469
1412 debug2("ssh_keysign called"); 1470 *sigp = NULL;
1471 *lenp = 0;
1413 1472
1414 if (stat(_PATH_SSH_KEY_SIGN, &st) < 0) { 1473 if (stat(_PATH_SSH_KEY_SIGN, &st) < 0) {
1415 error("ssh_keysign: not installed: %s", strerror(errno)); 1474 error("%s: not installed: %s", __func__, strerror(errno));
1475 return -1;
1476 }
1477 if (fflush(stdout) != 0) {
1478 error("%s: fflush: %s", __func__, strerror(errno));
1416 return -1; 1479 return -1;
1417 } 1480 }
1418 if (fflush(stdout) != 0)
1419 error("ssh_keysign: fflush: %s", strerror(errno));
1420 if (pipe(to) < 0) { 1481 if (pipe(to) < 0) {
1421 error("ssh_keysign: pipe: %s", strerror(errno)); 1482 error("%s: pipe: %s", __func__, strerror(errno));
1422 return -1; 1483 return -1;
1423 } 1484 }
1424 if (pipe(from) < 0) { 1485 if (pipe(from) < 0) {
1425 error("ssh_keysign: pipe: %s", strerror(errno)); 1486 error("%s: pipe: %s", __func__, strerror(errno));
1426 return -1; 1487 return -1;
1427 } 1488 }
1428 if ((pid = fork()) < 0) { 1489 if ((pid = fork()) < 0) {
1429 error("ssh_keysign: fork: %s", strerror(errno)); 1490 error("%s: fork: %s", __func__, strerror(errno));
1430 return -1; 1491 return -1;
1431 } 1492 }
1493 osigchld = signal(SIGCHLD, SIG_DFL);
1432 if (pid == 0) { 1494 if (pid == 0) {
1433 /* keep the socket on exec */ 1495 /* keep the socket on exec */
1434 fcntl(packet_get_connection_in(), F_SETFD, 0); 1496 fcntl(sock, F_SETFD, 0);
1435 permanently_drop_suid(getuid()); 1497 permanently_drop_suid(getuid());
1436 close(from[0]); 1498 close(from[0]);
1437 if (dup2(from[1], STDOUT_FILENO) < 0) 1499 if (dup2(from[1], STDOUT_FILENO) < 0)
1438 fatal("ssh_keysign: dup2: %s", strerror(errno)); 1500 fatal("%s: dup2: %s", __func__, strerror(errno));
1439 close(to[1]); 1501 close(to[1]);
1440 if (dup2(to[0], STDIN_FILENO) < 0) 1502 if (dup2(to[0], STDIN_FILENO) < 0)
1441 fatal("ssh_keysign: dup2: %s", strerror(errno)); 1503 fatal("%s: dup2: %s", __func__, strerror(errno));
1442 close(from[1]); 1504 close(from[1]);
1443 close(to[0]); 1505 close(to[0]);
1506 /* Close everything but stdio and the socket */
1507 for (i = STDERR_FILENO + 1; i < sock; i++)
1508 close(i);
1509 closefrom(sock + 1);
1510 debug3("%s: [child] pid=%ld, exec %s",
1511 __func__, (long)getpid(), _PATH_SSH_KEY_SIGN);
1444 execl(_PATH_SSH_KEY_SIGN, _PATH_SSH_KEY_SIGN, (char *) 0); 1512 execl(_PATH_SSH_KEY_SIGN, _PATH_SSH_KEY_SIGN, (char *) 0);
1445 fatal("ssh_keysign: exec(%s): %s", _PATH_SSH_KEY_SIGN, 1513 fatal("%s: exec(%s): %s", __func__, _PATH_SSH_KEY_SIGN,
1446 strerror(errno)); 1514 strerror(errno));
1447 } 1515 }
1448 close(from[1]); 1516 close(from[1]);
1449 close(to[0]); 1517 close(to[0]);
1450 1518
1451 buffer_init(&b); 1519 if ((b = sshbuf_new()) == NULL)
1452 buffer_put_int(&b, packet_get_connection_in()); /* send # of socket */ 1520 fatal("%s: sshbuf_new failed", __func__);
1453 buffer_put_string(&b, data, datalen); 1521 /* send # of sock, data to be signed */
1454 if (ssh_msg_send(to[1], version, &b) == -1) 1522 if ((r = sshbuf_put_u32(b, sock) != 0) ||
1455 fatal("ssh_keysign: couldn't send request"); 1523 (r = sshbuf_put_string(b, data, datalen)) != 0)
1456 1524 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1457 if (ssh_msg_recv(from[0], &b) < 0) { 1525 if (ssh_msg_send(to[1], version, b) == -1)
1458 error("ssh_keysign: no reply"); 1526 fatal("%s: couldn't send request", __func__);
1459 buffer_free(&b); 1527 sshbuf_reset(b);
1460 return -1; 1528 r = ssh_msg_recv(from[0], b);
1461 }
1462 close(from[0]); 1529 close(from[0]);
1463 close(to[1]); 1530 close(to[1]);
1531 if (r < 0) {
1532 error("%s: no reply", __func__);
1533 goto fail;
1534 }
1464 1535
1465 while (waitpid(pid, &status, 0) < 0) 1536 errno = 0;
1466 if (errno != EINTR) 1537 while (waitpid(pid, &status, 0) < 0) {
1467 break; 1538 if (errno != EINTR) {
1468 1539 error("%s: waitpid %ld: %s",
1469 if (buffer_get_char(&b) != version) { 1540 __func__, (long)pid, strerror(errno));
1470 error("ssh_keysign: bad version"); 1541 goto fail;
1471 buffer_free(&b); 1542 }
1543 }
1544 if (!WIFEXITED(status)) {
1545 error("%s: exited abnormally", __func__);
1546 goto fail;
1547 }
1548 if (WEXITSTATUS(status) != 0) {
1549 error("%s: exited with status %d",
1550 __func__, WEXITSTATUS(status));
1551 goto fail;
1552 }
1553 if ((r = sshbuf_get_u8(b, &rversion)) != 0) {
1554 error("%s: buffer error: %s", __func__, ssh_err(r));
1555 goto fail;
1556 }
1557 if (rversion != version) {
1558 error("%s: bad version", __func__);
1559 goto fail;
1560 }
1561 if ((r = sshbuf_get_string(b, sigp, lenp)) != 0) {
1562 error("%s: buffer error: %s", __func__, ssh_err(r));
1563 fail:
1564 signal(SIGCHLD, osigchld);
1565 sshbuf_free(b);
1472 return -1; 1566 return -1;
1473 } 1567 }
1474 *sigp = buffer_get_string(&b, lenp); 1568 signal(SIGCHLD, osigchld);
1475 buffer_free(&b); 1569 sshbuf_free(b);
1476 1570
1477 return 0; 1571 return 0;
1478} 1572}
@@ -1480,94 +1574,149 @@ ssh_keysign(Key *key, u_char **sigp, u_int *lenp,
1480int 1574int
1481userauth_hostbased(Authctxt *authctxt) 1575userauth_hostbased(Authctxt *authctxt)
1482{ 1576{
1483 Key *private = NULL; 1577 struct ssh *ssh = active_state;
1484 Sensitive *sensitive = authctxt->sensitive; 1578 struct sshkey *private = NULL;
1485 Buffer b; 1579 struct sshbuf *b = NULL;
1486 u_char *signature, *blob;
1487 char *chost, *pkalg, *p;
1488 const char *service; 1580 const char *service;
1489 u_int blen, slen; 1581 u_char *sig = NULL, *keyblob = NULL;
1490 int ok, i, found = 0; 1582 char *fp = NULL, *chost = NULL, *lname = NULL;
1491 1583 size_t siglen = 0, keylen = 0;
1492 /* check for a useful key */ 1584 int i, r, success = 0;
1493 for (i = 0; i < sensitive->nkeys; i++) { 1585
1494 private = sensitive->keys[i]; 1586 if (authctxt->ktypes == NULL) {
1495 if (private && private->type != KEY_RSA1) { 1587 authctxt->oktypes = xstrdup(options.hostbased_key_types);
1496 found = 1; 1588 authctxt->ktypes = authctxt->oktypes;
1589 }
1590
1591 /*
1592 * Work through each listed type pattern in HostbasedKeyTypes,
1593 * trying each hostkey that matches the type in turn.
1594 */
1595 for (;;) {
1596 if (authctxt->active_ktype == NULL)
1597 authctxt->active_ktype = strsep(&authctxt->ktypes, ",");
1598 if (authctxt->active_ktype == NULL ||
1599 *authctxt->active_ktype == '\0')
1600 break;
1601 debug3("%s: trying key type %s", __func__,
1602 authctxt->active_ktype);
1603
1604 /* check for a useful key */
1605 private = NULL;
1606 for (i = 0; i < authctxt->sensitive->nkeys; i++) {
1607 if (authctxt->sensitive->keys[i] == NULL ||
1608 authctxt->sensitive->keys[i]->type == KEY_RSA1 ||
1609 authctxt->sensitive->keys[i]->type == KEY_UNSPEC)
1610 continue;
1611 if (match_pattern_list(
1612 sshkey_ssh_name(authctxt->sensitive->keys[i]),
1613 authctxt->active_ktype,
1614 strlen(authctxt->active_ktype), 0) != 1)
1615 continue;
1497 /* we take and free the key */ 1616 /* we take and free the key */
1498 sensitive->keys[i] = NULL; 1617 private = authctxt->sensitive->keys[i];
1618 authctxt->sensitive->keys[i] = NULL;
1499 break; 1619 break;
1500 } 1620 }
1621 /* Found one */
1622 if (private != NULL)
1623 break;
1624 /* No more keys of this type; advance */
1625 authctxt->active_ktype = NULL;
1501 } 1626 }
1502 if (!found) { 1627 if (private == NULL) {
1628 free(authctxt->oktypes);
1629 authctxt->oktypes = authctxt->ktypes = NULL;
1630 authctxt->active_ktype = NULL;
1503 debug("No more client hostkeys for hostbased authentication."); 1631 debug("No more client hostkeys for hostbased authentication.");
1504 return 0; 1632 goto out;
1505 } 1633 }
1506 if (key_to_blob(private, &blob, &blen) == 0) { 1634
1507 key_free(private); 1635 if ((fp = sshkey_fingerprint(private, options.fingerprint_hash,
1508 return 0; 1636 SSH_FP_DEFAULT)) == NULL) {
1637 error("%s: sshkey_fingerprint failed", __func__);
1638 goto out;
1509 } 1639 }
1640 debug("%s: trying hostkey %s %s",
1641 __func__, sshkey_ssh_name(private), fp);
1642
1510 /* figure out a name for the client host */ 1643 /* figure out a name for the client host */
1511 p = get_local_name(packet_get_connection_in()); 1644 if ((lname = get_local_name(packet_get_connection_in())) == NULL) {
1512 if (p == NULL) { 1645 error("%s: cannot get local ipaddr/name", __func__);
1513 error("userauth_hostbased: cannot get local ipaddr/name"); 1646 goto out;
1514 key_free(private);
1515 free(blob);
1516 return 0;
1517 } 1647 }
1518 xasprintf(&chost, "%s.", p); 1648
1519 debug2("userauth_hostbased: chost %s", chost); 1649 /* XXX sshbuf_put_stringf? */
1520 free(p); 1650 xasprintf(&chost, "%s.", lname);
1651 debug2("%s: chost %s", __func__, chost);
1521 1652
1522 service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" : 1653 service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" :
1523 authctxt->service; 1654 authctxt->service;
1524 pkalg = xstrdup(key_ssh_name(private)); 1655
1525 buffer_init(&b);
1526 /* construct data */ 1656 /* construct data */
1527 buffer_put_string(&b, session_id2, session_id2_len); 1657 if ((b = sshbuf_new()) == NULL) {
1528 buffer_put_char(&b, SSH2_MSG_USERAUTH_REQUEST); 1658 error("%s: sshbuf_new failed", __func__);
1529 buffer_put_cstring(&b, authctxt->server_user); 1659 goto out;
1530 buffer_put_cstring(&b, service); 1660 }
1531 buffer_put_cstring(&b, authctxt->method->name); 1661 if ((r = sshkey_to_blob(private, &keyblob, &keylen)) != 0) {
1532 buffer_put_cstring(&b, pkalg); 1662 error("%s: sshkey_to_blob: %s", __func__, ssh_err(r));
1533 buffer_put_string(&b, blob, blen); 1663 goto out;
1534 buffer_put_cstring(&b, chost); 1664 }
1535 buffer_put_cstring(&b, authctxt->local_user); 1665 if ((r = sshbuf_put_string(b, session_id2, session_id2_len)) != 0 ||
1666 (r = sshbuf_put_u8(b, SSH2_MSG_USERAUTH_REQUEST)) != 0 ||
1667 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 ||
1668 (r = sshbuf_put_cstring(b, service)) != 0 ||
1669 (r = sshbuf_put_cstring(b, authctxt->method->name)) != 0 ||
1670 (r = sshbuf_put_cstring(b, key_ssh_name(private))) != 0 ||
1671 (r = sshbuf_put_string(b, keyblob, keylen)) != 0 ||
1672 (r = sshbuf_put_cstring(b, chost)) != 0 ||
1673 (r = sshbuf_put_cstring(b, authctxt->local_user)) != 0) {
1674 error("%s: buffer error: %s", __func__, ssh_err(r));
1675 goto out;
1676 }
1677
1536#ifdef DEBUG_PK 1678#ifdef DEBUG_PK
1537 buffer_dump(&b); 1679 sshbuf_dump(b, stderr);
1538#endif 1680#endif
1539 if (sensitive->external_keysign) 1681 if (authctxt->sensitive->external_keysign)
1540 ok = ssh_keysign(private, &signature, &slen, 1682 r = ssh_keysign(private, &sig, &siglen,
1541 buffer_ptr(&b), buffer_len(&b)); 1683 sshbuf_ptr(b), sshbuf_len(b));
1542 else 1684 else if ((r = sshkey_sign(private, &sig, &siglen,
1543 ok = key_sign(private, &signature, &slen, 1685 sshbuf_ptr(b), sshbuf_len(b), datafellows)) != 0)
1544 buffer_ptr(&b), buffer_len(&b)); 1686 debug("%s: sshkey_sign: %s", __func__, ssh_err(r));
1545 key_free(private); 1687 if (r != 0) {
1546 buffer_free(&b); 1688 error("sign using hostkey %s %s failed",
1547 if (ok != 0) { 1689 sshkey_ssh_name(private), fp);
1548 error("key_sign failed"); 1690 goto out;
1549 free(chost);
1550 free(pkalg);
1551 free(blob);
1552 return 0;
1553 } 1691 }
1554 packet_start(SSH2_MSG_USERAUTH_REQUEST); 1692 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 ||
1555 packet_put_cstring(authctxt->server_user); 1693 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
1556 packet_put_cstring(authctxt->service); 1694 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
1557 packet_put_cstring(authctxt->method->name); 1695 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
1558 packet_put_cstring(pkalg); 1696 (r = sshpkt_put_cstring(ssh, key_ssh_name(private))) != 0 ||
1559 packet_put_string(blob, blen); 1697 (r = sshpkt_put_string(ssh, keyblob, keylen)) != 0 ||
1560 packet_put_cstring(chost); 1698 (r = sshpkt_put_cstring(ssh, chost)) != 0 ||
1561 packet_put_cstring(authctxt->local_user); 1699 (r = sshpkt_put_cstring(ssh, authctxt->local_user)) != 0 ||
1562 packet_put_string(signature, slen); 1700 (r = sshpkt_put_string(ssh, sig, siglen)) != 0 ||
1563 explicit_bzero(signature, slen); 1701 (r = sshpkt_send(ssh)) != 0) {
1564 free(signature); 1702 error("%s: packet error: %s", __func__, ssh_err(r));
1703 goto out;
1704 }
1705 success = 1;
1706
1707 out:
1708 if (sig != NULL) {
1709 explicit_bzero(sig, siglen);
1710 free(sig);
1711 }
1712 free(keyblob);
1713 free(lname);
1714 free(fp);
1565 free(chost); 1715 free(chost);
1566 free(pkalg); 1716 sshkey_free(private);
1567 free(blob); 1717 sshbuf_free(b);
1568 1718
1569 packet_send(); 1719 return success;
1570 return 1;
1571} 1720}
1572 1721
1573/* find auth method */ 1722/* find auth method */
diff --git a/sshd.0 b/sshd.0
index 3008e01bd..442cd572f 100644
--- a/sshd.0
+++ b/sshd.0
@@ -1,7 +1,7 @@
1SSHD(8) System Manager's Manual SSHD(8) 1SSHD(8) System Manager's Manual SSHD(8)
2 2
3NAME 3NAME
4 sshd - OpenSSH SSH daemon 4 sshd M-bM-^@M-^S OpenSSH SSH daemon
5 5
6SYNOPSIS 6SYNOPSIS
7 sshd [-46DdeiqTt] [-b bits] [-C connection_spec] 7 sshd [-46DdeiqTt] [-b bits] [-C connection_spec]
@@ -41,10 +41,9 @@ DESCRIPTION
41 file that would apply to the specified user, host, and address 41 file that would apply to the specified user, host, and address
42 will be set before the configuration is written to standard 42 will be set before the configuration is written to standard
43 output. The connection parameters are supplied as keyword=value 43 output. The connection parameters are supplied as keyword=value
44 pairs. The keywords are ``user'', ``host'', ``laddr'', 44 pairs. The keywords are M-bM-^@M-^\userM-bM-^@M-^], M-bM-^@M-^\hostM-bM-^@M-^], M-bM-^@M-^\laddrM-bM-^@M-^], M-bM-^@M-^\lportM-bM-^@M-^], and
45 ``lport'', and ``addr''. All are required and may be supplied in 45 M-bM-^@M-^\addrM-bM-^@M-^]. All are required and may be supplied in any order,
46 any order, either with multiple -C options or as a comma- 46 either with multiple -C options or as a comma-separated list.
47 separated list.
48 47
49 -c host_certificate_file 48 -c host_certificate_file
50 Specifies a path to a certificate file to identify sshd during 49 Specifies a path to a certificate file to identify sshd during
@@ -148,7 +147,7 @@ DESCRIPTION
148AUTHENTICATION 147AUTHENTICATION
149 The OpenSSH SSH daemon supports SSH protocols 1 and 2. The default is to 148 The OpenSSH SSH daemon supports SSH protocols 1 and 2. The default is to
150 use protocol 2 only, though this can be changed via the Protocol option 149 use protocol 2 only, though this can be changed via the Protocol option
151 in sshd_config(5). Protocol 2 supports DSA, ECDSA, ED25519 and RSA keys; 150 in sshd_config(5). Protocol 2 supports DSA, ECDSA, Ed25519 and RSA keys;
152 protocol 1 only supports RSA keys. For both protocols, each host has a 151 protocol 1 only supports RSA keys. For both protocols, each host has a
153 host-specific key, normally 2048 bits, used to identify the host. 152 host-specific key, normally 2048 bits, used to identify the host.
154 153
@@ -185,11 +184,11 @@ AUTHENTICATION
185 listed in DenyUsers or its group is listed in DenyGroups . The 184 listed in DenyUsers or its group is listed in DenyGroups . The
186 definition of a locked account is system dependant. Some platforms have 185 definition of a locked account is system dependant. Some platforms have
187 their own account database (eg AIX) and some modify the passwd field ( 186 their own account database (eg AIX) and some modify the passwd field (
188 `*LK*' on Solaris and UnixWare, `*' on HP-UX, containing `Nologin' on 187 M-bM-^@M-^X*LK*M-bM-^@M-^Y on Solaris and UnixWare, M-bM-^@M-^X*M-bM-^@M-^Y on HP-UX, containing M-bM-^@M-^XNologinM-bM-^@M-^Y on
189 Tru64, a leading `*LOCKED*' on FreeBSD and a leading `!' on most 188 Tru64, a leading M-bM-^@M-^X*LOCKED*M-bM-^@M-^Y on FreeBSD and a leading M-bM-^@M-^X!M-bM-^@M-^Y on most
190 Linuxes). If there is a requirement to disable password authentication 189 Linuxes). If there is a requirement to disable password authentication
191 for the account while allowing still public-key, then the passwd field 190 for the account while allowing still public-key, then the passwd field
192 should be set to something other than these values (eg `NP' or `*NP*' ). 191 should be set to something other than these values (eg M-bM-^@M-^XNPM-bM-^@M-^Y or M-bM-^@M-^X*NP*M-bM-^@M-^Y ).
193 192
194 If the client successfully authenticates itself, a dialog for preparing 193 If the client successfully authenticates itself, a dialog for preparing
195 the session is entered. At this time the client may request things like 194 the session is entered. At this time the client may request things like
@@ -230,7 +229,7 @@ LOGIN PROCESS
230 229
231 8. If ~/.ssh/rc exists and the sshd_config(5) PermitUserRC option 230 8. If ~/.ssh/rc exists and the sshd_config(5) PermitUserRC option
232 is set, runs it; else if /etc/ssh/sshrc exists, runs it; 231 is set, runs it; else if /etc/ssh/sshrc exists, runs it;
233 otherwise runs xauth. The ``rc'' files are given the X11 232 otherwise runs xauth. The M-bM-^@M-^\rcM-bM-^@M-^] files are given the X11
234 authentication protocol and cookie in standard input. See 233 authentication protocol and cookie in standard input. See
235 SSHRC, below. 234 SSHRC, below.
236 235
@@ -270,7 +269,7 @@ AUTHORIZED_KEYS FILE FORMAT
270 AuthorizedKeysFile specifies the files containing public keys for public 269 AuthorizedKeysFile specifies the files containing public keys for public
271 key authentication; if none is specified, the default is 270 key authentication; if none is specified, the default is
272 ~/.ssh/authorized_keys and ~/.ssh/authorized_keys2. Each line of the 271 ~/.ssh/authorized_keys and ~/.ssh/authorized_keys2. Each line of the
273 file contains one key (empty lines and lines starting with a `#' are 272 file contains one key (empty lines and lines starting with a M-bM-^@M-^X#M-bM-^@M-^Y are
274 ignored as comments). Protocol 1 public keys consist of the following 273 ignored as comments). Protocol 1 public keys consist of the following
275 space-separated fields: options, bits, exponent, modulus, comment. 274 space-separated fields: options, bits, exponent, modulus, comment.
276 Protocol 2 public key consist of: options, keytype, base64-encoded key, 275 Protocol 2 public key consist of: options, keytype, base64-encoded key,
@@ -279,9 +278,9 @@ AUTHORIZED_KEYS FILE FORMAT
279 starts with a number). The bits, exponent, modulus, and comment fields 278 starts with a number). The bits, exponent, modulus, and comment fields
280 give the RSA key for protocol version 1; the comment field is not used 279 give the RSA key for protocol version 1; the comment field is not used
281 for anything (but may be convenient for the user to identify the key). 280 for anything (but may be convenient for the user to identify the key).
282 For protocol version 2 the keytype is ``ecdsa-sha2-nistp256'', 281 For protocol version 2 the keytype is M-bM-^@M-^\ecdsa-sha2-nistp256M-bM-^@M-^],
283 ``ecdsa-sha2-nistp384'', ``ecdsa-sha2-nistp521'', ``ssh-ed25519'', 282 M-bM-^@M-^\ecdsa-sha2-nistp384M-bM-^@M-^], M-bM-^@M-^\ecdsa-sha2-nistp521M-bM-^@M-^], M-bM-^@M-^\ssh-ed25519M-bM-^@M-^], M-bM-^@M-^\ssh-dssM-bM-^@M-^] or
284 ``ssh-dss'' or ``ssh-rsa''. 283 M-bM-^@M-^\ssh-rsaM-bM-^@M-^].
285 284
286 Note that lines in this file are usually several hundred bytes long 285 Note that lines in this file are usually several hundred bytes long
287 (because of the size of the public key encoding) up to a limit of 8 286 (because of the size of the public key encoding) up to a limit of 8
@@ -370,7 +369,7 @@ AUTHORIZED_KEYS FILE FORMAT
370 Any X11 forward requests by the client will return an error. 369 Any X11 forward requests by the client will return an error.
371 370
372 permitopen="host:port" 371 permitopen="host:port"
373 Limit local ``ssh -L'' port forwarding such that it may only 372 Limit local port forwarding with ssh(1) -L such that it may only
374 connect to the specified host and port. IPv6 addresses can be 373 connect to the specified host and port. IPv6 addresses can be
375 specified by enclosing the address in square brackets. Multiple 374 specified by enclosing the address in square brackets. Multiple
376 permitopen options may be applied separated by commas. No 375 permitopen options may be applied separated by commas. No
@@ -416,23 +415,23 @@ SSH_KNOWN_HOSTS FILE FORMAT
416 separated by spaces. 415 separated by spaces.
417 416
418 The marker is optional, but if it is present then it must be one of 417 The marker is optional, but if it is present then it must be one of
419 ``@cert-authority'', to indicate that the line contains a certification 418 M-bM-^@M-^\@cert-authorityM-bM-^@M-^], to indicate that the line contains a certification
420 authority (CA) key, or ``@revoked'', to indicate that the key contained 419 authority (CA) key, or M-bM-^@M-^\@revokedM-bM-^@M-^], to indicate that the key contained on
421 on the line is revoked and must not ever be accepted. Only one marker 420 the line is revoked and must not ever be accepted. Only one marker
422 should be used on a key line. 421 should be used on a key line.
423 422
424 Hostnames is a comma-separated list of patterns (`*' and `?' act as 423 Hostnames is a comma-separated list of patterns (M-bM-^@M-^X*M-bM-^@M-^Y and M-bM-^@M-^X?M-bM-^@M-^Y act as
425 wildcards); each pattern in turn is matched against the canonical host 424 wildcards); each pattern in turn is matched against the canonical host
426 name (when authenticating a client) or against the user-supplied name 425 name (when authenticating a client) or against the user-supplied name
427 (when authenticating a server). A pattern may also be preceded by `!' to 426 (when authenticating a server). A pattern may also be preceded by M-bM-^@M-^X!M-bM-^@M-^Y to
428 indicate negation: if the host name matches a negated pattern, it is not 427 indicate negation: if the host name matches a negated pattern, it is not
429 accepted (by that line) even if it matched another pattern on the line. 428 accepted (by that line) even if it matched another pattern on the line.
430 A hostname or address may optionally be enclosed within `[' and `]' 429 A hostname or address may optionally be enclosed within M-bM-^@M-^X[M-bM-^@M-^Y and M-bM-^@M-^X]M-bM-^@M-^Y
431 brackets then followed by `:' and a non-standard port number. 430 brackets then followed by M-bM-^@M-^X:M-bM-^@M-^Y and a non-standard port number.
432 431
433 Alternately, hostnames may be stored in a hashed form which hides host 432 Alternately, hostnames may be stored in a hashed form which hides host
434 names and addresses should the file's contents be disclosed. Hashed 433 names and addresses should the file's contents be disclosed. Hashed
435 hostnames start with a `|' character. Only one hashed hostname may 434 hostnames start with a M-bM-^@M-^X|M-bM-^@M-^Y character. Only one hashed hostname may
436 appear on a single line and none of the above negation or wildcard 435 appear on a single line and none of the above negation or wildcard
437 operators may be applied. 436 operators may be applied.
438 437
@@ -440,21 +439,21 @@ SSH_KNOWN_HOSTS FILE FORMAT
440 they can be obtained, for example, from /etc/ssh/ssh_host_key.pub. The 439 they can be obtained, for example, from /etc/ssh/ssh_host_key.pub. The
441 optional comment field continues to the end of the line, and is not used. 440 optional comment field continues to the end of the line, and is not used.
442 441
443 Lines starting with `#' and empty lines are ignored as comments. 442 Lines starting with M-bM-^@M-^X#M-bM-^@M-^Y and empty lines are ignored as comments.
444 443
445 When performing host authentication, authentication is accepted if any 444 When performing host authentication, authentication is accepted if any
446 matching line has the proper key; either one that matches exactly or, if 445 matching line has the proper key; either one that matches exactly or, if
447 the server has presented a certificate for authentication, the key of the 446 the server has presented a certificate for authentication, the key of the
448 certification authority that signed the certificate. For a key to be 447 certification authority that signed the certificate. For a key to be
449 trusted as a certification authority, it must use the ``@cert-authority'' 448 trusted as a certification authority, it must use the M-bM-^@M-^\@cert-authorityM-bM-^@M-^]
450 marker described above. 449 marker described above.
451 450
452 The known hosts file also provides a facility to mark keys as revoked, 451 The known hosts file also provides a facility to mark keys as revoked,
453 for example when it is known that the associated private key has been 452 for example when it is known that the associated private key has been
454 stolen. Revoked keys are specified by including the ``@revoked'' marker 453 stolen. Revoked keys are specified by including the M-bM-^@M-^\@revokedM-bM-^@M-^] marker at
455 at the beginning of the key line, and are never accepted for 454 the beginning of the key line, and are never accepted for authentication
456 authentication or as certification authorities, but instead will produce 455 or as certification authorities, but instead will produce a warning from
457 a warning from ssh(1) when they are encountered. 456 ssh(1) when they are encountered.
458 457
459 It is permissible (but not recommended) to have several lines or 458 It is permissible (but not recommended) to have several lines or
460 different host keys for the same names. This will inevitably happen when 459 different host keys for the same names. This will inevitably happen when
@@ -514,7 +513,7 @@ FILES
514 for the user, and not accessible by others. 513 for the user, and not accessible by others.
515 514
516 ~/.ssh/authorized_keys 515 ~/.ssh/authorized_keys
517 Lists the public keys (DSA, ECDSA, ED25519, RSA) that can be used 516 Lists the public keys (DSA, ECDSA, Ed25519, RSA) that can be used
518 for logging in as this user. The format of this file is 517 for logging in as this user. The format of this file is
519 described above. The content of the file is not highly 518 described above. The content of the file is not highly
520 sensitive, but the recommended permissions are read/write for the 519 sensitive, but the recommended permissions are read/write for the
@@ -524,12 +523,12 @@ FILES
524 are writable by other users, then the file could be modified or 523 are writable by other users, then the file could be modified or
525 replaced by unauthorized users. In this case, sshd will not 524 replaced by unauthorized users. In this case, sshd will not
526 allow it to be used unless the StrictModes option has been set to 525 allow it to be used unless the StrictModes option has been set to
527 ``no''. 526 M-bM-^@M-^\noM-bM-^@M-^].
528 527
529 ~/.ssh/environment 528 ~/.ssh/environment
530 This file is read into the environment at login (if it exists). 529 This file is read into the environment at login (if it exists).
531 It can only contain empty lines, comment lines (that start with 530 It can only contain empty lines, comment lines (that start with
532 `#'), and assignment lines of the form name=value. The file 531 M-bM-^@M-^X#M-bM-^@M-^Y), and assignment lines of the form name=value. The file
533 should be writable only by the user; it need not be readable by 532 should be writable only by the user; it need not be readable by
534 anyone else. Environment processing is disabled by default and 533 anyone else. Environment processing is disabled by default and
535 is controlled via the PermitUserEnvironment option. 534 is controlled via the PermitUserEnvironment option.
@@ -632,4 +631,4 @@ AUTHORS
632 versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support 631 versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support
633 for privilege separation. 632 for privilege separation.
634 633
635OpenBSD 5.6 July 3, 2014 OpenBSD 5.6 634OpenBSD 5.7 November 15, 2014 OpenBSD 5.7
diff --git a/sshd.8 b/sshd.8
index 01459d637..3c53f7cd6 100644
--- a/sshd.8
+++ b/sshd.8
@@ -33,8 +33,8 @@
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\" 35.\"
36.\" $OpenBSD: sshd.8,v 1.276 2014/07/03 22:40:43 djm Exp $ 36.\" $OpenBSD: sshd.8,v 1.278 2014/11/15 14:41:03 bentley Exp $
37.Dd $Mdocdate: July 3 2014 $ 37.Dd $Mdocdate: November 15 2014 $
38.Dt SSHD 8 38.Dt SSHD 8
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -278,7 +278,7 @@ though this can be changed via the
278.Cm Protocol 278.Cm Protocol
279option in 279option in
280.Xr sshd_config 5 . 280.Xr sshd_config 5 .
281Protocol 2 supports DSA, ECDSA, ED25519 and RSA keys; 281Protocol 2 supports DSA, ECDSA, Ed25519 and RSA keys;
282protocol 1 only supports RSA keys. 282protocol 1 only supports RSA keys.
283For both protocols, 283For both protocols,
284each host has a host-specific key, 284each host has a host-specific key,
@@ -604,10 +604,10 @@ Disables execution of
604Forbids X11 forwarding when this key is used for authentication. 604Forbids X11 forwarding when this key is used for authentication.
605Any X11 forward requests by the client will return an error. 605Any X11 forward requests by the client will return an error.
606.It Cm permitopen="host:port" 606.It Cm permitopen="host:port"
607Limit local 607Limit local port forwarding with
608.Li ``ssh -L'' 608.Xr ssh 1
609port forwarding such that it may only connect to the specified host and 609.Fl L
610port. 610such that it may only connect to the specified host and port.
611IPv6 addresses can be specified by enclosing the address in square brackets. 611IPv6 addresses can be specified by enclosing the address in square brackets.
612Multiple 612Multiple
613.Cm permitopen 613.Cm permitopen
@@ -808,7 +808,7 @@ secret, but the recommended permissions are read/write/execute for the user,
808and not accessible by others. 808and not accessible by others.
809.Pp 809.Pp
810.It Pa ~/.ssh/authorized_keys 810.It Pa ~/.ssh/authorized_keys
811Lists the public keys (DSA, ECDSA, ED25519, RSA) 811Lists the public keys (DSA, ECDSA, Ed25519, RSA)
812that can be used for logging in as this user. 812that can be used for logging in as this user.
813The format of this file is described above. 813The format of this file is described above.
814The content of the file is not highly sensitive, but the recommended 814The content of the file is not highly sensitive, but the recommended
diff --git a/sshd.c b/sshd.c
index 481d00155..e1c767c14 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.428 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: sshd.c,v 1.444 2015/02/20 22:17:21 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -71,6 +71,7 @@
71#include <stdlib.h> 71#include <stdlib.h>
72#include <string.h> 72#include <string.h>
73#include <unistd.h> 73#include <unistd.h>
74#include <limits.h>
74 75
75#ifdef WITH_OPENSSL 76#ifdef WITH_OPENSSL
76#include <openssl/dh.h> 77#include <openssl/dh.h>
@@ -122,6 +123,7 @@
122#include "roaming.h" 123#include "roaming.h"
123#include "ssh-sandbox.h" 124#include "ssh-sandbox.h"
124#include "version.h" 125#include "version.h"
126#include "ssherr.h"
125 127
126#ifndef O_NOCTTY 128#ifndef O_NOCTTY
127#define O_NOCTTY 0 129#define O_NOCTTY 0
@@ -186,11 +188,8 @@ int num_listen_socks = 0;
186char *client_version_string = NULL; 188char *client_version_string = NULL;
187char *server_version_string = NULL; 189char *server_version_string = NULL;
188 190
189/* for rekeying XXX fixme */
190Kex *xxx_kex;
191
192/* Daemon's agent connection */ 191/* Daemon's agent connection */
193AuthenticationConnection *auth_conn = NULL; 192int auth_sock = -1;
194int have_agent = 0; 193int have_agent = 0;
195 194
196/* 195/*
@@ -230,7 +229,7 @@ u_char *session_id2 = NULL;
230u_int session_id2_len = 0; 229u_int session_id2_len = 0;
231 230
232/* record remote hostname or ip */ 231/* record remote hostname or ip */
233u_int utmp_len = MAXHOSTNAMELEN; 232u_int utmp_len = HOST_NAME_MAX+1;
234 233
235/* options.max_startup sized array of fd ints */ 234/* options.max_startup sized array of fd ints */
236int *startup_pipes = NULL; 235int *startup_pipes = NULL;
@@ -486,7 +485,7 @@ sshd_exchange_identification(int sock_in, int sock_out)
486 debug("Client protocol version %d.%d; client software version %.100s", 485 debug("Client protocol version %d.%d; client software version %.100s",
487 remote_major, remote_minor, remote_version); 486 remote_major, remote_minor, remote_version);
488 487
489 compat_datafellows(remote_version); 488 active_state->compat = compat_datafellows(remote_version);
490 489
491 if ((datafellows & SSH_BUG_PROBE) != 0) { 490 if ((datafellows & SSH_BUG_PROBE) != 0) {
492 logit("probed from %s with %s. Don't panic.", 491 logit("probed from %s with %s. Don't panic.",
@@ -622,7 +621,9 @@ privsep_preauth_child(void)
622 621
623 arc4random_stir(); 622 arc4random_stir();
624 arc4random_buf(rnd, sizeof(rnd)); 623 arc4random_buf(rnd, sizeof(rnd));
624#ifdef WITH_OPENSSL
625 RAND_seed(rnd, sizeof(rnd)); 625 RAND_seed(rnd, sizeof(rnd));
626#endif
626 explicit_bzero(rnd, sizeof(rnd)); 627 explicit_bzero(rnd, sizeof(rnd));
627 628
628 /* Demote the private keys to public keys. */ 629 /* Demote the private keys to public keys. */
@@ -652,14 +653,14 @@ privsep_preauth_child(void)
652static int 653static int
653privsep_preauth(Authctxt *authctxt) 654privsep_preauth(Authctxt *authctxt)
654{ 655{
655 int status; 656 int status, r;
656 pid_t pid; 657 pid_t pid;
657 struct ssh_sandbox *box = NULL; 658 struct ssh_sandbox *box = NULL;
658 659
659 /* Set up unprivileged child process to deal with network data */ 660 /* Set up unprivileged child process to deal with network data */
660 pmonitor = monitor_init(); 661 pmonitor = monitor_init();
661 /* Store a pointer to the kex for later rekeying */ 662 /* Store a pointer to the kex for later rekeying */
662 pmonitor->m_pkex = &xxx_kex; 663 pmonitor->m_pkex = &active_state->kex;
663 664
664 if (use_privsep == PRIVSEP_ON) 665 if (use_privsep == PRIVSEP_ON)
665 box = ssh_sandbox_init(pmonitor); 666 box = ssh_sandbox_init(pmonitor);
@@ -670,8 +671,14 @@ privsep_preauth(Authctxt *authctxt)
670 debug2("Network child is on pid %ld", (long)pid); 671 debug2("Network child is on pid %ld", (long)pid);
671 672
672 pmonitor->m_pid = pid; 673 pmonitor->m_pid = pid;
673 if (have_agent) 674 if (have_agent) {
674 auth_conn = ssh_get_authentication_connection(); 675 r = ssh_get_authentication_socket(&auth_sock);
676 if (r != 0) {
677 error("Could not get agent socket: %s",
678 ssh_err(r));
679 have_agent = 0;
680 }
681 }
675 if (box != NULL) 682 if (box != NULL)
676 ssh_sandbox_parent_preauth(box, pid); 683 ssh_sandbox_parent_preauth(box, pid);
677 monitor_child_preauth(authctxt, pmonitor); 684 monitor_child_preauth(authctxt, pmonitor);
@@ -757,7 +764,9 @@ privsep_postauth(Authctxt *authctxt)
757 764
758 arc4random_stir(); 765 arc4random_stir();
759 arc4random_buf(rnd, sizeof(rnd)); 766 arc4random_buf(rnd, sizeof(rnd));
767#ifdef WITH_OPENSSL
760 RAND_seed(rnd, sizeof(rnd)); 768 RAND_seed(rnd, sizeof(rnd));
769#endif
761 explicit_bzero(rnd, sizeof(rnd)); 770 explicit_bzero(rnd, sizeof(rnd));
762 771
763 /* Drop privileges */ 772 /* Drop privileges */
@@ -827,7 +836,7 @@ list_hostkey_types(void)
827} 836}
828 837
829static Key * 838static Key *
830get_hostkey_by_type(int type, int need_private) 839get_hostkey_by_type(int type, int nid, int need_private, struct ssh *ssh)
831{ 840{
832 int i; 841 int i;
833 Key *key; 842 Key *key;
@@ -848,7 +857,8 @@ get_hostkey_by_type(int type, int need_private)
848 key = sensitive_data.host_pubkeys[i]; 857 key = sensitive_data.host_pubkeys[i];
849 break; 858 break;
850 } 859 }
851 if (key != NULL && key->type == type) 860 if (key != NULL && key->type == type &&
861 (key->type != KEY_ECDSA || key->ecdsa_nid == nid))
852 return need_private ? 862 return need_private ?
853 sensitive_data.host_keys[i] : key; 863 sensitive_data.host_keys[i] : key;
854 } 864 }
@@ -856,15 +866,15 @@ get_hostkey_by_type(int type, int need_private)
856} 866}
857 867
858Key * 868Key *
859get_hostkey_public_by_type(int type) 869get_hostkey_public_by_type(int type, int nid, struct ssh *ssh)
860{ 870{
861 return get_hostkey_by_type(type, 0); 871 return get_hostkey_by_type(type, nid, 0, ssh);
862} 872}
863 873
864Key * 874Key *
865get_hostkey_private_by_type(int type) 875get_hostkey_private_by_type(int type, int nid, struct ssh *ssh)
866{ 876{
867 return get_hostkey_by_type(type, 1); 877 return get_hostkey_by_type(type, nid, 1, ssh);
868} 878}
869 879
870Key * 880Key *
@@ -876,7 +886,7 @@ get_hostkey_by_index(int ind)
876} 886}
877 887
878Key * 888Key *
879get_hostkey_public_by_index(int ind) 889get_hostkey_public_by_index(int ind, struct ssh *ssh)
880{ 890{
881 if (ind < 0 || ind >= options.num_host_key_files) 891 if (ind < 0 || ind >= options.num_host_key_files)
882 return (NULL); 892 return (NULL);
@@ -884,24 +894,71 @@ get_hostkey_public_by_index(int ind)
884} 894}
885 895
886int 896int
887get_hostkey_index(Key *key) 897get_hostkey_index(Key *key, int compare, struct ssh *ssh)
888{ 898{
889 int i; 899 int i;
890 900
891 for (i = 0; i < options.num_host_key_files; i++) { 901 for (i = 0; i < options.num_host_key_files; i++) {
892 if (key_is_cert(key)) { 902 if (key_is_cert(key)) {
893 if (key == sensitive_data.host_certificates[i]) 903 if (key == sensitive_data.host_certificates[i] ||
904 (compare && sensitive_data.host_certificates[i] &&
905 sshkey_equal(key,
906 sensitive_data.host_certificates[i])))
894 return (i); 907 return (i);
895 } else { 908 } else {
896 if (key == sensitive_data.host_keys[i]) 909 if (key == sensitive_data.host_keys[i] ||
910 (compare && sensitive_data.host_keys[i] &&
911 sshkey_equal(key, sensitive_data.host_keys[i])))
897 return (i); 912 return (i);
898 if (key == sensitive_data.host_pubkeys[i]) 913 if (key == sensitive_data.host_pubkeys[i] ||
914 (compare && sensitive_data.host_pubkeys[i] &&
915 sshkey_equal(key, sensitive_data.host_pubkeys[i])))
899 return (i); 916 return (i);
900 } 917 }
901 } 918 }
902 return (-1); 919 return (-1);
903} 920}
904 921
922/* Inform the client of all hostkeys */
923static void
924notify_hostkeys(struct ssh *ssh)
925{
926 struct sshbuf *buf;
927 struct sshkey *key;
928 int i, nkeys, r;
929 char *fp;
930
931 if ((buf = sshbuf_new()) == NULL)
932 fatal("%s: sshbuf_new", __func__);
933 for (i = nkeys = 0; i < options.num_host_key_files; i++) {
934 key = get_hostkey_public_by_index(i, ssh);
935 if (key == NULL || key->type == KEY_UNSPEC ||
936 key->type == KEY_RSA1 || sshkey_is_cert(key))
937 continue;
938 fp = sshkey_fingerprint(key, options.fingerprint_hash,
939 SSH_FP_DEFAULT);
940 debug3("%s: key %d: %s %s", __func__, i,
941 sshkey_ssh_name(key), fp);
942 free(fp);
943 if (nkeys == 0) {
944 packet_start(SSH2_MSG_GLOBAL_REQUEST);
945 packet_put_cstring("hostkeys-00@openssh.com");
946 packet_put_char(0); /* want-reply */
947 }
948 sshbuf_reset(buf);
949 if ((r = sshkey_putb(key, buf)) != 0)
950 fatal("%s: couldn't put hostkey %d: %s",
951 __func__, i, ssh_err(r));
952 packet_put_string(sshbuf_ptr(buf), sshbuf_len(buf));
953 nkeys++;
954 }
955 debug3("%s: sent %d hostkeys", __func__, nkeys);
956 if (nkeys == 0)
957 fatal("%s: no hostkeys", __func__);
958 packet_send();
959 sshbuf_free(buf);
960}
961
905/* 962/*
906 * returns 1 if connection should be dropped, 0 otherwise. 963 * returns 1 if connection should be dropped, 0 otherwise.
907 * dropping starts at connection #max_startups_begin with a probability 964 * dropping starts at connection #max_startups_begin with a probability
@@ -987,7 +1044,7 @@ send_rexec_state(int fd, Buffer *conf)
987#endif 1044#endif
988 buffer_put_int(&m, 0); 1045 buffer_put_int(&m, 0);
989 1046
990#ifndef OPENSSL_PRNG_ONLY 1047#if defined(WITH_OPENSSL) && !defined(OPENSSL_PRNG_ONLY)
991 rexec_send_rng_seed(&m); 1048 rexec_send_rng_seed(&m);
992#endif 1049#endif
993 1050
@@ -1040,7 +1097,7 @@ recv_rexec_state(int fd, Buffer *conf)
1040#endif 1097#endif
1041 } 1098 }
1042 1099
1043#ifndef OPENSSL_PRNG_ONLY 1100#if defined(WITH_OPENSSL) && !defined(OPENSSL_PRNG_ONLY)
1044 rexec_recv_rng_seed(&m); 1101 rexec_recv_rng_seed(&m);
1045#endif 1102#endif
1046 1103
@@ -1207,7 +1264,8 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
1207 logit("Received signal %d; terminating.", 1264 logit("Received signal %d; terminating.",
1208 (int) received_sigterm); 1265 (int) received_sigterm);
1209 close_listen_socks(); 1266 close_listen_socks();
1210 unlink(options.pid_file); 1267 if (options.pid_file != NULL)
1268 unlink(options.pid_file);
1211 exit(received_sigterm == SIGTERM ? 0 : 255); 1269 exit(received_sigterm == SIGTERM ? 0 : 255);
1212 } 1270 }
1213 if (key_used && key_do_regen) { 1271 if (key_used && key_do_regen) {
@@ -1370,7 +1428,9 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
1370 */ 1428 */
1371 arc4random_stir(); 1429 arc4random_stir();
1372 arc4random_buf(rnd, sizeof(rnd)); 1430 arc4random_buf(rnd, sizeof(rnd));
1431#ifdef WITH_OPENSSL
1373 RAND_seed(rnd, sizeof(rnd)); 1432 RAND_seed(rnd, sizeof(rnd));
1433#endif
1374 explicit_bzero(rnd, sizeof(rnd)); 1434 explicit_bzero(rnd, sizeof(rnd));
1375 } 1435 }
1376 1436
@@ -1389,11 +1449,11 @@ main(int ac, char **av)
1389{ 1449{
1390 extern char *optarg; 1450 extern char *optarg;
1391 extern int optind; 1451 extern int optind;
1392 int opt, i, j, on = 1; 1452 int r, opt, i, j, on = 1;
1393 int sock_in = -1, sock_out = -1, newsock = -1; 1453 int sock_in = -1, sock_out = -1, newsock = -1;
1394 const char *remote_ip; 1454 const char *remote_ip;
1395 int remote_port; 1455 int remote_port;
1396 char *line, *logfile = NULL; 1456 char *fp, *line, *logfile = NULL;
1397 int config_s[2] = { -1 , -1 }; 1457 int config_s[2] = { -1 , -1 };
1398 u_int n; 1458 u_int n;
1399 u_int64_t ibytes, obytes; 1459 u_int64_t ibytes, obytes;
@@ -1532,8 +1592,8 @@ main(int ac, char **av)
1532 exit(1); 1592 exit(1);
1533 break; 1593 break;
1534 case 'u': 1594 case 'u':
1535 utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL); 1595 utmp_len = (u_int)strtonum(optarg, 0, HOST_NAME_MAX+1+1, NULL);
1536 if (utmp_len > MAXHOSTNAMELEN) { 1596 if (utmp_len > HOST_NAME_MAX+1) {
1537 fprintf(stderr, "Invalid utmp length.\n"); 1597 fprintf(stderr, "Invalid utmp length.\n");
1538 exit(1); 1598 exit(1);
1539 } 1599 }
@@ -1693,21 +1753,25 @@ main(int ac, char **av)
1693 sizeof(Key *)); 1753 sizeof(Key *));
1694 sensitive_data.host_pubkeys = xcalloc(options.num_host_key_files, 1754 sensitive_data.host_pubkeys = xcalloc(options.num_host_key_files,
1695 sizeof(Key *)); 1755 sizeof(Key *));
1696 for (i = 0; i < options.num_host_key_files; i++) {
1697 sensitive_data.host_keys[i] = NULL;
1698 sensitive_data.host_pubkeys[i] = NULL;
1699 }
1700 1756
1701 if (options.host_key_agent) { 1757 if (options.host_key_agent) {
1702 if (strcmp(options.host_key_agent, SSH_AUTHSOCKET_ENV_NAME)) 1758 if (strcmp(options.host_key_agent, SSH_AUTHSOCKET_ENV_NAME))
1703 setenv(SSH_AUTHSOCKET_ENV_NAME, 1759 setenv(SSH_AUTHSOCKET_ENV_NAME,
1704 options.host_key_agent, 1); 1760 options.host_key_agent, 1);
1705 have_agent = ssh_agent_present(); 1761 if ((r = ssh_get_authentication_socket(NULL)) == 0)
1762 have_agent = 1;
1763 else
1764 error("Could not connect to agent \"%s\": %s",
1765 options.host_key_agent, ssh_err(r));
1706 } 1766 }
1707 1767
1708 for (i = 0; i < options.num_host_key_files; i++) { 1768 for (i = 0; i < options.num_host_key_files; i++) {
1769 if (options.host_key_files[i] == NULL)
1770 continue;
1709 key = key_load_private(options.host_key_files[i], "", NULL); 1771 key = key_load_private(options.host_key_files[i], "", NULL);
1710 pubkey = key_load_public(options.host_key_files[i], NULL); 1772 pubkey = key_load_public(options.host_key_files[i], NULL);
1773 if (pubkey == NULL && key != NULL)
1774 pubkey = key_demote(key);
1711 sensitive_data.host_keys[i] = key; 1775 sensitive_data.host_keys[i] = key;
1712 sensitive_data.host_pubkeys[i] = pubkey; 1776 sensitive_data.host_pubkeys[i] = pubkey;
1713 1777
@@ -1735,11 +1799,17 @@ main(int ac, char **av)
1735 case KEY_DSA: 1799 case KEY_DSA:
1736 case KEY_ECDSA: 1800 case KEY_ECDSA:
1737 case KEY_ED25519: 1801 case KEY_ED25519:
1738 sensitive_data.have_ssh2_key = 1; 1802 if (have_agent || key != NULL)
1803 sensitive_data.have_ssh2_key = 1;
1739 break; 1804 break;
1740 } 1805 }
1741 debug("private host key: #%d type %d %s", i, keytype, 1806 if ((fp = sshkey_fingerprint(pubkey, options.fingerprint_hash,
1742 key_type(key ? key : pubkey)); 1807 SSH_FP_DEFAULT)) == NULL)
1808 fatal("sshkey_fingerprint failed");
1809 debug("%s host key #%d: %s %s",
1810 key ? "private" : "agent", i, keytype == KEY_RSA1 ?
1811 sshkey_type(pubkey) : sshkey_ssh_name(pubkey), fp);
1812 free(fp);
1743 } 1813 }
1744 if ((options.protocol & SSH_PROTO_1) && !sensitive_data.have_ssh1_key) { 1814 if ((options.protocol & SSH_PROTO_1) && !sensitive_data.have_ssh1_key) {
1745 logit("Disabling protocol version 1. Could not load host key"); 1815 logit("Disabling protocol version 1. Could not load host key");
@@ -1764,6 +1834,8 @@ main(int ac, char **av)
1764 sensitive_data.host_certificates[i] = NULL; 1834 sensitive_data.host_certificates[i] = NULL;
1765 1835
1766 for (i = 0; i < options.num_host_cert_files; i++) { 1836 for (i = 0; i < options.num_host_cert_files; i++) {
1837 if (options.host_cert_files[i] == NULL)
1838 continue;
1767 key = key_load_public(options.host_cert_files[i], NULL); 1839 key = key_load_public(options.host_cert_files[i], NULL);
1768 if (key == NULL) { 1840 if (key == NULL) {
1769 error("Could not load host certificate: %s", 1841 error("Could not load host certificate: %s",
@@ -1931,7 +2003,7 @@ main(int ac, char **av)
1931 * Write out the pid file after the sigterm handler 2003 * Write out the pid file after the sigterm handler
1932 * is setup and the listen sockets are bound 2004 * is setup and the listen sockets are bound
1933 */ 2005 */
1934 if (!debug_flag) { 2006 if (options.pid_file != NULL && !debug_flag) {
1935 FILE *f = fopen(options.pid_file, "w"); 2007 FILE *f = fopen(options.pid_file, "w");
1936 2008
1937 if (f == NULL) { 2009 if (f == NULL) {
@@ -2095,8 +2167,12 @@ main(int ac, char **av)
2095 if (use_privsep) { 2167 if (use_privsep) {
2096 if (privsep_preauth(authctxt) == 1) 2168 if (privsep_preauth(authctxt) == 1)
2097 goto authenticated; 2169 goto authenticated;
2098 } else if (compat20 && have_agent) 2170 } else if (compat20 && have_agent) {
2099 auth_conn = ssh_get_authentication_connection(); 2171 if ((r = ssh_get_authentication_socket(&auth_sock)) != 0) {
2172 error("Unable to get agent socket: %s", ssh_err(r));
2173 have_agent = 0;
2174 }
2175 }
2100 2176
2101 /* perform the key exchange */ 2177 /* perform the key exchange */
2102 /* authenticate user and start session */ 2178 /* authenticate user and start session */
@@ -2165,12 +2241,15 @@ main(int ac, char **av)
2165 packet_set_timeout(options.client_alive_interval, 2241 packet_set_timeout(options.client_alive_interval,
2166 options.client_alive_count_max); 2242 options.client_alive_count_max);
2167 2243
2244 /* Try to send all our hostkeys to the client */
2245 if (compat20)
2246 notify_hostkeys(active_state);
2247
2168 /* Start session. */ 2248 /* Start session. */
2169 do_authenticated(authctxt); 2249 do_authenticated(authctxt);
2170 2250
2171 /* The connection has been terminated. */ 2251 /* The connection has been terminated. */
2172 packet_get_state(MODE_IN, NULL, NULL, NULL, &ibytes); 2252 packet_get_bytes(&ibytes, &obytes);
2173 packet_get_state(MODE_OUT, NULL, NULL, NULL, &obytes);
2174 verbose("Transferred: sent %llu, received %llu bytes", 2253 verbose("Transferred: sent %llu, received %llu bytes",
2175 (unsigned long long)obytes, (unsigned long long)ibytes); 2254 (unsigned long long)obytes, (unsigned long long)ibytes);
2176 2255
@@ -2252,8 +2331,10 @@ do_ssh1_kex(void)
2252{ 2331{
2253 int i, len; 2332 int i, len;
2254 int rsafail = 0; 2333 int rsafail = 0;
2255 BIGNUM *session_key_int; 2334 BIGNUM *session_key_int, *fake_key_int, *real_key_int;
2256 u_char session_key[SSH_SESSION_KEY_LENGTH]; 2335 u_char session_key[SSH_SESSION_KEY_LENGTH];
2336 u_char fake_key_bytes[4096 / 8];
2337 size_t fake_key_len;
2257 u_char cookie[8]; 2338 u_char cookie[8];
2258 u_int cipher_type, auth_mask, protocol_flags; 2339 u_int cipher_type, auth_mask, protocol_flags;
2259 2340
@@ -2331,74 +2412,61 @@ do_ssh1_kex(void)
2331 debug("Encryption type: %.200s", cipher_name(cipher_type)); 2412 debug("Encryption type: %.200s", cipher_name(cipher_type));
2332 2413
2333 /* Get the encrypted integer. */ 2414 /* Get the encrypted integer. */
2334 if ((session_key_int = BN_new()) == NULL) 2415 if ((real_key_int = BN_new()) == NULL)
2335 fatal("do_ssh1_kex: BN_new failed"); 2416 fatal("do_ssh1_kex: BN_new failed");
2336 packet_get_bignum(session_key_int); 2417 packet_get_bignum(real_key_int);
2337 2418
2338 protocol_flags = packet_get_int(); 2419 protocol_flags = packet_get_int();
2339 packet_set_protocol_flags(protocol_flags); 2420 packet_set_protocol_flags(protocol_flags);
2340 packet_check_eom(); 2421 packet_check_eom();
2341 2422
2342 /* Decrypt session_key_int using host/server keys */ 2423 /* Setup a fake key in case RSA decryption fails */
2343 rsafail = PRIVSEP(ssh1_session_key(session_key_int)); 2424 if ((fake_key_int = BN_new()) == NULL)
2425 fatal("do_ssh1_kex: BN_new failed");
2426 fake_key_len = BN_num_bytes(real_key_int);
2427 if (fake_key_len > sizeof(fake_key_bytes))
2428 fake_key_len = sizeof(fake_key_bytes);
2429 arc4random_buf(fake_key_bytes, fake_key_len);
2430 if (BN_bin2bn(fake_key_bytes, fake_key_len, fake_key_int) == NULL)
2431 fatal("do_ssh1_kex: BN_bin2bn failed");
2432
2433 /* Decrypt real_key_int using host/server keys */
2434 rsafail = PRIVSEP(ssh1_session_key(real_key_int));
2435 /* If decryption failed, use the fake key. Else, the real key. */
2436 if (rsafail)
2437 session_key_int = fake_key_int;
2438 else
2439 session_key_int = real_key_int;
2344 2440
2345 /* 2441 /*
2346 * Extract session key from the decrypted integer. The key is in the 2442 * Extract session key from the decrypted integer. The key is in the
2347 * least significant 256 bits of the integer; the first byte of the 2443 * least significant 256 bits of the integer; the first byte of the
2348 * key is in the highest bits. 2444 * key is in the highest bits.
2349 */ 2445 */
2350 if (!rsafail) { 2446 (void) BN_mask_bits(session_key_int, sizeof(session_key) * 8);
2351 (void) BN_mask_bits(session_key_int, sizeof(session_key) * 8); 2447 len = BN_num_bytes(session_key_int);
2352 len = BN_num_bytes(session_key_int); 2448 if (len < 0 || (u_int)len > sizeof(session_key)) {
2353 if (len < 0 || (u_int)len > sizeof(session_key)) { 2449 error("do_ssh1_kex: bad session key len from %s: "
2354 error("do_ssh1_kex: bad session key len from %s: " 2450 "session_key_int %d > sizeof(session_key) %lu",
2355 "session_key_int %d > sizeof(session_key) %lu", 2451 get_remote_ipaddr(), len, (u_long)sizeof(session_key));
2356 get_remote_ipaddr(), len, (u_long)sizeof(session_key)); 2452 rsafail++;
2357 rsafail++; 2453 } else {
2358 } else { 2454 explicit_bzero(session_key, sizeof(session_key));
2359 explicit_bzero(session_key, sizeof(session_key)); 2455 BN_bn2bin(session_key_int,
2360 BN_bn2bin(session_key_int, 2456 session_key + sizeof(session_key) - len);
2361 session_key + sizeof(session_key) - len); 2457
2362 2458 derive_ssh1_session_id(
2363 derive_ssh1_session_id( 2459 sensitive_data.ssh1_host_key->rsa->n,
2364 sensitive_data.ssh1_host_key->rsa->n, 2460 sensitive_data.server_key->rsa->n,
2365 sensitive_data.server_key->rsa->n, 2461 cookie, session_id);
2366 cookie, session_id); 2462 /*
2367 /* 2463 * Xor the first 16 bytes of the session key with the
2368 * Xor the first 16 bytes of the session key with the 2464 * session id.
2369 * session id. 2465 */
2370 */
2371 for (i = 0; i < 16; i++)
2372 session_key[i] ^= session_id[i];
2373 }
2374 }
2375 if (rsafail) {
2376 int bytes = BN_num_bytes(session_key_int);
2377 u_char *buf = xmalloc(bytes);
2378 struct ssh_digest_ctx *md;
2379
2380 logit("do_connection: generating a fake encryption key");
2381 BN_bn2bin(session_key_int, buf);
2382 if ((md = ssh_digest_start(SSH_DIGEST_MD5)) == NULL ||
2383 ssh_digest_update(md, buf, bytes) < 0 ||
2384 ssh_digest_update(md, sensitive_data.ssh1_cookie,
2385 SSH_SESSION_KEY_LENGTH) < 0 ||
2386 ssh_digest_final(md, session_key, sizeof(session_key)) < 0)
2387 fatal("%s: md5 failed", __func__);
2388 ssh_digest_free(md);
2389 if ((md = ssh_digest_start(SSH_DIGEST_MD5)) == NULL ||
2390 ssh_digest_update(md, session_key, 16) < 0 ||
2391 ssh_digest_update(md, sensitive_data.ssh1_cookie,
2392 SSH_SESSION_KEY_LENGTH) < 0 ||
2393 ssh_digest_final(md, session_key + 16,
2394 sizeof(session_key) - 16) < 0)
2395 fatal("%s: md5 failed", __func__);
2396 ssh_digest_free(md);
2397 explicit_bzero(buf, bytes);
2398 free(buf);
2399 for (i = 0; i < 16; i++) 2466 for (i = 0; i < 16; i++)
2400 session_id[i] = session_key[i] ^ session_key[i + 16]; 2467 session_key[i] ^= session_id[i];
2401 } 2468 }
2469
2402 /* Destroy the private and public keys. No longer. */ 2470 /* Destroy the private and public keys. No longer. */
2403 destroy_sensitive_data(); 2471 destroy_sensitive_data();
2404 2472
@@ -2406,7 +2474,8 @@ do_ssh1_kex(void)
2406 mm_ssh1_session_id(session_id); 2474 mm_ssh1_session_id(session_id);
2407 2475
2408 /* Destroy the decrypted integer. It is no longer needed. */ 2476 /* Destroy the decrypted integer. It is no longer needed. */
2409 BN_clear_free(session_key_int); 2477 BN_clear_free(real_key_int);
2478 BN_clear_free(fake_key_int);
2410 2479
2411 /* Set the session key. From this on all communications will be encrypted. */ 2480 /* Set the session key. From this on all communications will be encrypted. */
2412 packet_set_encryption_key(session_key, SSH_SESSION_KEY_LENGTH, cipher_type); 2481 packet_set_encryption_key(session_key, SSH_SESSION_KEY_LENGTH, cipher_type);
@@ -2423,21 +2492,30 @@ do_ssh1_kex(void)
2423} 2492}
2424#endif 2493#endif
2425 2494
2426void 2495int
2427sshd_hostkey_sign(Key *privkey, Key *pubkey, u_char **signature, u_int *slen, 2496sshd_hostkey_sign(Key *privkey, Key *pubkey, u_char **signature, size_t *slen,
2428 u_char *data, u_int dlen) 2497 const u_char *data, size_t dlen, u_int flag)
2429{ 2498{
2499 int r;
2500 u_int xxx_slen, xxx_dlen = dlen;
2501
2430 if (privkey) { 2502 if (privkey) {
2431 if (PRIVSEP(key_sign(privkey, signature, slen, data, dlen) < 0)) 2503 if (PRIVSEP(key_sign(privkey, signature, &xxx_slen, data, xxx_dlen) < 0))
2432 fatal("%s: key_sign failed", __func__); 2504 fatal("%s: key_sign failed", __func__);
2505 if (slen)
2506 *slen = xxx_slen;
2433 } else if (use_privsep) { 2507 } else if (use_privsep) {
2434 if (mm_key_sign(pubkey, signature, slen, data, dlen) < 0) 2508 if (mm_key_sign(pubkey, signature, &xxx_slen, data, xxx_dlen) < 0)
2435 fatal("%s: pubkey_sign failed", __func__); 2509 fatal("%s: pubkey_sign failed", __func__);
2510 if (slen)
2511 *slen = xxx_slen;
2436 } else { 2512 } else {
2437 if (ssh_agent_sign(auth_conn, pubkey, signature, slen, data, 2513 if ((r = ssh_agent_sign(auth_sock, pubkey, signature, slen,
2438 dlen)) 2514 data, dlen, datafellows)) != 0)
2439 fatal("%s: ssh_agent_sign failed", __func__); 2515 fatal("%s: ssh_agent_sign failed: %s",
2516 __func__, ssh_err(r));
2440 } 2517 }
2518 return 0;
2441} 2519}
2442 2520
2443/* 2521/*
@@ -2447,7 +2525,8 @@ static void
2447do_ssh2_kex(void) 2525do_ssh2_kex(void)
2448{ 2526{
2449 char *myproposal[PROPOSAL_MAX] = { KEX_SERVER }; 2527 char *myproposal[PROPOSAL_MAX] = { KEX_SERVER };
2450 Kex *kex; 2528 struct kex *kex;
2529 int r;
2451 2530
2452 if (options.ciphers != NULL) { 2531 if (options.ciphers != NULL) {
2453 myproposal[PROPOSAL_ENC_ALGS_CTOS] = 2532 myproposal[PROPOSAL_ENC_ALGS_CTOS] =
@@ -2483,13 +2562,17 @@ do_ssh2_kex(void)
2483 list_hostkey_types()); 2562 list_hostkey_types());
2484 2563
2485 /* start key exchange */ 2564 /* start key exchange */
2486 kex = kex_setup(myproposal); 2565 if ((r = kex_setup(active_state, myproposal)) != 0)
2566 fatal("kex_setup: %s", ssh_err(r));
2567 kex = active_state->kex;
2487#ifdef WITH_OPENSSL 2568#ifdef WITH_OPENSSL
2488 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; 2569 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
2489 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server; 2570 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
2490 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; 2571 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
2491 kex->kex[KEX_DH_GEX_SHA256] = kexgex_server; 2572 kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
2573# ifdef OPENSSL_HAS_ECC
2492 kex->kex[KEX_ECDH_SHA2] = kexecdh_server; 2574 kex->kex[KEX_ECDH_SHA2] = kexecdh_server;
2575# endif
2493#endif 2576#endif
2494 kex->kex[KEX_C25519_SHA256] = kexc25519_server; 2577 kex->kex[KEX_C25519_SHA256] = kexc25519_server;
2495 kex->server = 1; 2578 kex->server = 1;
@@ -2500,9 +2583,7 @@ do_ssh2_kex(void)
2500 kex->host_key_index=&get_hostkey_index; 2583 kex->host_key_index=&get_hostkey_index;
2501 kex->sign = sshd_hostkey_sign; 2584 kex->sign = sshd_hostkey_sign;
2502 2585
2503 xxx_kex = kex; 2586 dispatch_run(DISPATCH_BLOCK, &kex->done, active_state);
2504
2505 dispatch_run(DISPATCH_BLOCK, &kex->done, kex);
2506 2587
2507 session_id2 = kex->session_id; 2588 session_id2 = kex->session_id;
2508 session_id2_len = kex->session_id_len; 2589 session_id2_len = kex->session_id_len;
diff --git a/sshd_config b/sshd_config
index e9045bc4d..c9042ac3c 100644
--- a/sshd_config
+++ b/sshd_config
@@ -1,4 +1,4 @@
1# $OpenBSD: sshd_config,v 1.93 2014/01/10 05:59:19 djm Exp $ 1# $OpenBSD: sshd_config,v 1.94 2015/02/02 01:57:44 deraadt Exp $
2 2
3# This is the sshd server system-wide configuration file. See 3# This is the sshd server system-wide configuration file. See
4# sshd_config(5) for more information. 4# sshd_config(5) for more information.
@@ -112,7 +112,7 @@ UsePrivilegeSeparation sandbox # Default for new installations.
112#Compression delayed 112#Compression delayed
113#ClientAliveInterval 0 113#ClientAliveInterval 0
114#ClientAliveCountMax 3 114#ClientAliveCountMax 3
115#UseDNS yes 115#UseDNS no
116#PidFile /var/run/sshd.pid 116#PidFile /var/run/sshd.pid
117#MaxStartups 10:30:100 117#MaxStartups 10:30:100
118#PermitTunnel no 118#PermitTunnel no
diff --git a/sshd_config.0 b/sshd_config.0
index 1c82d449f..be48e1364 100644
--- a/sshd_config.0
+++ b/sshd_config.0
@@ -1,7 +1,7 @@
1SSHD_CONFIG(5) File Formats Manual SSHD_CONFIG(5) 1SSHD_CONFIG(5) File Formats Manual SSHD_CONFIG(5)
2 2
3NAME 3NAME
4 sshd_config - OpenSSH SSH daemon configuration file 4 sshd_config M-bM-^@M-^S OpenSSH SSH daemon configuration file
5 5
6SYNOPSIS 6SYNOPSIS
7 /etc/ssh/sshd_config 7 /etc/ssh/sshd_config
@@ -9,7 +9,7 @@ SYNOPSIS
9DESCRIPTION 9DESCRIPTION
10 sshd(8) reads configuration data from /etc/ssh/sshd_config (or the file 10 sshd(8) reads configuration data from /etc/ssh/sshd_config (or the file
11 specified with -f on the command line). The file contains keyword- 11 specified with -f on the command line). The file contains keyword-
12 argument pairs, one per line. Lines starting with `#' and empty lines 12 argument pairs, one per line. Lines starting with M-bM-^@M-^X#M-bM-^@M-^Y and empty lines
13 are interpreted as comments. Arguments may optionally be enclosed in 13 are interpreted as comments. Arguments may optionally be enclosed in
14 double quotes (") in order to represent arguments containing spaces. 14 double quotes (") in order to represent arguments containing spaces.
15 15
@@ -22,7 +22,7 @@ DESCRIPTION
22 ssh_config(5) for how to configure the client. Note that 22 ssh_config(5) for how to configure the client. Note that
23 environment passing is only supported for protocol 2. Variables 23 environment passing is only supported for protocol 2. Variables
24 are specified by name, which may contain the wildcard characters 24 are specified by name, which may contain the wildcard characters
25 `*' and `?'. Multiple environment variables may be separated by 25 M-bM-^@M-^X*M-bM-^@M-^Y and M-bM-^@M-^X?M-bM-^@M-^Y. Multiple environment variables may be separated by
26 whitespace or spread across multiple AcceptEnv directives. Be 26 whitespace or spread across multiple AcceptEnv directives. Be
27 warned that some environment variables could be used to bypass 27 warned that some environment variables could be used to bypass
28 restricted user environments. For this reason, care should be 28 restricted user environments. For this reason, care should be
@@ -31,14 +31,14 @@ DESCRIPTION
31 31
32 AddressFamily 32 AddressFamily
33 Specifies which address family should be used by sshd(8). Valid 33 Specifies which address family should be used by sshd(8). Valid
34 arguments are ``any'', ``inet'' (use IPv4 only), or ``inet6'' 34 arguments are M-bM-^@M-^\anyM-bM-^@M-^], M-bM-^@M-^\inetM-bM-^@M-^] (use IPv4 only), or M-bM-^@M-^\inet6M-bM-^@M-^] (use IPv6
35 (use IPv6 only). The default is ``any''. 35 only). The default is M-bM-^@M-^\anyM-bM-^@M-^].
36 36
37 AllowAgentForwarding 37 AllowAgentForwarding
38 Specifies whether ssh-agent(1) forwarding is permitted. The 38 Specifies whether ssh-agent(1) forwarding is permitted. The
39 default is ``yes''. Note that disabling agent forwarding does 39 default is M-bM-^@M-^\yesM-bM-^@M-^]. Note that disabling agent forwarding does not
40 not improve security unless users are also denied shell access, 40 improve security unless users are also denied shell access, as
41 as they can always install their own forwarders. 41 they can always install their own forwarders.
42 42
43 AllowGroups 43 AllowGroups
44 This keyword can be followed by a list of group name patterns, 44 This keyword can be followed by a list of group name patterns,
@@ -54,21 +54,21 @@ DESCRIPTION
54 54
55 AllowTcpForwarding 55 AllowTcpForwarding
56 Specifies whether TCP forwarding is permitted. The available 56 Specifies whether TCP forwarding is permitted. The available
57 options are ``yes'' or ``all'' to allow TCP forwarding, ``no'' to 57 options are M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\allM-bM-^@M-^] to allow TCP forwarding, M-bM-^@M-^\noM-bM-^@M-^] to
58 prevent all TCP forwarding, ``local'' to allow local (from the 58 prevent all TCP forwarding, M-bM-^@M-^\localM-bM-^@M-^] to allow local (from the
59 perspective of ssh(1)) forwarding only or ``remote'' to allow 59 perspective of ssh(1)) forwarding only or M-bM-^@M-^\remoteM-bM-^@M-^] to allow
60 remote forwarding only. The default is ``yes''. Note that 60 remote forwarding only. The default is M-bM-^@M-^\yesM-bM-^@M-^]. Note that
61 disabling TCP forwarding does not improve security unless users 61 disabling TCP forwarding does not improve security unless users
62 are also denied shell access, as they can always install their 62 are also denied shell access, as they can always install their
63 own forwarders. 63 own forwarders.
64 64
65 AllowStreamLocalForwarding 65 AllowStreamLocalForwarding
66 Specifies whether StreamLocal (Unix-domain socket) forwarding is 66 Specifies whether StreamLocal (Unix-domain socket) forwarding is
67 permitted. The available options are ``yes'' or ``all'' to allow 67 permitted. The available options are M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\allM-bM-^@M-^] to allow
68 StreamLocal forwarding, ``no'' to prevent all StreamLocal 68 StreamLocal forwarding, M-bM-^@M-^\noM-bM-^@M-^] to prevent all StreamLocal
69 forwarding, ``local'' to allow local (from the perspective of 69 forwarding, M-bM-^@M-^\localM-bM-^@M-^] to allow local (from the perspective of
70 ssh(1)) forwarding only or ``remote'' to allow remote forwarding 70 ssh(1)) forwarding only or M-bM-^@M-^\remoteM-bM-^@M-^] to allow remote forwarding
71 only. The default is ``yes''. Note that disabling StreamLocal 71 only. The default is M-bM-^@M-^\yesM-bM-^@M-^]. Note that disabling StreamLocal
72 forwarding does not improve security unless users are also denied 72 forwarding does not improve security unless users are also denied
73 shell access, as they can always install their own forwarders. 73 shell access, as they can always install their own forwarders.
74 74
@@ -92,8 +92,8 @@ DESCRIPTION
92 method names. Successful authentication requires completion of 92 method names. Successful authentication requires completion of
93 every method in at least one of these lists. 93 every method in at least one of these lists.
94 94
95 For example, an argument of ``publickey,password 95 For example, an argument of M-bM-^@M-^\publickey,password
96 publickey,keyboard-interactive'' would require the user to 96 publickey,keyboard-interactiveM-bM-^@M-^] would require the user to
97 complete public key authentication, followed by either password 97 complete public key authentication, followed by either password
98 or keyboard interactive authentication. Only methods that are 98 or keyboard interactive authentication. Only methods that are
99 next in one or more lists are offered at each stage, so for this 99 next in one or more lists are offered at each stage, so for this
@@ -102,10 +102,16 @@ DESCRIPTION
102 102
103 For keyboard interactive authentication it is also possible to 103 For keyboard interactive authentication it is also possible to
104 restrict authentication to a specific device by appending a colon 104 restrict authentication to a specific device by appending a colon
105 followed by the device identifier ``bsdauth'', ``pam'', or 105 followed by the device identifier M-bM-^@M-^\bsdauthM-bM-^@M-^], M-bM-^@M-^\pamM-bM-^@M-^], or M-bM-^@M-^\skeyM-bM-^@M-^],
106 ``skey'', depending on the server configuration. For example, 106 depending on the server configuration. For example,
107 ``keyboard-interactive:bsdauth'' would restrict keyboard 107 M-bM-^@M-^\keyboard-interactive:bsdauthM-bM-^@M-^] would restrict keyboard
108 interactive authentication to the ``bsdauth'' device. 108 interactive authentication to the M-bM-^@M-^\bsdauthM-bM-^@M-^] device.
109
110 If the M-bM-^@M-^\publickeyM-bM-^@M-^] method is listed more than once, sshd(8)
111 verifies that keys that have been used successfully are not
112 reused for subsequent authentications. For example, an
113 AuthenticationMethods of M-bM-^@M-^\publickey,publickeyM-bM-^@M-^] will require
114 successful authentication using two different public keys.
109 115
110 This option is only available for SSH protocol 2 and will yield a 116 This option is only available for SSH protocol 2 and will yield a
111 fatal error if enabled if protocol 1 is also enabled. Note that 117 fatal error if enabled if protocol 1 is also enabled. Note that
@@ -129,7 +135,9 @@ DESCRIPTION
129 AuthorizedKeysCommandUser 135 AuthorizedKeysCommandUser
130 Specifies the user under whose account the AuthorizedKeysCommand 136 Specifies the user under whose account the AuthorizedKeysCommand
131 is run. It is recommended to use a dedicated user that has no 137 is run. It is recommended to use a dedicated user that has no
132 other role on the host than running authorized keys commands. 138 other role on the host than running authorized keys commands. If
139 AuthorizedKeysCommand is specified but AuthorizedKeysCommandUser
140 is not, then sshd(8) will refuse to start.
133 141
134 AuthorizedKeysFile 142 AuthorizedKeysFile
135 Specifies the file that contains the public keys that can be used 143 Specifies the file that contains the public keys that can be used
@@ -143,7 +151,7 @@ DESCRIPTION
143 AuthorizedKeysFile is taken to be an absolute path or one 151 AuthorizedKeysFile is taken to be an absolute path or one
144 relative to the user's home directory. Multiple files may be 152 relative to the user's home directory. Multiple files may be
145 listed, separated by whitespace. The default is 153 listed, separated by whitespace. The default is
146 ``.ssh/authorized_keys .ssh/authorized_keys2''. 154 M-bM-^@M-^\.ssh/authorized_keys .ssh/authorized_keys2M-bM-^@M-^].
147 155
148 AuthorizedPrincipalsFile 156 AuthorizedPrincipalsFile
149 Specifies a file that lists principal names that are accepted for 157 Specifies a file that lists principal names that are accepted for
@@ -152,7 +160,7 @@ DESCRIPTION
152 which must appear in the certificate for it to be accepted for 160 which must appear in the certificate for it to be accepted for
153 authentication. Names are listed one per line preceded by key 161 authentication. Names are listed one per line preceded by key
154 options (as described in AUTHORIZED_KEYS FILE FORMAT in sshd(8)). 162 options (as described in AUTHORIZED_KEYS FILE FORMAT in sshd(8)).
155 Empty lines and comments starting with `#' are ignored. 163 Empty lines and comments starting with M-bM-^@M-^X#M-bM-^@M-^Y are ignored.
156 164
157 AuthorizedPrincipalsFile may contain tokens of the form %T which 165 AuthorizedPrincipalsFile may contain tokens of the form %T which
158 are substituted during connection setup. The following tokens 166 are substituted during connection setup. The following tokens
@@ -162,7 +170,7 @@ DESCRIPTION
162 AuthorizedPrincipalsFile is taken to be an absolute path or one 170 AuthorizedPrincipalsFile is taken to be an absolute path or one
163 relative to the user's home directory. 171 relative to the user's home directory.
164 172
165 The default is ``none'', i.e. not to use a principals file - in 173 The default is M-bM-^@M-^\noneM-bM-^@M-^], i.e. not to use a principals file M-bM-^@M-^S in
166 this case, the username of the user must appear in a 174 this case, the username of the user must appear in a
167 certificate's principals list for it to be accepted. Note that 175 certificate's principals list for it to be accepted. Note that
168 AuthorizedPrincipalsFile is only used when authentication 176 AuthorizedPrincipalsFile is only used when authentication
@@ -172,21 +180,22 @@ DESCRIPTION
172 a similar facility (see sshd(8) for details). 180 a similar facility (see sshd(8) for details).
173 181
174 Banner The contents of the specified file are sent to the remote user 182 Banner The contents of the specified file are sent to the remote user
175 before authentication is allowed. If the argument is ``none'' 183 before authentication is allowed. If the argument is M-bM-^@M-^\noneM-bM-^@M-^] then
176 then no banner is displayed. This option is only available for 184 no banner is displayed. This option is only available for
177 protocol version 2. By default, no banner is displayed. 185 protocol version 2. By default, no banner is displayed.
178 186
179 ChallengeResponseAuthentication 187 ChallengeResponseAuthentication
180 Specifies whether challenge-response authentication is allowed 188 Specifies whether challenge-response authentication is allowed
181 (e.g. via PAM or through authentication styles supported in 189 (e.g. via PAM or through authentication styles supported in
182 login.conf(5)) The default is ``yes''. 190 login.conf(5)) The default is M-bM-^@M-^\yesM-bM-^@M-^].
183 191
184 ChrootDirectory 192 ChrootDirectory
185 Specifies the pathname of a directory to chroot(2) to after 193 Specifies the pathname of a directory to chroot(2) to after
186 authentication. All components of the pathname must be root- 194 authentication. At session startup sshd(8) checks that all
187 owned directories that are not writable by any other user or 195 components of the pathname are root-owned directories which are
188 group. After the chroot, sshd(8) changes the working directory 196 not writable by any other user or group. After the chroot,
189 to the user's home directory. 197 sshd(8) changes the working directory to the user's home
198 directory.
190 199
191 The pathname may contain the following tokens that are expanded 200 The pathname may contain the following tokens that are expanded
192 at runtime once the connecting user has been authenticated: %% is 201 at runtime once the connecting user has been authenticated: %% is
@@ -198,12 +207,17 @@ DESCRIPTION
198 directories to support the user's session. For an interactive 207 directories to support the user's session. For an interactive
199 session this requires at least a shell, typically sh(1), and 208 session this requires at least a shell, typically sh(1), and
200 basic /dev nodes such as null(4), zero(4), stdin(4), stdout(4), 209 basic /dev nodes such as null(4), zero(4), stdin(4), stdout(4),
201 stderr(4), arandom(4) and tty(4) devices. For file transfer 210 stderr(4), and tty(4) devices. For file transfer sessions using
202 sessions using ``sftp'', no additional configuration of the 211 M-bM-^@M-^\sftpM-bM-^@M-^], no additional configuration of the environment is
203 environment is necessary if the in-process sftp server is used, 212 necessary if the in-process sftp server is used, though sessions
204 though sessions which use logging may require /dev/log inside the 213 which use logging may require /dev/log inside the chroot
205 chroot directory on some operating systems (see sftp-server(8) 214 directory on some operating systems (see sftp-server(8) for
206 for details). 215 details).
216
217 For safety, it is very important that the directory hierarchy be
218 prevented from modification by other processes on the system
219 (especially those outside the jail). Misconfiguration can lead
220 to unsafe environments which sshd(8) cannot detect.
207 221
208 The default is not to chroot(2). 222 The default is not to chroot(2).
209 223
@@ -234,7 +248,7 @@ DESCRIPTION
234 chacha20-poly1305@openssh.com 248 chacha20-poly1305@openssh.com
235 249
236 The list of available ciphers may also be obtained using the -Q 250 The list of available ciphers may also be obtained using the -Q
237 option of ssh(1). 251 option of ssh(1) with an argument of M-bM-^@M-^\cipherM-bM-^@M-^].
238 252
239 ClientAliveCountMax 253 ClientAliveCountMax
240 Sets the number of client alive messages (see below) which may be 254 Sets the number of client alive messages (see below) which may be
@@ -264,8 +278,8 @@ DESCRIPTION
264 278
265 Compression 279 Compression
266 Specifies whether compression is allowed, or delayed until the 280 Specifies whether compression is allowed, or delayed until the
267 user has authenticated successfully. The argument must be 281 user has authenticated successfully. The argument must be M-bM-^@M-^\yesM-bM-^@M-^],
268 ``yes'', ``delayed'', or ``no''. The default is ``delayed''. 282 M-bM-^@M-^\delayedM-bM-^@M-^], or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\delayedM-bM-^@M-^].
269 283
270 DenyGroups 284 DenyGroups
271 This keyword can be followed by a list of group name patterns, 285 This keyword can be followed by a list of group name patterns,
@@ -291,6 +305,10 @@ DESCRIPTION
291 305
292 See PATTERNS in ssh_config(5) for more information on patterns. 306 See PATTERNS in ssh_config(5) for more information on patterns.
293 307
308 FingerprintHash
309 Specifies the hash algorithm used when logging key fingerprints.
310 Valid options are: M-bM-^@M-^\md5M-bM-^@M-^] and M-bM-^@M-^\sha256M-bM-^@M-^]. The default is M-bM-^@M-^\sha256M-bM-^@M-^].
311
294 ForceCommand 312 ForceCommand
295 Forces the execution of the command specified by ForceCommand, 313 Forces the execution of the command specified by ForceCommand,
296 ignoring any command supplied by the client and ~/.ssh/rc if 314 ignoring any command supplied by the client and ~/.ssh/rc if
@@ -299,7 +317,7 @@ DESCRIPTION
299 execution. It is most useful inside a Match block. The command 317 execution. It is most useful inside a Match block. The command
300 originally supplied by the client is available in the 318 originally supplied by the client is available in the
301 SSH_ORIGINAL_COMMAND environment variable. Specifying a command 319 SSH_ORIGINAL_COMMAND environment variable. Specifying a command
302 of ``internal-sftp'' will force the use of an in-process sftp 320 of M-bM-^@M-^\internal-sftpM-bM-^@M-^] will force the use of an in-process sftp
303 server that requires no support files when used with 321 server that requires no support files when used with
304 ChrootDirectory. 322 ChrootDirectory.
305 323
@@ -310,37 +328,43 @@ DESCRIPTION
310 hosts from connecting to forwarded ports. GatewayPorts can be 328 hosts from connecting to forwarded ports. GatewayPorts can be
311 used to specify that sshd should allow remote port forwardings to 329 used to specify that sshd should allow remote port forwardings to
312 bind to non-loopback addresses, thus allowing other hosts to 330 bind to non-loopback addresses, thus allowing other hosts to
313 connect. The argument may be ``no'' to force remote port 331 connect. The argument may be M-bM-^@M-^\noM-bM-^@M-^] to force remote port
314 forwardings to be available to the local host only, ``yes'' to 332 forwardings to be available to the local host only, M-bM-^@M-^\yesM-bM-^@M-^] to
315 force remote port forwardings to bind to the wildcard address, or 333 force remote port forwardings to bind to the wildcard address, or
316 ``clientspecified'' to allow the client to select the address to 334 M-bM-^@M-^\clientspecifiedM-bM-^@M-^] to allow the client to select the address to
317 which the forwarding is bound. The default is ``no''. 335 which the forwarding is bound. The default is M-bM-^@M-^\noM-bM-^@M-^].
318 336
319 GSSAPIAuthentication 337 GSSAPIAuthentication
320 Specifies whether user authentication based on GSSAPI is allowed. 338 Specifies whether user authentication based on GSSAPI is allowed.
321 The default is ``no''. Note that this option applies to protocol 339 The default is M-bM-^@M-^\noM-bM-^@M-^]. Note that this option applies to protocol
322 version 2 only. 340 version 2 only.
323 341
324 GSSAPICleanupCredentials 342 GSSAPICleanupCredentials
325 Specifies whether to automatically destroy the user's credentials 343 Specifies whether to automatically destroy the user's credentials
326 cache on logout. The default is ``yes''. Note that this option 344 cache on logout. The default is M-bM-^@M-^\yesM-bM-^@M-^]. Note that this option
327 applies to protocol version 2 only. 345 applies to protocol version 2 only.
328 346
347 HostbasedAcceptedKeyTypes
348 Specifies the key types that will be accepted for hostbased
349 authentication as a comma-separated pattern list. The default
350 M-bM-^@M-^\*M-bM-^@M-^] will allow all key types. The -Q option of ssh(1) may be
351 used to list supported key types.
352
329 HostbasedAuthentication 353 HostbasedAuthentication
330 Specifies whether rhosts or /etc/hosts.equiv authentication 354 Specifies whether rhosts or /etc/hosts.equiv authentication
331 together with successful public key client host authentication is 355 together with successful public key client host authentication is
332 allowed (host-based authentication). This option is similar to 356 allowed (host-based authentication). This option is similar to
333 RhostsRSAAuthentication and applies to protocol version 2 only. 357 RhostsRSAAuthentication and applies to protocol version 2 only.
334 The default is ``no''. 358 The default is M-bM-^@M-^\noM-bM-^@M-^].
335 359
336 HostbasedUsesNameFromPacketOnly 360 HostbasedUsesNameFromPacketOnly
337 Specifies whether or not the server will attempt to perform a 361 Specifies whether or not the server will attempt to perform a
338 reverse name lookup when matching the name in the ~/.shosts, 362 reverse name lookup when matching the name in the ~/.shosts,
339 ~/.rhosts, and /etc/hosts.equiv files during 363 ~/.rhosts, and /etc/hosts.equiv files during
340 HostbasedAuthentication. A setting of ``yes'' means that sshd(8) 364 HostbasedAuthentication. A setting of M-bM-^@M-^\yesM-bM-^@M-^] means that sshd(8)
341 uses the name supplied by the client rather than attempting to 365 uses the name supplied by the client rather than attempting to
342 resolve the name from the TCP connection itself. The default is 366 resolve the name from the TCP connection itself. The default is
343 ``no''. 367 M-bM-^@M-^\noM-bM-^@M-^].
344 368
345 HostCertificate 369 HostCertificate
346 Specifies a file containing a public host certificate. The 370 Specifies a file containing a public host certificate. The
@@ -355,70 +379,69 @@ DESCRIPTION
355 /etc/ssh/ssh_host_ed25519_key and /etc/ssh/ssh_host_rsa_key for 379 /etc/ssh/ssh_host_ed25519_key and /etc/ssh/ssh_host_rsa_key for
356 protocol version 2. Note that sshd(8) will refuse to use a file 380 protocol version 2. Note that sshd(8) will refuse to use a file
357 if it is group/world-accessible. It is possible to have multiple 381 if it is group/world-accessible. It is possible to have multiple
358 host key files. ``rsa1'' keys are used for version 1 and 382 host key files. M-bM-^@M-^\rsa1M-bM-^@M-^] keys are used for version 1 and M-bM-^@M-^\dsaM-bM-^@M-^],
359 ``dsa'', ``ecdsa'', ``ed25519'' or ``rsa'' are used for version 2 383 M-bM-^@M-^\ecdsaM-bM-^@M-^], M-bM-^@M-^\ed25519M-bM-^@M-^] or M-bM-^@M-^\rsaM-bM-^@M-^] are used for version 2 of the SSH
360 of the SSH protocol. It is also possible to specify public host 384 protocol. It is also possible to specify public host key files
361 key files instead. In this case operations on the private key 385 instead. In this case operations on the private key will be
362 will be delegated to an ssh-agent(1). 386 delegated to an ssh-agent(1).
363 387
364 HostKeyAgent 388 HostKeyAgent
365 Identifies the UNIX-domain socket used to communicate with an 389 Identifies the UNIX-domain socket used to communicate with an
366 agent that has access to the private host keys. If 390 agent that has access to the private host keys. If
367 ``SSH_AUTH_SOCK'' is specified, the location of the socket will 391 M-bM-^@M-^\SSH_AUTH_SOCKM-bM-^@M-^] is specified, the location of the socket will be
368 be read from the SSH_AUTH_SOCK environment variable. 392 read from the SSH_AUTH_SOCK environment variable.
369 393
370 IgnoreRhosts 394 IgnoreRhosts
371 Specifies that .rhosts and .shosts files will not be used in 395 Specifies that .rhosts and .shosts files will not be used in
372 RhostsRSAAuthentication or HostbasedAuthentication. 396 RhostsRSAAuthentication or HostbasedAuthentication.
373 397
374 /etc/hosts.equiv and /etc/shosts.equiv are still used. The 398 /etc/hosts.equiv and /etc/shosts.equiv are still used. The
375 default is ``yes''. 399 default is M-bM-^@M-^\yesM-bM-^@M-^].
376 400
377 IgnoreUserKnownHosts 401 IgnoreUserKnownHosts
378 Specifies whether sshd(8) should ignore the user's 402 Specifies whether sshd(8) should ignore the user's
379 ~/.ssh/known_hosts during RhostsRSAAuthentication or 403 ~/.ssh/known_hosts during RhostsRSAAuthentication or
380 HostbasedAuthentication. The default is ``no''. 404 HostbasedAuthentication. The default is M-bM-^@M-^\noM-bM-^@M-^].
381 405
382 IPQoS Specifies the IPv4 type-of-service or DSCP class for the 406 IPQoS Specifies the IPv4 type-of-service or DSCP class for the
383 connection. Accepted values are ``af11'', ``af12'', ``af13'', 407 connection. Accepted values are M-bM-^@M-^\af11M-bM-^@M-^], M-bM-^@M-^\af12M-bM-^@M-^], M-bM-^@M-^\af13M-bM-^@M-^], M-bM-^@M-^\af21M-bM-^@M-^],
384 ``af21'', ``af22'', ``af23'', ``af31'', ``af32'', ``af33'', 408 M-bM-^@M-^\af22M-bM-^@M-^], M-bM-^@M-^\af23M-bM-^@M-^], M-bM-^@M-^\af31M-bM-^@M-^], M-bM-^@M-^\af32M-bM-^@M-^], M-bM-^@M-^\af33M-bM-^@M-^], M-bM-^@M-^\af41M-bM-^@M-^], M-bM-^@M-^\af42M-bM-^@M-^], M-bM-^@M-^\af43M-bM-^@M-^],
385 ``af41'', ``af42'', ``af43'', ``cs0'', ``cs1'', ``cs2'', ``cs3'', 409 M-bM-^@M-^\cs0M-bM-^@M-^], M-bM-^@M-^\cs1M-bM-^@M-^], M-bM-^@M-^\cs2M-bM-^@M-^], M-bM-^@M-^\cs3M-bM-^@M-^], M-bM-^@M-^\cs4M-bM-^@M-^], M-bM-^@M-^\cs5M-bM-^@M-^], M-bM-^@M-^\cs6M-bM-^@M-^], M-bM-^@M-^\cs7M-bM-^@M-^], M-bM-^@M-^\efM-bM-^@M-^],
386 ``cs4'', ``cs5'', ``cs6'', ``cs7'', ``ef'', ``lowdelay'', 410 M-bM-^@M-^\lowdelayM-bM-^@M-^], M-bM-^@M-^\throughputM-bM-^@M-^], M-bM-^@M-^\reliabilityM-bM-^@M-^], or a numeric value.
387 ``throughput'', ``reliability'', or a numeric value. This option 411 This option may take one or two arguments, separated by
388 may take one or two arguments, separated by whitespace. If one 412 whitespace. If one argument is specified, it is used as the
389 argument is specified, it is used as the packet class 413 packet class unconditionally. If two values are specified, the
390 unconditionally. If two values are specified, the first is 414 first is automatically selected for interactive sessions and the
391 automatically selected for interactive sessions and the second 415 second for non-interactive sessions. The default is M-bM-^@M-^\lowdelayM-bM-^@M-^]
392 for non-interactive sessions. The default is ``lowdelay'' for 416 for interactive sessions and M-bM-^@M-^\throughputM-bM-^@M-^] for non-interactive
393 interactive sessions and ``throughput'' for non-interactive
394 sessions. 417 sessions.
395 418
396 KbdInteractiveAuthentication 419 KbdInteractiveAuthentication
397 Specifies whether to allow keyboard-interactive authentication. 420 Specifies whether to allow keyboard-interactive authentication.
398 The argument to this keyword must be ``yes'' or ``no''. The 421 The argument to this keyword must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default
399 default is to use whatever value ChallengeResponseAuthentication 422 is to use whatever value ChallengeResponseAuthentication is set
400 is set to (by default ``yes''). 423 to (by default M-bM-^@M-^\yesM-bM-^@M-^]).
401 424
402 KerberosAuthentication 425 KerberosAuthentication
403 Specifies whether the password provided by the user for 426 Specifies whether the password provided by the user for
404 PasswordAuthentication will be validated through the Kerberos 427 PasswordAuthentication will be validated through the Kerberos
405 KDC. To use this option, the server needs a Kerberos servtab 428 KDC. To use this option, the server needs a Kerberos servtab
406 which allows the verification of the KDC's identity. The default 429 which allows the verification of the KDC's identity. The default
407 is ``no''. 430 is M-bM-^@M-^\noM-bM-^@M-^].
408 431
409 KerberosGetAFSToken 432 KerberosGetAFSToken
410 If AFS is active and the user has a Kerberos 5 TGT, attempt to 433 If AFS is active and the user has a Kerberos 5 TGT, attempt to
411 acquire an AFS token before accessing the user's home directory. 434 acquire an AFS token before accessing the user's home directory.
412 The default is ``no''. 435 The default is M-bM-^@M-^\noM-bM-^@M-^].
413 436
414 KerberosOrLocalPasswd 437 KerberosOrLocalPasswd
415 If password authentication through Kerberos fails then the 438 If password authentication through Kerberos fails then the
416 password will be validated via any additional local mechanism 439 password will be validated via any additional local mechanism
417 such as /etc/passwd. The default is ``yes''. 440 such as /etc/passwd. The default is M-bM-^@M-^\yesM-bM-^@M-^].
418 441
419 KerberosTicketCleanup 442 KerberosTicketCleanup
420 Specifies whether to automatically destroy the user's ticket 443 Specifies whether to automatically destroy the user's ticket
421 cache file on logout. The default is ``yes''. 444 cache file on logout. The default is M-bM-^@M-^\yesM-bM-^@M-^].
422 445
423 KexAlgorithms 446 KexAlgorithms
424 Specifies the available KEX (Key Exchange) algorithms. Multiple 447 Specifies the available KEX (Key Exchange) algorithms. Multiple
@@ -441,6 +464,9 @@ DESCRIPTION
441 diffie-hellman-group-exchange-sha256, 464 diffie-hellman-group-exchange-sha256,
442 diffie-hellman-group14-sha1 465 diffie-hellman-group14-sha1
443 466
467 The list of available key exchange algorithms may also be
468 obtained using the -Q option of ssh(1) with an argument of M-bM-^@M-^\kexM-bM-^@M-^].
469
444 KeyRegenerationInterval 470 KeyRegenerationInterval
445 In protocol version 1, the ephemeral server key is automatically 471 In protocol version 1, the ephemeral server key is automatically
446 regenerated after this many seconds (if it has been used). The 472 regenerated after this many seconds (if it has been used). The
@@ -479,9 +505,9 @@ DESCRIPTION
479 MACs Specifies the available MAC (message authentication code) 505 MACs Specifies the available MAC (message authentication code)
480 algorithms. The MAC algorithm is used in protocol version 2 for 506 algorithms. The MAC algorithm is used in protocol version 2 for
481 data integrity protection. Multiple algorithms must be comma- 507 data integrity protection. Multiple algorithms must be comma-
482 separated. The algorithms that contain ``-etm'' calculate the 508 separated. The algorithms that contain M-bM-^@M-^\-etmM-bM-^@M-^] calculate the MAC
483 MAC after encryption (encrypt-then-mac). These are considered 509 after encryption (encrypt-then-mac). These are considered safer
484 safer and their use recommended. The supported MACs are: 510 and their use recommended. The supported MACs are:
485 511
486 hmac-md5 512 hmac-md5
487 hmac-md5-96 513 hmac-md5-96
@@ -509,12 +535,15 @@ DESCRIPTION
509 umac-64@openssh.com,umac-128@openssh.com, 535 umac-64@openssh.com,umac-128@openssh.com,
510 hmac-sha2-256,hmac-sha2-512 536 hmac-sha2-256,hmac-sha2-512
511 537
538 The list of available MAC algorithms may also be obtained using
539 the -Q option of ssh(1) with an argument of M-bM-^@M-^\macM-bM-^@M-^].
540
512 Match Introduces a conditional block. If all of the criteria on the 541 Match Introduces a conditional block. If all of the criteria on the
513 Match line are satisfied, the keywords on the following lines 542 Match line are satisfied, the keywords on the following lines
514 override those set in the global section of the config file, 543 override those set in the global section of the config file,
515 until either another Match line or the end of the file. If a 544 until either another Match line or the end of the file. If a
516 keyword appears in multiple Match blocks that are satisified, 545 keyword appears in multiple Match blocks that are satisfied, only
517 only the first instance of the keyword is applied. 546 the first instance of the keyword is applied.
518 547
519 The arguments to Match are one or more criteria-pattern pairs or 548 The arguments to Match are one or more criteria-pattern pairs or
520 the single token All which matches all criteria. The available 549 the single token All which matches all criteria. The available
@@ -525,25 +554,28 @@ DESCRIPTION
525 554
526 The patterns in an Address criteria may additionally contain 555 The patterns in an Address criteria may additionally contain
527 addresses to match in CIDR address/masklen format, e.g. 556 addresses to match in CIDR address/masklen format, e.g.
528 ``192.0.2.0/24'' or ``3ffe:ffff::/32''. Note that the mask 557 M-bM-^@M-^\192.0.2.0/24M-bM-^@M-^] or M-bM-^@M-^\3ffe:ffff::/32M-bM-^@M-^]. Note that the mask length
529 length provided must be consistent with the address - it is an 558 provided must be consistent with the address - it is an error to
530 error to specify a mask length that is too long for the address 559 specify a mask length that is too long for the address or one
531 or one with bits set in this host portion of the address. For 560 with bits set in this host portion of the address. For example,
532 example, ``192.0.2.0/33'' and ``192.0.2.0/8'' respectively. 561 M-bM-^@M-^\192.0.2.0/33M-bM-^@M-^] and M-bM-^@M-^\192.0.2.0/8M-bM-^@M-^] respectively.
533 562
534 Only a subset of keywords may be used on the lines following a 563 Only a subset of keywords may be used on the lines following a
535 Match keyword. Available keywords are AcceptEnv, 564 Match keyword. Available keywords are AcceptEnv,
536 AllowAgentForwarding, AllowGroups, AllowTcpForwarding, 565 AllowAgentForwarding, AllowGroups, AllowStreamLocalForwarding,
537 AllowUsers, AuthenticationMethods, AuthorizedKeysCommand, 566 AllowTcpForwarding, AllowUsers, AuthenticationMethods,
538 AuthorizedKeysCommandUser, AuthorizedKeysFile, 567 AuthorizedKeysCommand, AuthorizedKeysCommandUser,
539 AuthorizedPrincipalsFile, Banner, ChrootDirectory, DenyGroups, 568 AuthorizedKeysFile, AuthorizedPrincipalsFile, Banner,
540 DenyUsers, ForceCommand, GatewayPorts, GSSAPIAuthentication, 569 ChrootDirectory, DenyGroups, DenyUsers, ForceCommand,
541 HostbasedAuthentication, HostbasedUsesNameFromPacketOnly, 570 GatewayPorts, GSSAPIAuthentication, HostbasedAcceptedKeyTypes,
571 HostbasedAuthentication, HostbasedUsesNameFromPacketOnly, IPQoS,
542 KbdInteractiveAuthentication, KerberosAuthentication, 572 KbdInteractiveAuthentication, KerberosAuthentication,
543 MaxAuthTries, MaxSessions, PasswordAuthentication, 573 MaxAuthTries, MaxSessions, PasswordAuthentication,
544 PermitEmptyPasswords, PermitOpen, PermitRootLogin, PermitTTY, 574 PermitEmptyPasswords, PermitOpen, PermitRootLogin, PermitTTY,
545 PermitTunnel, PermitUserRC, PubkeyAuthentication, RekeyLimit, 575 PermitTunnel, PermitUserRC, PubkeyAcceptedKeyTypes,
546 RhostsRSAAuthentication, RSAAuthentication, X11DisplayOffset, 576 PubkeyAuthentication, RekeyLimit, RevokedKeys,
577 RhostsRSAAuthentication, RSAAuthentication, StreamLocalBindMask,
578 StreamLocalBindUnlink, TrustedUserCAKeys, X11DisplayOffset,
547 X11Forwarding and X11UseLocalHost. 579 X11Forwarding and X11UseLocalHost.
548 580
549 MaxAuthTries 581 MaxAuthTries
@@ -562,21 +594,21 @@ DESCRIPTION
562 expires for a connection. The default is 10:30:100. 594 expires for a connection. The default is 10:30:100.
563 595
564 Alternatively, random early drop can be enabled by specifying the 596 Alternatively, random early drop can be enabled by specifying the
565 three colon separated values ``start:rate:full'' (e.g. 597 three colon separated values M-bM-^@M-^\start:rate:fullM-bM-^@M-^] (e.g. "10:30:60").
566 "10:30:60"). sshd(8) will refuse connection attempts with a 598 sshd(8) will refuse connection attempts with a probability of
567 probability of ``rate/100'' (30%) if there are currently 599 M-bM-^@M-^\rate/100M-bM-^@M-^] (30%) if there are currently M-bM-^@M-^\startM-bM-^@M-^] (10)
568 ``start'' (10) unauthenticated connections. The probability 600 unauthenticated connections. The probability increases linearly
569 increases linearly and all connection attempts are refused if the 601 and all connection attempts are refused if the number of
570 number of unauthenticated connections reaches ``full'' (60). 602 unauthenticated connections reaches M-bM-^@M-^\fullM-bM-^@M-^] (60).
571 603
572 PasswordAuthentication 604 PasswordAuthentication
573 Specifies whether password authentication is allowed. The 605 Specifies whether password authentication is allowed. The
574 default is ``yes''. 606 default is M-bM-^@M-^\yesM-bM-^@M-^].
575 607
576 PermitEmptyPasswords 608 PermitEmptyPasswords
577 When password authentication is allowed, it specifies whether the 609 When password authentication is allowed, it specifies whether the
578 server allows login to accounts with empty password strings. The 610 server allows login to accounts with empty password strings. The
579 default is ``no''. 611 default is M-bM-^@M-^\noM-bM-^@M-^].
580 612
581 PermitOpen 613 PermitOpen
582 Specifies the destinations to which TCP port forwarding is 614 Specifies the destinations to which TCP port forwarding is
@@ -588,47 +620,50 @@ DESCRIPTION
588 PermitOpen [IPv6_addr]:port 620 PermitOpen [IPv6_addr]:port
589 621
590 Multiple forwards may be specified by separating them with 622 Multiple forwards may be specified by separating them with
591 whitespace. An argument of ``any'' can be used to remove all 623 whitespace. An argument of M-bM-^@M-^\anyM-bM-^@M-^] can be used to remove all
592 restrictions and permit any forwarding requests. An argument of 624 restrictions and permit any forwarding requests. An argument of
593 ``none'' can be used to prohibit all forwarding requests. By 625 M-bM-^@M-^\noneM-bM-^@M-^] can be used to prohibit all forwarding requests. By
594 default all port forwarding requests are permitted. 626 default all port forwarding requests are permitted.
595 627
596 PermitRootLogin 628 PermitRootLogin
597 Specifies whether root can log in using ssh(1). The argument 629 Specifies whether root can log in using ssh(1). The argument
598 must be ``yes'', ``without-password'', ``forced-commands-only'', 630 must be M-bM-^@M-^\yesM-bM-^@M-^], M-bM-^@M-^\without-passwordM-bM-^@M-^], M-bM-^@M-^\forced-commands-onlyM-bM-^@M-^], or
599 or ``no''. The default is ``yes''. 631 M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\yesM-bM-^@M-^].
600 632
601 If this option is set to ``without-password'', password 633 If this option is set to M-bM-^@M-^\without-passwordM-bM-^@M-^], password
602 authentication is disabled for root. 634 authentication is disabled for root.
603 635
604 If this option is set to ``forced-commands-only'', root login 636 If this option is set to M-bM-^@M-^\forced-commands-onlyM-bM-^@M-^], root login with
605 with public key authentication will be allowed, but only if the 637 public key authentication will be allowed, but only if the
606 command option has been specified (which may be useful for taking 638 command option has been specified (which may be useful for taking
607 remote backups even if root login is normally not allowed). All 639 remote backups even if root login is normally not allowed). All
608 other authentication methods are disabled for root. 640 other authentication methods are disabled for root.
609 641
610 If this option is set to ``no'', root is not allowed to log in. 642 If this option is set to M-bM-^@M-^\noM-bM-^@M-^], root is not allowed to log in.
611 643
612 PermitTunnel 644 PermitTunnel
613 Specifies whether tun(4) device forwarding is allowed. The 645 Specifies whether tun(4) device forwarding is allowed. The
614 argument must be ``yes'', ``point-to-point'' (layer 3), 646 argument must be M-bM-^@M-^\yesM-bM-^@M-^], M-bM-^@M-^\point-to-pointM-bM-^@M-^] (layer 3), M-bM-^@M-^\ethernetM-bM-^@M-^]
615 ``ethernet'' (layer 2), or ``no''. Specifying ``yes'' permits 647 (layer 2), or M-bM-^@M-^\noM-bM-^@M-^]. Specifying M-bM-^@M-^\yesM-bM-^@M-^] permits both
616 both ``point-to-point'' and ``ethernet''. The default is ``no''. 648 M-bM-^@M-^\point-to-pointM-bM-^@M-^] and M-bM-^@M-^\ethernetM-bM-^@M-^]. The default is M-bM-^@M-^\noM-bM-^@M-^].
649
650 Independent of this setting, the permissions of the selected
651 tun(4) device must allow access to the user.
617 652
618 PermitTTY 653 PermitTTY
619 Specifies whether pty(4) allocation is permitted. The default is 654 Specifies whether pty(4) allocation is permitted. The default is
620 ``yes''. 655 M-bM-^@M-^\yesM-bM-^@M-^].
621 656
622 PermitUserEnvironment 657 PermitUserEnvironment
623 Specifies whether ~/.ssh/environment and environment= options in 658 Specifies whether ~/.ssh/environment and environment= options in
624 ~/.ssh/authorized_keys are processed by sshd(8). The default is 659 ~/.ssh/authorized_keys are processed by sshd(8). The default is
625 ``no''. Enabling environment processing may enable users to 660 M-bM-^@M-^\noM-bM-^@M-^]. Enabling environment processing may enable users to bypass
626 bypass access restrictions in some configurations using 661 access restrictions in some configurations using mechanisms such
627 mechanisms such as LD_PRELOAD. 662 as LD_PRELOAD.
628 663
629 PermitUserRC 664 PermitUserRC
630 Specifies whether any ~/.ssh/rc file is executed. The default is 665 Specifies whether any ~/.ssh/rc file is executed. The default is
631 ``yes''. 666 M-bM-^@M-^\yesM-bM-^@M-^].
632 667
633 PidFile 668 PidFile
634 Specifies the file that contains the process ID of the SSH 669 Specifies the file that contains the process ID of the SSH
@@ -641,24 +676,30 @@ DESCRIPTION
641 PrintLastLog 676 PrintLastLog
642 Specifies whether sshd(8) should print the date and time of the 677 Specifies whether sshd(8) should print the date and time of the
643 last user login when a user logs in interactively. The default 678 last user login when a user logs in interactively. The default
644 is ``yes''. 679 is M-bM-^@M-^\yesM-bM-^@M-^].
645 680
646 PrintMotd 681 PrintMotd
647 Specifies whether sshd(8) should print /etc/motd when a user logs 682 Specifies whether sshd(8) should print /etc/motd when a user logs
648 in interactively. (On some systems it is also printed by the 683 in interactively. (On some systems it is also printed by the
649 shell, /etc/profile, or equivalent.) The default is ``yes''. 684 shell, /etc/profile, or equivalent.) The default is M-bM-^@M-^\yesM-bM-^@M-^].
650 685
651 Protocol 686 Protocol
652 Specifies the protocol versions sshd(8) supports. The possible 687 Specifies the protocol versions sshd(8) supports. The possible
653 values are `1' and `2'. Multiple versions must be comma- 688 values are M-bM-^@M-^X1M-bM-^@M-^Y and M-bM-^@M-^X2M-bM-^@M-^Y. Multiple versions must be comma-
654 separated. The default is `2'. Note that the order of the 689 separated. The default is M-bM-^@M-^X2M-bM-^@M-^Y. Note that the order of the
655 protocol list does not indicate preference, because the client 690 protocol list does not indicate preference, because the client
656 selects among multiple protocol versions offered by the server. 691 selects among multiple protocol versions offered by the server.
657 Specifying ``2,1'' is identical to ``1,2''. 692 Specifying M-bM-^@M-^\2,1M-bM-^@M-^] is identical to M-bM-^@M-^\1,2M-bM-^@M-^].
693
694 PubkeyAcceptedKeyTypes
695 Specifies the key types that will be accepted for public key
696 authentication as a comma-separated pattern list. The default
697 M-bM-^@M-^\*M-bM-^@M-^] will allow all key types. The -Q option of ssh(1) may be
698 used to list supported key types.
658 699
659 PubkeyAuthentication 700 PubkeyAuthentication
660 Specifies whether public key authentication is allowed. The 701 Specifies whether public key authentication is allowed. The
661 default is ``yes''. Note that this option applies to protocol 702 default is M-bM-^@M-^\yesM-bM-^@M-^]. Note that this option applies to protocol
662 version 2 only. 703 version 2 only.
663 704
664 RekeyLimit 705 RekeyLimit
@@ -666,12 +707,12 @@ DESCRIPTION
666 before the session key is renegotiated, optionally followed a 707 before the session key is renegotiated, optionally followed a
667 maximum amount of time that may pass before the session key is 708 maximum amount of time that may pass before the session key is
668 renegotiated. The first argument is specified in bytes and may 709 renegotiated. The first argument is specified in bytes and may
669 have a suffix of `K', `M', or `G' to indicate Kilobytes, 710 have a suffix of M-bM-^@M-^XKM-bM-^@M-^Y, M-bM-^@M-^XMM-bM-^@M-^Y, or M-bM-^@M-^XGM-bM-^@M-^Y to indicate Kilobytes,
670 Megabytes, or Gigabytes, respectively. The default is between 711 Megabytes, or Gigabytes, respectively. The default is between
671 `1G' and `4G', depending on the cipher. The optional second 712 M-bM-^@M-^X1GM-bM-^@M-^Y and M-bM-^@M-^X4GM-bM-^@M-^Y, depending on the cipher. The optional second
672 value is specified in seconds and may use any of the units 713 value is specified in seconds and may use any of the units
673 documented in the TIME FORMATS section. The default value for 714 documented in the TIME FORMATS section. The default value for
674 RekeyLimit is ``default none'', which means that rekeying is 715 RekeyLimit is M-bM-^@M-^\default noneM-bM-^@M-^], which means that rekeying is
675 performed after the cipher's default amount of data has been sent 716 performed after the cipher's default amount of data has been sent
676 or received and no time based rekeying is done. This option 717 or received and no time based rekeying is done. This option
677 applies to protocol version 2 only. 718 applies to protocol version 2 only.
@@ -688,12 +729,11 @@ DESCRIPTION
688 RhostsRSAAuthentication 729 RhostsRSAAuthentication
689 Specifies whether rhosts or /etc/hosts.equiv authentication 730 Specifies whether rhosts or /etc/hosts.equiv authentication
690 together with successful RSA host authentication is allowed. The 731 together with successful RSA host authentication is allowed. The
691 default is ``no''. This option applies to protocol version 1 732 default is M-bM-^@M-^\noM-bM-^@M-^]. This option applies to protocol version 1 only.
692 only.
693 733
694 RSAAuthentication 734 RSAAuthentication
695 Specifies whether pure RSA authentication is allowed. The 735 Specifies whether pure RSA authentication is allowed. The
696 default is ``yes''. This option applies to protocol version 1 736 default is M-bM-^@M-^\yesM-bM-^@M-^]. This option applies to protocol version 1
697 only. 737 only.
698 738
699 ServerKeyBits 739 ServerKeyBits
@@ -719,14 +759,14 @@ DESCRIPTION
719 domain socket file. This option is only used for port forwarding 759 domain socket file. This option is only used for port forwarding
720 to a Unix-domain socket file. 760 to a Unix-domain socket file.
721 761
722 The argument must be ``yes'' or ``no''. The default is ``no''. 762 The argument must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\noM-bM-^@M-^].
723 763
724 StrictModes 764 StrictModes
725 Specifies whether sshd(8) should check file modes and ownership 765 Specifies whether sshd(8) should check file modes and ownership
726 of the user's files and home directory before accepting login. 766 of the user's files and home directory before accepting login.
727 This is normally desirable because novices sometimes accidentally 767 This is normally desirable because novices sometimes accidentally
728 leave their directory or files world-writable. The default is 768 leave their directory or files world-writable. The default is
729 ``yes''. Note that this does not apply to ChrootDirectory, whose 769 M-bM-^@M-^\yesM-bM-^@M-^]. Note that this does not apply to ChrootDirectory, whose
730 permissions and ownership are checked unconditionally. 770 permissions and ownership are checked unconditionally.
731 771
732 Subsystem 772 Subsystem
@@ -734,11 +774,11 @@ DESCRIPTION
734 Arguments should be a subsystem name and a command (with optional 774 Arguments should be a subsystem name and a command (with optional
735 arguments) to execute upon subsystem request. 775 arguments) to execute upon subsystem request.
736 776
737 The command sftp-server(8) implements the ``sftp'' file transfer 777 The command sftp-server(8) implements the M-bM-^@M-^\sftpM-bM-^@M-^] file transfer
738 subsystem. 778 subsystem.
739 779
740 Alternately the name ``internal-sftp'' implements an in-process 780 Alternately the name M-bM-^@M-^\internal-sftpM-bM-^@M-^] implements an in-process
741 ``sftp'' server. This may simplify configurations using 781 M-bM-^@M-^\sftpM-bM-^@M-^] server. This may simplify configurations using
742 ChrootDirectory to force a different filesystem root on clients. 782 ChrootDirectory to force a different filesystem root on clients.
743 783
744 By default no subsystems are defined. Note that this option 784 By default no subsystems are defined. Note that this option
@@ -757,21 +797,21 @@ DESCRIPTION
757 this means that connections will die if the route is down 797 this means that connections will die if the route is down
758 temporarily, and some people find it annoying. On the other 798 temporarily, and some people find it annoying. On the other
759 hand, if TCP keepalives are not sent, sessions may hang 799 hand, if TCP keepalives are not sent, sessions may hang
760 indefinitely on the server, leaving ``ghost'' users and consuming 800 indefinitely on the server, leaving M-bM-^@M-^\ghostM-bM-^@M-^] users and consuming
761 server resources. 801 server resources.
762 802
763 The default is ``yes'' (to send TCP keepalive messages), and the 803 The default is M-bM-^@M-^\yesM-bM-^@M-^] (to send TCP keepalive messages), and the
764 server will notice if the network goes down or the client host 804 server will notice if the network goes down or the client host
765 crashes. This avoids infinitely hanging sessions. 805 crashes. This avoids infinitely hanging sessions.
766 806
767 To disable TCP keepalive messages, the value should be set to 807 To disable TCP keepalive messages, the value should be set to
768 ``no''. 808 M-bM-^@M-^\noM-bM-^@M-^].
769 809
770 TrustedUserCAKeys 810 TrustedUserCAKeys
771 Specifies a file containing public keys of certificate 811 Specifies a file containing public keys of certificate
772 authorities that are trusted to sign user certificates for 812 authorities that are trusted to sign user certificates for
773 authentication. Keys are listed one per line; empty lines and 813 authentication. Keys are listed one per line; empty lines and
774 comments starting with `#' are allowed. If a certificate is 814 comments starting with M-bM-^@M-^X#M-bM-^@M-^Y are allowed. If a certificate is
775 presented for authentication and has its signing CA key listed in 815 presented for authentication and has its signing CA key listed in
776 this file, then it may be used for authentication for any user 816 this file, then it may be used for authentication for any user
777 listed in the certificate's principals list. Note that 817 listed in the certificate's principals list. Note that
@@ -781,18 +821,18 @@ DESCRIPTION
781 821
782 UseDNS Specifies whether sshd(8) should look up the remote host name and 822 UseDNS Specifies whether sshd(8) should look up the remote host name and
783 check that the resolved host name for the remote IP address maps 823 check that the resolved host name for the remote IP address maps
784 back to the very same IP address. The default is ``yes''. 824 back to the very same IP address. The default is M-bM-^@M-^\noM-bM-^@M-^].
785 825
786 UseLogin 826 UseLogin
787 Specifies whether login(1) is used for interactive login 827 Specifies whether login(1) is used for interactive login
788 sessions. The default is ``no''. Note that login(1) is never 828 sessions. The default is M-bM-^@M-^\noM-bM-^@M-^]. Note that login(1) is never used
789 used for remote command execution. Note also, that if this is 829 for remote command execution. Note also, that if this is
790 enabled, X11Forwarding will be disabled because login(1) does not 830 enabled, X11Forwarding will be disabled because login(1) does not
791 know how to handle xauth(1) cookies. If UsePrivilegeSeparation 831 know how to handle xauth(1) cookies. If UsePrivilegeSeparation
792 is specified, it will be disabled after authentication. 832 is specified, it will be disabled after authentication.
793 833
794 UsePAM Enables the Pluggable Authentication Module interface. If set to 834 UsePAM Enables the Pluggable Authentication Module interface. If set to
795 ``yes'' this will enable PAM authentication using 835 M-bM-^@M-^\yesM-bM-^@M-^] this will enable PAM authentication using
796 ChallengeResponseAuthentication and PasswordAuthentication in 836 ChallengeResponseAuthentication and PasswordAuthentication in
797 addition to PAM account and session module processing for all 837 addition to PAM account and session module processing for all
798 authentication types. 838 authentication types.
@@ -802,7 +842,7 @@ DESCRIPTION
802 either PasswordAuthentication or ChallengeResponseAuthentication. 842 either PasswordAuthentication or ChallengeResponseAuthentication.
803 843
804 If UsePAM is enabled, you will not be able to run sshd(8) as a 844 If UsePAM is enabled, you will not be able to run sshd(8) as a
805 non-root user. The default is ``no''. 845 non-root user. The default is M-bM-^@M-^\noM-bM-^@M-^].
806 846
807 UsePrivilegeSeparation 847 UsePrivilegeSeparation
808 Specifies whether sshd(8) separates privileges by creating an 848 Specifies whether sshd(8) separates privileges by creating an
@@ -811,14 +851,14 @@ DESCRIPTION
811 that has the privilege of the authenticated user. The goal of 851 that has the privilege of the authenticated user. The goal of
812 privilege separation is to prevent privilege escalation by 852 privilege separation is to prevent privilege escalation by
813 containing any corruption within the unprivileged processes. The 853 containing any corruption within the unprivileged processes. The
814 default is ``yes''. If UsePrivilegeSeparation is set to 854 default is M-bM-^@M-^\yesM-bM-^@M-^]. If UsePrivilegeSeparation is set to M-bM-^@M-^\sandboxM-bM-^@M-^]
815 ``sandbox'' then the pre-authentication unprivileged process is 855 then the pre-authentication unprivileged process is subject to
816 subject to additional restrictions. 856 additional restrictions.
817 857
818 VersionAddendum 858 VersionAddendum
819 Optionally specifies additional text to append to the SSH 859 Optionally specifies additional text to append to the SSH
820 protocol banner sent by the server upon connection. The default 860 protocol banner sent by the server upon connection. The default
821 is ``none''. 861 is M-bM-^@M-^\noneM-bM-^@M-^].
822 862
823 X11DisplayOffset 863 X11DisplayOffset
824 Specifies the first display number available for sshd(8)'s X11 864 Specifies the first display number available for sshd(8)'s X11
@@ -827,7 +867,7 @@ DESCRIPTION
827 867
828 X11Forwarding 868 X11Forwarding
829 Specifies whether X11 forwarding is permitted. The argument must 869 Specifies whether X11 forwarding is permitted. The argument must
830 be ``yes'' or ``no''. The default is ``no''. 870 be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The default is M-bM-^@M-^\noM-bM-^@M-^].
831 871
832 When X11 forwarding is enabled, there may be additional exposure 872 When X11 forwarding is enabled, there may be additional exposure
833 to the server and to client displays if the sshd(8) proxy display 873 to the server and to client displays if the sshd(8) proxy display
@@ -841,7 +881,7 @@ DESCRIPTION
841 ssh_config(5)). A system administrator may have a stance in 881 ssh_config(5)). A system administrator may have a stance in
842 which they want to protect clients that may expose themselves to 882 which they want to protect clients that may expose themselves to
843 attack by unwittingly requesting X11 forwarding, which can 883 attack by unwittingly requesting X11 forwarding, which can
844 warrant a ``no'' setting. 884 warrant a M-bM-^@M-^\noM-bM-^@M-^] setting.
845 885
846 Note that disabling X11 forwarding does not prevent users from 886 Note that disabling X11 forwarding does not prevent users from
847 forwarding X11 traffic, as users can always install their own 887 forwarding X11 traffic, as users can always install their own
@@ -853,12 +893,12 @@ DESCRIPTION
853 to the loopback address or to the wildcard address. By default, 893 to the loopback address or to the wildcard address. By default,
854 sshd binds the forwarding server to the loopback address and sets 894 sshd binds the forwarding server to the loopback address and sets
855 the hostname part of the DISPLAY environment variable to 895 the hostname part of the DISPLAY environment variable to
856 ``localhost''. This prevents remote hosts from connecting to the 896 M-bM-^@M-^\localhostM-bM-^@M-^]. This prevents remote hosts from connecting to the
857 proxy display. However, some older X11 clients may not function 897 proxy display. However, some older X11 clients may not function
858 with this configuration. X11UseLocalhost may be set to ``no'' to 898 with this configuration. X11UseLocalhost may be set to M-bM-^@M-^\noM-bM-^@M-^] to
859 specify that the forwarding server should be bound to the 899 specify that the forwarding server should be bound to the
860 wildcard address. The argument must be ``yes'' or ``no''. The 900 wildcard address. The argument must be M-bM-^@M-^\yesM-bM-^@M-^] or M-bM-^@M-^\noM-bM-^@M-^]. The
861 default is ``yes''. 901 default is M-bM-^@M-^\yesM-bM-^@M-^].
862 902
863 XAuthLocation 903 XAuthLocation
864 Specifies the full pathname of the xauth(1) program. The default 904 Specifies the full pathname of the xauth(1) program. The default
@@ -870,7 +910,7 @@ TIME FORMATS
870 time[qualifier], where time is a positive integer value and qualifier is 910 time[qualifier], where time is a positive integer value and qualifier is
871 one of the following: 911 one of the following:
872 912
873 <none> seconds 913 M-bM-^_M-(noneM-bM-^_M-) seconds
874 s | S seconds 914 s | S seconds
875 m | M minutes 915 m | M minutes
876 h | H hours 916 h | H hours
@@ -903,4 +943,4 @@ AUTHORS
903 versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support 943 versions 1.5 and 2.0. Niels Provos and Markus Friedl contributed support
904 for privilege separation. 944 for privilege separation.
905 945
906OpenBSD 5.6 July 28, 2014 OpenBSD 5.6 946OpenBSD 5.7 February 20, 2015 OpenBSD 5.7
diff --git a/sshd_config.5 b/sshd_config.5
index fd44abe75..6dce0c70c 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -33,8 +33,8 @@
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\" 35.\"
36.\" $OpenBSD: sshd_config.5,v 1.176 2014/07/28 15:40:08 schwarze Exp $ 36.\" $OpenBSD: sshd_config.5,v 1.194 2015/02/20 23:46:01 djm Exp $
37.Dd $Mdocdate: July 28 2014 $ 37.Dd $Mdocdate: February 20 2015 $
38.Dt SSHD_CONFIG 5 38.Dt SSHD_CONFIG 5
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -210,6 +210,18 @@ would restrict keyboard interactive authentication to the
210.Dq bsdauth 210.Dq bsdauth
211device. 211device.
212.Pp 212.Pp
213If the
214.Dq publickey
215method is listed more than once,
216.Xr sshd 8
217verifies that keys that have been used successfully are not reused for
218subsequent authentications.
219For example, an
220.Cm AuthenticationMethods
221of
222.Dq publickey,publickey
223will require successful authentication using two different public keys.
224.Pp
213This option is only available for SSH protocol 2 and will yield a fatal 225This option is only available for SSH protocol 2 and will yield a fatal
214error if enabled if protocol 1 is also enabled. 226error if enabled if protocol 1 is also enabled.
215Note that each authentication method listed should also be explicitly enabled 227Note that each authentication method listed should also be explicitly enabled
@@ -232,6 +244,13 @@ By default, no AuthorizedKeysCommand is run.
232Specifies the user under whose account the AuthorizedKeysCommand is run. 244Specifies the user under whose account the AuthorizedKeysCommand is run.
233It is recommended to use a dedicated user that has no other role on the host 245It is recommended to use a dedicated user that has no other role on the host
234than running authorized keys commands. 246than running authorized keys commands.
247If
248.Cm AuthorizedKeysCommand
249is specified but
250.Cm AuthorizedKeysCommandUser
251is not, then
252.Xr sshd 8
253will refuse to start.
235.It Cm AuthorizedKeysFile 254.It Cm AuthorizedKeysFile
236Specifies the file that contains the public keys that can be used 255Specifies the file that contains the public keys that can be used
237for user authentication. 256for user authentication.
@@ -311,8 +330,10 @@ The default is
311Specifies the pathname of a directory to 330Specifies the pathname of a directory to
312.Xr chroot 2 331.Xr chroot 2
313to after authentication. 332to after authentication.
314All components of the pathname must be root-owned directories that are 333At session startup
315not writable by any other user or group. 334.Xr sshd 8
335checks that all components of the pathname are root-owned directories
336which are not writable by any other user or group.
316After the chroot, 337After the chroot,
317.Xr sshd 8 338.Xr sshd 8
318changes the working directory to the user's home directory. 339changes the working directory to the user's home directory.
@@ -336,7 +357,6 @@ nodes such as
336.Xr stdin 4 , 357.Xr stdin 4 ,
337.Xr stdout 4 , 358.Xr stdout 4 ,
338.Xr stderr 4 , 359.Xr stderr 4 ,
339.Xr arandom 4
340and 360and
341.Xr tty 4 361.Xr tty 4
342devices. 362devices.
@@ -350,6 +370,13 @@ inside the chroot directory on some operating systems (see
350.Xr sftp-server 8 370.Xr sftp-server 8
351for details). 371for details).
352.Pp 372.Pp
373For safety, it is very important that the directory hierarchy be
374prevented from modification by other processes on the system (especially
375those outside the jail).
376Misconfiguration can lead to unsafe environments which
377.Xr sshd 8
378cannot detect.
379.Pp
353The default is not to 380The default is not to
354.Xr chroot 2 . 381.Xr chroot 2 .
355.It Cm Ciphers 382.It Cm Ciphers
@@ -400,7 +427,9 @@ chacha20-poly1305@openssh.com
400The list of available ciphers may also be obtained using the 427The list of available ciphers may also be obtained using the
401.Fl Q 428.Fl Q
402option of 429option of
403.Xr ssh 1 . 430.Xr ssh 1
431with an argument of
432.Dq cipher .
404.It Cm ClientAliveCountMax 433.It Cm ClientAliveCountMax
405Sets the number of client alive messages (see below) which may be 434Sets the number of client alive messages (see below) which may be
406sent without 435sent without
@@ -483,6 +512,14 @@ and finally
483See PATTERNS in 512See PATTERNS in
484.Xr ssh_config 5 513.Xr ssh_config 5
485for more information on patterns. 514for more information on patterns.
515.It Cm FingerprintHash
516Specifies the hash algorithm used when logging key fingerprints.
517Valid options are:
518.Dq md5
519and
520.Dq sha256 .
521The default is
522.Dq sha256 .
486.It Cm ForceCommand 523.It Cm ForceCommand
487Forces the execution of the command specified by 524Forces the execution of the command specified by
488.Cm ForceCommand , 525.Cm ForceCommand ,
@@ -533,6 +570,17 @@ on logout.
533The default is 570The default is
534.Dq yes . 571.Dq yes .
535Note that this option applies to protocol version 2 only. 572Note that this option applies to protocol version 2 only.
573.It Cm HostbasedAcceptedKeyTypes
574Specifies the key types that will be accepted for hostbased authentication
575as a comma-separated pattern list.
576The default
577.Dq *
578will allow all key types.
579The
580.Fl Q
581option of
582.Xr ssh 1
583may be used to list supported key types.
536.It Cm HostbasedAuthentication 584.It Cm HostbasedAuthentication
537Specifies whether rhosts or /etc/hosts.equiv authentication together 585Specifies whether rhosts or /etc/hosts.equiv authentication together
538with successful public key client host authentication is allowed 586with successful public key client host authentication is allowed
@@ -734,6 +782,13 @@ ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
734diffie-hellman-group-exchange-sha256, 782diffie-hellman-group-exchange-sha256,
735diffie-hellman-group14-sha1 783diffie-hellman-group14-sha1
736.Ed 784.Ed
785.Pp
786The list of available key exchange algorithms may also be obtained using the
787.Fl Q
788option of
789.Xr ssh 1
790with an argument of
791.Dq kex .
737.It Cm KeyRegenerationInterval 792.It Cm KeyRegenerationInterval
738In protocol version 1, the ephemeral server key is automatically regenerated 793In protocol version 1, the ephemeral server key is automatically regenerated
739after this many seconds (if it has been used). 794after this many seconds (if it has been used).
@@ -753,18 +808,18 @@ The following forms may be used:
753.It 808.It
754.Cm ListenAddress 809.Cm ListenAddress
755.Sm off 810.Sm off
756.Ar host No | Ar IPv4_addr No | Ar IPv6_addr 811.Ar host | Ar IPv4_addr | Ar IPv6_addr
757.Sm on 812.Sm on
758.It 813.It
759.Cm ListenAddress 814.Cm ListenAddress
760.Sm off 815.Sm off
761.Ar host No | Ar IPv4_addr No : Ar port 816.Ar host | Ar IPv4_addr : Ar port
762.Sm on 817.Sm on
763.It 818.It
764.Cm ListenAddress 819.Cm ListenAddress
765.Sm off 820.Sm off
766.Oo 821.Oo
767.Ar host No | Ar IPv6_addr Oc : Ar port 822.Ar host | Ar IPv6_addr Oc : Ar port
768.Sm on 823.Sm on
769.El 824.El
770.Pp 825.Pp
@@ -852,6 +907,13 @@ hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
852umac-64@openssh.com,umac-128@openssh.com, 907umac-64@openssh.com,umac-128@openssh.com,
853hmac-sha2-256,hmac-sha2-512 908hmac-sha2-256,hmac-sha2-512
854.Ed 909.Ed
910.Pp
911The list of available MAC algorithms may also be obtained using the
912.Fl Q
913option of
914.Xr ssh 1
915with an argument of
916.Dq mac .
855.It Cm Match 917.It Cm Match
856Introduces a conditional block. 918Introduces a conditional block.
857If all of the criteria on the 919If all of the criteria on the
@@ -862,7 +924,7 @@ set in the global section of the config file, until either another
862line or the end of the file. 924line or the end of the file.
863If a keyword appears in multiple 925If a keyword appears in multiple
864.Cm Match 926.Cm Match
865blocks that are satisified, only the first instance of the keyword is 927blocks that are satisfied, only the first instance of the keyword is
866applied. 928applied.
867.Pp 929.Pp
868The arguments to 930The arguments to
@@ -906,6 +968,7 @@ Available keywords are
906.Cm AcceptEnv , 968.Cm AcceptEnv ,
907.Cm AllowAgentForwarding , 969.Cm AllowAgentForwarding ,
908.Cm AllowGroups , 970.Cm AllowGroups ,
971.Cm AllowStreamLocalForwarding ,
909.Cm AllowTcpForwarding , 972.Cm AllowTcpForwarding ,
910.Cm AllowUsers , 973.Cm AllowUsers ,
911.Cm AuthenticationMethods , 974.Cm AuthenticationMethods ,
@@ -920,8 +983,10 @@ Available keywords are
920.Cm ForceCommand , 983.Cm ForceCommand ,
921.Cm GatewayPorts , 984.Cm GatewayPorts ,
922.Cm GSSAPIAuthentication , 985.Cm GSSAPIAuthentication ,
986.Cm HostbasedAcceptedKeyTypes ,
923.Cm HostbasedAuthentication , 987.Cm HostbasedAuthentication ,
924.Cm HostbasedUsesNameFromPacketOnly , 988.Cm HostbasedUsesNameFromPacketOnly ,
989.Cm IPQoS ,
925.Cm KbdInteractiveAuthentication , 990.Cm KbdInteractiveAuthentication ,
926.Cm KerberosAuthentication , 991.Cm KerberosAuthentication ,
927.Cm MaxAuthTries , 992.Cm MaxAuthTries ,
@@ -933,10 +998,15 @@ Available keywords are
933.Cm PermitTTY , 998.Cm PermitTTY ,
934.Cm PermitTunnel , 999.Cm PermitTunnel ,
935.Cm PermitUserRC , 1000.Cm PermitUserRC ,
1001.Cm PubkeyAcceptedKeyTypes ,
936.Cm PubkeyAuthentication , 1002.Cm PubkeyAuthentication ,
937.Cm RekeyLimit , 1003.Cm RekeyLimit ,
1004.Cm RevokedKeys ,
938.Cm RhostsRSAAuthentication , 1005.Cm RhostsRSAAuthentication ,
939.Cm RSAAuthentication , 1006.Cm RSAAuthentication ,
1007.Cm StreamLocalBindMask ,
1008.Cm StreamLocalBindUnlink ,
1009.Cm TrustedUserCAKeys ,
940.Cm X11DisplayOffset , 1010.Cm X11DisplayOffset ,
941.Cm X11Forwarding 1011.Cm X11Forwarding
942and 1012and
@@ -1061,6 +1131,10 @@ and
1061.Dq ethernet . 1131.Dq ethernet .
1062The default is 1132The default is
1063.Dq no . 1133.Dq no .
1134.Pp
1135Independent of this setting, the permissions of the selected
1136.Xr tun 4
1137device must allow access to the user.
1064.It Cm PermitTTY 1138.It Cm PermitTTY
1065Specifies whether 1139Specifies whether
1066.Xr pty 4 1140.Xr pty 4
@@ -1136,6 +1210,17 @@ Specifying
1136.Dq 2,1 1210.Dq 2,1
1137is identical to 1211is identical to
1138.Dq 1,2 . 1212.Dq 1,2 .
1213.It Cm PubkeyAcceptedKeyTypes
1214Specifies the key types that will be accepted for public key authentication
1215as a comma-separated pattern list.
1216The default
1217.Dq *
1218will allow all key types.
1219The
1220.Fl Q
1221option of
1222.Xr ssh 1
1223may be used to list supported key types.
1139.It Cm PubkeyAuthentication 1224.It Cm PubkeyAuthentication
1140Specifies whether public key authentication is allowed. 1225Specifies whether public key authentication is allowed.
1141The default is 1226The default is
@@ -1300,7 +1385,7 @@ should look up the remote host name and check that
1300the resolved host name for the remote IP address maps back to the 1385the resolved host name for the remote IP address maps back to the
1301very same IP address. 1386very same IP address.
1302The default is 1387The default is
1303.Dq yes . 1388.Dq no .
1304.It Cm UseLogin 1389.It Cm UseLogin
1305Specifies whether 1390Specifies whether
1306.Xr login 1 1391.Xr login 1
diff --git a/ssherr.c b/ssherr.c
index 49fbb71de..4ca793992 100644
--- a/ssherr.c
+++ b/ssherr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssherr.c,v 1.1 2014/04/30 05:29:56 djm Exp $ */ 1/* $OpenBSD: ssherr.c,v 1.4 2015/02/16 22:13:32 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -121,10 +121,20 @@ ssh_err(int n)
121 return "agent not present"; 121 return "agent not present";
122 case SSH_ERR_AGENT_NO_IDENTITIES: 122 case SSH_ERR_AGENT_NO_IDENTITIES:
123 return "agent contains no identities"; 123 return "agent contains no identities";
124 case SSH_ERR_BUFFER_READ_ONLY:
125 return "internal error: buffer is read-only";
124 case SSH_ERR_KRL_BAD_MAGIC: 126 case SSH_ERR_KRL_BAD_MAGIC:
125 return "KRL file has invalid magic number"; 127 return "KRL file has invalid magic number";
126 case SSH_ERR_KEY_REVOKED: 128 case SSH_ERR_KEY_REVOKED:
127 return "Key is revoked"; 129 return "Key is revoked";
130 case SSH_ERR_CONN_CLOSED:
131 return "Connection closed";
132 case SSH_ERR_CONN_TIMEOUT:
133 return "Connection timed out";
134 case SSH_ERR_CONN_CORRUPT:
135 return "Connection corrupted";
136 case SSH_ERR_PROTOCOL_ERROR:
137 return "Protocol error";
128 default: 138 default:
129 return "unknown error"; 139 return "unknown error";
130 } 140 }
diff --git a/ssherr.h b/ssherr.h
index 106f786ea..6f771b4b7 100644
--- a/ssherr.h
+++ b/ssherr.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssherr.h,v 1.1 2014/04/30 05:29:56 djm Exp $ */ 1/* $OpenBSD: ssherr.h,v 1.3 2015/01/30 01:13:33 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -73,6 +73,10 @@
73#define SSH_ERR_BUFFER_READ_ONLY -49 73#define SSH_ERR_BUFFER_READ_ONLY -49
74#define SSH_ERR_KRL_BAD_MAGIC -50 74#define SSH_ERR_KRL_BAD_MAGIC -50
75#define SSH_ERR_KEY_REVOKED -51 75#define SSH_ERR_KEY_REVOKED -51
76#define SSH_ERR_CONN_CLOSED -52
77#define SSH_ERR_CONN_TIMEOUT -53
78#define SSH_ERR_CONN_CORRUPT -54
79#define SSH_ERR_PROTOCOL_ERROR -55
76 80
77/* Translate a numeric error code to a human-readable error string */ 81/* Translate a numeric error code to a human-readable error string */
78const char *ssh_err(int n); 82const char *ssh_err(int n);
diff --git a/sshkey.c b/sshkey.c
index fdd0c8a89..476879033 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.c,v 1.3 2014/07/03 01:45:38 djm Exp $ */ 1/* $OpenBSD: sshkey.c,v 1.15 2015/03/06 01:40:56 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved. 4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -27,18 +27,23 @@
27 27
28#include "includes.h" 28#include "includes.h"
29 29
30#include <sys/param.h> 30#include <sys/param.h> /* MIN MAX */
31#include <sys/types.h> 31#include <sys/types.h>
32#include <netinet/in.h>
32 33
34#ifdef WITH_OPENSSL
33#include <openssl/evp.h> 35#include <openssl/evp.h>
34#include <openssl/err.h> 36#include <openssl/err.h>
35#include <openssl/pem.h> 37#include <openssl/pem.h>
38#endif
36 39
37#include "crypto_api.h" 40#include "crypto_api.h"
38 41
39#include <errno.h> 42#include <errno.h>
43#include <limits.h>
40#include <stdio.h> 44#include <stdio.h>
41#include <string.h> 45#include <string.h>
46#include <resolv.h>
42#ifdef HAVE_UTIL_H 47#ifdef HAVE_UTIL_H
43#include <util.h> 48#include <util.h>
44#endif /* HAVE_UTIL_H */ 49#endif /* HAVE_UTIL_H */
@@ -52,6 +57,7 @@
52#include "digest.h" 57#include "digest.h"
53#define SSHKEY_INTERNAL 58#define SSHKEY_INTERNAL
54#include "sshkey.h" 59#include "sshkey.h"
60#include "match.h"
55 61
56/* openssh private key file format */ 62/* openssh private key file format */
57#define MARK_BEGIN "-----BEGIN OPENSSH PRIVATE KEY-----\n" 63#define MARK_BEGIN "-----BEGIN OPENSSH PRIVATE KEY-----\n"
@@ -67,7 +73,7 @@
67/* Version identification string for SSH v1 identity files. */ 73/* Version identification string for SSH v1 identity files. */
68#define LEGACY_BEGIN "SSH PRIVATE KEY FILE FORMAT 1.1\n" 74#define LEGACY_BEGIN "SSH PRIVATE KEY FILE FORMAT 1.1\n"
69 75
70static int sshkey_from_blob_internal(const u_char *blob, size_t blen, 76static int sshkey_from_blob_internal(struct sshbuf *buf,
71 struct sshkey **keyp, int allow_cert); 77 struct sshkey **keyp, int allow_cert);
72 78
73/* Supported key types */ 79/* Supported key types */
@@ -181,12 +187,12 @@ sshkey_ecdsa_nid_from_name(const char *name)
181{ 187{
182 const struct keytype *kt; 188 const struct keytype *kt;
183 189
184 for (kt = keytypes; kt->type != -1; kt++) { 190 for (kt = keytypes; kt->type != -1; kt++) {
185 if (kt->type != KEY_ECDSA && kt->type != KEY_ECDSA_CERT) 191 if (kt->type != KEY_ECDSA && kt->type != KEY_ECDSA_CERT)
186 continue; 192 continue;
187 if (kt->name != NULL && strcmp(name, kt->name) == 0) 193 if (kt->name != NULL && strcmp(name, kt->name) == 0)
188 return kt->nid; 194 return kt->nid;
189 } 195 }
190 return -1; 196 return -1;
191} 197}
192 198
@@ -217,9 +223,11 @@ key_alg_list(int certs_only, int plain_only)
217} 223}
218 224
219int 225int
220sshkey_names_valid2(const char *names) 226sshkey_names_valid2(const char *names, int allow_wildcard)
221{ 227{
222 char *s, *cp, *p; 228 char *s, *cp, *p;
229 const struct keytype *kt;
230 int type;
223 231
224 if (names == NULL || strcmp(names, "") == 0) 232 if (names == NULL || strcmp(names, "") == 0)
225 return 0; 233 return 0;
@@ -227,9 +235,28 @@ sshkey_names_valid2(const char *names)
227 return 0; 235 return 0;
228 for ((p = strsep(&cp, ",")); p && *p != '\0'; 236 for ((p = strsep(&cp, ",")); p && *p != '\0';
229 (p = strsep(&cp, ","))) { 237 (p = strsep(&cp, ","))) {
230 switch (sshkey_type_from_name(p)) { 238 type = sshkey_type_from_name(p);
231 case KEY_RSA1: 239 if (type == KEY_RSA1) {
232 case KEY_UNSPEC: 240 free(s);
241 return 0;
242 }
243 if (type == KEY_UNSPEC) {
244 if (allow_wildcard) {
245 /*
246 * Try matching key types against the string.
247 * If any has a positive or negative match then
248 * the component is accepted.
249 */
250 for (kt = keytypes; kt->type != -1; kt++) {
251 if (kt->type == KEY_RSA1)
252 continue;
253 if (match_pattern_list(kt->name,
254 p, strlen(p), 0) != 0)
255 break;
256 }
257 if (kt->type != -1)
258 continue;
259 }
233 free(s); 260 free(s);
234 return 0; 261 return 0;
235 } 262 }
@@ -797,13 +824,28 @@ to_blob_buf(const struct sshkey *key, struct sshbuf *b, int force_plain)
797} 824}
798 825
799int 826int
800sshkey_to_blob_buf(const struct sshkey *key, struct sshbuf *b) 827sshkey_putb(const struct sshkey *key, struct sshbuf *b)
801{ 828{
802 return to_blob_buf(key, b, 0); 829 return to_blob_buf(key, b, 0);
803} 830}
804 831
805int 832int
806sshkey_plain_to_blob_buf(const struct sshkey *key, struct sshbuf *b) 833sshkey_puts(const struct sshkey *key, struct sshbuf *b)
834{
835 struct sshbuf *tmp;
836 int r;
837
838 if ((tmp = sshbuf_new()) == NULL)
839 return SSH_ERR_ALLOC_FAIL;
840 r = to_blob_buf(key, tmp, 0);
841 if (r == 0)
842 r = sshbuf_put_stringb(b, tmp);
843 sshbuf_free(tmp);
844 return r;
845}
846
847int
848sshkey_putb_plain(const struct sshkey *key, struct sshbuf *b)
807{ 849{
808 return to_blob_buf(key, b, 1); 850 return to_blob_buf(key, b, 1);
809} 851}
@@ -852,29 +894,18 @@ sshkey_plain_to_blob(const struct sshkey *key, u_char **blobp, size_t *lenp)
852} 894}
853 895
854int 896int
855sshkey_fingerprint_raw(const struct sshkey *k, enum sshkey_fp_type dgst_type, 897sshkey_fingerprint_raw(const struct sshkey *k, int dgst_alg,
856 u_char **retp, size_t *lenp) 898 u_char **retp, size_t *lenp)
857{ 899{
858 u_char *blob = NULL, *ret = NULL; 900 u_char *blob = NULL, *ret = NULL;
859 size_t blob_len = 0; 901 size_t blob_len = 0;
860 int hash_alg = -1, r = SSH_ERR_INTERNAL_ERROR; 902 int r = SSH_ERR_INTERNAL_ERROR;
861 903
862 if (retp != NULL) 904 if (retp != NULL)
863 *retp = NULL; 905 *retp = NULL;
864 if (lenp != NULL) 906 if (lenp != NULL)
865 *lenp = 0; 907 *lenp = 0;
866 908 if (ssh_digest_bytes(dgst_alg) == 0) {
867 switch (dgst_type) {
868 case SSH_FP_MD5:
869 hash_alg = SSH_DIGEST_MD5;
870 break;
871 case SSH_FP_SHA1:
872 hash_alg = SSH_DIGEST_SHA1;
873 break;
874 case SSH_FP_SHA256:
875 hash_alg = SSH_DIGEST_SHA256;
876 break;
877 default:
878 r = SSH_ERR_INVALID_ARGUMENT; 909 r = SSH_ERR_INVALID_ARGUMENT;
879 goto out; 910 goto out;
880 } 911 }
@@ -899,7 +930,7 @@ sshkey_fingerprint_raw(const struct sshkey *k, enum sshkey_fp_type dgst_type,
899 r = SSH_ERR_ALLOC_FAIL; 930 r = SSH_ERR_ALLOC_FAIL;
900 goto out; 931 goto out;
901 } 932 }
902 if ((r = ssh_digest_memory(hash_alg, blob, blob_len, 933 if ((r = ssh_digest_memory(dgst_alg, blob, blob_len,
903 ret, SSH_DIGEST_MAX_LENGTH)) != 0) 934 ret, SSH_DIGEST_MAX_LENGTH)) != 0)
904 goto out; 935 goto out;
905 /* success */ 936 /* success */
@@ -908,7 +939,7 @@ sshkey_fingerprint_raw(const struct sshkey *k, enum sshkey_fp_type dgst_type,
908 ret = NULL; 939 ret = NULL;
909 } 940 }
910 if (lenp != NULL) 941 if (lenp != NULL)
911 *lenp = ssh_digest_bytes(hash_alg); 942 *lenp = ssh_digest_bytes(dgst_alg);
912 r = 0; 943 r = 0;
913 out: 944 out:
914 free(ret); 945 free(ret);
@@ -920,21 +951,45 @@ sshkey_fingerprint_raw(const struct sshkey *k, enum sshkey_fp_type dgst_type,
920} 951}
921 952
922static char * 953static char *
923fingerprint_hex(u_char *dgst_raw, size_t dgst_raw_len) 954fingerprint_b64(const char *alg, u_char *dgst_raw, size_t dgst_raw_len)
924{ 955{
925 char *retval; 956 char *ret;
926 size_t i; 957 size_t plen = strlen(alg) + 1;
958 size_t rlen = ((dgst_raw_len + 2) / 3) * 4 + plen + 1;
959 int r;
927 960
928 if ((retval = calloc(1, dgst_raw_len * 3 + 1)) == NULL) 961 if (dgst_raw_len > 65536 || (ret = calloc(1, rlen)) == NULL)
962 return NULL;
963 strlcpy(ret, alg, rlen);
964 strlcat(ret, ":", rlen);
965 if (dgst_raw_len == 0)
966 return ret;
967 if ((r = b64_ntop(dgst_raw, dgst_raw_len,
968 ret + plen, rlen - plen)) == -1) {
969 explicit_bzero(ret, rlen);
970 free(ret);
929 return NULL; 971 return NULL;
930 for (i = 0; i < dgst_raw_len; i++) {
931 char hex[4];
932 snprintf(hex, sizeof(hex), "%02x:", dgst_raw[i]);
933 strlcat(retval, hex, dgst_raw_len * 3 + 1);
934 } 972 }
973 /* Trim padding characters from end */
974 ret[strcspn(ret, "=")] = '\0';
975 return ret;
976}
977
978static char *
979fingerprint_hex(const char *alg, u_char *dgst_raw, size_t dgst_raw_len)
980{
981 char *retval, hex[5];
982 size_t i, rlen = dgst_raw_len * 3 + strlen(alg) + 2;
935 983
936 /* Remove the trailing ':' character */ 984 if (dgst_raw_len > 65536 || (retval = calloc(1, rlen)) == NULL)
937 retval[(dgst_raw_len * 3) - 1] = '\0'; 985 return NULL;
986 strlcpy(retval, alg, rlen);
987 strlcat(retval, ":", rlen);
988 for (i = 0; i < dgst_raw_len; i++) {
989 snprintf(hex, sizeof(hex), "%s%02x",
990 i > 0 ? ":" : "", dgst_raw[i]);
991 strlcat(retval, hex, rlen);
992 }
938 return retval; 993 return retval;
939} 994}
940 995
@@ -1020,7 +1075,7 @@ fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len)
1020#define FLDSIZE_Y (FLDBASE + 1) 1075#define FLDSIZE_Y (FLDBASE + 1)
1021#define FLDSIZE_X (FLDBASE * 2 + 1) 1076#define FLDSIZE_X (FLDBASE * 2 + 1)
1022static char * 1077static char *
1023fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len, 1078fingerprint_randomart(const char *alg, u_char *dgst_raw, size_t dgst_raw_len,
1024 const struct sshkey *k) 1079 const struct sshkey *k)
1025{ 1080{
1026 /* 1081 /*
@@ -1028,9 +1083,9 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len,
1028 * intersects with itself. Matter of taste. 1083 * intersects with itself. Matter of taste.
1029 */ 1084 */
1030 char *augmentation_string = " .o+=*BOX@%&#/^SE"; 1085 char *augmentation_string = " .o+=*BOX@%&#/^SE";
1031 char *retval, *p, title[FLDSIZE_X]; 1086 char *retval, *p, title[FLDSIZE_X], hash[FLDSIZE_X];
1032 u_char field[FLDSIZE_X][FLDSIZE_Y]; 1087 u_char field[FLDSIZE_X][FLDSIZE_Y];
1033 size_t i, tlen; 1088 size_t i, tlen, hlen;
1034 u_int b; 1089 u_int b;
1035 int x, y, r; 1090 int x, y, r;
1036 size_t len = strlen(augmentation_string) - 1; 1091 size_t len = strlen(augmentation_string) - 1;
@@ -1075,8 +1130,12 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len,
1075 sshkey_type(k), sshkey_size(k)); 1130 sshkey_type(k), sshkey_size(k));
1076 /* If [type size] won't fit, then try [type]; fits "[ED25519-CERT]" */ 1131 /* If [type size] won't fit, then try [type]; fits "[ED25519-CERT]" */
1077 if (r < 0 || r > (int)sizeof(title)) 1132 if (r < 0 || r > (int)sizeof(title))
1078 snprintf(title, sizeof(title), "[%s]", sshkey_type(k)); 1133 r = snprintf(title, sizeof(title), "[%s]", sshkey_type(k));
1079 tlen = strlen(title); 1134 tlen = (r <= 0) ? 0 : strlen(title);
1135
1136 /* assemble hash ID. */
1137 r = snprintf(hash, sizeof(hash), "[%s]", alg);
1138 hlen = (r <= 0) ? 0 : strlen(hash);
1080 1139
1081 /* output upper border */ 1140 /* output upper border */
1082 p = retval; 1141 p = retval;
@@ -1085,7 +1144,7 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len,
1085 *p++ = '-'; 1144 *p++ = '-';
1086 memcpy(p, title, tlen); 1145 memcpy(p, title, tlen);
1087 p += tlen; 1146 p += tlen;
1088 for (i = p - retval - 1; i < FLDSIZE_X; i++) 1147 for (i += tlen; i < FLDSIZE_X; i++)
1089 *p++ = '-'; 1148 *p++ = '-';
1090 *p++ = '+'; 1149 *p++ = '+';
1091 *p++ = '\n'; 1150 *p++ = '\n';
@@ -1101,7 +1160,11 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len,
1101 1160
1102 /* output lower border */ 1161 /* output lower border */
1103 *p++ = '+'; 1162 *p++ = '+';
1104 for (i = 0; i < FLDSIZE_X; i++) 1163 for (i = 0; i < (FLDSIZE_X - hlen) / 2; i++)
1164 *p++ = '-';
1165 memcpy(p, hash, hlen);
1166 p += hlen;
1167 for (i += hlen; i < FLDSIZE_X; i++)
1105 *p++ = '-'; 1168 *p++ = '-';
1106 *p++ = '+'; 1169 *p++ = '+';
1107 1170
@@ -1109,24 +1172,39 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len,
1109} 1172}
1110 1173
1111char * 1174char *
1112sshkey_fingerprint(const struct sshkey *k, enum sshkey_fp_type dgst_type, 1175sshkey_fingerprint(const struct sshkey *k, int dgst_alg,
1113 enum sshkey_fp_rep dgst_rep) 1176 enum sshkey_fp_rep dgst_rep)
1114{ 1177{
1115 char *retval = NULL; 1178 char *retval = NULL;
1116 u_char *dgst_raw; 1179 u_char *dgst_raw;
1117 size_t dgst_raw_len; 1180 size_t dgst_raw_len;
1118 1181
1119 if (sshkey_fingerprint_raw(k, dgst_type, &dgst_raw, &dgst_raw_len) != 0) 1182 if (sshkey_fingerprint_raw(k, dgst_alg, &dgst_raw, &dgst_raw_len) != 0)
1120 return NULL; 1183 return NULL;
1121 switch (dgst_rep) { 1184 switch (dgst_rep) {
1185 case SSH_FP_DEFAULT:
1186 if (dgst_alg == SSH_DIGEST_MD5) {
1187 retval = fingerprint_hex(ssh_digest_alg_name(dgst_alg),
1188 dgst_raw, dgst_raw_len);
1189 } else {
1190 retval = fingerprint_b64(ssh_digest_alg_name(dgst_alg),
1191 dgst_raw, dgst_raw_len);
1192 }
1193 break;
1122 case SSH_FP_HEX: 1194 case SSH_FP_HEX:
1123 retval = fingerprint_hex(dgst_raw, dgst_raw_len); 1195 retval = fingerprint_hex(ssh_digest_alg_name(dgst_alg),
1196 dgst_raw, dgst_raw_len);
1197 break;
1198 case SSH_FP_BASE64:
1199 retval = fingerprint_b64(ssh_digest_alg_name(dgst_alg),
1200 dgst_raw, dgst_raw_len);
1124 break; 1201 break;
1125 case SSH_FP_BUBBLEBABBLE: 1202 case SSH_FP_BUBBLEBABBLE:
1126 retval = fingerprint_bubblebabble(dgst_raw, dgst_raw_len); 1203 retval = fingerprint_bubblebabble(dgst_raw, dgst_raw_len);
1127 break; 1204 break;
1128 case SSH_FP_RANDOMART: 1205 case SSH_FP_RANDOMART:
1129 retval = fingerprint_randomart(dgst_raw, dgst_raw_len, k); 1206 retval = fingerprint_randomart(ssh_digest_alg_name(dgst_alg),
1207 dgst_raw, dgst_raw_len, k);
1130 break; 1208 break;
1131 default: 1209 default:
1132 explicit_bzero(dgst_raw, dgst_raw_len); 1210 explicit_bzero(dgst_raw, dgst_raw_len);
@@ -1233,16 +1311,20 @@ sshkey_read(struct sshkey *ret, char **cpp)
1233 cp = space+1; 1311 cp = space+1;
1234 if (*cp == '\0') 1312 if (*cp == '\0')
1235 return SSH_ERR_INVALID_FORMAT; 1313 return SSH_ERR_INVALID_FORMAT;
1236 if (ret->type == KEY_UNSPEC) { 1314 if (ret->type != KEY_UNSPEC && ret->type != type)
1237 ret->type = type;
1238 } else if (ret->type != type)
1239 return SSH_ERR_KEY_TYPE_MISMATCH; 1315 return SSH_ERR_KEY_TYPE_MISMATCH;
1240 if ((blob = sshbuf_new()) == NULL) 1316 if ((blob = sshbuf_new()) == NULL)
1241 return SSH_ERR_ALLOC_FAIL; 1317 return SSH_ERR_ALLOC_FAIL;
1242 /* trim comment */ 1318 /* trim comment */
1243 space = strchr(cp, ' '); 1319 space = strchr(cp, ' ');
1244 if (space) 1320 if (space) {
1245 *space = '\0'; 1321 /* advance 'space': skip whitespace */
1322 *space++ = '\0';
1323 while (*space == ' ' || *space == '\t')
1324 space++;
1325 *cpp = space;
1326 } else
1327 *cpp = cp + strlen(cp);
1246 if ((r = sshbuf_b64tod(blob, cp)) != 0) { 1328 if ((r = sshbuf_b64tod(blob, cp)) != 0) {
1247 sshbuf_free(blob); 1329 sshbuf_free(blob);
1248 return r; 1330 return r;
@@ -1262,7 +1344,7 @@ sshkey_read(struct sshkey *ret, char **cpp)
1262 sshkey_free(k); 1344 sshkey_free(k);
1263 return SSH_ERR_EC_CURVE_MISMATCH; 1345 return SSH_ERR_EC_CURVE_MISMATCH;
1264 } 1346 }
1265/*XXXX*/ 1347 ret->type = type;
1266 if (sshkey_is_cert(ret)) { 1348 if (sshkey_is_cert(ret)) {
1267 if (!sshkey_is_cert(k)) { 1349 if (!sshkey_is_cert(k)) {
1268 sshkey_free(k); 1350 sshkey_free(k);
@@ -1319,12 +1401,6 @@ sshkey_read(struct sshkey *ret, char **cpp)
1319 sshkey_free(k); 1401 sshkey_free(k);
1320 if (retval != 0) 1402 if (retval != 0)
1321 break; 1403 break;
1322 /* advance cp: skip whitespace and data */
1323 while (*cp == ' ' || *cp == '\t')
1324 cp++;
1325 while (*cp != '\0' && *cp != ' ' && *cp != '\t')
1326 cp++;
1327 *cpp = cp;
1328 break; 1404 break;
1329 default: 1405 default:
1330 return SSH_ERR_INVALID_ARGUMENT; 1406 return SSH_ERR_INVALID_ARGUMENT;
@@ -1389,7 +1465,7 @@ sshkey_write(const struct sshkey *key, FILE *f)
1389 ret = SSH_ERR_ALLOC_FAIL; 1465 ret = SSH_ERR_ALLOC_FAIL;
1390 goto out; 1466 goto out;
1391 } 1467 }
1392 if ((ret = sshkey_to_blob_buf(key, bb)) != 0) 1468 if ((ret = sshkey_putb(key, bb)) != 0)
1393 goto out; 1469 goto out;
1394 if ((uu = sshbuf_dtob64(bb)) == NULL) { 1470 if ((uu = sshbuf_dtob64(bb)) == NULL) {
1395 ret = SSH_ERR_ALLOC_FAIL; 1471 ret = SSH_ERR_ALLOC_FAIL;
@@ -1766,38 +1842,30 @@ sshkey_from_private(const struct sshkey *k, struct sshkey **pkp)
1766} 1842}
1767 1843
1768static int 1844static int
1769cert_parse(struct sshbuf *b, struct sshkey *key, const u_char *blob, 1845cert_parse(struct sshbuf *b, struct sshkey *key, struct sshbuf *certbuf)
1770 size_t blen)
1771{ 1846{
1772 u_char *principals = NULL, *critical = NULL, *exts = NULL; 1847 struct sshbuf *principals = NULL, *crit = NULL;
1773 u_char *sig_key = NULL, *sig = NULL; 1848 struct sshbuf *exts = NULL, *ca = NULL;
1774 size_t signed_len, plen, clen, sklen, slen, kidlen, elen; 1849 u_char *sig = NULL;
1775 struct sshbuf *tmp; 1850 size_t signed_len = 0, slen = 0, kidlen = 0;
1776 char *principal;
1777 int ret = SSH_ERR_INTERNAL_ERROR; 1851 int ret = SSH_ERR_INTERNAL_ERROR;
1778 int v00 = sshkey_cert_is_legacy(key); 1852 int v00 = sshkey_cert_is_legacy(key);
1779 char **oprincipals;
1780
1781 if ((tmp = sshbuf_new()) == NULL)
1782 return SSH_ERR_ALLOC_FAIL;
1783 1853
1784 /* Copy the entire key blob for verification and later serialisation */ 1854 /* Copy the entire key blob for verification and later serialisation */
1785 if ((ret = sshbuf_put(key->cert->certblob, blob, blen)) != 0) 1855 if ((ret = sshbuf_putb(key->cert->certblob, certbuf)) != 0)
1786 return ret; 1856 return ret;
1787 1857
1788 elen = 0; /* Not touched for v00 certs */
1789 principals = exts = critical = sig_key = sig = NULL;
1790 if ((!v00 && (ret = sshbuf_get_u64(b, &key->cert->serial)) != 0) || 1858 if ((!v00 && (ret = sshbuf_get_u64(b, &key->cert->serial)) != 0) ||
1791 (ret = sshbuf_get_u32(b, &key->cert->type)) != 0 || 1859 (ret = sshbuf_get_u32(b, &key->cert->type)) != 0 ||
1792 (ret = sshbuf_get_cstring(b, &key->cert->key_id, &kidlen)) != 0 || 1860 (ret = sshbuf_get_cstring(b, &key->cert->key_id, &kidlen)) != 0 ||
1793 (ret = sshbuf_get_string(b, &principals, &plen)) != 0 || 1861 (ret = sshbuf_froms(b, &principals)) != 0 ||
1794 (ret = sshbuf_get_u64(b, &key->cert->valid_after)) != 0 || 1862 (ret = sshbuf_get_u64(b, &key->cert->valid_after)) != 0 ||
1795 (ret = sshbuf_get_u64(b, &key->cert->valid_before)) != 0 || 1863 (ret = sshbuf_get_u64(b, &key->cert->valid_before)) != 0 ||
1796 (ret = sshbuf_get_string(b, &critical, &clen)) != 0 || 1864 (ret = sshbuf_froms(b, &crit)) != 0 ||
1797 (!v00 && (ret = sshbuf_get_string(b, &exts, &elen)) != 0) || 1865 (!v00 && (ret = sshbuf_froms(b, &exts)) != 0) ||
1798 (v00 && (ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0) || 1866 (v00 && (ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0) ||
1799 (ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0 || 1867 (ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0 ||
1800 (ret = sshbuf_get_string(b, &sig_key, &sklen)) != 0) { 1868 (ret = sshbuf_froms(b, &ca)) != 0) {
1801 /* XXX debug print error for ret */ 1869 /* XXX debug print error for ret */
1802 ret = SSH_ERR_INVALID_FORMAT; 1870 ret = SSH_ERR_INVALID_FORMAT;
1803 goto out; 1871 goto out;
@@ -1817,14 +1885,17 @@ cert_parse(struct sshbuf *b, struct sshkey *key, const u_char *blob,
1817 goto out; 1885 goto out;
1818 } 1886 }
1819 1887
1820 if ((ret = sshbuf_put(tmp, principals, plen)) != 0) 1888 /* Parse principals section */
1821 goto out; 1889 while (sshbuf_len(principals) > 0) {
1822 while (sshbuf_len(tmp) > 0) { 1890 char *principal = NULL;
1891 char **oprincipals = NULL;
1892
1823 if (key->cert->nprincipals >= SSHKEY_CERT_MAX_PRINCIPALS) { 1893 if (key->cert->nprincipals >= SSHKEY_CERT_MAX_PRINCIPALS) {
1824 ret = SSH_ERR_INVALID_FORMAT; 1894 ret = SSH_ERR_INVALID_FORMAT;
1825 goto out; 1895 goto out;
1826 } 1896 }
1827 if ((ret = sshbuf_get_cstring(tmp, &principal, &plen)) != 0) { 1897 if ((ret = sshbuf_get_cstring(principals, &principal,
1898 NULL)) != 0) {
1828 ret = SSH_ERR_INVALID_FORMAT; 1899 ret = SSH_ERR_INVALID_FORMAT;
1829 goto out; 1900 goto out;
1830 } 1901 }
@@ -1841,38 +1912,38 @@ cert_parse(struct sshbuf *b, struct sshkey *key, const u_char *blob,
1841 key->cert->principals[key->cert->nprincipals++] = principal; 1912 key->cert->principals[key->cert->nprincipals++] = principal;
1842 } 1913 }
1843 1914
1844 sshbuf_reset(tmp); 1915 /*
1845 1916 * Stash a copies of the critical options and extensions sections
1846 if ((ret = sshbuf_put(key->cert->critical, critical, clen)) != 0 || 1917 * for later use.
1847 (ret = sshbuf_put(tmp, critical, clen)) != 0) 1918 */
1919 if ((ret = sshbuf_putb(key->cert->critical, crit)) != 0 ||
1920 (exts != NULL &&
1921 (ret = sshbuf_putb(key->cert->extensions, exts)) != 0))
1848 goto out; 1922 goto out;
1849 1923
1850 /* validate structure */ 1924 /*
1851 while (sshbuf_len(tmp) != 0) { 1925 * Validate critical options and extensions sections format.
1852 if ((ret = sshbuf_get_string_direct(tmp, NULL, NULL)) != 0 || 1926 * NB. extensions are not present in v00 certs.
1853 (ret = sshbuf_get_string_direct(tmp, NULL, NULL)) != 0) { 1927 */
1928 while (sshbuf_len(crit) != 0) {
1929 if ((ret = sshbuf_get_string_direct(crit, NULL, NULL)) != 0 ||
1930 (ret = sshbuf_get_string_direct(crit, NULL, NULL)) != 0) {
1931 sshbuf_reset(key->cert->critical);
1854 ret = SSH_ERR_INVALID_FORMAT; 1932 ret = SSH_ERR_INVALID_FORMAT;
1855 goto out; 1933 goto out;
1856 } 1934 }
1857 } 1935 }
1858 sshbuf_reset(tmp); 1936 while (exts != NULL && sshbuf_len(exts) != 0) {
1859 1937 if ((ret = sshbuf_get_string_direct(exts, NULL, NULL)) != 0 ||
1860 if ((ret = sshbuf_put(key->cert->extensions, exts, elen)) != 0 || 1938 (ret = sshbuf_get_string_direct(exts, NULL, NULL)) != 0) {
1861 (ret = sshbuf_put(tmp, exts, elen)) != 0) 1939 sshbuf_reset(key->cert->extensions);
1862 goto out;
1863
1864 /* validate structure */
1865 while (sshbuf_len(tmp) != 0) {
1866 if ((ret = sshbuf_get_string_direct(tmp, NULL, NULL)) != 0 ||
1867 (ret = sshbuf_get_string_direct(tmp, NULL, NULL)) != 0) {
1868 ret = SSH_ERR_INVALID_FORMAT; 1940 ret = SSH_ERR_INVALID_FORMAT;
1869 goto out; 1941 goto out;
1870 } 1942 }
1871 } 1943 }
1872 sshbuf_reset(tmp);
1873 1944
1874 if (sshkey_from_blob_internal(sig_key, sklen, 1945 /* Parse CA key and check signature */
1875 &key->cert->signature_key, 0) != 0) { 1946 if (sshkey_from_blob_internal(ca, &key->cert->signature_key, 0) != 0) {
1876 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY; 1947 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
1877 goto out; 1948 goto out;
1878 } 1949 }
@@ -1880,50 +1951,49 @@ cert_parse(struct sshbuf *b, struct sshkey *key, const u_char *blob,
1880 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY; 1951 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
1881 goto out; 1952 goto out;
1882 } 1953 }
1883
1884 if ((ret = sshkey_verify(key->cert->signature_key, sig, slen, 1954 if ((ret = sshkey_verify(key->cert->signature_key, sig, slen,
1885 sshbuf_ptr(key->cert->certblob), signed_len, 0)) != 0) 1955 sshbuf_ptr(key->cert->certblob), signed_len, 0)) != 0)
1886 goto out; 1956 goto out;
1887 ret = 0;
1888 1957
1958 /* Success */
1959 ret = 0;
1889 out: 1960 out:
1890 sshbuf_free(tmp); 1961 sshbuf_free(ca);
1891 free(principals); 1962 sshbuf_free(crit);
1892 free(critical); 1963 sshbuf_free(exts);
1893 free(exts); 1964 sshbuf_free(principals);
1894 free(sig_key);
1895 free(sig); 1965 free(sig);
1896 return ret; 1966 return ret;
1897} 1967}
1898 1968
1899static int 1969static int
1900sshkey_from_blob_internal(const u_char *blob, size_t blen, 1970sshkey_from_blob_internal(struct sshbuf *b, struct sshkey **keyp,
1901 struct sshkey **keyp, int allow_cert) 1971 int allow_cert)
1902{ 1972{
1903 struct sshbuf *b = NULL; 1973 int type, ret = SSH_ERR_INTERNAL_ERROR;
1904 int type, nid = -1, ret = SSH_ERR_INTERNAL_ERROR;
1905 char *ktype = NULL, *curve = NULL; 1974 char *ktype = NULL, *curve = NULL;
1906 struct sshkey *key = NULL; 1975 struct sshkey *key = NULL;
1907 size_t len; 1976 size_t len;
1908 u_char *pk = NULL; 1977 u_char *pk = NULL;
1978 struct sshbuf *copy;
1909#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC) 1979#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC)
1910 EC_POINT *q = NULL; 1980 EC_POINT *q = NULL;
1911#endif /* WITH_OPENSSL && OPENSSL_HAS_ECC */ 1981#endif /* WITH_OPENSSL && OPENSSL_HAS_ECC */
1912 1982
1913#ifdef DEBUG_PK /* XXX */ 1983#ifdef DEBUG_PK /* XXX */
1914 dump_base64(stderr, blob, blen); 1984 sshbuf_dump(b, stderr);
1915#endif 1985#endif
1916 *keyp = NULL; 1986 *keyp = NULL;
1917 if ((b = sshbuf_from(blob, blen)) == NULL) 1987 if ((copy = sshbuf_fromb(b)) == NULL) {
1918 return SSH_ERR_ALLOC_FAIL; 1988 ret = SSH_ERR_ALLOC_FAIL;
1989 goto out;
1990 }
1919 if (sshbuf_get_cstring(b, &ktype, NULL) != 0) { 1991 if (sshbuf_get_cstring(b, &ktype, NULL) != 0) {
1920 ret = SSH_ERR_INVALID_FORMAT; 1992 ret = SSH_ERR_INVALID_FORMAT;
1921 goto out; 1993 goto out;
1922 } 1994 }
1923 1995
1924 type = sshkey_type_from_name(ktype); 1996 type = sshkey_type_from_name(ktype);
1925 if (sshkey_type_plain(type) == KEY_ECDSA)
1926 nid = sshkey_ecdsa_nid_from_name(ktype);
1927 if (!allow_cert && sshkey_type_is_cert(type)) { 1997 if (!allow_cert && sshkey_type_is_cert(type)) {
1928 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY; 1998 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
1929 goto out; 1999 goto out;
@@ -1931,6 +2001,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
1931 switch (type) { 2001 switch (type) {
1932#ifdef WITH_OPENSSL 2002#ifdef WITH_OPENSSL
1933 case KEY_RSA_CERT: 2003 case KEY_RSA_CERT:
2004 /* Skip nonce */
1934 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) { 2005 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) {
1935 ret = SSH_ERR_INVALID_FORMAT; 2006 ret = SSH_ERR_INVALID_FORMAT;
1936 goto out; 2007 goto out;
@@ -1952,6 +2023,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
1952#endif 2023#endif
1953 break; 2024 break;
1954 case KEY_DSA_CERT: 2025 case KEY_DSA_CERT:
2026 /* Skip nonce */
1955 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) { 2027 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) {
1956 ret = SSH_ERR_INVALID_FORMAT; 2028 ret = SSH_ERR_INVALID_FORMAT;
1957 goto out; 2029 goto out;
@@ -1975,6 +2047,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
1975#endif 2047#endif
1976 break; 2048 break;
1977 case KEY_ECDSA_CERT: 2049 case KEY_ECDSA_CERT:
2050 /* Skip nonce */
1978 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) { 2051 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) {
1979 ret = SSH_ERR_INVALID_FORMAT; 2052 ret = SSH_ERR_INVALID_FORMAT;
1980 goto out; 2053 goto out;
@@ -1986,7 +2059,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
1986 ret = SSH_ERR_ALLOC_FAIL; 2059 ret = SSH_ERR_ALLOC_FAIL;
1987 goto out; 2060 goto out;
1988 } 2061 }
1989 key->ecdsa_nid = nid; 2062 key->ecdsa_nid = sshkey_ecdsa_nid_from_name(ktype);
1990 if (sshbuf_get_cstring(b, &curve, NULL) != 0) { 2063 if (sshbuf_get_cstring(b, &curve, NULL) != 0) {
1991 ret = SSH_ERR_INVALID_FORMAT; 2064 ret = SSH_ERR_INVALID_FORMAT;
1992 goto out; 2065 goto out;
@@ -2027,6 +2100,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
2027# endif /* OPENSSL_HAS_ECC */ 2100# endif /* OPENSSL_HAS_ECC */
2028#endif /* WITH_OPENSSL */ 2101#endif /* WITH_OPENSSL */
2029 case KEY_ED25519_CERT: 2102 case KEY_ED25519_CERT:
2103 /* Skip nonce */
2030 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) { 2104 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) {
2031 ret = SSH_ERR_INVALID_FORMAT; 2105 ret = SSH_ERR_INVALID_FORMAT;
2032 goto out; 2106 goto out;
@@ -2058,8 +2132,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
2058 } 2132 }
2059 2133
2060 /* Parse certificate potion */ 2134 /* Parse certificate potion */
2061 if (sshkey_is_cert(key) && 2135 if (sshkey_is_cert(key) && (ret = cert_parse(b, key, copy)) != 0)
2062 (ret = cert_parse(b, key, blob, blen)) != 0)
2063 goto out; 2136 goto out;
2064 2137
2065 if (key != NULL && sshbuf_len(b) != 0) { 2138 if (key != NULL && sshbuf_len(b) != 0) {
@@ -2070,7 +2143,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
2070 *keyp = key; 2143 *keyp = key;
2071 key = NULL; 2144 key = NULL;
2072 out: 2145 out:
2073 sshbuf_free(b); 2146 sshbuf_free(copy);
2074 sshkey_free(key); 2147 sshkey_free(key);
2075 free(ktype); 2148 free(ktype);
2076 free(curve); 2149 free(curve);
@@ -2085,7 +2158,33 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
2085int 2158int
2086sshkey_from_blob(const u_char *blob, size_t blen, struct sshkey **keyp) 2159sshkey_from_blob(const u_char *blob, size_t blen, struct sshkey **keyp)
2087{ 2160{
2088 return sshkey_from_blob_internal(blob, blen, keyp, 1); 2161 struct sshbuf *b;
2162 int r;
2163
2164 if ((b = sshbuf_from(blob, blen)) == NULL)
2165 return SSH_ERR_ALLOC_FAIL;
2166 r = sshkey_from_blob_internal(b, keyp, 1);
2167 sshbuf_free(b);
2168 return r;
2169}
2170
2171int
2172sshkey_fromb(struct sshbuf *b, struct sshkey **keyp)
2173{
2174 return sshkey_from_blob_internal(b, keyp, 1);
2175}
2176
2177int
2178sshkey_froms(struct sshbuf *buf, struct sshkey **keyp)
2179{
2180 struct sshbuf *b;
2181 int r;
2182
2183 if ((r = sshbuf_froms(buf, &b)) != 0)
2184 return r;
2185 r = sshkey_from_blob_internal(b, keyp, 1);
2186 sshbuf_free(b);
2187 return r;
2089} 2188}
2090 2189
2091int 2190int
@@ -2131,10 +2230,7 @@ sshkey_verify(const struct sshkey *key,
2131 const u_char *sig, size_t siglen, 2230 const u_char *sig, size_t siglen,
2132 const u_char *data, size_t dlen, u_int compat) 2231 const u_char *data, size_t dlen, u_int compat)
2133{ 2232{
2134 if (siglen == 0) 2233 if (siglen == 0 || dlen > SSH_KEY_MAX_SIGN_DATA_SIZE)
2135 return -1;
2136
2137 if (dlen > SSH_KEY_MAX_SIGN_DATA_SIZE)
2138 return SSH_ERR_INVALID_ARGUMENT; 2234 return SSH_ERR_INVALID_ARGUMENT;
2139 switch (key->type) { 2235 switch (key->type) {
2140#ifdef WITH_OPENSSL 2236#ifdef WITH_OPENSSL
@@ -2368,6 +2464,7 @@ sshkey_certify(struct sshkey *k, struct sshkey *ca)
2368 break; 2464 break;
2369 default: 2465 default:
2370 ret = SSH_ERR_INVALID_ARGUMENT; 2466 ret = SSH_ERR_INVALID_ARGUMENT;
2467 goto out;
2371 } 2468 }
2372 2469
2373 /* -v01 certs have a serial number next */ 2470 /* -v01 certs have a serial number next */
@@ -2593,8 +2690,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2593{ 2690{
2594 char *tname = NULL, *curve = NULL; 2691 char *tname = NULL, *curve = NULL;
2595 struct sshkey *k = NULL; 2692 struct sshkey *k = NULL;
2596 const u_char *cert; 2693 size_t pklen = 0, sklen = 0;
2597 size_t len, pklen = 0, sklen = 0;
2598 int type, r = SSH_ERR_INTERNAL_ERROR; 2694 int type, r = SSH_ERR_INTERNAL_ERROR;
2599 u_char *ed25519_pk = NULL, *ed25519_sk = NULL; 2695 u_char *ed25519_pk = NULL, *ed25519_sk = NULL;
2600#ifdef WITH_OPENSSL 2696#ifdef WITH_OPENSSL
@@ -2622,8 +2718,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2622 break; 2718 break;
2623 case KEY_DSA_CERT_V00: 2719 case KEY_DSA_CERT_V00:
2624 case KEY_DSA_CERT: 2720 case KEY_DSA_CERT:
2625 if ((r = sshbuf_get_string_direct(buf, &cert, &len)) != 0 || 2721 if ((r = sshkey_froms(buf, &k)) != 0 ||
2626 (r = sshkey_from_blob(cert, len, &k)) != 0 ||
2627 (r = sshkey_add_private(k)) != 0 || 2722 (r = sshkey_add_private(k)) != 0 ||
2628 (r = sshbuf_get_bignum2(buf, k->dsa->priv_key)) != 0) 2723 (r = sshbuf_get_bignum2(buf, k->dsa->priv_key)) != 0)
2629 goto out; 2724 goto out;
@@ -2666,8 +2761,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2666 r = SSH_ERR_LIBCRYPTO_ERROR; 2761 r = SSH_ERR_LIBCRYPTO_ERROR;
2667 goto out; 2762 goto out;
2668 } 2763 }
2669 if ((r = sshbuf_get_string_direct(buf, &cert, &len)) != 0 || 2764 if ((r = sshkey_froms(buf, &k)) != 0 ||
2670 (r = sshkey_from_blob(cert, len, &k)) != 0 ||
2671 (r = sshkey_add_private(k)) != 0 || 2765 (r = sshkey_add_private(k)) != 0 ||
2672 (r = sshbuf_get_bignum2(buf, exponent)) != 0) 2766 (r = sshbuf_get_bignum2(buf, exponent)) != 0)
2673 goto out; 2767 goto out;
@@ -2697,8 +2791,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2697 break; 2791 break;
2698 case KEY_RSA_CERT_V00: 2792 case KEY_RSA_CERT_V00:
2699 case KEY_RSA_CERT: 2793 case KEY_RSA_CERT:
2700 if ((r = sshbuf_get_string_direct(buf, &cert, &len)) != 0 || 2794 if ((r = sshkey_froms(buf, &k)) != 0 ||
2701 (r = sshkey_from_blob(cert, len, &k)) != 0 ||
2702 (r = sshkey_add_private(k)) != 0 || 2795 (r = sshkey_add_private(k)) != 0 ||
2703 (r = sshbuf_get_bignum2(buf, k->rsa->d) != 0) || 2796 (r = sshbuf_get_bignum2(buf, k->rsa->d) != 0) ||
2704 (r = sshbuf_get_bignum2(buf, k->rsa->iqmp) != 0) || 2797 (r = sshbuf_get_bignum2(buf, k->rsa->iqmp) != 0) ||
@@ -2725,8 +2818,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2725 ed25519_pk = ed25519_sk = NULL; 2818 ed25519_pk = ed25519_sk = NULL;
2726 break; 2819 break;
2727 case KEY_ED25519_CERT: 2820 case KEY_ED25519_CERT:
2728 if ((r = sshbuf_get_string_direct(buf, &cert, &len)) != 0 || 2821 if ((r = sshkey_froms(buf, &k)) != 0 ||
2729 (r = sshkey_from_blob(cert, len, &k)) != 0 ||
2730 (r = sshkey_add_private(k)) != 0 || 2822 (r = sshkey_add_private(k)) != 0 ||
2731 (r = sshbuf_get_string(buf, &ed25519_pk, &pklen)) != 0 || 2823 (r = sshbuf_get_string(buf, &ed25519_pk, &pklen)) != 0 ||
2732 (r = sshbuf_get_string(buf, &ed25519_sk, &sklen)) != 0) 2824 (r = sshbuf_get_string(buf, &ed25519_sk, &sklen)) != 0)
@@ -2952,8 +3044,9 @@ sshkey_private_to_blob2(const struct sshkey *prv, struct sshbuf *blob,
2952 const char *passphrase, const char *comment, const char *ciphername, 3044 const char *passphrase, const char *comment, const char *ciphername,
2953 int rounds) 3045 int rounds)
2954{ 3046{
2955 u_char *cp, *b64 = NULL, *key = NULL, *pubkeyblob = NULL; 3047 u_char *cp, *key = NULL, *pubkeyblob = NULL;
2956 u_char salt[SALT_LEN]; 3048 u_char salt[SALT_LEN];
3049 char *b64 = NULL;
2957 size_t i, pubkeylen, keylen, ivlen, blocksize, authlen; 3050 size_t i, pubkeylen, keylen, ivlen, blocksize, authlen;
2958 u_int check; 3051 u_int check;
2959 int r = SSH_ERR_INTERNAL_ERROR; 3052 int r = SSH_ERR_INTERNAL_ERROR;
@@ -3165,7 +3258,7 @@ sshkey_parse_private2(struct sshbuf *blob, int type, const char *passphrase,
3165 } 3258 }
3166 3259
3167 /* decode base64 */ 3260 /* decode base64 */
3168 if ((r = sshbuf_b64tod(decoded, sshbuf_ptr(encoded))) != 0) 3261 if ((r = sshbuf_b64tod(decoded, (char *)sshbuf_ptr(encoded))) != 0)
3169 goto out; 3262 goto out;
3170 3263
3171 /* check magic */ 3264 /* check magic */
@@ -3481,10 +3574,12 @@ sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
3481 int force_new_format, const char *new_format_cipher, int new_format_rounds) 3574 int force_new_format, const char *new_format_cipher, int new_format_rounds)
3482{ 3575{
3483 switch (key->type) { 3576 switch (key->type) {
3484#ifdef WITH_OPENSSL 3577#ifdef WITH_SSH1
3485 case KEY_RSA1: 3578 case KEY_RSA1:
3486 return sshkey_private_rsa1_to_blob(key, blob, 3579 return sshkey_private_rsa1_to_blob(key, blob,
3487 passphrase, comment); 3580 passphrase, comment);
3581#endif /* WITH_SSH1 */
3582#ifdef WITH_OPENSSL
3488 case KEY_DSA: 3583 case KEY_DSA:
3489 case KEY_ECDSA: 3584 case KEY_ECDSA:
3490 case KEY_RSA: 3585 case KEY_RSA:
@@ -3690,20 +3785,16 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase,
3690#endif /* WITH_SSH1 */ 3785#endif /* WITH_SSH1 */
3691 3786
3692#ifdef WITH_OPENSSL 3787#ifdef WITH_OPENSSL
3693/* XXX make private once ssh-keysign.c fixed */ 3788static int
3694int
3695sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, 3789sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3696 const char *passphrase, struct sshkey **keyp, char **commentp) 3790 const char *passphrase, struct sshkey **keyp)
3697{ 3791{
3698 EVP_PKEY *pk = NULL; 3792 EVP_PKEY *pk = NULL;
3699 struct sshkey *prv = NULL; 3793 struct sshkey *prv = NULL;
3700 char *name = "<no key>";
3701 BIO *bio = NULL; 3794 BIO *bio = NULL;
3702 int r; 3795 int r;
3703 3796
3704 *keyp = NULL; 3797 *keyp = NULL;
3705 if (commentp != NULL)
3706 *commentp = NULL;
3707 3798
3708 if ((bio = BIO_new(BIO_s_mem())) == NULL || sshbuf_len(blob) > INT_MAX) 3799 if ((bio = BIO_new(BIO_s_mem())) == NULL || sshbuf_len(blob) > INT_MAX)
3709 return SSH_ERR_ALLOC_FAIL; 3800 return SSH_ERR_ALLOC_FAIL;
@@ -3726,7 +3817,6 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3726 } 3817 }
3727 prv->rsa = EVP_PKEY_get1_RSA(pk); 3818 prv->rsa = EVP_PKEY_get1_RSA(pk);
3728 prv->type = KEY_RSA; 3819 prv->type = KEY_RSA;
3729 name = "rsa w/o comment";
3730#ifdef DEBUG_PK 3820#ifdef DEBUG_PK
3731 RSA_print_fp(stderr, prv->rsa, 8); 3821 RSA_print_fp(stderr, prv->rsa, 8);
3732#endif 3822#endif
@@ -3742,7 +3832,6 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3742 } 3832 }
3743 prv->dsa = EVP_PKEY_get1_DSA(pk); 3833 prv->dsa = EVP_PKEY_get1_DSA(pk);
3744 prv->type = KEY_DSA; 3834 prv->type = KEY_DSA;
3745 name = "dsa w/o comment";
3746#ifdef DEBUG_PK 3835#ifdef DEBUG_PK
3747 DSA_print_fp(stderr, prv->dsa, 8); 3836 DSA_print_fp(stderr, prv->dsa, 8);
3748#endif 3837#endif
@@ -3764,7 +3853,6 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3764 r = SSH_ERR_INVALID_FORMAT; 3853 r = SSH_ERR_INVALID_FORMAT;
3765 goto out; 3854 goto out;
3766 } 3855 }
3767 name = "ecdsa w/o comment";
3768# ifdef DEBUG_PK 3856# ifdef DEBUG_PK
3769 if (prv != NULL && prv->ecdsa != NULL) 3857 if (prv != NULL && prv->ecdsa != NULL)
3770 sshkey_dump_ec_key(prv->ecdsa); 3858 sshkey_dump_ec_key(prv->ecdsa);
@@ -3774,11 +3862,6 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3774 r = SSH_ERR_INVALID_FORMAT; 3862 r = SSH_ERR_INVALID_FORMAT;
3775 goto out; 3863 goto out;
3776 } 3864 }
3777 if (commentp != NULL &&
3778 (*commentp = strdup(name)) == NULL) {
3779 r = SSH_ERR_ALLOC_FAIL;
3780 goto out;
3781 }
3782 r = 0; 3865 r = 0;
3783 *keyp = prv; 3866 *keyp = prv;
3784 prv = NULL; 3867 prv = NULL;
@@ -3803,15 +3886,17 @@ sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
3803 *commentp = NULL; 3886 *commentp = NULL;
3804 3887
3805 switch (type) { 3888 switch (type) {
3806#ifdef WITH_OPENSSL 3889#ifdef WITH_SSH1
3807 case KEY_RSA1: 3890 case KEY_RSA1:
3808 return sshkey_parse_private_rsa1(blob, passphrase, 3891 return sshkey_parse_private_rsa1(blob, passphrase,
3809 keyp, commentp); 3892 keyp, commentp);
3893#endif /* WITH_SSH1 */
3894#ifdef WITH_OPENSSL
3810 case KEY_DSA: 3895 case KEY_DSA:
3811 case KEY_ECDSA: 3896 case KEY_ECDSA:
3812 case KEY_RSA: 3897 case KEY_RSA:
3813 return sshkey_parse_private_pem_fileblob(blob, type, passphrase, 3898 return sshkey_parse_private_pem_fileblob(blob, type,
3814 keyp, commentp); 3899 passphrase, keyp);
3815#endif /* WITH_OPENSSL */ 3900#endif /* WITH_OPENSSL */
3816 case KEY_ED25519: 3901 case KEY_ED25519:
3817 return sshkey_parse_private2(blob, type, passphrase, 3902 return sshkey_parse_private2(blob, type, passphrase,
@@ -3821,8 +3906,8 @@ sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
3821 commentp)) == 0) 3906 commentp)) == 0)
3822 return 0; 3907 return 0;
3823#ifdef WITH_OPENSSL 3908#ifdef WITH_OPENSSL
3824 return sshkey_parse_private_pem_fileblob(blob, type, passphrase, 3909 return sshkey_parse_private_pem_fileblob(blob, type,
3825 keyp, commentp); 3910 passphrase, keyp);
3826#else 3911#else
3827 return SSH_ERR_INVALID_FORMAT; 3912 return SSH_ERR_INVALID_FORMAT;
3828#endif /* WITH_OPENSSL */ 3913#endif /* WITH_OPENSSL */
diff --git a/sshkey.h b/sshkey.h
index 450b30c1f..62c1c3e2f 100644
--- a/sshkey.h
+++ b/sshkey.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.h,v 1.1 2014/06/24 01:16:58 djm Exp $ */ 1/* $OpenBSD: sshkey.h,v 1.5 2015/01/26 02:59:11 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -67,16 +67,14 @@ enum sshkey_types {
67 KEY_UNSPEC 67 KEY_UNSPEC
68}; 68};
69 69
70/* Fingerprint hash algorithms */ 70/* Default fingerprint hash */
71enum sshkey_fp_type { 71#define SSH_FP_HASH_DEFAULT SSH_DIGEST_SHA256
72 SSH_FP_SHA1,
73 SSH_FP_MD5,
74 SSH_FP_SHA256
75};
76 72
77/* Fingerprint representation formats */ 73/* Fingerprint representation formats */
78enum sshkey_fp_rep { 74enum sshkey_fp_rep {
75 SSH_FP_DEFAULT = 0,
79 SSH_FP_HEX, 76 SSH_FP_HEX,
77 SSH_FP_BASE64,
80 SSH_FP_BUBBLEBABBLE, 78 SSH_FP_BUBBLEBABBLE,
81 SSH_FP_RANDOMART 79 SSH_FP_RANDOMART
82}; 80};
@@ -124,9 +122,9 @@ int sshkey_equal_public(const struct sshkey *,
124 const struct sshkey *); 122 const struct sshkey *);
125int sshkey_equal(const struct sshkey *, const struct sshkey *); 123int sshkey_equal(const struct sshkey *, const struct sshkey *);
126char *sshkey_fingerprint(const struct sshkey *, 124char *sshkey_fingerprint(const struct sshkey *,
127 enum sshkey_fp_type, enum sshkey_fp_rep); 125 int, enum sshkey_fp_rep);
128int sshkey_fingerprint_raw(const struct sshkey *k, 126int sshkey_fingerprint_raw(const struct sshkey *k,
129 enum sshkey_fp_type dgst_type, u_char **retp, size_t *lenp); 127 int, u_char **retp, size_t *lenp);
130const char *sshkey_type(const struct sshkey *); 128const char *sshkey_type(const struct sshkey *);
131const char *sshkey_cert_type(const struct sshkey *); 129const char *sshkey_cert_type(const struct sshkey *);
132int sshkey_write(const struct sshkey *, FILE *); 130int sshkey_write(const struct sshkey *, FILE *);
@@ -158,14 +156,17 @@ int sshkey_ec_validate_public(const EC_GROUP *, const EC_POINT *);
158int sshkey_ec_validate_private(const EC_KEY *); 156int sshkey_ec_validate_private(const EC_KEY *);
159const char *sshkey_ssh_name(const struct sshkey *); 157const char *sshkey_ssh_name(const struct sshkey *);
160const char *sshkey_ssh_name_plain(const struct sshkey *); 158const char *sshkey_ssh_name_plain(const struct sshkey *);
161int sshkey_names_valid2(const char *); 159int sshkey_names_valid2(const char *, int);
162char *key_alg_list(int, int); 160char *key_alg_list(int, int);
163 161
164int sshkey_from_blob(const u_char *, size_t, struct sshkey **); 162int sshkey_from_blob(const u_char *, size_t, struct sshkey **);
165int sshkey_to_blob_buf(const struct sshkey *, struct sshbuf *); 163int sshkey_fromb(struct sshbuf *, struct sshkey **);
164int sshkey_froms(struct sshbuf *, struct sshkey **);
166int sshkey_to_blob(const struct sshkey *, u_char **, size_t *); 165int sshkey_to_blob(const struct sshkey *, u_char **, size_t *);
167int sshkey_plain_to_blob_buf(const struct sshkey *, struct sshbuf *); 166int sshkey_putb(const struct sshkey *, struct sshbuf *);
167int sshkey_puts(const struct sshkey *, struct sshbuf *);
168int sshkey_plain_to_blob(const struct sshkey *, u_char **, size_t *); 168int sshkey_plain_to_blob(const struct sshkey *, u_char **, size_t *);
169int sshkey_putb_plain(const struct sshkey *, struct sshbuf *);
169 170
170int sshkey_sign(const struct sshkey *, u_char **, size_t *, 171int sshkey_sign(const struct sshkey *, u_char **, size_t *,
171 const u_char *, size_t, u_int); 172 const u_char *, size_t, u_int);
@@ -186,8 +187,6 @@ int sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
186 int force_new_format, const char *new_format_cipher, int new_format_rounds); 187 int force_new_format, const char *new_format_cipher, int new_format_rounds);
187int sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob, 188int sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob,
188 struct sshkey **keyp, char **commentp); 189 struct sshkey **keyp, char **commentp);
189int sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
190 const char *passphrase, struct sshkey **keyp, char **commentp);
191int sshkey_parse_private_fileblob(struct sshbuf *buffer, 190int sshkey_parse_private_fileblob(struct sshbuf *buffer,
192 const char *passphrase, const char *filename, struct sshkey **keyp, 191 const char *passphrase, const char *filename, struct sshkey **keyp,
193 char **commentp); 192 char **commentp);
diff --git a/sshlogin.c b/sshlogin.c
index 7b951c844..818312ff1 100644
--- a/sshlogin.c
+++ b/sshlogin.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshlogin.c,v 1.29 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: sshlogin.c,v 1.31 2015/01/20 23:14:00 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -42,7 +42,6 @@
42#include "includes.h" 42#include "includes.h"
43 43
44#include <sys/types.h> 44#include <sys/types.h>
45#include <sys/param.h>
46#include <sys/socket.h> 45#include <sys/socket.h>
47 46
48#include <netinet/in.h> 47#include <netinet/in.h>
@@ -54,6 +53,7 @@
54#include <string.h> 53#include <string.h>
55#include <time.h> 54#include <time.h>
56#include <unistd.h> 55#include <unistd.h>
56#include <limits.h>
57 57
58#include "loginrec.h" 58#include "loginrec.h"
59#include "log.h" 59#include "log.h"
@@ -88,7 +88,7 @@ static void
88store_lastlog_message(const char *user, uid_t uid) 88store_lastlog_message(const char *user, uid_t uid)
89{ 89{
90#ifndef NO_SSH_LASTLOG 90#ifndef NO_SSH_LASTLOG
91 char *time_string, hostname[MAXHOSTNAMELEN] = "", buf[512]; 91 char *time_string, hostname[HOST_NAME_MAX+1] = "", buf[512];
92 time_t last_login_time; 92 time_t last_login_time;
93 93
94 if (!options.print_lastlog) 94 if (!options.print_lastlog)
diff --git a/sshpty.c b/sshpty.c
index a2059b76d..d2ff8c16a 100644
--- a/sshpty.c
+++ b/sshpty.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshpty.c,v 1.28 2007/09/11 23:49:09 stevesk Exp $ */ 1/* $OpenBSD: sshpty.c,v 1.29 2014/09/03 18:55:07 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -196,13 +196,8 @@ pty_setowner(struct passwd *pw, const char *tty)
196 196
197 /* Determine the group to make the owner of the tty. */ 197 /* Determine the group to make the owner of the tty. */
198 grp = getgrnam("tty"); 198 grp = getgrnam("tty");
199 if (grp) { 199 gid = (grp != NULL) ? grp->gr_gid : pw->pw_gid;
200 gid = grp->gr_gid; 200 mode = (grp != NULL) ? 0622 : 0600;
201 mode = S_IRUSR | S_IWUSR | S_IWGRP;
202 } else {
203 gid = pw->pw_gid;
204 mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH;
205 }
206 201
207 /* 202 /*
208 * Change owner and mode of the tty as required. 203 * Change owner and mode of the tty as required.
diff --git a/uidswap.c b/uidswap.c
index 1f09d5887..c339283af 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: uidswap.c,v 1.36 2013/11/08 11:15:19 dtucker Exp $ */ 1/* $OpenBSD: uidswap.c,v 1.37 2015/01/16 06:40:12 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -14,11 +14,11 @@
14 14
15#include "includes.h" 15#include "includes.h"
16 16
17#include <sys/param.h>
18#include <errno.h> 17#include <errno.h>
19#include <pwd.h> 18#include <pwd.h>
20#include <string.h> 19#include <string.h>
21#include <unistd.h> 20#include <unistd.h>
21#include <limits.h>
22#include <stdarg.h> 22#include <stdarg.h>
23#include <stdlib.h> 23#include <stdlib.h>
24 24
diff --git a/version.h b/version.h
index cc8a079a9..dfe3ee996 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
1/* $OpenBSD: version.h,v 1.71 2014/04/18 23:52:25 djm Exp $ */ 1/* $OpenBSD: version.h,v 1.72 2015/03/04 18:53:53 djm Exp $ */
2 2
3#define SSH_VERSION "OpenSSH_6.7" 3#define SSH_VERSION "OpenSSH_6.8"
4 4
5#define SSH_PORTABLE "p1" 5#define SSH_PORTABLE "p1"
6#define SSH_RELEASE SSH_VERSION SSH_PORTABLE 6#define SSH_RELEASE SSH_VERSION SSH_PORTABLE
diff --git a/xmalloc.c b/xmalloc.c
index 2f1cd2306..cd59dc2e5 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: xmalloc.c,v 1.29 2014/01/04 17:50:55 tedu Exp $ */ 1/* $OpenBSD: xmalloc.c,v 1.31 2015/02/06 23:21:59 millert Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -15,8 +15,10 @@
15 15
16#include "includes.h" 16#include "includes.h"
17 17
18#include <sys/param.h>
19#include <stdarg.h> 18#include <stdarg.h>
19#ifdef HAVE_STDINT_H
20#include <stdint.h>
21#endif
20#include <stdio.h> 22#include <stdio.h>
21#include <stdlib.h> 23#include <stdlib.h>
22#include <string.h> 24#include <string.h>
@@ -44,8 +46,8 @@ xcalloc(size_t nmemb, size_t size)
44 46
45 if (size == 0 || nmemb == 0) 47 if (size == 0 || nmemb == 0)
46 fatal("xcalloc: zero size"); 48 fatal("xcalloc: zero size");
47 if (SIZE_T_MAX / nmemb < size) 49 if (SIZE_MAX / nmemb < size)
48 fatal("xcalloc: nmemb * size > SIZE_T_MAX"); 50 fatal("xcalloc: nmemb * size > SIZE_MAX");
49 ptr = calloc(nmemb, size); 51 ptr = calloc(nmemb, size);
50 if (ptr == NULL) 52 if (ptr == NULL)
51 fatal("xcalloc: out of memory (allocating %zu bytes)", 53 fatal("xcalloc: out of memory (allocating %zu bytes)",
@@ -61,8 +63,8 @@ xrealloc(void *ptr, size_t nmemb, size_t size)
61 63
62 if (new_size == 0) 64 if (new_size == 0)
63 fatal("xrealloc: zero size"); 65 fatal("xrealloc: zero size");
64 if (SIZE_T_MAX / nmemb < size) 66 if (SIZE_MAX / nmemb < size)
65 fatal("xrealloc: nmemb * size > SIZE_T_MAX"); 67 fatal("xrealloc: nmemb * size > SIZE_MAX");
66 if (ptr == NULL) 68 if (ptr == NULL)
67 new_ptr = malloc(new_size); 69 new_ptr = malloc(new_size);
68 else 70 else